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 Shipping.Repo do
# use Ecto.Repo, otp_app: :shipping
@moduledoc """
Normally the Repo module is responsible for the data storage and retrieval to
and from a database system. See the commented out code above.
However, Stage 1 of the Shipping example does not
use a database. Instead, data is handle... | apps/shipping/lib/shipping/repo.ex | 0.71423 | 0.464416 | repo.ex | starcoder |
defmodule SMPPEX.MC do
@moduledoc """
This is a module for launching a TCP listener (or any other listener supported by `ranch`, for example, `ssl`) which handles incoming connections with the passed `SMPPEX.Session` implementations.
To start an MC one generally should do the following.
1. Implement an `SMPPE... | lib/smppex/mc.ex | 0.879458 | 0.850189 | mc.ex | starcoder |
defmodule CairoEx.Context do
@moduledoc """
Context is the main module used for drawing.
"""
alias CairoEx.{
CairoPort,
Matrix,
Ref
}
@doc """
Create a new context from a surface
"""
@spec create(surface :: Ref.t()) ::
{:ok, Ref.t()} | {:error, CairoEx.error_reason()}
def cre... | lib/cairo_ex/context.ex | 0.912876 | 0.597344 | context.ex | starcoder |
defmodule Grizzly.ZWave.Commands.CentralSceneNotification do
@moduledoc """
This command is used to advertise a scene key event.
Versions 1 and 2 are obsolete.
Params:
* `:seq_number` - The receiving device uses the sequence number to ignore duplicates. (required)
* `:slow_refresh` - This flag is us... | lib/grizzly/zwave/commands/central_scene_notification.ex | 0.882282 | 0.423607 | central_scene_notification.ex | starcoder |
defmodule ExForce do
@moduledoc """
Simple wrapper for Salesforce REST API.
## Usage
```elixir
{:ok, %{instance_url: instance_url} = oauth_response} =
ExForce.OAuth.get_token(
"https://login.salesforce.com",
grant_type: "password",
client_id: "client_id",
client_secret: "client_s... | lib/ex_force.ex | 0.757436 | 0.548432 | ex_force.ex | starcoder |
defmodule Cbuf.ETS do
@moduledoc """
`Cbuf.ETS` implements the `Cbuf` behaviour with an ETS table as its implementation.
For examples of typical use, see the documentation for `new/1`, `insert/2`, `peek/1`, and `delete/1`.
Each new buffer creates and owns a new ETS table.
Operations that must interact with... | lib/cbuf/ets.ex | 0.854733 | 0.764848 | ets.ex | starcoder |
defmodule Absinthe.Phase.Document.Arguments.Parse do
@moduledoc false
# Parses Leaf Node inputs
alias Absinthe.Blueprint.Input
alias Absinthe.{Blueprint, Type}
use Absinthe.Phase
def run(input, options \\ []) do
result = Blueprint.prewalk(input, &handle_node(&1, options[:context] || %{}))
{:ok, r... | lib/absinthe/phase/document/arguments/parse.ex | 0.7586 | 0.413063 | parse.ex | starcoder |
defprotocol Type.Properties do
@spec usable_as(Type.t, Type.t, keyword) :: Type.ternary
def usable_as(subject, target, meta)
@spec subtype?(Type.t, Type.t) :: boolean
def subtype?(subject, target)
@spec compare(Type.t, Type.t) :: :gt | :eq | :lt
def compare(a, b)
@spec typegroup(Type.t) :: Type.group
... | lib/type/_properties.ex | 0.781789 | 0.533458 | _properties.ex | starcoder |
defmodule Animu.Media.Anime.Options do
@moduledoc """
Parses Anime options
"""
use Animu.Ecto.Schema
alias Animu.Media.Anime
alias __MODULE__
defmodule Numbers do
@behaviour Ecto.Type
def type, do: {:array, :float}
defguard is_integers(from, to)
when is_integer(from) and is_integer(to... | lib/animu/media/anime/options.ex | 0.741487 | 0.455138 | options.ex | starcoder |
defmodule Crawly.Manager do
@moduledoc """
Crawler manager module
This module is responsible for spawning all processes related to
a given Crawler.
The manager spawns the following processes tree.
┌────────────────┐ ┌───────────────────┐
│ Crawly.Manager ├────────> Crawly.ManagerSup │
└────────... | lib/crawly/manager.ex | 0.73914 | 0.479138 | manager.ex | starcoder |
defmodule Contex.CategoryColourScale do
@moduledoc """
Maps categories to colours.
The `Contex.CategoryColourScale` maps categories to a colour palette. It is used, for example, to calculate
the fill colours for `Contex.BarChart`, or to calculate the colours for series in `Contex.PointPlot`.
Internally it i... | lib/chart/scale/category_colour_scale.ex | 0.898972 | 0.908982 | category_colour_scale.ex | starcoder |
defmodule Freshcom.Filter do
@moduledoc """
[%{"$and" => [
%{"$or" => [%{"role" => "test1Test"}, %{"role" => "test2"}]},
%{"role" => "lol"},
%{"$or" => [%{"role" => "tt1"}, %{"role" => "tt2"}]}
]}]
"""
import Ecto.Query
import FCSupport.Normalization, only: [stringify_list: 1]
alias Ecto.Que... | lib/freshcom/core/filter.ex | 0.606032 | 0.471041 | filter.ex | starcoder |
defmodule Mssqlex do
@moduledoc """
Interface for interacting with MS SQL Server via an ODBC driver for Elixir.
It implements `DBConnection` behaviour, using `:odbc` to connect to the
system's ODBC driver. Requires MS SQL Server ODBC driver, see
[README](readme.html) for installation instructions.
"""
a... | lib/mssqlex.ex | 0.944434 | 0.664067 | mssqlex.ex | starcoder |
defmodule ReviewParser do
@moduledoc """
Parses the review snippets from [www.dealerrater.com](https://www.dealerrater.com) into `Model.Review` model.
"""
@doc """
Parses the review snippets from [www.dealerrater.com](https://www.dealerrater.com) into `Model.Review` model.
"""
def parse(review) do
%M... | lib/review_parser.ex | 0.664214 | 0.423577 | review_parser.ex | starcoder |
defmodule Tabular do
@moduledoc """
Tabular converts an ascii table string into either a list of lists or a list of maps.
"""
@row_splitter_re ~r/^\s*[|+]--[-+|]+$/
@doc ~S'''
Converts an ascii table to a list of maps.
## Examples
iex> ascii_table = """
...> |---------------+-------------... | lib/tabular.ex | 0.696165 | 0.510863 | tabular.ex | starcoder |
defmodule Financials do
alias Decimal, as: D
@moduledoc """
A financial modeling library for elixir. Contains functions that can be used as building blocks for complex financial modeling.
## Usage
Requests return a 2-tuple with the standard `:ok` or `:error` status.
```elixir
# Successful response
... | lib/financials.ex | 0.79909 | 0.735357 | financials.ex | starcoder |
defmodule PhoenixInlineSvg.Helpers do
@moduledoc """
This module adds view helpers for rendering SVG files into safe HTML.
To add the helpers, add the following to the quoted `view` in your `my_app_web.ex` file.
def view do
quote do
use PhoenixInlineSvg.Helpers, otp_app: :my_app
... | lib/phoenix_inline_svg/helpers.ex | 0.870101 | 0.791439 | helpers.ex | starcoder |
defmodule AWS.SageMakerFeatureStoreRuntime do
@moduledoc """
Contains all data plane API operations and data types for the Amazon SageMaker
Feature Store.
Use this API to put, delete, and retrieve (get) features from a feature store.
Use the following operations to configure your `OnlineStore` and `Offline... | lib/aws/generated/sage_maker_feature_store_runtime.ex | 0.808597 | 0.461077 | sage_maker_feature_store_runtime.ex | starcoder |
defmodule Tint.Lab do
@moduledoc """
A color in the CIELAB colorspace.
"""
@moduledoc since: "1.0.0"
import Tint.Utils.Cast
alias Tint.Distance
defstruct [:lightness, :a, :b]
@type t :: %__MODULE__{
lightness: float,
a: float,
b: float
}
@doc """
Builds a n... | lib/tint/lab.ex | 0.928749 | 0.766643 | lab.ex | starcoder |
defmodule HyperMap do
@moduledoc """
HyperMap provides a multiple-key Map.
A use case could be to store a phonebook from people and then
looking it up by either their first name or their last name without
having to do a full lookup.
"""
defstruct [
values: nil,
num_keys: nil,
opts: nil
]
... | lib/hypermap.ex | 0.891973 | 0.700588 | hypermap.ex | starcoder |
defmodule Predicator.Evaluator do
@moduledoc "Evaluator Module"
alias Predicator.{
InstructionNotCompleteError,
Machine
}
@typedoc "Error types returned from Predicator.Evaluator"
@type error_t ::
{:error,
InstructionError.t()
| ValueError.t()
| InstructionN... | lib/predicator/evaluator.ex | 0.651909 | 0.409959 | evaluator.ex | starcoder |
defmodule CFSync.Entry.Extractors do
@moduledoc """
Utility functions to extract data from contenful JSON.
"""
require Logger
alias CFSync.Link
alias CFSync.RichText
@typedoc """
Entry's payload as provided to `c:CFSync.Entry.Fields.new/1`
"""
@opaque data() :: {map, binary}
@doc """
Returns ... | lib/cf_sync/entry/extractors.ex | 0.910022 | 0.574066 | extractors.ex | starcoder |
defmodule VML do
@moduledoc """
Parse VML text strings
"""
require Logger
@doc """
Parse, raise on errors
"""
def parse!(string) do
case parse(string) do
{:ok, ast} ->
ast
{:error, _type, error} ->
raise error
end
end
@doc """
Parse a string into an AST for ... | lib/vml.ex | 0.749271 | 0.514888 | vml.ex | starcoder |
defmodule Rtmp.Handshake.OldHandshakeFormat do
@moduledoc """
Functions to parse and validate RTMP handshakes as specified in the
official RTMP specification.
This handshake format does *NOT* work for h.264 video.
"""
@behaviour Rtmp.Handshake
require Logger
@type state :: %__MODULE__.State{}
def... | apps/rtmp/lib/rtmp/handshake/old_handshake_format.ex | 0.666388 | 0.456591 | old_handshake_format.ex | starcoder |
defmodule SieveOfEratosthenes do
@moduledoc """
Documentation for `SieveOfEratosthenes`.
Implementation of sieve of eratosthenes algorithm to calculate all the prime numbers
until number given used as limit, using tail recursive optimization and async functions
"""
@doc """
Calculate all the prime... | lib/sieve_of_eratosthenes.ex | 0.90712 | 0.662297 | sieve_of_eratosthenes.ex | starcoder |
defmodule ApiAccounts.Changeset do
@moduledoc """
Assists in creating and updating records by applying rules to changes in data.
"""
alias ApiAccounts.Changeset
@type t :: %__MODULE__{}
defstruct source: nil,
data: %{},
changes: %{},
params: %{},
errors: %{... | apps/api_accounts/lib/api_accounts/changeset.ex | 0.881577 | 0.409634 | changeset.ex | starcoder |
defmodule AWS.Inspector do
@moduledoc """
Amazon Inspector
Amazon Inspector enables you to analyze the behavior of your AWS resources
and to identify potential security issues. For more information, see [
Amazon Inspector User
Guide](https://docs.aws.amazon.com/inspector/latest/userguide/inspector_introdu... | lib/aws/inspector.ex | 0.855474 | 0.528229 | inspector.ex | starcoder |
defmodule Raxx.Middleware do
alias Raxx.Server
@moduledoc """
A "middleware" is a component that sits between the HTTP server
such as as [Ace](https://github.com/CrowdHailer/Ace) and a `Raxx.Server` controller.
The middleware can modify requests request before giving it to the controller and
modify the con... | lib/raxx/middleware.ex | 0.92243 | 0.562207 | middleware.ex | starcoder |
defmodule ETS do
use ETS.Utils
@moduledoc """
ETS, an Elixir wrapper for Erlang's [`:ets`](http://erlang.org/doc/man/ets.html) module.
See `ETS.Set` for information on creating and managing Sets, and `ETS.Bag` for information on creating and managing Bags.
See `ETS.KeyValueSet` for an abstraction which pro... | lib/ets.ex | 0.893336 | 0.562537 | ets.ex | starcoder |
defmodule Alchemy.Cache do
@moduledoc """
This module provides a handful of useful functions to interact with the cache.
By default, Alchemy caches a great deal of information given to it, notably about
guilds. In general, using the cache should be prioritised over using the api
functions in `Alchemy.Client`... | lib/cache.ex | 0.846657 | 0.64526 | cache.ex | starcoder |
defmodule Cldr.String do
@moduledoc """
Functions that operate on a `String.t` that are not provided
in the standard lib.
"""
@doc """
Hash a string using a polynomial rolling hash function.
See https://cp-algorithms.com/string/string-hashing.html for
a description of the algoithim.
"""
@p 99991... | lib/cldr/utils/string.ex | 0.779028 | 0.42656 | string.ex | starcoder |
defmodule APIacFilterIPWhitelist do
@behaviour Plug
@behaviour APIac.Filter
@moduledoc """
An `APIac.Filter` plug enabling IP whitelist (IPv4 & IPv6)
## Plug options
- `whitelist`: a *list* of allowed IPv4 and IPv6 addresses in CIDR notation or a
`(Plug.Conn.t -> [String])` function returning that list... | lib/apiac_filter_ip_whitelist.ex | 0.84905 | 0.784154 | apiac_filter_ip_whitelist.ex | starcoder |
defmodule Alchemy.Cogs do
alias Alchemy.Cache
alias Alchemy.Cogs.CommandHandler
alias Alchemy.Cogs.EventRegistry
alias Alchemy.Events
alias Alchemy.Guild
require Logger
@moduledoc """
This module provides quite a bit of sugar for registering commands.
To use the macros in this module, it must be `use... | lib/cogs.ex | 0.784154 | 0.840488 | cogs.ex | starcoder |
defmodule Ueberauth.Strategy.Procore do
@moduledoc """
Implements an ÜeberauthProcore strategy for authentication with procore.com.
When configuring the strategy in the Üeberauth providers, you can specify some defaults.
* `oauth2_module` - The OAuth2 module to use. Default Ueberauth.Strategy.Procore.OAuth
... | lib/ueberauth/strategy/procore.ex | 0.725649 | 0.421284 | procore.ex | starcoder |
defmodule Valvex do
@moduledoc """
Valvex is a simple wrapper for the Steam ReST Api
Before making calls be sure to initialize the client with your Api key provided
by Steam. Check `start_link/0` for more details.
Every single one of the user ids specified here are 64-bit Steam ids.
"""
alias Valvex.Ap... | lib/valvex.ex | 0.863651 | 0.835886 | valvex.ex | starcoder |
defmodule Sanbase.Cryptocompare.HistoricalScheduler do
@moduledoc ~s"""
Scrape the prices from Cryptocompare websocket API
https://min-api.cryptocompare.com/documentation/websockets
Use the cryptocompare API to fetch prices aggregated across many exchanges
in near-realtime. For every base/quote asset pairs f... | lib/sanbase/cryptocompare/historical_scheduler.ex | 0.712932 | 0.481454 | historical_scheduler.ex | starcoder |
defmodule Gim do
@moduledoc """
#{Gim.MixProject.project()[:description]}
## Usage
Add Gim to your application by adding `{:gim, "~> #{Mix.Project.config()[:version]}"}` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
# ...
{:gim, "~> #{Mix.Project.config()[:version]}"}
... | lib/gim.ex | 0.651687 | 0.523725 | gim.ex | starcoder |
defmodule AWS.Imagebuilder do
@moduledoc """
EC2 Image Builder is a fully managed AWS service that makes it easier to
automate the creation, management, and deployment of customized, secure,
and up-to-date “golden” server images that are pre-installed and
pre-configured with software and settings to meet spe... | lib/aws/generated/imagebuilder.ex | 0.737158 | 0.442275 | imagebuilder.ex | starcoder |
defmodule Iteraptor.Iteraptable do
@moduledoc """
`use Iteraptor.Iteraptable` inside structs to make them both
[`Enumerable`](http://elixir-lang.org/docs/stable/elixir/Enumerable.html) and
[`Collectable`](http://elixir-lang.org/docs/stable/elixir/Collectable.html) and
implement the [`Access`](https://hexdocs.... | lib/iteraptor/iteraptable.ex | 0.883506 | 0.55254 | iteraptable.ex | starcoder |
defmodule Aoc.Day10 do
@moduledoc false
import Aoc.Utils
def run(1), do: solve1(get_input(10))
def run(2), do: solve2(get_input(10))
def solve1(input) do
input
|> read_instructions
|> zooming_around()
:ets.delete(:instructions)
end
def read_instructions(t) do
:ets.new(:instruction... | lib/aoc/day10.ex | 0.598547 | 0.504516 | day10.ex | starcoder |
defmodule ICouch.View do
@moduledoc """
Module to handle views in CouchDB.
View structs should not be created or manipulated directly, please use
`ICouch.open_view/3` or `ICouch.open_view!/3`.
The view struct implements the enumerable protocol for easy handling with
Elixir's `Enum` module.
A view can ... | lib/icouch/view.ex | 0.860721 | 0.457985 | view.ex | starcoder |
defmodule DemonSpiritGame.Card do
@moduledoc """
Provides a structure to hold a card containing moves that
a player may use. Also contains a hardcoded list of all cards.
id: Hardcoded integer.
name: String, name of card.
moves: List of {int, int} tuples, representing moves.
{1, 1} is the ability to mo... | apps/demon_spirit_game/lib/demon_spirit_game/card.ex | 0.705988 | 0.475544 | card.ex | starcoder |
defmodule OpenMovieApi.DbSetup do
@moduledoc """
Provides functionalities needed to setup movie database in mnesia
:mnesia setup process includes
stopping available :mnesia applications
creating schema
creating tables
starting mnesia
"""
require Logger
@basics_table [:tconst,... | lib/open_movie_api/db_setup.ex | 0.659295 | 0.563318 | db_setup.ex | starcoder |
defmodule Insights.Adapter do
@moduledoc """
This module specifies the adapter API that an adapter is required to
implement.
"""
use Behaviour
@type t :: module
@type source :: {table :: binary, model :: atom}
@typep adapter :: Insights.Server.t
@typep collection :: String.t
@typep query ... | lib/insights/adapter.ex | 0.912163 | 0.614871 | adapter.ex | starcoder |
defmodule Descisionex.AnalyticHierarchy do
@moduledoc """
https://en.wikipedia.org/wiki/Analytic_hierarchy_process
"""
alias Descisionex.{AnalyticHierarchy, Helper}
defstruct comparison_matrix: [],
normalized_comparison_matrix: [],
criteria_weights: [],
criteria_num: 0,
... | lib/algorithms/analytic_hierarchy.ex | 0.909742 | 0.558809 | analytic_hierarchy.ex | starcoder |
defmodule BSV.Crypto.Hash do
@moduledoc """
A collection of one-way hashing functions.
"""
alias BSV.Util
@hash_algorithms [:md5, :ripemd160, :sha, :sha224, :sha256, :sha384, :sha512]
@doc """
Returns a list of supported hash algorithms.
"""
@spec hash_algorithms :: list
def hash_algorithms, do: ... | lib/bsv/crypto/hash.ex | 0.856498 | 0.629547 | hash.ex | starcoder |
defmodule K8s.Conn.Config do
@moduledoc """
Add runtime cluster configuration with environment variables.
Each variable consists of a prefix that determines where the value will be placed in the config
and a suffix that is the cluster name. The cluster name will be atomized.
Environment Variable Prefixes:
... | lib/k8s/conn/config.ex | 0.848753 | 0.530784 | config.ex | starcoder |
defmodule Conform.Schema.Validator do
@moduledoc """
This module defines the behaviour for custom validators.
Validators can be defined inline in which case this behaviour need not be used,
but if you want to define reusable validators which you can reference in your
schema, you should implement this behavio... | lib/conform/schema/validator.ex | 0.889999 | 0.505493 | validator.ex | starcoder |
defmodule Scenic.Assets.Stream.Bitmap do
@moduledoc """
This module helps you to prepare images, in the form of a bitmap, that are to be streamed
and displayed through the `Scenic.Assets.Stream` module.
A bitmap is a rectangular field of pixels. Each pixel can be addressed and assigned a color.
When the bit... | lib/scenic/assets/stream/bitmap.ex | 0.937243 | 0.910027 | bitmap.ex | starcoder |
defmodule NzIrValidator do
@moduledoc """
Documentation for NzIrValidator.
"""
@length 8
@primary_weighting [ 3, 2, 7, 6, 5, 4, 3, 2 ]
@secondary_weighting [ 7, 4, 3, 2, 5, 2, 7, 6 ]
@modulus 11
@doc """
Validate the provided IR number.
## Examples
iex> NzIrValidator.is_valid?(49091850)
... | lib/nz_ir_validator.ex | 0.857738 | 0.451206 | nz_ir_validator.ex | starcoder |
defmodule ParkingTweets.GarageMap do
@moduledoc """
Responsible for maintaing a map of garages and and their current state.
"""
alias ParkingTweets.{Garage, IdMapSet}
defstruct garages: IdMapSet.new(&Garage.id/1),
alternates: %{},
facility_to_stop_id: %{},
stop_id_to_stop_... | lib/parking_tweets/garage_map.ex | 0.70791 | 0.408601 | garage_map.ex | starcoder |
defmodule GitDiff do
@moduledoc """
A simple implementation for taking the output from 'git diff' and transforming it into Elixir structs.
## Installation
The package can be installed by adding `git_diff` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:git_diff, "~> 0.6.1"}... | lib/git_diff.ex | 0.845863 | 0.862815 | git_diff.ex | starcoder |
defmodule DgraphEx.Changeset do
alias DgraphEx.Changeset, as: Cs
alias DgraphEx.{Field, Vertex, Types, Util}
defstruct [
module: nil,
model: nil,
changes: nil,
errors: nil,
]
@doc """
In `cast/3` we do 3 things:
1) We ensure only changes to allowed fields "get through" b... | lib/dgraph_ex/changeset.ex | 0.750827 | 0.438605 | changeset.ex | starcoder |
defmodule Google.Bigtable.Admin.V2.CreateTableRequest do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
parent: String.t(),
table_id: String.t(),
table: Google.Bigtable.Admin.V2.Table.t(),
initial_splits: [Google.Bigtable.Admin.V2.CreateTableRequest... | lib/grpc/admin/bigtable_table_admin.pb.ex | 0.714628 | 0.491334 | bigtable_table_admin.pb.ex | starcoder |
defmodule Cobs do
@moduledoc """
Elixir implementation of [Consistent Overhead Byte Stuffing](https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing)
"""
@doc """
Encode a binary (with `0` bytes) into a COBS encoded binary (without `0` bytes).
## Example
iex> Cobs.encode(<<0x01, 0x02, 0x00,... | lib/cobs.ex | 0.897635 | 0.671072 | cobs.ex | starcoder |
defmodule Scrip.Response do
defmodule Error do
@moduledoc """
Module dealing with error responses from the App Store
"""
@type t :: %__MODULE__{
environment: :sandbox | :production | nil,
message: String.t(),
status: integer
}
@doc """
The `#{__MO... | lib/scrip/response.ex | 0.782288 | 0.470128 | response.ex | starcoder |
defmodule MeshxConsul.Service.Endpoint do
@moduledoc """
Consul agent http API endpoint.
`MeshxConsul` is using OTP [`:httpc`](http://erlang.org/doc/man/httpc.html) HTTP client to access Consul agent HTTP API endpoint when managing services and upstreams. Required by `:httpc` configuration is described in `Meshx... | lib/service/endpoint.ex | 0.864468 | 0.679332 | endpoint.ex | starcoder |
defmodule Day07 do
@moduledoc """
AoC 2017, Day 7 - Amplification Circuit
"""
@doc """
Find largest output signal that can be sent to thrusters
"""
def part1 do
Util.priv_file(:day07, "day7_input.txt")
|> Intcode.load()
|> max_thrust(0..4)
end
@doc """
Find largest output signal that c... | apps/day07/lib/day07.ex | 0.708717 | 0.409457 | day07.ex | starcoder |
defmodule AdaptableCostsEvaluatorWeb.OutputController do
use AdaptableCostsEvaluatorWeb, :controller
use OpenApiSpex.ControllerSpecs
import AdaptableCostsEvaluatorWeb.Helpers.AuthHelper, only: [current_user: 1]
alias AdaptableCostsEvaluator.{Outputs, Computations}
alias AdaptableCostsEvaluator.Outputs.Outpu... | lib/adaptable_costs_evaluator_web/controllers/output_controller.ex | 0.731538 | 0.406567 | output_controller.ex | starcoder |
defmodule Day7 do
@moduledoc """
--- Day 7: Recursive Circus ---
Wandering further through the circuits of the computer, you come upon a tower of programs that have gotten themselves
into a bit of trouble. A recursive algorithm has gotten out of hand, and now they're balanced precariously in a large
tower.
... | lib/day7.ex | 0.720663 | 0.757682 | day7.ex | starcoder |
defmodule Grax.Id.Schema do
alias Grax.Id.Namespace
alias Grax.Id.Schema.Extension
@type template :: struct
@type t :: %__MODULE__{
namespace: Namespace.t(),
template: template | :bnode,
schema: module | [module],
selector: {module, atom} | nil,
counter: {modul... | lib/grax/id/schema.ex | 0.669205 | 0.426202 | schema.ex | starcoder |
defmodule Grakn do
@moduledoc """
The main entry point for interacting with Grakn. All functions take a
connection reference.
"""
@behaviour Multix.OnFailure
@typedoc """
A connection process name, pid or reference.
A connection reference is used when making multiple requests within a
transaction, s... | lib/grakn.ex | 0.933862 | 0.648452 | grakn.ex | starcoder |
defmodule KeyboardLayout do
@moduledoc """
Describes a keyboard layout.
The layout can be created dynamically, or it can be predefined in the `Config`
for the application.
Example of a layout defined in `Config`:
import Config
config :keyboard_layout,
layout: [
leds: [
... | lib/keyboard_layout.ex | 0.873835 | 0.54958 | keyboard_layout.ex | starcoder |
defmodule RDF.Quad do
@moduledoc """
Helper functions for RDF quads.
A RDF Quad is represented as a plain Elixir tuple consisting of four valid
RDF values for subject, predicate, object and a graph context.
"""
alias RDF.Statement
@type t :: {Statement.subject, Statement.predicate, Statement.object, St... | lib/rdf/quad.ex | 0.874419 | 0.68223 | quad.ex | starcoder |
defmodule TicTacToe do
@moduledoc """
Documentation for `TicTacToe`.
"""
alias TicTacToe.Board, as: Board
alias TicTacToe.Opponent, as: Opponent
alias Mix.Shell.IO, as: Shell
@doc """
This defines the entry point of functions and data structures needed to play
a game of tic-tac-toe in the terminal.
... | tic_tac_toe/lib/tic_tac_toe.ex | 0.704364 | 0.602032 | tic_tac_toe.ex | starcoder |
defmodule Postgrex.Interval do
@moduledoc """
Struct for PostgreSQL `interval`.
## Fields
* `months`
* `days`
* `secs`
* `microsecs`
"""
@type t :: %__MODULE__{months: integer, days: integer, secs: integer, microsecs: integer}
defstruct months: 0, days: 0, secs: 0, microsecs: 0
def c... | lib/postgrex/builtins.ex | 0.900162 | 0.609117 | builtins.ex | starcoder |
defmodule Flowex.PipelineBuilder do
@moduledoc "Defines functions to start and to stop a pipeline"
import Supervisor.Spec
def start(pipeline_module, opts) do
{producer_name, consumer_name, all_specs} = build_children(pipeline_module, opts)
sup_name = supervisor_name(pipeline_module)
{:ok, _sup_pid}... | lib/flowex/pipeline_builder.ex | 0.558086 | 0.425098 | pipeline_builder.ex | starcoder |
defmodule Booklist.Reports do
@moduledoc """
The Reports context.
"""
import Ecto.Query, warn: false
alias Booklist.Repo
alias Booklist.Admin.Rating
alias Booklist.Admin.Genre
alias Booklist.Admin.Author
def increment(num) do
num + 1
end
def calculate_percent_of_ratings(total, ratings_coun... | apps/booklist/lib/booklist/admin/reports.ex | 0.756268 | 0.448547 | reports.ex | starcoder |
defmodule Nabo.Repo do
@moduledoc """
Precompiles and provides interface to interact with your posts.
defmodule MyRepo do
use Nabo.Repo, root: "priv/posts"
end
posts = MyRepo.all
{:ok, post} = MyRepo.get("foo")
post = MyRepo.get!("foo")
Can be configured with:
```
def... | lib/nabo/repo.ex | 0.818882 | 0.68763 | repo.ex | starcoder |
defmodule Microformats2.Items.DtProp do
@moduledoc false
import Microformats2.Helpers
alias Microformats2.Helpers.DateTimeNormalizer
alias Microformats2.ParserState
defp parse_infos_from_state(state) do
%{
date_parts: state.dates,
implied_timezone: state.implied_timezone,
value: nil,
... | lib/items/dt_prop.ex | 0.581778 | 0.414247 | dt_prop.ex | starcoder |
defmodule Timex.Timezone do
@moduledoc """
This module is used for looking up the timezone information for
a given point in time, in the desired zone. Timezones are dependent
not only on locale, but the date and time for which you are querying.
For instance, the timezone offset from UTC for `Europe/Moscow` is... | lib/timezone/timezone.ex | 0.88729 | 0.591399 | timezone.ex | starcoder |
defmodule Artheon.Artwork do
use Artheon.Web, :model
schema "artworks" do
field :uid, :string
field :slug, :string
field :title, :string
field :category, :string
field :medium, :string
field :created_at, Ecto.DateTime
field :updated_at, Ecto.DateTime
field :date, Ecto.Date
field... | web/models/artwork.ex | 0.517327 | 0.413981 | artwork.ex | starcoder |
defmodule ExOauth2Provider.Authorization.Code do
@moduledoc """
Methods for authorization code flow.
The flow consists of three method calls:
1. `preauthorize(resource_owner, request)`
This validates the request. If a resource owner already have been
authenticated previously it'll respond with a redirect... | lib/ex_oauth2_provider/oauth2/authorization/strategy/code.ex | 0.900836 | 0.707607 | code.ex | starcoder |
defmodule Sass do
@moduledoc """
Compiles SASS into CSS using a NIF for Libsass
## Currently supported Sass options
* [output_style](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style) Use the helpers below to assign the style
* precision `integer` - decimal rounding percision
* sour... | lib/sass.ex | 0.803637 | 0.436142 | sass.ex | starcoder |
defmodule Ash.Resource.Calculation do
@moduledoc "Represents a named calculation on a resource"
defstruct [:name, :type, :calculation, :arguments, :description, :private?, :allow_nil?]
@schema [
name: [
type: :atom,
required: true,
doc: "The field name to use for the calculation value"
... | lib/ash/resource/calculation/calculation.ex | 0.829871 | 0.553626 | calculation.ex | starcoder |
defmodule ExUnit.Diff do
@moduledoc false
@doc """
Returns an edit script representing the difference between `left` and `right`.
Returns `nil` if they are not the same data type,
or if the given data type is not supported.
"""
def script(left, right)
def script(term, term)
when is_binary(term)... | lib/ex_unit/lib/ex_unit/diff.ex | 0.78785 | 0.567937 | diff.ex | starcoder |
defmodule Cloak.Ciphers.AES.GCM do
@moduledoc """
A `Cloak.Cipher` which encrypts values with the AES cipher in GCM (block) mode.
Internally relies on Erlang's `:crypto.block_encrypt/4`.
"""
@behaviour Cloak.Cipher
@aad "AES256GCM"
@default_iv_length 16
alias Cloak.Tags.Encoder
alias Cloak.Tags.Deco... | lib/cloak/ciphers/aes_gcm.ex | 0.836388 | 0.520862 | aes_gcm.ex | starcoder |
defmodule JSONAPI.Serializer do
@moduledoc """
Serialize a map of data into a properly formatted JSON API response object
"""
import JSONAPI.Ecto, only: [assoc_loaded?: 1]
alias JSONAPI.{Config, Utils}
alias Utils.String, as: JString
require Logger
@typep serialized_doc :: map()
@doc """
Takes ... | lib/jsonapi/serializer.ex | 0.817101 | 0.434941 | serializer.ex | starcoder |
defmodule Membrane.Core.Element.DemandController do
@moduledoc false
# Module handling demands incoming through output pads.
use Bunch
alias Membrane.Core.{CallbackHandler, Message}
alias Membrane.Core.Child.PadModel
alias Membrane.Core.Element.{ActionHandler, State, Toilet}
alias Membrane.Element.Call... | lib/membrane/core/element/demand_controller.ex | 0.722918 | 0.541954 | demand_controller.ex | starcoder |
defmodule Sanbase.Alert.Trigger.SignalTriggerSettings do
@moduledoc ~s"""
An alert based on the ClickHouse signals.
The signal we're following is configured via the 'signal' parameter
"""
use Vex.Struct
import Sanbase.{Validation, Alert.Validation}
import Sanbase.DateTimeUtils, only: [round_datetime: 1... | lib/sanbase/alerts/trigger/settings/signal_trigger_settings.ex | 0.700792 | 0.412205 | signal_trigger_settings.ex | starcoder |
defmodule StepFlow.WorkflowView do
use StepFlow, :view
alias StepFlow.{ArtifactView, JobView, RightView, WorkflowView}
require Logger
def render("index.json", %{workflows: %{data: workflows, total: total}}) do
%{
data: render_many(workflows, WorkflowView, "workflow.json"),
total: total
}
... | lib/step_flow/view/workflow_view.ex | 0.598782 | 0.48987 | workflow_view.ex | starcoder |
defmodule JourneyList do
@moduledoc """
Responsible for grouping together schedules and predictions based on an origin and destination, in
a form to be used in the schedule views.
"""
alias Predictions.Prediction
alias Schedules.{Schedule, Trip}
alias PredictedSchedule.Group
defstruct journeys: [],
... | apps/site/lib/journey_list.ex | 0.849862 | 0.600071 | journey_list.ex | starcoder |
defmodule DumboOctopus.Simulation do
@moduledoc """
Implements the rules of the puzzle.
"""
@doc """
Parse puzzle input into a map of locations to energy level
"""
def parse_input(input) do
for {row, i} <- String.split(input, "\n") |> Enum.with_index(),
{number, j} <- String.trim(row) |> Stri... | day11/dumbo_octopus/lib/dumbo_octopus/simulation.ex | 0.752559 | 0.707556 | simulation.ex | starcoder |
defmodule Tarearbol do
@moduledoc """
`Tarearbol` module provides an interface to run tasks in easy way.
## Examples
iex> result = Tarearbol.ensure(fn -> raise "¡?" end, attempts: 1, raise: false)
iex> {:error, %{job: _job, outcome: outcome}} = result
iex> {error, _stacktrace} = outcome
... | lib/tarearbol.ex | 0.901652 | 0.58599 | tarearbol.ex | starcoder |
defmodule Absinthe.Middleware.Batch do
@moduledoc """
Batch the resolution of multiple fields.
## Motivation
Consider the following graphql query:
```
{
posts {
author {
name
}
}
}
```
`posts` returns a list of `post` objects, which has an associated `author` field.
If ... | lib/absinthe/middleware/batch.ex | 0.918795 | 0.896704 | batch.ex | starcoder |
defmodule AutoApi.GetAvailabilityCommand do
@moduledoc """
Abstraction for a `get_availability` command in AutoApi (id `0x02`).
The `struct` contains two fields:
* `capability` specifies the capability of the command as a Capability module
* `properties` specifies which properties for which the availability... | lib/auto_api/commands/get_availability_command.ex | 0.911702 | 0.486332 | get_availability_command.ex | starcoder |
defmodule Mix.Releases.App do
@moduledoc """
Represents important metadata about a given application.
"""
defstruct name: nil,
vsn: nil,
applications: [],
included_applications: [],
unhandled_deps: [],
start_type: nil,
path: nil
@type start_type :: :permanent | :temporary | :transien... | lib/mix/lib/releases/models/app.ex | 0.708414 | 0.416322 | app.ex | starcoder |
defmodule Cldr.Calendar.Formatter.Options do
@moduledoc """
Defines and validates the options
for a calendar formatter.
These options are passed to the formatter
callbacks defined in `Cldr.Calendar.Formatter`.
The valid options are:
* `:calendar` is an calendar module defined with
`use Cldr.Calenda... | lib/formatter/options.ex | 0.919018 | 0.62458 | options.ex | starcoder |
defmodule ChildNode do
@moduledoc """
ChildNode provides facilities for starting another erlang node on the current machine.
This module enhances and abstracts the erlang `slave` module. After calling `slave.start` to
make sure the child node is running, it ensures that Elixir is started, after which it will r... | test/support/child_node.ex | 0.731346 | 0.460228 | child_node.ex | starcoder |
defmodule CTE.Adapter do
@moduledoc ~S"""
Specification of the Closure Table implementation.
Most of the functions implementing the `CTE.Adapter` behavior, will accept the following options:
- `:limit`, to limit the total number of nodes returned, when finding the ancestors or the descendants for nodes
- `:... | lib/cte/adapter.ex | 0.858807 | 0.648745 | adapter.ex | starcoder |
defmodule Beamchmark.Suite do
@moduledoc """
The module defines a struct representing a single run of benchmark. It is also responsible for running the
benchmark and saving/loading the results.
The results are serialized and stored in `output_dir / scenario name / delay_duration` directory, where
`scenario n... | lib/beamchmark/suite.ex | 0.788135 | 0.511229 | suite.ex | starcoder |
defmodule MapSet do
@moduledoc """
A set store.
The `MapSet` is represented internally as a struct, therefore
`%MapSet{}` can be used whenever there is a need to match
on any `MapSet`. Note though the struct fields are private and
must not be accessed directly. Instead, use the functions on this
or in th... | lib/elixir/lib/map_set.ex | 0.768863 | 0.666227 | map_set.ex | starcoder |
defmodule Ash.Dsl.Transformer do
@moduledoc """
A transformer manipulates and/or validates the entire DSL state of a resource.
It's `transform/2` takes a `map`, which is just the values/configurations at each point
of the DSL. Don't manipulate it directly, if possible, instead use functions like
`get_entitie... | lib/ash/dsl/transformer.ex | 0.808521 | 0.571288 | transformer.ex | starcoder |
defmodule Rummage.Phoenix.SearchView do
@moduledoc """
Search View Module for Rummage. This has view helpers that can generate rummagable links and forms.
Usage:
```elixir
defmodule MyApp.ProductView do
use MyApp.Web, :view
use Rummage.Phoenix.View, only: [:search]
end
```
OR
... | lib/rummage_phoenix/hooks/views/search_view.ex | 0.726426 | 0.794305 | search_view.ex | starcoder |
defmodule Mix.Tasks.Doctor do
@moduledoc """
Doctor is a command line utility that can be used to ensure that your project
documentation remains healthy. For more in depth documentation on Doctor or to
file bug/feature requests, please check out https://github.com/akoutmos/doctor.
The `mix doctor` command su... | lib/mix/tasks/doctor.ex | 0.729327 | 0.707897 | doctor.ex | starcoder |
defmodule Elixlsx.Sheet do
alias __MODULE__
alias Elixlsx.Sheet
alias Elixlsx.Util
@moduledoc ~S"""
Describes a single sheet with a given name. The name can be up to 31 characters long.
The rows property is a list, each corresponding to a
row (from the top), of lists, each corresponding to
a column (fr... | lib/elixlsx/sheet.ex | 0.808332 | 0.502625 | sheet.ex | starcoder |
defmodule Lasagna do
@moduledoc """
API for creating a tasty dish made of stacked layers of lasgane and filling.
"""
@doc """
Returns the total time in minutes that a lasagna is expected to remain in the oven.
## Examples
iex> Lasagna.expected_minutes_in_oven()
40
"""
@spec expected_minutes_i... | elixir/lasagna/lib/lasagna.ex | 0.845113 | 0.807233 | lasagna.ex | starcoder |
defmodule Accounting.Assertions do
@moduledoc """
This module contains a set of assertion functions.
"""
alias Accounting.{Account, Entry, Journal}
import ExUnit.Assertions, only: [flunk: 1]
@timeout 100
@spec assert_registered_categories(Journal.id, [String.t]) :: true | no_return
def assert_registe... | lib/accounting/assertions.ex | 0.853119 | 0.426919 | assertions.ex | starcoder |
defmodule CyberSourceSDK.Client do
@moduledoc """
This Client module handle all HTTPS requests to the CyberSource server. It
takes some parameters and convert to HTTPS requests.
It support the following payments:
* Android Pay
* Apple Pay
It supports the following requests:
* Authorization
* Capture... | lib/cybersource-sdk/client.ex | 0.85186 | 0.716181 | client.ex | starcoder |
defmodule Veritaserum do
@moduledoc """
Sentiment analisis based on AFINN-165, emojis and some enhancements.
Also supports:
- emojis (❤️, 😱...)
- boosters (*very*, *really*...)
- negators (*don't*, *not*...).
"""
alias Veritaserum.Evaluator
@spec analyze(list(String.t()) | String.t()) :: list(inte... | lib/veritaserum.ex | 0.715821 | 0.49231 | veritaserum.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.