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 Monad.Writer do
@moduledoc """
The writer monad keeps track of a calculation and a "log".
The log can be anything that conforms to the `Monoid` protocol.
It's often useful to combine the writer monad with others. For example, you
can use a `Monad.Maybe` as the `value` of the writer monad. This off... | lib/monad/writer.ex | 0.852506 | 0.697029 | writer.ex | starcoder |
defmodule CanvasAPI.Team do
@moduledoc """
A group of users in a Slack team.
"""
use CanvasAPI.Web, :model
alias CanvasAPI.ImageMap
@type t :: %__MODULE__{}
schema "teams" do
field :domain, :string
field :images, :map, default: %{}
field :name, :string
field :slack_id, :string
man... | web/models/team.ex | 0.805173 | 0.412382 | team.ex | starcoder |
defmodule Asteroid.ObjectStore.AuthenticatedSession.Riak do
@moduledoc """
Riak implementation of the `Asteroid.ObjectStore.AuthenticatedSession` behaviour
## Initializing a Riak bucket type
```console
$ sudo riak-admin bucket-type create ephemeral_token '{"props":{"datatype":"map", "backend":"leveldb_mult"... | lib/asteroid/object_store/authenticated_session/riak.ex | 0.931416 | 0.712301 | riak.ex | starcoder |
defmodule ExSieve.Predicate do
@moduledoc false
import ExSieve.CustomPredicate, only: [custom_predicates: 0]
@true_values [1, true, "1", "T", "t", "true", "TRUE"]
@type predicate_spec :: {
prediate_name :: atom(),
allowed_types :: :all | [Ecto.Type.primitive()],
allowed_values :... | lib/ex_sieve/predicate.ex | 0.68784 | 0.460835 | predicate.ex | starcoder |
defmodule ExPokerEval.Card do
@moduledoc """
Card manipulation functions
"""
@suits ~w(H D S C)
@doc """
Gets an array of cards as a keyword of cards represented by
value and suit.
## Examples
```
iex>ExPokerEval.Card.parse_hand(~w(KD))
{:ok, [[suit: "D", value: 13]]}
iex>ExPokerEval.Card.p... | lib/ex_poker_eval/card.ex | 0.815012 | 0.879302 | card.ex | starcoder |
defmodule P9 do
@moduledoc """
# Definition
- レベルアップ = floor(倒したモンスターのレベル / 2)
- 敵は円状に並んでいる
- 最初の敵は選べる
- 戦わせる順番は、一戦ごとに決め、min level and min fight
- 手持ちのパーティー中で戦闘回数が一番多い回数がもっとも低くなるように、最初に戦う相手を選ぶ。
- その際の、一番戦闘回数が多い数を求める。
1_500 *
# Examples
iex> P9.solve(3, [6, 1, 5], [9, 2, 7])
2
iex> P... | lib/100/p9.ex | 0.529263 | 0.524699 | p9.ex | starcoder |
defmodule Liquex do
@moduledoc """
Liquid template renderer for Elixir with 100% compatibility with the
[Liquid](https://shopify.github.io/liquid/) gem by [Shopify](https://www.shopify.com/).
## Basic Usage
iex> {:ok, template_ast} = Liquex.parse("Hello {{ name }}!")
iex> {content, _context} = Liq... | lib/liquex.ex | 0.709422 | 0.568865 | liquex.ex | starcoder |
defmodule ExAws.Boto do
require ExAws.Boto.Util
alias ExAws.Boto.Util, as: Util
alias ExAws.Boto.Operation, as: Operation
alias ExAws.Boto.Shape, as: Shape
@doc """
Loads a service JSON spec from botocore, and generates client modules and objects.
Accepts a list of services and API versions to load.
... | lib/ex_aws_boto.ex | 0.606498 | 0.472683 | ex_aws_boto.ex | starcoder |
defmodule Esperanto.Parser do
@moduledoc """
Parser interface
"""
alias Esperanto.Walker
@type tree() :: any()
@doc """
Parse given input
paremters:
* `walker`- Parse is responsible to walk trough input
* `tree`- Current AST tree
* `parent_id`- id of the parent node
* `opts`- id of the ... | apps/esperanto/lib/trybe/esperanto/parse.ex | 0.82925 | 0.496765 | parse.ex | starcoder |
defmodule Rummage.Ecto.CustomHooks.SimpleSort do
@moduledoc """
`Rummage.Ecto.CustomHooks.SimpleSort` is a custom sort hook that comes shipped
with `Rummage.Ecto`.
Usage:
For a regular sort:
```elixir
alias Rummage.Ecto.CustomHooks.SimpleSort
# This returns a queryable which upon running will give a ... | lib/rummage_ecto/custom_hooks/simple_sort.ex | 0.832339 | 0.850313 | simple_sort.ex | starcoder |
defmodule Membrane.RTP.SilenceDiscarder do
@moduledoc """
Element responsible for dropping silent audio packets.
For a packet to be discarded it needs to contain a `RTP.Header.Extension` struct with identifier equal to `vad_id` in
its extensions list. The header extension will contain information about audio l... | lib/membrane/rtp/silence_discarder.ex | 0.856512 | 0.459197 | silence_discarder.ex | starcoder |
defmodule Analyzer do
import SumMag
@type asm :: %{args: list(any), operators: list(atom)}
@moduledoc """
Provides optimizer for anonymous functions.
"""
@doc """
Check if expressions can be optimzed.
When the expression is enable to optimize, {:ok, map} is returned.
The map is shape following: %{... | lib/pelemay/analyzer.ex | 0.690246 | 0.533762 | analyzer.ex | starcoder |
defmodule Exotus.Upload do
@moduledoc """
Handling the lifecycle of a chunked upload.
"""
use GenStateMachine
def start_link(inital_data) do
GenStateMachine.start_link(__MODULE__, inital_data)
end
def append(server, offset, iodata) do
GenStateMachine.call(server, {:append, offset, iodata})
end... | lib/exotus/upload.ex | 0.52902 | 0.417004 | upload.ex | starcoder |
defmodule Tox.IsoDays do
@moduledoc false
@spec add(Calendar.iso_days(), Calendar.iso_days()) :: Calendar.iso_days()
def add(
{days1, {parts_in_day1, parts_per_day}},
{days2, {parts_in_day2, parts_per_day}}
) do
adjust({days1 + days2, {parts_in_day1 + parts_in_day2, parts_per_day}})
e... | lib/tox/iso_days.ex | 0.807916 | 0.405861 | iso_days.ex | starcoder |
defmodule PolicrMini.Logger do
@moduledoc """
查询和记录日志。
"""
require Logger
alias :mnesia, as: Mnesia
@type query_cont :: [
{:level, atom | nil},
{:beginning, integer | nil},
{:ending, integer | nil}
]
@doc """
查询已持久化存储的日志。
参数 `query_cont` 表示查询条件,支持以下可选项:
- `... | lib/policr_mini/logger.ex | 0.680985 | 0.57517 | logger.ex | starcoder |
defmodule Rummage.Ecto.Schema.Macro do
@moduledoc """
Usage:
```elixir
defmodule MyApp.Rummage.MyModel do
use Rummage.Schema,
paginate: MyApp.Rummage.Paginate,
sort: MyApp.Rummage.MyModel.Sort,
search: MyApp.Rummage.MyModel.Search,
schema: MyApp.MyModel
end
```
"""
defmacro ... | lib/rummage_ecto/schema/macro.ex | 0.574753 | 0.528168 | macro.ex | starcoder |
defmodule Mix.Tasks.Akd.Gen.Task do
@shortdoc ~w(Generates an Akd.Mix.Task which can be used to deploy an app)
@tsk ~s(mix akd.gen.task)
@info """
#{@tsk} expects both module name and optional parameters:
$ `@{tsk} TaskModule -f FetcherModule`
Usage:
$ `@{tsk} Deploy -f Akd.Fetcher.Git`
Opt... | lib/akd/mix/gen/task.ex | 0.689828 | 0.432543 | task.ex | starcoder |
defmodule Aecore.Channel.ChannelTransaction do
@moduledoc """
Behaviour specifying the necessary functions which any onchain/offchain transaction modifying the offchain chainstate must implement.
"""
alias Aecore.Chain.Identifier
alias Aecore.Channel.{ChannelOffChainUpdate, ChannelOffChainTx, ChannelStateO... | apps/aecore/lib/aecore/channel/channel_transaction.ex | 0.904756 | 0.445831 | channel_transaction.ex | starcoder |
defmodule SpadesGame.GameAI.Play do
@moduledoc """
Functions for the AI figuring out which card to play.
"""
alias SpadesGame.{Card, Deck, Game, TrickCard}
alias SpadesGame.GameAI.PlayInfo
@spec play(Game.t()) :: Card.t()
def play(%Game{turn: turn, trick: trick} = game) when turn != nil do
{:ok, vali... | backend/lib/spades_game/ai/game_ai_play.ex | 0.804367 | 0.564219 | game_ai_play.ex | starcoder |
defmodule MapTransform do
@moduledoc """
This is a simple library that can transform one map into another through
mapping rules.
"""
@type path :: nonempty_list(term)
@type mapping :: {path, path} | {path, path, (term -> term)}
@doc """
Transform one map into another.
## Format for mappings
For... | lib/map_transform.ex | 0.850422 | 0.648383 | map_transform.ex | starcoder |
defmodule HtPipe do
@moduledoc """
`HtPipe`: Macro for the Heavy Task Pipeline operator.
"""
@sub_elixir_alive_time 100_000
@doc """
Starts a task that can be awaited on with being supervised,
and temporarily blocks the caller process waiting
for a task reply with shutdown.
The task won't be linked... | lib/ht_pipe.ex | 0.70304 | 0.558207 | ht_pipe.ex | starcoder |
defmodule Auctoritas.DataStorage.Data do
alias Auctoritas.DataStorage.Data
@typedoc "Token expiration in seconds"
@type expiration() :: non_neg_integer()
@typedoc "When was token inserted (UNIX Epoch time)"
@type inserted_at() :: non_neg_integer()
@typedoc "When was token updated (UNIX Epoch time)"
@ty... | lib/auctoritas/data_storage/data.ex | 0.831827 | 0.441793 | data.ex | starcoder |
defmodule Period.Relationship do
@moduledoc """
Does work with relationships between two `Period`'s.
"""
@typep relationship ::
:same
| :contains
| :contained
| :before
| :after
| :insertsect_start
| :intersect_end
| :abut_... | lib/period/relationship.ex | 0.946138 | 0.892516 | relationship.ex | starcoder |
defmodule Couch.Test.Setup do
@moduledoc """
Allows to chain setup functions.
Example of using:
```
alias Couch,Test.Utils
def with_db_name(context, setup) do
setup =
setup
|> Step.Start.new(:start, extra_apps: [:chttpd])
|> Step.User.new(:admin, roles: [:server_admin]... | test/elixir/lib/setup.ex | 0.621541 | 0.71852 | setup.ex | starcoder |
defmodule Tensorflow.GraphTransferInfo.Destination do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3
@type t :: integer | :NOP | :HEXAGON
field(:NOP, 0)
field(:HEXAGON, 1)
end
defmodule Tensorflow.GraphTransferNodeInput do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODU... | lib/tensorflow/core/framework/graph_transfer_info.pb.ex | 0.776919 | 0.523786 | graph_transfer_info.pb.ex | starcoder |
defmodule Notoriety.Note.Meta do
@moduledoc false
defstruct title: nil, tags: []
end
defmodule Notoriety.Note do
@moduledoc """
A `Note` is the focal point of Notoriety, representing a markdown file with
any tags parsed out of yaml front matter.
"""
alias Notoriety.Note.Meta
@doc """
A parsed `No... | lib/notoriety/note.ex | 0.680666 | 0.527073 | note.ex | starcoder |
defmodule Exfacebook do
use GenServer
use Exfacebook.Macros
@moduledoc ~S"""
Exfacebook implements Graph Api:
* `Exfacebook.Api` - graph calls using access token to Facebook Graph API,
depends on respnse it returns decoded to JSON values.
* `Exfacebook.Config` - specify `api_version` and http req... | lib/exfacebook.ex | 0.857753 | 0.673672 | exfacebook.ex | starcoder |
defmodule JSON do
@moduledoc """
Provides a RFC 7159, ECMA 404, and JSONTestSuite compliant JSON Encoder / Decoder
"""
require Logger
import JSON.Logger
alias JSON.Decoder
alias JSON.Encoder
@vsn "1.0.2"
@doc """
Returns a JSON string representation of the Elixir term
## Examples
iex>... | node_modules/@snyk/snyk-hex-plugin/elixirsrc/deps/json/lib/json.ex | 0.890669 | 0.519399 | json.ex | starcoder |
defmodule APDS9960.Proximity do
@moduledoc "The proximity detection."
alias APDS9960.{Comm, Sensor}
@doc """
Returns all the current proximity settings.
"""
@spec settings(Sensor.t()) :: %{
enabled: boolean,
gain: 0..3,
gain_compensation: %{enabled: boolean, mask: byte},
... | lib/apds9960/proximity.ex | 0.876892 | 0.420897 | proximity.ex | starcoder |
defmodule CatalogApi.Address do
@moduledoc """
Defines the CatalogApi.Address struct and functions which are responsible for
validation and interpretation of physical shipping addresses as they relate
to CatalogApi.
To see the CatalogApi documentation for what is and isn't a valid Address see
`http://usern... | lib/catalog_api/address.ex | 0.917682 | 0.508117 | address.ex | starcoder |
defmodule Date do
@moduledoc """
A Date struct and functions.
The Date struct contains the fields year, month, day and calendar.
New dates can be built with the `new/3` function or using the
`~D` (see `Kernel.sigil_D/2`) sigil:
iex> ~D[2000-01-01]
~D[2000-01-01]
Both `new/3` and sigil return ... | lib/elixir/lib/calendar/date.ex | 0.91621 | 0.891197 | date.ex | starcoder |
defmodule Money do
import Kernel, except: [abs: 1]
@moduledoc """
Defines a `Money` struct along with convenience methods for working with currencies.
## Examples
iex> money = Money.new(500, :USD)
%Money{amount: 500, currency: :USD}
iex> money = Money.add(money, 550)
%Money{amount: 10... | lib/money.ex | 0.895546 | 0.671942 | money.ex | starcoder |
defmodule Mix.Tasks.PromEx.Dashboard.Export do
@moduledoc """
This will render a PromEx dashboard either to STDOUT or to a file depending on
the CLI arguments that are provided.
The following CLI flags are supported:
```md
-d, --dashboard The name of the dashboard that you would like to export from PromEx... | lib/mix/tasks/prom_ex.dashboard.export.ex | 0.810591 | 0.799638 | prom_ex.dashboard.export.ex | starcoder |
defmodule PewPew.Mailer do
@moduledoc """
This is the module used to manage the messages themselves.
"""
defstruct [
to: [], cc: [], bcc: [], subject: nil, text: nil, html: nil, attach: [],
from: nil
]
# The Mailgun API base path.
@mailgun "https://api.mailgun.net/v3"
@doc """
This is the f... | lib/pewpew/mailer.ex | 0.796055 | 0.523299 | mailer.ex | starcoder |
defmodule Elsa.Supervisor do
@moduledoc """
Top-level supervisor that orchestrates all other components
of the Elsa library. Allows for a single point of integration
into your application supervision tree and configuration by way
of a series of nested keyword lists
Components not needed by a running applic... | deps/elsa/lib/elsa/supervisor.ex | 0.861844 | 0.805861 | supervisor.ex | starcoder |
defmodule Cldr.Time.Interval do
@moduledoc """
Interval formats allow for software to format intervals like "Jan 10-12, 2008" as a
shorter and more natural format than "Jan 10, 2008 - Jan 12, 2008". They are designed
to take a start and end date, time or datetime plus a formatting pattern
and use that informa... | lib/cldr/interval/time.ex | 0.918361 | 0.650301 | time.ex | starcoder |
defmodule Bella.Server.Reconciler do
@moduledoc """
Continuously reconciles a set of kubernetes resources.
`reconcile/1` will be executed asynchronously with each result returned from `reconcilable_resources/0`.
`reconcilable_resources/0` has a default implementation of running `K8s.Client.stream/2` with `rec... | lib/bella/server/reconciler.ex | 0.89616 | 0.671636 | reconciler.ex | starcoder |
defmodule Calendar do
@moduledoc """
This module defines the responsibilities for working with
calendars, dates, times and datetimes in Elixir.
Currently it defines types and the minimal implementation
for a calendar behaviour in Elixir. The goal of the Calendar
features in Elixir is to provide a base for ... | lib/elixir/lib/calendar.ex | 0.936125 | 0.74375 | calendar.ex | starcoder |
defmodule ExCoveralls.Stats do
@moduledoc """
Provide calculation logics of coverage stats.
"""
alias ExCoveralls.Cover
alias ExCoveralls.Settings
defmodule Source do
@moduledoc """
Stores count information for a file and all source lines.
"""
defstruct filename: "", coverage: 0, sloc: 0, ... | lib/excoveralls/stats.ex | 0.797714 | 0.462473 | stats.ex | starcoder |
defmodule Yggdrasil.Redis.Application do
@moduledoc """
[](https://travis-ci.org/gmtprime/yggdrasil_redis) [](https://hex.pm/packages/yggdrasil_redis) [![hex.pm dow... | lib/yggdrasil/redis/application.ex | 0.901567 | 0.969785 | application.ex | starcoder |
defmodule SanbaseWeb.Graphql.ProjectTypes do
use Absinthe.Schema.Notation
import Absinthe.Resolution.Helpers
import SanbaseWeb.Graphql.Cache, only: [cache_resolve: 1, cache_resolve: 2]
alias SanbaseWeb.Graphql.Resolvers.{
ClickhouseResolver,
ProjectResolver,
ProjectSignalsResolver,
ProjectMet... | lib/sanbase_web/graphql/schema/types/project_types.ex | 0.777258 | 0.505554 | project_types.ex | starcoder |
defmodule Mix.Tasks.Xref do
use Mix.Task
import Mix.Compilers.Elixir,
only: [read_manifest: 1, source: 0, source: 1, source: 2, module: 1]
@shortdoc "Prints cross reference information"
@recursive true
@manifest "compile.elixir"
@moduledoc """
Prints cross reference information between modules.
... | lib/mix/lib/mix/tasks/xref.ex | 0.852844 | 0.548915 | xref.ex | starcoder |
defmodule Phoenix.Logger do
@moduledoc """
Instrumenter to handle logging of various instrumentation events.
## Parameter filtering
When logging parameters, Phoenix can filter out sensitive parameters
such as passwords and tokens. Parameters to be filtered can be
added via the `:filter_parameters` option:... | lib/phoenix/logger.ex | 0.802788 | 0.52141 | logger.ex | starcoder |
defmodule Robotica.Scheduler.Classifier do
@moduledoc """
Process schedule classifier days
"""
alias Robotica.Config.Loader
alias Robotica.Types
defp is_week_day?(date) do
case Date.day_of_week(date) do
dow when dow in 1..5 -> true
_ -> false
end
end
if Application.compile_env(:rob... | robotica/lib/robotica/scheduler/classifier.ex | 0.651466 | 0.537345 | classifier.ex | starcoder |
defmodule Mux.Video.Assets do
@moduledoc """
This module provides functions for managing assets in Mux Video. [API Documentation](https://docs.mux.com/v1/reference#assets)
"""
alias Mux.{Base, Fixtures}
@path "/video/v1"
@doc """
Create a new asset.
Returns `{:ok, asset, %Tesla.Client{}}`.
## Exam... | lib/mux/video/assets.ex | 0.817684 | 0.445771 | assets.ex | starcoder |
defmodule Numerix.Distance do
@moduledoc """
Distance functions between two vectors.
"""
use Numerix.Tensor
import Numerix.LinearAlgebra
alias Numerix.{Common, Correlation, Statistics}
@doc """
Mean squared error, the average of the squares of the errors
betwen two vectors, i.e. the difference bet... | lib/distance.ex | 0.881242 | 0.925027 | distance.ex | starcoder |
defmodule Cassette.Plug do
@moduledoc """
A plug to authenticate using Cassette
When plugged, this will test the session for the presence of the user.
When not present it will test for presence of a ticket parameter and validate it.
If none of those are present, it will redirect the user to the cas login.
... | lib/cassette/plug.ex | 0.816809 | 0.809201 | plug.ex | starcoder |
defmodule Drab.Core do
@moduledoc ~S"""
Drab module providing the base of communication between the browser and the server.
`Drab.Core` defines the method to declare client-side events, which are handled server-side in the commander
module. Also provides basic function for running JS code directly from Phoenix... | lib/drab/core.ex | 0.780077 | 0.540378 | core.ex | starcoder |
defmodule Rayray.Renderings.SphereShaded do
alias Rayray.Canvas
alias Rayray.Intersect
alias Rayray.Intersection
alias Rayray.Lights
alias Rayray.Material
# alias Rayray.Matrix
alias Rayray.Normal
alias Rayray.Ray
alias Rayray.Sphere
alias Rayray.Tuple
def do_it(ray_origin \\ Tuple.point(0, 0, -5... | lib/rayray/renderings/sphere_shaded.ex | 0.596316 | 0.566049 | sphere_shaded.ex | starcoder |
defmodule SteamEx.ICheatReportingService do
@moduledoc """
This service allows your game to report cheats and cheaters to the [VAC](https://partner.steamgames.com/doc/features/anticheat#VAC) system and provides the toolset behind the [Game Bans](https://partner.steamgames.com/doc/features/anticheat#GameBans) system... | lib/interfaces/i_cheat_reporting_service.ex | 0.675551 | 0.712857 | i_cheat_reporting_service.ex | starcoder |
defmodule Bunch do
@moduledoc """
A bunch of general-purpose helper and convenience functions.
"""
alias __MODULE__.Type
@doc """
Imports a bunch of Bunch macros: `withl/1`, `withl/2`, `~>/2`, `~>>/2`, `quote_expr/1`, `quote_expr/2`
"""
defmacro __using__(_args) do
quote do
import unquote(__... | lib/bunch.ex | 0.783326 | 0.490419 | bunch.ex | starcoder |
defmodule Saucexages.IO.BinaryReader do
@moduledoc """
Reads SAUCE data from binaries according to the SAUCE specification.
SAUCE data is decoded decoded according to the SAUCE spec.
If you need to read files from the local file system directly in a more efficient manner, see `Saucexages.IO.FileReader`.
##... | lib/saucexages/io/binary_reader.ex | 0.911293 | 0.897919 | binary_reader.ex | starcoder |
defmodule Grizzly.ZWave.Commands.MultiChannelAggregatedMembersReport do
@moduledoc """
This command is used to advertise the members of an Aggregated End Point.
Params:
* `:aggregated_end_point` - an aggregated end_point (required)
* `:members` - the lists of end points member of the aggregated end poi... | lib/grizzly/zwave/commands/multi_channel_aggregated_members_report.ex | 0.829008 | 0.471223 | multi_channel_aggregated_members_report.ex | starcoder |
defmodule Rules.Poker.Mechanics.SeatedPlayer do
@moduledoc """
A SP status is just a data structure defining
the following details regarding their play in
this turn:
- status: :active, :all_in, :away, :folded.
Other useful statuses:
- :pending: The [new] hand has not yet
star... | lib/rules/poker/mechanics/seated_player.ex | 0.635109 | 0.503174 | seated_player.ex | starcoder |
defmodule Seqfuzz do
@moduledoc """
Seqfuzz is an implementation of a sequential fuzzy string matching algorithm, similar to those used in code editors like Sublime Text. It is based on <NAME>'s work on [lib_ftps](https://github.com/forrestthewoods/lib_fts/) and his blog post [Reverse Engineering Sublime Text's Fuz... | lib/seqfuzz.ex | 0.889054 | 0.886764 | seqfuzz.ex | starcoder |
defmodule TeslaMate.Vehicles.Vehicle.Summary do
import TeslaMate.Convert, only: [miles_to_km: 2, mph_to_kmh: 1]
alias TeslaApi.Vehicle.State.{Drive, Charge}
alias TeslaApi.Vehicle
defstruct [
:display_name,
:state,
:since,
:battery_level,
:ideal_battery_range_km,
:est_battery_range_km,... | lib/teslamate/vehicles/vehicle/summary.ex | 0.684686 | 0.541773 | summary.ex | starcoder |
defmodule Grizzly.CommandClass.NetworkManagementInclusion.NodeAddDSKSet do
@moduledoc """
Command module for working with NETWORK_MANAGEMENT_INCLUSION NODE_ADD_DSK_SET command.
command options:
* `:accept`: - Boolean that indicates if S2 requested keys should be granted
* `:input_dsk` - The 5 digit pin ... | lib/grizzly/command_class/network_management_inclusion/node_add_dsk_set.ex | 0.869763 | 0.418786 | node_add_dsk_set.ex | starcoder |
defmodule Unicode.Transform.Rule.Conversion do
@moduledoc """
#### 10.3.9 [Conversion Rules](https://unicode.org/reports/tr35/tr35-general.html#Conversion_Rules)
Conversion rules can be forward, backward, or double. The complete conversion rule syntax is described below:
**Forward**
> A forward conversion ... | lib/unicode/transform/rule/conversion.ex | 0.887571 | 0.886322 | conversion.ex | starcoder |
defmodule Bitcoinex.Segwit do
@moduledoc """
SegWit address serialization.
"""
alias Bitcoinex.Bech32
use Bitwise
@valid_witness_program_length_range 2..40
@valid_witness_version 0..16
@supported_network [:mainnet, :testnet, :regtest]
@type hrp :: String.t()
@type data :: list(integer)
# seem ... | server/bitcoinex/lib/segwit.ex | 0.843219 | 0.411406 | segwit.ex | starcoder |
defmodule NebulexEcto.Repo do
@moduledoc """
Wrapper/Facade on top of `Nebulex.Cache` and `Ecto.Repo`.
This module encapsulates the access to the Ecto repo and Nebulex cache,
providing a set of functions compliant with the `Ecto.Repo` API.
For retrieve-like functions, the wrapper access the cache first, if ... | lib/nebulex_ecto/repo.ex | 0.85561 | 0.488527 | repo.ex | starcoder |
defmodule Erlef.Schema do
@moduledoc """
Imports all functionality for an ecto schema
### Usage
```
defmodule Erlef.Schema.MySchema do
use Erlef.Schema
schema "my_schemas" do
# Fields
end
end
```
"""
alias Erlef.Inputs
import Ecto.Changeset
defmacro __using__(_opts) do
quo... | lib/erlef/schema.ex | 0.719581 | 0.55929 | schema.ex | starcoder |
defmodule Mxpanel.Groups do
@options_schema [
time: [
type: :pos_integer,
doc: "Specific timestamp in seconds of the event. Defaults to `System.os_time(:second)`."
]
]
@moduledoc """
Functions to manipulate group profiles.
## Shared Options
All of the functions in this module accept t... | lib/mxpanel/groups.ex | 0.823009 | 0.433322 | groups.ex | starcoder |
defmodule GenSpoxy.Stores.Ets do
@moduledoc """
implements the `GenSpoxy.Store` behaviour.
it stores its data under `ets` and it manages it in using sharded `GenServer`.
"""
use GenServer
use GenSpoxy.Partitionable
@behaviour GenSpoxy.Store
alias GenSpoxy.Defaults
@total_partitions Defaults.total_... | lib/store/ets/ets.ex | 0.800692 | 0.405625 | ets.ex | starcoder |
defmodule Stripe.BalanceTransaction do
@moduledoc """
Work with [Stripe `balance_transaction` objects] (https://stripe.com/docs/api#balance_transactions/object).
You can:
- [Retrieve a balance transaction](https://stripe.com/docs/api/balance_transactions/retrieve)
- [List all balance history](https://stripe... | lib/stripe/core_resources/balance_transaction.ex | 0.859943 | 0.420213 | balance_transaction.ex | starcoder |
defmodule Prog do
@moduledoc """
Documentation for `Prog`.
"""
@doc """
Day 11
"""
def solve do
{:ok, raw} = File.read("data/day_11")
# raw = "L.LL.LL.LL
# LLLLLLL.LL
# L.L.L..L..
# LLLL.LL.LL
# L.LL.LL.LL
# L.LLLLL.LL
# ..L.L.....
# LLLLLLLLLL
# L.LLLLLL.L
# L.LLLLL.LL"
data = String.split... | lib/days/day_11.ex | 0.548915 | 0.403273 | day_11.ex | starcoder |
defmodule ExqLimit.GCRA do
@moduledoc """
This module implements the
[GCRA](https://en.wikipedia.org/wiki/Generic_cell_rate_algorithm)
algorithm. Check the [blog post](https://brandur.org/rate-limiting)
by brandur for an excellent introduction.
### Example
{ExqLimit.GCRA, period: :hour, rate: 60}
... | lib/exq_limit/gcra.ex | 0.846847 | 0.739681 | gcra.ex | starcoder |
defmodule Jeeves.Pooled do
@moduledoc """
Implement a singleton (global) named pool of services.
Creates a dynamic pool of worker services. Each service shares an initial state,
and each invocation of a service is independent from the previous one (so there
is no concept of claiming a service for your dedic... | lib/jeeves/pooled.ex | 0.87215 | 0.835416 | pooled.ex | starcoder |
defmodule Nesty do
@moduledoc """
Convenient helpers when dealing with nested keywords and maps.
"""
@type key :: Keyword.key | Map.key
@type default :: any
@type value :: Keyword.value | Map.value
@doc """
Get the value deeply nested at the specified key path.
If a key does... | lib/nesty.ex | 0.847826 | 0.431464 | nesty.ex | starcoder |
defmodule Advent.Y2021.D14 do
@moduledoc """
https://adventofcode.com/2021/day/14
"""
@typep rules :: %{charlist() => {charlist(), charlist()}}
@doc """
Apply 10 steps of pair insertion to the polymer template and find the most
and least common elements in the result. What do you get if you take the
q... | lib/advent/y2021/d14.ex | 0.725649 | 0.618492 | d14.ex | starcoder |
defmodule Zaryn.Reward do
@moduledoc """
Module which handles the rewards and transfer scheduling
"""
alias Zaryn.OracleChain
alias Zaryn.P2P
alias Zaryn.P2P.Message.GetTransactionChain
alias Zaryn.P2P.Message.GetUnspentOutputs
alias Zaryn.P2P.Message.TransactionList
alias Zaryn.P2P.Message.UnspentO... | lib/zaryn/reward.ex | 0.795221 | 0.456591 | reward.ex | starcoder |
defmodule RemoteDockers.ContainerConfig do
alias RemoteDockers.MountPoint
@enforce_keys [:Image]
@derive Jason.Encoder
defstruct [
:Env,
:HostConfig,
:Image
]
@doc """
Build a container configuration with a specified `image_name`.
## Example:
```elixir
iex> ContainerConfig.new("he... | lib/container_config.ex | 0.86712 | 0.598459 | container_config.ex | starcoder |
defmodule Godfist.DataDragon.Data do
@moduledoc """
Interact with the data endpoints from DataDragon in English.
Each function must be passed a locale as an atom, you can consult the available
languages on `Godfist.Static.languages/1`.
Default language is english(United States) if none is specified.
These... | lib/godfist/requests/data_dragon/data.ex | 0.803637 | 0.832373 | data.ex | starcoder |
defmodule Mnemonix.Supervision do
@moduledoc """
Functions to start a store server.
Using this module will define `start_link` functions that allow your module to offer an API for
booting up a `Mnemonix.Store.Server`.
Providing a `:default` option will allow you to override the configuration described in
... | lib/mnemonix/supervision.ex | 0.913493 | 0.424412 | supervision.ex | starcoder |
defmodule Comeonin.Bcrypt do
@moduledoc """
Module to handle bcrypt authentication.
Bcrypt is a key derivation function for passwords designed by <NAME>
and <NAME>. Bcrypt is an adaptive function, which means that it can
be configured to remain slow and resistant to brute-force attacks even as
computationa... | deps/comeonin/lib/comeonin/bcrypt.ex | 0.792986 | 0.549157 | bcrypt.ex | starcoder |
defmodule OMG.Burner.ThresholdAgent do
@moduledoc """
ThresholdAgent is a background task once in a while gets current gas price,
checks whether thresholds has been met. If so, it triggers fee exit.
"""
use AdjustableServer
alias OMG.Burner.HttpRequester, as: Requester
alias OMG.Burner.State
requi... | apps/omg_burner/lib/omg_burner/threshold_agent.ex | 0.657978 | 0.401834 | threshold_agent.ex | starcoder |
defmodule Benchee.Formatters.Console.Memory do
@moduledoc false
# 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
# th... | lib/benchee/formatters/console/memory.ex | 0.82379 | 0.524029 | memory.ex | starcoder |
defmodule Ig do
@moduledoc """
Public interface for using IG Api's wrapper.
It expects following config:
```
config :ig,
users: %{
user_name: %{
identifier: "...",
password: "...",
api_key: "...",
demo: false
}
}
```
where:
- `user_name` is a human re... | lib/ig.ex | 0.879121 | 0.678893 | ig.ex | starcoder |
defmodule SchedEx do
@moduledoc """
SchedEx schedules jobs (either an m,f,a or a function) to run in the future. These jobs are run in isolated processes, and are unsurpervised.
"""
@doc """
Runs the given module, function and argument at the given time
"""
def run_at(m, f, a, %DateTime{} = time) when is... | lib/sched_ex.ex | 0.870501 | 0.768516 | sched_ex.ex | starcoder |
defmodule SampleProjects.Language.SentenceComplete do
@moduledoc false
def run do
{training_data, words} = gen_training_data
blank_vector = NeuralNet.get_blank_vector(words)
IO.puts "Generating neural network."
net = GRU.new(%{input_ids: words, output_ids: words})
IO.puts "Beginning t... | lib/sample_projects/language/sentence_complete.ex | 0.545286 | 0.504639 | sentence_complete.ex | starcoder |
defmodule Axon.Shared do
@moduledoc false
# Collection of private helper functions and
# macros for enforcing shape/type constraints,
# doing shape calculations, and even some
# helper numerical definitions.
import Nx.Defn
@doc """
Asserts `lhs` has same shape as `rhs`.
"""
defn assert_shape!(cal... | lib/axon/shared.ex | 0.821939 | 0.589716 | shared.ex | starcoder |
defmodule QRCode.GaloisField do
@moduledoc """
Galios Field GF(256) functions.
"""
@type value() :: 1..255
@type alpha() :: 0..254
# {index, aplha}
@gf_table [
{1, 0},
{2, 1},
{3, 25},
{4, 2},
{5, 50},
{6, 26},
{7, 198},
{8, 3},
{9, 223},
{10, 51},
{11, 238},
... | lib/qr_code/galois_field.ex | 0.678007 | 0.446434 | galois_field.ex | starcoder |
defmodule PriorityQueue do
@moduledoc """
This module defines a priority queue datastructure, intended for use with graphs, as it prioritizes
lower priority values over higher priority values (ideal for priorities based on edge weights, etc.).
This implementation makes use of `:gb_trees` under the covers. It i... | lib/priority_queue.ex | 0.935832 | 0.544741 | priority_queue.ex | starcoder |
defmodule Fixtures.Time do
@moduledoc ~S"""
Time and date related generators.
"""
use Fixtures.Helper
@doc ~S"""
Generate a random date of birth up to a 100 years old.
## Options
- `:age` the following value formats are accepted:
- `from..to` a date of birth for someone with an age between from a... | lib/fixtures/time.ex | 0.841305 | 0.781372 | time.ex | starcoder |
defmodule FlowAssertions.Messages do
@moduledoc false
def not_ok, do: "Value is not `:ok` or an `:ok` tuple"
def not_ok_tuple, do: "Value is not an `:ok` tuple"
def not_error, do: "Value is not an `:error` or `:error` tuple"
def not_error_tuple, do: "Value is not an `:error` tuple"
def not_error_3tuple(er... | lib/messages.ex | 0.84916 | 0.661168 | messages.ex | starcoder |
defmodule ExPlasma do
@moduledoc """
Documentation for ExPlasma.
"""
alias ExPlasma.Transaction
# constants that identify payment types, make sure that
# when we introduce a new payment type, you name it `paymentV2`
# https://github.com/omisego/plasma-contracts/blob/6ab35256b805e25cfc30d85f95f0616415220... | lib/ex_plasma.ex | 0.841679 | 0.422922 | ex_plasma.ex | starcoder |
defmodule Ewebmachine.Builder.Resources do
@moduledoc ~S"""
`use` this module will `use Plug.Builder` (so a plug pipeline
described with the `plug module_or_function_plug` macro), but gives
you a `:resource_match` local function plug which matches routes declared
with the `resource/2` macro and execute the p... | lib/ewebmachine/builder.resources.ex | 0.891946 | 0.663042 | builder.resources.ex | starcoder |
defmodule State.Trip.Added do
@moduledoc """
State for added trips. They aren't matched to GTFS trip IDs, so we
maintain them separately, based on the predictions we see.
"""
use State.Server,
indices: [:id, :route_id],
recordable: Model.Trip,
hibernate: false
alias Model.{Prediction, Trip}
... | apps/state/lib/state/trip/added.ex | 0.756582 | 0.487246 | added.ex | starcoder |
defmodule ISO8583 do
@moduledoc ~S"""
ISO 8583 messaging library for Elixir. This library has utilities validate, encode and decode message
between systems using ISO 8583 regadless of the language the other system is written in.
```elixir
message = %{ "0": "0800", "11": "646465", "12": "160244", "13"... | lib/iso_8583.ex | 0.912826 | 0.736187 | iso_8583.ex | starcoder |
defmodule Games.Pong do
require OK
use GenServer, restart: :transient
defmodule State do
use TypedStruct
typedstruct enforce: true do
field :id, String.t()
field :running, boolean(), default: false
field :winner, :red | :blue | none(), default: nil
field :fader, Fader.t(), defa... | web/lib/infolab_light_games/games/pong.ex | 0.702734 | 0.415966 | pong.ex | starcoder |
defmodule Network.Sender do
@doc """
Quality-Of-Service aware network sender. The idea is to wrap
around a real socket and send on multiple "partitions". Small partitions
with fewer data in the queue are always preferred over the large partitions
"""
use GenServer
alias Network.Sender
defstruct [:... | lib/network/sender.ex | 0.640074 | 0.512571 | sender.ex | starcoder |
defmodule MdnsLite.Options do
@moduledoc """
MdnsLite options
MdnsLite is usually configured in a project's application environment
(`config.exs`) as follows:
```elixir
config :mdns_lite,
hosts: [:hostname, "nerves"],
ttl: 120,
instance_name: "mDNS Lite Device",
services: [
%{
... | lib/mdns_lite/options.ex | 0.872361 | 0.690478 | options.ex | starcoder |
defmodule Coinbase.Pro.REST do
@moduledoc """
This package implements a low-level REST API of the
[Coinbase Pro](https://docs.pro.coinbase.com/).
Low-level means it is just a wrapper over HTTP library which handles
authentication, request signing and has a few nice helper functions
but you still have to con... | lib/coinbasepro_rest.ex | 0.828419 | 0.828731 | coinbasepro_rest.ex | starcoder |
defmodule AdventOfCode.Day8 do
@spec add_vertex(:digraph.graph(), any) :: any
def add_vertex(graph, vertex) do
case :digraph.vertex(graph, vertex) do
false ->
:digraph.add_vertex(graph, vertex)
{vertex, _} ->
vertex
end
end
@spec execute_op(:acc | :jmp | :nop, integer, inte... | lib/day8.ex | 0.716516 | 0.468487 | day8.ex | starcoder |
defprotocol Orderable do
@moduledoc """
Orderable is a simple Elixir package that allows you to make your custom data types orderable, so you can:
- Compare them
- Sort them
## How to write an implementation for my datatype?
There is only a single function to implement: `Orderable.ordered/1`.
This fu... | lib/orderable.ex | 0.873417 | 0.71857 | orderable.ex | starcoder |
defmodule Estated.Error do
@moduledoc """
Errors happen either because a problem occured with the key or the request. The level at which
the result provides an error differs based on where the error occurs within the request. Error
codes will be provided in an error response.
"""
@moduledoc since: "0.1.0"... | lib/estated/error.ex | 0.85067 | 0.525308 | error.ex | starcoder |
defmodule Nug do
@moduledoc """
Provides a macro for using Nug in tests
"""
defmacro __using__([]) do
quote do
import Nug
end
end
defmacro __using__(opts) do
quote do
@upstream_url Keyword.fetch!(unquote(opts), :upstream_url)
@client_builder Keyword.fetch!(unquote(opts), :clie... | lib/nug.ex | 0.727104 | 0.624895 | nug.ex | starcoder |
defmodule Penelope.NLP.IntentClassifier do
@moduledoc """
The intent classifier transforms a natural language utterance into a
named intent and a set of named parameters. It uses an ML classifier
to infer the intent name and an entity recognizer to extract named
entities as parameters. These components are bo... | lib/penelope/nlp/intent_classifier.ex | 0.85814 | 0.730482 | intent_classifier.ex | starcoder |
defmodule PromEx.Plugin do
@moduledoc """
This module defines the behaviour that PromEx plugins need to implement
in order to be properly loaded by PromEx on application start. As a convenience, this
module can also be used as a macro to automatically import all of the necessary utility
functions for writing ... | lib/prom_ex/plugin.ex | 0.868868 | 0.49646 | plugin.ex | starcoder |
defmodule SSHKit.SCP.Download do
@moduledoc false
require Bitwise
alias SSHKit.SCP.Command
alias SSHKit.SSH
@doc """
Downloads a file or directory from a remote host.
## Options
* `:verbose` - let the remote scp process be verbose, default `false`
* `:recursive` - set to `true` for copying direct... | lib/sshkit/scp/download.ex | 0.813868 | 0.722331 | download.ex | starcoder |
defmodule Architect.KnownHosts.Scanned do
@moduledoc """
Provides functions to get known host data from a host.
Does this by running the v-ssh-keyscan executable and decoding the output to json.
Tries to scan for *:architect, :keyscan_timeout* milliseconds, then will fail with :keyscan_timeout.
Possible er... | architect/lib/architect/known_hosts/scanned.ex | 0.736211 | 0.523177 | scanned.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.