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 Steamex.SteamID do
@moduledoc """
Various utility functions related to SteamIDs.
"""
@doc """
Converts a 64-bit community SteamID to the legacy SteamID format.
## Examples
iex> Steamex.SteamID.community_id_to_steam_id(76561197961358433)
"STEAM_0:1:546352"
"""
@spec community_i... | lib/steamex/steam_id.ex | 0.550366 | 0.412471 | steam_id.ex | starcoder |
defmodule HPack do
@moduledoc """
Implementation of the [HPack](https://http2.github.io/http2-spec/compression.html) protocol, a compression format for efficiently representing HTTP header fields, to be used in HTTP/2.
"""
use Bitwise
alias HPack.Huffman
alias HPack.Table
@type name() :: String.t()
... | lib/hpack.ex | 0.886844 | 0.616128 | hpack.ex | starcoder |
defmodule Stream do
@moduledoc """
Module for creating and composing streams.
Streams are composable, lazy enumerables. Any enumerable that generates
items one by one during enumeration is called a stream. For example,
Elixir's `Range` is a stream:
iex> range = 1..5
1..5
iex> Enum.map rang... | lib/elixir/lib/stream.ex | 0.844024 | 0.669069 | stream.ex | starcoder |
defmodule Exoddic do
@moduledoc """
A means for working with odds and probability.
In particular, a means to convert between different representations.
"""
@typedoc """
A keyword list with conversion options
The `to` and `from` formats are identified by atoms corresponding to
the converter module name... | lib/exoddic.ex | 0.894216 | 0.75005 | exoddic.ex | starcoder |
defmodule Cldr.Unit.Test.PreferenceData do
@moduledoc false
@preference_test_data "test/support/data/preference_test_data.txt"
@external_resource @preference_test_data
@offset 1
def preference_test_data do
@preference_test_data
|> File.read!()
|> String.split("\n")
|> Enum.map(&String.trim/1... | test/support/parse_preference_data.ex | 0.677154 | 0.534309 | parse_preference_data.ex | starcoder |
defmodule Ockam.Channel.Protocol do
@moduledoc "Represents a Noise protocol configuration"
@type noise_pattern ::
:nn | :kn | :nk | :kk | :nx | :kx | :xn | :in | :xk | :ik | :xx | :ix | :psk
@type noise_msg :: {:in | :out, [Ockam.Channel.Handshake.token()]}
defstruct pattern: :xx, dh: :x25519, ciphe... | implementations/elixir/lib/channel/protocol.ex | 0.819785 | 0.446193 | protocol.ex | starcoder |
defmodule AWS.Lightsail do
@moduledoc """
Amazon Lightsail is the easiest way to get started with AWS for developers
who just need virtual private servers. Lightsail includes everything you
need to launch your project quickly - a virtual machine, SSD-based storage,
data transfer, DNS management, and a static... | lib/aws/lightsail.ex | 0.804406 | 0.511168 | lightsail.ex | starcoder |
defmodule MuonTrap do
@moduledoc """
MuonTrap protects you from lost and out of control OS processes.
You can use it as a `System.cmd/3` replacement or to pull OS processes into
an Erlang supervision tree via `MuonTrap.Daemon`. Either way, if the Erlang
process that runs the command dies, then the OS process... | lib/muontrap.ex | 0.817283 | 0.828731 | muontrap.ex | starcoder |
defmodule Penelope.ML.CRF.Tagger do
@moduledoc """
The CRF tagger is a thin wrapper over the CRFSuite library for sequence
inference. It provides the ability to train sequence models, use them
for inference, and import/export them.
Features (Xs) are represented as lists of sequences (lists). Each sequence
... | lib/penelope/ml/crf/tagger.ex | 0.923411 | 0.81257 | tagger.ex | starcoder |
defmodule ExMpesa.TransactionStatus do
@moduledoc """
Use this api to check the transaction status.
"""
import ExMpesa.MpesaBase
import ExMpesa.Util
@doc """
Transaction Status Query
## Requirement Params
- `CommandID`[String] - Takes only 'TransactionStatusQuery' command id
- `timeout_url` [URL] ... | lib/ex_mpesa/transaction_status.ex | 0.856377 | 0.739516 | transaction_status.ex | starcoder |
defmodule Timber.Formatter do
@moduledoc """
Provides utilities for formatting log lines as JSON text
This formatter is designed for use with the default `:console` backend provided by
Elixir Logger. To use this, you'll need to configure the console backend to call
the `Timber.Formatter.format/4` function in... | lib/timber/formatter.ex | 0.806662 | 0.812682 | formatter.ex | starcoder |
defmodule WebDriver.Error do
@status_codes [
{ 0, :success },
{ 6, :no_such_driver },
{ 7, :no_such_element },
{ 8, :no_such_frame },
{ 9, :unknown_command },
{ 10, :stale_element_reference },
{ 11, :element_not_visible },
{ 12, :invalid_element_state },
{ 13, :unknown_error },
... | lib/webdriver/error.ex | 0.571049 | 0.438905 | error.ex | starcoder |
defmodule Faqcheck.Referrals.OperatingHours do
use Ecto.Schema
@timestamps_opts [type: :utc_datetime]
use EnumType
import Ecto.Changeset
import Faqcheck.Schema
defenum Weekday, :integer do
value Monday, 0
value Tuesday, 1
value Wednesday, 2
value Thursday, 3
value Friday, 4
value ... | apps/faqcheck/lib/faqcheck/referrals/operating_hours.ex | 0.535584 | 0.476214 | operating_hours.ex | starcoder |
defmodule Grizzly.ZWave.CommandClasses.Indicator do
@moduledoc """
"Indicator" Command Class
The Indicator Command Class is used to help end users to monitor the operation or condition of the
application provided by a supporting node.
"""
@behaviour Grizzly.ZWave.CommandClass
alias Grizzly.ZWave.Decode... | lib/grizzly/zwave/command_classes/indicator.ex | 0.73412 | 0.449393 | indicator.ex | starcoder |
defmodule DistributedTasks do
@moduledoc """
Distributed tasks provide a nice way to run a unique task across elixir cluster.
Distributed tasks allow us to start a process running our task and be sure only one instance of it will be running across cluster. Nodes for tasks are picked by a consistent hashing algor... | lib/distributed_tasks.ex | 0.844794 | 0.641647 | distributed_tasks.ex | starcoder |
defmodule Dynamo.Filters.Session do
@moduledoc """
The session filter. When added to your Dynamo, this filter allows
you to fetch the session and to serialize it back.
When initialized, this filter supports a set of options:
* `key` - The name of the session cookie. This option is required;
Besides is su... | lib/dynamo/filters/session.ex | 0.779825 | 0.456046 | session.ex | starcoder |
defmodule Abit.Counter do
@moduledoc """
Use `:atomics` as an array of counters with N bits per counter.
An `:atomics` is an array of 64 bit integers so the possible counters are below:
Possible counters:
bits | unsigned value range | signed value range
2 | 0..3 | -2..1
4 ... | lib/abit/counter.ex | 0.941868 | 0.586582 | counter.ex | starcoder |
defmodule Server.MPCwallet do
@moduledoc """
Library for the server part of the MPC-based API keys.
Glossary of terms:
- MPC: Multi-party computation. A method to have multiple parties compute a function while keeping their inputs private. For our case, the function is creating a digital signature and the ... | mpc-wallet/demo/server/lib/mpcwallet.ex | 0.753467 | 0.529811 | mpcwallet.ex | starcoder |
defmodule Geometry.GeometryCollectionZ do
@moduledoc """
A collection set of 3D geometries.
`GeometryCollectionZ` implements the protocols `Enumerable` and `Collectable`.
## Examples
iex> Enum.map(
...> GeometryCollectionZ.new([
...> PointZ.new(11, 12, 13),
...> LineStringZ.... | lib/geometry/geometry_collection_z.ex | 0.962072 | 0.630059 | geometry_collection_z.ex | starcoder |
defmodule AWS.SageMaker do
@moduledoc """
Provides APIs for creating and managing Amazon SageMaker resources.
Other Resources:
<ul> <li> [Amazon SageMaker Developer
Guide](https://docs.aws.amazon.com/sagemaker/latest/dg/whatis.html#first-time-user)
</li> <li> [Amazon Augmented AI Runtime API
Reference... | lib/aws/sage_maker.ex | 0.862656 | 0.581244 | sage_maker.ex | starcoder |
defmodule Exfile.Ecto.FileTemplate do
@moduledoc """
A module to help you define an `Ecto.Type` backed by a custom backend.
Example:
```
defmodule MyApp.User.ProfilePicture do
use Exfile.Ecto.File,
backend: "profile_pictures",
cache_backend: "cache"
end
```
```
defmodule MyApp.User ... | lib/exfile/ecto/file_template.ex | 0.81615 | 0.550124 | file_template.ex | starcoder |
defmodule RedisGraph.Node do
@moduledoc """
A Node member of a Graph.
Nodes have an alias which uniquely identifies them in a Graph. Nodes
must have an alias in order for their associated Graph to be committed
to the database.
Nodes have a label which is analogous to a type definition. Nodes can
be quer... | lib/redis_graph/node.ex | 0.915115 | 0.682977 | node.ex | starcoder |
defmodule Patch.Mock do
alias Patch.Mock
alias Patch.Mock.Code
alias Patch.Mock.Code.Freezer
@typedoc """
What exposures should be made in a module.
- `:public` will only expose the public functions
- `:all` will expose both public and private functions
- A list of exports can be provided, they will b... | lib/patch/mock.ex | 0.901579 | 0.505859 | mock.ex | starcoder |
defmodule Geometry.GeometryCollectionZM do
@moduledoc """
A collection set of 3D geometries with a measurement.
`GeometryCollectionZM` implements the protocols `Enumerable` and `Collectable`.
## Examples
iex> Enum.map(
...> GeometryCollectionZM.new([
...> PointZM.new(11, 12, 13, 14),
... | lib/geometry/geometry_collection_zm.ex | 0.960842 | 0.650176 | geometry_collection_zm.ex | starcoder |
defmodule LinkedList do
@opaque t :: tuple()
@doc """
Construct a new LinkedList
"""
@spec new() :: t
def new(), do: {}
@doc """
Push an item onto a LinkedList
"""
@spec push(t, any()) :: t
def push(list, elem), do: {elem, list}
@doc """
Counts the number of elements in a LinkedList
"""
... | exercism/elixir/simple-linked-list/lib/linked_list.ex | 0.844361 | 0.448185 | linked_list.ex | starcoder |
defmodule ZenMonitor.Local.Tables do
@moduledoc """
`ZenMonitor.Local.Tables` owns tables that are shared between multiple `ZenMonitor.Local`
components.
See `nodes/0` and `references/0` for more information.
"""
use GenServer
@node_table Module.concat(__MODULE__, "Nodes")
@reference_table Module.conc... | lib/zen_monitor/local/tables.ex | 0.881774 | 0.600745 | tables.ex | starcoder |
defmodule Neo4j.Sips.Utils do
@moduledoc "Common utilities"
@doc """
Generate a random string.
"""
def random_id, do: :random.uniform |> Float.to_string |> String.slice(2..10)
@doc """
Given a list of queries i.e. `[{"cypher statement ..."}, %{parameters...}]`, this
method will return a JSON that may ... | lib/neo4j_sips_models/utils.ex | 0.772531 | 0.499268 | utils.ex | starcoder |
defmodule DemoRGBLCD do
@moduledoc """
Sample functions to demonstrate and test GrovePi.RGBLCD module
"""
# References
# C++ library: https://github.com/Seeed-Studio/Grove_LCD_RGB_Backlight
alias GrovePi.RGBLCD
@doc """
Shows autoscroll function
"""
def autoscroll() do
{:ok, config} = RGBLCD.... | examples/demo_rgblcd/lib/demo_rgblcd.ex | 0.701611 | 0.432962 | demo_rgblcd.ex | starcoder |
defmodule NaiveBayes do
@moduledoc """
An implementation of Naive Bayes
"""
defstruct vocab: %Vocab{}, data: %Data{}, smoothing: 1, binarized: false, assume_uniform: false
@doc """
Initializes a new NaiveBayes agent
Returns `{:ok, pid}`.
## Examples
iex> {:ok, nbayes} = NaiveBayes.new(binarize... | lib/naive_bayes.ex | 0.873012 | 0.672294 | naive_bayes.ex | starcoder |
defmodule Toolshed.Unix do
@moduledoc """
Helpers for when your fingers are too used to typing Unix
commands.
Helpers include:
* `cat/1` - print out a file
* `grep/2` - print out lines of a file that match a regular expression
* `tree/1` - print out a directory tree
* `uptime/0` - print the up... | lib/toolshed/unix.ex | 0.737158 | 0.474692 | unix.ex | starcoder |
defmodule AWS.DirectConnect do
@moduledoc """
AWS Direct Connect links your internal network to an AWS Direct Connect
location over a standard Ethernet fiber-optic cable. One end of the cable
is connected to your router, the other to an AWS Direct Connect router.
With this connection in place, you can create... | lib/aws/generated/direct_connect.ex | 0.895091 | 0.53127 | direct_connect.ex | starcoder |
defmodule Vex.Validators.Format do
@moduledoc """
Ensure a value matches a regular expression.
## Options
* `:with`: The regular expression.
* `:message`: Optional. A custom error message. May be in EEx format
and use the fields described in "Custom Error Messages," below.
The regular expression ... | lib/vex/validators/format.ex | 0.901762 | 0.591487 | format.ex | starcoder |
defmodule TailPipe do
@moduledoc """
An operator macro for piping into the final argument of a function.
Via the `~>/2` macro, overloads the operator as the "tail pipe". This lets
you pipe the output of preceding logic set into the final (i.e. tail) argument
of the next function.
### Examples
# Imp... | lib/back_pipe.ex | 0.824002 | 0.413418 | back_pipe.ex | starcoder |
defmodule Nostrum.Voice do
@moduledoc """
Interface for playing audio through Discord's voice channels.
# Using Discord Voice Channels
To play sound in Discord with Nostrum, you'll need `ffmpeg` to be installed.
If you don't have the executable `ffmpeg` in the path, the absolute path may
be configured thro... | lib/nostrum/voice.ex | 0.901972 | 0.662182 | voice.ex | starcoder |
defmodule Mix.Tasks.Profile.Cprof do
use Mix.Task
@shortdoc "Profiles the given file or expression with cprof"
@moduledoc """
Profiles the given file or expression using Erlang's `cprof` tool.
`cprof` can be useful when you want to discover the bottlenecks related
to function calls.
Before running the... | lib/mix/lib/mix/tasks/profile.cprof.ex | 0.887771 | 0.53443 | profile.cprof.ex | starcoder |
defmodule SafeURL.DNSResolver do
@moduledoc """
In some cases you might want to use a custom strategy
for DNS resolution. You can do so by passing your own
implementation of `SafeURL.DNSResolver` in the global
or local config.
By default, the `DNS` package is used for resolution,
but you can replace it w... | lib/safeurl/dns_resolver.ex | 0.846101 | 0.512693 | dns_resolver.ex | starcoder |
defmodule Hypex.Bitstring do
@moduledoc """
This module provides a Hypex register implementation using a Bitstring under
the hood.
Using this implementation provides several guarantees about memory, in that the
memory cost stays constant and falls well below that of other registers.
Unfortunately this eff... | lib/hypex/bitstring.ex | 0.827201 | 0.772745 | bitstring.ex | starcoder |
defmodule AWS.DMS do
@moduledoc """
AWS Database Migration Service
AWS Database Migration Service (AWS DMS) can migrate your data to and from
the most widely used commercial and open-source databases such as Oracle,
PostgreSQL, Microsoft SQL Server, Amazon Redshift, MariaDB, Amazon Aurora,
MySQL, and SAP ... | lib/aws/dms.ex | 0.828176 | 0.50592 | dms.ex | starcoder |
defmodule ExRabbitMQ.RPC.Client do
@moduledoc """
*A behavior module for implementing a RabbitMQ RPC client with a `GenServer`.*
It uses the `ExRabbitMQ.Consumer`, which in-turn uses the `AMQP` library to configure and consume messages from a
queue that are actually the response messages of the requests. This ... | lib/ex_rabbitmq/rpc/client.ex | 0.920513 | 0.793706 | client.ex | starcoder |
defmodule Essence.Document do
defstruct type: "", uri: "", text: "", nested_tokens: [], meta: %{}
@moduledoc """
This module defines the struct type `Essence.Document`, as well as a
variety of convenience methods for access the document's text, paragraphs,
sentences and tokens.
"""
@doc """
Read the `... | lib/essence/document.ex | 0.842426 | 0.632063 | document.ex | starcoder |
defprotocol Alambic.BlockingCollection do
@moduledoc """
Interface to a blocking collection.
A blocking collection is a collection of items where:
- multiple processes can push data into the collecion
- multiple processes can consume items from the collection
- a blocking collection may be "completed" me... | lib/alambic/blocking_collection.ex | 0.892989 | 0.690683 | blocking_collection.ex | starcoder |
defmodule Excv.Imgcodecs do
require Logger
@moduledoc """
Imgcodecs correspond to "opencv2/imgcodecs.hpp".
"""
@typep im_read_result ::
{{pos_integer(), pos_integer(), pos_integer()}, {atom(), pos_integer()}, binary()}
@on_load :load_nif
@doc false
def load_nif do
nif_file = '#{Applic... | lib/excv/imgcodecs.ex | 0.884433 | 0.593786 | imgcodecs.ex | starcoder |
import Kernel, except: [round: 1]
defmodule Float do
@moduledoc """
Functions for working with floating point numbers.
"""
@doc """
Parses a binary into a float.
If successful, returns a tuple in the form of `{float, remainder_of_binary}`;
when the binary cannot be coerced into a valid float, the atom ... | lib/elixir/lib/float.ex | 0.90796 | 0.664268 | float.ex | starcoder |
defmodule Nadia.Graph do
@moduledoc """
Provides access to Telegra.ph API.
## Reference
http://telegra.ph/api
"""
alias Nadia.Graph.Model.{Account, Error}
import Nadia.Graph.API
@doc """
Use this method to create a new Telegraph account. Most users only need one account, but this can be useful for... | lib/nadia/graph.ex | 0.894375 | 0.421076 | graph.ex | starcoder |
defmodule Extract.Kafka.Subscribe do
use Definition, schema: Extract.Kafka.Subscribe.V1
@type t :: %__MODULE__{
version: integer,
endpoints: keyword,
topic: String.t()
}
defstruct version: 1, endpoints: nil, topic: nil
def on_new(data) do
data
|> Map.update(:endp... | apps/extract_kafka/lib/extract/kafka/subscribe.ex | 0.569374 | 0.40116 | subscribe.ex | starcoder |
defmodule Ratatouille.Renderer.Canvas do
@moduledoc """
A canvas represents a terminal window, a subvision of it for rendering, and a
sparse mapping of positions to cells.
A `%Canvas{}` struct can be rendered to different output formats. This includes
the primary use-case of rendering to the termbox-managed ... | lib/ratatouille/renderer/canvas.ex | 0.907322 | 0.832373 | canvas.ex | starcoder |
defmodule NebulexEctoRepoAdapter.Local.MatchSpecification do
@moduledoc """
The Match Specifications module contains various functions which convert Ecto queries to
ETS Match Specifications (:ets.match_spec()) in order to execute the given queries.
See: https://github.com/evadne/etso/blob/develop/lib/etso/ets/... | lib/nebulex_ecto_repo_adapter/local/match_specification.ex | 0.826607 | 0.594139 | match_specification.ex | starcoder |
defmodule Modbus.Response do
@moduledoc false
alias Modbus.Utils
def pack({:rc, slave, _address, count}, values) do
^count = Enum.count(values)
data = Utils.bitlist_to_bin(values)
reads(slave, 1, data)
end
def pack({:ri, slave, _address, count}, values) do
^count = Enum.count(values)
dat... | lib/response.ex | 0.583085 | 0.539347 | response.ex | starcoder |
defmodule TelemetryMetricsLogger do
@moduledoc """
A reporter that prints events to the `Logger`.
This module aggregates and prints metrics information at a configurable frequency.
For example, imagine the given metrics:
metrics = [
last_value("vm.memory.binary", unit: :byte),
counter("... | lib/telemetry_metrics_logger.ex | 0.89493 | 0.655253 | telemetry_metrics_logger.ex | starcoder |
defmodule Ockam.Example.Stream.BiDirectional.Remote do
@moduledoc """
Ping-pong example for bi-directional stream communication using remote subsctiption
Use-case: integrate ockam nodes which don't implement stream protocol yet
Pre-requisites:
Ockam hub running with stream service and TCP listener
Two ... | implementations/elixir/ockam/ockam/lib/ockam/examples/stream/bi_directional/remote.ex | 0.833663 | 0.522324 | remote.ex | starcoder |
defmodule DeltaCrdt.AWLWWMap do
defstruct dots: MapSet.new(),
value: %{}
require Logger
@doc false
def new(), do: %__MODULE__{}
defmodule Dots do
@moduledoc false
def compress(dots = %MapSet{}) do
Enum.reduce(dots, %{}, fn {c, i}, dots_map ->
Map.update(dots_map, c, i, fn... | lib/delta_crdt/aw_lww_map.ex | 0.641535 | 0.442817 | aw_lww_map.ex | starcoder |
defmodule EthGethAdapter.Balance do
@moduledoc false
import EthGethAdapter.Encoding
alias Ethereumex.HttpClient, as: Client
alias EthGethAdapter.ERC20
@doc """
Retrieve the balance of all given `contract_addresses` for the provided wallet `address`.
The `0x0000000000000000000000000000000000000000` addr... | apps/eth_geth_adapter/lib/eth_geth_adapter/balance.ex | 0.893652 | 0.786991 | balance.ex | starcoder |
defmodule EctoSanitizer do
@moduledoc """
Provides functions for sanitizing `Ecto.Changeset` fields.
"""
@doc """
Sanitizes all changes in the given changeset that apply to field which are of
the `:string` `Ecto` type.
Uses the `HtmlSanitizeEx.strip_tags/1` function on any change that satisfies
all of... | lib/ecto_sanitizer.ex | 0.829665 | 0.418429 | ecto_sanitizer.ex | starcoder |
defmodule EVM.MachineState do
@moduledoc """
Module for tracking the current machine state, which is roughly
equivalent to the VM state for an executing contract.
This is most often seen as µ in the Yellow Paper.
"""
alias EVM.{ExecEnv, Gas, MachineState, ProgramCounter, Stack}
alias EVM.Operation.Metad... | apps/evm/lib/evm/machine_state.ex | 0.861188 | 0.653787 | machine_state.ex | starcoder |
defmodule Ecto.Query.Normalizer do
@moduledoc false
# Normalizes a query so that it is as consistent as possible.
alias Ecto.Query.QueryExpr
alias Ecto.Query.JoinExpr
alias Ecto.Query.Util
def normalize(query, opts \\ []) do
query
|> setup_sources
|> normalize_joins
|> auto_select(opts)
... | lib/ecto/query/normalizer.ex | 0.732687 | 0.470068 | normalizer.ex | starcoder |
defmodule Axon.Training.Callbacks do
@moduledoc """
Axon training callbacks.
"""
@doc """
Standard IO Logger callback.
Logs training results to standard out.
"""
def standard_io_logger(train_state, :before_train, opts) do
epochs = opts[:epochs]
metrics = Map.keys(train_state[:metrics])
IO... | lib/axon/training/callbacks.ex | 0.805288 | 0.474144 | callbacks.ex | starcoder |
defmodule Openflow.Action do
@moduledoc """
Openflow parser handler
"""
@type type ::
Openflow.Action.Output.t()
| Openflow.Action.CopyTtlOut.t()
| Openflow.Action.CopyTtlIn.t()
| Openflow.Action.SetMplsTtl.t()
| Openflow.Action.DecMplsTtl.t()
| Openf... | lib/openflow/action.ex | 0.513912 | 0.451145 | action.ex | starcoder |
defmodule Garlic.Circuit.Cell do
@moduledoc "Tor circuit cell"
# tor-spec.txt 3. Cell Packet format
# On a version 1 connection, each cell contains the following
# fields:
# CircID [CIRCID_LEN bytes]
# Command [1 byte]
# Payload (... | lib/garlic/circuit/cell.ex | 0.808219 | 0.474144 | cell.ex | starcoder |
defmodule StringMatcher do
@moduledoc ~S"""
StringMatcher allows you to pass multiple regular expressions and a string and get values back.
## Example
Let's say you have a text that is:
```
Del 5 av 6. Shakespeare är mycket nöjd med sin senaste pjäs, Så tuktas en argbigga. Men av någon anledning uppskatt... | lib/string_matcher.ex | 0.872639 | 0.908252 | string_matcher.ex | starcoder |
defmodule Mix.Tasks.PromEx.Dashboard.Publish do
@moduledoc """
This mix task will publish dashboards to Grafana for a PromEx module. It is
recommended that you use the functionality that is part of the PromEx supervision
tree in order to upload dashboards as opposed to this, given that mix may not
always be a... | lib/mix/tasks/prom_ex.dashboard.publish.ex | 0.802594 | 0.72754 | prom_ex.dashboard.publish.ex | starcoder |
defmodule OT.Text.Scanner do
@moduledoc """
Enumerates over a pair of operations, yielding a full or partial component
from each
"""
alias OT.Text.{Component, Operation}
@typedoc "A type which is not to be split when iterating"
@type skip_type :: :delete | :insert | nil
@typedoc """
The input to th... | lib/ot/text/scanner.ex | 0.910022 | 0.64072 | scanner.ex | starcoder |
defmodule Membrane.SRTP.Decryptor do
@moduledoc """
Converts SRTP packets to plain RTP.
Decryptor expects that buffers passed to `handle_process/4` have already parsed headers
in the metadata field as they contain information about header length. The header
length is needed to avoid parsing the header twice ... | lib/membrane/srtp/decryptor.ex | 0.851706 | 0.420064 | decryptor.ex | starcoder |
defmodule Dat.Hypercore.Placeholder do
def get_batch(feed, start, _end, {:config, timeout, value_encoding}) do
[]
end
def head(feed, {:config, timeout, value_encoding}) do
{:error, ''}
end
def download(feed, {:range, start, _end, linear}) do
{:error, ['']}
end
def undownload(feed, {:range,... | lib/dat_hypercore.ex | 0.655997 | 0.400691 | dat_hypercore.ex | starcoder |
defmodule Timex.PosixTimezone do
@moduledoc """
Used when parsing POSIX-TZ timezone rules.
"""
alias Timex.TimezoneInfo
defstruct name: nil,
std_abbr: nil,
std_offset: 0,
dst_abbr: nil,
dst_offset: nil,
dst_start: nil,
dst_end: nil
@t... | lib/timezone/posix_timezone.ex | 0.876311 | 0.4917 | posix_timezone.ex | starcoder |
defmodule AWS.AppStream do
@moduledoc """
Amazon AppStream 2.0
This is the *Amazon AppStream 2.0 API Reference*. This reference provides
descriptions and syntax for each of the actions and data types in AppStream
2.0. AppStream 2.0 is a fully managed application streaming service. You
centrally manage you... | lib/aws/appstream.ex | 0.850748 | 0.541954 | appstream.ex | starcoder |
defmodule FinTex.Tan.StartCode do
@moduledoc false
alias FinTex.Helper.Conversion
alias FinTex.Tan.DataElement
import Conversion
defdelegate render_data(m), to: DataElement
defdelegate bitsum(n, bits), to: DataElement
@bit_controlbyte 7
@type t :: %__MODULE__{
version: :hhd13 | :hhd14,
leng... | lib/tan/start_code.ex | 0.504639 | 0.475179 | start_code.ex | starcoder |
defmodule Legion.Messaging.Switching.Globals do
@moduledoc """
Provides functions for altering/retrieving global switches to messaging.
**This module is NOT transaction-safe.**
## Enabling/disabling mediums
Suppose you need to disable the a medium globally. You might use `enable_medium/2` and
`disable_me... | apps/legion/lib/messaging/switching/globals.ex | 0.804329 | 0.481515 | globals.ex | starcoder |
defmodule AWS.MigrationHub do
@moduledoc """
The AWS Migration Hub API methods help to obtain server and application
migration status and integrate your resource-specific migration tool by
providing a programmatic interface to Migration Hub.
Remember that you must set your AWS Migration Hub home region befo... | lib/aws/migration_hub.ex | 0.873012 | 0.472014 | migration_hub.ex | starcoder |
if Code.ensure_loaded?(Ecto.Type) do
defmodule Cldr.UnitWithUsage.Ecto.Map.Type do
@moduledoc """
Implements Ecto.Type behaviour for `Cldr.Unit`, where the underlying schema type
is a map.
This is the required option for databases such as MySQL that do not support
composite types.
In order t... | lib/cldr/unit/ecto/unit_with_usage_ecto_map_type.ex | 0.744285 | 0.648543 | unit_with_usage_ecto_map_type.ex | starcoder |
defmodule Milight.Light.RGBW do
alias Milight.Light.RGBW
@type t :: %RGBW{}
@type command :: :on | :off | {:hue, float} | {:brightness, float}
@type group :: 1..4
defstruct c: :on, group: nil
def on(), do: %RGBW{c: :on}
def off(), do: %RGBW{c: :off}
def hue(v) when v >= 0.0 and v <= 1.0 do
%RGBW... | lib/milight/light/rgbw.ex | 0.841109 | 0.435181 | rgbw.ex | starcoder |
defmodule Money.DDL do
@moduledoc """
Functions to return SQL DDL commands that support the
creation and deletion of the `money_with_currency` database
type and associated aggregate functions.
"""
# @doc since: "2.7.0"
@default_db :postgres
@supported_db_types :code.priv_dir(:ex_money_sql)
... | lib/money/ddl.ex | 0.828904 | 0.562447 | ddl.ex | starcoder |
defmodule Cumulus do
alias Cumulus.{Bucket, Object}
alias HTTPoison.Response
@api_host "https://www.googleapis.com"
@storage_namespace "storage/v1"
@upload_namespace "upload/storage/v1"
@auth_scope "https://www.googleapis.com/auth/cloud-platform"
@doc """
This is the function responsible for returning... | lib/cumulus.ex | 0.790409 | 0.461805 | cumulus.ex | starcoder |
defmodule HubGateway.ZWave.Devices.Thermostat do
@moduledoc """
This module represents the capability of zwave thermostat device.
"""
use HubGateway.ZWave.Device,
core_type: "thermostat",
attributes: [
{"unit_type", "temperature unit"},
{"system_mode", "mode"},
{"running_mode", "opera... | hgw/lib/hub_gateway/helpers/zwave/devices/thermostat.ex | 0.776665 | 0.435121 | thermostat.ex | starcoder |
defmodule AdventOfCode.Y2020.Day12_1 do
def test_data() do
"""
F10
N3
F7
R90
F11
"""
|> String.split("\n", trim: true)
end
# Data structure is {position, direction} where both position and direction are {west, north}
def run() do
# test_data()
AdventOfCode.Helpers.Data.r... | lib/2020/day12_1.ex | 0.595728 | 0.591576 | day12_1.ex | starcoder |
defmodule Akd.Build.Phoenix.Brunch do
@moduledoc """
A native Hook module that comes shipped with Akd.
This module uses `Akd.Hook`.
Provides a set of operations that build a brunch release for a given phoenix app
at a deployment's `build_at` destination. This hook assumes that an executable
brunch binary ... | lib/akd/phx/brunch.ex | 0.873889 | 0.599544 | brunch.ex | starcoder |
if Code.ensure_loaded?(Decimal) and Code.ensure_loaded?(Money) do
defmodule Amenities.Monies do
@moduledoc """
Money Helpers
"""
@doc """
Converts a `Money` to a `Decimal` type
"""
@spec to_decimal(Money.t()) :: Decimal.t()
def to_decimal(%Money{} = money) do
money
|> Mone... | lib/amenities/monies.ex | 0.817028 | 0.454048 | monies.ex | starcoder |
defmodule Aoc2021.Day6 do
@moduledoc """
See https://adventofcode.com/2021/day/6
"""
defmodule Parser do
@moduledoc false
@spec read_input(Path.t()) :: [non_neg_integer()]
def read_input(path) do
path
|> File.stream!()
|> Stream.take(1)
|> Stream.map(&parse_line/1)
|>... | lib/aoc2021/day6.ex | 0.761184 | 0.599808 | day6.ex | starcoder |
defmodule Rollout do
@moduledoc """
Rollout allows you to flip features quickly and easily. It relies on
distributed erlang and uses LWW-register and Hybrid-logical clocks
to provide maximum availability. Rollout has no dependency on an external
service such as redis which means rollout feature flags can be u... | lib/rollout.ex | 0.82887 | 0.874185 | rollout.ex | starcoder |
defmodule Ueberauth.Strategy.CAS do
@moduledoc """
CAS Strategy for Überauth. Redirects the user to a CAS login page
and verifies the Service Ticket the CAS server returns after a
successful login.
The login flow looks like this:
1. User is redirected to the CAS server's login page by
`Ueberauth.Strat... | lib/ueberauth/strategy/cas.ex | 0.793666 | 0.779154 | cas.ex | starcoder |
defmodule Ecto.Query.API do
use Ecto.Query.Typespec
@moduledoc """
The Query API available by default in Ecto queries.
All queries in Ecto are typesafe and this module defines all
database functions based on their type. Note that this module defines
only the API, each database adapter still needs to suppo... | lib/ecto/query/api.ex | 0.928238 | 0.444083 | api.ex | starcoder |
defmodule Cldr.Unit.Conversion do
@moduledoc """
Unit conversion functions for the units defined
in `Cldr`.
"""
@enforce_keys [:factor, :offset, :base_unit]
defstruct factor: 1,
offset: 0,
base_unit: nil
@type factor :: integer | float | Ratio.t()
@type offset :: integer | flo... | lib/cldr/unit/conversion.ex | 0.937705 | 0.568595 | conversion.ex | starcoder |
defmodule Rodeo.HTTP do
@moduledoc """
Encapsulates starting, configuring, reloading, and stopping of
cowboy web server instances.
"""
@defaultport 8080
def start(port \\ @defaultport, identifier \\ __MODULE__)
def start(:auto, identifier) do
find_available_tcp_port()
|> start(identifier)
en... | lib/rodeo/http.ex | 0.765856 | 0.447279 | http.ex | starcoder |
defmodule Freddy.RPC.Server do
@moduledoc """
A behaviour module for implementing AMQP RPC server processes.
The `Freddy.RPC.Server` module provides a way to create processes that hold,
monitor, and restart a channel in case of failure, and have some callbacks
to hook into the process lifecycle and handle me... | lib/freddy/rpc/server.ex | 0.866331 | 0.550305 | server.ex | starcoder |
defmodule Transmog do
@moduledoc """
`Transmog` is a module which makes it easy to perform a deep rename of keys in
a map or list of maps using a key mapping. The key mapping is a list of two
tuples which are dot notation strings representing the path to update and the
resulting name of the key after formatti... | lib/transmog.ex | 0.934671 | 0.782122 | transmog.ex | starcoder |
defmodule ExRets.SearchArguments do
@moduledoc """
Arguments for a RETS Search Transaction.
"""
@moduledoc since: "0.1.0"
@enforce_keys [:search_type, :class]
defstruct search_type: nil,
class: nil,
count: :no_record_count,
format: "COMPACT-DECODED",
limit: "... | lib/ex_rets/search_arguments.ex | 0.926087 | 0.465873 | search_arguments.ex | starcoder |
defmodule Day10 do
def part1(input) do
asteroids = make_map_set(input)
x_range = 0..byte_size(hd(input))-1
y_range = 0..length(input)-1
limits = {x_range, y_range}
asteroids
|> Enum.map(fn pos ->
{num_visible(asteroids, pos, limits), pos}
end)
|> Enum.max
end
def part2(inp... | day10/lib/day10.ex | 0.526586 | 0.711067 | day10.ex | starcoder |
defmodule Trades.Leader do
use GenServer, restart: :temporary
require Logger
alias Decimal, as: D
D.Context.set(%D.Context{D.Context.get() | precision: 9})
@short 60 * 10
@long 60 * 180
@trend 3600 * 24
defmodule Mas do
defstruct short_ma: Deque.new(2),
long_ma: Deque.new(2),
... | apps/trades/lib/trades/leader.ex | 0.55447 | 0.408985 | leader.ex | starcoder |
defmodule Defparser do
@moduledoc """
Provides a way to define a parser for an arbitrary map with atom or string keys.
Works with `Ecto.Schema`s and `Ecto.Type`s.
## Example
iex(1)> defmodule Test do
...(1)> import Defparser
...(1)> defparser :user, %{
...(1)> username: %{firs... | lib/defparser.ex | 0.785884 | 0.501038 | defparser.ex | starcoder |
defmodule Rummage.Ecto.CustomHooks.SimpleSearch do
@moduledoc """
`Rummage.Ecto.CustomHooks.SimpleSearch` is a custom search hook that comes shipped
with `Rummage.Ecto`.
Usage:
For a regular search:
This returns a `queryable` which upon running will give a list of `Parent`(s)
searched by ascending `fiel... | lib/rummage_ecto/custom_hooks/simple_search.ex | 0.791539 | 0.871146 | simple_search.ex | starcoder |
defmodule CpuInfo do
@moduledoc """
**CpuInfo:** get CPU information, including a type, number of processors, number of physical cores and logical threads of a processor, and status of simultaneous multi-threads (hyper-threading).
"""
@latest_versions %{gcc: 9, "g++": 9, clang: 9, "clang++": 9}
defp os_ty... | lib/cpu_info.ex | 0.703448 | 0.575081 | cpu_info.ex | starcoder |
defmodule ExAliyun.Client.RPC do
@moduledoc """
Aliyun RPC client.
### Usage
Please go to Aliyun api explorer to find how to access each service:
https://api.aliyun.com/new#/?product=Dysmsapi&api=QuerySendDetails¶ms={}&tab=DEMO&lang=RUBY
Below is an example for `SendSms`:
```elixir
alias ExAliyu... | lib/client/rpc.ex | 0.716814 | 0.45423 | rpc.ex | starcoder |
defmodule XDR.DoubleFloat do
@moduledoc """
This module manages the `Double-Precision Floating-Point` type based on the RFC4506 XDR Standard.
"""
@behaviour XDR.Declaration
alias XDR.Error.DoubleFloat, as: DoubleFloatError
defstruct [:float]
defguard valid_float?(value) when is_float(value) or is_inte... | lib/xdr/double_float.ex | 0.938449 | 0.665161 | double_float.ex | starcoder |
defmodule Maze do
@doc """
Creates non-overlapping tiles representing the maze.
## Examples
iex> Maze.tiles([[4,8]], %{width: 2, height: 1, hall_width: 1})
[
%{tile: "#", x: 1, y: 1},
%{tile: "#", x: 2, y: 1},
%{tile: "#", x: 3, y: 1},
%{tile: "#", x: 4, y: 1},
%{tile: "#", x: 5, y: 1},
%{tile: ... | lib/fireball/models/maze.ex | 0.511717 | 0.940898 | maze.ex | starcoder |
defmodule DistAgent.Behaviour do
@moduledoc """
Behaviour module for distributed agents.
The 6 callbacks are classified into the following 2 dimensions:
- how the callback is used, i.e., for pure manipulation of state or for side effect
- when the callback is used, i.e., type of event that triggers the call... | lib/dist_agent/behaviour.ex | 0.884177 | 0.728217 | behaviour.ex | starcoder |
defmodule Flect.Compiler.Syntax.Parser do
@moduledoc """
Contains the parser for Flect source code documents.
"""
@typep location() :: Flect.Compiler.Syntax.Location.t()
@typep token() :: Flect.Compiler.Syntax.Token.t()
@typep ast_node() :: Flect.Compiler.Syntax.Node.t()
@typep state() :: {... | lib/compiler/syntax/parser.ex | 0.851629 | 0.611411 | parser.ex | starcoder |
defmodule Plymio.Ast.Vorm.Error do
@moduledoc false
require Plymio.Option.Utility, as: POU
use Plymio.Ast.Vorm.Attribute
@pav_struct_kvs_aliases [
{@pav_key_message, [:m, :msg]},
{@pav_key_value, [:v]},
{@pav_key_error, [:e]}
]
@pav_struct_dict_aliases @pav_struct_kvs_aliases
|> POU.op... | lib/ast/vorm/error.ex | 0.764012 | 0.442034 | error.ex | starcoder |
defmodule EctoAsStateMachine.State do
@moduledoc """
State callbacks
"""
alias Ecto.Changeset
@spec update(%{event: List.t(), model: Map.t(), states: List.t(), initial: String.t(), column: atom}) :: term | %{valid: false}
def update(%{event: event, model: model, states: states, initial: initial, column: ... | lib/ecto_as_state_machine/state.ex | 0.764848 | 0.582907 | state.ex | starcoder |
defmodule SBoM do
@moduledoc """
Collect dependency information for use in a Software Bill-of-Materials (SBOM).
"""
alias SBoM.Purl
alias SBoM.Cpe
@doc """
Builds a SBoM for the current Mix project. The result can be exported to
CycloneDX XML format using the `SBoM.CycloneDX` module. Pass an environme... | lib/sbom.ex | 0.756717 | 0.45744 | sbom.ex | starcoder |
defmodule ExDhcp.Utils do
@moduledoc """
Provides utilities containing typespecs for data types and binary/string
conversions for _ip_ and _mac_ addresses. For ease-of-use both within this
library and when using it.
"""
@typedoc "Erlang-style _ip_ addresses."
@type ip4 :: :inet.ip4_address
@typedoc "_... | lib/ex_dhcp/utils.ex | 0.830628 | 0.712207 | utils.ex | starcoder |
defmodule QueryBuilder do
require Ecto.Query
alias Ecto.Query
defmacro __using__(opts) do
quote do
require QueryBuilder.Schema
QueryBuilder.Schema.__using__(unquote(opts))
end
end
def new(ecto_query) do
%QueryBuilder.Query{ecto_query: ensure_query_has_binding(ecto_query)}
end
@d... | lib/query_builder.ex | 0.865665 | 0.815637 | query_builder.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.