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 Exq.Middleware.Pipeline do
@moduledoc """
Pipeline is a structure that is used as an argument in functions of module with
`Exq.Middleware.Behaviour` behaviour. This structure must be returned by particular function
to be used in the next middleware based on defined middleware chain.
Pipeline contai... | lib/exq/middleware/pipeline.ex | 0.86866 | 0.657092 | pipeline.ex | starcoder |
defmodule Harald.HCI.ControllerAndBaseband do
alias Harald.HCI
@moduledoc """
HCI commands for working with the controller and baseband.
> The Controller & Baseband Commands provide access and control to various capabilities of the
> Bluetooth hardware. These parameters provide control of BR/EDR Controllers... | lib/harald/hci/controller_and_baseband.ex | 0.681197 | 0.736732 | controller_and_baseband.ex | starcoder |
defmodule Identicon do
@moduledoc """
Identicon is a unique image that is always the same for the same `input`.
The file is in the format of "`input`.png"
"""
@compile if Mix.env() == :test, do: :export_all
alias Identicon.Image
@doc """
Creates an Identicon in the project directory
Examples
... | identicon/lib/identicon.ex | 0.915564 | 0.425725 | identicon.ex | starcoder |
defmodule Dlex.Node do
@moduledoc """
Simple high level API for accessing graphs
## Usage
defmodule Shared do
use Dlex.Node
shared do
field :id, :string, index: ["term"]
field :name, :string, index: ["term"]
end
end
defmodule User do
use Dlex.Node, depends_o... | lib/dlex/node.ex | 0.744378 | 0.430746 | node.ex | starcoder |
defmodule X509.Certificate.Template do
@moduledoc """
Certificate templates.
"""
import X509.Certificate.Extension
defstruct serial: {:random, 8}, validity: 365, hash: :sha256, extensions: []
@type t :: %__MODULE__{
serial: pos_integer() | {:random, pos_integer()},
validity: pos_integ... | lib/x509/certificate/template.ex | 0.911746 | 0.456894 | template.ex | starcoder |
defmodule Xandra.Frame do
@moduledoc false
defstruct [
:kind,
:body,
stream_id: 0,
compressor: nil,
tracing: false,
warning: false,
atom_keys?: false
]
use Bitwise
alias Xandra.Protocol
@type kind ::
:startup
| :options
| :query
| :prep... | lib/xandra/frame.ex | 0.735452 | 0.402099 | frame.ex | starcoder |
defmodule Gherkin do
@moduledoc """
See `Gherkin.parse/1` for primary usage.
"""
@doc """
Primary helper function for parsing files or streams through `Gherkin`. To use
simply call this function passing in the full text of the file or a file stream.
Example:
%Gherkin.Elements.Feature{scenarios: s... | deps/gherkin/lib/gherkin/gherkin.ex | 0.843573 | 0.49231 | gherkin.ex | starcoder |
defmodule Brook.Event do
@moduledoc """
The `Brook.Event` struct is the basic unit of message written to
and read from the event stream. It encodes the type of event (for
application event handlers to pattern match on), the author (source application),
The creation timestamp of the message, the actual data of... | lib/brook/event.ex | 0.835181 | 0.641001 | event.ex | starcoder |
defmodule Phoenix.HTML.Link do
@moduledoc """
Conveniences for working with links and URLs in HTML.
"""
import Phoenix.HTML.Tag
@doc """
Generates a link to the given URL.
## Examples
link("hello", to: "/world")
#=> <a href="/world">hello</a>
link("hello", to: URI.parse("https://eli... | lib/phoenix_html/link.ex | 0.794106 | 0.705379 | link.ex | starcoder |
defmodule Raxx.View do
@moduledoc ~S"""
Generate views from `.eex` template files.
Using this module will add the functions `html` and `render` to a module.
To create layouts that can be reused across multiple pages check out `Raxx.View.Layout`.
## Example
# greet.html.eex
<p>Hello, <%= name %... | extensions/raxx_view/lib/raxx/view.ex | 0.763792 | 0.747731 | view.ex | starcoder |
defmodule AbsintheErrorPayload.ValidationMessageTypes do
@moduledoc """
This contains absinthe objects used in mutation responses.
To use, import into your Absinthe.Schema files with
```
import_types AbsintheErrorPayload.ValidationMessageTypes
```
## Objects
`:validation_option` holds a key value pa... | lib/absinthe_error_payload/validation_message_types.ex | 0.931166 | 0.891999 | validation_message_types.ex | starcoder |
defmodule RateTheDub.Anime do
@moduledoc """
The Anime context.
"""
import Ecto.Query, warn: false
alias RateTheDub.Repo
alias RateTheDub.Anime.AnimeSeries
alias RateTheDub.DubVotes.Vote
@limit 5
@doc """
Returns the list of anime.
## Examples
iex> list_anime()
[%AnimeSeries{}, .... | lib/ratethedub/anime.ex | 0.856242 | 0.498596 | anime.ex | starcoder |
defmodule ExUnit.ClusteredCase.Cluster do
@moduledoc """
This module is responsible for managing the setup and lifecycle of a single cluster.
"""
use GenServer
require Logger
alias ExUnit.ClusteredCaseError
alias ExUnit.ClusteredCase.Utils
alias __MODULE__.{Partition, PartitionChange}
@type node_spe... | lib/cluster.ex | 0.871242 | 0.531088 | cluster.ex | starcoder |
defmodule BitPal.Backend.Flowee.Connection do
@moduledoc """
This is the low-level API to flowee.
Allows connecting to a Flowee server and communicating with it. This module
handles the packet-based API with Flowee, and handles serialization and
deserialization of the binary format. The binary format essenti... | lib/bitpal/backends/flowee/connection.ex | 0.844794 | 0.632616 | connection.ex | starcoder |
defmodule Benchee.Conversion.Format do
@moduledoc """
Functions for formatting values and their unit labels. Different domains
handle this task differently, for example durations and counts.
See `Benchee.Conversion.Count` and `Benchee.Conversion.Duration` for examples.
"""
alias Benchee.Conversion.Unit
... | lib/benchee/conversion/format.ex | 0.905943 | 0.776453 | format.ex | starcoder |
defmodule Controller.Server do
use GenServer.Behaviour
@doc """
A record for storing the state of the controller
"""
defrecord ControllerState,
# the module that defines map() and reduce()
module: nil,
# the keys to mapper_input_tbl
mapper_input_keys: [],
# the keys to reducer_input_tbl
... | lib/controller/controller_server.ex | 0.592902 | 0.523359 | controller_server.ex | starcoder |
if Code.ensure_loaded?(Plug) do
defmodule Zachaeus.Plug do
@moduledoc """
Provides functions and a behaviour for dealing with Zachaeus in a Plug environment.
You can use the following functions to build plugs with your own behaviour.
To fulfill the behaviour, the `build_response` callback needs to be ... | lib/zachaeus/plug.ex | 0.835953 | 0.80837 | plug.ex | starcoder |
defmodule DockerBuild.Plugins do
@moduledoc """
A behaviour for a plugin system allowing functionality to be extended when building the docker image.
By implementing the optional callbacks the docker file can be changed at various points.
All callbacks are optional.
## Creating a plugin
1. Create module... | lib/docker_build/plugins.ex | 0.835148 | 0.402833 | plugins.ex | starcoder |
defmodule Resin do
@moduledoc """
Introduce a configurable delay to all requests in a plug pipeline.
Usage
use Resin
This will introduce a delay to all incoming requests. This delay defaults to
3000 ms, but can be configured by the `enterpriseyness` option, like so:
use Resin, enterpriseyness:... | lib/resin.ex | 0.86267 | 0.455804 | resin.ex | starcoder |
defmodule Valkyrie do
@moduledoc """
Main Business logic for Valkyrie
Validating and transforming the payload to conform to the provided dataset schema
"""
alias SmartCity.Dataset
def instance_name(), do: :valkyrie_brook
@type reason :: %{String.t() => term()}
@spec standardize_data(Dataset.t(), map... | apps/valkyrie/lib/valkyrie.ex | 0.776792 | 0.570361 | valkyrie.ex | starcoder |
defmodule Commands.StrCommands do
alias Interp.Functions
alias Commands.ListCommands
alias Commands.GeneralCommands
require Interp.Functions
use Memoize
@doc """
Replace at the given index. Replaces the element found in a at index c and replaces it with b.
"""
def replace_at(a, b, c... | lib/commands/str_commands.ex | 0.767341 | 0.796174 | str_commands.ex | starcoder |
defmodule Meilisearch.Indexes do
@moduledoc """
Collection of functions used to manage indexes.
[MeiliSearch Documentation - Indexes](https://docs.meilisearch.com/references/indexes.html)
"""
alias Meilisearch.HTTP
@doc """
List all indexes
## Example
iex> Meilisearch.Indexes.list()
{:o... | lib/meilisearch/indexes.ex | 0.747063 | 0.411436 | indexes.ex | starcoder |
defmodule OpenSCAD.Watcher do
@moduledoc """
Giles forever!
This is the only child spec for the OpenSCAD application. It watches
`./models` by default, but you can configure that to whatever you want like
so:
```elixir
config :open_scad, :watcher_path, "./slayers"
```
"""
use GenServer, restart: ... | lib/watcher.ex | 0.505859 | 0.559892 | watcher.ex | starcoder |
defmodule Canvas.Resources.Assignments do
@moduledoc """
Provides functions to interact with the
[assignment endpoints](https://canvas.instructure.com/doc/api/assignments).
"""
alias Canvas.{Client, Listing, Response}
alias Canvas.Resources.Assignment
def delete_an_assignment() do
end
@doc """
Li... | lib/canvas/resources/assignments.ex | 0.824991 | 0.486454 | assignments.ex | starcoder |
defmodule Tz.TimeZoneDatabase do
@moduledoc false
@behaviour Calendar.TimeZoneDatabase
alias Tz.PeriodsProvider
@compile {:inline, period_to_map: 1}
@impl true
def time_zone_period_from_utc_iso_days(_, "Etc/UTC"),
do: {:ok, %{utc_offset: 0, std_offset: 0, zone_abbr: "UTC"}}
def time_zone_period... | lib/time_zone_database.ex | 0.834609 | 0.511961 | time_zone_database.ex | starcoder |
defmodule Contex.SVG do
@moduledoc """
Convenience functions for generating SVG output
"""
def text(x, y, content, opts \\ []) do
attrs = opts_to_attrs(opts)
[
"<text ",
~s|x="#{x}" y="#{y}"|,
attrs,
">",
clean(content),
"</text>"
]
end
def text(content, op... | lib/chart/svg.ex | 0.63023 | 0.500061 | svg.ex | starcoder |
defmodule SimpleMarkdown.Renderer.HTML.Utilities do
@moduledoc """
Convenient functions for working with HTML.
"""
@type ast :: { tag :: String.Chars.t, attrs :: [{ String.Chars.t, String.Chars.t }], ast } | [ast] | String.t
@type version :: { major :: non_neg_integer, minor :: non_neg_integer }
... | lib/simple_markdown/Renderer/html/utilities.ex | 0.895251 | 0.490114 | utilities.ex | starcoder |
defmodule Platformsh.Config do
@moduledoc """
Reads Platform.sh configuration from environment variables.
See: https://docs.platform.sh/development/variables.html
The following are 'magic' properties that may exist on a Config object. Before accessing a property, check its
existence with hasattr(config, v... | lib/platformshconfig.ex | 0.865594 | 0.459986 | platformshconfig.ex | starcoder |
defmodule Granulix.Generator.Lfo do
alias Granulix.Math, as: GM
@moduledoc """
**Low Frequency Oscillator**
The Lfo module returns a stream of floats() between -1.0 and 1.0.
To be used as amplitude/frequency modulating input into audio rate streams.
Example, create a 4 Hz frequency modulator between 420 a... | lib/granulix/generator/lfo.ex | 0.873323 | 0.674848 | lfo.ex | starcoder |
defmodule Money.Subscription.Plan do
@moduledoc """
Defines a standard subscription plan data structure.
"""
@typedoc "A plan interval type."
@type interval :: :day | :week | :month | :year
@typedoc "A integer interval count for a plan."
@type interval_count :: non_neg_integer
@typedoc "A Subscriptio... | lib/money/subscription/plan.ex | 0.940763 | 0.693486 | plan.ex | starcoder |
defmodule SoftBank.ExchangeRates.CoinMarketCap do
@moduledoc """
Implements the `Money.ExchangeRates` for CoinMarketCap
Rates service.
## Required configuration:
The configuration key `:coin_market_cap_key` should be
set to your `app_id`. for example:
config :soft_bank,
coin_market_cap_key... | lib/exchange_rates/coin_market_cap.ex | 0.906839 | 0.415907 | coin_market_cap.ex | starcoder |
defmodule AshGraphql.Resource do
@moduledoc """
This Ash resource extension adds configuration for exposing a resource in a graphql.
See `graphql/1` for more information
"""
alias Ash.Dsl.Extension
alias Ash.Query.Aggregate
alias AshGraphql.Resource
alias AshGraphql.Resource.{Mutation, Query}
@get ... | lib/resource/resource.ex | 0.833392 | 0.42937 | resource.ex | starcoder |
defmodule MFL.League do
@moduledoc """
Wrapper for requests which return information for a specific
league.
This module contains functions that make API requests that
require a league `id` as an argument.
The structure for every call is `MFL.League.request_type(year, id, options)`
where the `id` is a l... | lib/mfl/league.ex | 0.828523 | 0.658452 | league.ex | starcoder |
defmodule MDACube do
@moduledoc """
Experimental Multi-Dimensional Attribute Cube.
Allows to set attributes by coordinates. Use partial coordinates, so any
unspecified dimension's member attribute will have the same value.
Possible useful for: ranking by multi-attributes.
Provides great visibility.
Examp... | lib/mdacube.ex | 0.722625 | 0.502991 | mdacube.ex | starcoder |
defmodule Sanbase.SocialData.MetricAdapter do
@moduledoc """
Provides access and metadata for social metrics - these metrics are currently taken from internal service called metricshub.
All `_total` metrics are served from 2 different places depending on the invocation.
The ones with `slug` argument are served ... | lib/sanbase/social_data/metric_adapter.ex | 0.916787 | 0.470797 | metric_adapter.ex | starcoder |
defmodule Rinku do
@moduledoc """
A pattern for composing functions to execute in a chain.
Execution will stop when all links in the chain have been resolved, or any link in the chain returns an error.
The initial input will be provided as the first argument in the chain.
The result of each link in the chain... | lib/rinku.ex | 0.795142 | 0.597872 | rinku.ex | starcoder |
defmodule Pun do
defp count(text, phrase) do
others = String.split(text, phrase) |> Enum.count
others - 1
end
def search(text, use_pronunciation \\ false) do
words = text |> Helper.parse |> Parser.get_parsed_words(use_pronunciation)
combinations = get_combinations words
search_pun text, combi... | lib/pun/pun.ex | 0.610105 | 0.413418 | pun.ex | starcoder |
defmodule Artem.ImportIntrospection do
@external_resource "./README.md"
@moduledoc """
#{File.read!(@external_resource) |> String.split("---", parts: 2) |> List.last()}
"""
alias Absinthe.Schema
@type import_introspection_option :: {:path, String.t() | Macro.t()}
@doc """
Import types defined using th... | lib/artem/import_introspection.ex | 0.717804 | 0.548915 | import_introspection.ex | starcoder |
defmodule LineBuffer do
@moduledoc """
Buffer lines like a boss.
"""
defmodule State do
@typedoc """
`%State{}`'s type
"""
@type t :: %__MODULE__{}
@doc false
defstruct [
splitter: "\n",
buf: "",
]
end
@spec new(String.t()) :: State.t()
@doc ~S"""
Create a new l... | lib/line_buffer.ex | 0.900767 | 0.813238 | line_buffer.ex | starcoder |
defmodule Exexif.Decode do
@moduledoc """
Decode tags and (in some cases) their parameters
"""
def tag(:tiff, 0x0100, value), do: {:image_width, value}
def tag(:tiff, 0x0101, value), do: {:image_height, value}
def tag(:tiff, 0x010D, value), do: {:document_name, value}
def tag(:tiff, 0x010E, value), do:... | lib/exexif/decode.ex | 0.759225 | 0.580947 | decode.ex | starcoder |
defmodule Riptide.Store.Postgres do
@moduledoc """
This store persists data to a single Postgres table as materialized paths. It is best used in scenarios where your application will have multiple erlang nodes running that all need shared access to data. Note with this store Postgres is treated like a dumb key/valu... | packages/elixir/lib/riptide/store/store_postgres.ex | 0.843041 | 0.763374 | store_postgres.ex | starcoder |
defmodule VintageNetWiFi.Cookbook do
@moduledoc """
Recipes for common WiFi network configurations
For example, if you want the standard configuration for the most common type of WiFi
network (WPA2 Preshared Key networks), pass the SSID and password to `wpa_psk/2`
"""
alias VintageNetWiFi.WPA2
@doc """... | lib/vintage_net_wifi/cookbook.ex | 0.790409 | 0.591074 | cookbook.ex | starcoder |
defmodule PassiveSupport.Range do
@moduledoc """
Helper functions for working with ranges.
Ranges have some interesting characteristics in Elixir. A range literal
is the language's simplest representation of a Stream; the use case for
them is rather limited compared to other languages; and as of version 1.12... | lib/passive_support/base/range.ex | 0.88578 | 0.72645 | range.ex | starcoder |
defmodule Riak.CRDT.Map do
@moduledoc """
Encapsulates Riak maps
"""
require Record
@doc """
Creates a new `map`
"""
def new(), do: :riakc_map.new()
@doc """
Get the `map` size
"""
def size(map) when Record.is_record(map, :map), do: :riakc_map.size(map)
def size(nil), do: {:error, :nil_objec... | lib/riak/crdt/map.ex | 0.791217 | 0.709887 | map.ex | starcoder |
defmodule ExMaps do
@moduledoc """
Public ExMaps application interface.
"""
alias ExMaps.{DirectionsCoordinator, DistanceMatrixCoordinator}
@typedoc """
General params.
Format of the output of Google Maps API call.
Please note that json is recommended by Google docs.
"""
@type output_format :: :js... | lib/ex_maps.ex | 0.9027 | 0.591487 | ex_maps.ex | starcoder |
defmodule AdventOfCode.Day03 do
import AdventOfCode.Utils
@spec part1([binary()]) :: integer()
def part1(args) do
frequencies = parse_args(args) |> dominant_bits()
gamma = frequencies |> Integer.undigits(2)
epsilon = frequencies |> Enum.map(&Bitwise.bxor(&1, 1)) |> Integer.undigits(2)
gamma * eps... | lib/advent_of_code/day_03.ex | 0.766162 | 0.444806 | day_03.ex | starcoder |
defmodule Txbox.Transactions do
@moduledoc """
Collection of functions for composing Ecto queries.
The functions in this module can be broadly split into two types, expressions
and queries.
## Expressions
Expression functions can be used to compose queries following the Elixir
pipeline syntax.
i... | lib/txbox/transactions.ex | 0.86674 | 0.431614 | transactions.ex | starcoder |
defmodule PactElixir.Response do
@moduledoc """
Represent the expected response.
"""
# @derive [Poison.Encoder]
defstruct [:body, :headers, :status, :matching_rules]
def new(attributes \\ %{}) do
value_or_default = &value_from_map(attributes, &1, &2)
%PactElixir.Response{
body: value_or_defa... | lib/pact_elixir/response.ex | 0.588416 | 0.449393 | response.ex | starcoder |
defmodule Receiver do
@moduledoc ~S"""
Conveniences for creating processes that hold important state.
A wrapper around an `Agent` that adds callbacks and reduces boilerplate code, making it
quick and easy to store important state in a separate supervised process.
# Use cases
* Creating a "stash" to per... | lib/receiver.ex | 0.920706 | 0.706494 | receiver.ex | starcoder |
defmodule ICouch.StreamChunk do
@moduledoc """
Struct module for stream chunks.
The `name` field will hold the document ID on document streaming, both
document ID and attachment name on attachment streaming and nil on changes
streaming.
"""
defstruct [:ref, :type, :name, :data]
@type t :: %__MODULE... | lib/icouch/stream.ex | 0.748168 | 0.405449 | stream.ex | starcoder |
defmodule RowBinary do
@moduledoc """
`RowBinary` format encoding for ClickHouse.
`RowBinary` is a binary format used to ingest data into ClickHouse efficiently. See https://clickhouse.yandex/docs/en/interfaces/formats/#rowbinary .
You can either use `RowBinary.encode/2` to manually encode a field, or impleme... | lib/row_binary.ex | 0.911059 | 0.684956 | row_binary.ex | starcoder |
defmodule ExWire.Struct.WarpQueue do
@moduledoc """
`WarpQueue` maintains the current state of an active warp, this mean we will
track the `block_chunk` hashes and `state_chunk` hashes given to us, so we
can request each from our connected peers. This structure is also persisted
during a warp sync, so that i... | apps/ex_wire/lib/ex_wire/struct/warp_queue.ex | 0.756088 | 0.509886 | warp_queue.ex | starcoder |
defmodule AmqpOne.TypeManager.Type, do: defstruct [:name, :class, :label,
:doc, :fields, :choices, :descriptor, :source, provides: [], encodings: []]
defmodule AmqpOne.TypeManager.Encoding, do: defstruct [:name, :code, :category, :label, :width]
defmodule AmqpOne.TypeManager.Descriptor, do: defstruct [:name, :code]... | lib/type.ex | 0.533884 | 0.519521 | type.ex | starcoder |
defmodule AstroEx.Unit.DMS do
@moduledoc """
Degrees Minutes Seconds
"""
alias AstroEx.Unit.{Arcmin, Arcsec, Degrees, HMS, Radian}
alias AstroEx.Utils.Math
@enforce_keys [:value]
defstruct [:value]
@typep degrees :: -360..360
@typep minutes :: 0..59
@typep seconds :: number()
@typep dms :: {deg... | lib/astro_ex/unit/dms.ex | 0.817975 | 0.557243 | dms.ex | starcoder |
defmodule Tyyppi.T do
@moduledoc """
Raw type wrapper. All the macros exported by that module are available in `Tyyppi`.
Require and use `Tyyppi` instead.
"""
use Boundary, deps: [Tyyppi]
alias Tyyppi.{Stats, T}
require Logger
@doc false
defguardp is_params(params) when is_list(params) or is_atom(... | lib/tyyppi/t.ex | 0.815269 | 0.661376 | t.ex | starcoder |
defmodule McProtocol.Handler do
@type t :: module
@moduledoc """
Basic component for the connection state machine.
This behaviour is one of the two components that makes McProtocol flexible,
the other one being the Orchestrator. To interact directly with the protocol
on the standard acceptor, you need to... | lib/handler/handler.ex | 0.86923 | 0.532729 | handler.ex | starcoder |
defmodule Project2 do
def main(args \\ []) do
{_, input, _} = OptionParser.parse(args)
numNodes = 0
if length(input) == 3 do
numNodes = String.to_integer(List.first(input))
if numNodes > 1 do
algorithm = List.last(input)
{topology, _} = List.pop_at(input, 1)
... | project2/lib/project2.ex | 0.536799 | 0.553626 | project2.ex | starcoder |
defmodule Wavex.Chunk.BAE do
@moduledoc """
A BAE (Broadcast Audio Extension) chunk.
"""
alias Wavex.{
FourCC,
CString
}
@enforce_keys [
:size,
:description,
:originator,
:originator_reference,
:origination_date,
:origination_time,
:time_reference_low,
:time_referen... | lib/wavex/chunk/bae.ex | 0.763748 | 0.560674 | bae.ex | starcoder |
defmodule CoAP.Payload do
defstruct segments: [], multipart: false, data: <<>>, size: nil
alias CoAP.Block
def empty(), do: %__MODULE__{}
def add(%__MODULE__{segments: segments}, number, segment) do
%__MODULE__{
multipart: true,
segments: [{number, segment} | segments]
}
end
def to_b... | lib/coap/payload.ex | 0.848816 | 0.609379 | payload.ex | starcoder |
defprotocol Vow.Generatable do
@moduledoc """
Generatable protocol used by `Vow.gen/2` for generating data from
vows.
## Default Generators
There are a handful of default generators that are less than
optimal to use. The following all use relatively open-ended
generators with (potentially) restrictive f... | lib/vow/generatable.ex | 0.910443 | 0.57087 | generatable.ex | starcoder |
defmodule Disco.EventStore.Client do
@moduledoc """
The `Disco.EventStore.Client` specification.
A client is used to interact with `Disco.EventStore` while keeping details isolated.
Like other components in `Disco`, even the `Disco.EventStore.Client` is built as a
behaviour that implements default callbacks... | lib/disco/event_store/client.ex | 0.909802 | 0.62065 | client.ex | starcoder |
defmodule CSSEx.Helpers.Functions do
@moduledoc """
Default base functions to use in stylesheets.
```
@fn::opacity(red, 0.8)
```
"""
@doc """
Lighten function, takes a color in the form of a string and a number representing
the percentage to lighten and returns a CSS rgba() string.
@fn::lighten(o... | lib/helpers/functions.ex | 0.870184 | 0.776538 | functions.ex | starcoder |
defmodule PgContrivance.Postgres do
@moduledoc """
The base functions that inteface directly with PostgreSQL via Postgrex.
Uses `postgrex` for communicating to the database
and a connection pool, such as `poolboy`.
## Options
Postgres options split in different categories described
below. All options s... | lib/pg_contrivance/postgres.ex | 0.850748 | 0.55929 | postgres.ex | starcoder |
defmodule APDS9960.ALS do
@moduledoc "The ambient light and RGB color sensing."
alias APDS9960.{Comm, Sensor}
@doc """
Returns all the current Color / ALS settings.
"""
@spec settings(Sensor.t()) :: %{
adc_integration_time: byte,
enabled: boolean,
gain: 0..3,
interr... | lib/apds9960/als.ex | 0.873822 | 0.482673 | als.ex | starcoder |
defmodule Clover.Script do
@moduledoc """
A data structure for handling `Clover.Message`s
"""
alias Clover.{
Error,
Message
}
alias Clover.Util.Logger
import Kernel, except: [match?: 2]
@type match_mode :: :overhear | :respond
@type script :: {module :: atom, function :: atom} | function()... | lib/script.ex | 0.841744 | 0.514278 | script.ex | starcoder |
defmodule BrDocs do
@moduledoc ~S"""
Generation, validation and formatting for Brazilian docs.
Currently supported docs:
* `CPF` it's a Brazilian identification number for individuals (like SSN, in USA).
* `CNPJ` it's a Brazilian identification number for companies.
"""
alias BrDocs.Doc
@doc """
U... | lib/brdocs.ex | 0.89594 | 0.471284 | brdocs.ex | starcoder |
defmodule AkinML.Axon.Name do
require Axon
require Logger
@epochs 10
@learning_rate 0.001
@loss :mean_squared_error
@dropout_rate 0.1
@input_columns [
"Bag Distance",
"Chunk Set",
"Dice Sorensen",
"Metaphone",
"Double Metaphone",
"Double Metaphone Chunks",
"Jaccard",
"Jar... | lib/axon/name.ex | 0.725065 | 0.438004 | name.ex | starcoder |
defmodule Ecto do
@moduledoc ~S"""
Ecto is split into 4 main components:
* `Ecto.Repo` - repositories are wrappers around the data store.
Via the repository, we can create, update, destroy and query existing entries.
A repository needs an adapter and credentials to communicate to the database
... | lib/ecto.ex | 0.8789 | 0.620047 | ecto.ex | starcoder |
defmodule Flickrex.Flickr do
@moduledoc """
Flickr API Modules.
These modules and functions map to the methods from the Flickr [API
Documentation](https://www.flickr.com/services/api/).
Arguments for the API functions should be strings, or integers (if the API
accepts a number). Any additional `opts` will... | lib/flickrex/flickr.ex | 0.802478 | 0.456228 | flickr.ex | starcoder |
defmodule Circuits.UART.Framing do
@moduledoc """
A behaviour for implementing framers for data received over a UART.
"""
@doc """
Initialize the state of the framer based on options passed to
`Circuits.UART.open/3`.
This function should return the initial state for the framer or
an error.
"""
@ca... | lib/uart/framing.ex | 0.836821 | 0.576393 | framing.ex | starcoder |
defmodule AWS.DataSync do
@moduledoc """
AWS DataSync
AWS DataSync is a managed data transfer service that makes it simpler for
you to automate moving data between on-premises storage and Amazon Simple
Storage Service (Amazon S3) or Amazon Elastic File System (Amazon EFS).
This API interface reference fo... | lib/aws/generated/data_sync.ex | 0.801781 | 0.623749 | data_sync.ex | starcoder |
defmodule ExPlasma.Transaction.Signed do
@moduledoc """
Holds functions related to transactions containing signatures.
"""
alias ExPlasma.Crypto
alias ExPlasma.Signature
alias ExPlasma.Transaction
alias ExPlasma.Transaction.Witness
alias ExPlasma.TypedData
alias ExPlasma.Utils.RlpDecoder
@type tx_... | lib/ex_plasma/transaction/signed.ex | 0.920883 | 0.543954 | signed.ex | starcoder |
defmodule Mix.Tasks.Cadet.Users.Import do
@moduledoc """
Import user and grouping information from several csv files.
To use this, you need to prepare 3 csv files:
1. List of all the students together with their group names
2. List of all the leaders together with their group names
3. List of all the mento... | lib/mix/tasks/users/import.ex | 0.66769 | 0.623878 | import.ex | starcoder |
defmodule Braintree.PaymentMethodNonce do
@moduledoc """
Create a payment method nonce from an existing payment method token
"""
use Braintree.Construction
alias Braintree.HTTP
alias Braintree.ErrorResponse, as: Error
@type t :: %__MODULE__{
default: String.t,
... | lib/payment_method_nonce.ex | 0.888205 | 0.469581 | payment_method_nonce.ex | starcoder |
defmodule Snitch.Data.Schema.Promotion do
@moduledoc """
Models coupon based `promotions`.
Allows creation of PromoCodes and uses a set of rules to apply set of
actions on the payload to provide discounts.
"""
use Snitch.Data.Schema
alias Snitch.Data.Schema.{PromotionAction, PromotionRule}
alias Snitc... | apps/snitch_core/lib/core/data/schema/promotion/promotion.ex | 0.879987 | 0.519704 | promotion.ex | starcoder |
defmodule Ueberauth.Strategy.Foursquare do
@moduledoc """
Foursquare Strategy for Überauth.
### Setup
Create an application in Foursquare for you to use.
Register a new application at: [foursquare developer page](https://developer.foursquare.com/) and get the `client_id` and `client_secret`.
Include th... | lib/ueberauth/strategy/foursquare.ex | 0.699973 | 0.441854 | foursquare.ex | starcoder |
defmodule Timex.DateTime.Helpers do
@moduledoc false
alias Timex.{Types, Timezone, TimezoneInfo, AmbiguousDateTime, AmbiguousTimezoneInfo}
@doc """
Constructs an empty DateTime, for internal use only
"""
def empty() do
%DateTime{year: 0, month: 1, day: 1,
hour: 0, minute: 0, second: 0,
... | deps/timex/lib/datetime/helpers.ex | 0.806396 | 0.462534 | helpers.ex | starcoder |
defmodule Current.Stream do
@moduledoc false
defstruct [:repo, :queryable, :options, :state]
def __build__(repo, queryable, options) do
key = Keyword.get(options, :key, :id)
direction = Keyword.get(options, :direction, :asc)
chunk = Keyword.get(options, :chunk, 1_000)
%__MODULE__{
repo: r... | lib/current/stream.ex | 0.755997 | 0.42182 | stream.ex | starcoder |
defmodule XGPS.Parser do
def start_link do
GenServer.start_link(__MODULE__, [], name: __MODULE__)
end
def init([]) do
{:ok, %{}}
end
def parse_sentence(sentence) do
case unwrap_sentence(sentence) do
{:ok, body} ->
body
|> match_type
|> parse_content
{:error, :... | lib/xgps/parser.ex | 0.584153 | 0.453322 | parser.ex | starcoder |
defmodule Bamboo.ElasticEmail.Utilities do
@moduledoc """
Utilities for working with the Elastic Email API.
The decode_query/{1,2} and encode_query/{1,2} functions are based heavily
on Plug.Conn.Query, but the Elastic Email API accepts repeated values for
list values instead of requiring `[]` be appended to ... | lib/bamboo/elastic_email/utilities.ex | 0.831759 | 0.539711 | utilities.ex | starcoder |
defmodule AWS.Appflow do
@moduledoc """
Welcome to the Amazon AppFlow API reference.
This guide is for developers who need detailed information about the Amazon
AppFlow API operations, data types, and errors.
Amazon AppFlow is a fully managed integration service that enables you to
securely transfer data... | lib/aws/generated/appflow.ex | 0.873107 | 0.548613 | appflow.ex | starcoder |
defmodule Bolt.Cogs.Assign do
@moduledoc false
@behaviour Nosedrum.Command
alias Bolt.Schema.SelfAssignableRoles
alias Bolt.{Converters, ErrorFormatters, Helpers, Humanizer, ModLog, Repo}
alias Nosedrum.Predicates
alias Nostrum.Api
alias Nostrum.Cache.GuildCache
require Logger
@impl true
def usag... | lib/bolt/cogs/assign.ex | 0.838894 | 0.583619 | assign.ex | starcoder |
defmodule ExUnit do
@moduledoc """
Basic unit testing framework for Elixir.
## Example
A basic setup for ExUnit is shown below:
# File: assertion_test.exs
# 1) Start ExUnit.
ExUnit.start
# 2) Create a new test module (test case) and use `ExUnit.Case`.
defmodule AssertionTest d... | lib/ex_unit/lib/ex_unit.ex | 0.869313 | 0.851212 | ex_unit.ex | starcoder |
defmodule Saxmerl.Handler do
@moduledoc false
import Saxmerl.Records
@behaviour Saxy.Handler
@impl true
def handle_event(:start_element, element, state) do
{:ok, start_element(element, state)}
end
@impl true
def handle_event(:end_element, element, state) do
{:ok, end_element(element, state)}... | lib/saxmerl/handler.ex | 0.648578 | 0.478529 | handler.ex | starcoder |
if Code.ensure_loaded?(Phoenix.LiveView) do
defmodule PromEx.Plugins.PhoenixLiveView do
@moduledoc """
This plugin captures metrics emitted by PhoenixLiveView. Specifically, it captures events related to the
mount, handle_event, and handle_params callbacks for live views and live components.
This plu... | lib/prom_ex/plugins/phoenix_live_view.ex | 0.879761 | 0.63202 | phoenix_live_view.ex | starcoder |
defmodule Construct.Compiler.AST.Types do
@moduledoc false
@builtin Construct.Type.builtin()
@doc """
Returns typespec AST for given type
iex> spec([CommaList, {:array, :integer}]) |> Macro.to_string()
"list(:integer)"
iex> spec({:array, :string}) |> Macro.to_string()
"list(String.t())"
... | lib/construct/compiler/ast/ast_types.ex | 0.745398 | 0.590986 | ast_types.ex | starcoder |
defmodule Singleton do
@moduledoc """
Singleton.
The top supervisor of singleton is a DynamicSupervisor. Singleton
can manage many singleton processes at the same time. Each singleton
is identified by its unique `name` term.
"""
@doc """
Start a new singleton process. Optionally provide the `on_confli... | lib/singleton.ex | 0.845065 | 0.404713 | singleton.ex | starcoder |
defmodule EverythingLocation.Options do
@moduledoc """
A struct for validating the parameters before passing them to the api
"""
use Ecto.Model
import Ecto.Schema
@required ~w(api_key address1)
@optional ~w(geocode certify suggest enhance address2 address3 address4 address5 address6 address7 address8 l... | lib/everything_location/options.ex | 0.810929 | 0.483526 | options.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.87637 | 0.444806 | discovery.ex | starcoder |
defmodule Cocktail.Schedule do
@moduledoc """
Struct used to represent a schedule of recurring events.
Use the `new/2` function to create a new schedule, and the
`add_recurrence_rule/2` function to add rules to describe how to repeat.
Currently, Cocktail supports the following types of repeat rules:
* ... | lib/cocktail/schedule.ex | 0.942348 | 0.794783 | schedule.ex | starcoder |
defmodule Distancia do
@moduledoc """
Distancia is a module which provides functions that calculate distances between two points.
It allows to perform calulations in various metrics:
- Euclidean (`Distancia.euclidean/2`)
- Manhattan (`Distancia.manhattan/2`)
- Chebyshev (`Distancia.chebyshev/2`)
- Hammin... | lib/distancia.ex | 0.954732 | 0.825132 | distancia.ex | starcoder |
defmodule Wavex do
@moduledoc """
Read LPCM WAVE data.
"""
alias Wavex.FourCC
alias Wavex.Chunk.{
BAE,
Data,
Format,
RIFF
}
@enforce_keys [
:riff,
:format,
:data
]
defstruct [
:riff,
:format,
:data,
:bae
]
@type t :: %__MODULE__{
riff: RIF... | lib/wavex.ex | 0.778944 | 0.57332 | wavex.ex | starcoder |
defmodule Ecto.Adapters.SQL do
@moduledoc """
Behaviour and implementation for SQL adapters.
The implementation for SQL adapter provides a
pooled based implementation of SQL and also expose
a query function to developers.
Developers that use `Ecto.Adapters.SQL` should implement
a connection module with ... | lib/ecto/adapters/sql.ex | 0.861815 | 0.506836 | sql.ex | starcoder |
defmodule Day3 do
def solve(input) do
normalized =
input
|> String.trim()
|> String.split("\n")
|> normalize([], [])
[first | _] = normalized
Enum.reduce(0..(Enum.count(first) - 1), [], fn position, acc ->
[count(normalized, position, {0, 0}) | acc]
end)
|> Enum.rev... | lib/day3.ex | 0.650467 | 0.512876 | day3.ex | starcoder |
defmodule Logi.Condition do
@moduledoc "Sink Applicable Condition."
@typedoc "The condition to determine which messages to be consumed by a sink."
@type condition :: severity_condition | location_condition
@typedoc """
Condition based on the specified severity pattern.
### min
- The messages with `min`... | lib/logi/condition.ex | 0.885074 | 0.849535 | condition.ex | starcoder |
defmodule ContexSampleWeb.ScalesLive do
use Phoenix.LiveView
use Phoenix.HTML
alias Contex.{Axis, Scale, TimeScale, ContinuousLinearScale}
def render(assigns) do
~L"""
<h3>Fun With Scales</h3>
<div class="container">
<div class="row">
<div class="column">
<table>
... | lib/contexsample_web/live/scales.ex | 0.711932 | 0.464051 | scales.ex | starcoder |
defmodule AshCsv.DataLayer do
@behaviour Ash.DataLayer
alias Ash.Actions.Sort
alias Ash.Dsl.Extension
@impl true
def can?(_, :read), do: true
def can?(_, :create), do: true
def can?(_, :update), do: true
def can?(_, :destroy), do: true
def can?(_, :sort), do: true
def can?(_, :filter), do: true
... | lib/ash_csv/data_layer.ex | 0.750827 | 0.42316 | data_layer.ex | starcoder |
defmodule CrockfordBase32 do
@moduledoc """
The main module implements Douglas Crockford's [Base32](https://www.crockford.com/base32.html) encoding.
"""
import Bitwise, only: [bor: 2, bsl: 2]
defmacro __using__(opts \\ []) do
alias CrockfordBase32.FixedEncoding
opts = Macro.prewalk(opts, &Macro.expa... | lib/crockford_base32.ex | 0.920169 | 0.508971 | crockford_base32.ex | starcoder |
defmodule IO do
@moduledoc """
Module responsible for doing IO. Many functions in this
module expects an IO device and an io data encoded in UTF-8.
An IO device must be a pid or an atom representing a process.
For convenience, Elixir provides `:stdio` and `:stderr` as
shortcut to Erlang's `:standard_io` an... | lib/elixir/lib/io.ex | 0.843525 | 0.729182 | io.ex | starcoder |
# based on XKCD 287 - https://xkcd.com/287/
defmodule Entry do
@moduledoc """
Defines a struct for an entry in an order, including an item and a quantity
"""
@type t :: %__MODULE__{
item: Item,
quantity: integer
}
defstruct item: Item, quantity: 1
@type order() :: [t, ...]
@spec new(Item.t... | lib/entry.ex | 0.834407 | 0.507141 | entry.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.