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 Bitmap.Binary do
@moduledoc """
Contains functions to create and work with a [bitmap](https://en.wikipedia.org/wiki/Bitmap)
Bitmaps are also known as bit arrays, bit sets and is a fast space efficient
data structure for lookups
The module has been designed to be pipe-friendly, so pipe 'em up
""... | lib/bitmap/binary.ex | 0.914463 | 0.620305 | binary.ex | starcoder |
defmodule Gettext.Interpolation.Default do
@moduledoc """
Default Interpolation Implementation
Replaces `%{binding_name}` with a string value.
"""
@behaviour Gettext.Interpolation
@type interpolatable :: [String.t() | atom]
# Extracts interpolations from a given string.
# This function extracts all... | api/deps/gettext/lib/gettext/interpolation/default.ex | 0.91854 | 0.538134 | default.ex | starcoder |
defmodule Fixtures.Helper do
@moduledoc false
@doc false
defmacro __using__(_opts \\ []) do
quote do
@before_compile unquote(__MODULE__)
@on_definition {unquote(__MODULE__), :on_def}
require unquote(__MODULE__)
Module.register_attribute(__MODULE__, :generators, accumulate: true)
e... | lib/fixtures/helper.ex | 0.678433 | 0.609698 | helper.ex | starcoder |
defmodule Brook.Storage.Postgres.Query do
@moduledoc """
Abstracts the Postgrex SQL query functions away from
the storage behaviour implementation.
Collects the command run directly against the Postgrex
API in a single location for creates, inserts, selects,
and deletes.
"""
@typedoc "The pid of the P... | lib/brook/storage/postgres/query.ex | 0.770939 | 0.40031 | query.ex | starcoder |
defmodule Joi.Type.Integer do
@moduledoc false
import Joi.Validator.Skipping
import Joi.Util
import Joi.Validator.Max, only: [max_validate: 4]
import Joi.Validator.Min, only: [min_validate: 4]
import Joi.Validator.Inclusion, only: [inclusion_validate: 4]
import Joi.Validator.Greater, only: [greater_val... | lib/joi/type/integer.ex | 0.726814 | 0.438605 | integer.ex | starcoder |
defmodule Faker.Pokemon.It do
import Faker, only: [sampler: 2]
@moduledoc """
Functions for Pokemon names in Italian
"""
@doc """
Returns a Pokemon name
## Examples
iex> Faker.Pokemon.It.name()
"Magmortar"
iex> Faker.Pokemon.It.name()
"Gastly"
iex> Faker.Pokemon.It.name()... | lib/faker/pokemon/it.ex | 0.530236 | 0.48182 | it.ex | starcoder |
defmodule Serum.Plugins.SitemapGenerator do
@moduledoc """
A Serum plugin that create a sitemap so that the search engine can index posts.
## Using the Plugin
# serum.exs:
%{
server_root: "https://example.io",
plugins: [
{Serum.Plugins.SitemapGenerator, only: :prod}
... | lib/serum/plugins/sitemap_generator.ex | 0.671794 | 0.434821 | sitemap_generator.ex | starcoder |
defmodule Exchange.Order do
@moduledoc """
A struct representing an Order to be placed in the Exchange
side: :buy, :sell
type: :market, :limit
trader_id: Alchemist or the user_id
expiration_time: unix timestamp in milliseconds when the order expires
"""
defstruct order_id: nil,
trader_id: ... | lib/exchange/order.ex | 0.837968 | 0.658146 | order.ex | starcoder |
defmodule Blockchain.Transaction do
@moduledoc """
Implements a blockchain transaction
"""
alias Blockchain.Hash
alias Blockchain.TransactionIO
alias Blockchain.Wallet
@enforce_keys [:signature, :from, :to, :value, :inputs, :outputs]
defstruct @enforce_keys
@typedoc """
Represents a transaction
... | lib/blockchain/transaction.ex | 0.896547 | 0.567547 | transaction.ex | starcoder |
defmodule WebpackStatic.Plug do
@moduledoc """
Phoenix plug to proxy a locally running instance of the webpack dev server.<br />
This plug will only serve assets when the env parameter has the value of `:dev`.<br />
Phoenix will be allowed a chance to resolve any assets not resolved by webpack.<br />
## Inst... | lib/webpack_static.ex | 0.864982 | 0.727056 | webpack_static.ex | starcoder |
defmodule AWS.MarketplaceMetering do
@moduledoc """
AWS Marketplace Metering Service
This reference provides descriptions of the low-level AWS Marketplace
Metering Service API.
AWS Marketplace sellers can use this API to submit usage data for custom
usage dimensions.
For information on the permissions... | lib/aws/marketplace_metering.ex | 0.833663 | 0.536131 | marketplace_metering.ex | starcoder |
defmodule Bitcoinex.Address do
@moduledoc """
Bitcoinex.Address supports Base58 and Bech32 address encoding and validation.
"""
alias Bitcoinex.{Segwit, Base58, Network}
@typedoc """
The address_type describes the address type to use.
Four address types are supported:
* p2pkh: Pay-to-Public-Key... | server/bitcoinex/lib/address.ex | 0.852859 | 0.572036 | address.ex | starcoder |
defmodule Docker do
@moduledoc false
defmodule Error do
@moduledoc false
defexception [:command, :args, :status, :output]
def message(%{command: command, args: args, status: status, output: output}) do
"Failed on docker #{Enum.join([command | args], " ")} (#{status}):\n#{output}"
end
end
... | test/support/docker.ex | 0.805709 | 0.470554 | docker.ex | starcoder |
defmodule Estuary.DataWriter do
@moduledoc """
Implementation of `Pipeline.Writer` for Estuary's edges.
"""
require Logger
alias Estuary.Datasets.DatasetSchema
alias Estuary.DataReader
@behaviour Pipeline.Writer
@table_writer Application.get_env(:estuary, :table_writer)
@impl Pipeline.Writer
@d... | apps/estuary/lib/estuary/data_writer.ex | 0.798187 | 0.520496 | data_writer.ex | starcoder |
defmodule StepFlow.Amqp.CommonConsumer do
@moduledoc """
Definition of a Common Consumer of RabbitMQ queue.
To implement a consumer,
```elixir
defmodule MyModule do
use StepFlow.Amqp.CommonConsumer, %{
queue: "name_of_the_rabbit_mq_queue",
exchange "name_of_exchange",
consumer: &MyModu... | lib/step_flow/amqp/common_consumer.ex | 0.733547 | 0.590897 | common_consumer.ex | starcoder |
defmodule Chatter.PeerData do
require Record
require Chatter.NetID
require Chatter.BroadcastID
alias Chatter.NetID
alias Chatter.BroadcastID
Record.defrecord :peer_data,
id: nil,
broadcast_seqno: 0,
seen_ids: []
@type t :: record( :peer_data,
... | lib/peer_data.ex | 0.659076 | 0.40204 | peer_data.ex | starcoder |
defmodule OptimusHash do
@moduledoc """
OptimusHash is a small library to do integer hashing based on Knuth's
multiplicative hashing algorithm. The algorithm is fast, reversible and has
zero collisions.
This comes in very handy when you have e.g. integer-based primary keys in your
database and you don't wa... | lib/optimus_hash.ex | 0.909244 | 0.897111 | optimus_hash.ex | starcoder |
defmodule Pushex.Sandbox do
@moduledoc """
Sandbox where notifications get saved when the application is running in sandbox mode.
This is meant to be used in tests, and should not be used in production.
Note that all operations are dependent on the `pid`, so the process
calling and `Pushex.send_notification/... | lib/pushex/sandbox.ex | 0.777342 | 0.432243 | sandbox.ex | starcoder |
defmodule Bowling do
@doc """
Creates a new game of bowling that can be used to store the results of
the game
There are several possible states of the game:
* :ball_1 means waiting for the first roll of the frame
* {:ball_2, roll_1} means waiting for the second roll of t... | elixir/bowling/lib/bowling.ex | 0.877129 | 0.645888 | bowling.ex | starcoder |
defmodule Csp.AC3 do
@moduledoc """
Pure AC-3 algorithm implementation.
Also provides `reduce/3` helper that can be used as an inference part of search algorithms.
"""
alias Csp.Constraint
@type unassigned :: [Csp.variable()]
@type domain_reduction :: {Csp.t(), Csp.assignment(), unassigned()}
@type re... | lib/csp/ac3.ex | 0.928676 | 0.838911 | ac3.ex | starcoder |
defmodule Urania do
@moduledoc """
Efficient and elegant data access for Elixir.
It's a port of a Clojure library named Urania.
A brief explanation blatantly stolen from
https://funcool.github.io/urania/latest/ ensues:
Oftentimes, your business logic relies on remote data that you need to fetch
from di... | lib/urania.ex | 0.684791 | 0.628664 | urania.ex | starcoder |
defmodule Akd.DestinationResolver do
@moduledoc """
This module defines helper functions which can be used to resolve
a destination for based on deployment and the destination type
"""
alias Akd.{Destination, Deployment}
@doc """
This function takes a `destination` variable and a `Deployment.t` struct.
... | lib/akd/helpers/destination_resolver.ex | 0.865025 | 0.585309 | destination_resolver.ex | starcoder |
defmodule Cldr.Http do
@moduledoc """
Supports securely downloading https content.
"""
@doc """
Securely download https content from
a URL.
This function uses the built-in `:httpc`
client but enables certificate verification
which is not enabled by `:httc` by default.
### Arguments
* `url` is... | lib/cldr/http/http.ex | 0.80406 | 0.69311 | http.ex | starcoder |
defmodule Scenic.Primitive.Style do
@moduledoc """
Modify the look of a primitive by applying a Style.
Styles are optional modifiers that you can put on any primitive. Each style does a specific thing and some only affect certain primitives.
There is a fixed list of primitive styles which are understood by t... | lib/scenic/primitive/style/style.ex | 0.93866 | 0.657836 | style.ex | starcoder |
defmodule AWS.RDS do
@moduledoc """
Amazon Relational Database Service
Amazon Relational Database Service (Amazon RDS) is a web service that makes it
easier to set up, operate, and scale a relational database in the cloud.
It provides cost-efficient, resizeable capacity for an industry-standard
relationa... | lib/aws/generated/rds.ex | 0.844377 | 0.522202 | rds.ex | starcoder |
defmodule Phoenix.LiveView do
@moduledoc """
Live views are stateful views which update the browser on state changes.
## Configuration
A `:signing_salt` configuration is required in your endpoint's
`:live_view` configuration, for example:
config :my_app, AppWeb.Endpoint,
...,
live_vie... | lib/phoenix_live_view.ex | 0.884788 | 0.637877 | phoenix_live_view.ex | starcoder |
defmodule Vix.Vips.Interpolate do
alias Vix.Type
defstruct [:ref]
alias __MODULE__
@moduledoc """
Make interpolators for operators like `affine` and `mapim`.
"""
alias Vix.Type
alias Vix.Nif
@behaviour Type
@typedoc """
Represents an instance of VipsInterpolate
"""
@type t() :: %Interpol... | lib/vix/vips/interpolate.ex | 0.905444 | 0.700933 | interpolate.ex | starcoder |
defmodule Exglicko2 do
@moduledoc """
Tools for working with Glicko-2 ratings.
Players are represented by a `Exglicko2.Player` struct.
You can get a new, default struct with the `new_player/0` function.
iex> Exglicko2.new_player()
%Exglicko2.Player{rating: 0.0, deviation: 2.0, volatility: 0.06}
... | lib/exglicko2.ex | 0.837321 | 0.649057 | exglicko2.ex | starcoder |
defmodule Tortoise311 do
@moduledoc """
A MQTT client for Elixir.
`Tortoise311` provides ways of publishing messages to, and receiving
messages from one or many MQTT brokers via TCP or SSL. The design
philosophy of Tortoise311 is to hide the protocol specific details from
the user, and expose interfaces an... | lib/tortoise311.ex | 0.938379 | 0.547222 | tortoise311.ex | starcoder |
defmodule Kvasir.Offset do
@moduledoc ~S"""
Kafka offset per partition.
"""
@typedoc @moduledoc
@type t :: %__MODULE__{} | :earliest
defstruct partitions: %{},
offset: 0
@spec create(map | list) :: t
def create(partitions \\ [])
def create(offset = %__MODULE__{}), do: offset
def crea... | lib/kvasir/offset.ex | 0.863233 | 0.506836 | offset.ex | starcoder |
defmodule Ecto.Model.Schema do
@moduledoc """
Defines a schema for a model.
A schema is a struct with associated metadata that is persisted to a
repository. Every schema model is also a struct, that means that you work
with models just like you would work with structs.
## Example
defmodule User do
... | lib/ecto/model/schema.ex | 0.856917 | 0.542742 | schema.ex | starcoder |
defmodule Sourceror.Code do
@moduledoc false
alias Sourceror.Code.Formatter
alias Sourceror.Code.Normalizer
@spec string_to_quoted_with_comments(List.Chars.t(), keyword) ::
{:ok, Macro.t(), list(map())} | {:error, {location :: keyword, term, term}}
def string_to_quoted_with_comments(string, opts \... | lib/sourceror/code.ex | 0.748444 | 0.451447 | code.ex | starcoder |
defmodule ExW3.Utils do
@type invalid_hex_string :: :invalid_hex_string
@type negative_integer :: :negative_integer
@type non_integer :: :non_integer
@type eth_hex :: String.t()
@doc "Convert eth hex string to integer"
@spec hex_to_integer(eth_hex) ::
{:ok, non_neg_integer} | {:error, invalid_hex... | lib/exw3/utils.ex | 0.856017 | 0.475788 | utils.ex | starcoder |
if Code.ensure_loaded?(Absinthe) do
defmodule Datacop.AbsintheMiddleware.Authorize do
@moduledoc """
Performs authorization for the given resolution.
With Datacop module we are able to get `{:dataloader, _dataloader_config}` while authorizing, when
we work with batched fields. To process result we sh... | lib/datacop/absinthe_middleware/authorize.ex | 0.918192 | 0.795698 | authorize.ex | starcoder |
defmodule AWS.Snowball do
@moduledoc """
AWS Snowball is a petabyte-scale data transport solution that uses secure
devices to transfer large amounts of data between your on-premises data
centers and Amazon Simple Storage Service (Amazon S3). The Snowball
commands described here provide access to the same fun... | lib/aws/snowball.ex | 0.877398 | 0.674546 | snowball.ex | starcoder |
defmodule Pushover.Model.Message do
@moduledoc """
A message.
## Attributes
* `data` (*type:* `String.t`, *default:* `nil`) - Your message.
* `device` (*type:* `String.t`, *default:* `nil`) - Your user's device name(s) to send the message directly (multiple devices may be separated by a comma).
* `t... | lib/pushover/model/message.ex | 0.77569 | 0.464841 | message.ex | starcoder |
defmodule LearnKit.Regression.Polynomial do
@moduledoc """
Module for Polynomial Regression algorithm
"""
defstruct factors: [], results: [], coefficients: [], degree: 2
alias LearnKit.Regression.Polynomial
use Polynomial.Calculations
use LearnKit.Regression.Score
@type factors :: [number]
@type re... | lib/learn_kit/regression/polynomial.ex | 0.940051 | 0.988949 | polynomial.ex | starcoder |
defmodule Durex do
@moduledoc """
Parse durations, such as `"1s"`, to its numerical millisecond value, e.g. `1_000`,
so you can do things such as:
```
"1s"
|> Durex.ms!()
|> Process.sleep()
```
## Examples
iex> Durex.ms "3s"
{:ok, 3_000}
iex> Durex.ms "1h"
{:ok, 3600_000}
... | lib/durex.ex | 0.932184 | 0.855308 | durex.ex | starcoder |
defmodule Raxx.Request do
@moduledoc """
HTTP requests to a Raxx application are encapsulated in a `Raxx.Request` struct.
A request has all the properties of the url it was sent to.
In addition it has optional content, in the body.
As well as a variable number of headers that contain meta data.
Where appr... | lib/raxx/request.ex | 0.898566 | 0.616128 | request.ex | starcoder |
defmodule Statistics.Distributions.Normal do
@moduledoc """
The normal, or gaussian, distribution
When invoking the distibution functions without parameters,
a distribution with mean of 0 and standard deviation of 1 is assumed.
"""
alias Statistics.Math
alias Statistics.Math.Functions
@doc """
Pro... | lib/statistics/distributions/normal.ex | 0.942626 | 0.874881 | normal.ex | starcoder |
defmodule PlayfabEx.Server.SharedGroupData do
use Interface
@doc """
Adds users to the set of those able to update both the shared data, as well as the set of users in the group. Only users in the group (and the server) can add new members. Shared Groups are designed for sharing data between a very small numbe... | lib/server/shared_group_data.ex | 0.584864 | 0.476945 | shared_group_data.ex | starcoder |
defmodule ExWire.P2P.Server do
@moduledoc """
Server handling peer to peer communication.
It starts a TCP server to handle incoming and outgoing RLPx, DevP2P, Eth Wire
connection.
Once this connection is up, it's possible to add a subscriber to the different
packets that are sent over the connection. This... | apps/ex_wire/lib/ex_wire/p2p/server.ex | 0.721743 | 0.500549 | server.ex | starcoder |
defmodule Coxir.API do
@moduledoc """
Used to interact with Discord's API while
keeping track of all the ratelimits.
"""
alias Coxir.API.Base
@table :rates
@doc false
def create_tables do
:ets.new @table, [:set, :public, :named_table]
end
@doc """
Performs an API request.
Returns raw da... | lib/coxir/api/api.ex | 0.843105 | 0.418459 | api.ex | starcoder |
defmodule Membrane.Query do
@moduledoc ~S"""
`Membrane.Query` module evaluates query against a map or struct. It evaluates every condition through
`Membrane.Parser` module.
## Query Conditions
The query conditions are divided into 4 types.
* [Logical Conditions](#module-logical-conditions)
* [Atom... | lib/membrane/query.ex | 0.86792 | 0.723285 | query.ex | starcoder |
defmodule CoursePlanner.Classes.Calendars do
@moduledoc """
This module provides helper functions to populate the json for the calendar view
"""
import Ecto.Query
alias CoursePlanner.{Repo, Courses.OfferedCourse}
alias Ecto.Changeset
def get_user_classes(user, true, week_range) do
case user.role do
... | lib/course_planner/classes/calendars.ex | 0.694717 | 0.533094 | calendars.ex | starcoder |
defmodule Speed.Deck do
@moduledoc """
Provides functions for working with a deck of playing cards.
"""
@typedoc "A list of binaries representing playing cards."
@type t :: [card]
@typedoc "A binary representing a playing card."
@type card :: binary
@typedoc "The successful result of dealing to a pla... | lib/speed/deck.ex | 0.887205 | 0.530966 | deck.ex | starcoder |
defmodule Nixa.Tree.ID3Regressor do
@moduledoc """
Implementation of ID3 regressor decision tree algorithm
"""
import Nixa.Tree.Shared
import Nixa.Shared
defmodule WrappedModel do
defstruct [
root: nil,
binning_strategy: [],
binning_borders: []
]
end
@doc """
Train a model... | lib/nixa/tree/id3_regressor.ex | 0.803405 | 0.529811 | id3_regressor.ex | starcoder |
defmodule LayoutOMatic.ComponentLayout do
@moduledoc """
Handles Auto-Layouts for Scenic Components.
Each Scenic component is a little different in how it's sized and positioned. While most components are positioned from it's top left most point, passing the next starting point is
a little different. Sizing fo... | lib/layouts/components/autolayout.ex | 0.860193 | 0.813831 | autolayout.ex | starcoder |
defmodule Automaton.Types.TWEANN.Neuron do
@moduledoc """
A signal processing element. It accepts signals, accumulates them
into an ordered vectorr, then processes this input vector to produce
an output, and finally passes the output to other elements it is
connected to.
Nuerons's are represented with the ... | lib/automata/automaton_types/neuroevolution/neuron.ex | 0.784154 | 0.693927 | neuron.ex | starcoder |
defmodule Cldr.Locale.Backend do
@moduledoc false
def define_locale_backend(config) do
quote location: :keep, bind_quoted: [config: Macro.escape(config)] do
defmodule Locale do
@moduledoc false
if Cldr.Config.include_module_docs?(config.generate_docs) do
@moduledoc """
... | lib/cldr/backend/locale.ex | 0.865494 | 0.445107 | locale.ex | starcoder |
defmodule Formular.Compiler do
@moduledoc """
This module is used to compile the code into Elixir modules.
"""
@scope_and_binding_ops ~w[-> def]a
@scope_ops ~w[for]a
@binding_ops ~w[<- =]a
@doc """
Create an Elixir module from the raw code (AST).
The created module will have to public functions:
... | lib/formular/compiler.ex | 0.810966 | 0.781414 | compiler.ex | starcoder |
defmodule ETag.Plug.Options do
@moduledoc """
Applies defaults and validates the given options for the plug. Allowed options are:
- `generator`
- `methods`
- `status_codes`
For details on their usage, values and defaults take a look at the `ETag.Plug` module.
"""
@spec sanitize!(Keyword.t()) :: Keywor... | lib/etag/plug/options.ex | 0.857619 | 0.460653 | options.ex | starcoder |
defmodule Ffaker.KoKr.Address do
@moduledoc"""
주소 데이터에 관한 함수가 들어있는 모듈
"""
use Ffaker
alias Ffaker.KoKr.Name
import Ffaker, only: [numerify: 1]
@building_dongs ~w(가 나 다 라 마 바 ## ###)
@building_suffixes ~w(빌라 아파트 연립 마을 타운 타워)
@street_suffixes ~w(로 #로 가 #가 거리 길)
@town_suffixes ~w(동 리 마을)
@metropoli... | lib/ffaker/ko_kr/address.ex | 0.588889 | 0.450843 | address.ex | starcoder |
defmodule StellarBase.XDR.ClaimOfferAtomV0 do
@moduledoc """
Representation of Stellar `ClaimOfferAtomV0` type.
ClaimOfferAtomV0 is a ClaimOfferAtom with the AccountID discriminant stripped
off, leaving a raw ed25519 public key to identify the source account. This is
used for backwards compatibility starting... | lib/xdr/transactions/claim_offer_atom_v0.ex | 0.857679 | 0.436142 | claim_offer_atom_v0.ex | starcoder |
defmodule Glock.Conn do
@moduledoc """
Defines the glock connection struct that serves as
the configuration state of an initialized glock process.
The struct tracks all configuration settings and arguments
passed into the connection when it is initialized and provides
common default values for all settings... | lib/glock/conn.ex | 0.591723 | 0.421909 | conn.ex | starcoder |
defmodule Snapex7.Client do
use GenServer
require Logger
@c_timeout 5000
@block_types [
OB: 0x38,
DB: 0x41,
SDB: 0x42,
FC: 0x43,
SFC: 0x44,
FB: 0x45,
SFB: 0x46
]
@connection_types [
PG: 0x01,
OP: 0x02,
S7_basic: 0x03
]
@area_types [
PE: 0x81,
PA: 0x82,... | lib/snap7/client.ex | 0.765681 | 0.413477 | client.ex | starcoder |
defmodule ProteinTranslation do
@moduledoc """
Provides functions to translate a RNA codons sequence into the corresponding proteins sequence :
- `of_codon\1` translate a given codon in the corresponding protein
- `of_rna\1` translate a given strand of codon in the corresponding protein sequence
"""
@... | exercism/elixir/protein-translation/lib/protein_translation.ex | 0.914405 | 0.615853 | protein_translation.ex | starcoder |
defmodule BubbleLib.DslStruct do
@moduledoc """
A "DSL Struct" is a struct which can be exposed in Bubblescript.
Most notable are intent, message, attachment, location, event.
"""
defmacro __using__(struct) do
str_fields = struct |> Keyword.keys() |> Enum.map(&to_string/1)
quote do
defstruct ... | lib/bubble_lib/dsl_struct.ex | 0.792424 | 0.548492 | dsl_struct.ex | starcoder |
defmodule Sea.Signal do
@moduledoc """
Defines signal (aka. event) with payload that will get emitted to defined observers.
"""
@doc """
Build the signal struct from arbitrary input (or return it if already a signal struct).
Sea provides the default implementation that will simply return the signal struct... | lib/sea/signal.ex | 0.877214 | 0.596022 | signal.ex | starcoder |
defmodule Extreme do
@moduledoc """
Extreme module is main communication point with EventStore using tcp connection. Extreme is implemented using
GenServer and is OTP compatible. If client is disconnected from server we are not trying to reconnect,
instead you should rely on your supervisor. For example:
... | lib/extreme.ex | 0.847274 | 0.428413 | extreme.ex | starcoder |
defmodule Snitch.Domain.Inventory do
@moduledoc """
Interface for handling inventory related business logic
"""
alias Snitch.Data.Model.StockItem, as: StockModel
alias Snitch.Data.Model.StockLocation, as: SLModel
alias Snitch.Data.Schema.StockItem, as: StockSchema
alias Snitch.Data.Schema.Product
alias... | apps/snitch_core/lib/core/domain/stock/inventory.ex | 0.833833 | 0.482795 | inventory.ex | starcoder |
defmodule Geometry.MultiLineString do
@moduledoc """
A set of line-strings from type `Geometry.LineString`
`MultiLineStringMZ` implements the protocols `Enumerable` and `Collectable`.
## Examples
iex> Enum.map(
...> MultiLineString.new([
...> LineString.new([
...> Point.ne... | lib/geometry/multi_line_string.ex | 0.939789 | 0.557785 | multi_line_string.ex | starcoder |
defmodule SmartTracer do
@moduledoc """
A simple wrapper for recon_trace.
## Usage
When connected to a live remote console, issue the `trace/2` passing the function reference and rate limit.
### Tracing a global function
```
iex> SmartTracer.trace(&FakeModule.hello/1, 5)
1
iex> FakeModu... | lib/smart_tracer.ex | 0.825871 | 0.712932 | smart_tracer.ex | starcoder |
defmodule Fastfwd.Sender do
@moduledoc """
Functions for a generic Fastfwd sender, such as an adapter frontend, forwarder or facade.
This module is a quick way to convert a module into a Fastfwd sender, acting as frontend to various tagged receiver
modules.
## Example
```
defmodule Icecream do
use... | lib/fastfwd/sender.ex | 0.896795 | 0.717723 | sender.ex | starcoder |
defmodule Dust.Parsers do
@moduledoc """
Parsers API provides abstractions to
get relevant assets from the DOM.
"""
alias Dust.Parsers
alias Dust.Parsers.{CSS, Image, Favicon, JS}
@type sources() :: list(String.t())
@type document() :: Floki.html_tag() | Floki.html_tree()
@doc """
Parses raw HTML ... | lib/dust/parsers.ex | 0.835953 | 0.521227 | parsers.ex | starcoder |
defmodule Nerves.Network do
require Logger
alias Nerves.Network.Types
@moduledoc """
The Nerves.Network application handles the low level details of connecting
to networks. To quickly get started, create a new Nerves project and add
the following line someplace early on in your program:
Nerves.Netwo... | lib/nerves_network.ex | 0.784195 | 0.407834 | nerves_network.ex | starcoder |
defmodule Elixoids.Space do
@moduledoc """
Define the play area (world) in which the Game is played.
All units are in metres.
"""
alias Elixoids.World.Point
import Elixoids.Const
# The ratio of the play area
@ratio world_ratio()
@width world_width_m()
@height @width / @ratio
@half_width @width ... | lib/elixoids/space.ex | 0.824285 | 0.41745 | space.ex | starcoder |
defmodule Scipio.Utils.Pipeline do
require Logger
def is_valid(pipelines) when is_list(pipelines), do: pipelines
def is_valid(tasks), do: tasks
def parse(pipeline, :config) do
String.trim(pipeline)
|> String.split("\n")
|> Enum.map(fn item -> String.trim(item) end)
end
@doc """
pipelines... | lib/utils/pipeline.ex | 0.618665 | 0.459137 | pipeline.ex | starcoder |
defmodule AkinML.Tangram.Name do
@moduledoc """
1. [Install](https://www.tangram.dev/docs/install) the Tangram CLI
1. Training data is in `names.csv` in same directory as this module
1. Train the model: `tangram train --file names.csv --target outcome`
1. Model is `metrics_for_training.tangram`
1. Run the T... | lib/tangram/name.ex | 0.822759 | 0.532729 | name.ex | starcoder |
defmodule Sanbase.Signal.Evaluator do
@moduledoc ~s"""
A module that takes a list of triggers and returns the ones that are triggered.
The evaluation can be executed or the values can be taken from a cache. Taking
data from the cache respects the last triggered datetimes, the cooldown value and
all relevat t... | lib/sanbase/signals/evaluator/evaluator.ex | 0.786131 | 0.493348 | evaluator.ex | starcoder |
defmodule KafkaEx.New.KafkaExAPI do
@moduledoc """
This module interfaces Kafka through the New.Client implementation
This is intended to become the future KafkaEx API
Most functions here take a client pid as the first argument.
```
{:ok, client} = KafkaEx.New.Client.start_link()
KafkaEx.New.KafkaExAP... | lib/kafka_ex/new/kafka_ex_api.ex | 0.836388 | 0.644582 | kafka_ex_api.ex | starcoder |
defmodule Gradient do
@moduledoc """
Documentation for `Gradient`.
Options:
- `app_path` - Path to the app that contains file with code (for umbrella apps).
- `code_path` - Path to a file with code (e.g. when beam was compiled without project).
- `no_gradualizer_check` - Skip Gradualizer checks if true.
... | lib/gradient.ex | 0.738386 | 0.546859 | gradient.ex | starcoder |
defmodule Exq.Redis.JobStat do
@moduledoc """
The JobStat module encapsulates storing system-wide stats on top of Redis
It aims to be compatible with the Sidekiq stats format.
"""
require Logger
alias Exq.Support.{Binary, Process, Job, Time}
alias Exq.Redis.{Connection, JobQueue}
def record_processed_... | lib/exq/redis/job_stat.ex | 0.667256 | 0.52409 | job_stat.ex | starcoder |
defmodule DryValidation do
@moduledoc """
Used to create a schema to validate input data against.
## Example
```
iex> alias DryValidation.Types
...>
iex> schema = DryValidation.schema do
...> required :name, Types.String
...> optional :age, Types.Integer
...> end
...>
iex> input_data = %{"name... | lib/dry_validation.ex | 0.93108 | 0.828766 | dry_validation.ex | starcoder |
defmodule AshGraphql.Resource do
alias Ash.Dsl.Extension
alias Ash.Query.Aggregate
alias AshGraphql.Resource
alias AshGraphql.Resource.{Mutation, Query}
@get %Ash.Dsl.Entity{
name: :get,
args: [:name, :action],
describe: "A query to fetch a record by primary key",
examples: [
"get :get_... | lib/resource/resource.ex | 0.745398 | 0.491273 | resource.ex | starcoder |
defmodule Paginator.Ecto.Query do
@moduledoc false
import Ecto.Query
alias Paginator.Config
alias Paginator.Ecto.Query.DynamicFilterBuilder
def paginate(queryable, config \\ [])
def paginate(queryable, %Config{} = config) do
queryable
|> maybe_where(config)
|> limit(^query_limit(config))
e... | lib/paginator/ecto/query.ex | 0.760384 | 0.469338 | query.ex | starcoder |
defmodule RZstd do
@moduledoc """
`RZstd` API.
"""
alias RZstd.{Compressor, Decompressor, Handler, Native}
use Unsafe.Generator, docs: true, handler: {Handler, :unwrap}
@type compression_error ::
:binary_decode_failed
| :integer_decode_failed
| :compression_failed
... | lib/r_zstd.ex | 0.84599 | 0.511351 | r_zstd.ex | starcoder |
defmodule Wavexfront do
@moduledoc """
This guide provide the necessary to configure and use the Wavexfront and start monitoring your application
## Configuration
The ```:wavexfront``` application needs to be configured properly in order to work.
This configuration can be done, for example, in ```config/con... | lib/wavexfront.ex | 0.843863 | 0.938857 | wavexfront.ex | starcoder |
defmodule ExActor.Operations do
@moduledoc """
Macros that can be used for simpler definition of `gen_server` operations
such as casts or calls.
"""
@doc """
Defines the initializer callback.
Examples:
# ignoring the input argument
definit do: HashSet.new
# using the input argument
... | lib/exactor/operations.ex | 0.670716 | 0.461927 | operations.ex | starcoder |
defmodule EWallet.Web.SearchParser do
@moduledoc """
This module allows parsing of arbitrary attributes into a search query.
It takes in a request's attributes, parses only the attributes needed for searching,
then builds those attributes into a search query on top of the given `Ecto.Queryable`.
"""
import ... | apps/ewallet/lib/ewallet/web/search_parser.ex | 0.794624 | 0.568176 | search_parser.ex | starcoder |
defmodule Memento.Capture.Handler do
@moduledoc """
The `Memento.Capture.Handler` behaviour can be used
to implement a handler that knows how to authorize
and fetch data from a specific source.
A handler has an implicit lifecycle: authorization,
refresh and processing of new data.
This lifecycle is impl... | lib/memento/capture/handler.ex | 0.84994 | 0.50769 | handler.ex | starcoder |
import Ecto.Query, only: [from: 2, join: 4, distinct: 3, select: 3]
defmodule Ecto.Associations do
@moduledoc """
Documents the functions required for associations to implement
in order to work with Ecto query mechanism.
This module contains documentation for those interested in
understanding how Ecto assoc... | lib/ecto/associations.ex | 0.860208 | 0.481393 | associations.ex | starcoder |
defmodule AMQP.Basic do
@moduledoc """
Functions to publish, consume and acknowledge messages.
"""
import AMQP.Core
alias AMQP.{Channel, Utils}
@type error :: {:error, reason :: :blocked | :closing}
@doc """
Publishes a message to an Exchange.
This method publishes a message to a specific exchange... | lib/amqp/basic.ex | 0.9255 | 0.564519 | basic.ex | starcoder |
defmodule Ecto.Adapters.Postgres do
@moduledoc """
Adapter module for PostgreSQL.
It uses `postgrex` for communicating to the database
and a connection pool, such as `poolboy`.
## Features
* Full query support (including joins, preloads and associations)
* Support for transactions
* Support for... | deps/ecto/lib/ecto/adapters/postgres.ex | 0.813164 | 0.550426 | postgres.ex | starcoder |
defmodule Chopperbot.Split.OptionTransformer do
@percentage_pattern ~r/^(\+|-)(\d+|\d+[.]\d+)(%)$/
@doc """
Transform options to a multiplier.
## Examples
iex> transform(["+vat"])
{:ok, 1.07}
iex> transform(["+s", "+v"])
{:ok, 1.177}
iex> transform(["-20%"])
{:ok, 0.8}
... | lib/chopperbot/split/parser/option_transformer.ex | 0.726231 | 0.42179 | option_transformer.ex | starcoder |
defmodule Galena.Consumer do
@moduledoc """
**Galena.Consumer** is a customized `GenStage` producer which is able to receive _some_ messages
from _some_ producers or producers-consumers. The consumer will have the possibility to be subscribed
to the chosen topics from the chosen producers.
### Definition
... | lib/galena/consumer.ex | 0.719186 | 0.806243 | consumer.ex | starcoder |
defmodule Holidays.DateCalculator.DateMath do
@doc """
Adds the given number of `days` to the given `date`.
## Examples
iex> Holidays.DateCalculator.DateMath.add_days({2015, 12, 31}, 1)
{2016, 1, 1}
iex> Holidays.DateCalculator.DateMath.add_days({2016, 1, 6}, -12)
{2015, 12, 25}
"""... | lib/holidays/date_calculator/date_math.ex | 0.887285 | 0.682706 | date_math.ex | starcoder |
defmodule Ockam.Workers.RemoteForwarder do
@moduledoc """
Ockam worker to handle forwarding from the Ockam Hub forwarding service `Ockam.Hub.Service.Forwarding`
On start creates a hub forwarder in the forwarding service.
Forwards messages from the hub forwarder to configured route.
Options:
`service_rout... | implementations/elixir/ockam/ockam/lib/ockam/workers/remote_forwarder.ex | 0.912392 | 0.547767 | remote_forwarder.ex | starcoder |
defmodule Wallaby.Feature do
@moduledoc """
Helpers for writing features.
You can `use` or `import` this module.
## use Wallaby.Feature
Calling this module with `use` will automatically call `use Wallaby.DSL`.
When called with `use` and you are using Ecto, please configure your `otp_app`.
```
confi... | lib/wallaby/feature.ex | 0.784773 | 0.783782 | feature.ex | starcoder |
defmodule DataQuacker.Adapter do
@moduledoc ~S"""
Specifies the behaviour to which adapters must conform.
An adapter must implement these functions: `parse_source/2`, `get_headers/1`, `get_rows/1`, `get_row/1`.
The first one takes a source (e.g. a file path) and a keyword list of options,
and returns a tupl... | lib/data_quacker/adapter.ex | 0.893783 | 0.863507 | adapter.ex | starcoder |
defmodule Tipalti.IFrame.SetupProcess do
@moduledoc """
Generate URLs for the Tipalti Setup Process iFrame.
"""
import Tipalti.IFrame, only: [build_url: 3]
@type flaggable_fields ::
:country
| :first
| :middle
| :last
| :company
| :street1
... | lib/tipalti/iframe/setup_process.ex | 0.738763 | 0.467271 | setup_process.ex | starcoder |
defmodule Joken.Signer do
@moduledoc """
Interface between Joken and JOSE for signing and verifying tokens.
In the future we plan to keep this interface but make it pluggable for other crypto
implementations like using only standard `:crypto` and `:public_key` modules. So,
**avoid** depending on the inner st... | lib/joken/signer.ex | 0.866683 | 0.57075 | signer.ex | starcoder |
defmodule Margaret.Helpers.Connection do
@moduledoc """
Helper functions for working with pagination connections.
See https://facebook.github.io/relay/graphql/connections.html
for more information.
"""
alias Absinthe.Relay
alias Margaret.{Repo, Helpers}
@doc """
Returns a pagination connection fro... | projects/api/lib/margaret/helpers/connection.ex | 0.833833 | 0.403508 | connection.ex | starcoder |
defmodule Kino.Control do
@moduledoc """
Various widgets for user interactions.
Each widget is a UI control element that the user interacts
with, consequenty producing an event stream.
Those widgets are often useful paired with `Kino.Frame` for
presenting content that changes upon user interactions.
##... | lib/kino/control.ex | 0.932894 | 0.521288 | control.ex | starcoder |
defmodule SPARQL.Algebra.Construct do
defstruct [:template, :query]
alias SPARQL.Algebra.Expression
alias RDF.BlankNode
def result(%SPARQL.Query.Result{results: results}, template, generator, prefixes) do
template_bnodes = template_bnodes(template)
prefixes = if Enum.empty?((prefixes)), do: nil, else:... | lib/sparql/algebra/expression/construct.ex | 0.514644 | 0.590248 | construct.ex | starcoder |
defmodule Bolt.Cogs.ForceNick do
@moduledoc false
@behaviour Nosedrum.Command
alias Bolt.Events.Handler
alias Bolt.Schema.Infraction
alias Bolt.{Converters, ErrorFormatters}
alias Bolt.{Helpers, ModLog, Parsers, Repo}
alias Nosedrum.Predicates
alias Nostrum.Api
alias Nostrum.Struct.User
require Log... | lib/bolt/cogs/forcenick.ex | 0.79049 | 0.472927 | forcenick.ex | starcoder |
defmodule Beamchmark.Formatters.HTML do
@moduledoc """
The module formats `#{inspect(Beamchmark.Suite)}` and outputs it to an HTML file.
"""
@behaviour Beamchmark.Formatter
alias __MODULE__.Templates
alias Beamchmark.Suite
alias Beamchmark.Utils
@default_output_path "index.html"
@default_auto_open ... | lib/beamchmark/formatters/html.ex | 0.784732 | 0.407805 | html.ex | starcoder |
defmodule Axon.Recurrent do
@moduledoc """
Functional implementations of common recurrent neural network
routines.
Recurrent Neural Networks are commonly used for working with
sequences of data where there is some level of dependence between
outputs at different timesteps.
This module contains 3 RNN Cel... | lib/axon/recurrent.ex | 0.907916 | 0.829146 | recurrent.ex | starcoder |
defmodule KVX.Bucket do
@moduledoc """
Defines a Bucket.
A bucket maps to an underlying data store, controlled by the
adapter. For example, `KVX` ships with a `KVX.Bucket.ExShards`
adapter that stores data into `ExShards` distributed memory
storage – [ExShards](https://github.com/cabol/ex_shards).
For e... | lib/kvx/bucket.ex | 0.92058 | 0.512693 | bucket.ex | starcoder |
defmodule Maxwell.Adapter.Util do
@moduledoc """
Utils for Adapter
"""
@chunk_size 4 * 1024 * 1024
alias Maxwell.{Conn, Multipart, Query}
@doc """
Append path and query string to url
* `url` - `conn.url`
* `path` - `conn.path`
* `query` - `conn.query`
* `type` - `:char_list` or `:string`, d... | lib/maxwell/adapter/util.ex | 0.810704 | 0.413122 | util.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.