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 Kernel.SpecialForms do
@moduledoc """
In this module we define Elixir special forms. Special forms
cannot be overriden by the developer and are the basic
building blocks of Elixir code.
Some of those forms are lexical (like `alias`, `import`, etc).
The macros `{}`, `[]` and `<<>>` are also specia... | lib/elixir/lib/kernel/special_forms.ex | 0.894706 | 0.533033 | special_forms.ex | starcoder |
defmodule Mix.Tasks.FixSlackMessageFormatting do
use Mix.Task
require Logger
import Ecto.Query, warn: false
alias ChatApi.{Messages, Repo, Slack, SlackAuthorizations}
alias ChatApi.Messages.Message
alias ChatApi.SlackAuthorizations.SlackAuthorization
@shortdoc "Fixes Slack message formatting for links a... | lib/mix/tasks/fix_slack_message_formatting.ex | 0.765155 | 0.557875 | fix_slack_message_formatting.ex | starcoder |
defmodule Surface.Compiler.Helpers do
alias Surface.AST
alias Surface.Compiler.CompileMeta
alias Surface.IOHelper
def interpolation_to_quoted!(text, meta) do
with {:ok, expr} <- Code.string_to_quoted(text, file: meta.file, line: meta.line),
:ok <- validate_interpolation(expr, meta) do
expr
... | lib/surface/compiler/helpers.ex | 0.639849 | 0.401219 | helpers.ex | starcoder |
defmodule Jaxon.ParseError do
@type t :: %__MODULE__{
message: String.t() | nil,
unexpected: {:incomplete, String.t()} | {:error, String.t()} | nil,
expected: [atom()] | nil
}
defexception [:message, :unexpected, :expected]
defp event_to_pretty_name({:incomplete, {event, _}... | lib/jaxon/parse_error.ex | 0.772144 | 0.462594 | parse_error.ex | starcoder |
defmodule Grizzly.ZWave.Commands.MultiChannelEndpointReport do
@moduledoc """
This command is used to advertise the number of End Points implemented by the sending node.
Params:
* `:dynamic` - whether the node implements a dynamic number of End Points (required)
* `:identical` - whether all end points ... | lib/grizzly/zwave/commands/multi_channel_endpoint_report.ex | 0.850918 | 0.467818 | multi_channel_endpoint_report.ex | starcoder |
defmodule Web.Skill do
@moduledoc """
Bounded context for the Phoenix app talking to the data layer
"""
alias Data.Effect
alias Data.Skill
alias Data.Repo
alias Game.Skills
alias Web.Filter
alias Web.Pagination
import Ecto.Query
@behaviour Filter
@doc """
Load all skills
"""
@spec all(... | lib/web/skill.ex | 0.826747 | 0.425426 | skill.ex | starcoder |
defmodule AWS.CodePipeline do
@moduledoc """
AWS CodePipeline
**Overview**
This is the AWS CodePipeline API Reference. This guide provides
descriptions of the actions and data types for AWS CodePipeline. Some
functionality for your pipeline is only configurable through the API. For
additional informati... | lib/aws/code_pipeline.ex | 0.927741 | 0.753648 | code_pipeline.ex | starcoder |
defmodule Zaryn.P2P.GeoPatch do
@moduledoc """
Provide functions for Geographical Patching from IP address
Each patch is represented by 3 digits in hexadecimal form (ie. AAA, F3C)
"""
alias __MODULE__.GeoIP
@doc """
Get a patch from an IP address
"""
@spec from_ip(:inet.ip_address()) :: binary()
... | lib/zaryn/p2p/geo_patch.ex | 0.716219 | 0.442275 | geo_patch.ex | starcoder |
defmodule DBConnection.OwnershipError do
defexception [:message]
def exception(message), do: %DBConnection.OwnershipError{message: message}
end
defmodule DBConnection.Ownership do
@moduledoc """
A DBConnection pool that requires explicit checkout and checkin
as a mechanism to coordinate between pro... | deps/db_connection/lib/db_connection/ownership.ex | 0.813831 | 0.422147 | ownership.ex | starcoder |
defmodule Serum.Plugins.TableOfContents do
@moduledoc """
A Serum plugin that inserts a table of contents.
## Using the Plugin
First, add this plugin to your `serum.exs`:
%{
plugins: [
#{__MODULE__ |> to_string() |> String.replace_prefix("Elixir.", "")}
]
}
This plugi... | lib/serum/plugins/table_of_contents.ex | 0.855323 | 0.650675 | table_of_contents.ex | starcoder |
# based on XKCD 287 - https://xkcd.com/287/
defmodule Orderer do
@moduledoc """
Generates orders of an exact target amount
"""
@type menu() :: [Item.t, ...]
@type order() :: [Entry.t, ...]
@spec generate({menu(), Money.t}) :: [order()]
@doc ~S"""
Wrapper around generation routine to assure that item... | lib/orderer.ex | 0.758108 | 0.447038 | orderer.ex | starcoder |
defmodule Sizeable do
@moduledoc """
A library to make file sizes human-readable
"""
require Logger
@bits ~w(b Kb Mb Gb Tb Pb Eb Zb Yb)
@bytes ~w(B KB MB GB TB PB EB ZB YB)
@doc """
see `filesize(value, options)`
"""
def filesize(value) do
filesize(value, [])
end
def filesize(value, opti... | lib/sizeable.ex | 0.888952 | 0.608769 | sizeable.ex | starcoder |
defmodule Membrane.Element.RawVideo.Parser do
@moduledoc """
Simple module responsible for splitting the incoming buffers into
frames of raw (uncompressed) video frames of desired format.
The parser sends proper caps when moves to playing state.
No data analysis is done, this element simply ensures that
th... | lib/membrane_element_rawvideo/parser.ex | 0.870253 | 0.557785 | parser.ex | starcoder |
defmodule Daguex.Image do
@type key :: String.t
@type variant_t :: %{identifier: identifier, width: integer, height: integer, type: Daguex.ImageFile.type}
@type format :: String.t
@type t :: %__MODULE__{
key: key,
width: integer,
height: integer,
type: String.t,
variants: %{format => varia... | lib/daguex/image.ex | 0.800107 | 0.609321 | image.ex | starcoder |
defmodule Geo.PostGIS.Extension do
@moduledoc """
PostGIS extension for Postgrex. Supports Geometry and Geography data types.
## Examples
Create a new Postgrex Types module:
Postgrex.Types.define(MyApp.PostgresTypes, [Geo.PostGIS.Extension], [])
If using with Ecto, you may want something like thing ... | lib/geo_postgis/extension.ex | 0.639961 | 0.425665 | extension.ex | starcoder |
defmodule Nestru do
@moduledoc "README.md"
|> File.read!()
|> String.split("[//]: # (Documentation)\n")
|> Enum.at(1)
|> String.trim("\n")
@doc """
Creates a nested struct from the given map.
The first argument is a map having key-value pairs. Supports both ... | lib/nestru.ex | 0.852276 | 0.567277 | nestru.ex | starcoder |
defmodule ExUnit.Filters do
@moduledoc """
Conveniences for parsing and evaluating filters.
"""
@type t :: list({ atom, any } | atom)
@doc """
Normalizes include and excludes to remove duplicates
and keep precedence.
## Examples
iex> ExUnit.Filters.normalize(nil, nil)
{ [], [] }
i... | lib/ex_unit/lib/ex_unit/filters.ex | 0.887223 | 0.532668 | filters.ex | starcoder |
defmodule Cluster.Strategy.Kubernetes.DNS do
@moduledoc """
This clustering strategy works by loading all your Erlang nodes (within Pods) in the current Kubernetes
namespace. It will fetch the addresses of all pods under a shared headless service and attempt to connect.
It will continually monitor and update it... | lib/strategy/kubernetes_dns.ex | 0.759047 | 0.526038 | kubernetes_dns.ex | starcoder |
defmodule Data.Quest do
@moduledoc """
Quest schema
"""
use Data.Schema
alias Data.Script
alias Data.NPC
alias Data.QuestRelation
alias Data.QuestStep
schema "quests" do
field(:name, :string)
field(:description, :string)
field(:completed_message, :string)
field(:level, :integer)
... | lib/data/quest.ex | 0.568536 | 0.482185 | quest.ex | starcoder |
defmodule Ratatouille.Renderer.Box do
@moduledoc """
This defines the internal representation of a rectangular region---a box---for
rendering, as well as logic for transforming these boxes.
Boxes live on a coordinate plane. The y-axis is inverted so that the y values
increase as the box's height grows.
... | lib/ratatouille/renderer/box.ex | 0.892972 | 0.802168 | box.ex | starcoder |
defmodule AWS.Discovery do
@moduledoc """
AWS Application Discovery Service
AWS Application Discovery Service helps you plan application migration
projects by automatically identifying servers, virtual machines (VMs),
software, and software dependencies running in your on-premises data
centers. Applicatio... | lib/aws/discovery.ex | 0.854384 | 0.574872 | discovery.ex | starcoder |
defmodule Spinlock do
@moduledoc """
Documentation for Spinlock.
"""
@doc """
Initialize the circular buffer for the spinlock.
## Examples
iex> Spinlock.init
%{buffer: [0], position: 0, last_value: 0 }
"""
def init do
%{ buffer: [0], position: 0, last_value: 0 }
end
@doc """
... | 2017/17-spinlock/lib/spinlock.ex | 0.745491 | 0.436742 | spinlock.ex | starcoder |
defmodule Prolly.BloomFilter do
require Vector
@moduledoc """
Use a Bloom filter when you want to keep track of whether
you have seen a given value or not.
For example, the quesetion "have I seen the string `foo` so far in the stream?"
is a reasonble question for a Bloom filter.
Specifically, a Bloom f... | lib/prolly/bloom_filter.ex | 0.901799 | 0.727274 | bloom_filter.ex | starcoder |
defmodule Bigtable.Mutations do
@moduledoc """
Provides functions to build Bigtable mutations that are used when forming
row mutation requests.
"""
alias Google.Bigtable.V2.{MutateRowsRequest, Mutation, TimestampRange}
alias MutateRowsRequest.Entry
alias Mutation.{DeleteFromColumn, DeleteFromFamily, Delet... | lib/data/mutations.ex | 0.908255 | 0.463141 | mutations.ex | starcoder |
defmodule BN.FQP do
defstruct [:coef, :modulus_coef, :dim]
alias BN.FQ
@type t :: %__MODULE__{
coef: [FQ.t()],
modulus_coef: [integer()]
}
@spec new([integer()], [integer()], keyword()) :: t() | no_return
def new(coef, modulus_coef, params \\ []) do
modulus = Keyword.get(par... | lib/bn/fqp.ex | 0.87672 | 0.442938 | fqp.ex | starcoder |
defmodule AWS.Detective do
@moduledoc """
Detective uses machine learning and purpose-built visualizations to help
you analyze and investigate security issues across your Amazon Web Services
(AWS) workloads. Detective automatically extracts time-based events such as
login attempts, API calls, and network tra... | lib/aws/generated/detective.ex | 0.874533 | 0.634359 | detective.ex | starcoder |
defmodule FuzzyCompare do
@moduledoc """
This module compares two strings for their similarity and uses multiple
approaches to get high quality results.
## Getting started
In order to compare two strings with each other do the following:
iex> FuzzyCompare.similarity("<NAME>", "monet, claude")
0... | lib/fuzzy_compare.ex | 0.88397 | 0.698548 | fuzzy_compare.ex | starcoder |
defmodule Timber.JSON do
@moduledoc false
# This module wraps all JSON encoding functions making it easy
# to change the underlying JSON encoder. This is necessary if/when
# we decide to make the JSON encoder configurable.
# Convenience function for encoding data to JSON. This is necessary to allow for
# c... | lib/timber/json.ex | 0.76856 | 0.491578 | json.ex | starcoder |
defprotocol Bamboo.Formatter do
@moduledoc ~S"""
Converts data to email addresses.
The passed in options is currently a map with the key `:type` and a value of
`:from`, `:to`, `:cc` or `:bcc`. This makes it so that you can pattern match
and return a different address depending on if the address is being used... | lib/bamboo/formatter.ex | 0.865736 | 0.510313 | formatter.ex | starcoder |
defmodule Ambry.Series do
@moduledoc """
Functions for dealing with Series.
"""
import Ambry.SearchUtils
import Ecto.Query
alias Ambry.{PubSub, Repo}
alias Ambry.Series.{Series, SeriesBook, SeriesFlat}
@doc """
Returns a limited list of series and whether or not there are more.
By default, it wi... | lib/ambry/series.ex | 0.897627 | 0.607343 | series.ex | starcoder |
defmodule Rummage.Ecto.Hook.Search do
@moduledoc """
`Rummage.Ecto.Hook.Search` is the default search hook that comes with
`Rummage.Ecto`.
This module provides a operations that can add searching functionality to
a pipeline of `Ecto` queries. This module works by taking fields, and `search_type`,
`search_t... | lib/rummage_ecto/hooks/search.ex | 0.830525 | 0.935405 | search.ex | starcoder |
defprotocol Bolt.Sips.ResponseEncoder.Json do
@moduledoc """
Protocol controlling how a value is made jsonable.
Its only purpose is to convert Bolt Sips specific structures into elixir buit-in types
which can be encoed in json by Jason.
## Deriving
If the provided default implementation don't fit your nee... | lib/bolt_sips/response_encoder/json.ex | 0.926719 | 0.829077 | json.ex | starcoder |
defmodule Advent.Y2021.D25 do
@moduledoc """
https://adventofcode.com/2021/day/25
"""
@doc """
"""
@spec part_one(Enumerable.t()) :: non_neg_integer()
def part_one(input) do
input
|> parse_input()
|> Stream.iterate(&step/1)
|> Stream.chunk_every(2, 1)
|> Stream.with_index(1)
|> En... | lib/advent/y2021/d25.ex | 0.684897 | 0.476701 | d25.ex | starcoder |
defmodule Chunky.Math.Operations do
@moduledoc """
The Operations module provides functions and macros for making particular repeated
operations and series easier to work with. Most of these are just simplifications
around enumerations over values, with support for either Integer or Fraction values.
To use t... | lib/math/operations.ex | 0.879062 | 0.959307 | operations.ex | starcoder |
defmodule Openflow.Action.NxRegLoad do
@moduledoc """
Copies value[0:n_bits] to dst[ofs:ofs+n_bits], where a[b:c] denotes the bits
within 'a' numbered 'b' through 'c' (not including bit 'c'). Bit numbering
starts at 0 for the least-significant bit, 1 for the next most significant
bit, and so on.
'dst' is ... | lib/openflow/actions/nx_reg_load.ex | 0.783368 | 0.790773 | nx_reg_load.ex | starcoder |
defmodule Markdown do
@moduledoc """
Markdown to HTML conversion.
## Dirty Scheduling
This relies on a NIF wrapping the hoedown library.
By default the NIF is deemed as clean for input lower than 30k characters. For
inputs over this value, it is likely the render time will take over 1ms and thus
it sho... | lib/markdown.ex | 0.805058 | 0.801509 | markdown.ex | starcoder |
defmodule Blockchain.Block do
@moduledoc """
Represents one block within the blockchain.
This module provides functions to hash blocks, validate proof, and find
proofs (mine) for blocks.
"""
require Logger
alias Blockchain.{Transaction, Chain}
@type t() :: %Blockchain.Block{
index: integer... | apps/blockchain/lib/blockchain/block.ex | 0.853669 | 0.533458 | block.ex | starcoder |
defmodule OpenHours.TimeSlot do
@moduledoc """
This module contains all functions to work with time slots.
"""
import OpenHours.Common
alias OpenHours.{TimeSlot, Schedule, Interval}
@typedoc """
Struct composed by a start datetime and an end datetime.
"""
@type t :: %__MODULE__{starts_at: DateTime.t... | lib/open_hours/time_slot.ex | 0.87802 | 0.549943 | time_slot.ex | starcoder |
defmodule Croma.Monad do
@moduledoc """
This module defines an interface for [monad](https://en.wikipedia.org/wiki/Monad).
Modules that `use` this module must provide concrete implementations of the following:
- `@type t(a)`
- `@spec pure(a) :: t(a) when a: any`
- `@spec bind(t(a), (a -> t(b))) :: t(b) wh... | lib/croma/monad.ex | 0.882238 | 0.739681 | monad.ex | starcoder |
defmodule Snitch.Data.Model.ProductBrand do
@moduledoc """
Product Brand API
"""
use Snitch.Data.Model
alias Ecto.Multi
alias Snitch.Data.Schema.{Image, ProductBrand}
alias Snitch.Data.Model.Image, as: ImageModel
alias Snitch.Tools.Helper.ImageUploader
@doc """
Returns all Product Brands
"""
@s... | apps/snitch_core/lib/core/data/model/product_brand.ex | 0.874151 | 0.49469 | product_brand.ex | starcoder |
defmodule Nomex.Request do
@moduledoc """
Wrapper module for `HTTPoison.Base` and contains some convenience
defmacro functions to keep other modules DRY
"""
alias Nomex.{ Request, Response }
use HTTPoison.Base
@doc """
Creates 2 functions with the following names:
```
function_name
function_nam... | lib/nomex/request.ex | 0.834441 | 0.830181 | request.ex | starcoder |
defmodule Membrane.Dashboard.Charts.Helpers do
@moduledoc """
Module has functions useful for Membrane.Dashboard.Charts.Full and Membrane.Dashboard.Charts.Update.
"""
import Membrane.Dashboard.Helpers
import Ecto.Query, only: [from: 2]
alias Membrane.Dashboard.Repo
alias Membrane.Dashboard.Charts
req... | lib/membrane_dashboard/charts/helpers.ex | 0.929224 | 0.479565 | helpers.ex | starcoder |
defmodule Cashtrail.Entities.Entity do
@moduledoc """
This is an `Ecto.Schema` struct that represents an entity of the application.
## Definition
According to [Techopedia](https://www.techopedia.com/definition/14360/entity-computing),
an entity is any singular, identifiable, and separate object. It refers to... | apps/cashtrail/lib/cashtrail/entities/entity.ex | 0.833223 | 0.708566 | entity.ex | starcoder |
defmodule ExOkex.Spot.Private do
@moduledoc """
Spot account client.
[API docs](https://www.okex.com/docs/en/#spot-README)
"""
alias ExOkex.Spot.Private
@type params :: map
@type config :: ExOkex.Config.t()
@type response :: ExOkex.Api.response()
@doc """
Place a new order.
Refer to params li... | lib/ex_okex/spot/private.ex | 0.582966 | 0.44903 | private.ex | starcoder |
defmodule RandomCache do
@moduledoc """
This modules implements a simple cache, using 1 ets table for it.
For using it, you need to start it:
iex> RandomCache.start_link(:my_cache, 1000)
Or add it to your supervisor tree, like: `worker(RandomCache, [:my_cache, 1000])`
## Using
iex> RandomCach... | lib/random_cache.ex | 0.811153 | 0.475849 | random_cache.ex | starcoder |
defmodule LiqenCore.CMS do
alias LiqenCore.CMS.{Entry,
ExternalHTML,
MediumPost,
Author}
alias LiqenCore.Accounts
alias LiqenCore.Repo
@moduledoc """
Content Management System of Liqen Core.
- This module handles user permissions for mana... | lib/liqen_core/cms/cms.ex | 0.782995 | 0.644547 | cms.ex | starcoder |
defmodule Clex.CL10 do
@moduledoc ~S"""
This module provides an interface into the [OpenCL 1.0 API](https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/).
"""
# Selectively pull in functions + docs from Clex.CL for OpenCL 1.0
use Clex.VersionedApi
# Platform
add_cl_func :platform, :get_platfo... | lib/clex/cl10.ex | 0.712332 | 0.407245 | cl10.ex | starcoder |
defmodule AWS.CloudWatchLogs do
@moduledoc """
You can use Amazon CloudWatch Logs to monitor, store, and access your log
files from Amazon EC2 instances, AWS CloudTrail, or other sources. You can
then retrieve the associated log data from CloudWatch Logs using the
CloudWatch console, CloudWatch Logs commands... | lib/aws/cloud_watch_logs.ex | 0.869382 | 0.650065 | cloud_watch_logs.ex | starcoder |
defmodule STL.Parser.Nimble do
@moduledoc """
A STL Parser written using https://hexdocs.pm/nimble_parsec/NimbleParsec.html
Implements STL.Parser behaviour. Also includes triangle count and STL bounding
box analysis steps during parser output formatting.
Developer's note: "I think my post processing steps co... | lib/stl/parser/nimble.ex | 0.818447 | 0.45048 | nimble.ex | starcoder |
defmodule Combine.Helpers do
@moduledoc "Helpers for building custom parsers."
defmacro __using__(_) do
quote do
require Combine.Helpers
import Combine.Helpers
@type parser :: Combine.parser
@type previous_parser :: Combine.previous_parser
end
end
@doc ~S"""
Macro... | deps/combine/lib/combine/helpers.ex | 0.819749 | 0.865679 | helpers.ex | starcoder |
defmodule Grizzly.ZWave.CommandClasses.NetworkManagementInclusion do
@moduledoc """
Network Management Inclusion Command Class
This command class provides the commands for adding and removing Z-Wave nodes
to the Z-Wave network
"""
@behaviour Grizzly.ZWave.CommandClass
alias Grizzly.ZWave.{DSK, CommandC... | lib/grizzly/zwave/command_classes/network_management_inclusion.ex | 0.827026 | 0.480783 | network_management_inclusion.ex | starcoder |
defmodule Membrane.MP4.Track do
@moduledoc """
A module defining a structure that represents an MPEG-4 track.
All new samples of a track must be stored in the structure first in order
to build a sample table of a regular MP4 container. Samples that were stored
can be flushed later in form of chunks.
"""
... | lib/membrane_mp4/track.ex | 0.876634 | 0.536616 | track.ex | starcoder |
defmodule Fiet.Atom do
@moduledoc """
Atom parser, comply with [RFC 4287](https://tools.ietf.org/html/rfc4287).
## Text constructs
Fiet supports two out of three text contructs in Atom: `text` and `html`.
`xhtml` is not supported.
In text constructs fields, the returning format is `{format, data}`. If "t... | lib/fiet/atom.ex | 0.849035 | 0.595257 | atom.ex | starcoder |
defmodule Kiq.Periodic.Crontab do
@moduledoc """
Generate and evaluate the structs used to evaluate periodic jobs.
The `Crontab` module provides parsing and evaluation for standard cron
expressions. Expressions are composed of rules specifying the minutes, hours,
days, months and weekdays. Rules for each fie... | lib/kiq/periodic/crontab.ex | 0.909702 | 0.751717 | crontab.ex | starcoder |
defmodule Okta.TrustedOrigins do
@moduledoc """
The `Okta.TrustedOrigins` module provides access methods to the [Okta Trusted Origins API](https://developer.okta.com/docs/reference/api/trusted-origins/).
All methods require a Tesla Client struct created with `Okta.client(base_url, api_key)`.
## Examples
... | lib/okta/trusted_origins.ex | 0.873384 | 0.863679 | trusted_origins.ex | starcoder |
defmodule Filtrex.Params do
@moduledoc """
`Filtrex.Params` is a module that parses parameters similar to Phoenix, such as:
```
%{"due_date_between" => %{"start" => "2016-03-10", "end" => "2016-03-20"}, "text_column" => "Buy milk"}
```
"""
@doc "Converts a string-key map to atoms from whitelist"
def s... | lib/filtrex/params.ex | 0.782746 | 0.844601 | params.ex | starcoder |
defmodule Stein.MFA.OneTimePassword.Secret do
@moduledoc """
`Stein.MFA.OneTimePassword.Secret` contains the struct and functions for generation of `:pot` useful secret keys
and Google Authenticator compatible (QR-) presentable urls for them.
"""
@typedoc "Secret type; totp or hotp"
@type stype :: :totp | ... | lib/stein/mfa/one_time_password/secret.ex | 0.798894 | 0.552721 | secret.ex | starcoder |
defmodule Storex.Diff do
@doc """
Check difference between two arguments.
```elixir
Storex.Diff.check(%{name: "John"}, %{name: "Adam"})
[%{a: "u", p: [:name], t: "Adam"}]
```
Result explanation:
```
a: action
n - none
u - update
d - delete
i - insert
t: to
p: path
```
"""
... | lib/storex/diff.ex | 0.666931 | 0.76882 | diff.ex | starcoder |
defmodule Multicodec do
@moduledoc """
This module provides encoding, decoding, and convenience functions for working with [Multicodec](https://github.com/multiformats/multicodec).
## Overview
> Compact self-describing codecs. Save space by using predefined multicodec tables.
## Motivation
[Multistream... | lib/multicodec.ex | 0.931649 | 0.906818 | multicodec.ex | starcoder |
defmodule DemoProcesses do
@moduledoc """
Documentation for DemoProcesses.
"""
alias DemoProcesses.{Step00, Step02, Step03, Utils}
@doc """
Start Step00 "remembering" process and a have a short conversation with it.
Effectively...
pid = Step00.start_process()
send(pid, {:remember, "Process... | lib/demo_processes.ex | 0.680666 | 0.475666 | demo_processes.ex | starcoder |
defmodule Alerts.InformedEntitySet do
@moduledoc """
Represents the superset of all InformedEntities for an Alert.
Simplifies matching, since we can compare a single InformedEntity to see if
it's present in the InformedEntitySet. If it's not, there's no way for it
to match any of the InformedEntities inside... | apps/alerts/lib/informed_entity_set.ex | 0.792745 | 0.461199 | informed_entity_set.ex | starcoder |
defmodule Mix.Tasks.Phx.Gen.PrettyHtml do
@shortdoc "Generates controller, views, and context for an HTML resource"
@moduledoc """
Generates controller, views, and context for an HTML resource.
mix phx.gen.html Accounts User users name:string age:integer
The first argument is the context module followe... | lib/mix/tasks/phx.gen.pretty_html.ex | 0.863132 | 0.462352 | phx.gen.pretty_html.ex | starcoder |
defmodule Contex.PointPlot do
@moduledoc """
A simple point plot, plotting points showing y values against x values.
It is possible to specify multiple y columns with the same x column. It is not
yet possible to specify multiple independent series.
The x column can either be numeric or date time data. If nu... | lib/chart/pointplot.ex | 0.956877 | 0.948728 | pointplot.ex | starcoder |
defmodule Commanded.ProcessManagers.ProcessManager do
@moduledoc """
Macro used to define a process manager.
A process manager is responsible for coordinating one or more aggregates.
It handles events and dispatches commands in response. Process managers have
state that can be used to track which aggregates ... | lib/commanded/process_managers/process_manager.ex | 0.87251 | 0.52074 | process_manager.ex | starcoder |
defmodule Depot.Adapter.InMemory do
@moduledoc """
Depot Adapter using an `Agent` for in memory storage.
## Direct usage
iex> filesystem = Depot.Adapter.InMemory.configure(name: InMemoryFileSystem)
iex> start_supervised(filesystem)
iex> :ok = Depot.write(filesystem, "test.txt", "Hello World")
... | lib/depot/adapter/in_memory.ex | 0.770681 | 0.404184 | in_memory.ex | starcoder |
defmodule AWS.ECS do
@moduledoc """
Amazon Elastic Container Service
Amazon Elastic Container Service (Amazon ECS) is a highly scalable, fast,
container management service.
It makes it easy to run, stop, and manage Docker containers on a cluster. You
can host your cluster on a serverless infrastructure t... | lib/aws/generated/ecs.ex | 0.885594 | 0.427546 | ecs.ex | starcoder |
defmodule Synacor.Token do
@moduledoc """
Tokenize binary data into instructions
"""
@doc """
Get the value at the given memory address
"""
def get_value(offset, bin) do
skip = offset * 2
<<_skip::binary-size(skip), value::little-integer-size(16), _rest::binary>> = bin
value
end
@doc """... | lib/synacor/token.ex | 0.724188 | 0.55646 | token.ex | starcoder |
defmodule Bolt.Sips.Internals.BoltProtocolHelper do
@moduledoc false
alias Bolt.Sips.Internals.PackStream.Message
alias Bolt.Sips.Internals.Error
@recv_timeout 10_000
@zero_chunk <<0x00, 0x00>>
@summary ~w(success ignored failure)a
@doc """
Sends a message using the Bolt protocol and PackStream encod... | lib/bolt_sips/internals/bolt_protocol_helper.ex | 0.81721 | 0.55103 | bolt_protocol_helper.ex | starcoder |
defmodule Nebulex.Cache do
@moduledoc ~S"""
Cache's main interface; defines the cache abstraction layer which is
highly inspired by [Ecto](https://github.com/elixir-ecto/ecto).
A Cache maps to an underlying implementation, controlled by the
adapter. For example, Nebulex ships with a default adapter that
im... | lib/nebulex/cache.ex | 0.88782 | 0.603056 | cache.ex | starcoder |
defmodule APIacAuthBasic do
@behaviour Plug
@behaviour APIac.Authenticator
use Bitwise
@moduledoc """
An `APIac.Authenticator` plug for API authentication using the HTTP `Basic` scheme
The HTTP `Basic` scheme simply consists in transmitting a client and its password
in the `Authorization` HTTP header. ... | lib/apiac_auth_basic.ex | 0.93318 | 0.694626 | apiac_auth_basic.ex | starcoder |
defmodule Plug do
@moduledoc """
The plug specification.
There are two kind of plugs: function plugs and module plugs.
#### Function plugs
A function plug is any function that receives a connection and a set of
options and returns a connection. Its type signature must be:
(Plug.Conn.t, Plug.opts) ... | lib/plug.ex | 0.90058 | 0.674064 | plug.ex | starcoder |
defmodule Gringotts.Gateways.Monei do
@moduledoc """
[MONEI][home] gateway implementation.
For reference see [MONEI's API (v1) documentation][docs].
The following features of MONEI are implemented:
| Action | Method | `type` |
| ------ | ------ | ... | lib/gringotts/gateways/monei.ex | 0.858244 | 0.680627 | monei.ex | starcoder |
defmodule AWS.KinesisVideoSignaling do
@moduledoc """
Kinesis Video Streams Signaling Service is a intermediate service that
establishes a communication channel for discovering peers, transmitting offers
and answers in order to establish peer-to-peer connection in webRTC technology.
"""
@doc """
Gets th... | lib/aws/generated/kinesis_video_signaling.ex | 0.747892 | 0.456168 | kinesis_video_signaling.ex | starcoder |
defmodule Sourceror.Range do
@moduledoc false
import Sourceror.Identifier, only: [is_unary_op: 1, is_binary_op: 1]
defp split_on_newline(string) do
String.split(string, ~r/\n|\r\n|\r/)
end
@spec get_range(Macro.t()) :: Sourceror.range()
def get_range(quoted)
# Module aliases
def get_range({:__al... | lib/sourceror/range.ex | 0.588889 | 0.512937 | range.ex | starcoder |
defmodule ExContract.Predicates do
@moduledoc """
Predicate functions and operators that are useful in contract specifications.
To use the operator versions of the predicates, this module must be imported in the using module.
"""
@doc """
Logical exclusive or: is either `p` or `q` true, but not both?
#... | lib/ex_contract/predicates.ex | 0.890555 | 0.452536 | predicates.ex | starcoder |
defmodule Benchee.Formatters.Console.RunTime do
@moduledoc """
This deals with just the formatting of the run time results. They are similar
to the way the memory results are formatted, but different enough to where the
abstractions start to break down pretty significantly, so I wanted to extract
these two th... | lib/benchee/formatters/console/run_time.ex | 0.871174 | 0.757234 | run_time.ex | starcoder |
defmodule Bank.Transactions do
@moduledoc """
Module that provides banking transactions.
The following transactions are available: `deposit`, `withdraw`, `transfer`, `split` and `exchange`.
"""
alias Bank.Accounts
alias Ecto.Changeset
@doc """
Transaction `deposit`.
## Examples
iex> {:ok, ac... | lib/bank/transactions.ex | 0.869894 | 0.475057 | transactions.ex | starcoder |
defmodule StepFlow.Workflows do
@moduledoc """
The Workflows context.
"""
import Ecto.Query, warn: false
alias StepFlow.Artifacts.Artifact
alias StepFlow.Jobs
alias StepFlow.Jobs.Status
alias StepFlow.Progressions.Progression
alias StepFlow.Repo
alias StepFlow.Workflows.Workflow
require Logger
... | lib/step_flow/workflows/workflows.ex | 0.811788 | 0.589066 | workflows.ex | starcoder |
defmodule Bolt.Cogs.Kick do
@moduledoc false
@behaviour Nosedrum.Command
alias Nosedrum.Predicates
alias Bolt.{Converters, ErrorFormatters, Helpers, Humanizer, ModLog, Repo, Schema.Infraction}
alias Nostrum.Api
require Logger
@impl true
def usage, do: ["kick <user:member> [reason:str...]"]
@impl t... | lib/bolt/cogs/kick.ex | 0.828558 | 0.518546 | kick.ex | starcoder |
defmodule Entice.Logic.Skills do
use Entice.Logic.Skill
use Entice.Logic.Attributes
defskill NoSkill, id: 0 do
def description, do: "Non-existing skill as a placeholder for empty skillbar slots."
def cast_time, do: 0
def recharge_time, do: 0
def energy_cost, do: 0
end
defskill Healin... | lib/entice/logic/skills/skills.ex | 0.571408 | 0.50293 | skills.ex | starcoder |
defmodule ESx.Schema do
@moduledoc """
Define schema for elasticsaerch using Keyword lists and DSL.
## DSL Example
defmodule MyApp.Blog do
use ESx.Schema
index_name "blog" # Optional
document_type "blog" # Optional
mapping _all: [enabled: false], _ttl: [enabled: true... | lib/esx/schema.ex | 0.863305 | 0.517632 | schema.ex | starcoder |
defmodule Pow.Ecto.Schema.Password do
@moduledoc """
Simple wrapper for password hash and verification.
The password hash format is based on [Pbkdf2](https://github.com/riverrun/pbkdf2_elixir)
## Configuration
This module can be configured by setting the `Pow.Ecto.Schema.Password` key
for the `:pow` app:... | lib/pow/ecto/schema/password.ex | 0.901679 | 0.562297 | password.ex | starcoder |
defmodule Bpmn do
@moduledoc """
BPMN Execution Engine
=====================
Hashiru BPMN allows you to execute any BPMN process in Elixir.
Each node in the BPMN process can be mapped to the appropriate Elixir token and added to a process.
Each loaded process will be added to a Registry under the id of th... | lib/bpmn.ex | 0.653901 | 0.504455 | bpmn.ex | starcoder |
defmodule Graph do
@moduledoc """
This module defines a graph data structure, which supports directed and undirected graphs, in both acyclic and cyclic forms.
It also defines the API for creating, manipulating, and querying that structure.
As far as memory usage is concerned, `Graph` should be fairly compact i... | lib/graph.ex | 0.937081 | 0.914939 | graph.ex | starcoder |
defmodule Matrix.Cluster do
@moduledoc """
Holds state about agent centers registered in cluster.
This module is meant to be used when new agent centers are registered / unregistered
to / from cluster.
## Example
Cluster.register_node %AgentCenter{aliaz: "Mars, address: "localhost:4000"}
Cluster.un... | lib/matrix/cluster.ex | 0.886917 | 0.600452 | cluster.ex | starcoder |
defmodule HomeBot.Monitoring.DailyEnergyMonitoring do
@moduledoc "This job will run some daily checks"
alias HomeBot.DataStore
alias HomeBot.Tools
def run do
check_gas_usage()
check_electricity_usage()
end
def check_gas_usage do
start_time = start_of_yesterday()
end_time = end_of_yesterda... | lib/home_bot/monitoring/daily_energy_monitoring_job.ex | 0.761627 | 0.565629 | daily_energy_monitoring_job.ex | starcoder |
defmodule VerifyOrigin do
@moduledoc """
A Plug adapter to protect from CSRF attacks by verifying the `Origin` header.
## Options
* `:origin` - The origin of the server - requests from this origin will always proceed. Defaults to the default hostname configured for your application's endpoint.
* `:strict... | lib/verify_origin.ex | 0.862829 | 0.431464 | verify_origin.ex | starcoder |
defmodule Morphix do
@moduledoc """
Morphix provides convenience methods for dealing with Maps, Lists, and Tuples.
`morphiflat/1` and `morphiflat!/1` flatten maps, discarding top level keys.
### Examples:
```
iex> Morphix.morphiflat %{flatten: %{this: "map"}, if: "you please"}
{:ok, %{this: "map", if: ... | lib/morphix.ex | 0.919953 | 0.902524 | morphix.ex | starcoder |
defmodule Phoenix.Digester do
@digested_file_regex ~r/(-[a-fA-F\d]{32})/
@moduledoc """
Digests and compress static files.
For each file under the given input path, Phoenix will generate a digest
and also compress in `.gz` format. The filename and its digest will be
used to generate the manifest file. It ... | lib/phoenix/digester.ex | 0.658308 | 0.526951 | digester.ex | starcoder |
defmodule Sanbase.Math do
require Integer
@epsilon 1.0e-6
def round_float(f) when is_float(f) and (f >= 1 or f <= -1), do: Float.round(f, 2)
def round_float(f) when is_float(f) and f >= 0 and f <= @epsilon, do: 0.0
def round_float(f) when is_float(f) and f < 0 and f >= -@epsilon, do: 0.0
def round_float(f... | lib/sanbase/utils/math.ex | 0.842637 | 0.615117 | math.ex | starcoder |
defmodule CRC do
@moduledoc """
This module is used to calculate CRC (Cyclic Redundancy Check) values
for binary data. It uses NIF functions written in C to iterate over
the given binary calculating the CRC checksum value.
CRC implementations have been tested against these online calculators to
validate th... | lib/crc.ex | 0.941399 | 0.831485 | crc.ex | starcoder |
defmodule Artheon.Artist do
use Artheon.Web, :model
@gender_female 0
@gender_male 1
@gender_unknown 2
schema "artists" do
field :uid, :string
field :name, :string
field :slug, :string
field :nationality, :string
field :birthday, :integer
field :gender, :integer
field :hometown, :... | web/models/artist.ex | 0.5 | 0.463505 | artist.ex | starcoder |
defmodule EdgeDB.Protocol.Enum do
alias EdgeDB.Protocol.Datatypes
@callback to_atom(integer() | atom()) :: atom()
@callback to_code(atom() | integer()) :: integer()
@callback encode(term()) :: iodata()
@callback decode(bitstring()) :: {term(), bitstring()}
defmacro __using__(_opts \\ []) do
quote do
... | lib/edgedb/protocol/enum.ex | 0.677581 | 0.451508 | enum.ex | starcoder |
defmodule Membrane.Caps.Matcher do
@moduledoc """
Module that allows to specify valid caps and verify that they match specification.
Caps specifications (specs) should be in one of the formats:
* simply module name of the desired caps (e.g. `Membrane.Caps.Audio.Raw` or `Raw` with proper alias)
* tuple w... | lib/membrane/caps/matcher.ex | 0.908456 | 0.714404 | matcher.ex | starcoder |
defmodule BreakingPP.Model.Cluster do
alias BreakingPP.Model.{Node, Session}
defstruct [
started_nodes: [],
stopped_nodes: [],
sessions: [],
splits: MapSet.new()
]
@type session_id :: {Node.t, String.t}
@type split :: {Node.t, Node.t}
@type t :: %__MODULE__{
started_nodes: [Node.t],
... | lib/breaking_pp/model/cluster.ex | 0.691602 | 0.644777 | cluster.ex | starcoder |
defmodule Ecto.Pool do
@moduledoc """
Behaviour for using a pool of connections.
"""
@typedoc """
A pool process
"""
@type t :: atom | pid
@typedoc """
Opaque connection reference.
Use inside `run/4` and `transaction/4` to retrieve the connection module and
pid or break the transaction.
"""
... | lib/ecto/pool.ex | 0.899151 | 0.714911 | pool.ex | starcoder |
defmodule Bottle.Number do
@moduledoc """
Provides custom guards for numbers
"""
@doc """
Guard that passes when a number is 0 (including float 0.0)
## Examples
iex> is_zero(0)
true
iex> is_zero(0.0)
true
iex> is_zero(1)
false
"""
defguard is_zero(sub) when is_nu... | lib/bottle/number.ex | 0.77437 | 0.414454 | number.ex | starcoder |
defmodule OMG.Performance do
@moduledoc """
OMG network performance tests. Provides general setup and utilities to do the perf tests.
"""
defmacro __using__(_opt) do
quote do
alias OMG.Performance
alias OMG.Performance.ByzantineEvents
alias OMG.Performance.ExtendedPerftest
alias OM... | apps/omg_performance/lib/performance.ex | 0.852706 | 0.631708 | performance.ex | starcoder |
defmodule Vow.FunctionWrapper do
@moduledoc """
This vow wraps an annoymous function for the purpose of improved error
messages and readability of vows.
The `Function` type impelements the `Inspect` protocol in Elixir, but
annoymous functions are printed as something similar to the following:
```
# ... | lib/vow/function_wrapper.ex | 0.865977 | 0.86293 | function_wrapper.ex | starcoder |
defmodule PgMoney do
@moduledoc """
Contains the all the basic types and guards to work with the `money` data type.
"""
@type money :: -9_223_372_036_854_775_808..9_223_372_036_854_775_807
@type precision :: non_neg_integer()
@type telemetry :: false | nonempty_list(atom())
@type config :: %{
p... | lib/pg_money.ex | 0.922665 | 0.530236 | pg_money.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.