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 Gradient.ElixirFmt do
@moduledoc """
Module that handles formatting and printing error messages produced by Gradient in Elixir.
"""
@behaviour Gradient.Fmt
alias :gradualizer_fmt, as: FmtLib
alias Gradient.ElixirType
def print_errors(errors, opts) do
for {file, e} <- errors do
opts =... | lib/gradient/elixir_fmt.ex | 0.536313 | 0.546073 | elixir_fmt.ex | starcoder |
defmodule Saxy.Xmerl do
@moduledoc """
Provides functions to parse a XML document to
[xmerl format](https://github.com/erlang/otp/blob/master/lib/xmerl/include/xmerl.hrl)
data structure.
See "Types" section for more information.
"""
import Saxy.Xmerl.Records
@type position() :: integer()
@type nam... | lib/saxy/xmerl.ex | 0.91519 | 0.445047 | xmerl.ex | starcoder |
defmodule Deckhub.Ecto.Markdown do
@moduledoc """
An `Ecto.Type` that handles the conversion between a string in the database and a
`Deckhub.Markdown` struct in memory.
Use this as the type of the database field in the schema:
```
defmodule Deckhub.Hearthstone.Term do
use Ecto.Schema
alias Deckhub... | lib/deckhub/ecto/markdown.ex | 0.85373 | 0.832032 | markdown.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.893443 | 0.477311 | control.ex | starcoder |
defmodule Painting do
@moduledoc """
Module to create and manipulate Paintings. A painting has a status that can be:
- :not_ready -> Painting cannot be started, it needs configuration
- :ready -> Painting can be started, all configuration is set
- :in_progress -> Painting is in progress.
- :complete -> Pai... | apps/painting/lib/painting.ex | 0.805709 | 0.411229 | painting.ex | starcoder |
defmodule Openflow.Action.SetField do
@moduledoc """
Set a header field using OXM TLV format.
"""
defstruct(field: nil)
alias __MODULE__
@type t :: %SetField{field: Keyword.t()}
@set_field_size 8
def ofpat, do: 25
@doc """
Create a new set_field action struct
note: The following oxm(nxm)_he... | lib/openflow/actions/set_field.ex | 0.736969 | 0.641956 | set_field.ex | starcoder |
defmodule Formex.Field do
alias __MODULE__
@doc """
Defines the Formex.Field struct.
* `:name` - a field name, for example: `:title`
* `:struct_name` - a name of a key in your struct. By default the same as `:name`
* `:custom_value` - custom function that extracts a value that will be used in view
... | lib/formex/field.ex | 0.894132 | 0.895477 | field.ex | starcoder |
defmodule Ecto.Adapters.Postgres.SQL do
@moduledoc false
# This module handles the generation of SQL code from queries and for create,
# update and delete. All queries has to be normalized and validated for
# correctness before given to this module.
alias Ecto.Query.Query
alias Ecto.Query.QueryExpr
alia... | lib/ecto/adapters/postgres/sql.ex | 0.618089 | 0.433262 | sql.ex | starcoder |
defmodule OverDB.Protocol.V4.Frames.Responses.Result.Prepared do
@moduledoc """
Prepared
The result to a PREPARE message. The body of a Prepared result is:
<id><metadata><result_metadata>
where:
- <id> is [short bytes] representing the prepared query ID.
- <metadata> is composed of:
<... | lib/protocol/v4/frames/responses/result/prepared.ex | 0.848628 | 0.687433 | prepared.ex | starcoder |
defmodule Frank.Git.Grep.Match do
@type t :: %__MODULE__{
line_number: integer(),
raw_text: String.t()
}
defstruct line_number: nil,
raw_text: nil
end
defmodule Frank.Git.Grep do
import Frank.Helper
require Logger
@type t :: %__MODULE__{
reference: Frank.G... | lib/git/grep.ex | 0.712532 | 0.483222 | grep.ex | starcoder |
defmodule Wasmex do
@moduledoc """
Wasmex is a fast and secure [WebAssembly](https://webassembly.org/) and [WASI](https://github.com/WebAssembly/WASI) runtime for Elixir.
It enables lightweight WebAssembly containers to be run in your Elixir backend.
It uses [wasmer](https://wasmer.io/) to execute WASM binarie... | lib/wasmex.ex | 0.900423 | 0.657786 | wasmex.ex | starcoder |
defmodule Stone do
@moduledoc ~S"""
This project tries to reduce boilerplate when writing Elixir `GenServer`s by
making use of language metaprogramming capabilities.
## Functionality
This project helps remove boilerplate common when implementing `GenServer`
behaviour in Elixir. In particular, it can be us... | lib/stone.ex | 0.835383 | 0.867822 | stone.ex | starcoder |
defmodule NotQwerty123.PasswordStrength do
@moduledoc """
Module to check password strength.
This module does not provide a password strength meter. Instead, it
simply rejects passwords that are considered too weak. Depending on
the nature of your application, a solid front end solution to password
checkin... | lib/not_qwerty123/password_strength.ex | 0.70304 | 0.53437 | password_strength.ex | starcoder |
defmodule FarmbotOS.BotStateNG do
@moduledoc """
The data strucutre behind the bot state tree (not the living process).
Also has some helpers for batching changes.
"""
alias FarmbotOS.{
BotStateNG,
BotStateNG.McuParams,
BotStateNG.LocationData,
BotStateNG.InformationalSettings,
BotStateNG... | lib/core/bot_state_ng.ex | 0.793746 | 0.417776 | bot_state_ng.ex | starcoder |
defprotocol Commanded.Event.Upcaster do
@moduledoc """
Protocol to allow an event to be transformed before being passed to a
consumer.
You can use an upcaster to change the shape of an event (e.g. add a new field
with a default, rename a field) or rename an event.
Because the upcaster changes any historic... | lib/commanded/event/upcaster.ex | 0.930197 | 0.499573 | upcaster.ex | starcoder |
defmodule Resourceful.JSONAPI.Fields do
@moduledoc """
Functions for validating fields, primarily for use with JSON:API
[sparse fieldsets](https://jsonapi.org/format/#fetching-sparse-fieldsets).
Fields are provided by type type_name in requests and not inferred from root or
relationship names. This means that... | lib/resourceful/jsonapi/fields.ex | 0.811303 | 0.485356 | fields.ex | starcoder |
defmodule Comeonin do
@moduledoc """
Comeonin is a password hashing library that aims to make the
secure validation of passwords as straightforward as possible.
It also provides extensive documentation to help
developers keep their apps secure.
Comeonin supports bcrypt and pbkdf2_sha512.
## Use
Most... | deps/comeonin/lib/comeonin.ex | 0.832066 | 0.910665 | comeonin.ex | starcoder |
defmodule ExNoCache.Plug.LastModified do
@moduledoc """
A plug for caching a content using last modify date.
Requires one option:
* `:updated_at` - The Module Function Argument tuple to fetch the last
modify date for the content. The function must return a %DateTime{}
struct.
## Cache mechani... | lib/ex_no_cache/plug/last_modified.ex | 0.757481 | 0.412205 | last_modified.ex | starcoder |
defmodule Eager do
@type atm :: {:atm, atom}
@type variable :: {:var, atom}
@type ignore :: :ignore
@type cons(t) :: {:cons, t, t}
# Pattern matching
@type pattern :: atm | variable | ignore | cons(pattern)
@type lambda :: {:lambda, [atom], [atom], seq}
@type apply :: {:apply, expr, [expr]}
@... | interpreter/lib/eager.ex | 0.766818 | 0.434581 | eager.ex | starcoder |
defmodule CoopMinesweeper.Game.Field do
@moduledoc """
This module is responsible for the minesweeper fields. It initializes new
fields and handles turns and mark toggles. It also determines whether a turn
lead to a win or loss.
"""
alias __MODULE__
alias CoopMinesweeper.Game.Tile
@min_size 6
@max_s... | lib/coop_minesweeper/game/field.ex | 0.868924 | 0.680069 | field.ex | starcoder |
defmodule Drab.Live.Assign do
@moduledoc false
@spec trim(term) :: term
@doc """
Reduces size of the assigns by shrinking @conn to include only the essential information
(by default it is .private.phoenix_endpoint only).
"""
def trim(%Plug.Conn{} = conn) do
filter = Drab.Config.get(Phoenix.Controller... | lib/drab/live/assign.ex | 0.707708 | 0.403773 | assign.ex | starcoder |
defmodule Authority.Ecto.Template do
@moduledoc """
Automatically implements `Authority` behaviours into modules of your
choice, minimizing the amount of code that you have to write. All callbacks
remain overridable, however.
## Definition
`Authority` expects you to define a module in your application to ... | lib/authority/ecto/template.ex | 0.881723 | 0.468669 | template.ex | starcoder |
defmodule GameOfLife do
@moduledoc """
Handles the logic for Conway's Game of Life.
Each cell is tracked as a list that represents its coordinate
E.g. [1, 2] = Column 1, Row 2
On each iteration of the game, we gather a list of neighbours
for all active cells. Then we apply the game of logic of each
of t... | apps/game_of_life/lib/game_of_life.ex | 0.885724 | 0.83508 | game_of_life.ex | starcoder |
defmodule Fatura do
@moduledoc """
Este módulos executamos funções de faturas
"""
@doc """
Ao receber `fatura` retorna uma array de faturas
## Exemplos
iex> Fatura.criar_faturas(["Telefone", "Agua", "Luz"], [5,10])
[
%Fatura.Conta{fatura: "Telefone", vencimento: 5},
... | lib/fatura.ex | 0.61855 | 0.556098 | fatura.ex | starcoder |
defmodule Multipart.Part do
@moduledoc """
Represents an individual part of a `Multipart` message.
"""
defstruct headers: [], body: nil, content_length: nil
@type body :: binary() | Enum.t()
@type t :: %__MODULE__{
headers: [],
body: body,
content_length: pos_integer() | nil
... | lib/multipart/part.ex | 0.83752 | 0.489992 | part.ex | starcoder |
defmodule Mix.Tasks.Hex.Repo do
use Mix.Task
@shortdoc "Manages Hex repositories"
@moduledoc """
Manages the list of available Hex repositories.
The repository is where packages and the registry of packages is stored.
You can fetch packages from multiple different repositories and packages
can depend o... | lib/mix/tasks/hex.repo.ex | 0.855565 | 0.454109 | hex.repo.ex | starcoder |
defmodule Solid.Context do
defstruct vars: %{}, counter_vars: %{}, iteration_vars: %{}, cycle_state: %{}, trim_next: false
@type t :: %__MODULE__{
vars: Map.t(),
counter_vars: Map.t(),
iteration_vars: %{optional(String.t()) => term},
cycle_state: Map.t(),
trim_next... | lib/solid/context.ex | 0.781414 | 0.465205 | context.ex | starcoder |
if Code.ensure_loaded?(Phoenix) do
defmodule Guardian.Phoenix.Socket do
@moduledoc """
Provides functions for managing authentication with sockets.
This module mostly provides convenience functions for storing tokens, claims and resources
on the socket assigns.
The main functions you'll be inter... | lib/guardian/phoenix/socket.ex | 0.830147 | 0.846387 | socket.ex | starcoder |
defmodule Cldr.DateTime.Compiler do
@moduledoc """
Tokenizes and parses `Date`, `Time` and `DateTime` format strings.
During compilation, each of the date, time and datetime format
strings defined in CLDR are compiled into a list of
function bodies that are then grafted onto the function head
`format/3` in... | lib/cldr/backend/compiler.ex | 0.910809 | 0.728965 | compiler.ex | starcoder |
defmodule Annex.DataCase do
@moduledoc """
Annex.DataCase is an ExUnit.CaseTemplate with helpers to validing the implementation of
Annex.Data behaviours.
"""
use ExUnit.CaseTemplate
alias Annex.{
Data.List1D,
DataAssertion
}
using kwargs do
quote do
@data_type Keyword.fetch!(unquote... | test/support/data_case.ex | 0.735926 | 0.731706 | data_case.ex | starcoder |
defmodule Opencensus.Plug.Metrics do
@moduledoc """
Template method for creating `Plug` to measure response times.
## Usage
1. Create your own `Plug` module:
```elixir
defmodule MyApp.TracingPlug do
use Opencensus.Plug.Trace
end
```
2. Add it to your pipeline, ex. for Phoenix:
`... | lib/opencensus/plug/metrics.ex | 0.856827 | 0.768733 | metrics.ex | starcoder |
defprotocol Enumerable do
@moduledoc """
Enumerable protocol used by `Enum` and `Stream` modules.
When you invoke a function in the `Enum` module, the first argument
is usually a collection that must implement this protocol. For example,
the expression
Enum.map([1, 2, 3], &(&1 * 2))
invokes underne... | lib/elixir/lib/enum.ex | 0.934924 | 0.7413 | enum.ex | starcoder |
defmodule AWS.LookoutVision do
@moduledoc """
This is the Amazon Lookout for Vision API Reference.
It provides descriptions of actions, data types, common parameters, and common
errors.
Amazon Lookout for Vision enables you to find visual defects in industrial
products, accurately and at scale. It uses c... | lib/aws/generated/lookout_vision.ex | 0.888674 | 0.661868 | lookout_vision.ex | starcoder |
defmodule SampleProjects.Language.WordComplete do
@moduledoc false
def run do
{training_data, letters} = gen_training_data
blank_vector = NeuralNet.get_blank_vector(letters)
IO.puts "Generating neural network."
net = GRUM.new(%{input_ids: letters, output_ids: letters, memory_size: 100})
... | lib/sample_projects/language/word_complete.ex | 0.516595 | 0.485173 | word_complete.ex | starcoder |
defmodule ExWire.Packet.Disconnect do
@moduledoc """
Disconnect is when a peer wants to end a connection for a reason.
```
**Disconnect** `0x01` [`reason`: `P`]
Inform the peer that a disconnection is imminent; if received, a peer should
disconnect immediately. When sending, well-behaved hosts give their ... | apps/ex_wire/lib/ex_wire/packet/disconnect.ex | 0.893704 | 0.798344 | disconnect.ex | starcoder |
defmodule Brando.Villain.Filters do
use Phoenix.Component
alias Brando.Utils
alias Liquex.Context
@moduledoc """
Contains all the basic filters for Liquid
"""
@type filter_t :: {:filter, [...]}
@callback apply(any, filter_t, map) :: any
defmacro __using__(_) do
quote do
@behaviour Brando.... | lib/brando/villain/filters.ex | 0.891439 | 0.408808 | filters.ex | starcoder |
defmodule Brando.Content.Module do
@moduledoc """
Ecto schema for the Villain Content Module schema
A module can hold a setup for multiple blocks.
## Multi module
A module can be setup as a multi module, meaning it can contain X other entries.
If the entry template is not floating your boat, you can acc... | lib/brando/content/module.ex | 0.796134 | 0.772402 | module.ex | starcoder |
defmodule Rps.Games.Leaderboard do
@moduledoc """
The Leaderboard can be implemented in different ways, it depends on what
problem we are trying to optimize. The common approach might bea single
`ordered_set` table (sorted table) where the key is the score and the value
is a lis of users with that score. The ... | lib/rps/games/leaderboard.ex | 0.861655 | 0.852568 | leaderboard.ex | starcoder |
defmodule HLDSLogs.LogProducer do
@moduledoc """
A `GenStage` producer that connects to a HLDS server and sets up log forwarding to itself. Should only be calling this
module directly if you want to manage the supervision of these processes yourself, otherwise the functions in
`HLDSLogs` will create processes u... | lib/hlds_logs/log_producer.ex | 0.827759 | 0.738009 | log_producer.ex | starcoder |
defmodule HtmlWriter do
@moduledoc """
Provide helper macros to write html programatically into a chardata
all macros in this module take an chardata as first argument and put more data in it
as the return value
"""
@doc ~S"""
helper macro to bind a value to a name, in order to maintain flow of the pipe... | lib/html_writer.ex | 0.700075 | 0.815416 | html_writer.ex | starcoder |
defmodule Scenic.Primitive.Line do
@moduledoc """
Draw a line on the screen.
## Data
`{point_a, point_b}`
The data for a line is a tuple containing two points.
* `point_a` - position to start drawing from
* `point_b` - position to draw to
## Styles
This primitive recognizes the following styles
... | lib/scenic/primitive/line.ex | 0.925525 | 0.897111 | line.ex | starcoder |
defmodule ABI.TypeEncoder do
@moduledoc """
`ABI.TypeEncoder` is responsible for encoding types to the format
expected by Solidity. We generally take a function selector and an
array of data and encode that array according to the specification.
"""
@doc """
Encodes the given data based on the function se... | lib/abi/type_encoder.ex | 0.871666 | 0.484807 | type_encoder.ex | starcoder |
defmodule Ecto.Query.Builder.OrderBy do
@moduledoc false
alias Ecto.Query.Builder
@doc """
Escapes an order by query.
The query is escaped to a list of `{direction, expression}`
pairs at runtime. Escaping also validates direction is one of
`:asc` or `:desc`.
## Examples
iex> escape(quote do [... | lib/ecto/query/builder/order_by.ex | 0.862757 | 0.503174 | order_by.ex | starcoder |
defmodule Aoc2020Day11 do
import Enum
def str_to_map(str) do
str
|> String.trim()
|> String.split("\n", trim: true)
|> with_index
|> map(fn {cs, y} ->
String.split(cs, "", trim: true) |> with_index |> map(fn {v, x} -> {{x, y}, v} end)
end)
|> concat
|> Map.new()
end
def s... | lib/2020/aoc2020_day11.ex | 0.655005 | 0.606149 | aoc2020_day11.ex | starcoder |
defmodule Advent.D6 do
def part1() do
coordinates = get_coordinates()
{max_column, max_row} = tuple_max_column_and_row(coordinates)
coordinates
|> mark_new_board(max_column, max_row)
|> remove_coordinates_from_the_edge(max_column, max_row)
|> biggest_area()
end
def part2() do
coordin... | lib/advent/d6.ex | 0.661267 | 0.577108 | d6.ex | starcoder |
defmodule UeberauthToken do
@moduledoc """
A package for authenticating with an oauth2 token and building an ueberauth struct.
Features:
- Cache the ueberauth struct response using the excellent `whitfin/cachex` library.
- Perform asynchronyous validity checks for each token key in the cache.
See full de... | lib/ueberauth_token.ex | 0.869922 | 0.605595 | ueberauth_token.ex | starcoder |
defmodule DataTree.TreePath do
@moduledoc """
A canonical path implementation for tree structures.
The functions in this module handle `TreePath` structs, which encapsulate
path `segments` in a list in reverse order. There is no distinction between
absolute and relative paths. Printable representations of su... | lib/data_tree/tree_path.ex | 0.917769 | 0.762114 | tree_path.ex | starcoder |
defmodule Changex.Formatter.Elixir do
use Changex.Formatter
@moduledoc """
Format changelog to the terminal in markdown format that matches the
format of the elixir-lang changelog
"""
@doc """
Take a map of commits in the following format:
%{
fix: %{
scope1: [commit1, commit2],
... | lib/changex/formatter/elixir.ex | 0.641871 | 0.420748 | elixir.ex | starcoder |
defmodule BSV.Transaction do
@moduledoc """
Module for the construction, parsing and serialization of Bitcoin transactions.
"""
alias BSV.Crypto.{Hash, ECDSA}
alias BSV.Address
alias BSV.KeyPair
alias BSV.Extended.PrivateKey
alias BSV.Script.PublicKeyHash
alias BSV.Transaction.{Input, Output, Signatur... | lib/bsv/transaction.ex | 0.888656 | 0.495239 | transaction.ex | starcoder |
defmodule AshGraphql.Resource.Mutation do
@moduledoc "Represents a configured mutation on a resource"
defstruct [:name, :action, :type, :identity, :read_action, :upsert?]
@create_schema [
name: [
type: :atom,
doc: "The name to use for the mutation.",
default: :get
],
action: [
... | lib/resource/mutation.ex | 0.85269 | 0.51623 | mutation.ex | starcoder |
defmodule Gim.Query do
@moduledoc """
Defines queries on schemas.
"""
defstruct type: nil,
filter: {:and, []},
expand: []
import Gim.Queryable
alias Gim.Index
def query(%__MODULE__{} = query) do
query
end
def query(node) when is_map(node) do
query([node])
end
... | lib/gim/query.ex | 0.836555 | 0.682362 | query.ex | starcoder |
defmodule Manic.TX do
@moduledoc """
Send transactions directly to miners and query the status of any transaction.
By giving a transaction directly to a miner (instead of broadcasting it to the
Bitcoin peer network), you are pushing the transaction directly to the centre
of the network. As the miner will hav... | lib/manic/tx.ex | 0.880071 | 0.701767 | tx.ex | starcoder |
defmodule ExInsights.Decoration.Attributes do
@moduledoc """
Injects decorator functions into parent module to streamline telemetry logging in aspect-oriented style
"""
use Decorator.Define,
track_event: 0,
track_dependency: 1,
track_exception: 0
def track_event(body, %{name: name}) do
quote... | lib/decoration/attributes.ex | 0.502441 | 0.407982 | attributes.ex | starcoder |
defmodule RePG2.Worker do
@moduledoc false
use GenServer
require Logger
alias RePG2.Impl
def start_link, do: GenServer.start_link(__MODULE__, [], name: __MODULE__)
@doc """
Make a globally locked multi call to all `RePG2.Worker`s in the cluster.
This function acquires a cluster-wide lock on the gr... | lib/repg2/worker.ex | 0.697506 | 0.406685 | worker.ex | starcoder |
defmodule Exq.Stats.Server do
@moduledoc """
Stats process is responsible for recording all stats into Redis.
The stats format is compatible with the Sidekiq stats format, so that
The Sidekiq UI can be also used to view Exq status as well, and Exq
can run side by side with Sidekiq without breaking any of it'... | lib/exq/stats/server.ex | 0.662469 | 0.408129 | server.ex | starcoder |
defmodule Grizzly.CommandClass.ScheduleEntryLock.YearDaySet do
@moduledoc """
Command for working with SCHEDULE_ENTRY_LOCK command class YEAR_DAY_SET command
Command Options:
* `:action` - The action either to erase or to modify the slot
* `:slot_id` - The schedule slot id
* `:user_id` - The sch... | lib/grizzly/command_class/schedule_entry_lock/year_day_set.ex | 0.857037 | 0.457561 | year_day_set.ex | starcoder |
defmodule Zaryn.TransactionChain.Transaction.ValidationStamp do
@moduledoc """
Represents a validation stamp created by a coordinator on a pending transaction
"""
alias Zaryn.Crypto
alias __MODULE__.LedgerOperations
defstruct [
:timestamp,
:signature,
:proof_of_work,
:proof_of_integrity,
... | lib/zaryn/transaction_chain/transaction/validation_stamp.ex | 0.900075 | 0.435061 | validation_stamp.ex | starcoder |
defmodule LearnKit.Preprocessing do
@moduledoc """
Module for data preprocessing
"""
alias LearnKit.{Preprocessing, Math}
use Preprocessing.Normalize
@type row :: [number]
@type matrix :: [row]
@doc """
Normalize data set with minimax normalization
## Parameters
- features: list of features... | lib/learn_kit/preprocessing.ex | 0.870405 | 0.778818 | preprocessing.ex | starcoder |
defmodule Base2 do
@moduledoc """
This module provides data encoding and decoding functions for Base2.
## Overview
Converting to and from Base2 is very simple in Elixir and Erlang. Unfortunately, most approaches use generic methodologies that are suitable for any Base, and thus do not optimize for any Base ty... | lib/base2.ex | 0.936263 | 0.861596 | base2.ex | starcoder |
defmodule Sippet.Message.StatusLine do
@moduledoc """
A SIP Status-Line struct, composed by the SIP-Version, Status-Code and the
Reason-Phrase.
The `start_line` of responses are represented by this struct. The RFC 3261
represents the Status-Line as:
Status-Line = SIP-Version SP Status-Code SP Reason... | lib/sippet/message/status_line.ex | 0.89568 | 0.50354 | status_line.ex | starcoder |
defmodule AWS.IoTJobsDataPlane do
@moduledoc """
AWS IoT Jobs is a service that allows you to define a set of jobs — remote
operations that are sent to and executed on one or more devices connected to AWS
IoT.
For example, you can define a job that instructs a set of devices to download
and install applic... | lib/aws/generated/iot_jobs_data_plane.ex | 0.716814 | 0.522689 | iot_jobs_data_plane.ex | starcoder |
defmodule RecurringEvents.Monthly do
@moduledoc """
Handles `:monthly` frequency rule
"""
alias RecurringEvents.Date
@doc """
Returns monthly stream of dates with respect to `:interval`, `:count` and
`:until` rules. Time and day in date provided as `:until` is ignored.
# Example
iex> Recurring... | lib/recurring_events/monthly.ex | 0.88311 | 0.460532 | monthly.ex | starcoder |
defmodule IVCU.Definition do
@moduledoc ~S"""
An interface for file processing.
## Example
Suppose we have defined [storage](`IVCU.Storage`) and
[converter](`IVCU.Converter`) modules as `MyApp.FileStorage` and
`MyApp.ImageConverter` respectively. Then we can provide a specific
definition for some images... | lib/ivcu/definition.ex | 0.822439 | 0.438966 | definition.ex | starcoder |
defmodule D09.Challenge do
@moduledoc """
Solution sketch:
The first part is quite simple: Create a 2D array (I use a 1D array with indexing) and scan every points if their
direct neighbors have lower values (or the scanned point is 9 itself, which cannot be lower than the rest). If so, it
is a low point and... | lib/d09/challenge.ex | 0.722331 | 0.828072 | challenge.ex | starcoder |
defmodule NeoNode.Parser do
@address_version "17"
defp parse16("0x" <> rest), do: parse16(rest)
defp parse16(string) do
Base.decode16!(string, case: :mixed)
end
# Base.decode64!(string, padding: false)
defp parse58(string), do: Base58.decode(string)
defp parse_asset_type("GoverningToken"), do: :go... | apps/neo_node/lib/neo_node/parser.ex | 0.539226 | 0.513303 | parser.ex | starcoder |
defmodule Dynamo.Cowboy do
@moduledoc """
Provides the interface to Cowboy webserver.
Check `run/2` for more information.
"""
@doc """
Runs the given module with the given options:
* `port` - the port to run the server (defaults to 4000)
* `acceptors` - the number of acceptors for the listener
* `... | lib/dynamo/cowboy.ex | 0.846229 | 0.446133 | cowboy.ex | starcoder |
defmodule Lexthink.AST do
@typep datum_arg :: :null | boolean | number | binary
@typep expr_arg :: Dict.t | {any, any} | [expr_arg] | fun | atom | :term.t | :term_assocpair.t | datum_arg
@typep key_arg :: binary | number | atom
@spec db_create(binary) :: :term.t
def db_create(name), do: :term.new(type: :'DB_... | lib/lexthink/ast.ex | 0.761361 | 0.42925 | ast.ex | starcoder |
defmodule Explorer.DataFrame do
@moduledoc """
The DataFrame struct and API.
Dataframes are two-dimensional tabular data structures similar to a spreadsheet.
For example, the Iris dataset:
iex> Explorer.Datasets.iris()
#Explorer.DataFrame<
Polars[150 x 5]
sepal_length float [5.1, 4... | lib/explorer/data_frame.ex | 0.904395 | 0.844985 | data_frame.ex | starcoder |
defmodule Bow.Exec do
@moduledoc """
Transform files with shell commands
This module allows executing any external command taking care of temporary path generation and error handling.
It is as reliable as [erlexec](https://github.com/saleyn/erlexec) module (very!).
It is also possible to provide custom comm... | lib/bow/exec.ex | 0.831793 | 0.451266 | exec.ex | starcoder |
defmodule Sanbase.Clickhouse.Uniswap.MetricAdapter do
@behaviour Sanbase.Metric.Behaviour
import Sanbase.Utils.Transform
alias Sanbase.Transfers.Erc20Transfers
require Sanbase.Utils.Config, as: Config
@aggregations [:sum]
@timeseries_metrics []
@histogram_metrics ["uniswap_top_claimers"]
@table_me... | lib/sanbase/clickhouse/uniswap/metric_adapter.ex | 0.786828 | 0.407628 | metric_adapter.ex | starcoder |
defmodule StructAccess do
@moduledoc """
Provides a standard callback implementation for the `Access` behaviour.
Implements the following callbacks for the struct where this module is used:
- `c:Access.fetch/2`
- `c:Access.get_and_update/3`
- `c:Access.pop/2`
To define these callback and include the pro... | lib/struct_access.ex | 0.925078 | 0.878105 | struct_access.ex | starcoder |
defmodule Ppc.Common do
@doc """
To update a paypal entity we need to provide each mutated field with correct annotations.
The plan:
- compare fields of old entity with new one. Obtain a list of entries
(aka. update-list or update-triplets):
- operation (one of {add|remove|replace})
- fiel... | lib/ppc/common.ex | 0.833325 | 0.558688 | common.ex | starcoder |
defmodule Terp.Evaluate.List do
@moduledoc """
Provides functionality for working with lists.
"""
alias Terp.Evaluate
@doc """
Build a list by prepending an item to it.
"""
def cons([], environment), do: Evaluate.eval_expr(nil, environment)
def cons([x | xs], environment) do
e = Evaluate.eval_exp... | lib/evaluate/list.ex | 0.737347 | 0.487429 | list.ex | starcoder |
defmodule Mix.Tasks.Potato.Upgrade do
@moduledoc """
Prepare an upgrade release from an existing release.
## Command line options
* --from - Specify the version to upgrade from.
## Notes
Generates a minimal tar file capable of upgrading from the
specified version to the current version. This task expe... | lib/mix/tasks/potato/upgrade.ex | 0.83747 | 0.726547 | upgrade.ex | starcoder |
defmodule Hierbautberlin.GeoData.AnalyzeText do
require Logger
use GenServer
import Ecto.Query, warn: false
alias Hierbautberlin.GeoData
alias Hierbautberlin.GeoData.{GeoPlace, GeoStreet, GeoStreetNumber}
alias Hierbautberlin.Repo
alias Hierbautberlin.Services.UnicodeHelper
@place_sorting ["Park", "Sc... | lib/hierbautberlin/geo_data/analyze_text.ex | 0.539711 | 0.410697 | analyze_text.ex | starcoder |
defmodule Ecbolic do
@moduledoc """
This module aims to provide a simple interface to
`Ecbolic.Store` and the neccessary tools to add
documentation to functions, which is easly accessable
at runtime. This library was build with the intend to
make it easy to show help for users of applications,
such as ... | lib/ecbolic.ex | 0.888593 | 0.908658 | ecbolic.ex | starcoder |
defmodule Cog.Queries.Command do
import Ecto.Query, only: [from: 2]
alias Cog.Models.Command
def names do
from c in Command,
join: b in assoc(c, :bundle),
select: [b.name, c.name]
end
def names_for(enabled) do
from c in Command,
join: b in assoc(c, :bundle),
where: b.enabled == ^en... | lib/cog/queries/command.ex | 0.620622 | 0.611295 | command.ex | starcoder |
defmodule Journey do
@moduledoc ~S"""
Journey helps you define and execute workflow-like processes, simply, scalably, and reliably.
Examples of applications that could be powered by processes defined and executed with Journey:
* a food delivery application,
* a web site for computing horoscopes,
* a web si... | lib/journey.ex | 0.819352 | 0.924279 | journey.ex | starcoder |
defmodule Google.Protobuf.Struct do
@moduledoc false
alias Pbuf.Decoder
import Bitwise, only: [bsr: 2, band: 2]
@derive Jason.Encoder
defstruct [
fields: %{}
]
@type t :: %__MODULE__{
fields: %{optional(String.t) => any}
}
@spec new(Enum.t) :: t
def new(data) do
struct(__MODULE__, data... | lib/protoc/google/protobuf/struct.pb.ex | 0.80567 | 0.570122 | struct.pb.ex | starcoder |
defmodule ExWordNet.Lemma do
@moduledoc """
Provides abstraction over a single word in the WordNet lexicon,
which can be used to look up a set of synsets.
Struct members:
- `:word`: The word this lemma represents.
- `:part_of_speech`: The part of speech (noun, verb, adjective) of this lemma.
- `:synset_o... | lib/exwordnet/lemma.ex | 0.810179 | 0.555918 | lemma.ex | starcoder |
defprotocol Livebook.FileSystem do
@moduledoc false
# This protocol defines an interface for file systems
# that can be plugged into Livebook.
@typedoc """
A path uniquely idenfies file in the file system.
Path has most of the semantics of regular file paths,
with the following exceptions:
* path ... | lib/livebook/file_system.ex | 0.908283 | 0.44553 | file_system.ex | starcoder |
defmodule TradeIndicators.ATR do
use TypedStruct
alias __MODULE__, as: ATR
alias __MODULE__.Item
alias TradeIndicators.MA
alias TradeIndicators.Util, as: U
alias Decimal, as: D
alias Enum, as: E
alias Map, as: M
typedstruct do
field :list, List.t(), default: []
field :period, pos_integer(), d... | lib/atr.ex | 0.533397 | 0.49292 | atr.ex | starcoder |
defmodule ProductCatalog.Service.Product do
products = [
%{
title: "Sennheiser HD 202 II Professional Headphones",
description: "The HD 202 MK II closed, dynamic hi-fi stereo headphones are the ideal partner for DJs and powerful modern music, providing great insulation against ambient noise and a vivi... | lib/product_catalog/service/product.ex | 0.571169 | 0.645036 | product.ex | starcoder |
defmodule Transformations do
@moduledoc """
Transformations is an Elixir library for translating, rotating, reflecting, scaling, shearing, projecting, orthogonalizing, and superimposing arrays of 3D homogeneous coordinates as well as for converting between rotation matrices, Euler angles, and quaternions. Also incl... | lib/transformations.ex | 0.881104 | 0.88842 | transformations.ex | starcoder |
defmodule Aja.Vector.Builder do
@moduledoc false
alias Aja.Vector.{Tail, Node}
require Aja.Vector.CodeGen, as: C
def from_list(list) when is_list(list) do
do_concat_list([], list)
end
def concat_list(builder, list) when is_list(builder) and is_list(list) do
do_concat_list(builder, list)
end
... | lib/vector/builder.ex | 0.689828 | 0.551755 | builder.ex | starcoder |
defmodule Recurrencex do
@moduledoc """
Simple date recurrences
"""
require Logger
@enforce_keys [
:frequency,
:repeat_on,
:type
]
defstruct [
:frequency,
:repeat_on,
:type
]
@type t :: %__MODULE__{
type: atom,
frequency: integer,
repeat_on: [integer] | [{integer... | lib/recurrencex.ex | 0.861188 | 0.756964 | recurrencex.ex | starcoder |
defmodule Mnemonix.Behaviour.Definition.Params do
@moduledoc false
def arities(params) do
{arity, defaults} = Enum.reduce(params, {0, 0}, fn
{:\\, _, [_arg, _default]}, {arity, defaults} ->
{arity, defaults + 1}
_ast, {arity, defaults} ->
{arity + 1, defaults}
end)
Range.new... | lib/mnemonix/behaviour/definition/params.ex | 0.616359 | 0.434161 | params.ex | starcoder |
defmodule Membrane.Dashboard.Dagre.G6Marshaller do
@moduledoc """
This module is responsible for marshalling data regarding links between membrane elements
to create a structure suitable for generating a dagre layout (directed graph) using a `G6` library
whose documentation is available at [https://g6.antv.visi... | lib/membrane_dashboard/dagre/g6_marshaller.ex | 0.85567 | 0.681356 | g6_marshaller.ex | starcoder |
defmodule DatabaseYamlConfigProvider do
@moduledoc """
A config provider that can load a Rails style database.yml file that has the
following structure:
```yaml
production:
adapter: postgresql
database: testdb
username: testuser
password: <PASSWORD>
host: pgsqlhost
port: 5432
```
... | lib/database_yaml_config_provider.ex | 0.796094 | 0.589687 | database_yaml_config_provider.ex | starcoder |
defmodule Figlet.Parser.HeaderlineParser do
@moduledoc """
This module is dedicated to parsing the metadata from a Figlet file headerline.
The [header line](http://www.jave.de/figlet/figfont.html#headerline) gives
information about the FIGfont. Here is an example showing the names of all
parameters:
```
... | lib/figlet/parser/headerline_parser.ex | 0.833257 | 0.790813 | headerline_parser.ex | starcoder |
defmodule Crux.Structs.Overwrite do
@moduledoc """
Represents a Discord [Overwrite Object](https://discord.com/developers/docs/resources/channel#overwrite-object).
"""
@moduledoc since: "0.1.0"
@behaviour Crux.Structs
alias Crux.Structs
alias Crux.Structs.{Overwrite, Permissions, Role, Snowflake, User, ... | lib/structs/overwrite.ex | 0.82573 | 0.592224 | overwrite.ex | starcoder |
defmodule Pnum do
@moduledoc """
Concurrent collection enumeration
Wraps the stdlib `Enum` module which implements the `Enumerable` protocol.
Implementation and documentation should mimic the `Enum` module.
"""
@type t :: Enumerable.t
@type item :: any
@doc """
Filters the collect... | src/pnum.ex | 0.875381 | 0.725454 | pnum.ex | starcoder |
defmodule Scenic.Driver.KeyMap do
@moduledoc """
Behaviour and support functions for mapping physical keys to characters.
This module is meant to be implemented elsewhere and provided to a driver
in order to localize key presses into the correct characters.
The `:scenic_driver_local` driver comes with a US... | lib/scenic/driver/key_map.ex | 0.833562 | 0.533944 | key_map.ex | starcoder |
defmodule AssertIdentity do
import ExUnit.Assertions, only: [assert: 2]
@typedoc """
Value that can be compared by identity.
"""
@type comparable :: list | {list, any} | %{id: any} | {map, any}
@doc """
Asserts that `a` and `b` have the same identity.
Checks that the `id` keys of all provided structs... | lib/assert_identity.ex | 0.902177 | 0.691276 | assert_identity.ex | starcoder |
defmodule Network do
alias Cumatrix, as: CM
@moduledoc """
defnetwork is macros to describe network
argument must have under bar to avoid warning message
```
defnetwork name(_x) do
_x |> element of network |> ...
end
```
element
- w(r,c) weight matrix row-size is r col-size is c. initial ... | lib/macro.ex | 0.746139 | 0.850655 | macro.ex | starcoder |
defmodule Plug.LoggerJSON do
@moduledoc """
A plug for logging basic request information in the format:
```json
{
"api_version": "N/A"
"client_ip": "192.168.3.11"
"client_version": "ios/1.6.7",
"date_time": "2016-05-31T18:00:13Z",
"duration": 4.670,
"handler": ... | lib/plug/logger_json.ex | 0.848549 | 0.674412 | logger_json.ex | starcoder |
defmodule Ecto.Model do
@moduledoc """
Provides convenience functions for defining and working
with models.
## Using
When used, `Ecto.Model` works as an "umbrella" module that adds
common functionality to your module:
* `use Ecto.Schema` - provides the API necessary to define schemas
* `import Ec... | lib/ecto/model.ex | 0.870446 | 0.579252 | model.ex | starcoder |
defmodule Ockam.Hub.Service.Provider do
@moduledoc """
Behaviour module and entrypoint to start Ockam.Hub services
Provider behaviour implementations should provide a list of service names and be able to
start service workers given names and arguments
Provider can start all services configured in :ockam_hub... | implementations/elixir/ockam/ockam_hub/lib/hub/service/provider.ex | 0.537284 | 0.428592 | provider.ex | starcoder |
defmodule Expdf do
alias Expdf.{
Document,
Parser,
Header,
Object,
ElementHexa,
Element,
}
@doc """
Parse given string data
## Parameters
- `data` - file content as binary string
## Example
iex> File.read!("./test/test_data/test.pdf") |> Expdf.parse
true
"""
def pa... | lib/expdf.ex | 0.715821 | 0.416915 | expdf.ex | starcoder |
defmodule Ecto.Adapter do
@moduledoc """
This module specifies the adapter API that an adapter is required to
implement.
"""
@type t :: module
@typedoc "Ecto.Query metadata fields (stored in cache)"
@type query_meta :: %{prefix: binary | nil, sources: tuple, assocs: term,
preload... | lib/ecto/adapter.ex | 0.905003 | 0.436892 | adapter.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.