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 Serum.Template.Compiler do
@moduledoc false
_moduledocp = "This module handles template loading and preprocessing."
alias Serum.Plugin
alias Serum.Result
alias Serum.Template
alias Serum.Template.Compiler.Include
@type templates() :: %{optional(binary()) => Template.t()}
@type options :: [... | lib/serum/template/compiler.ex | 0.762733 | 0.411318 | compiler.ex | starcoder |
defmodule ExFieldDoc do
@moduledoc """
Documenting `defstruct` fields inline.
## Usage
`ExFieldDoc` adds function documentation which includes fields and their corresponding
default values (if any). Fields are marked to be documented by appending `||` followed
by a string. See the example below and note t... | lib/ex_field_doc.ex | 0.839389 | 0.874828 | ex_field_doc.ex | starcoder |
defmodule McProtocol.NBT do
@moduledoc """
Module for reading and writing NBT (http://wiki.vg/NBT)
The optional argument on the read/write functions allows the root tag to be nil.
This encodes as a NBT end tag.
"""
@type tag_name :: binary | nil
@type integer_tag :: {:byte | :short | :int | :long, tag... | lib/nbt.ex | 0.680454 | 0.40248 | nbt.ex | starcoder |
defmodule PowerAssert.Renderer do
@moduledoc false
alias PowerAssert.PositionAndValue
@doc """
renders test result
"""
def render(code_ast, position_and_values, lhs_result \\ nil, rhs_result \\ nil)
def render(code_ast, [], lhs_result, rhs_result) do
Macro.to_string(code_ast) <> extra_information(l... | lib/power_assert/renderer.ex | 0.755186 | 0.551936 | renderer.ex | starcoder |
defmodule Ninjaproxies.Proxy do
defstruct [:alive, :bandwidth, :cityName, :connectTotal, :cookie, :countryCode, :countryName, :craigslist, :created, :facebook, :get, :google, :id, :instagram, :ip, :modified, :paypal, :pinterest, :portNum, :post, :processing, :protocol, :referrer, :regionName, :speed, :twitter, :type,... | lib/api.ex | 0.520496 | 0.435301 | api.ex | starcoder |
defmodule MeshxConsul.Proxy do
@moduledoc """
Manages sidecar service proxy binary command.
Service mesh data plane is using system of connected proxies managed by control plane application for service communication.
Module is managing starting, stopping and restarting proxies binary commands.
Proxies should... | lib/proxy/proxy.ex | 0.894502 | 0.844281 | proxy.ex | starcoder |
defmodule ComplexNumbers do
@moduledoc false
@typedoc """
In this module, complex numbers are represented as a tuple-pair containing the real and
imaginary parts.
For example, the real number `1` is `{1, 0}`, the imaginary number `i` is `{0, 1}` and
the complex number `4+3i` is `{4, 3}'.
"""
@type comp... | complex-numbers/lib/complex_numbers.ex | 0.925911 | 0.837021 | complex_numbers.ex | starcoder |
defmodule YipyipExAuth.Config do
@moduledoc """
Config struct. Keys `:session_ttl`, `:refresh_token_ttl` and `:session_store_module` have no defaults and are mandatory.
Setting `:session_ttl` to `nil` means sessions can live forever, as long as they are refreshed.
The token salts serve to separate one token fro... | lib/config.ex | 0.816845 | 0.591222 | config.ex | starcoder |
if Code.ensure_loaded?(Tesla) do
defmodule RssWatcher.HTTP.Tesla do
@moduledoc """
`Tesla` adapter for HTTP fetching. Used by default if no configuration is
provided.
## Installation
To use, add the following to your dependancies.
```
{:tesla, "~> 1.2.1"}
```
You may need to ... | lib/rss_watcher/http/adapter/tesla.ex | 0.768212 | 0.691888 | tesla.ex | starcoder |
defmodule BRAN do
alias BRAN.Banks.C6
alias BRAN.Banks.Itau
alias BRAN.Banks.Nubank
alias BRAN.Banks.Santander
@moduledoc """
Documentation for `BRAN`.
"""
@doc """
validate
Returns a tuple with {:ok, :valid} or {:error, :reason}, after checking if the combination of bank_code, branch_number, acco... | lib/bran.ex | 0.869811 | 0.507873 | bran.ex | starcoder |
defmodule Cldr.Number.String do
@moduledoc false
@doc """
Returns a regex which matches all latin1 characters
"""
@latin1 ~r/([\x00-\x7F])/
def latin1 do
@latin1
end
@doc """
Returns a regex which matches all non-latin1 characters
"""
@not_latin1 ~r/([^\x00-\x7F])/
def not_latin1 do
@n... | lib/cldr/number/string.ex | 0.890922 | 0.590632 | string.ex | starcoder |
defmodule ArrowChoice do
@typedoc """
Functor dictionary
intuitive type: fmap : (a -> b) -> f a -> f b
* `map`: (f a, a -> b) -> f b # params are swapped to facilitate piping, mandatory
* `lift_left`: a -> f b -> f a # default implementation provided, optional
"""
@type t :: %__MODULE__{
arrow: Arro... | typeclassopedia/lib/arrow_choice.ex | 0.855474 | 0.481271 | arrow_choice.ex | starcoder |
defmodule AVLTree do
@moduledoc """
Pure Elixir [AVL tree](https://en.wikipedia.org/wiki/AVL_tree) implementation.
This data structure is very similar to `MapSet`, but unlike the latter,
elements in the `AVLTree` are always sorted in ascending or descending order.
To sort items, `AVLTree` uses a comparison... | lib/avl_tree/tree.ex | 0.944944 | 0.937268 | tree.ex | starcoder |
defmodule ExDgraph.Mutation do
@moduledoc """
Provides the functions for the callbacks from the DBConnection behaviour.
"""
alias ExDgraph.{Exception, MutationStatement, Transform}
@doc false
def mutation(conn, statement) do
case mutation_commit(conn, statement) do
{:error, f} -> {:error, code: f... | lib/exdgraph/mutation.ex | 0.525612 | 0.479077 | mutation.ex | starcoder |
defmodule Crux.Structs.Channel do
@moduledoc """
Represents a Discord [Channel Object](https://discordapp.com/developers/docs/resources/channel#channel-object-channel-structure).
List of where every property can be present:
| Property | Text (0) | DM (1) | Voice (2) | Group (3) | Ca... | lib/structs/channel.ex | 0.880283 | 0.755862 | channel.ex | starcoder |
defmodule TypedStructLens do
@moduledoc """
TypedStructLens is a [TypedStruct](https://github.com/ejpcmac/typed_struct)
plugin for defining a [Lens](https://github.com/obrok/lens) on each field
without writing boilerplate code.
## Rationale
If you define your structs with TypedStruct and use Lens alongsid... | lib/typed_struct_lens.ex | 0.793666 | 0.483161 | typed_struct_lens.ex | starcoder |
defmodule Blogit.Components.Supervisor do
@moduledoc """
Represents a `Supervisor`, which supervises the components worker
processes.
By default this Supervisor starts with no children.
`Blogit.Supervisor` starts a supervisor process implementing this module first
and after it a `Blogit.Server` worker proc... | lib/blogit/components/supervisor.ex | 0.71889 | 0.596903 | supervisor.ex | starcoder |
defmodule StepFlow.Step.Live do
@moduledoc """
The Live step context.
"""
alias StepFlow.Amqp.CommonEmitter
alias StepFlow.Jobs
alias StepFlow.Jobs.Status
alias StepFlow.LiveWorkers
alias StepFlow.Repo
alias StepFlow.Step.Launch
alias StepFlow.Step.LaunchParams
def create_job_live([source_path | ... | lib/step_flow/step/live.ex | 0.521715 | 0.534916 | live.ex | starcoder |
defmodule Infusionsoft.Schemas.XML.Contact do
@moduledoc false
# Functions to translate between common names and XML api names for Contact.
alias Infusionsoft.Caches.ContactCustomFields
@common_names [
"Shipping Address Street 1",
"Shipping Address Street 2",
"Other Address Street 1",
"Other ... | lib/infusionsoft/schemas/xml/contact.ex | 0.620852 | 0.411584 | contact.ex | starcoder |
defmodule MarcoPolo.GenericParser do
@moduledoc false
# Provides facilities for parsing binary data with support for incomplete
# data.
# This module provides functions for parsing binary data through given
# *parsers* (which are just functions). What makes this module useful over
# manually parsing these... | lib/marco_polo/generic_parser.ex | 0.780579 | 0.778397 | generic_parser.ex | starcoder |
defmodule OMG.State.UtxoSet do
@moduledoc """
Handles all the operations done on the UTXOs held in the ledger.
Provides the requested UTXOs by a collection of input pointers.
Trades in transaction effects (new utxos, utxos to delete).
Translates the modifications to itself into DB updates, and is able to in... | apps/omg/lib/omg/state/utxo_set.ex | 0.841761 | 0.410638 | utxo_set.ex | starcoder |
defmodule Ratatouille.Renderer.Element do
@moduledoc false
alias __MODULE__, as: Element
alias Ratatouille.Renderer.Element.{
Bar,
Canvas,
Chart,
Column,
Label,
Overlay,
Panel,
Row,
Sparkline,
Table,
Tree,
View,
Viewport
}
@type t :: %Element{tag: atom()}... | lib/ratatouille/renderer/element.ex | 0.872998 | 0.50415 | element.ex | starcoder |
defmodule ExPesa.Jenga.SendMoney.EFT do
@moduledoc """
This module enables you to Send Money To Other Banks Via Electronic Funds Transfer (EFT)
"""
import ExPesa.Jenga.JengaBase
alias ExPesa.Jenga.Signature
@doc """
Send Money To Other Banks Via Electronic Funds Transfer (EFT)
## Parameters
attrs: ... | lib/ex_pesa/Jenga/send_money/eft.ex | 0.782912 | 0.516595 | eft.ex | starcoder |
defmodule LosslessJason.Codegen do
@moduledoc false
alias LosslessJason.{Encode, EncodeError}
def jump_table(ranges, default) do
ranges
|> ranges_to_orddict()
|> :array.from_orddict(default)
|> :array.to_orddict()
end
def jump_table(ranges, default, max) do
ranges
|> ranges_to_orddi... | lib/codegen.ex | 0.702836 | 0.585486 | codegen.ex | starcoder |
defmodule Sentry.Sources do
alias Sentry.Config
@moduledoc """
This module is responsible for providing functionality that stores
the text of source files during compilation for displaying the
source code that caused an exception.
### Configuration
There is configuration required to set up this function... | lib/sentry/sources.ex | 0.804021 | 0.450782 | sources.ex | starcoder |
defmodule EventStore do
@moduledoc """
EventStore is CQRS event store implemented in Elixir.
It uses PostgreSQL (v9.5 or later) as the underlying storage engine.
The `EventStore` module provides the public API to read and write events to an
event stream, and subscribe to event notifications.
Please refer... | lib/event_store.ex | 0.893292 | 0.638737 | event_store.ex | starcoder |
defmodule Blueprint.Plot.Graph do
@moduledoc """
Convenient functions for building simple node dependency
graphs.
"""
@type graph_node :: any
@type meta :: any
@type connection :: { graph_node, graph_node } | { graph_node, graph_node, meta }
@type graph :: [connection]
@type lab... | lib/blueprint/plot/graph.ex | 0.77518 | 0.463019 | graph.ex | starcoder |
defmodule Timex.Convert do
@moduledoc false
@doc """
Converts a map to a Date, NaiveDateTime or DateTime, depending on the amount
of date/time information in the map.
"""
@spec convert_map(Map.t) :: Date.t | DateTime.t | NaiveDateTime.t | {:error, term}
def convert_map(map) when is_map(map) do
case c... | deps/timex/lib/convert/convert.ex | 0.756987 | 0.690357 | convert.ex | starcoder |
defmodule Kernel.ParallelCompiler do
@moduledoc """
A module responsible for compiling files in parallel.
"""
@doc """
Compiles the given files.
Those files are compiled in parallel and can automatically
detect dependencies between them. Once a dependency is found,
the current file stops being compile... | lib/elixir/lib/kernel/parallel_compiler.ex | 0.794106 | 0.477189 | parallel_compiler.ex | starcoder |
defmodule FakeServer.Response do
@moduledoc """
Response structure and helpers.
FakeServer makes use of the `%FakeServer.Response{}` structure to define the responses that will be given by the server.
## Structure Fields
- `:status`: The status code of the response. It must be an integer.
- `:body`: ... | lib/fake_server/response.ex | 0.923407 | 0.71716 | response.ex | starcoder |
defmodule Microdata.Error do
@errors %{
document: [:no_items]
}
@moduledoc """
`Microdata.Error` provides a generic error struct implementing the `Exception` behaviour and containing three keys: `type`, `reason`, and `metadata`.
- `type` is an atom classifying the general context the error exists in, ... | lib/microdata/error.ex | 0.900096 | 0.590986 | error.ex | starcoder |
defmodule AWS.Cloud9 do
@moduledoc """
AWS Cloud9
AWS Cloud9 is a collection of tools that you can use to code, build, run,
test, debug, and release software in the cloud.
For more information about AWS Cloud9, see the [AWS Cloud9 User
Guide](https://docs.aws.amazon.com/cloud9/latest/user-guide).
AWS ... | lib/aws/generated/cloud9.ex | 0.832305 | 0.626453 | cloud9.ex | starcoder |
defmodule Soap do
@moduledoc """
The SOAP client for Elixir based on `HTTPoison` (for send requests) and `SweetXml` (for XML parsing).
Soap contains 5 main modules:
* `Soap.Wsdl` - Build wsdl components data map. Can parse raw wsdl file
from external url or local path. Wsdl which is prepared this modu... | lib/soap.ex | 0.895947 | 0.837686 | soap.ex | starcoder |
defmodule Kazan.Codegen.Apis do
@moduledoc false
# Macros for generating API clients from OAI specs.
import Kazan.Swagger, only: [swagger_to_op_map: 1]
alias Kazan.Codegen.Apis.{ApiId, Operation, Parameter}
require EEx
@doc """
Generates API client modules for all the operations defined in an OAPI spec.... | lib/kazan/codegen/apis.ex | 0.691081 | 0.40589 | apis.ex | starcoder |
defmodule StaffNotes.Accounts.Team do
@moduledoc """
A team is a collection of users within an organization that have the same permission level.
## Permission Level
There are three permission levels:
* `:owner`
* All permissions of `:write`
* Can invite users to the organization
* Can rem... | lib/staff_notes/accounts/team.ex | 0.778902 | 0.475484 | team.ex | starcoder |
defmodule MeshxNode.Default do
@moduledoc """
Defaults for "node service" and upstream node connections registration parameters with service mesh adapter.
"""
@doc """
Returns service `params` required by `c:Meshx.ServiceMesh.start/4` as first argument.
When node is transformed to distributed one using `N... | lib/default.ex | 0.904716 | 0.55929 | default.ex | starcoder |
defmodule Expt.Renderer do
alias Expt.{Renderer, Camera, Scene, Ray, Material, Intersection, Const}
use Expt.Vector
def render_seq(%Scene{} = scene) do
%Scene{
samples: samples,
supersamples: supersamples,
camera: %Camera{
width: width,
height: height,
position: pos,... | lib/Expt/Renderer.ex | 0.647352 | 0.465448 | Renderer.ex | starcoder |
defmodule Topo.Cleaner do
@moduledoc false
import Topo.Util
@type geometry ::
{number, number}
| %{type: String.t(), coordinates: list}
| %Geo.Point{}
| %Geo.MultiPoint{}
| %Geo.LineString{}
| %Geo.MultiLineString{}
| %Geo.Polygon{}
... | lib/topo/cleaner.ex | 0.794225 | 0.498901 | cleaner.ex | starcoder |
defmodule AtomTweaksWeb do
@moduledoc """
A module that keeps using definitions for controllers, views and so on.
This can be used in your application as:
```
use AtomTweaksWeb, :controller
use AtomTweaksWeb, :view
```
The definitions below will be executed for every view, controller, etc, so keep th... | lib/atom_tweaks_web.ex | 0.712932 | 0.604165 | atom_tweaks_web.ex | starcoder |
defmodule AWS.Athena do
@moduledoc """
Amazon Athena is an interactive query service that lets you use standard SQL to
analyze data directly in Amazon S3.
You can point Athena at your data in Amazon S3 and run ad-hoc queries and get
results in seconds. Athena is serverless, so there is no infrastructure to ... | lib/aws/generated/athena.ex | 0.916316 | 0.595816 | athena.ex | starcoder |
defmodule Hound.Metadata do
@moduledoc """
Metadata allows to pass and extract custom data through.
This can be useful if you need to identify sessions.
The keys and values must be serializable using `:erlang.term_to_binary/1`.
## Examples
You can start a session using metadata by doing the following:
... | lib/hound/metadata.ex | 0.82011 | 0.551393 | metadata.ex | starcoder |
defmodule DTask.TUI.Views.MainView do
@moduledoc """
## [mode: :table_only]
```
*==============================================================================*
| <Top Bar> |
*===============================================================... | apps/dtask_tui/lib/dtask/tui/views/main_view.ex | 0.784443 | 0.790247 | main_view.ex | starcoder |
defmodule Bundlex.Project do
@bundlex_file_name "bundlex.exs"
@moduledoc """
Behaviour that should be implemented by each project using Bundlex in the
`#{@bundlex_file_name}` file.
"""
use Bunch
alias Bunch.KVList
alias Bundlex.Helper.MixHelper
alias __MODULE__.Store
@src_dir_name "c_src"
@type ... | lib/bundlex/project.ex | 0.820146 | 0.410845 | project.ex | starcoder |
defmodule Bigtable.RowFilter do
alias Bigtable.RowFilter.ColumnRange
alias Google.Bigtable.V2.{ReadRowsRequest, RowFilter, TimestampRange}
@moduledoc """
Provides functions for creating `Google.Bigtable.V2.RowFilter` and applying them to a `Google.Bigtable.V2.ReadRowsRequest` or `Google.Bigtable.V2.RowFilter.C... | lib/row_filter/row_filter.ex | 0.917349 | 0.700608 | row_filter.ex | starcoder |
defmodule Aoc2019Day16 do
# https://adventofcode.com/2019/day/16
def as_list(text) do
text
|> String.trim()
|> String.to_charlist()
|> Enum.map(fn d -> d - ?0 end)
|> Enum.with_index(1)
end
@doc """
This originally used for part 1 but now keep for reference only after refactor
"""
def... | lib/aoc2019_day16.ex | 0.782663 | 0.429968 | aoc2019_day16.ex | starcoder |
defmodule JPMarc.DataField do
@moduledoc """
Tools for working with JPMARC DataFields
"""
alias JPMarc.SubField
@fs "\x1e" # Field separator
@typedoc """
Type that represents `JPMarc.DataField` struct.
This is constructed with `:tag` as String, `:ind1` as String, `:ind2` as String and `:subfi... | lib/jpmarc/data_field.ex | 0.844265 | 0.563048 | data_field.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... | lib/git_diff.ex | 0.836388 | 0.769015 | git_diff.ex | starcoder |
defmodule Parse.VehiclePositionsJson do
@moduledoc """
Parses an enhanced Vehicle Position JSON file into a list of `%Model.Vehicle{}` structs.
"""
alias Model.Vehicle
def parse(body) do
body
|> Jason.decode!(strings: :copy)
|> Map.get("entity")
|> Enum.flat_map(&parse_entity/1)
end
de... | apps/parse/lib/parse/vehicle_positions_json.ex | 0.767559 | 0.459622 | vehicle_positions_json.ex | starcoder |
defprotocol Access do
@moduledoc """
Dictionary-like access to data structures via the `foo[bar]` syntax.
This module also empowers `Kernel`s nested update functions
`Kernel.get_in/2`, `Kernel.put_in/3`, `Kernel.update_in/3` and
`Kernel.get_and_update_in/3`.
## Deprecated
Currently, the Access protocol... | lib/elixir/lib/access.ex | 0.919032 | 0.715747 | access.ex | starcoder |
defmodule Exonerate.Pointer do
@moduledoc false
# JSONPointer implementation. Internally, it's managed as a
# list of strings, with the head of the list being the outermost
# leaf in the JSON structure, and the end of the list being the
# root.
@type t :: [String.t]
alias Exonerate.Type
@spec to_fun... | lib/exonerate/pointer.ex | 0.767429 | 0.802362 | pointer.ex | starcoder |
defmodule K8s.Conn.Auth.Exec do
@moduledoc """
Cluster authentication for kube configs using an `exec` section.
Useful for Kubernetes clusters running on AWS which use IAM authentication (eg. the `aws-iam-authenticator` binary).
An applicable kube config may look something like this:
```
# ...
users:
... | lib/k8s/conn/auth/exec.ex | 0.913472 | 0.700242 | exec.ex | starcoder |
require IEx
defmodule Chopsticks.Engine do
@moduledoc """
Functions for playing the numbers hand game.
Rules:
Each player starts with 1 of 5 possible fingers up on each hand.
On each turn, one player gives the number of up fingers on one hand to one of the other player's hands.
If a hand has exactly 5 fin... | lib/chopsticks/engine.ex | 0.757077 | 0.583233 | engine.ex | starcoder |
defmodule ElixirALE.SPI do
use GenServer
@moduledoc """
This module enables Elixir programs to interact with hardware that's connected
via a SPI bus.
"""
defmodule State do
@moduledoc false
defstruct port: nil, devname: nil
end
@type spi_option ::
{:mode, 0..3} |
{:bits_per_word, 0..1... | lib/elixir_ale/spi.ex | 0.836555 | 0.771284 | spi.ex | starcoder |
defmodule Exchange.Validations do
@moduledoc """
Validations for Data Structures for the Exchange
"""
@doc """
Function that validates the parameters of an order taking into account the type of the `Exchange.Order`.
Different validations are made:
- price is positive
- side one of [:buy, :sell]
- s... | lib/exchange/validations.ex | 0.85067 | 0.70724 | validations.ex | starcoder |
defmodule ExTwilio.Notify.Notification do
@moduledoc """
Represents a Notification resource in the Twilio Notify.
- [Twilio docs](https://www.twilio.com/docs/notify/api/notifications)
- body (optional for all except Alexa) Indicates the notification body text.
Translates to `data.twi_body` for FCM and GCM, ... | lib/ex_twilio/resources/notify/notification.ex | 0.763043 | 0.545346 | notification.ex | starcoder |
defmodule Rummage.Phoenix.SortView do
@moduledoc """
Sort View Module for Rummage. This has view helpers that can generate rummagable links and forms.
Usage:
Usage:
```elixir
defmodule MyApp.ProductView do
use MyApp.Web, :view
use Rummage.Phoenix.View, only: [:paginate]
end
```
OR
```el... | lib/rummage_phoenix/hooks/views/sort_view.ex | 0.687945 | 0.757481 | sort_view.ex | starcoder |
defmodule Attempt do
@moduledoc """
"""
alias Attempt.{Bucket, Retry}
@doc """
Implements a block form of `Attempt.run/2`.
## Examples
iex> require Attempt
...> Attempt.execute tries: 3 do
...> IO.puts "Welcome to Attempt"
...> end
Hi
:ok
"""
defmacro execute(... | lib/attempt.ex | 0.902995 | 0.62144 | attempt.ex | starcoder |
defmodule CardBinEx do
@moduledoc """
Module to discover the CreditCard brand based in the first digits.
### Valid CreditCard brands
| brand | alias |
|------------------|-------------|
| Visa | `visa` |
| Elo | `elo` |
| JCB | `j... | lib/card_bin.ex | 0.712132 | 0.509276 | card_bin.ex | starcoder |
defmodule Elrondex.Transaction do
alias Elrondex.{Transaction, Account, REST}
@sign_fields [
:nonce,
:value,
:receiver,
:sender,
:gasPrice,
:gasLimit,
:data,
:chainID,
:version
]
@number_sign_fields [:nonce, :gasPrice, :gasLimit, :version]
defstruct network: nil,
... | lib/elrondex/transaction.ex | 0.699357 | 0.579817 | transaction.ex | starcoder |
defmodule ElasticsearchElixirBulkProcessor.Helpers.Events do
alias ElasticsearchElixirBulkProcessor.Items.{Create, Index, Update, Delete}
@doc ~S"""
Return the size of the string in bytes
## Examples
iex> ElasticsearchElixirBulkProcessor.Helpers.Events.byte_sum([%ElasticsearchElixirBulkProcessor.Items.I... | lib/elasticsearch_elixir_bulk_processor/helpers/events.ex | 0.720073 | 0.636325 | events.ex | starcoder |
defmodule JaResource.Show do
import Plug.Conn
@moduledoc """
Defines a behaviour for displaying a resource and the function to execute it.
It relies on (and uses):
* JaResource.Record
* JaResource.Serializable
When used JaResource.Show defines the `show/2` action suitable for handling
json-api r... | lib/ja_resource/show.ex | 0.818918 | 0.444565 | show.ex | starcoder |
defmodule Cldr.Calendar do
@moduledoc """
Calendar support functions for formatting dates, times and datetimes.
`Cldr` defines formats for several calendars, the names of which
are returned by `Cldr.Calendar.known_calendars/0`.
Currently this implementation only supports the `:gregorian`
calendar which al... | lib/cldr/calendar.ex | 0.913903 | 0.625753 | calendar.ex | starcoder |
defmodule RDF.NQuads.Encoder do
@moduledoc """
An encoder for N-Quads serializations of RDF.ex data structures.
As for all encoders of `RDF.Serialization.Format`s, you normally won't use these
functions directly, but via one of the `write_` functions on the `RDF.NQuads`
format module or the generic `RDF.Seri... | lib/rdf/serializations/nquads_encoder.ex | 0.831691 | 0.541106 | nquads_encoder.ex | starcoder |
defmodule Financeiro do
@moduledoc """
Início do sistema.
Através desse módulo o usuário escolhe quais operações fazer.
"""
@doc """
Inicia o sistema financeiro.
"""
def main([]) do
alfa(usr_padrao(), entrada("Sistema Financeiro\nDigite 1 para entrar ou 2 para criar um cadastro: "))
end
@doc ... | lib/financeiro.ex | 0.557966 | 0.614886 | financeiro.ex | starcoder |
defmodule Ofex.Helpers do
@spec convert_to_positive_float(number() | String.t) :: float()
def convert_to_positive_float(num) when is_float(num) do
num |> Float.to_string() |> String.replace("-", "") |> string_to_float
end
def convert_to_positive_float(num) when is_integer(num) do
num |> Integer.to_stri... | lib/helpers.ex | 0.772874 | 0.540378 | helpers.ex | starcoder |
defmodule BonnyPlug.WebhookHandler do
@moduledoc """
This module dispatches the admission webhook requests to the handlers. You can `use` this module in your webhook
handler to connect it to the Plug.
## Options
When `use`-ing this module, you have to tell it about the resource you want to act upon:
### ... | lib/bonny_plug/webhook_handler.ex | 0.866217 | 0.688442 | webhook_handler.ex | starcoder |
defmodule LevelWeb.Schema.InputObjects do
@moduledoc false
use Absinthe.Schema.Notation
@desc "The field and direction to sort users."
input_object :user_order do
@desc "The field by which to sort."
field :field, non_null(:user_order_field)
@desc "The sort direction."
field :direction, non_nu... | lib/level_web/schema/input_objects.ex | 0.775477 | 0.436562 | input_objects.ex | starcoder |
defmodule Bitcoin.Protocol.Messages.GetHeaders do
@moduledoc """
Return a headers packet containing the headers of blocks starting right after the last known hash in the block
locator object, up to hash_stop or 2000 blocks, whichever comes first. To receive the next block headers, one needs
to issue gethe... | lib/bitcoin/protocol/messages/get_headers.ex | 0.827689 | 0.508178 | get_headers.ex | starcoder |
defmodule DataBase.Schemas.AccountTransfer do
@moduledoc """
The centralized agreement for exchanging assets between two
distinct accounts.
A transfer between accounts is performed by creating a outbound
movement to the *sender* account and a inbound movement to the
*recipient* account.
This module prov... | apps/database/lib/database/schemas/account_transfer.ex | 0.866895 | 0.628379 | account_transfer.ex | starcoder |
defmodule Issues.CLI do
@default_count 4
@moduledoc """
Handle the command line parsing and the dispatch to
the various functions that end up generating a
table of the last _n_ issues in a github project
"""
def run(argv) do
argv
|> parse_args
|> process
end
@doc """
`argv` can b... | chapter-13/organizing-a-project-4/issues/lib/issues/cli.ex | 0.631708 | 0.401248 | cli.ex | starcoder |
defmodule Scenic.Toggle.Components do
@moduledoc """
A set of helper functions for working with toggle components.
"""
alias Scenic.Graph
alias Scenic.Primitive
alias Scenic.Component.Toggle
@doc """
Add toggle to a Scenic graph.
You must pass the initial state, `on?`. Pass `true` if the toggle is... | lib/components.ex | 0.904268 | 0.736401 | components.ex | starcoder |
defmodule WechatPay.Native do
@moduledoc """
The **Native** payment method.
[Official document](https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_1)
## Example
Set up a client:
```elixir
{:ok, client} = WechatPay.Client.new(
app_id: "the-app_id",
mch_id: "the-mch-id",
api_key: "t... | lib/wechat_pay/payment_methods/native.ex | 0.828973 | 0.639511 | native.ex | starcoder |
defmodule Para do
@moduledoc """
Para is an Elixir library that provides structured and
declarative way to parse and validate parameters.
Para uses Ecto under the hood and therefore inherits most of
its utilities such as changeset and built-in validators.
## Usage
Let's imagine that you have a controll... | lib/para.ex | 0.876079 | 0.610976 | para.ex | starcoder |
defmodule Solar do
@moduledoc """
A library that provides information about the sun and in particular; events.
This first version handles sunrise and sunset.
All calls to `Solar` library are through this module.
"""
@doc """
Provides sunrise or sunset times for a provided location and date.
The algor... | lib/solar.ex | 0.889993 | 0.752877 | solar.ex | starcoder |
defmodule StepFlow.Map do
@moduledoc """
Extend Map with some additional functions.
"""
@doc """
Get a key matching on an atom or a string.
Default value can be specified.
## Examples
iex> StepFlow.Map.get_by_key_or_atom(%{key: "value"}, :key)
"value"
iex> StepFlow.Map.get_by_key_or... | lib/step_flow/map_tool.ex | 0.872924 | 0.683631 | map_tool.ex | starcoder |
defmodule Ptolemy.Loader do
@moduledoc """
`Ptolemy.Loader` implements a highly opinionated Application Configuration solution.
Instead of having compile-time configuration and secrets, or simple system environment variables
on application startup, this module provides infrastructure on loading configuration
... | lib/loader.ex | 0.848737 | 0.836755 | loader.ex | starcoder |
defmodule PassiveSupport.Math do
@moduledoc """
Mathematical functions.
I'm not great at math.
"""
@doc """
Returns 1 if the number is positive, -1 if negative, and 0 if 0
"""
@spec sign(number) :: -1 | 0 | 1
def sign(0), do: 0
def sign(number) when is_number(number), do:
number / abs(number)
... | lib/passive_support/ext/math.ex | 0.827863 | 0.749615 | math.ex | starcoder |
defmodule OMG.API.Monitor do
@moduledoc """
This module is a custom implemented supervisor that monitors all it's chilldren
and restarts them based on alarms raised. This means that in the period when Geth alarms are raised
it would wait before it would restart them.
When you receive an EXIT, check for an a... | apps/omg_api/lib/monitor.ex | 0.608361 | 0.433082 | monitor.ex | starcoder |
defmodule AWS.Cloudsearchdomain do
@moduledoc """
You use the AmazonCloudSearch2013 API to upload documents to a search domain and
search those documents.
The endpoints for submitting `UploadDocuments`, `Search`, and `Suggest` requests
are domain-specific. To get the endpoints for your domain, use the Amazo... | lib/aws/generated/cloudsearchdomain.ex | 0.887205 | 0.457924 | cloudsearchdomain.ex | starcoder |
defmodule RDF.Dataset do
@moduledoc """
A set of `RDF.Graph`s.
It may have multiple named graphs and at most one unnamed ("default") graph.
`RDF.Dataset` implements:
- Elixir's `Access` behaviour
- Elixir's `Enumerable` protocol
- Elixir's `Inspect` protocol
- the `RDF.Data` protocol
"""
@behav... | lib/rdf/dataset.ex | 0.875175 | 0.701638 | dataset.ex | starcoder |
defmodule Yggdrasil.GraphQL do
@moduledoc """
[](https://travis-ci.org/etherharvest/yggdrasil_graphql) [](https://hex.pm/packages/yggdrasil_graphql) [![hex.... | lib/yggdrasil/graphql.ex | 0.908318 | 0.946399 | graphql.ex | starcoder |
defmodule Glimesh.FileValidation do
@moduledoc """
Reads a file and matches against common magic bytes to determine the type of the file
"""
require Logger
import SweetXml
@doc """
Helper function to quickly match against known types.
## Examples
iex> validate(png_file, [:png, :jpg])
tru... | lib/glimesh_web/uploaders/file_validation.ex | 0.786295 | 0.540439 | file_validation.ex | starcoder |
defmodule ExLTTB.SampleUtils do
@moduledoc """
Utility functions to perform common operations on generic samples
"""
@doc """
Returns the average sample of a list of sample.
## Arguments
* `samples`: a list of samples. These can have any representation provided that access functions are provided (see O... | lib/ex_lttb/sample_utils.ex | 0.923282 | 0.933915 | sample_utils.ex | starcoder |
defmodule Raft.LogStore do
@moduledoc """
The `LogStore` module provides a behaviour and high-level api for interacting
with the underlying database engine. All values are encoded and decoded using
`:erlang.term_to_binary` and `:erlang.binary_to_term` before they're stored.
"""
alias Raft.Log.{
Entry,
... | lib/raft/log_store.ex | 0.84729 | 0.515254 | log_store.ex | starcoder |
defmodule NYSETL.Engines.E1.Cache do
@moduledoc """
Wrapper for Cachex, providing a large number of checksum caches under a supervision
tree. While Cachex provides non-blocking reads and writes for caches, transactions
for a specific cache block other transactions via a single GenServer message queue.
This s... | lib/nys_etl/engines/e1/cache.ex | 0.832713 | 0.585101 | cache.ex | starcoder |
defmodule State.Trip.Added do
@moduledoc """
State for added trips. They aren't matched to GTFS trip IDs, so we
maintain them separately, based on the predictions we see.
"""
use State.Server,
indices: [:id, :route_id],
recordable: Model.Trip,
hibernate: false
alias Model.{Prediction, Trip}
... | apps/state/lib/state/trip/added.ex | 0.749362 | 0.469581 | added.ex | starcoder |
defmodule Square.Checkout do
@doc """
Links a `checkoutId` to a `checkout_page_url` that customers will
be directed to in order to provide their payment information using a
payment processing workflow hosted on connect.squareup.com.
```ruby
def create_checkout(client, location_id, body)
```
### Parame... | lib/api/checkout_api.ex | 0.881602 | 0.775775 | checkout_api.ex | starcoder |
defmodule LightBridge.Workflow do
@moduledoc """
Converts the workflow defined in the json into a Graph which can be used by LightBridge.Instance
A workflow is defined using an acyclic graph. The nodes of the graph are the components and the
links between them define the connections.
#### Node
A node has ... | apps/light_bridge/lib/workflow.ex | 0.853699 | 0.944125 | workflow.ex | starcoder |
defmodule ExOrient.QueryBuilder do
@moduledoc """
Logic for building query strings to be used in DB commands. This is used in
`ExOrient.DB` function calls.
"""
alias MarcoPolo.RID
@doc """
Return a DB class name for a given module name or string.
iex> ExOrient.QueryBuilder.class_name(Models.Perso... | lib/ex_orient/query_builder.ex | 0.817647 | 0.41941 | query_builder.ex | starcoder |
defmodule Timex.Time do
@moduledoc """
This module provides a friendly API for working with Erlang
timestamps, i.e. `{megasecs, secs, microsecs}`. In addition,
it provides an easy way to wrap the measurement of function
execution time (via `measure`).
"""
@type units :: :usecs | :msecs | :secs | :mins | ... | lib/time/time.ex | 0.891575 | 0.660669 | time.ex | starcoder |
defmodule Md0.ManualMacroScanner do
use Md0.Scanner.ManualMacro
def scan_document(doc) do
doc
|> String.split(~r{\r\n?|\n})
|> Enum.zip(Stream.iterate(1, &(&1 + 1)))
|> Enum.flat_map(&scan_line/1)
end
state :start do
empty :halt# allows input do end here and emit all tokens scanned so fa... | lib/md0/manual_macro_scanner.ex | 0.503662 | 0.403684 | manual_macro_scanner.ex | starcoder |
defmodule ImageClassifier do
@moduledoc """
Image classification using Tensorflow.
"""
@doc """
Returns the most probable label along with an accuracy for a given image.
## Examples
iex> ImageClassifier.label(File.read!("file/t54wjgedk1kd3d8s.jpg"))
{0.49980872869491577, "tvs"}
"""
def label(ima... | lib/image_classifier.ex | 0.8951 | 0.572872 | image_classifier.ex | starcoder |
defmodule Auctoritas.DataStorage.RefreshTokenData do
alias Auctoritas.DataStorage.RefreshTokenData
@typedoc "Token expiration in seconds"
@type expiration() :: non_neg_integer()
@typedoc "When was token inserted (UNIX Epoch time)"
@type inserted_at() :: non_neg_integer()
@typedoc "When was token updated ... | lib/auctoritas/data_storage/refresh_token_data.ex | 0.830972 | 0.406273 | refresh_token_data.ex | starcoder |
defmodule ExTectonicdb.Connection do
@moduledoc """
Handles connection to the database socket
`tdb-server` uses first bit in the reply to denote success/failure, so `:gen_tcp` needs to connect with `packet: :raw`.
Incoming message format: 1 byte for success failure, 8 bytes big endian (64 bit) for length n, a... | lib/ex_tectonicdb/connection.ex | 0.739799 | 0.401776 | connection.ex | starcoder |
defmodule Day09 do
def get_low_points(grid) do
Range.new(0, tuple_size(grid[:data]) - 1)
|> Enum.map(&Grid.position_to_point(&1, grid))
|> Enum.map(fn p -> {p, Grid.get(p, grid), Grid.min_adjacent(p, grid)} end)
|> Enum.filter(fn {_, n, adj} -> n < adj end)
|> Enum.map(fn {p, _, _} -> p end)
end... | aoc21/lib/day09.ex | 0.660063 | 0.536434 | day09.ex | starcoder |
defmodule Vessel.Mapper do
@moduledoc """
This module contains the implementation of the Mapper behaviour for Vessel.
A Mapper uses a Vessel Pipe in order to receive input split by lines and pass
them through to the mapping function. The key for the Mapper is just a binary
representation of the nth record - ... | lib/vessel/mapper.ex | 0.853989 | 0.698702 | mapper.ex | starcoder |
defmodule Phoenix.LiveView.Helpers do
@moduledoc """
A collection of helpers to be imported into your views.
"""
alias Phoenix.LiveView.{Component, Socket, Static}
@doc false
def live_patch(opts) when is_list(opts) do
live_link("patch", Keyword.fetch!(opts, :do), Keyword.delete(opts, :do))
end
@d... | lib/phoenix_live_view/helpers.ex | 0.897011 | 0.541348 | helpers.ex | starcoder |
defmodule Grouper.GroupLeader do
@moduledoc """
This implements a group leader capable of IO and storing group metadata.
A `Grouper.GroupLeader` forwards IO upstream, just like any other
group_leader. In addition, it also allocates a ETS table for this group and
registers it in a global ETS table.
Request... | lib/grouper/group_leader.ex | 0.750827 | 0.436862 | group_leader.ex | starcoder |
defmodule Screens.V2.Template do
@moduledoc false
import Screens.V2.Template.Guards
@typedoc """
A paging_index is used in combination with a slot_id to
uniquely identify a paged region on the screen.
"""
@type paging_index :: non_neg_integer()
@typedoc """
A non_paged_slot_id represents a defined,... | lib/screens/v2/template.ex | 0.852429 | 0.445891 | template.ex | starcoder |
defmodule ExForce.OAuth do
@moduledoc """
Handles OAuth2
## Grant Types
- `authorization_code`: [Understanding the Web Server OAuth Authentication Flow](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_web_server_oauth_flow.htm)
- `password`: [Understanding the Us... | lib/ex_force/oauth.ex | 0.885792 | 0.724383 | oauth.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.