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 Ueberauth.Strategy.Exact do
@moduledoc """
Provides an Ueberauth strategy for authenticating with Exact Online.
### Setup
Create an application in Exact for you to use.
Register a new application at: [Exact App Center](https://apps.exactonline.com)
and get the `client_id` and `client_secret`.
... | lib/ueberauth/strategy/exact.ex | 0.805173 | 0.466603 | exact.ex | starcoder |
defmodule RayTracer.Sphere do
@moduledoc """
This module defines sphere operations
"""
alias RayTracer.Shape
alias RayTracer.RTuple
alias RayTracer.Matrix
alias RayTracer.Material
alias RayTracer.Intersection
use Shape, [
center: RTuple.point(0, 0, 0),
r: 1
]
import RTuple, only: [sub: ... | lib/sphere.ex | 0.91256 | 0.606003 | sphere.ex | starcoder |
defmodule ARI.HTTP.Recordings do
@moduledoc """
HTTP Interface for CRUD operations on Recording objects
REST Reference: https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Recordings+REST+API
Live Recording Object: https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+REST+Data+Models#Asterisk18RESTDataMo... | lib/ex_ari/http/recordings.ex | 0.777722 | 0.406626 | recordings.ex | starcoder |
defmodule Data.Stats do
@moduledoc """
Item statistics
"""
import Data.Type
@type character :: %{
health_points: integer(),
max_health_points: integer(),
skill_points: integer(),
max_skill_points: integer(),
endurance_points: integer(),
max_enduran... | lib/data/stats.ex | 0.8415 | 0.485722 | stats.ex | starcoder |
defmodule VintageNet.Interface.IfupDaemon do
@moduledoc """
Wrap MuonTrap.Daemon to start and stop a program based on whether the network is up
Unlike MuonTrap.Daemon, the arguments are called out in the child_spec so it looks like
this:
```
{VintageNet.Interface.IfupDaemon, ifname: ifname, command: progr... | lib/vintage_net/interface/ifup_daemon.ex | 0.730578 | 0.659816 | ifup_daemon.ex | starcoder |
Code.require_file("../util/util.ex", __DIR__)
defmodule Day03 do
def parse_pathdir(tok) do
{dir, num} = String.split_at(tok, 1)
{String.to_existing_atom(dir), Integer.parse(num) |> elem(0)}
end
def parse_path(line) do
line
|> String.codepoints
|> Util.stream_comma_seperated
|> Stream.ma... | day03/el.ex | 0.524882 | 0.602442 | el.ex | starcoder |
defmodule Alchemy.Voice do
@moduledoc """
Contains the types and functions related to voice communication with discord.
To use the functions in this module, make sure to configure the paths
to `ffmpeg`, as well as `youtube-dl`, like so:
```elixir
config :alchemy,
ffmpeg_path: "path/to/ffmpeg"
youtu... | lib/Structs/Voice/voice.ex | 0.89353 | 0.804866 | voice.ex | starcoder |
defmodule AWS.ElasticTranscoder do
@moduledoc """
AWS Elastic Transcoder Service
The AWS Elastic Transcoder Service.
"""
@doc """
The CancelJob operation cancels an unfinished job.
You can only cancel a job that has a status of `Submitted`. To prevent a
pipeline from starting to process a job while ... | lib/aws/generated/elastic_transcoder.ex | 0.827166 | 0.452838 | elastic_transcoder.ex | starcoder |
defmodule Cldr.Calendar.Format do
@moduledoc """
Formatting functions for calendars
"""
alias Cldr.Calendar.Formatter.Options
@default_format_module Cldr.Calendar.Formatter.HTML.Basic
def default_formatter_module do
@default_format_module
end
@default_calendar_css_class "cldr_calendar"
def def... | lib/format.ex | 0.924883 | 0.627595 | format.ex | starcoder |
defmodule Bitcoin.Protocol.Types.NetworkAddress do
defstruct time: 0, # (uint32) the Time (version >= 31402). Not present in version message.
services: <<0, 0, 0, 0, 0, 0, 0, 0>>, # (uint64_t) bitfield of features to be enabled for this connection. See Version Message.
address: {0, 0, 0, 0}, ... | lib/bitcoin/protocol/types/network_address.ex | 0.594669 | 0.426501 | network_address.ex | starcoder |
defmodule Makeup.Lexer.Combinators do
@moduledoc """
Common components useful in many lexers.
"""
import NimbleParsec
@doc """
Wraps the given combinator into a token of the given `ttype`.
Instead of a combinator, the first argument can also be a string literal.
"""
def token(literal, token_type) wh... | lib/makeup/lexer/combinators.ex | 0.91321 | 0.486575 | combinators.ex | starcoder |
defmodule Code.Typespec do
@moduledoc false
@doc """
Converts a spec clause back to Elixir quoted expression.
"""
@spec spec_to_quoted(atom, tuple) :: {atom, keyword, [Macro.t()]}
def spec_to_quoted(name, spec)
def spec_to_quoted(name, {:type, line, :fun, [{:type, _, :product, args}, result]})
whe... | lib/elixir/lib/code/typespec.ex | 0.73077 | 0.446133 | typespec.ex | starcoder |
defmodule Supervisor do
@moduledoc ~S"""
A behaviour module for implementing supervision functionality.
A supervisor is a process which supervises other processes, which we refer
to as *child processes*. Supervisors are used to build a hierarchical process
structure called a *supervision tree*. Supervision t... | lib/elixir/lib/supervisor.ex | 0.766818 | 0.606265 | supervisor.ex | starcoder |
defmodule Drab.Core do
@moduledoc ~S"""
Drab module providing the base of communication between the browser and the server.
`Drab.Core` defines the method to declare client-side events, which are handled server-side in
the commander module. Also provides basic function for running JS code directly from Phoenix... | lib/drab/core.ex | 0.749087 | 0.431584 | core.ex | starcoder |
defmodule RTypes.Generator do
@moduledoc """
Generator module provides the `make/4` function and `make/2` macro
which allow to automatically derive a data generator to be used with
property-based frameworks.
For example, to write a unit test for a pure function with a given
spec to use with `StreamData` fr... | lib/rtypes/generator.ex | 0.934806 | 0.958499 | generator.ex | starcoder |
defmodule Control.Access do
import Kernel, except: [get_in: 2, update_in: 3, get_and_update_in: 3, pop_in: 2]
#defdelegate at(idx), to: Access
#defdelegate elem(idx), to: Access
defdelegate key(k, default \\ nil), to: Access
defdelegate key!(k), to: Access
defdelegate fetch(t, k), to: Access
defdelegate... | lib/control/access.ex | 0.503174 | 0.605099 | access.ex | starcoder |
defmodule OMG.Eth do
@moduledoc """
Library for common code of the adapter/port to contracts deployed on Ethereum.
NOTE: The library code is not intended to be used outside of `OMG.Eth`: use `OMG.Eth.RootChain` and `OMG.Eth.Token` as main
entrypoints to the contract-interaction functionality.
NOTE: This wr... | apps/omg_eth/lib/eth.ex | 0.884598 | 0.522872 | eth.ex | starcoder |
defmodule Phoenix.Tracker.DeltaGeneration do
@moduledoc false
require Logger
alias Phoenix.Tracker.{State, Clock, Replica}
@doc """
Extracts minimal delta from generations to satisfy remote clock.
Falls back to extracting entire crdt if unable to match delta.
"""
@spec extract(State.delta, [State.delt... | deps/phoenix_pubsub/lib/phoenix/tracker/delta_generation.ex | 0.728072 | 0.50354 | delta_generation.ex | starcoder |
defmodule Spf.Lexer do
@moduledoc """
Lexer for SPF strings and explain-strings.
See [the collected ABNF](https://www.rfc-editor.org/rfc/rfc7208.html#section-12).
"""
@typedoc """
qualifier = ?+ / ?- / ?~ / ??
"""
@type q :: ?+ | ?- | ?~ | ??
@typedoc """
`range` denotes a token's `start..stop`-... | lib/spf/lexer.ex | 0.888922 | 0.648132 | lexer.ex | starcoder |
defmodule Params.Schema do
@moduledoc ~S"""
Defines a params schema for a module.
A params schema is just a map where keys are the parameter name
(ending with a `!` to mark the parameter as required) and the
value is either a valid Ecto.Type, another map for embedded schemas
or an array of those.
## Exa... | lib/params/schema.ex | 0.830457 | 0.769037 | schema.ex | starcoder |
defmodule Graph.Pathfinding do
@moduledoc """
This module contains implementation code for path finding algorithms used by `libgraph`.
"""
import Graph.Utils, only: [vertex_id: 1, edge_weight: 3]
@type heuristic_fun :: ((Graph.vertex) -> integer)
@doc """
Finds the shortest path between `a` and `b` as a... | lib/graph/pathfinding.ex | 0.895323 | 0.688763 | pathfinding.ex | starcoder |
defmodule Mix.Releases.Appup.Utils do
@moduledoc false
@purge_modes [:soft_purge, :brutal_purge]
@doc """
Given a list of appup instructions, this function determines if they are valid or not,
returning `:ok` if they are valid, or `{:invalid, term}` if not, where the term in that
tuple is the invalid inst... | lib/mix/lib/releases/appup/utils.ex | 0.828973 | 0.498657 | utils.ex | starcoder |
defmodule Pseudoloc do
@moduledoc """
Creates a [pseudolocalized](https://en.wikipedia.org/wiki/Pseudolocalization) translation of
`Gettext` data files.
Because this module is designed to work with `Gettext`, it specifically ignores
[interpolated](https://hexdocs.pm/gettext/Gettext.html#module-interpolation)... | lib/pseudoloc.ex | 0.928457 | 0.942823 | pseudoloc.ex | starcoder |
defmodule Turtle.Vector do
@moduledoc """
2D Vector operations
"""
@type t :: {number(), number()}
@doc """
Returns a new 2D Vector
## Examples
iex> Turtle.Vector.new(1, 2)
{1, 2}
"""
@spec new(number(), number()) :: t()
def new(x, y), do: {x, y}
@doc """
Returns the 2D point a... | turtle/lib/turtle/vector.ex | 0.951515 | 0.877319 | vector.ex | starcoder |
defmodule MapBasedLruCacheLib do
@moduledoc """
in simplest mode like SimpleLruCacheLib we used array
to store keys which used by cache, and the problem
was this method does not provide good search, because
in the time we want change recently updated key we should
whole of array to find target key and remov... | apps/lru_cache_lib/lib/map_based_lru_cache_lib.ex | 0.716913 | 0.580174 | map_based_lru_cache_lib.ex | starcoder |
defmodule AdventOfCode.Solutions.DayOne do
@input "L5, R1, L5, L1, R5, R1, R1, L4, L1, L3, R2, R4, L4, L1, L1, R2, R4, R3, L1, R4, L4, L5, L4, R4, L5, R1, R5, L2, R1, R3, L2, L4, L4, R1, L192, R5, R1, R4, L5, L4, R5, L1, L1, R48, R5, R5, L2, R4, R4, R1, R3, L1, L4, L5, R1, L4, L2, L5, R5, L2, R74, R4, L1, R188, R5, L... | lib/solutions/day_one.ex | 0.690663 | 0.733881 | day_one.ex | starcoder |
defmodule Routemaster.Drain.EventState do
@moduledoc """
Persisted data.
Each `EventState` is associated to the URL of a resource and
stores the timestamp of the latest Drain event received for
that URL.
They are stored in Redis, with the URL acting as key.
They are used to keep track of the most recen... | lib/routemaster/drain/event_state.ex | 0.683102 | 0.502991 | event_state.ex | starcoder |
defmodule CoAP.Block do
defstruct number: 0, more: false, size: 0
@type t :: %__MODULE__{number: integer, more: boolean, size: integer}
@type tuple_t :: {integer, boolean, integer}
@type binary_t_small :: <<_::8>>
@type binary_t_medium :: <<_::16>>
@type binary_t_large :: <<_::32>>
@type binary_t :: bina... | lib/coap/block.ex | 0.552902 | 0.626481 | block.ex | starcoder |
defmodule Filtrex do
@moduledoc """
Filtrex consists of the following primary components:
* `Filtrex` - handles the overall parsing of filters and delegates to
`Filtrex.AST` to build an ecto query expression
* `Filtrex.Condition` - an abstract module built to delegate to specific condition modules i... | lib/filtrex.ex | 0.874379 | 0.910027 | filtrex.ex | starcoder |
defmodule AWS.ComputeOptimizer do
@moduledoc """
AWS Compute Optimizer is a service that analyzes the configuration and
utilization metrics of your AWS resources, such as EC2 instances and Auto
Scaling groups. It reports whether your resources are optimal, and
generates optimization recommendations to reduce... | lib/aws/generated/compute_optimizer.ex | 0.902218 | 0.666999 | compute_optimizer.ex | starcoder |
defmodule ExPng.Chunks.Header do
@moduledoc """
Stores the data collected from a PNG's header data chunk. This chunk enodes
information about
* the image's width and height
* the bit_depth of encoded pixel data
* the color mode the image pixel data is stored in
* whether the image data has been i... | lib/ex_png/chunks/header.ex | 0.9118 | 0.786418 | header.ex | starcoder |
defmodule FakeServer.HTTP.Response do
@moduledoc """
Response structure
FakeServer makes use of the FakeServer.HTTP.Response structure to define the responses that will be given by the server.
The structure has the following fields:
- `:code`: The status code of the response. It must be an integer.
-... | lib/fake_server/http/response.ex | 0.898923 | 0.756807 | response.ex | starcoder |
defmodule OsrsEx.Hiscores.Hiscore do
@moduledoc "A struct representing a player's hiscores."
alias OsrsEx.Hiscores.{Skill, Activity}
defstruct [
:overall,
:attack,
:defence,
:strength,
:hitpoints,
:ranged,
:prayer,
:magic,
:cooking,
:woodcutting,
:fletching,
:fish... | lib/hiscores/hiscore.ex | 0.777722 | 0.449211 | hiscore.ex | starcoder |
defmodule Subscribex do
@moduledoc """
Subscribex is a simple way to interface with RabbitMQ. It's split into 2 main
components:
* `Subscribex.Broker` — Brokers are wrappers around the RabbitMQ instance.
Actions go through the broker to get to the connection.
* `Subscribex.Subscriber` — Subscribers ... | lib/subscribex.ex | 0.815159 | 0.542924 | subscribex.ex | starcoder |
defmodule Ockam.Examples.Delivery do
@moduledoc """
Examples of using delivery pipe
Creates a filter worker to lose messages
Sends messages through filter and through filter wrapped in a delivery pipe
Returns a sequence of messages received with unreliable delivety (through filter)
and reliable delivery (... | implementations/elixir/ockam/ockam/lib/ockam/examples/messaging/delivery.ex | 0.873174 | 0.467514 | delivery.ex | starcoder |
defmodule Timex.Parsers.DateFormat.Tokenizers.Strftime do
@moduledoc """
Responsible for tokenizing date/time format strings
which use the strftime formatter.
"""
alias Timex.Parsers.DateFormat.ParserState, as: State
alias Timex.Parsers.DateFormat.Directive, as: Directive
# These are all the strftime f... | lib/parsers/dateformat/tokenizers/strftime.ex | 0.779741 | 0.424412 | strftime.ex | starcoder |
defmodule Kitto.Job.DSL do
@moduledoc """
A DSL to define jobs populating the widgets with data.
"""
alias Kitto.Job
alias Kitto.Notifier
@doc false
defmacro __using__(_opts) do
quote do
import Kitto.Job.DSL
import Kitto.Notifier, only: [broadcast!: 2]
end
end
@doc """
Main AP... | lib/kitto/job/dsl.ex | 0.794106 | 0.405419 | dsl.ex | starcoder |
defmodule Linkify do
@moduledoc """
Create url links from text containing urls.
Turns an input string like `"Check out google.com"` into
`Check out "<a href=\"http://google.com\">google.com</a>"`
## Examples
iex> Linkify.link("google.com")
~s(<a href="http://google.com">google.com</a>)
i... | lib/linkify.ex | 0.838911 | 0.487612 | linkify.ex | starcoder |
defmodule Wallaby.Phantom do
@moduledoc """
Wallaby driver for PhantomJS.
## Usage
Start a Wallaby Session using this driver with the following command:
```
{:ok, session} = Wallaby.start_session()
```
## Notes
This driver requires PhantomJS be installed in your path. You can install PhantomJS th... | lib/wallaby/phantom.ex | 0.771542 | 0.579192 | phantom.ex | starcoder |
defmodule Cure do
use Application
@moduledoc """
The main Cure module. Provides a few functions to easily start a connection
with a C/C++ program, to send messages to the program and to handle the
incoming responses.
"""
@doc """
Starts the Cure application, returns the Cure.Supervisor-PID.
"""
@s... | lib/cure.ex | 0.802981 | 0.559952 | cure.ex | starcoder |
defmodule DBConnection.LogEntry do
@moduledoc """
Struct containing log entry information.
"""
defstruct [:call, :query, :params, :result, :pool_time, :connection_time,
:decode_time]
@typedoc """
Log entry information.
* `:call` - The `DBConnection` function called
* `:query` - The query used... | deps/db_connection/lib/db_connection/log_entry.ex | 0.868353 | 0.499023 | log_entry.ex | starcoder |
defmodule ConnAudit do
@moduledoc """
This application provides a simple implementation for login brute force protection.
The two components for this are the Verification Plug macro and the Auditing API.
You can check out the sections below for more information on each component.
This application isn't mean... | lib/conn_audit.ex | 0.719088 | 0.946794 | conn_audit.ex | starcoder |
defmodule AutoLinker do
@moduledoc """
Create url links from text containing urls.
Turns an input string like `"Check out google.com"` into
`Check out "<a href='http://google.com' target='_blank' rel='noopener noreferrer'>google.com</a>"`
## Examples
iex> AutoLinker.link("google.com")
"<a href=... | lib/auto_linker.ex | 0.818374 | 0.542682 | auto_linker.ex | starcoder |
defmodule GenRetry do
@moduledoc ~s"""
GenRetry provides utilities for retrying Elixir functions,
with configurable delay and backoff characteristics.
## Summary
Given a 0-arity function which raises an exception upon failure, `retry/2`
and `retry_link/2` repeatedly executes the function until success is
... | lib/gen_retry.ex | 0.875674 | 0.505066 | gen_retry.ex | starcoder |
defmodule DivoVernemq do
@moduledoc """
Defines a single-node "cluster" vernemq broker
as a map compatible with divo for building a
docker-compose file.
"""
@behaviour Divo.Stack
@doc """
Implements the Divo Stack behaviour to take a
keyword list of defined variables specific to
the DivoVernemq st... | lib/divo_vernemq.ex | 0.690142 | 0.610366 | divo_vernemq.ex | starcoder |
defmodule Mix.Tasks.EqcCI do
use Mix.Task
@shortdoc "Create a project's properties for QuickCheck-CI"
@recursive true
@moduledoc """
Create the properties for a project.
This task mimics `mix test` but compiles the test files to beam instead of in
memory and does not execute the tests or properties.
... | lib/mix/tasks/mix_eqcci.ex | 0.827166 | 0.448547 | mix_eqcci.ex | starcoder |
defmodule ExPesel do
@moduledoc """
Library for PESEL number.
* `ExPesel.valid?/1` - you can check if PESEL number is valid
* `ExPesel.valid_with?/2` - you can check if PESEL number is valid with additional check about sex or birthdate
* `ExPesel.birthdate/1` - you can obtain date of birth from PESEL number
... | lib/ex_pesel.ex | 0.849129 | 0.646035 | ex_pesel.ex | starcoder |
defmodule State.Route do
@moduledoc """
Stores and indexes `Model.Route.t` from `routes.txt`.
"""
use State.Server,
indices: [:id, :type, :line_id],
parser: Parse.Routes,
recordable: Model.Route
alias Events.Gather
@impl GenServer
def init(_) do
_ = super(nil)
subscriptions = [{:fe... | apps/state/lib/state/route.ex | 0.812347 | 0.402421 | route.ex | starcoder |
defmodule Nx.Type do
@moduledoc """
Conveniences for working with types.
A type is a two-element tuple with the name and the size.
The first element must be one of followed by the respective
sizes:
* `:s` - signed integer (8, 16, 32, 64)
* `:u` - unsigned integer (8, 16, 32, 64)
* `:f` - f... | lib/nx/type.ex | 0.93488 | 0.565239 | type.ex | starcoder |
defmodule SimplePay.Wallet.Reader do
use GenServer
alias SimplePay.{Wallet, Repo, Utilities}
alias Events.{WalletCreated, MoneyDeposited, MoneyWithdrawn, WithdrawDeclined}
@default_state %{ event_store: SimplePay.EventStore, stream: nil, last_event: nil, balance: nil,
subscription_ref: nil... | programming/elixir/simple_pay/lib/simple_pay/wallet/reader.ex | 0.569134 | 0.410963 | reader.ex | starcoder |
defmodule Logfmt.Decoder do
@moduledoc """
Decodes a logfmt-style log line into a `map`.
## Examples
iex> Logfmt.decode "foo=bar"
%{"foo" => "bar"}
iex> Logfmt.decode "foo=true"
%{"foo" => true}
"""
import String, only: [next_grapheme: 1]
@doc """
See [`Logfmt.decode`](/logfmt/... | lib/logfmt/decoder.ex | 0.903439 | 0.412234 | decoder.ex | starcoder |
defmodule Collision.Detection.SeparatingAxis do
@moduledoc """
Implements the separating axis theorem for collision detection.
Checks for collision by projecting all of the edges of a pair of polygons
against test axes that are the normals of their edges.
If there is any axis for which the projections aren'... | lib/collision/detection/separating_axis.ex | 0.923983 | 0.812123 | separating_axis.ex | starcoder |
defmodule Bolt.Sips.Types do
@moduledoc """
Basic support for representing nodes, relationships and paths belonging to
a Neo4j graph database.
Four supported types of entities:
- Node
- Relationship
- UnboundRelationship
- Path
"""
defmodule Entity do
@moduledoc """
base structure for N... | lib/bolt_sips/types.ex | 0.842232 | 0.674054 | types.ex | starcoder |
defmodule Forage.Codec.Encoder do
@moduledoc """
Functionality to encode a `Forage.Plan` into a Phoenix `param` map
for use with the `ApplicationWeb.Router.Helpers`.
"""
alias Forage.ForagePlan
@doc """
Encodes a forage plan into a params map.
This function doesn't need to take the schema as... | lib/forage/codec/encoder.ex | 0.847495 | 0.516352 | encoder.ex | starcoder |
defmodule Expo.Po do
@moduledoc """
`.po` / `.pot` file handler
"""
alias Expo.Po.DuplicateTranslationsError
alias Expo.Po.Parser
alias Expo.Po.SyntaxError
alias Expo.Translations
@type parse_options :: [{:file, Path.t()}]
@type parse_error ::
{:error,
{:parse_error, message ::... | lib/expo/po.ex | 0.857112 | 0.451871 | po.ex | starcoder |
defmodule Day1 do
@moduledoc """
Solution to Day 1 Advent of Code puzzle 2021: SonarSweep
"""
@doc """
Returns the number of instances a measurement increased from the
previous measurement
"""
def run(filepath) do
data = get_data(filepath)
IO.puts("Increases: #{sweep(data, 0)}")
IO.puts("No... | lib/day_1/day_1.ex | 0.834474 | 0.761184 | day_1.ex | starcoder |
defmodule JsonRfc.Patch do
@moduledoc """
Represent map transformations as a series of JSON Patch (RFC 6902) compatible operations.
"""
import JsonRfc, only: [is_array_index: 2, is_array_append: 2]
import JsonRfc.Pointer, only: [transform: 3, fetch: 2]
@type ops :: :add | :replace | :remove | :move | :cop... | lib/patch.ex | 0.912699 | 0.758063 | patch.ex | starcoder |
defmodule Nebulex.Time do
@moduledoc """
Time utilities.
"""
## API
@doc """
Returns the current system time in the given time unit.
The `unit` is set to `:millisecond` by default.
## Examples
iex> Nebulex.Time.now()
_milliseconds
"""
@spec now(System.time_unit()) :: integer()
def... | lib/nebulex/time.ex | 0.921007 | 0.546617 | time.ex | starcoder |
defmodule YipyipExAuth.Plugs.ProcessRefreshToken do
@moduledoc """
Plug to process and verify refresh tokens. Must be initialized with a `YipyipExAuth.Config`-struct, which can be initialized itself using `YipyipExAuth.Config.from_enum/1`.
The token signature source (bearer or cookie) must match the `token_signa... | lib/plugs/process_refresh_token.ex | 0.884657 | 0.54353 | process_refresh_token.ex | starcoder |
defmodule ArtemisWeb.ViewHelper.Tables do
use Phoenix.HTML
import Phoenix.HTML.Tag
@default_delimiter ","
@doc """
Generates empty table row if no records match
"""
def render_table_row_if_empty(records, options \\ [])
def render_table_row_if_empty(%{entries: entries}, options), do: render_table_row... | apps/artemis_web/lib/artemis_web/view_helpers/tables.ex | 0.73659 | 0.481515 | tables.ex | starcoder |
defmodule DSMR.Telegram do
@type t() :: %__MODULE__{
header: DSMR.Telegram.Header.t(),
checksum: DSMR.Telegram.Checksum.t(),
data: [DSMR.Telegram.COSEM.t() | DSMR.Telegram.MBus.t()]
}
defstruct header: nil, checksum: nil, data: []
defmodule OBIS do
@type t() :: %__MODUL... | lib/dsmr/telegram.ex | 0.712332 | 0.606469 | telegram.ex | starcoder |
defmodule Pointers do
@moduledoc """
A context for working with Pointers, a sort of global foreign key scheme.
"""
import Ecto.Query
alias Pointers.{Pointer, Tables}
@doc """
Returns a Pointer, either the one provided or a synthesised one
pointing to the provided schema object. Does not hit the databa... | lib/pointers.ex | 0.853608 | 0.491578 | pointers.ex | starcoder |
defmodule Plaid.Castable do
@moduledoc false
@type generic_map :: %{String.t() => any()}
@doc """
Core to how this library functions is the `Plaid.Castable` behaviour for casting response objects to structs.
Each struct implements the behaviour by adding a `cast/1` fuction that take a generic string-keyed
... | lib/plaid/castable.ex | 0.880925 | 0.851891 | castable.ex | starcoder |
defmodule Terrasol.Path do
@moduledoc """
Handling of Earthstar path strings and the resulting
`Terrasol.Path.t` structures
"""
@upper 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@lower 'abcdefghijklmnopqrstuvwxyz'
@digit '0123456789'
@puncs '\'()-._~!$&+,:=@%'
@allow @upper ++ @lower ++ @digit ++ @puncs
@enforce... | lib/terrasol/path.ex | 0.739986 | 0.570271 | path.ex | starcoder |
defmodule GenWebsocket do
@moduledoc ~S"""
A Websocket client for Elixir with a API similar to `:gen_tcp`.
Example of usage where a client is started and connected, then it is used to send and receive
data:
iex> {:ok, client} = GenWebsocket.connect('example.com', 80, [])
iex> :ok = GenWebsocket.sen... | lib/gen_websocket.ex | 0.865025 | 0.612527 | gen_websocket.ex | starcoder |
defmodule Authex do
@moduledoc """
Defines an auth module.
This module provides a simple set of tools for the authorization and authentication
required by a typical API through use of JSON web tokens. To begin, we will want
to generate a secret from which our tokens will be signed with. There is a convenient... | lib/authex.ex | 0.892735 | 0.560192 | authex.ex | starcoder |
defmodule Faker.Name.It do
import Faker, only: [sampler: 2]
@moduledoc """
Functions for name data in Italian
"""
@doc """
Returns a complete name (may include a suffix/prefix or both)
## Examples
iex> Faker.Name.It.name()
"<NAME>"
iex> Faker.Name.It.name()
"<NAME>"
"""
@sp... | lib/faker/name/it.ex | 0.627837 | 0.517083 | it.ex | starcoder |
defmodule Oban.Worker do
@moduledoc """
Defines a behavior and macro to guide the creation of worker modules.
Worker modules do the work of processing a job. At a minimum they must define a `perform/2`
function, which is called with an `args` map and the full `Oban.Job` struct.
## Defining Workers
Worker... | lib/oban/worker.ex | 0.895117 | 0.777996 | worker.ex | starcoder |
defmodule Pass do
defstruct [:row, :col, :id]
def new(row, col) do
%Pass{row: row, col: col, id: row * 8 + col}
end
def compare(p1, p2) do
cond do
p1.id < p2.id -> :lt
p1.id > p2.id -> :gt
true -> :eq
end
end
end
defmodule D5 do
@moduledoc """
--- Day 5: Binary Boarding --... | lib/days/05.ex | 0.714827 | 0.707152 | 05.ex | starcoder |
defmodule Yggdrasil.Adapter do
@moduledoc """
This module defines a generalization of an adapter (for adapter creation
refer to `Yggdrasil.Subscriber.Adapter` and `Yggdrasil.Publisher.Adapter`
behaviour).
## Adapter alias
If you already have implemented the publisher and subscriber adapters, then
you ca... | lib/yggdrasil/adapter.ex | 0.853043 | 0.899519 | adapter.ex | starcoder |
defmodule EVM.SubState do
@moduledoc """
Functions for handling the sub-state that exists only
between operations in an execution for a contract.
"""
alias EVM.{
ExecEnv,
LogEntry,
MachineState,
Operation,
Refunds
}
defstruct selfdestruct_list: MapSet.new(),
touched_accou... | apps/evm/lib/evm/sub_state.ex | 0.769037 | 0.430028 | sub_state.ex | starcoder |
defmodule A do
@moduledoc false
alias Pbuf.Decoder
@derive {Jason.Encoder, []}
defstruct [
b: nil
]
@type t :: %__MODULE__{
b: A.B.t
}
@spec new(Enum.t) :: t
def new(data \\ []), do: struct(__MODULE__, data)
@spec encode_to_iodata!(t | map) :: iodata
def encode_to_iodata!(data) d... | test/schemas/generated/nopackage.pb.ex | 0.797004 | 0.562116 | nopackage.pb.ex | starcoder |
defmodule AWS.SageMakerA2IRuntime do
@moduledoc """
<important> Amazon Augmented AI is in preview release and is subject to
change. We do not recommend using this product in production environments.
</important> Amazon Augmented AI (Amazon A2I) adds the benefit of human
judgment to any machine learning appl... | lib/aws/generated/sage_maker_a2i_runtime.ex | 0.754463 | 0.7445 | sage_maker_a2i_runtime.ex | starcoder |
defmodule RDF.List do
@moduledoc """
A structure for RDF lists.
see
- <https://www.w3.org/TR/rdf-schema/#ch_collectionvocab>
- <https://www.w3.org/TR/rdf11-mt/#rdf-collections>
"""
alias RDF.{BlankNode, Description, Graph, IRI}
import RDF.Guards
@type t :: %__MODULE__{
head: IRI.t(),
... | lib/rdf/list.ex | 0.864139 | 0.640495 | list.ex | starcoder |
defmodule Astra.Document do
alias Astra.Document.Http
@moduledoc """
Provides functions to access the public methods of the Document API for databases hosted on https://astra.datastax.com.
Astra's Document API is implemented using the stargate project, https://stargate.io. Swagger docs for this interface ar... | lib/document/document.ex | 0.9231 | 0.795857 | document.ex | starcoder |
defmodule Msgpax.PackError do
@moduledoc """
Exception that represents an error in packing terms.
This exception has a `:reason` field that can have one of the following
values:
* `{:not_encodable, term}` - means that the given argument is not
serializable. For example, this is returned when you try... | lib/msgpax/packer.ex | 0.917774 | 0.564459 | packer.ex | starcoder |
defmodule Snitch.Data.Schema.PaymentMethod do
@moduledoc """
Models a PaymentMethod.
"""
use Snitch.Data.Schema
alias Snitch.Data.Schema.Payment
@typedoc """
A struct which represents PaymentMethod.
All the fields mentioned in the struct map
to fields of the database table.
The fields are:
... | apps/snitch_core/lib/core/data/schema/payment/payment_method.ex | 0.818156 | 0.5794 | payment_method.ex | starcoder |
defmodule Cassette.Support do
@moduledoc """
This macro module allows you to create your own Cassette service with custom
configurations
You can customize the (otp) application name with the `:process_name` key and
provide your configuration in the `:config` key.
```elixir
defmodule MyCas do
use Cas... | lib/cassette/support.ex | 0.810141 | 0.682772 | support.ex | starcoder |
defmodule AdventOfCode.Day02 do
@moduledoc """
Day 02.
Count the number of box IDs that have exactly two of any letter or that have
exactly three of any letter.
i.e.
abcdef does not have any
bababc has both two letters exactly and three letters exactly, so it counts for both.
"""
@da... | 2018/elixir/advent_of_code/lib/day02/day02.ex | 0.697094 | 0.588741 | day02.ex | starcoder |
defmodule Flawless.Rule do
@moduledoc """
Provides helpers to build and evaluate rules. It also defines all the built-in rules.
"""
defstruct predicate: nil, message: nil
alias Flawless.Context
import Flawless.Utils.Interpolation, only: [sigil_t: 2]
@type predicate() :: (any -> boolean())
@type error... | lib/flawless/rule.ex | 0.875667 | 0.473049 | rule.ex | starcoder |
defmodule DiodeClient do
@moduledoc ~S"""
DiodeClient secure end-to-end encrypted connections bettween any two machines. Connections are established
either through direct peer-to-peer TCP connections or bridged via the Diode network. To learn more about the
decentralized Diode network visit https://diode.io/
... | lib/diode_client.ex | 0.786213 | 0.743517 | diode_client.ex | starcoder |
defmodule Calendar do
@moduledoc """
This module defines the responsibilities for working with
calendars, dates, times and datetimes in Elixir.
Currently it defines types and the minimal implementation
for a calendar behaviour in Elixir. The goal of the Calendar
features in Elixir is to provide a base for ... | lib/elixir/lib/calendar.ex | 0.942823 | 0.778144 | calendar.ex | starcoder |
defmodule Packer do
@doc """
Encodes a term. Returns an array with the version-specific magic string, the
data schema, and buffer.
Options supported include:
* compress: boolean, defaulting to true
* small_int: boolean, defaulting to true. When false integers that would fit into a single byte
are inst... | lib/packer.ex | 0.870446 | 0.76882 | packer.ex | starcoder |
defmodule Server.Pycomm do
use GenServer
@moduledoc """
This module is a GenServer that manages the Python code that will be executed.
The general idea is that you will call functions in the library's API and this will usually add
code here. Then when you call Expyplot.Plot.show(), it will flush the code to ... | lib/server/pycomm.ex | 0.677154 | 0.490175 | pycomm.ex | starcoder |
defmodule InteropProxy do
@moduledoc """
Entrypoint for the Interop Proxy service.
This service wraps the behavior of the AUVSI SUAS Interoperability
Server for use from other services in the stack.
"""
alias InteropProxy.Message.Interop.{InteropTelem, Odlc}
alias InteropProxy.Request
alias InteropPr... | services/interop-proxy/lib/interop_proxy.ex | 0.794425 | 0.486575 | interop_proxy.ex | starcoder |
defmodule Fsharpy.FromFsharp do
@moduledoc """
Helper functions to take FSI output and convert `val` items into their
appoxiamate Elixir equivalents.
"""
def get_vals raw_output do
raw_output
|> String.replace("list =\n", "list = ")
|> String.split("\n")
|... | lib/Fsharpy/from_fsharp.ex | 0.779448 | 0.436622 | from_fsharp.ex | starcoder |
defmodule Day02 do
@moduledoc """
Advent of Code 2018, day 2.
"""
@doc """
Read a file of strings;
Check each string for duplicate and triplicate characters;
Multiply the number of words that contain dups with the number of words that contain trips.
Conditions:
A dup must have exactly two chars, i.e... | day02/lib/day02.ex | 0.874988 | 0.635844 | day02.ex | starcoder |
defmodule XDR.Int do
@moduledoc """
This module manages the `Integer` type based on the RFC4506 XDR Standard.
"""
@behaviour XDR.Declaration
alias XDR.Error.Int, as: IntError
defstruct [:datum]
@typedoc """
`XDR.Int` structure type specification.
"""
@type t :: %XDR.Int{datum: integer}
@doc "... | lib/xdr/int.ex | 0.929344 | 0.616373 | int.ex | starcoder |
defmodule Pow.Phoenix.SessionController do
@moduledoc """
Controller actions for session.
The `:request_path` param will automatically be assigned in `:new` and
`:create` actions, and used for the `pow_session_path(conn, :create)` path.
"""
use Pow.Phoenix.Controller
alias Plug.Conn
alias Pow.Plug
... | lib/pow/phoenix/controllers/session_controller.ex | 0.730386 | 0.415225 | session_controller.ex | starcoder |
defmodule Clickhousex.Codec.RowBinary.Old do
@moduledoc false
alias Clickhousex.{Codec, Codec.Binary}
require Record
Record.defrecord(:state, column_count: 0, column_names: [], column_types: [], rows: [], count: 0)
@behaviour Codec
@impl Codec
def response_format do
"RowBinaryWithNamesAndTypes"
... | lib/clickhousex/codec/row_binary_old.ex | 0.675658 | 0.550668 | row_binary_old.ex | starcoder |
defmodule ExPixBRCode.BRCodes.Decoder do
@moduledoc """
Decode iodata that represent a BRCode.
"""
alias ExPixBRCode.BRCodes.Models.BRCode
alias ExPixBRCode.Changesets
@keys %{
"00" => "payload_format_indicator",
"01" => "point_of_initiation_method",
"26" =>
{"merchant_account_informatio... | lib/ex_pix_brcode/brcode/decoder.ex | 0.884277 | 0.42913 | decoder.ex | starcoder |
defmodule ExHash.CLI do
defp switches() do
[
file: :string,
text: :string,
alg: :string,
help: :boolean,
]
end
defp aliases() do
[
f: :file,
t: :text,
a: :alg,
h: :help,
]
end
defp algorithms() do
[
"sha",
"sha224",
"sha2... | lib/cli.ex | 0.563978 | 0.425098 | cli.ex | starcoder |
defmodule KittenBlue.JWK do
@moduledoc """
Structure containing `kid`, `alg`, `JOSE.JWK` and handling functions
"""
defstruct [
:kid,
:alg,
:key
]
@type t :: %__MODULE__{kid: String.t(), alg: String.t(), key: JOSE.JWK.t()}
@doc """
```Elixir
kid = "sample_201804"
alg = "RS256"
key =... | lib/kitten_blue/jwk.ex | 0.798698 | 0.833019 | jwk.ex | starcoder |
defmodule Cased.Export do
@moduledoc """
Data modeling a Cased export.
"""
import Norm
@enforce_keys [
:id,
:audit_trails,
:download_url,
:events_found_count,
:fields,
:format,
:phrase,
:state,
:updated_at,
:created_at
]
defstruct [
:id,
:audit_trails,
... | lib/cased/export.ex | 0.895682 | 0.686337 | export.ex | starcoder |
defmodule Adventofcode.Day03CrossedWires do
use Adventofcode
alias __MODULE__.{CentralPort, Parser, Twister, Wire}
def part_1(input) do
closest_intersection_distance(input)
end
def part_2(input) do
fewest_combined_steps_to_intersection(input)
end
def closest_intersection_distance(input) do
... | lib/day_03_crossed_wires.ex | 0.631481 | 0.701636 | day_03_crossed_wires.ex | starcoder |
defmodule Adventofcode.Day16ChronalClassification do
use Adventofcode
defmodule Part1 do
alias Adventofcode.Day16ChronalClassification.Samples
def solve(input) do
input
|> Samples.detect_matching_operations()
|> Enum.filter(&three_or_more_matching_operations?/1)
|> Enum.count()
... | lib/day_16_chronal_classification.ex | 0.745676 | 0.561335 | day_16_chronal_classification.ex | starcoder |
defmodule SimpleSchema do
@moduledoc """
#{File.read!("README.md")}
"""
@type simple_schema :: SimpleSchema.Schema.simple_schema()
@callback schema(opts :: Keyword.t()) :: simple_schema
@callback from_json(schema :: simple_schema, json :: any, opts :: Keyword.t()) ::
{:ok, any} | {:error, an... | lib/simple_schema.ex | 0.811078 | 0.718422 | simple_schema.ex | starcoder |
defmodule FarmbotFirmware.Param do
@moduledoc "decodes/encodes integer id to name and vice versa"
require Logger
@type t() :: atom()
@doc "Decodes an integer parameter id to a atom parameter name"
def decode(parameter_id)
def decode(0), do: :param_version
def decode(1), do: :param_test
def decode(2), ... | farmbot_firmware/lib/farmbot_firmware/param.ex | 0.693058 | 0.578151 | param.ex | starcoder |
defmodule AWS.GroundStation do
@moduledoc """
Welcome to the AWS Ground Station API Reference.
AWS Ground Station is a fully managed service that enables you to control
satellite communications, downlink and process satellite data, and scale your
satellite operations efficiently and cost-effectively without... | lib/aws/generated/ground_station.ex | 0.85984 | 0.551936 | ground_station.ex | starcoder |
defmodule DarkFlows.Workflows.Stages.StepOkStage do
@moduledoc """
Adds `:ok` tuple monad handling step to `Opus.Pipeline`.
"""
@moduledoc since: "1.0.0"
alias DarkFlows.Workflow
alias DarkFlows.Workflows.Stages.StepOkStage
require Opus.Pipeline
@type opts() :: Keyword.t()
@type wrapped_step_ok_fun... | lib/dark_flows/workflows/stages/step_ok_stage.ex | 0.831143 | 0.500488 | step_ok_stage.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.