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 Cldr.DateTime do
@moduledoc """
Provides localization and formatting of a `DateTime`
struct or any map with the keys `:year`, `:month`,
`:day`, `:calendar`, `:hour`, `:minute`, `:second` and optionally `:microsecond`.
`Cldr.DateTime` provides support for the built-in calendar
`Calendar.ISO` or an... | lib/cldr/datetime.ex | 0.946262 | 0.757839 | datetime.ex | starcoder |
defmodule Guss.RequestHeaders do
@moduledoc """
Conveniences for working with canonical request headers.
Normally you do not need to access this module directly. It is
meant to be used by the signing processes.
If you want to get a list of signed headers for your request,
see `Guss.Resource.signed_headers... | lib/guss/request_headers.ex | 0.845225 | 0.45181 | request_headers.ex | starcoder |
defmodule VintageNetBridge do
@moduledoc """
Configure network bridges with VintageNet
Configurations for this technology are maps with a `:type` field set to
`VintageNetBridge`. The following additional fields are supported:
* `:vintage_net_bridge` - Bridge options
* `:interfaces` - Set to a list of in... | lib/vintage_net_bridge.ex | 0.864239 | 0.76625 | vintage_net_bridge.ex | starcoder |
defmodule OT.Text.Transformation do
require Logger
@moduledoc """
The transformation of two concurrent operations such that they satisfy the
[TP1][tp1] property of operational transformation.
[tp1]: https://en.wikipedia.org/wiki/Operational_transformation#Convergence_properties
"""
alias OT.Text.{Compon... | lib/ot/text/transformation.ex | 0.770724 | 0.710754 | transformation.ex | starcoder |
defmodule Fika.Compiler.TypeChecker.Match do
alias Fika.Compiler.TypeChecker.Types, as: T
@moduledoc """
This module takes care of the type checking needed for pattern matching.
This is currently a naive algorithm with scope for optimization,
but it should do for now. Here's how the algorithm works:
1. E... | lib/fika/compiler/type_checker/match.ex | 0.626924 | 0.555315 | match.ex | starcoder |
defmodule UeberauthToken.Strategy do
@moduledoc """
A workflow for validation of oauth2 tokens on the resource server.
The strategy `handle_callback/1` function is invoked for
validation token calidation in either of the following cases:
1. As a plug in a plug pipeline which assigns an ueberauth struct to `... | lib/ueberauth_token/strategy.ex | 0.852859 | 0.619586 | strategy.ex | starcoder |
defmodule PinElixir.Customer do
import PinElixir.Utils.RequestOptions
import PinElixir.Utils.Response
@pin_url Application.get_env :pin_elixir, :pin_url
@moduledoc """
Module handling customer operations
"""
@doc """
Given an email and card_map, creates a customer. The map may contain a card or a c... | lib/customers/customer.ex | 0.678007 | 0.707114 | customer.ex | starcoder |
defmodule Screens.Util do
@moduledoc false
def format_time(t) do
t |> DateTime.truncate(:second) |> DateTime.to_iso8601()
end
@spec time_period(DateTime.t()) :: :peak | :off_peak
def time_period(utc_time) do
{:ok, dt} = DateTime.shift_zone(utc_time, "America/New_York")
day_of_week = dt |> DateT... | lib/screens/util.ex | 0.77907 | 0.591782 | util.ex | starcoder |
defmodule Hippocrene.Article do
defstruct title: "", date: {1970, 1, 1}, author: "", body: []
def title(title), do: {:title, title}
def date(year, month, day), do: {:date, {year, month, day}}
def date(date) when is_tuple(date), do: {:date, date}
def author(author), do: {:author, author}
defmacro... | lib/hippocrene/article.ex | 0.617859 | 0.5047 | article.ex | starcoder |
defmodule Shared.Month do
defmodule InvalidMonthIndex do
defexception [:message]
end
if Code.ensure_loaded?(Jason.Encoder) do
@derive Jason.Encoder
end
@enforce_keys [:year, :month]
defstruct [:year, :month]
@type t :: %__MODULE__{
year: integer,
month: integer
}
... | lib/month.ex | 0.802942 | 0.65747 | month.ex | starcoder |
defmodule Shipping.HandlingEvents do
@moduledoc """
The Handling Events Aggregate*. Its root is the module Shipping.HandlingEvent
From the DDD book: [An AGGREGATE is] a cluster of associated objects that
are treated as a unit for the purgpose of data changes. External references are
restricted to one member ... | apps/shipping/lib/shipping/handling_events/handling_events.ex | 0.845608 | 0.51946 | handling_events.ex | starcoder |
defmodule Ecto.Adapters.Postgres do
@moduledoc """
Adapter module for PostgreSQL.
It handles and pools the connections to the postgres
database using `postgrex` with `poolboy`.
## Options
Postgrex options split in different categories described
below. All options should be given via the repository
co... | lib/ecto/adapters/postgres.ex | 0.790934 | 0.411347 | postgres.ex | starcoder |
defmodule Freshcom.Request do
@moduledoc """
Use this module to wrap and modify request data to pass in to API functions.
## Fields
- `requester_id` - The user's ID that is making this request.
- `client_id` - The app's ID that is making the request on behalf of the user.
- `account_id` - The target accou... | lib/freshcom/core/request.ex | 0.761849 | 0.482917 | request.ex | starcoder |
defmodule Quack.Formatter do
@moduledoc """
Module responsible for formatting and composing messages to be sent to slack
"""
import Logger.Formatter, only: [format_date: 1, format_time: 1]
@doc """
Function to compose a new message based on event data
"""
def create_message({level, message, timestamp,... | lib/quack/formatter.ex | 0.786991 | 0.706494 | formatter.ex | starcoder |
defmodule Hyperex.Flattree do
@moduledoc """
A Flat Tree is a deterministic way of using a list as an index
for nodes in a tree. Essentially a simpler way of representing the
position of nodes.
A Flat Tree is also refered to as 'bin numbers' described here
in RFC 7574: https://datatracker.ietf.org/doc/html... | lib/hyperex/flattree.ex | 0.927831 | 0.961353 | flattree.ex | starcoder |
defmodule JuliaPort do
@moduledoc """
example project to invoke julia functions in elixir to do scientific computing using port and metaprogramming
"""
alias JuliaPort.GenFunction
use GenFunction, rand: 2, sum: 1, *: 2
use GenFunction, init_network: 1, train: 3, net_eval: 2
use GenFunction, load_data: 1,... | lib/julia_port.ex | 0.757884 | 0.61855 | julia_port.ex | starcoder |
defmodule ExifParser do
@moduledoc """
Parse EXIF/TIFF metadata from JPEG and TIFF files.
Exif/TIFF referes to the metadata added to jpeg images. It is encoded as part of the jpeg file.
There are multiple so-called "Image File Directories" or IFD that store information about the image.
+ IFD0 generally store... | lib/exif_parser.ex | 0.674372 | 0.840848 | exif_parser.ex | starcoder |
defmodule RatchetWrench.Model do
@moduledoc """
Define struct module of record in database.
## Examples
```elixir
defmodule Data do
use RatchetWrench.Model
schema do
uuid :data_id
pk: [:data_id]
attributes data_id: {"STRING", nil},
string: {"STRING", ""},
... | lib/ratchet_wrench/model.ex | 0.743354 | 0.519887 | model.ex | starcoder |
defmodule Combinators do
@moduledoc """
This module provides fundamental combinators for matching and parsing
strings. All public functions in this module return a function which takes a
`State`, and optionally, a `label` and a `visitor` function.
`State`: struct with the original string and an offset from w... | lib/combinators.ex | 0.838382 | 0.873269 | combinators.ex | starcoder |
defmodule ID3.Picture do
@moduledoc """
A struct representing a picture in the ID3 tag.
See https://docs.rs/id3/0.3.0/id3/frame/struct.Picture.html
### PictureType
Due to limitations of `rust-id3`, multiple pictures with same `picture_type` is not available.
When writing, a picture with the same `picture_t... | lib/id3/picture.ex | 0.85186 | 0.511839 | picture.ex | starcoder |
defmodule GenRegex.Interpreter do
@moduledoc """
This is the interpreter module.
It reduces the parsed structures to string generator nodes, which in turn will be used to generate the final string.
"""
alias GenRegex.Generator
def read(ast, parent \\ nil), do: interpret(ast, parent)
defp interpret({:wo... | lib/grammar/interpreter.ex | 0.673621 | 0.64563 | interpreter.ex | starcoder |
defmodule LargeSort.Shared.IntegerFile do
alias LargeSort.Shared.IntegerFileBehavior
@behaviour IntegerFileBehavior
@moduledoc """
Contains functionality for working with integer files
"""
@doc """
Creates a stream for an integer file that operates in line mode
Any existing file will be overwritten.
... | largesort_shared/lib/integer_file.ex | 0.896455 | 0.538983 | integer_file.ex | starcoder |
defmodule Unicode.IndicSyllabicCategory do
@moduledoc """
Functions to introspect Unicode
indic syllabic categories for binaries
(Strings) and codepoints.
"""
@behaviour Unicode.Property.Behaviour
alias Unicode.Utils
@indic_syllabic_categories Utils.indic_syllabic_categories()
... | lib/unicode/indic_syllabic_category.ex | 0.892659 | 0.592195 | indic_syllabic_category.ex | starcoder |
defmodule Donut.GraphQL.Schema.Notation do
@moduledoc """
Sets up the notations for building an Absinthe schema.
"""
defmacro __using__(_options) do
quote do
use Absinthe.Schema.Notation, except: [resolve: 1]
import Donut.GraphQL.Schema.Notation, only: [
... | apps/donut_graphql/lib/donut.graphql/schema.notation.ex | 0.611614 | 0.421998 | schema.notation.ex | starcoder |
defmodule Bingo.GameServer do
@moduledoc """
A game server process that holds a `Game` struct as its state.
"""
use GenServer
require Logger
@timeout :timer.hours(2)
# Client (Public) Interface
@doc """
Spawns a new game server process registered under the given `game_name`.
"""
def start_lin... | apps/bingo/lib/bingo/game_server.ex | 0.817647 | 0.439026 | game_server.ex | starcoder |
defmodule LocationsWeb.GeoHelpers do
@moduledoc """
GEO helpers
"""
@doc """
Returns the type of the features for a location
"""
def get_feature_type(%{geo_features: features}) when length(features) > 1 do
:multiple_features
end
def get_feature_type(%{geo_features: features}) when length(feature... | lib/locations_web/geo_helpers/geo_helpers.ex | 0.828349 | 0.561185 | geo_helpers.ex | starcoder |
defmodule OpenTelemetry.Tracer do
@moduledoc """
This module contains macros for Tracer operations around the lifecycle of the Spans within a Trace.
The Tracer is able to start a new Span as a child of the active Span of the current process, set
a different Span to be the current Span by passing the Span's con... | apps/opentelemetry_api/lib/open_telemetry/tracer.ex | 0.692642 | 0.502075 | tracer.ex | starcoder |
defmodule Bertex do
@moduledoc """
This is a work TOTALLY based on @mojombo and @eproxus work:
More at: https://github.com/eproxus/bert.erl and http://github.com/mojombo/bert.erl
"""
import :erlang, only: [binary_to_term: 1,
binary_to_term: 2,
term_to_binary: ... | lib/bertex.ex | 0.758153 | 0.545407 | bertex.ex | starcoder |
defmodule Central.Helpers.QueryHelpers do
alias Central.Repo
import Ecto.Query, warn: false
defmacro stddev_pop(field) do
quote do
fragment("stddev_pop(?)", unquote(field))
end
end
defmacro between(field, low, high) do
quote do
fragment("? BETWEEN ? AND ?", unquote(field), unquote(lo... | lib/central/helpers/query_helpers.ex | 0.661158 | 0.538437 | query_helpers.ex | starcoder |
defmodule GoogleRoads do
@moduledoc """
Provides methods to interact with Google Roads API.
Unless otherwise noted, all the functions take the required Google
parameters as its own parameters, and all optional ones in an
`options` keyword list.
The `options` keyword can also take special entry for `heade... | lib/google_roads.ex | 0.907212 | 0.61891 | google_roads.ex | starcoder |
defmodule Mix.Tasks.Format do
use Mix.Task
@shortdoc "Formats the given files/patterns"
@moduledoc """
Formats the given files and patterns.
mix format mix.exs "lib/**/*.{ex,exs}" "test/**/*.{ex,exs}"
If any of the files is `-`, then the output is read from stdin
and written to stdout.
## Forma... | lib/mix/lib/mix/tasks/format.ex | 0.924167 | 0.583263 | format.ex | starcoder |
defmodule Cloak.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`.
## Configuration
In addition to the normal `:default` and `tag` configuration options, this
cipher take a `:keys` option to sup... | lib/cloak/ciphers/aes_gcm.ex | 0.900214 | 0.541045 | aes_gcm.ex | starcoder |
defmodule Monet.Writer do
@moduledoc """
Prepares and sends messages to the server. Should not be called directly from
outside this library.
"""
use Bitwise, only: [bsl: 2, bor: 1]
import Kernel, except: [send: 2] # resolve conflict
import Monet.Connection, only: [connection: 2]
@doc """
Sends `data` to the... | lib/writer.ex | 0.605333 | 0.458167 | writer.ex | starcoder |
defmodule AWS.Personalize do
@moduledoc """
Amazon Personalize is a machine learning service that makes it easy to add
individualized recommendations to customers.
"""
alias AWS.Client
alias AWS.Request
def metadata do
%AWS.ServiceMetadata{
abbreviation: nil,
api_version: "2018-05-22",
... | lib/aws/generated/personalize.ex | 0.882668 | 0.553385 | personalize.ex | starcoder |
defmodule ForgeSdk do
@moduledoc """
Forge is a full fledge blockchain framework for developers to build decentralized applications easily. Forge gives the developers / operators the freedom to launch their own customized chains with their own application logic.
This is the Elixir / Erlang version of the SDK fo... | lib/forge_sdk.ex | 0.881577 | 0.605974 | forge_sdk.ex | starcoder |
defmodule TaskBunny.Job do
@moduledoc """
Behaviour module for implementing a TaskBunny job.
TaskBunny job is an asynchronous background job whose execution request is
enqueued to RabbitMQ and performed in a worker process.
defmodule HelloJob do
use TaskBunny.Job
def perform(%{"name" =>... | lib/task_bunny/job.ex | 0.884146 | 0.533215 | job.ex | starcoder |
defmodule Q do
@moduledoc """
Documentation for Q ( Elixir Quantum module ).
"""
@doc """
|0> qubit = ( 1, 0 )
## Examples
iex> Q.q0.array
[ 1, 0 ]
"""
def q0, do: Numexy.new( [ 1, 0 ] )
@doc """
|1> qubit = ( 0, 1 )
## Examples
iex> Q.q1.array
[ 0, 1 ]
"""
def q1, do: Numexy.new( [ 0, 1 ] )
... | lib/q.ex | 0.660939 | 0.70581 | q.ex | starcoder |
defmodule AWS.SES do
@moduledoc """
Amazon Simple Email Service
This document contains reference information for the [Amazon Simple Email Service](https://aws.amazon.com/ses/) (Amazon SES) API, version 2010-12-01.
This document is best used in conjunction with the [Amazon SES Developer Guide](https://docs.aw... | lib/aws/generated/ses.ex | 0.824885 | 0.45417 | ses.ex | starcoder |
defmodule Kojin.Pod.PodObject do
@moduledoc """
Module for defining plain old data objects, independent of target language
"""
alias Kojin.Pod.{PodField, PodObject, PodTypeRef, PodTypes}
use TypedStruct
@typedoc """
A plain old data object, with an `id`, a `doc` comment and a
list of fields.
"""
... | lib/kojin/pod/pod_object.ex | 0.849082 | 0.553566 | pod_object.ex | starcoder |
defmodule Validation do
@moduledoc """
> **Easy. Simple. Powerful.**
>
> Elixir Validation library with +25 fully tested rules. *(+30 coming up soon!)*
[](https://travis-ci.org/elixir-validation/validation)
[![Build stat... | lib/validation.ex | 0.722233 | 0.887351 | validation.ex | starcoder |
defmodule Analytics.Mixpanel.Events do
@moduledoc """
This module provides a struct that accumulates user events and helper to submit data to Mixpanel.
"""
alias Analytics.Mixpanel.Events
@track_endpoint "track"
defstruct client: Analytics.Mixpanel.Client, events: [], distinct_id: nil, ip: nil, token: nil... | lib/analytics/mixpanel/events.ex | 0.873849 | 0.511595 | events.ex | starcoder |
defmodule Elm.Platform.Parser do
use Combine, parsers: [:text]
alias Data.Json.Decode
alias Data.Function
alias Elm.Docs.Binop
alias Elm.Docs.Value
alias Elm.Docs.Union
alias Elm.Docs.Alias
alias Elm.Docs.Module
alias Elm.Searchable
alias Elm.Version
alias Elm.Name
def module_name(text) do
... | lib/elm/platform/parser.ex | 0.651355 | 0.436202 | parser.ex | starcoder |
defmodule WorkTime do
@moduledoc """
Documentation for `WorkTime`.
"""
@doc """
## Examples
iex> WorkTime.parse("6:00 PM")
{:ok, %WorkTime{hour: 6, minute: 0, ampm: :PM}}
iex> WorkTime.parse("13:00 PM")
{:error, "hour greater than 12"}
"""
defstruct hour: nil,
mi... | lib/work_time.ex | 0.786008 | 0.430506 | work_time.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
Ama... | lib/aws/generated/cloudsearchdomain.ex | 0.858095 | 0.553867 | cloudsearchdomain.ex | starcoder |
defmodule HtmlSanitizeEx.Scrubber.HTML5 do
@moduledoc """
Allows all HTML5 tags to support user input.
Sanitizes all malicious content.
"""
require HtmlSanitizeEx.Scrubber.Meta
alias HtmlSanitizeEx.Scrubber.Meta
# Removes any CDATA tags before the traverser/scrubber runs.
Meta.remove_cdata_sections_b... | lib/html_sanitize_ex/scrubber/html5.ex | 0.538498 | 0.427815 | html5.ex | starcoder |
defmodule Timex.AmbiguousDateTime do
@moduledoc """
Represents a DateTime which is ambiguous due to timezone rules.
## Ambiguity #1 - Non-existent times
Let's use American daylight savings time rules as our example here,
using America/Chicago as our example. Central Standard Time for that
zone ends at 2:0... | lib/datetime/ambiguous.ex | 0.77081 | 0.749133 | ambiguous.ex | starcoder |
defmodule Defconst do
@moduledoc """
Define constants and enum with use in guards
## Define a contant
defmodule ConstType do
use Defconst
defconst :one, 1
defconst :two, 2
end
## Define an enum with default values
defmodule EnumType1 do
use Defconst
... | lib/defconst.ex | 0.782164 | 0.499512 | defconst.ex | starcoder |
defmodule ExHealth do
@moduledoc """
[](https://circleci.com/gh/Kartstig/ex_health/tree/master) [](https://codecov.io/gh/Kartstig... | lib/ex_health.ex | 0.756582 | 0.528351 | ex_health.ex | starcoder |
defmodule Statistics.Distributions.T do
alias Statistics.Math
alias Statistics.Math.Functions
@moduledoc """
Student's t distribution.
This distribution is always centered around 0.0 and allows a *degrees of freedom* parameter.
"""
@doc """
The probability density function
## Examples
iex> ... | lib/statistics/distributions/t.ex | 0.895657 | 0.698844 | t.ex | starcoder |
defmodule SpringConfig do
@moduledoc """
Consume configuration from a Spring Cloud Config Server in Elixir.
"""
use PatternTap
@default_opts []
@spec get(atom(), any(), keyword()) :: any()
@doc """
Finds and returns `key` in the configuration registry. If `key` is not found, `default` is returned.
... | lib/spring_config.ex | 0.801042 | 0.433262 | spring_config.ex | starcoder |
defmodule BinanceFutures.RateLimiter do
@moduledoc """
Rate Limiter handles Binance Futures API limits.
More info could be found here:
https://binance-docs.github.io/apidocs/futures/en/#limits
Binance API has two type of limits.
- `weight` limit - you have N available weight by IP address per time f... | lib/binance_futures/rate_limiter.ex | 0.854187 | 0.57687 | rate_limiter.ex | starcoder |
defmodule Glide do
@external_resource "README.md"
@moduledoc @external_resource
|> File.read!()
|> String.split("<!-- MDOC !-->")
|> Enum.fetch!(1)
@doc """
Create a value from a generator.
Mostly wraps StreamData or when the function exists any of the Glide generators... | lib/glide.ex | 0.779825 | 0.651909 | glide.ex | starcoder |
alias InterpreterTerms.SymbolMatch, as: Sym
alias InterpreterTerms.WordMatch, as: Word
defmodule GraphReasoner.QueryMatching.TriplesBlock do
@moduledoc """
Parses information from a TriplesBlock SymbolMatch.
The idea behind this module is to keep it as simple as possible,
mainly focussing on abstracting th... | lib/graph_reasoner/query_matching/triples_block.ex | 0.83762 | 0.541106 | triples_block.ex | starcoder |
defmodule Braintree.Transaction do
@moduledoc """
Create a new sale.
To create a transaction, you must include an amount and either a
payment_method_nonce or a payment_method_token.
https://developers.braintreepayments.com/reference/response/transaction/ruby
"""
use Braintree.Construction
alias Brai... | lib/transaction.ex | 0.905879 | 0.446434 | transaction.ex | starcoder |
defmodule FunLand.Mappable do
@moduledoc """
Something is Mappable if there is a way to map a function over it.
`mapping` means to apply a transformation to the contents, without changing the structure.
This module both contains the Mappable behaviour, which might be added
to your modules/structures by usi... | lib/fun_land/mappable.ex | 0.778565 | 0.733022 | mappable.ex | starcoder |
defmodule Staxx.Proxy.Chain.State do
@moduledoc """
Default chain process state
Chain process has it's own statuses a bit different to ExTestchain
When new chain process is spawning it's status is set to `:initializing` then flow is this:
`:initializing` -> `:ready` -> `:terminating` -> `:terminated`
So c... | apps/proxy/lib/proxy/chain/state.ex | 0.801742 | 0.590661 | state.ex | starcoder |
defmodule Ash.Filter.Runtime do
@moduledoc """
Checks a record to see if it matches a filter statement.
We can't always tell if a record matches a filter statement, and as such
this function may return `:unknown`
"""
alias Ash.Query.{Expression, Not, Ref}
@doc """
Checks if a record matches a filter, ... | lib/ash/filter/runtime.ex | 0.826537 | 0.591753 | runtime.ex | starcoder |
defmodule GCS do
@moduledoc """
A simple library to interact with Google Cloud Storage
"""
alias GCS.{Client, Auth}
require Logger
@make_public_body ~s({"role":"READER"})
@type headers :: [{String.t(), String.t()}]
@doc """
Uploads a file to GCS
Requires the bucket name, the desired gcs file locat... | lib/gcs.ex | 0.83975 | 0.548976 | gcs.ex | starcoder |
defmodule GenMetricsBench.Cluster do
alias GenMetrics.GenServer.Cluster
alias GenMetricsBench.GenServer.Server
alias GenMetricsBench.Utils.Runtime
@moduledoc """
GenMetricsBench harness for GenServer Clusters.
This module provides a simple benchmark harness to
load a simple GenServer with flexible mess... | lib/cluster.ex | 0.819893 | 0.508056 | cluster.ex | starcoder |
defmodule Tanx.Game.Walls do
@moduledoc """
Computes force on tanks due to walls.
"""
@doc """
Given a wall, returns a "decomposed" form of the wall that is preprocessed to
make force computation efficient.
The decomposed form is a list of tuples representing, in order, concave corners,
convex corners... | apps/tanx/lib/tanx/game/walls.ex | 0.867556 | 0.768928 | walls.ex | starcoder |
defmodule Grizzly.ZWave.Commands.WakeUpIntervalCapabilitiesReport do
@moduledoc """
This module implements the WAKE_UP_INTERVAL_CAPABILITIES_REPORT command of the COMMAND_CLASS_WAKE_UP command class.
Params:
* `:minimum_seconds` - the minimum Wake Up Interval supported by the sending node - v2
* `:maxim... | lib/grizzly/zwave/commands/wake_up_interval_capabilities_report.ex | 0.883532 | 0.415551 | wake_up_interval_capabilities_report.ex | starcoder |
defmodule Annex.Learner do
@moduledoc """
The Learner module defines the types, callbacks, and helper functions for a Learner.
A Learner is a model that is capable of supervised learning.
"""
alias Annex.{
Data,
Dataset,
LayerConfig,
Optimizer,
Optimizer.SGD
}
require Logger
@typ... | lib/annex/learner.ex | 0.809803 | 0.485051 | learner.ex | starcoder |
defmodule Chunky.Sequence.OEIS do
@moduledoc """
Online Encyclopedia of Integer Sequences (OEIS) sequence iterators.
Supported sequences are broken down into modules based on OEIS Keyword, subject matter, or
related methods.
## Available Modules
- `Chunky.Sequence.OEIS.Combinatorics` - Permutations, Co... | lib/sequence/oeis.ex | 0.894832 | 0.943712 | oeis.ex | starcoder |
defmodule Flume do
@moduledoc """
A convenient way to handle control flow in pipelines. This makes for easier reading and composability.
"""
@type t :: %__MODULE__{}
@type tag :: atom()
@type process_fun :: (map() -> {:ok, tag()} | {:error, atom()})
defstruct [
:halt_on_errors,
results: %{},
... | lib/flume.ex | 0.900351 | 0.480662 | flume.ex | starcoder |
defmodule Web.BulletinController do
use Web, :controller
alias ChallengeGov.Challenges
alias ChallengeGov.Challenges.Bulletin
alias ChallengeGov.GovDelivery
def new(conn, %{"challenge_id" => id}) do
%{current_user: user} = conn.assigns
with {:ok, challenge} <- Challenges.get(id),
{:ok, cha... | lib/web/controllers/bulletin_controller.ex | 0.517083 | 0.408483 | bulletin_controller.ex | starcoder |
defmodule Collections.Heap do
defstruct data: nil, size: 0, comparator: nil
@moduledoc """
Leftist heap implemention in Elixir
See also: [Leftist Tree](https://en.wikipedia.org/wiki/Leftist_tree)
Time complexity
* `&peek/2` : O(1)
* `&push/2` : O(logn)
* `&pop/2` : O(logn)
* `&size/1` ... | lib/heap/heap.ex | 0.92964 | 0.702677 | heap.ex | starcoder |
defmodule ExTorch.Native.Macros do
@moduledoc """
General purpose macros to automatically generate binding declarations and calls
for both ExTorch callable functions and Rustler signature calls to the NIF library.
"""
@doc """
Automatic binding generation.
This macro allow to define a bindings block und... | lib/extorch/native/macros.ex | 0.925911 | 0.63799 | macros.ex | starcoder |
defmodule Site.TripPlan.Map do
alias Leaflet.{MapData, MapData.Marker}
alias Leaflet.MapData.Polyline, as: LeafletPolyline
alias GoogleMaps
alias Routes.Route
alias TripPlan.{Leg, NamedPosition, TransitDetail}
alias Util.Position
@type static_map :: String.t()
@type t :: {MapData.t(), static_map}
@ty... | apps/site/lib/site/trip_plan/map.ex | 0.820901 | 0.51879 | map.ex | starcoder |
defmodule Freddy.Consumer do
@moduledoc """
This module allows to consume messages from specified queue bound to specified exchange.
## Configuration
* `:exchange` - specifies an exchange to declare. See `Freddy.Core.Exchange` for available
options. Optional.
* `:queue` - specifies a queue to decl... | lib/freddy/consumer.ex | 0.927683 | 0.500427 | consumer.ex | starcoder |
defmodule Zippex do
@moduledoc """
A Zipper is a representation of an aggregate data structure which
allows it to be traversed and updated arbitrarily. This module
implements tree-like semantics for traversing a data structure.
## Focus
The current node of the zipper, also known as the focus node, can be
... | lib/zippex.ex | 0.953827 | 0.880489 | zippex.ex | starcoder |
defmodule Machinery.Plug do
@moduledoc """
This Plug module is the entry point for the Machinery Dashboard.
It's supposed to be used on the Endpoint of a Phoenix application,
and it's responsible to call the Machinery.Endpoint.
You're expected to use this as a plug on the main application, and it also
acce... | lib/machinery/plug.ex | 0.841077 | 0.751329 | plug.ex | starcoder |
defmodule StrawHat.Map.States do
@moduledoc """
States management use cases.
"""
import Ecto.Query
alias StrawHat.{Error, Response}
alias StrawHat.Map.{City, County, State}
@spec get_states(Ecto.Repo.t(), Scrivener.Config.t()) :: Scrivener.Page.t()
def get_states(repo, pagination \\ []) do
Scriven... | lib/straw_hat_map/world/states/states_use_cases.ex | 0.716913 | 0.401776 | states_use_cases.ex | starcoder |
defmodule Runlet.CLI do
@moduledoc "Compile runlet expresions"
@type t :: {[atom], atom} | {{[atom], atom}, [String.t() | integer]}
@type e :: String.t() | [t]
@spec aliases() :: [t]
def aliases(), do: Runlet.Config.get(:runlet, :aliases, [])
def exec(ast), do: exec!(ast, [])
def exec(ast, bind), do: e... | lib/runlet/cli.ex | 0.800926 | 0.640102 | cli.ex | starcoder |
defmodule Bunt.ANSI.Sequence do
@moduledoc false
defmacro defalias(alias_name, original_name) do
quote bind_quoted: [alias_name: alias_name, original_name: original_name] do
def unquote(alias_name)() do
unquote(original_name)()
end
defp format_sequence(unquote(alias_name)) do
... | deps/bunt/lib/bunt_ansi.ex | 0.658198 | 0.416025 | bunt_ansi.ex | starcoder |
defmodule VSCodeExUnitFormatter do
@moduledoc false
use GenServer
alias VSCodeExUnitFormatter.VsSuite
alias VSCodeExUnitFormatter.VsTestCase
@impl GenServer
def init(_opts) do
root_test_suite = %VsSuite{id: "root", label: "ExUnit"}
{:ok, root_test_suite}
end
@impl GenServer
def handle_cast(... | lib/vs_code_ex_unit_formatter.ex | 0.625324 | 0.439747 | vs_code_ex_unit_formatter.ex | starcoder |
defmodule Numy.Enumy do
@moduledoc """
Extend Enum for homogeneous enumerables.
"""
@doc """
Check if all elements of a list are integers.
## Examples
iex(1)> import Numy.Enumy
Numy.Enumy
iex(2)> all_integers?([1, 2, 3])
true
iex(3)> all_integers?([1.1, 2, 3])
false
... | lib/enumy.ex | 0.901299 | 0.50653 | enumy.ex | starcoder |
defmodule CRC.Legacy do
@moduledoc false
# Legacy CRC functions, these may be depraced in a future release and removed in v1.0 - RN
defmacro __using__(_) do
quote do
@doc """
Calculates a 8-bit CRC with polynomial x^8+x^6+x^3+x^2+1, 0x14D.
Chosen based on Koopman... | lib/crc/legacy.ex | 0.821152 | 0.561185 | legacy.ex | starcoder |
defmodule Episode do
defstruct [:show, :title, :season, :episode, :download_url]
@type t :: %Episode {
show: Show.t,
title: String.t,
season: pos_integer,
episode: pos_integer,
download_url: String.t
}
@doc """
iex> parse_title("S01E02.HR-HDTV.AC3.1024X576.x264.mkv")
[season: 1, ep... | apps/harvester/lib/episode.ex | 0.735547 | 0.442034 | episode.ex | starcoder |
defmodule Annex.Data do
@moduledoc """
Annex.Data defines the callbacks and helpers for data structures used
by Annex.
An implementer of the Annex.Layer behaviour must return an Annex.Data
implementer from the `c:data_type/0` callback.
"""
alias Annex.{
AnnexError,
Data,
Data.List1D,
Data... | lib/annex/data.ex | 0.840815 | 0.701355 | data.ex | starcoder |
defmodule Expected.Plugs do
@moduledoc """
Plugs for registering logins and authenticating persistent cookies.
## Requirements
For the plugs in this module to work, you must plug `Expected` in your
endpoint:
plug Expected
As `Expected` calls `Plug.Session` itself, you must not plug it in your
en... | lib/expected/plugs.ex | 0.839537 | 0.413714 | plugs.ex | starcoder |
defmodule Timber.Context do
@moduledoc """
The ContextEntry module formalizes the structure of context stack entries
Most users will not interact directly with this module and will instead use
the helper functions provided by the main `Timber` module. See the `Timber`
module for more information.
The func... | lib/timber/context.ex | 0.786008 | 0.442998 | context.ex | starcoder |
defmodule Mix.Tasks.Yuki.Test do
@shortdoc "Tests all testcase"
@moduledoc """
Tests your source code for the specified problem.
From mix task:
mix yuki.test NO [--problem-id] [--lang LANG] [--source SOURCE] [--time-limit TIME_LIMIT] [--module MODULE]
From escript:
yuki test NO [--problem-id] ... | lib/mix/tasks/yuki.test.ex | 0.795777 | 0.49109 | yuki.test.ex | starcoder |
defmodule DgraphEx.Core.Expr.Uid do
@moduledoc """
https://docs.dgraph.io/query-language/#uid
Syntax Examples:
q(func: uid(<uid>))
predicate @filter(uid(<uid1>, ..., <uidn>))
predicate @filter(uid(a)) for variable a
q(func: uid(a,b)) for variables a and b
"""
alias DgraphEx.Util
defstruc... | lib/dgraph_ex/core/expr/uid.ex | 0.841533 | 0.541227 | uid.ex | starcoder |
defmodule AdventOfCode.Day14 do
@moduledoc ~S"""
[Advent Of Code day 14](https://adventofcode.com/2018/day/14).
"""
defmodule Recipes do
use GenServer
defstruct [:scores, :elves, :last_index, :iterations]
@type t :: %__MODULE__{scores: Map.t(), elves: [non_neg_integer], last_index: non_neg_integer... | lib/advent_of_code/day_14.ex | 0.707203 | 0.547162 | day_14.ex | starcoder |
defmodule AbtDid.Type do
@moduledoc """
Represents the type of the DID. A DID is composed of three inner types: `role_type`, `key_type` and `hash_type`.
"""
use TypedStruct
typedstruct do
field(:role_type, atom(), default: :account)
field(:key_type, atom(), default: :ed25519)
field(:hash_type, a... | lib/type_bytes.ex | 0.860266 | 0.560614 | type_bytes.ex | starcoder |
defmodule Keypad do
@moduledoc """
`keypad` is implemented as a `__using__` macro so that you can put it in any module you want
to handle the keypress events. Because it is small GenServer, it [accepts the same options for supervision](https://hexdocs.pm/elixir/GenServer.html#module-how-to-supervise)
to configu... | lib/keypad.ex | 0.887497 | 0.882984 | keypad.ex | starcoder |
defmodule Wand.CLI.Commands.Add do
use Wand.CLI.Command
@moduledoc """
# Add
Add elixir packages to wand.json
### Usage
**wand** add [package] [package] ... [flags]
Wand can be used to add packages from three different places: hex, git, or the local filesystem. [package] can either be the name, or name... | lib/cli/commands/add.ex | 0.807688 | 0.862583 | add.ex | starcoder |
defmodule SmsPartCounter do
@moduledoc """
Module for detecting which encoding is being used and the character count of SMS text.
"""
gsm_7bit_ext_chars =
"@£$¥èéùìòÇ\nØø\rÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !\"#¤%&'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà" <>
"^{}\\[~]|€... | lib/sms_part_counter.ex | 0.635901 | 0.432183 | sms_part_counter.ex | starcoder |
defmodule Logger.Backends.Gelf do
@moduledoc """
Gelf Logger Backend
# GelfLogger [](https://travis-ci.org/jschniper/gelf_logger)
A logger backend that will generate Graylog Extended Log Format messages. The
current version only su... | lib/gelf_logger.ex | 0.779783 | 0.806091 | gelf_logger.ex | starcoder |
defmodule Neotomex.ExGrammar do
@moduledoc """
## Neotomex.ExGrammar
ExGrammar provides an interface for defining a PEG from within an
Elixir module.
For example:
defmodule Number do
use Neotomex.ExGrammar
@root true
define :digits, "[0-9]+" do
digits when is_list(d... | lib/neotomex/exgrammar.ex | 0.663669 | 0.689371 | exgrammar.ex | starcoder |
defmodule ExWeb3EcRecover.SignedType do
@moduledoc """
This module was written based on nomenclature
and algorithm specified in the [EIP-712](https://eips.ethereum.org/EIPS/eip-712#specification)
"""
defmodule Encoder do
@moduledoc false
@callback encode_value(value :: any(), type :: String.t()) :: b... | lib/ex_web3_ec_recover/signed_type.ex | 0.774328 | 0.747455 | signed_type.ex | starcoder |
defmodule Chunkr do
@external_resource "README.md"
@moduledoc "README.md"
|> File.read!()
|> String.split("<!-- MDOC !-->")
|> Enum.fetch!(1)
alias Chunkr.{Cursor, Opts, Page}
@doc false
defmacro __using__(opts) do
quote do
@default_chunkr_opts unquote(opts) ... | lib/chunkr.ex | 0.797951 | 0.427875 | chunkr.ex | starcoder |
defmodule Play.Asteroid do
@moduledoc """
Represents an asteroid in the game
"""
defstruct [:id, :t, :direction, :speed, :color, :size]
alias Scenic.Math.Vector2
alias Play.Asteroid
@type t :: %__MODULE__{
id: Play.ScenicEntity.id(),
t: Play.Scene.Asteroids.coords(),
direct... | scenic_asteroids/play/lib/play/asteroid.ex | 0.849862 | 0.613179 | asteroid.ex | starcoder |
defmodule Phoenix.Presence do
@moduledoc """
Provides Presence tracking to processes and channels.
This behaviour provides presence features such as fetching
presences for a given topic, as well as handling diffs of
join and leave events as they occur in real-time. Using this
module defines a supervisor an... | lib/phoenix/presence.ex | 0.928206 | 0.692609 | presence.ex | starcoder |
defmodule Sanbase.Cryptocompare.HistoricalWorker do
@moduledoc ~s"""
An Oban Worker that processes the jobs in the cryptocompare_historical_jobs_queue
queue.
An Oban Worker has one main function `perform/1` which receives as argument
one record from the oban jobs table. If it returns :ok or {:ok, _}, then th... | lib/sanbase/cryptocompare/workers/historical_worker.ex | 0.668015 | 0.425247 | historical_worker.ex | starcoder |
defmodule AWS.DirectoryService do
@moduledoc """
AWS Directory Service
AWS Directory Service is a web service that makes it easy for you to setup
and run directories in the AWS cloud, or connect your AWS resources with an
existing on-premises Microsoft Active Directory. This guide provides
detailed inform... | lib/aws/directory_service.ex | 0.873754 | 0.565239 | directory_service.ex | starcoder |
alias Plug.Conn.Unfetched
defmodule Plug.Conn do
@moduledoc """
The Plug connection.
This module defines a `Plug.Conn` struct and the main functions
for working with Plug connections.
Note request headers are normalized to lowercase and response
headers are expected to have lower-case keys.
## Request... | deps/plug/lib/plug/conn.ex | 0.94049 | 0.748915 | conn.ex | starcoder |
defmodule ShopifyAPI.Plugs.CustomerAuthenticator do
@moduledoc """
The Shopify.Plugs.CustomerAuthenticator plug allows for authentication of a customer call being made from a Shopify shop with a signed payload.
## Liquid Template
You can create the payload and signature that this plug will consume with the fo... | lib/shopify_api/plugs/customer_authenticator.ex | 0.844313 | 0.772574 | customer_authenticator.ex | starcoder |
defmodule ConfigCat.CachePolicy do
@moduledoc """
Represents the [polling mode](https://configcat.com/docs/sdk-reference/elixir#polling-modes) used by ConfigCat.
The *ConfigCat SDK* supports 3 different polling mechanisms to
acquire the setting values from *ConfigCat*. After the latest
setting values are dow... | lib/config_cat/cache_policy.ex | 0.907284 | 0.825519 | cache_policy.ex | starcoder |
defmodule Pets do
@moduledoc """
A generic datastore using PersistentEts.
Most Pets functions take a `signature` as the first argument, which
identifies a specific Pets datastore.
The signature is simply a map with two fields:
- tablekey - an atom which identifies the underlying ETS table
- filepath ... | lib/pets.ex | 0.743075 | 0.947186 | pets.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.