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 Tw.V1_1.Place do
@moduledoc """
Place data structure and related functions.
https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/geo
"""
alias Tw.V1_1.BoundingBox
@type id :: binary()
@enforce_keys [:id, :url, :place_type, :name, :full_name, :country_code, :countr... | lib/tw/v1_1/place.ex | 0.898603 | 0.604078 | place.ex | starcoder |
defmodule Bunch.Map do
@moduledoc """
A bunch of helper functions for manipulating maps.
"""
use Bunch
@doc """
Updates value at `key` in `map` and returns new value and updated map.
Uses `Map.get_and_update/3` under the hood.
## Example
iex> %{a: 1} |> #{inspect(__MODULE__)}.get_updated(:a, &... | lib/bunch/map.ex | 0.911618 | 0.703206 | map.ex | starcoder |
defmodule EventStore.Subscriptions.Subscriber do
@moduledoc false
defstruct [
:pid,
:ref,
:partition_key,
last_sent: 0,
buffer_size: 1,
in_flight: []
]
alias EventStore.RecordedEvent
alias EventStore.Subscriptions.Subscriber
@doc """
Subscriber is available to receive events whe... | lib/event_store/subscriptions/subscriber.ex | 0.752559 | 0.49762 | subscriber.ex | starcoder |
defmodule DarkMatter.Lists do
@moduledoc """
Utils for working with lists or improper lists
"""
@moduledoc since: "1.0.0"
@type atom_or_improper_tree_list() ::
atom
| maybe_improper_list
| {atom, atom | maybe_improper_list | {atom, atom | maybe_improper_list | {any, any}}}
@d... | lib/dark_matter/lists.ex | 0.821438 | 0.615911 | lists.ex | starcoder |
defmodule Ecto.Pools.Poolboy do
@moduledoc """
Start a pool of connections using `poolboy`.
### Options
* `:pool_name` - The name of the pool supervisor
* `:pool_size` - The number of connections to keep in the pool (default: 10)
* `:lazy` - When true, connections to the repo are lazily started (def... | lib/ecto/pools/poolboy.ex | 0.815306 | 0.485478 | poolboy.ex | starcoder |
defmodule Loom.LWWRegister do
@moduledoc """
A Last-write-wins register
While alone, this kinda defeats the point of a CRDT, there are times, such as
in a map or other kind of composite CRDT, where an individual value should
be last-write-wins, but we'd like to preserve causality between all the
properties... | lib/loom/lwwregister.ex | 0.838944 | 0.574962 | lwwregister.ex | starcoder |
defmodule Plymio.Ast.Vorm.Vormen do
@moduledoc false
alias Plymio.Option.Utility, as: POU
##alias Plymio.Ast.Utility, as: PAU
alias Plymio.Ast.Vorm.Utility, as: PAVU
alias Plymio.Ast.Vorm.Vormen.Transform, as: PAVMT
import Plymio.Ast.Vorm.Utility, only: [
new_error_result: 1,
]
use Plymio.Ast.Vor... | lib/ast/vorm/vormen/vormen.ex | 0.715921 | 0.504089 | vormen.ex | starcoder |
defmodule ElixirDbf.Row do
@moduledoc """
ElixirDbf row module
"""
def decode(string, :utf8), do: string
def decode(string, encoding) when is_atom(encoding), do: Exconv.to_unicode!(string, encoding)
def decode(string, [from, to]) do
string
|> Exconv.to_unicode!(from)
|> Exconv.to_unicode!(to)... | lib/elixir_dbf/row.ex | 0.677154 | 0.558387 | row.ex | starcoder |
defmodule Mongo.Ecto.NormalizedQuery do
@moduledoc false
defmodule ReadQuery do
@moduledoc false
defstruct coll: nil,
pk: nil,
params: {},
query: %{},
projection: %{},
order: %{},
fields: [],
database: nil,
... | lib/mongo_ecto/normalized_query.ex | 0.809615 | 0.518485 | normalized_query.ex | starcoder |
defmodule Contex.Mapping do
@moduledoc """
Mappings generalize the process of associating columns in the dataset to the
elements of a plot. As part of creating a mapping, these associations are
validated to confirm that a column has been assigned to each of the graphical
elements that are necessary to draw th... | lib/chart/mapping.ex | 0.891864 | 0.977479 | mapping.ex | starcoder |
defmodule Firebirdex.Query do
alias Firebirdex.Result
@type t :: %__MODULE__{
ref: reference() | nil,
name: iodata(),
statement: iodata(),
stmt: tuple()
}
defstruct name: "",
ref: nil,
stmt: nil,
statement: nil,
stm... | lib/firebirdex/query.ex | 0.654453 | 0.46563 | query.ex | starcoder |
defmodule HTS221.Server do
@moduledoc """
Server for setting up and using the HTS221
When controlling the HTS221 there are few setup steps and other checks you
may want to do. Also, to keep the transport layer working often times this
will call for a GenServer. This server is meant to provide common
functi... | lib/hts221/server.ex | 0.88263 | 0.851706 | server.ex | starcoder |
defmodule Graphmath.Vec2 do
@moduledoc """
This is the 2D mathematics library for graphmath.
This submodule handles vectors stored as a tuple.
"""
@type vec2 :: {float, float}
@doc """
`create()` creates a zero vec2.
It will return a tuple of the form {0.0,0.0}.
`create()` creates a zeroed `vec2`.... | lib/graphmath/Vec2.ex | 0.949189 | 0.986726 | Vec2.ex | starcoder |
defmodule Bitmap.Integer do
@moduledoc """
Bitmap behaviour implementation using arbitrarily sized integers.
"""
use Bitwise
import Kernel, except: [to_string: 1]
@behaviour Bitmap
@typedoc """
A typed map which holds the integer bitmap as defined by the module struct
"""
@type t :: %__MODULE... | lib/bitmap/integer.ex | 0.9491 | 0.676593 | integer.ex | starcoder |
defmodule AdventOfCode.Y2020.Day20.V1 do
alias AdventOfCode.Y2020.Day20.V1.Edge
alias AdventOfCode.Y2020.Day20.V1.Parser
alias AdventOfCode.Y2020.Day20.V1.Matrix
def run_both() do
relations =
"2020/day20.txt"
|> Parser.parse()
|> build_relations()
{solve1(relations), solve2(relations... | lib/2020/day20-v1.ex | 0.654343 | 0.55646 | day20-v1.ex | starcoder |
defmodule TheFuzz.Similarity.WeightedLevenshtein do
@moduledoc """
This module contains function to calculate the weighted levenshtein distance
between 2 given strings.
"""
require IEx
@behaviour TheFuzz.StringMetric
@default_delete_cost 1
@default_insert_cost 1
@default_replace_cost 1
@doc """
... | lib/the_fuzz/similarity/weighted_levenshtein.ex | 0.874299 | 0.619011 | weighted_levenshtein.ex | starcoder |
defmodule Resx.Producers.Transform do
use Resx.Producer
alias Resx.Resource
alias Resx.Resource.Reference
defp to_ref(reference = %Reference{}), do: { :ok, reference }
defp to_ref(uri) when is_binary(uri), do: URI.decode(uri) |> URI.parse |> to_ref
defp to_ref(%URI{ scheme: "resx-transform", p... | lib/resx/producers/transform.ex | 0.720467 | 0.480235 | transform.ex | starcoder |
defmodule Socket.SSL do
@moduledoc """
This module allows usage of SSL sockets and promotion of TCP sockets to SSL
sockets.
## Options
When creating a socket you can pass a series of options to use for it.
* `:cert` can either be an encoded certificate or `[path:
"path/to/certificate"]`
* `:key` c... | deps/socket/lib/socket/ssl.ex | 0.898597 | 0.609931 | ssl.ex | starcoder |
defmodule ExHal do
@moduledoc """
Use HAL APIs with ease.
Given a resource `http://example.com/hal` whose HAL representation looks like
```json
{ "name": "Hello!",
"_links": {
"self" : { "href": "http://example.com" },
"profile": [{ "href": "http://example.com/special" },
... | lib/exhal.ex | 0.868764 | 0.731994 | exhal.ex | starcoder |
defmodule Ravix.RQL.QueryParser do
@moduledoc false
require OK
alias Ravix.RQL.Query
@non_aliasable_fields ["id()", "count()", "sum()", :"id()", :"count()", :"sum()"]
@doc """
Receives a `Ravix.RQL.Query` object and parses it to a RQL query string
"""
@spec parse(Query.t()) :: {:error, any} | {:ok, Q... | lib/rql/query_parser.ex | 0.680454 | 0.424054 | query_parser.ex | starcoder |
defmodule Brain.Filter.Complementary do
require Logger
alias Brain.BlackBox
@pi 3.14159265359
@degrees_to_radians @pi/180
def init(_) do
{:ok,
%{
roll: 0,
pitch: 0,
roll_offset: 1.79,
pitch_offset: -0.5,
yaw: 0,
alpha: 0.985,
first_loop: true... | apps/brain/lib/filters/complementary.ex | 0.772273 | 0.502747 | complementary.ex | starcoder |
defmodule Ockam.Transport.Address do
defstruct [:family, :addr, :port]
defmodule InvalidAddressError do
defexception [:message]
def new({:unsupported_family, family}) do
%__MODULE__{message: "unsupported address family: #{inspect(family)}"}
end
def new(reason) when not is_binary(reason) do
... | implementations/elixir/lib/transport/address.ex | 0.797478 | 0.411613 | address.ex | starcoder |
defmodule OMG.API.State.Transaction do
@moduledoc """
Internal representation of transaction spent on Plasma chain
"""
alias OMG.API.Crypto
alias OMG.API.Utxo
require Utxo
@zero_address OMG.Eth.zero_address()
@max_inputs 4
@max_outputs 4
@default_metadata nil
defstruct [:inputs, :outputs, me... | apps/omg_api/lib/state/transaction.ex | 0.887972 | 0.576244 | transaction.ex | starcoder |
defmodule Phoenix.Component do
@moduledoc """
API for function components.
A function component is any function that receives
an assigns map as argument and returns a rendered
struct built with [the `~H` sigil](`Phoenix.LiveView.Helpers.sigil_H/2`).
Here is an example:
defmodule MyComponent do
... | lib/phoenix_component.ex | 0.847227 | 0.645036 | phoenix_component.ex | starcoder |
defmodule Crit.Params.Variants.SingletonToMany do
@moduledoc """
A builder for controller params of this form:
%{
"0" => %{..., "split_field" => ...}},
"1" => %{..., "split_field" => ...}},
...
}
A controller will typically receive N indexed parameters. For tests
using this module, only a sin... | test/support/http_params/variants/singleton_to_many.ex | 0.783409 | 0.433562 | singleton_to_many.ex | starcoder |
defmodule StacktraceCleaner do
@moduledoc """
Stacktraces often include many lines that are not relevant for the context under review.
This makes it hard to find the signal amongst many noise, and adds debugging time.
StacktraceCleaner is a module to remove those noises and make them easier to see.
"""
@noi... | lib/stacktrace_cleaner.ex | 0.747432 | 0.521227 | stacktrace_cleaner.ex | starcoder |
defprotocol Xema.Castable do
@moduledoc """
Converts data using the specified schema.
"""
@doc """
Converts the given data using the specified schema.
"""
def cast(value, schema)
end
defimpl Xema.Castable, for: Atom do
alias Xema.Schema
def cast(atom, %Schema{type: :any}),
do: {:ok, atom}
de... | lib/xema/castable.ex | 0.894868 | 0.437223 | castable.ex | starcoder |
defmodule Oli.Activities.Realizer.Selection do
@moduledoc """
Represents a selection embedded within a page.
"""
@derive Jason.Encoder
@enforce_keys [:id, :count, :logic, :purpose, :type]
defstruct [:id, :count, :logic, :purpose, :type]
alias Oli.Activities.Realizer.Logic
alias Oli.Activities.Realizer... | lib/oli/activities/realizer/selection.ex | 0.873276 | 0.446012 | selection.ex | starcoder |
defmodule Jaxon.Stream do
alias Jaxon.{Path, Parser, ParseError, Decoder}
@doc """
Query all values of an array:
```
iex> ~s({ "numbers": [1,2] }) |> List.wrap() |> Jaxon.Stream.query([:root, "numbers", :all]) |> Enum.to_list()
[1, 2]
```
Query an object property:
```
iex> ~s({ "person": {"name"... | lib/jaxon/stream.ex | 0.683208 | 0.906694 | stream.ex | starcoder |
defmodule FusionAuth.Reports do
@moduledoc """
The `FusionAuth.Reports` module provides access functions to the [FusionAuth Reports API](https://fusionauth.io/docs/v1/tech/apis/reports).
All functions require a Tesla Client struct created with `FusionAuth.client(base_url, api_key, tenant_id)`.
All but one fun... | lib/fusion_auth/reports.ex | 0.857917 | 0.437703 | reports.ex | starcoder |
defmodule DuckDuck.Transform do
alias DuckDuck.UploadCommand, as: Command
@moduledoc """
Describes a series of transformations to iteratively build an UploadCommand.
"""
@effects Application.get_env(:duckduck, :effects_client, DuckDuck.Effects)
@switches [tag: :string, path: :string, yes: :boolean]
@al... | lib/duck_duck/transform.ex | 0.774967 | 0.416322 | transform.ex | starcoder |
defmodule Militerm.Parsers.SimpleResponse do
@moduledoc ~S"""
The response system allows NPCs to map text string patterns to
events. This is a fairly generic system, so the scripting needs to
supply the string being matched as well as the set of matches. The
returned event is then triggered by the scr... | lib/militerm/parsers/simple_response.ex | 0.750187 | 0.523177 | simple_response.ex | starcoder |
defmodule EthBlockchain.Transaction do
@moduledoc false
import Utils.Helpers.Encoding
alias Keychain.Signature
alias ExthCrypto.Hash.Keccak
alias EthBlockchain.{Adapter, ABIEncoder}
defstruct nonce: 0,
gas_price: 0,
gas_limit: 0,
to: <<>>,
value: 0,
... | apps/eth_blockchain/lib/eth_blockchain/transaction.ex | 0.912927 | 0.608536 | transaction.ex | starcoder |
defmodule Tip do
@moduledoc """
Tip is a basic apparatus for performing type checks during
development and test. It does not replace the need to write type
checks in the code, it merely provides you with a convenient
assertive style and a framework for thinking with types.
Tip's basic types correspond roug... | lib/tip.ex | 0.809615 | 0.800887 | tip.ex | starcoder |
defmodule Benx.Decoder do
@moduledoc """
Provides decoding for iodata according to the
Bencoding specification.
"""
alias Benx.Decoder.SyntaxError
@doc """
Decodes a Bencoded iolist.
"""
@spec decode(iodata) ::
{:ok, Benx.Encoder.t} |
{:error, SyntaxError.t}
def decode(data) do
with fla... | lib/benx/decoder.ex | 0.780328 | 0.646063 | decoder.ex | starcoder |
defmodule ConfusionMatrix.Printer do
defimpl String.Chars, for: P7777776.ConfusionMatrix do
import P7777776.ConfusionMatrix
alias P7777776.ConfusionMatrix
def to_string(%ConfusionMatrix{classes: classes, counts: counts} = cm) do
cell_width =
counts
|> Enum.reduce(0, fn {_, c}, max -... | lib/p7777776_confusion_matrix_printer.ex | 0.644449 | 0.424889 | p7777776_confusion_matrix_printer.ex | starcoder |
defmodule Grizzly.ZWave.SmartStart.MetaExtension.NetworkStatus do
@moduledoc """
This extension is used to advertise if the node is in the network and its
assigned node id
"""
@behaviour Grizzly.ZWave.SmartStart.MetaExtension
alias Grizzly.ZWave
@typedoc """
The different network statuses are:
- `:... | lib/grizzly/zwave/smart_start/meta_extension/network_status.ex | 0.847479 | 0.480722 | network_status.ex | starcoder |
if Code.ensure_loaded?(:ibrowse) do
defmodule Tesla.Adapter.Ibrowse do
@moduledoc """
Adapter for [ibrowse](https://github.com/cmullaparthi/ibrowse)
Remember to add `{:ibrowse, "~> 4.2"}` to dependencies (and `:ibrowse` to applications in `mix.exs`)
Also, you need to recompile tesla after adding `:ib... | lib/tesla/adapter/ibrowse.ex | 0.818845 | 0.697442 | ibrowse.ex | starcoder |
defmodule ExMachina.Sequence do
@moduledoc """
Module for generating sequential values.
Use `ExMachina.sequence/1` or `ExMachina.sequence/2` to generate
sequential values instead of calling this module directly.
"""
@doc false
def start_link do
Agent.start_link(fn -> Map.new() end, name: __MODULE__)... | lib/ex_machina/sequence.ex | 0.86378 | 0.410549 | sequence.ex | starcoder |
defmodule Ockam.Telemetry do
@moduledoc """
Provides functions to emit `:telemetry` events.
"""
@typedoc "The event name."
@type event_name :: atom() | [atom(), ...]
@typedoc "The event measurements."
@type event_measurements :: map()
@typedoc "The event metadata."
@type event_metadata :: map()
... | implementations/elixir/ockam/ockam/lib/ockam/telemetry.ex | 0.928934 | 0.654149 | telemetry.ex | starcoder |
defmodule Surface.API do
@moduledoc false
alias Surface.IOHelper
@types [
:any,
:css_class,
:list,
:event,
:boolean,
:string,
:date,
:datetime,
:number,
:integer,
:decimal,
:map,
:fun,
:atom,
:module,
:changeset,
:form,
:keyword
]
@pri... | lib/surface/api.ex | 0.742328 | 0.590396 | api.ex | starcoder |
defmodule Snitch.Tools.ElasticSearch.Product.Store do
@moduledoc """
Fetches data from product table to be used in product index
"""
@behaviour Elasticsearch.Store
import Ecto.Query
alias Snitch.Core.Tools.MultiTenancy.Repo
alias Snitch.Data.Model.Product, as: PM
alias Snitch.Tools.ElasticsearchCluste... | apps/snitch_core/lib/core/tools/elasticsearch/product/store.ex | 0.644337 | 0.502441 | store.ex | starcoder |
defmodule Tournament do
@doc """
Given `input` lines representing two teams and whether the first of them won,
lost, or reached a draw, separated by semicolons, calculate the statistics
for each team's number of games played, won, drawn, lost, and total points
for the season, and return a nicely-formatted str... | elixir/tournament/lib/tournament.ex | 0.798815 | 0.562357 | tournament.ex | starcoder |
defmodule Mnemonix.Builder do
@moduledoc """
Creates functions that proxy to Mnemonix ones.
`use Mnemonix.Builder` to instrument a module with the `Mnemonix` client API.
It will define the `Mnemonix.Supervision` functions and all `Mnemonix.Feature` functions on the module:
- `Mnemonix.Features.Map`
- `Mne... | lib/mnemonix/builder.ex | 0.853287 | 0.401512 | builder.ex | starcoder |
defmodule Mix.Tasks.Blueprint.Plot.Fun do
@shortdoc "Create a function graph"
@moduledoc """
Creates a function graph.
mix blueprint.plot.fun [APP] [--simple | --complex] [--colour] [[--lib LIB | --path PATH] ...] [-o PATH]
An `APP` name is provided if the function graph should be
li... | lib/mix/tasks/blueprint.plot/fun.ex | 0.796213 | 0.526891 | fun.ex | starcoder |
defmodule Ratatouille.Runtime.Subscription do
@moduledoc """
Subscriptions provide a way for the app to be notified via
`c:Ratatouille.App.update/2` when something interesting happens.
Subscriptions should be constructed via the functions below and not via the
struct directly, as this is internal and subject... | lib/ratatouille/runtime/subscription.ex | 0.821331 | 0.628279 | subscription.ex | starcoder |
defmodule EnumExtras do
@moduledoc """
Provides additional utility functions for working with enumerables.
"""
@type t :: Enumerable.t()
@type element :: any
@doc """
Calculates the average of the elements in the `enumerable`.
It should return `nil` if the `enumerable` is empty.
"""
@spec averag... | lib/enum_extras.ex | 0.717507 | 0.677261 | enum_extras.ex | starcoder |
defmodule Kaffe.Producer do
@moduledoc """
The producer pulls in values from the Kaffe producer configuration:
- `heroku_kafka_env` - endpoints and SSL configuration will be pulled from ENV
- `endpoints` - plaintext Kafka endpoints
- `topics` - a list of Kafka topics to prep for producing
- `parti... | lib/kaffe/producer.ex | 0.870542 | 0.621957 | producer.ex | starcoder |
defmodule Ravix.Ecto.Parser.Shared do
alias Ravix.Ecto.Conversions
@spec is_op(any) ::
{:and, [{:context, Ravix.Ecto.Parser.Shared} | {:import, Kernel}, ...],
[{:!=, [...], [...]} | {:is_atom, [...], [...]}, ...]}
defmacro is_op(op) do
quote do
is_atom(unquote(op)) and unquote(op) ... | lib/ravix_ecto/parsers/shared.ex | 0.629319 | 0.464234 | shared.ex | starcoder |
defmodule StepFlow.LiveWorkers do
@moduledoc """
The LiveWorkers context.
"""
import Ecto.Query, warn: false
alias StepFlow.Repo
alias StepFlow.LiveWorkers.LiveWorker
@doc """
Returns the list of Live Worker.
## Examples
iex> StepFlow.LiveWorkers.list_live_workers()
%{data: [], page: ... | lib/step_flow/live_workers/live_workers.ex | 0.769514 | 0.452657 | live_workers.ex | starcoder |
defmodule Kernel.ParallelCompiler do
@moduledoc """
A module responsible for compiling files in parallel.
"""
@doc """
Compiles the given files.
Those files are compiled in parallel and can automatically
detect dependencies between them. Once a dependency is found,
the current file stops being compile... | lib/elixir/lib/kernel/parallel_compiler.ex | 0.791338 | 0.439807 | parallel_compiler.ex | starcoder |
defmodule ExHal.Form do
@moduledoc """
Represents a [Dwolla style HAL
form](https://github.com/Dwolla/hal-forms). Generally these are
acquired from `ExHal.Document.get_form/2`,
`ExHal.Document.fetch_form/2`, etc
"""
alias ExHal.{
FormField,
JsonFormEncoder
}
@typedoc """
A form that can ... | lib/exhal/form.ex | 0.83256 | 0.551936 | form.ex | starcoder |
defmodule StrawHat.Configurable do
@moduledoc """
It defines a configurable module. A configurable module expose `config`
function that returns the configuration of the module based a merge strategy.
The configuration will use three configurations:
* Using the macro parameters, most likely used for static v... | lib/straw_hat/configurable.ex | 0.823257 | 0.497315 | configurable.ex | starcoder |
defmodule Exnoops.Interviewbot do
@moduledoc """
Module to interact with Github's Noop: Interviewbot
See the [official `noop` documentation](https://noopschallenge.com/challenges/interviewbot) for API information including the accepted parameters.
"""
require Logger
import Exnoops.API
@doc """
Query ... | lib/exnoops/interviewbot.ex | 0.694095 | 0.551695 | interviewbot.ex | starcoder |
defmodule Wallaby.Element do
@moduledoc """
Defines an Element Struct and interactions with Elements.
Typically these functions are used in conjunction with a `find`:
```
page
|> find(Query.css(".some-element"), fn(element) -> Element.click(element) end)
```
These functions can be used to create new ... | lib/wallaby/element.ex | 0.78842 | 0.891244 | element.ex | starcoder |
defmodule Processor do
use GenServer
@moduledoc """
A `Processor` handles info regarding one source of input.
It reads data from a queue, processes that same data and forwards it to processed queues.
"""
@doc """
Starts a connection to handle one input source named `name`.
"""
def start_link(name) d... | dharma_server/apps/processor/lib/processor.ex | 0.749912 | 0.527864 | processor.ex | starcoder |
defmodule Health.Data.Periods do
@moduledoc """
The Data.Periods context.
"""
import Ecto.Query, warn: false
alias Health.Repo
alias Health.Data.Periods.Period
alias Health.Accounts.User
@doc """
Returns the list of periods.
## Examples
iex> list_periods()
[%Period{}, ...]
"""
... | lib/health/data/periods.ex | 0.913729 | 0.482856 | periods.ex | starcoder |
defmodule Obs do
use GenServer
defstruct [:value, observers: []]
def create(initial_value \\ 0) do
state = %Obs{value: initial_value}
GenServer.start_link(__MODULE__, state)
end
def init(state), do: {:ok, state}
def add_observer(observers, observer_pid) do
[observer_pid | observers]
end
... | 11-genserver/obs.ex | 0.661267 | 0.461927 | obs.ex | starcoder |
defmodule IBMCloud.KeyProtect do
@moduledoc """
IBM Key Protect API.
- [IBM Cloud Docs- IBM Key Protect](https://cloud.ibm.com/docs/services/key-protect)
- [IBM Cloud API - IBM Key Protect API](https://cloud.ibm.com/apidocs/key-protect)
"""
import IBMCloud.Utils
def build_client(endpoint, bearer_token,... | lib/ibmcloud/key_protect.ex | 0.672439 | 0.401072 | key_protect.ex | starcoder |
defmodule Ockam.SecureChannel.Channel do
@moduledoc false
use GenStateMachine
alias Ockam.Node
alias Ockam.SecureChannel.EncryptedTransportProtocol.AeadAesGcm, as: EncryptedTransport
alias Ockam.SecureChannel.KeyEstablishmentProtocol.XX, as: XXKeyEstablishmentProtocol
alias Ockam.Telemetry
@doc false
... | implementations/elixir/ockam/ockam/lib/ockam/secure_channel/channel.ex | 0.568416 | 0.411229 | channel.ex | starcoder |
defmodule NervesTime do
@moduledoc """
Keep time in sync on Nerves devices
`NervesTime` keeps the system clock on [Nerves](http://nerves-project.org)
devices in sync when connected to the network and close to in sync when
disconnected. It's especially useful for devices lacking a [Battery-backed
real-time ... | lib/nerves_time.ex | 0.856167 | 0.921711 | nerves_time.ex | starcoder |
defmodule AWS.Config do
@moduledoc """
AWS Config
AWS Config provides a way to keep track of the configurations of all the
AWS resources associated with your AWS account. You can use AWS Config to
get the current and historical configurations of each AWS resource and also
to get information about the rela... | lib/aws/config.ex | 0.873147 | 0.60842 | config.ex | starcoder |
defmodule Membrane.Event do
@moduledoc """
Structure representing a single event that flows between elements.
Each event:
- must contain type,
- may contain payload.
Type is used to distinguish event class.
Payload can hold additional information about the event.
Payload should always be a named st... | lib/membrane/event.ex | 0.857291 | 0.520679 | event.ex | starcoder |
defmodule Akd.Build.Phoenix.Npm do
@moduledoc """
A native Hook module that comes shipped with Akd.
This module uses `Akd.Hook`.
Provides a set of operations that build a npm release for a given phoenix app
at a deployment's `build_at` destination. This hook assumes that a package.json
is present.
Ensu... | lib/akd/phx/npm.ex | 0.877411 | 0.542318 | npm.ex | starcoder |
defmodule TheElixir.Logic.Game do
@moduledoc """
Module to handle the main menus and text of the game
"""
alias TheElixir.Logic.Game
alias TheElixir.Lobby
alias TheElixir.Components.World
alias TheElixir.Components.Inventory
alias TheElixir.Components.Journal
alias TheElixir.Logic.RoomGame
@do... | lib/the_elixir/logic/game.ex | 0.632503 | 0.439807 | game.ex | starcoder |
defmodule Scidata.Squad do
@moduledoc """
Module for downloading the [SQuAD1.1 dataset](https://rajpurkar.github.io/SQuAD-explorer).
"""
require Scidata.Utils
alias Scidata.Utils
@base_url "https://rajpurkar.github.io/SQuAD-explorer/dataset/"
@train_dataset_file "train-v1.1.json"
@test_dataset_file "d... | lib/scidata/squad.ex | 0.640074 | 0.50653 | squad.ex | starcoder |
defmodule Oban.Repo do
@moduledoc """
Wrappers around `Ecto.Repo` callbacks.
These functions should be used when working with an Ecto repo inside a plugin. These functions
will resolve the correct repo instance, and set the schema prefix and the log level, according
to the Oban configuration.
"""
alias ... | lib/oban/repo.ex | 0.853532 | 0.45847 | repo.ex | starcoder |
defmodule Flow.Window do
@moduledoc """
Splits a flow into windows that are materialized at certain triggers.
Windows allow developers to split data so we can understand incoming
data as time progresses. Once a window is created, we can specify
triggers that allow us to customize when the data accumulated on... | lib/flow/window.ex | 0.925369 | 0.817028 | window.ex | starcoder |
defprotocol Transducer do
@type accumulator :: any
@type state :: any
@type annotated_accumulator :: {:cont, accumulator} | {:halt, accumulator} | {:reduce, term, accumulator}
@type stateless_reducer :: (term, accumulator -> annotated_accumulator)
@type stateful_reducer :: (term, {state, accumulator} -> ann... | lib/transducer.ex | 0.903709 | 0.490968 | transducer.ex | starcoder |
defprotocol PayloadType do
@moduledoc """
This protocol indicates a module that is aware of which parser should be used
to handle its body.
"""
@doc """
This function is passed a packet and it returns the parser that should be used
to parse its body.
"""
@spec payload_parser(any) :: PayloadParser.t
... | lib/expcap.ex | 0.827026 | 0.467393 | expcap.ex | starcoder |
defmodule LimitedQueue do
@moduledoc """
An elixir wrapper for erlang's `:queue`, with a constant-time `size/1` and a maximum capacity.
When items pushed on to the `LimitedQueue` put it over its maximum capacity,
it will drop events according to its `drop_strategy/0`.
"""
@typedoc """
The opaque interna... | lib/limited_queue/limited_queue.ex | 0.913175 | 0.622373 | limited_queue.ex | starcoder |
defmodule Credo.Code do
@moduledoc """
`Credo.Code` contains a lot of utility or helper functions that deal with the
analysis of - you guessed it - code.
Whenever a function serves a general purpose in this area, e.g. getting the
value of a module attribute inside a given module, we want to extract that
fu... | lib/credo/code.ex | 0.73029 | 0.490114 | code.ex | starcoder |
defmodule ExsemanticaPhx.Search do
import Ecto.Query
def interests(qstring, opts, operation \\ :count) do
limit = Keyword.get(opts, :limit)
# Construct the query
query = case Keyword.get(opts, :d0) do
# No date bound
nil -> {:ok, from(int in ExsemanticaPhx.Site.Post, where: like(int.title, ... | apps/exsemantica_phx/lib/exsemantica_phx/search.ex | 0.55917 | 0.519217 | search.ex | starcoder |
defmodule Ueberauth.Strategy.Okta do
@moduledoc """
Provides an Ueberauth strategy for authenticating with Okta.
## Setup
You'll need to register a new application with Okta and get the `client_id` and `client_secret`. That setup is out of the scope of this library, but some notes to remember are:
* Ensure... | lib/ueberauth/strategy/okta.ex | 0.7324 | 0.422326 | okta.ex | starcoder |
defmodule BubblewrapEngine.Board do
require BubblewrapEngine.{Bubble, Coordinate}
alias BubblewrapEngine.{Bubble, Coordinate}
@enforce_keys [:max_players, :players, :popped_bubbles]
defstruct [:max_players, :players, :popped_bubbles]
def new(max_players, starting_players \\ []) do
{:ok, %__MODULE__{ max... | lib/bubblewrap_engine/board.ex | 0.754373 | 0.40489 | board.ex | starcoder |
defmodule Graphvix.Graph do
@moduledoc """
Models a directed graph that can be written to disk and displayed using
[Graphviz](http://www.graphviz.org/) notation.
Graphs are created by
* adding vertices of various formats to a graph
* `add_vertex/3`
* `add_record/2`
* `add_html_record/2`
* conn... | lib/graphvix/graph.ex | 0.943034 | 0.670202 | graph.ex | starcoder |
defmodule Mix.Tasks.GitHooks.Run do
@shortdoc "Runs all the configured mix tasks for a given git hook."
@moduledoc """
Runs all the configured mix tasks for a given git hook.
Any [git hook](https://git-scm.com/docs/githooks) is supported.
## Examples
You can run any hook by running `mix git_hooks.run ho... | lib/mix/tasks/git_hooks/run.ex | 0.843493 | 0.818193 | run.ex | starcoder |
defmodule Elixium.Validator do
alias Elixium.Block
alias Elixium.Utilities
alias Elixium.KeyPair
alias Elixium.Store.Ledger
alias Elixium.Store.Utxo
alias Decimal, as: D
@moduledoc """
Responsible for implementing the consensus rules to all blocks and transactions
"""
@doc """
A block is con... | lib/validator.ex | 0.727201 | 0.458712 | validator.ex | starcoder |
defmodule Snitch.Seed.Taxonomy do
@moduledoc """
Seeds basic taxonomy.
"""
alias Snitch.Data.Schema.Taxonomy
alias Snitch.Core.Tools.MultiTenancy.Repo
alias Snitch.Tools.Helper.Taxonomy, as: TaxonomyHelper
@product_category {
"Pets",
[
{"Dog",
[
{"Food",
[
... | apps/snitch_core/priv/repo/seed/taxonomy.ex | 0.524395 | 0.532851 | taxonomy.ex | starcoder |
defmodule BB84 do
@bases1 {
# |0>
Qubit.new(),
# |1>
Qubit.new() |> Qubit.qnot()
}
@bases2 {
# | + >
Qubit.new() |> Qubit.hadamard(),
# | - >
Qubit.new() |> Qubit.qnot() |> Qubit.hadamard()
}
@doc """
Encodes a list `bits` of 0s and 1s as a list of qubit, using a second list... | lib/bb84.ex | 0.902295 | 0.719507 | bb84.ex | starcoder |
defmodule WebSpell do
@moduledoc """
For a tutorial on how to use WebSpell, see the [README on Github](https://github.com/langalex/web_spell/blob/master/README.md).
"""
@doc """
Add WebSpell to your http client stub module by calling `use WebSpell`.
This adds the following methods to your module:
... | lib/web_spell.ex | 0.641759 | 0.44571 | web_spell.ex | starcoder |
defmodule Core.Ecto.TimestampRange do
@moduledoc false
@behaviour Ecto.Type
defstruct [:lower, :upper, lower_inclusive: true, upper_inclusive: true]
@type t :: %__MODULE__{
lower: boundary_t(),
upper: boundary_t(),
lower_inclusive: boolean(),
upper_inclusive: boolean()... | apps/core/lib/core/ecto/timestamp_range.ex | 0.883594 | 0.470554 | timestamp_range.ex | starcoder |
defmodule Protocol.Consolidation do
@moduledoc """
Module responsible for consolidating protocols and helpers for
extracting protocols and implementations from code paths for
consolidation.
"""
@doc """
Extract all protocols from the given paths.
The paths can be either a char list or a string. Intern... | lib/elixir/lib/protocol/consolidation.ex | 0.861217 | 0.461077 | consolidation.ex | starcoder |
defmodule NervesPack.WiFiWizardButton do
use GenServer
@moduledoc """
Starts the wizard if a button is depressed for long enough.
**Note:** Using this requires `Circuits.GPIO` be included as a dependency in
your project:
```elixir
def deps() do
{:circuits_gpio, "~> 0.4"}
end
```
It is recomm... | lib/nerves_pack/wifi_wizard_button.ex | 0.818229 | 0.781372 | wifi_wizard_button.ex | starcoder |
defmodule Nifsy do
@moduledoc """
The Nifsy API.
"""
alias Nifsy.{Handle, Native}
@default_buffer_bytes 64 * 1024
@options [:append, :create, :dsync, :exclusive, :lock, :sync, :truncate]
@type option ::
:append |
{:buffer_bytes, pos_integer} |
:create |
:dsync |
:exclusive |
:l... | lib/nifsy.ex | 0.830388 | 0.569553 | nifsy.ex | starcoder |
defmodule Cassette do
@moduledoc """
Library to generate and validate [CAS](http://jasig.github.io/cas/) TGTs/STs
## Client usage
Generate a tgt and a st for some service:
```elixir
iex> Cassette.tgt
{:ok, "TGT-example-abcd"}
iex> Cassette.st("http://some.authenticated/url")
{:ok, "ST-example-123... | lib/cassette.ex | 0.801276 | 0.873485 | cassette.ex | starcoder |
defmodule Plymio.Fontais.Option.Macro do
@moduledoc ~S"""
Macros for Custom Option ("opts") Accessors and Mutators.
See `Plymio.Fontais` for overview and documentation terms.
These macros define custom versions of a small set of functions from `Plymio.Fontais.Option` such as `Plymio.Fontais.Option.opts_get/3`... | lib/fontais/option/macro.ex | 0.713232 | 0.430387 | macro.ex | starcoder |
defmodule Cldr.Date do
@moduledoc """
Provides an API for the localization and formatting of a `Date`
struct or any map with the keys `:year`, `:month`,
`:day` and `:calendar`.
`Cldr.Date` provides support for the built-in calendar
`Calendar.ISO`. Use of other calendars may not produce
the expected resu... | lib/cldr/datetime/date.ex | 0.945362 | 0.755783 | date.ex | starcoder |
defmodule AWS.GreengrassV2 do
@moduledoc """
AWS IoT Greengrass brings local compute, messaging, data management, sync, and
ML inference capabilities to edge devices.
This enables devices to collect and analyze data closer to the source of
information, react autonomously to local events, and communicate sec... | lib/aws/generated/greengrass_v2.ex | 0.868493 | 0.459379 | greengrass_v2.ex | starcoder |
defmodule Plaid.Transactions do
@moduledoc """
[Plaid Transactions API](https://plaid.com/docs/api/transactions) calls and schema.
"""
defmodule GetResponse do
@moduledoc """
[Plaid API /transactions/get response schema.](https://plaid.com/docs/api/transactions)
"""
@behaviour Plaid.Castable
... | lib/plaid/transactions.ex | 0.910264 | 0.455986 | transactions.ex | starcoder |
defmodule PrometheusParser.Line do
defstruct line_type: nil,
timestamp: nil,
pairs: [],
value: nil,
documentation: nil,
type: nil,
label: nil
end
defimpl String.Chars, for: PrometheusParser.Line do
def pairs_to_string(pairs) do
pairs
|... | lib/prometheus_parser.ex | 0.640411 | 0.401365 | prometheus_parser.ex | starcoder |
defmodule AWS.CodeGuruProfiler do
@moduledoc """
This section provides documentation for the Amazon CodeGuru Profiler API
operations.
` Amazon CodeGuru Profiler collects runtime performance data from your live
applications, and provides recommendations that can help you fine-tune your
application performa... | lib/aws/generated/code_guru_profiler.ex | 0.913193 | 0.454533 | code_guru_profiler.ex | starcoder |
defmodule Uniq.UUID do
@moduledoc """
This module provides RFC 4122 compliant universally unique identifiers (UUIDs).
See the [README](README.md) for general usage information.
"""
use Bitwise, skip_operators: true
import Kernel, except: [to_string: 1]
defstruct [:format, :version, :variant, :time, :se... | lib/uuid.ex | 0.879419 | 0.608158 | uuid.ex | starcoder |
defmodule APIacAuthBearer do
@moduledoc """
An `APIac.Authenticator` plug for API authentication using the OAuth2 `Bearer` scheme
The OAuth2 `Bearer` scheme is documented in
[RFC6750 - The OAuth 2.0 Authorization Framework: Bearer Token Usage](https://tools.ietf.org/html/rfc6750)
and consists in sending an O... | lib/apiac_auth_bearer.ex | 0.940626 | 0.835819 | apiac_auth_bearer.ex | starcoder |
defmodule Adventofcode.Day11SeatingSystem do
use Adventofcode
alias __MODULE__.{Printer, State}
def part_1(input) do
input
|> parse()
|> State.new(tolerant: false)
|> step_until_stable
|> State.count_occupied()
end
def part_2(input) do
input
|> parse()
|> State.new(tolerant:... | lib/day_11_seating_system.ex | 0.682362 | 0.623635 | day_11_seating_system.ex | starcoder |
defmodule Csp.Backtracking do
@moduledoc """
Backtracking algorithm implementation.
"""
alias Csp
alias Csp.AC3
@type variable_selector :: :take_head | ([Csp.variable()] -> {Csp.variable(), [Csp.variable()]})
@doc """
Backtracking implementation for solving CSPs.
## Options
The following `opts` ... | lib/csp/backtracking.ex | 0.82425 | 0.639032 | backtracking.ex | starcoder |
defmodule Journey do
defstruct data: nil, steps: [], state: :new, result: nil
alias Journey.Step
def new() do
%__MODULE__{}
end
def set_data(%__MODULE__{} = journey, data) do
%__MODULE__{journey | data: data}
end
def run(%__MODULE__{} = journey, spec, args \\ []) do
add_step(journey, {spec... | lib/journey.ex | 0.566139 | 0.717556 | journey.ex | starcoder |
defmodule Mapail do
@moduledoc ~S"""
Helper library to convert a map into a struct or a struct to a struct.
Convert string-keyed maps to structs by calling the
`map_to_struct/3` function.
Convert atom-keyed and atom/string mixed key maps to
structs by piping the `stringify_map/1` into the `map_to_struct/3... | lib/mapail.ex | 0.730674 | 0.857171 | mapail.ex | starcoder |
defmodule EctoIPRange.Util.Inet do
@moduledoc false
@doc """
Convert an IPv4 tuple into an IPv6 tuple.
Wrapper around `:inet.ipv4_mapped_ipv6_address/1` to allow only IPv4-to-IPv6
conversion and provide support for OTP < 21.
## Examples
iex> ipv4_to_ipv6({127, 0, 0, 1})
{:ok, {0, 0, 0, 0, 0,... | lib/ecto_ip_range/util/inet.ex | 0.854582 | 0.534612 | inet.ex | starcoder |
defmodule Curve448 do
import Bitwise
@moduledoc """
Curve448 Diffie-Hellman functions
"""
@typedoc """
public or secret key
"""
@type key :: <<_:: 224>>
@p 726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018365439
@a 15... | lib/curve448.ex | 0.864268 | 0.451508 | curve448.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.