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 DataPool do
@moduledoc """
Provides a blocking data storage and retrival data pool. The basic idea
behind DataPool is to allow producers to fill the pool up and block on
adding more items once it's limit is reached. On the flip side, consumers
of the data block when the pool is empty.
"""
alia... | lib/data_pool.ex | 0.820397 | 0.508788 | data_pool.ex | starcoder |
defmodule Staxx.ExChain.EVM.State do
@moduledoc """
Default structure for handling state into any EVM implementation
Consist of this properties:
- `status` - Chain status
- `locked` - Identify if chain is locked or not
- `task` - Task scheduled for execution after chain stop
- `config` - default conf... | apps/ex_chain/lib/ex_chain/evm/state.ex | 0.8308 | 0.719112 | state.ex | starcoder |
defmodule Mix.Generator do
@moduledoc """
Conveniences for working with paths and generating content.
All of these functions are verbose, in the sense they log
the action to be performed via `Mix.shell/0`.
"""
@doc ~S"""
Creates a file with the given contents.
If the file already exists, asks for user... | lib/mix/lib/mix/generator.ex | 0.812459 | 0.474875 | generator.ex | starcoder |
defmodule ExDoc.Formatter.EPUB.Templates do
@moduledoc false
require EEx
alias ExDoc.Formatter.HTML
alias ExDoc.Formatter.HTML.Templates, as: H
@doc """
Generate content from the module template for a given `node`
"""
def module_page(config, module_node) do
summary_map = H.group_summary(module_no... | lib/ex_doc/formatter/epub/templates.ex | 0.761184 | 0.416797 | templates.ex | starcoder |
defmodule LibJudge.Rule do
@moduledoc """
Defines the `Rule` structure and provides methods for generating
and working with them
"""
import LibJudge.Tokenizer.Guards
alias LibJudge.Rule.InvalidPartError
@type rule_type :: :category | :subcategory | :rule | :subrule
@type t :: %__MODULE__{
cat... | lib/lib_judge/rule.ex | 0.790166 | 0.542379 | rule.ex | starcoder |
defmodule Ecto.Query.OrderByBuilder do
@moduledoc false
alias Ecto.Query.BuilderUtil
@doc """
Escapes an order by query.
The query is escaped to a list of `{ direction, var, field }`
pairs at runtime. Escaping also validates direction is one of
`:asc` or `:desc`.
## Examples
iex> escape(quote... | lib/ecto/query/order_by_builder.ex | 0.877102 | 0.503601 | order_by_builder.ex | starcoder |
defmodule Feedbuilder do
@moduledoc """
Feedbuilder is an Elixir library for generating XML Feeds using Streams.
It currently supports three feed formats:
* [XML Sitemaps](https://www.sitemaps.org)
* [Google Merchant](https://support.google.com/merchants/answer/160567?hl=en&ref_topic=3163841)
Inspiration ... | lib/feedbuilder.ex | 0.772874 | 0.525369 | feedbuilder.ex | starcoder |
defmodule Forage.Codec.Encoder do
@moduledoc """
Functionality to encode a `Forage.Plan` into a Phoenix `param` map
for use with the `ApplicationWeb.Router.Helpers`.
"""
alias Forage.ForagePlan
@doc """
Encodes a forage plan into a params map.
This function doesn't need to take the schema as an argume... | lib/forage/codec/encoder.ex | 0.869146 | 0.630756 | encoder.ex | starcoder |
defmodule Chunkr.PaginationPlanner do
@moduledoc """
Provides a set of macros for generating functions to assist with paginating queries. For example:
defmodule MyApp.PaginationPlanner do
use Chunkr.PaginationPlanner
paginate_by :user_created_at do
sort :desc, as(:user).inserted_at... | lib/chunkr/pagination_planner.ex | 0.843992 | 0.798187 | pagination_planner.ex | starcoder |
defmodule FunctionDecorating do
@moduledoc """
Add a function decorating availability to a module.
## Usage
Decorating in dev with log decorator.
```elixir
defmodule User do
use FunctionDecorating
decorate_fn_with(LogDecorator)
def say(word) do
word
end
end
iex >User.say("hell... | lib/function_decorating.ex | 0.539226 | 0.810066 | function_decorating.ex | starcoder |
defmodule Regex do
@moduledoc %S"""
Regular expressions for Elixir built on top of the `re` module
in the Erlang Standard Library. More information can be found
in the [`re` documentation](http://www.erlang.org/doc/man/re.html).
Regular expressions in Elixir can be created using `Regex.compile!`
or using t... | lib/elixir/lib/regex.ex | 0.918485 | 0.713843 | regex.ex | starcoder |
defmodule Annon.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
## Credentials
Most of source code is a copy-paste from `Phoenix.ConnTest`,
it's already contains great tests suite, but we don't
want to depend on Phoenix.
## Endpoi... | test/support/conn_case.ex | 0.853364 | 0.555134 | conn_case.ex | starcoder |
defmodule Hulaaki do
alias Hulaaki.Message
alias Hulaaki.Encoder
alias Hulaaki.Decoder
@moduledoc """
Defines Packet protocol and provides implementations for Hulaaki Messages
"""
defprotocol Packet do
@moduledoc """
Defines the protocol Packet to encode/decode a Hulaaki Message
"""
@do... | lib/hulaaki.ex | 0.837021 | 0.431285 | hulaaki.ex | starcoder |
defmodule Eikon.PNG do
@moduledoc "A struct that holds several informations about a PNG file"
@typedoc """
A struct with the following fields:
- :bit_depth
- :chunks
- :color_type
- :compressionfilter
- :height
- :interlace
- :width
"""
@type t :: struct
defstruct [
:width,
:height,
... | lib/eikon/png_parser.ex | 0.809803 | 0.451387 | png_parser.ex | starcoder |
defmodule Snap.HTTPClient do
@moduledoc """
Behaviour for the HTTP client used by the `Snap.Cluster`.
By default, it uses the `Snap.HTTPClient.Adapters.Finch` for making requests.
You can configure the Cluster with your own adapter:
```
config :my_app, MyApp.Cluster,
http_client_adapter: MyHTTPClient... | lib/snap/http_client/http_client.ex | 0.894234 | 0.599514 | http_client.ex | starcoder |
defmodule CloudfrontSigner do
@moduledoc """
Elixir implementation of cloudfront's signed url algorithm. Basic usage is:
```
CloudfrontSigner.Distribution.from_config(:scope, :key)
|> CloudfrontSigner.sign("some/path", [arg: "val"], some_expiry)
```
"""
alias CloudfrontSigner.{Distribution, Policy, Si... | lib/cloudfront_signer.ex | 0.868827 | 0.737584 | cloudfront_signer.ex | starcoder |
defmodule FakeStatsd do
@moduledoc """
A fake stats server.
This statsd server will parse incoming statsd calls and forward them to the process
send into its start_link function.
"""
use GenServer
def start_link(test_process) do
GenServer.start_link(__MODULE__, [test_process], name: __MODULE__)
en... | test/support/fake_statsd.ex | 0.72331 | 0.47926 | fake_statsd.ex | starcoder |
defmodule XMLParser.Elements do
@moduledoc """
Used for parsing the elements in the XML.
"""
@doc """
- `map` must be a [Map](https://hexdocs.pm/elixir/Map.html) where the elements data will be appended.
- `elements` must be the list containing the structure [{root, attributes, elements}, ...]
- `root... | lib/elements.ex | 0.835383 | 0.775605 | elements.ex | starcoder |
defmodule Bolt.Sips.Routing.RoutingTable do
@moduledoc ~S"""
representing the routing table elements
There are a couple of ways to get the routing table from the server, for recent Neo4j servers, and with the
latest version of Bolt.Sips, you could use this query:
Bolt.Sips.query!(Bolt.Sips.conn, "call d... | lib/bolt_sips/routing/routing_table.ex | 0.793586 | 0.403802 | routing_table.ex | starcoder |
defmodule Grizzly.ZWave.Commands.BatteryReport do
@moduledoc """
This module implements the BATTERY_REPORT command of the COMMAND_CLASS_BATTERY
command class.
Params:
* `:level` - percent charged - v1
* `:charging_status` - whether charging, discharging or maintaining - v2
* `:rechargeable` - whet... | lib/grizzly/zwave/commands/battery_report.ex | 0.860911 | 0.566438 | battery_report.ex | starcoder |
defmodule BitPal.ViewHelpers do
alias BitPalSchemas.Invoice
@spec money_to_string(Money.t()) :: String.t()
def money_to_string(money) do
Money.to_string(money,
strip_insignificant_zeros: true,
symbol_on_right: true,
symbol_space: true
)
end
@spec render_qrcode(Invoice.t(), keyword)... | lib/bitpal/view_helpers.ex | 0.846958 | 0.408247 | view_helpers.ex | starcoder |
defmodule EarlFormatter do
@moduledoc """
An `ExUnit.Formatter` implementation that generates EARL reports.
see <https://www.w3.org/TR/EARL10-Schema/>
"""
use GenServer
defmodule NS do
use RDF.Vocabulary.Namespace
defvocab EARL, base_iri: "http://www.w3.org/ns/earl#", terms: [], strict: false
... | test/support/earl_formatter.ex | 0.750827 | 0.452717 | earl_formatter.ex | starcoder |
defmodule Legion.Location.Geocode do
@moduledoc """
Represents information about a location geocode. A geocode is a locational
estimation of a location identified by a connection artifact or such.
The data can be mostly used to analytic purposes, rather than transactional
operations.
"""
@enforce_keys ~w(... | apps/legion/lib/location/geocode.ex | 0.917409 | 0.669957 | geocode.ex | starcoder |
defmodule ShouldI.Matchers.Plug do
@moduledoc """
Convenience macros for generating short test cases of common structure.
These matchers work with Plug connections.
"""
import ExUnit.Assertions
import ShouldI.Matcher
alias ShouldI.Matchers.Plug
@doc """
The connection status (connection.status) shou... | lib/shouldi/matchers/plug.ex | 0.862945 | 0.539711 | plug.ex | starcoder |
defmodule ExZenHub.Parser do
@moduledoc """
Turn responses from ZenHub into structs
"""
@nested_resources ~w(pipeline pipelines issues epic_issues)a
alias ExZenHub.{Board, Pipeline, Issue, EpicIssue, Event, Epic}
@spec check_nested_resources(Map.t | any()) :: Map.t
def check_nested_resources(object) when... | lib/ex_zenhub/parser.ex | 0.594669 | 0.406479 | parser.ex | starcoder |
defmodule CloudflareStream.TusClient do
@moduledoc """
A minimal client for the https://tus.io protocol. With fixes for working with cloudflare
"""
alias CloudflareStream.TusClient.{Post, Patch}
require Logger
@type upload_error ::
:file_error
| :generic
| :location
... | lib/cloudflare_stream/tus/tus_client.ex | 0.887479 | 0.531209 | tus_client.ex | starcoder |
defmodule Rummage.Ecto do
@moduledoc ~S"""
Rummage.Ecto is a light weight, but powerful framework that can be used to alter Ecto
queries with Search, Sort and Paginate operations.
It accomplishes the above operations by using `Hooks`, which are modules that
implement `Rumamge.Ecto.Hook` behavior. Each operat... | lib/rummage_ecto.ex | 0.71413 | 0.845879 | rummage_ecto.ex | starcoder |
defmodule AdaptableCostsEvaluatorWeb.InputController do
use AdaptableCostsEvaluatorWeb, :controller
use OpenApiSpex.ControllerSpecs
import AdaptableCostsEvaluatorWeb.Helpers.AuthHelper, only: [current_user: 1]
alias AdaptableCostsEvaluator.{Inputs, Computations}
alias AdaptableCostsEvaluator.Inputs.Input
... | lib/adaptable_costs_evaluator_web/controllers/input_controller.ex | 0.720172 | 0.419024 | input_controller.ex | starcoder |
import TypeClass
defclass Witchcraft.Functor do
@moduledoc ~S"""
Functors are datatypes that allow the application of functions to their interior values.
Always returns data in the same structure (same size, tree layout, and so on).
Please note that bitstrings are not functors, as they fail the
functor comp... | lib/witchcraft/functor.ex | 0.790813 | 0.674314 | functor.ex | starcoder |
defmodule Adap.Unit do
@moduledoc "Behaviour describing an ADAP distributed processing unit"
use Behaviour
defcallback start_link(args :: term) :: {:ok,pid}
defcallback cast(pid,fun) :: :ok
defcallback node(args :: term) :: node
end
defmodule Adap.Unit.Router do
@moduledoc """
Route element to a node/pro... | lib/unit.ex | 0.782953 | 0.510252 | unit.ex | starcoder |
defmodule PlugPreferredLocales do
@moduledoc """
PlugPreferredLocales is a plug to parse the `"accept-language"` header and
store a list of preferred locales in the `:private` key of the
`%Plug.Conn{}`.
## Options
The following options are supported:
* `:ignore_area` - Determines wether to ignore the a... | lib/plug_preferred_locales.ex | 0.842313 | 0.508666 | plug_preferred_locales.ex | starcoder |
defmodule Exceptional.Safe do
@moduledoc ~S"""
Convert a function that may `raise` into one that returns an exception struct
"""
defdelegate lower(dangeroud_fun), to: __MODULE__, as: :safe
defdelegate lower(dangeroud_fun, dynamic), to: __MODULE__, as: :safe
defmacro __using__(_) do
quote do
... | deps/exceptional/lib/exceptional/safe.ex | 0.696062 | 0.582372 | safe.ex | starcoder |
defmodule FarmbotFirmware.Param do
@moduledoc "decodes/encodes integer id to name and vice versa"
require Logger
@type t() :: atom()
@doc "Decodes an integer parameter id to a atom parameter name"
def decode(parameter_id)
def decode(0), do: :param_version
def decode(1), do: :param_test
def decode(2), ... | farmbot_firmware/lib/farmbot_firmware/param.ex | 0.668772 | 0.600364 | param.ex | starcoder |
defmodule Phoenix.Swoosh do
@moduledoc """
The main feature provided by this module is the ability to set the HTML and/or
text body of an email by rendering templates.
It utilizes `Phoenix.View` and can work very well both standalone
and in apps using `Phoenix` framework.
"""
import Swoosh.Email
defm... | lib/phoenix_swoosh.ex | 0.876502 | 0.494934 | phoenix_swoosh.ex | starcoder |
defmodule SilentVideo do
alias SilentVideo.Presets
@doc """
Convert using high compatibility settings for mobile devices.
Options:
* `:width` - An integer width for the output video. Defaults to input width.
* `:height` - An integer height for the output video. Defaults to input height.
* `:max_width` ... | lib/silent_video.ex | 0.909448 | 0.731922 | silent_video.ex | starcoder |
defmodule Delugex.EventTransformer do
@moduledoc """
Helps converting from a raw event. A raw event is basically a map as
it comes from the database.
It's a behavior (fill-in the types for callbacks)
It can be "used" with `use Delugex.EventTransformer` which would:
- @behavior Delugex.EventTransformer
-... | lib/delugex/event_transformer.ex | 0.767994 | 0.413152 | event_transformer.ex | starcoder |
defmodule Repo do
@moduledoc ~S"""
Stores and manages writes of new items.
Creates two ets tables, `:repo` where the unique numbers are stored
and `:counter` that contains a single element, a tuple
`{:duplicates, integer()}` with the count of duplicate nine digits
items received.
On init it cleans the f... | lib/repo.ex | 0.820793 | 0.558929 | repo.ex | starcoder |
defmodule Core.DataModel.Table.Bundle do
@moduledoc """
This is a CQL table schema for bundle,
Please Check The following link for more details about DataTypes
https://docs.scylladb.com/getting-started/types/
:bundle is the table name,
:bh is a bundle_hash alias, and also the partition_key(pk),... | apps/core/lib/data_model/table/bundle.ex | 0.612426 | 0.793706 | bundle.ex | starcoder |
defmodule TimeCalc.DailyTasks do
@moduledoc """
Module for managing activities.
"""
def make_date({"h1", [], [date_text], _}) do
{:ok, partial_date} = TimeCalc.DateTimeParser.parse_date_text(date_text)
%Date{partial_date | year: NaiveDateTime.local_now().year}
end
def make_start_time(start_time_of... | lib/time_calc/daily_tasks.ex | 0.675336 | 0.401981 | daily_tasks.ex | starcoder |
defmodule Architect.Projects.Blueprint do
@moduledoc """
Represents a blueprint in Velocity
Currently only root level properties are parsed.
The properties in this root struct contain raw maps with string keys for all properties
"""
defstruct [:name, :description, :git, :docker, :parameters]
@enforce_k... | architect/lib/architect/projects/blueprint.ex | 0.798108 | 0.494385 | blueprint.ex | starcoder |
defmodule EpicenterWeb.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build common data structures and query the data layer.
Finally, if ... | test/support/conn_case.ex | 0.74872 | 0.405419 | conn_case.ex | starcoder |
defmodule Plugmap.DSL do
@moduledoc """
This is the DSL sitemap module.
"""
alias Plugmap.Generator
@doc false
defmacro __using__(_opts) do
quote do
import Plugmap.DSL
end
end
@doc """
Create function which generate sitemap xml.
Returns `Plug.C... | lib/plugmap/dsl.ex | 0.8339 | 0.730866 | dsl.ex | starcoder |
defmodule Advent2019Web.Day08Controller do
use Advent2019Web, :controller
@doc """
Given a space image converts it to a list of layers.
The input is a map with w and h parameters defining the size of an image.
Then the rawImage parameter defines the content, in reading order,
of N layers. Every digit is a ... | lib/advent2019_web/controllers/day08_controller.ex | 0.791136 | 0.591605 | day08_controller.ex | starcoder |
defmodule Serum.HeaderParser do
@moduledoc """
This module takes care of parsing headers of page (or post) source files.
Header is where all page or post metadata goes into, and has the following
format:
```
---
key: value
...
---
```
where `---` in the first and last line delimits the beginnin... | lib/serum/header_parser.ex | 0.864511 | 0.847274 | header_parser.ex | starcoder |
defmodule FlightSimulator do
import Geocalc
@moduledoc """
The state of a simulated aircraft with ability to control basic parameters and
update them over time.
## Units
- All angles are expressed in degrees (and are converted to radians internally when needed)
- All distances are expressed in metres
... | lib/groundstation/flight_simulator.ex | 0.916051 | 0.77518 | flight_simulator.ex | starcoder |
defmodule MerkleMap do
@moduledoc """
MerkleMap is a drop-in replacement for Map that optimizes certain operations, making heavy use of Merkle Trees.
"""
alias MerkleMap.MerkleTree
alias MerkleMap.MerkleTree.Diff
defstruct map: %{},
merkle_tree: MerkleTree.new()
@opaque t() :: %__MODULE__{}... | astreu/deps/merkle_map/lib/merkle_map.ex | 0.778018 | 0.460774 | merkle_map.ex | starcoder |
defmodule Membrane.Core.Element.DemandHandler do
@moduledoc false
# Module handling demands requested on output pads.
alias Membrane.Core
alias Membrane.Element.Pad
alias Core.{Message, PullBuffer}
alias Core.Element.{
BufferController,
CapsController,
DemandController,
EventController,
... | lib/membrane/core/element/demand_handler.ex | 0.732496 | 0.44354 | demand_handler.ex | starcoder |
defmodule Cryptozaur.Model.Level do
@moduledoc """
The model represents orders from an order book grouped by price.
It means some orders with the similar price will be represent as a single level with cumulative amount.
"""
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
import Cryptozaur.U... | lib/cryptozaur/model/level.ex | 0.588653 | 0.491517 | level.ex | starcoder |
import Ecto.Query, only: [from: 2]
defmodule Ecto.Associations do
@moduledoc """
Documents the functions required for associations to implement
in order to work with Ecto query mechanism.
This module contains documentation for those interested in
understanding how Ecto associations work internally. If you a... | lib/ecto/associations.ex | 0.872863 | 0.518424 | associations.ex | starcoder |
defmodule Tensorflow.TrackableObjectGraph.TrackableObject.ObjectReference do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
node_id: integer,
local_name: String.t()
}
defstruct [:node_id, :local_name]
field(:node_id, 1, type: :int32)
field(:local_name, 2... | lib/tensorflow/core/protobuf/trackable_object_graph.pb.ex | 0.805479 | 0.529628 | trackable_object_graph.pb.ex | starcoder |
defmodule TelemetryMetricsStatsd.Options do
@moduledoc false
@schema [
metrics: [
type: {:list, :any},
required: true,
doc:
"A lits of `Telemetry.Metrics` metric definitions that will be published by the reporter."
],
host: [
type: {:custom, __MODULE__, :host, []},
... | lib/telemetry_metrics_statsd/options.ex | 0.908957 | 0.410372 | options.ex | starcoder |
defmodule NebulexRedisAdapter do
@moduledoc """
Nebulex adapter for Redis.
This adapter is implemented using `Redix`, a Redis driver for
Elixir.
**NebulexRedisAdapter** brings with three setup alternatives: standalone
(default) and two more for cluster support:
* **Standalone** - This is the default ... | lib/nebulex_redis_adapter.ex | 0.885835 | 0.602149 | nebulex_redis_adapter.ex | starcoder |
defmodule Bitcoinex.Secp256k1 do
@moduledoc """
ECDSA Secp256k1 curve operations.
libsecp256k1: https://github.com/bitcoin-core/secp256k1
Currently supports ECDSA public key recovery.
In the future, we will NIF for critical operations. However, it is more portable to have a native elixir version.
"""
us... | server/bitcoinex/lib/secp256k1/secp256k1.ex | 0.921446 | 0.51751 | secp256k1.ex | starcoder |
defmodule Specs do
@spec fall_velocity({atom(), number()}, number()) :: float()
def fall_velocity({_planemo, gravity}, distance) when distance > 0 do
:math.sqrt(2 * gravity * distance)
end
@spec average_velocity_by_distance({atom(), number()}, number()) :: float()
def average_velocity_by_d... | other/dialyxir/typespecs.ex | 0.897852 | 0.743634 | typespecs.ex | starcoder |
defmodule MapTileRenderer.MapData do
require Logger
defmodule Area do
defstruct id: 0, type: :land, tags: %{}, vertices: [], bbox: {{0.0, 0.0}, {0.0, 0.0}}
end
defmodule Line do
defstruct id: 0, type: :road, tags: %{}, vertices: [], bbox: {{0.0, 0.0}, {0.0, 0.0}}
end
defmodule... | lib/map_data/map_data.ex | 0.65368 | 0.64946 | map_data.ex | starcoder |
defmodule Himamo.Training do
@moduledoc """
Defines the required functions to train a new model by optimizing a given
model on the given observation sequences.
## Example
iex> # Specifying a model
...> a = fn -> # State transition probabilities
...> import Himamo.Model.A, only: [new: 1, pu... | lib/himamo/training.ex | 0.846101 | 0.69153 | training.ex | starcoder |
defmodule STL do
@moduledoc """
Functions for working with STL files and structs. Triangle count and bounding box
finding is done during parsing and is a constant-time operation.
Surface area calculation, if not able to be calculated during parsing,
is done every time the function is called and thus is potent... | lib/stl.ex | 0.919204 | 0.932392 | stl.ex | starcoder |
defmodule Marshal.Decode.Helper do
@moduledoc """
Helper functions for pulling apart Marshal binary
"""
@doc """
Retrieve fixnum from Marshal binary.
# Examples
iex> Marshal.Decode.Helper.decode_fixnum(<<0>>)
{0, <<>>}
iex> Marshal.Decode.Helper.decode_fixnum(<<3, 64, 226, 1>>)
{... | lib/marshal/decode/helper.ex | 0.749912 | 0.484502 | helper.ex | starcoder |
defmodule AisFront.Coordinates do
alias __MODULE__
alias AisFront.Units.Angle
alias AisFront.Units.Distance
alias AisFront.Protocols.Convertible
alias Geo.Point
@possible_srid [3857, 4326, 900913]
@default_srid 4326
@possible_units [Angle, Distance]
@type coordinates_unit() :: Angle | Distance
@... | lib/ais_front/coordinates.ex | 0.851768 | 0.540681 | coordinates.ex | starcoder |
defmodule Terminator do
@moduledoc """
Main Terminator module for including macros
Terminator has 3 main components:
* `Terminator.Ability` - Representation of a single permission e.g. :view, :delete, :update
* `Terminator.Performer` - Main actor which is holding given abilities
* `Terminator.Role` ... | lib/terminator.ex | 0.871844 | 0.618694 | terminator.ex | starcoder |
defmodule CommonGraphqlClient.StaticValidator.NpmGraphql do
@moduledoc """
This module uses node and graphql-tools to validate a graphql query against
a graphql schema
It needs `node` binary to be available
"""
@behaviour CommonGraphqlClient.StaticValidator.ValidationStrategy
@doc """
This method use... | lib/common_graphql_client/static_validator/npm_graphql.ex | 0.8635 | 0.542803 | npm_graphql.ex | starcoder |
defmodule RigOutboundGateway.Kafka.Sup do
@moduledoc """
Supervisor handling Kafka-related processes.
## About the Kafka Integration
In order to scale horizontally,
[Kafka Consumer Groups](https://kafka.apache.org/documentation/#distributionimpl)
are used. This supervisor takes care of the [Brod](https://... | apps/rig_outbound_gateway/lib/rig_outbound_gateway/kafka/sup.ex | 0.777342 | 0.433682 | sup.ex | starcoder |
defmodule AdventOfCode.Day4 do
alias AdventOfCode.Day4, as: Day4
@required_keys [:byr, :iyr, :eyr, :hgt, :hcl, :ecl, :pid]
# @optional_keys [:cid]
def parsers() do
%{
:byr => fn x -> Day4.parse_integer(x, fn v -> v >= 1920 and v <= 2002 end) end,
:iyr => fn x -> Day4.parse_integer(x, fn v -> v... | lib/day4.ex | 0.630457 | 0.562657 | day4.ex | starcoder |
defmodule Retex.Node.BetaMemory do
@moduledoc """
A BetaMemory works like a two input node in Rete. It is simply a join node
between two tests that have passed successfully. The activation of a BetaMemory
happens if the two parents (left and right) have been activated and the bindings
are matching for both of... | lib/nodes/beta_memory.ex | 0.816516 | 0.668892 | beta_memory.ex | starcoder |
defmodule BSV.Message do
@moduledoc """
Module to sign and verify messages with Bitcoin keys. Is compatible with
ElectrumSV and bsv.js.
Internally uses `libsecp256k1` NIF bindings for compact signatures and public
key recovery from signatures.
"""
alias BSV.Crypto.Hash
alias BSV.KeyPair
alias BSV.U... | lib/bsv/message.ex | 0.872198 | 0.492432 | message.ex | starcoder |
defmodule AWS.STS do
@moduledoc """
AWS Security Token Service
The AWS Security Token Service (STS) is a web service that enables you to
request temporary, limited-privilege credentials for AWS Identity and
Access Management (IAM) users or for users that you authenticate (federated
users). This guide prov... | lib/aws/sts.ex | 0.852966 | 0.464294 | sts.ex | starcoder |
defmodule DateTime do
@moduledoc """
A datetime implementation with a time zone.
This datetime can be seen as an ephemeral snapshot
of a datetime at a given time zone. For such purposes,
it also includes both UTC and Standard offsets, as
well as the zone abbreviation field used exclusively
for formatting... | lib/elixir/lib/calendar/datetime.ex | 0.955016 | 0.657621 | datetime.ex | starcoder |
defmodule Croma.Result do
@moduledoc """
A simple data structure to represent a result of computation that can either succeed or fail,
in the form of `{:ok, any}` or `{:error, any}`.
In addition to many utility functions, this module also provides implementation of
`Croma.Monad` interface for `t:Croma.Result... | lib/croma/result.ex | 0.893501 | 0.70337 | result.ex | starcoder |
defmodule Contex.SimplePie do
@moduledoc """
Generates a simple pie chart from an array of tuples like `{"Cat", 10.0}`.
Usage:
```
SimplePie.new([{"Cat", 10.0}, {"Dog", 20.0}, {"Hamster", 5.0}])
|> SimplePie.colours(["aa0000", "00aa00", "0000aa"]) # Optional - only if you don't like the defaults
|... | lib/chart/simple_pie.ex | 0.90879 | 0.887741 | simple_pie.ex | starcoder |
defmodule Sift.Schema do
alias Sift.Schema.Field
alias Sift.Schema.Types.Boolean, as: BooleanType
alias Sift.Schema.Types.Enum, as: EnumType
alias Sift.Schema.Types.Float, as: FloatType
alias Sift.Schema.Types.Integer, as: IntegerType
alias Sift.Schema.Types.List, as: ListType
alias Sift.Schema.Types.Stri... | lib/sift/schema.ex | 0.61057 | 0.46873 | schema.ex | starcoder |
defmodule Ratekeeper do
@moduledoc File.read!(__DIR__ <> "/../README.md")
use GenServer
@name __MODULE__
## Client API
@doc """
Starts Ratekeeper server.
```args[:limits]``` can be provided to set limits in format ```%{bucket_name: [{interval, limit}]}```
"""
def start_link(args) do
limits = ... | lib/ratekeeper.ex | 0.857664 | 0.642419 | ratekeeper.ex | starcoder |
defmodule Plugoid do
@moduledoc """
## Basic use
defmodule MyAppWeb.Router do
use MyAppWeb, :router
use Plugoid.RedirectURI
pipeline :oidc_auth do
plug Plugoid,
issuer: "https://repentant-brief-fishingcat.gigalixirapp.com",
client_id: "client1",
... | lib/plugoid.ex | 0.779154 | 0.408188 | plugoid.ex | starcoder |
defmodule Slime.Parser.Transform do
@moduledoc """
PEG parser callbacks module.
Define transformations from parsed iolist to ast.
See https://github.com/seancribbs/neotoma/wiki#working-with-the-ast
"""
import Slime.Parser.Preprocessor, only: [indent_size: 1]
alias Slime.Parser.{AttributesKeyword, Embedd... | lib/slime/parser/transform.ex | 0.678753 | 0.473536 | transform.ex | starcoder |
defmodule TradeIndicators.Tests.Fixtures do
alias TradeIndicators.Util, as: U
alias Enum, as: E
alias Map, as: M
@msft_m1_2020_07_27 [
%{t: 1_595_620_860, o: 201.63, c: 201.63, h: 201.63, l: 201.63},
%{t: 1_595_852_820, o: 202.98, c: 202.98, h: 202.98, l: 202.98}... | test/support/fixtures.ex | 0.511473 | 0.551996 | fixtures.ex | starcoder |
defmodule LocalHex.Registry.Builder do
@moduledoc """
The `Registry.Builder` module is used to persit the registry of a repository in signed files using using
`:hex_core` library
The stored files are:
* `names` - signed file storing a list of available package names
* `versions` - signed file storing a li... | lib/local_hex/registry/builder.ex | 0.853058 | 0.858006 | builder.ex | starcoder |
defmodule LogiStd.Sink.FlowLimiter do
@moduledoc """
A sink which limits message flow rate of underlying sink.
## Examples
```
iex> base_sink = LogiStd.Sink.Console.new(:console)
iex> sink = LogiStd.Sink.FlowLimiter.new(:limiter, base_sink, [write_rate_limits: [{1024, 1000}]])
iex> {:ok, _} = Logi.Chann... | lib/logi_std/sink/flow_limiter.ex | 0.657868 | 0.658459 | flow_limiter.ex | starcoder |
defmodule EctoDripper do
@moduledoc """
Provides composable queries following a convention of `query_x(query, %{x: "asdf"})`, or `query_all(query, %{x: "asdf"})`.
## Basic Usage
```elixir
defmodule MyApp.SomeQuery do
use EctoDripper,
composable_queries: [
[:status, :==, :status],
[:... | lib/ecto_dripper.ex | 0.787646 | 0.687755 | ecto_dripper.ex | starcoder |
defmodule Ecto.Associations.Assoc do
@moduledoc """
This module provides the assoc selector merger and utilities around it.
"""
alias Ecto.Query.Query
alias Ecto.Query.QueryExpr
alias Ecto.Query.Util
alias Ecto.Associations
@doc """
Transforms a result set based on the assoc selector, loading the as... | lib/ecto/associations/assoc.ex | 0.749087 | 0.585753 | assoc.ex | starcoder |
defmodule ElxValidation.BindRules do
alias ElxValidation.{Accepted, Alpha, Boolean, Field, In, Internet, Max, Min, Nullable, Numbers}
alias ElxValidation.{Confirmation, DateTime, Different, Required, Storage, Uuid}
@moduledoc """
Build rules by rule name
- not use inside validator
- called automatically b... | lib/factory/bind_rules.ex | 0.7478 | 0.428831 | bind_rules.ex | starcoder |
defmodule KitchenCalculator do
@moduledoc false
@spec get_volume({any, any}) :: any
def get_volume({_, volume}), do: volume
@spec to_milliliter(
{:cup, number}
| {:fluid_ounce, number}
| {:milliliter, number}
| {:tablespoon, number}
| {:teaspoon, number}
... | kitchen-calculator/lib/kitchen_calculator.ex | 0.838018 | 0.485417 | kitchen_calculator.ex | starcoder |
defmodule Dwolla.Customer do
@moduledoc """
Functions for `customers` endpoint.
"""
alias Dwolla.Utils
defstruct id: nil,
first_name: nil,
last_name: nil,
email: nil,
type: nil,
status: nil,
created: nil,
address1: nil,
... | lib/dwolla/customer.ex | 0.792384 | 0.66195 | customer.ex | starcoder |
defmodule Stargate.Receiver.Acknowledger do
@moduledoc """
Defines the `Stargate.Receiver.Acknowledger` GenStage process
that acts as the final consumer in the receive pipeline to
acknowledge successful processing of messages back to Pulsar
to allow more messages to be sent and for the cluster to
delete mes... | lib/stargate/receiver/acknowledger.ex | 0.816772 | 0.529811 | acknowledger.ex | starcoder |
defmodule Circuit.Ads1115 do
use GenServer
defmodule State do
@moduledoc false
defstruct devname: nil,
address: nil,
inputs: nil
end
defmodule Config do
@moduledoc false
defstruct mode: :default,
max_volts: :default,
data_rate: :default
... | lib/circuit/ads1115.ex | 0.568895 | 0.44071 | ads1115.ex | starcoder |
defmodule Runlet.Cmd.Flow do
@moduledoc "Flow control events"
defstruct count: 1000,
seconds: 10,
events: 0,
dropped: 0
@doc """
Drop events that exceed a rate in count per seconds.
"""
@spec exec(Enumerable.t(), pos_integer, pos_integer) :: Enumerable.t()
def exec(st... | lib/runlet/cmd/flow.ex | 0.756717 | 0.550728 | flow.ex | starcoder |
defmodule Riak.Ecto.NormalizedQuery do
@moduledoc false
defmodule SearchQuery do
@moduledoc false
defstruct coll: nil, pk: nil, params: {}, query: %{},
model: nil, filter: "", fields: [], order: nil,
projection: %{}, opts: []
end
defmodule FetchQuery do
@moduledoc fals... | lib/riak_ecto/normalized_query.ex | 0.688364 | 0.594021 | normalized_query.ex | starcoder |
defmodule Pixie do
use Application
@default_timeout 25_000 # 25 seconds.
# @default_transports ~w| long-polling cross-origin-long-polling callback-polling websocket eventsource |
@default_transports ~w| long-polling cross-origin-long-polling callback-polling websocket |
@default_backend [name: :ETS]
@bayeu... | lib/pixie.ex | 0.871489 | 0.615521 | pixie.ex | starcoder |
defmodule TripleDes do
@moduledoc """
Documentation for TripleDes.
```elixir
mode: :des3_ecb, :des3_cbc, :des_ede3
key: iodata, must be a multiple of 64 bits (8 bytes).
ivec: an arbitrary initializing vector, must be a multiple of 64 bits (8 bytes)
data: iodata, must be a multiple of 64 bits (8 bytes).
... | lib/triple_des.ex | 0.844008 | 0.813868 | triple_des.ex | starcoder |
defmodule Grizzly.ZWave.CommandClasses.BarrierOperator do
@moduledoc """
"BarrierOperator" Command Class
The Barrier Operator Command Class is used to control and query the status of motorized barriers.
"""
@behaviour Grizzly.ZWave.CommandClass
alias Grizzly.ZWave.DecodeError
use Bitwise
@type targ... | lib/grizzly/zwave/command_classes/barrier_operator.ex | 0.882111 | 0.54256 | barrier_operator.ex | starcoder |
defmodule Memcachir do
@moduledoc """
Module with a friendly API for memcached servers.
It provides connection pooling, and cluster support.
## Examples
{:ok} = Memcachir.set("hello", "world")
{:ok, "world"} = Memcachir.get("hello")
"""
use Application
alias Memcachir.{
Cluster,
P... | lib/memcachir.ex | 0.83346 | 0.403978 | memcachir.ex | starcoder |
defmodule RDF.Description do
@moduledoc """
A set of RDF triples about the same subject.
`RDF.Description` implements:
- Elixir's `Access` behaviour
- Elixir's `Enumerable` protocol
- Elixir's `Inspect` protocol
- the `RDF.Data` protocol
"""
@behaviour Access
import RDF.Statement
alias RDF.{St... | lib/rdf/description.ex | 0.890625 | 0.589864 | description.ex | starcoder |
defmodule Mix.Tasks.Bench do
use Mix.Task
@shortdoc "Microbenchmarking tool for Elixir."
@moduledoc """
## Usage
mix bench [options] [<path>...]
When one or more arguments are supplied, each of them will be treated as a
wildcard pattern and only those bench tests that match the pattern will be
s... | lib/mix/tasks/bench.ex | 0.826852 | 0.411554 | bench.ex | starcoder |
defmodule SpiderMan.Stats do
@moduledoc false
@events [
[:spider_man, :downloader, :start],
[:spider_man, :downloader, :stop],
[:spider_man, :spider, :start],
[:spider_man, :spider, :stop],
[:spider_man, :item_processor, :start],
[:spider_man, :item_processor, :stop]
]
def attach_spider... | lib/spider_man/stats.ex | 0.515864 | 0.536738 | stats.ex | starcoder |
defmodule Math do
@doc """
Calculates the cartesian product of the given enumerables.
## Options
* `:repeat` - when given repeats the the enum the given times
## Examples
iex> Math.cartesian([[:a, :b], [:c]])
[[:a, :c], [:b, :c]]
iex> Math.cartesian([0..1], repeat: 2)
[[0, 0], [1, 0], [... | lib/math.ex | 0.927601 | 0.874935 | math.ex | starcoder |
defmodule Shippex.Address do
@moduledoc """
Represents an address that can be passed to other `Shippex` functions. Do
*not* initialize this struct directly. Instead, use `address/1`.
"""
@enforce_keys ~w(first_name last_name name phone address address_line_2 city
state zip country)a
def... | lib/shippex/address.ex | 0.892252 | 0.48688 | address.ex | starcoder |
defmodule Playwright.Page.Accessibility do
@moduledoc """
`Playwright.Page.Accessibility` provides functions for inspecting Chromium's accessibility tree.
The accessibility tree is used by assistive technology such as [screen readers][1] or [switches][2].
Accessibility is a very platform-specific thing. On di... | lib/playwright/page/accessibility.ex | 0.899694 | 0.572364 | accessibility.ex | starcoder |
defmodule Selfie do
@moduledoc """
Provides a single way to access both a struct's fields and its associated module's functions.
Elixir structs know what module they belong to.
`Kernel.apply/3` lets you dynamically call module functions.
Selfie takes advantage to let you play fast and loose with structs.
... | lib/selfie.ex | 0.82963 | 0.667354 | selfie.ex | starcoder |
defmodule Voomex.SMPP.Monitor do
@moduledoc """
Monitor the SMPP connection process
- Starts the connection on a delay
- Notified when the connection drops and restarts after a delay
"""
use GenServer
require Logger
alias Voomex.SMPP.{Connection, TetherSupervisor}
@connection_boot_delay 1_500
@... | lib/voomex/smpp/monitor.ex | 0.649356 | 0.406067 | monitor.ex | starcoder |
defmodule Scenic.Math.Vector2 do
@moduledoc """
A collection of functions to work with 2D vectors.
2D vectors are always two numbers in a tuple.
{3, 4}
{3.5, 4.7}
"""
alias Scenic.Math
alias Scenic.Math.Vector2
alias Scenic.Math.Matrix
# common constants
@doc "A vector that points to ... | lib/scenic/math/vector_2.ex | 0.963686 | 0.913445 | vector_2.ex | starcoder |
defmodule Sanbase.TechIndicators.PriceVolumeDifference do
import Sanbase.Utils.ErrorHandling
require Logger
require Sanbase.Utils.Config, as: Config
alias Sanbase.Model.Project
require Mockery.Macro
defp http_client, do: Mockery.Macro.mockable(HTTPoison)
@recv_timeout 15_000
@type price_volume_diff... | lib/sanbase/tech_indicators/price_volume_difference.ex | 0.804521 | 0.430806 | price_volume_difference.ex | starcoder |
defmodule Mixpanel.Dispatcher do
@doc """
Tracks an event.
## Arguments
* `event` - A name for the event
* `properties` - A collection of properties associated with this event.
* `opts` - The options
## Options
* `:distinct_id` - The value of distinct_id will be treated as a string, and u... | lib/mixpanel/dispatcher.ex | 0.848141 | 0.607721 | dispatcher.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.