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 AWS.WorkMail do
@moduledoc """
Amazon WorkMail is a secure, managed business email and calendaring service with
support for existing desktop and mobile email clients.
You can access your email, contacts, and calendars using Microsoft Outlook, your
browser, or other native iOS and Android email app... | lib/aws/generated/work_mail.ex | 0.72526 | 0.47993 | work_mail.ex | starcoder |
defmodule Crawly.Manager do
@moduledoc """
Crawler manager module
This module is responsible for spawning all processes related to
a given Crawler.
The manager spawns the following processes tree.
ββββββββββββββββββ βββββββββββββββββββββ
β Crawly.Manager βββββββββ> Crawly.ManagerSup β
βββββββββ... | lib/crawly/manager.ex | 0.738386 | 0.490175 | manager.ex | starcoder |
defmodule JSONC.Transcoder do
import JSONC.Parser
@doc """
transcodes a jsonc document into a json document and raises in case of error
"""
def transcode!(content) when is_binary(content) do
case transcode(content) do
{:ok, result} -> result
{:error, reason} -> raise reason
end
end
@... | lib/transcoder.ex | 0.636466 | 0.431105 | transcoder.ex | starcoder |
defmodule TeamCityExUnitFormatting do
# Constants
@root_parent_node_id 0
# Struct
defstruct failures_counter: 0,
invalids_counter: 0,
seed: nil,
skipped_counter: 0,
tests_counter: 0,
trace: false,
width: 80
# Functions
def new(opts... | resources/exunit/1.6.0/team_city_ex_unit_formatting.ex | 0.642993 | 0.589657 | team_city_ex_unit_formatting.ex | starcoder |
defmodule Horde.DynamicSupervisor do
@moduledoc """
A distributed supervisor.
Horde.DynamicSupervisor implements a distributed DynamicSupervisor backed by a add-wins last-write-wins Ξ΄-CRDT (provided by `DeltaCrdt.AWLWWMap`). This CRDT is used for both tracking membership of the cluster and tracking supervised pr... | lib/horde/dynamic_supervisor.ex | 0.939004 | 0.802826 | dynamic_supervisor.ex | starcoder |
defmodule ExAlgo.List.LinkedList do
@moduledoc """
Implementation of a singly linked list.
"""
@type neg_index_error :: {:error, :negative_index}
@type empty_error :: {:error, :empty_list}
@type value_type :: any()
@type t :: %__MODULE__{container: [value_type()]}
defstruct container: []
@doc """
... | lib/ex_algo/list/linked_list.ex | 0.85443 | 0.436742 | linked_list.ex | starcoder |
defmodule Rihanna do
@moduledoc """
The primary client interface for Rihanna.
There are two ways to dispatch jobs with Rihanna:
1. Using mod-fun-args which is a bit like RPC
2. Using a module that implements `Rihanna.Job` and passing in one argument
See the documentation for `enqueue/1` and `enqueue/2` f... | lib/rihanna.ex | 0.904467 | 0.879354 | rihanna.ex | starcoder |
defmodule AWS.TimestreamWrite do
@moduledoc """
Amazon Timestream is a fast, scalable, fully managed time series database
service that makes it easy to store and analyze trillions of time series data
points per day.
With Timestream, you can easily store and analyze IoT sensor data to derive
insights from ... | lib/aws/generated/timestream_write.ex | 0.88275 | 0.633609 | timestream_write.ex | starcoder |
defmodule Scenic.Primitive.Transform do
@moduledoc """
Generic code for the transform styles.
Not intended to be used directly
"""
alias Scenic.Math.Matrix
alias Scenic.Math.Vector2
alias Scenic.Primitive.Transform
@callback info(data :: any) :: bitstring
@callback verify(any) :: boolean
# ======... | lib/scenic/primitive/transform/transform.ex | 0.78838 | 0.493287 | transform.ex | starcoder |
defmodule WechatPay.Plug.Refund do
@moduledoc """
Plug behaviour to handle **Refund** Notification from Wechat's Payment Gateway.
Official document: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_16&index=9
## Example
### Define a handler
See `WechatPay.Plug.Handler` for how to implement a h... | lib/wechat_pay/plug/refund.ex | 0.805173 | 0.567997 | refund.ex | starcoder |
defmodule StringIO do
@moduledoc """
Controls an IO device process that wraps a string.
A `StringIO` IO device can be passed as a "device" to
most of the functions in the `IO` module.
## Examples
iex> {:ok, pid} = StringIO.open("foo")
iex> IO.read(pid, 2)
"fo"
"""
use GenServer
@... | lib/elixir/lib/string_io.ex | 0.89934 | 0.606906 | string_io.ex | starcoder |
defmodule RDF.XSD.Integer do
@moduledoc """
`RDF.XSD.Datatype` for XSD integers.
Although the XSD spec defines integers as derived from `xsd:decimal` we implement
it here as a primitive datatype for simplicity and performance reasons.
"""
@type valid_value :: integer
use RDF.XSD.Datatype.Primitive,
... | lib/rdf/xsd/datatypes/integer.ex | 0.859752 | 0.715101 | integer.ex | starcoder |
defmodule JsonApiEspec.Core.AssertionStep do
defstruct steps: [], expected_msg: "", actual: nil, expected: nil
def init() do
%__MODULE__{}
end
def step(%__MODULE__{steps: steps} = assertion_step, {step, field} = step_field)
when is_atom(step) and is_binary(field) do
assertion_step
|> Map.put... | lib/core/assertion_step.ex | 0.725843 | 0.830113 | assertion_step.ex | starcoder |
defmodule ConfigParser.ParseState do
@moduledoc false
@default_options %{
join_continuations: :with_newline,
delimeters: [:equal, :colon]
}
@map Application.get_env(:configparser, :map_implementation)
# What line of the "file" are we parsing
defstruct line_number: 1,
# Section that de... | lib/ConfigParser/ParseState.ex | 0.660939 | 0.433802 | ParseState.ex | starcoder |
defmodule CHAT.TXT do
@moduledoc """
`CHAT.TXT` is a WebSocket client interface and client
socket protocol (session level) representation and
textual protocol termination.
"""
use N2O, with: [:n2o, :kvs]
require CHAT
defp format_msg(
CHAT."Pub"(bin: pl, key: id, adr: CHAT."Adr"(src: fr, dst: {... | lib/txt.ex | 0.717507 | 0.44897 | txt.ex | starcoder |
defmodule Blanket.Heir do
@moduledoc """
This modules describes the generic server for the table heirs. Use the
`Blanket` module to create and interact with a heir.
"""
alias :ets, as: ETS
use GenServer
defmodule State do
@moduledoc false
defstruct [tab: nil, owner: nil, mref: nil]
end
defp ... | lib/blanket/heir.ex | 0.61555 | 0.435481 | heir.ex | starcoder |
defmodule Parse.VehiclePositions do
@moduledoc """
Parser for the VehiclePositions.pb GTFS-RT file.
"""
@behaviour Parse
alias Model.Vehicle
alias Parse.Realtime.FeedMessage
import Parse.Helpers
def parse("{" <> _ = blob) do
Parse.VehiclePositionsJson.parse(blob)
end
def parse(blob) do
b... | apps/parse/lib/parse/vehicle_positions.ex | 0.694199 | 0.440469 | vehicle_positions.ex | starcoder |
defmodule PhoenixDatatables do
@moduledoc """
Provides the `execute` function which is the primary entry-point to the library, used
by the `Repo.fetch_datatable` function and directly by client applications.
"""
alias PhoenixDatatables.Request
alias PhoenixDatatables.Query
alias PhoenixDatatables.Res... | lib/phoenix_datatables.ex | 0.873552 | 0.89783 | phoenix_datatables.ex | starcoder |
defmodule Mojito.Telemetry do
@moduledoc ~S"""
Mojito's [Telemetry](https://github.com/beam-telemetry/telemetry)
integration.
All time measurements are emitted in `:millisecond` units by
default. A different
[Erlang time unit](https://erlang.org/doc/man/erlang.html#type-time_unit)
can be chosen by settin... | lib/mojito/telemetry.ex | 0.882225 | 0.876634 | telemetry.ex | starcoder |
defmodule Spat.Geometry.Sphere do
use Bitwise
@doc """
Obtain the indexes of a sphere within the subdivided bounds.
iex> Spat.Geometry.Sphere.index({ 0 }, 1, Spat.Bounds.new({ 10 }), 1)
[[0]]
iex> Spat.Geometry.Sphere.index({ 5 }, 1, Spat.Bounds.new({ 10 }), 1)
[[0], [1]... | lib/spat/geometry/sphere.ex | 0.863334 | 0.859369 | sphere.ex | starcoder |
defmodule Scrip.PendingRenewalInfo do
@moduledoc """
An array of elements that refers to auto-renewable subscription renewals that are open or failed in the past.
Only returned for app receipts that contain auto-renewable subscriptions.
See
https://developer.apple.com/documentation/appstorereceipts/response... | lib/scrip/pending_renewal_info.ex | 0.786664 | 0.437283 | pending_renewal_info.ex | starcoder |
defmodule ElxValidation.Internet do
@moduledoc """
### email
- The field under validation must be formatted as an email address.
### url
- The field under validation must be a valid URL.
### ip
- The field under validation must be an IP address.
### ipv4
- The field under validation must be an IPv4... | lib/rules/internet.ex | 0.583322 | 0.647109 | internet.ex | starcoder |
defmodule StarkInfra.PixDirector do
alias __MODULE__, as: PixDirector
alias StarkInfra.Utils.Rest
alias StarkInfra.User.Project
alias StarkInfra.User.Organization
alias StarkInfra.Error
@moduledoc """
Groups PixDirector related functions
"""
@doc """
The PixDomain struct displays the domain name a... | lib/pix_director/pix_director.ex | 0.779574 | 0.417271 | pix_director.ex | starcoder |
defmodule Sqlitex.Row do
@moduledoc false
def from(types, columns, rows, into) do
for row <- rows do
build_row(types, columns, row, into)
end
end
defp build_row(_types, _columns, row, :raw_list) do
Tuple.to_list(row)
end
defp build_row(types, columns, row, into) do
types = Enum.map(t... | deps/sqlitex/lib/sqlitex/row.ex | 0.541409 | 0.446133 | row.ex | starcoder |
defmodule ExZipper.Zipper do
@moduledoc """
An Elixir implementation of [Huet's Zipper][huet], with gratitude to <NAME>'s
[Clojure implementation][clojure].
Zippers provide a method of navigating and editing a tree while maintaining
enough state data to reconstruct the tree from the currently focused node.
... | lib/ex_zipper/zipper.ex | 0.886537 | 0.697664 | zipper.ex | starcoder |
defmodule Day21 do
def part_one(input) do
21
|> input.contents_of(:stream)
|> Stream.map(&String.trim/1)
|> Stream.map(fn line -> String.split(line, ":") end)
|> Stream.map(fn [_prefix, pos] -> pos end)
|> Stream.map(&String.trim/1)
|> Enum.map(&String.to_integer/1)
|> play(determinist... | year_2021/lib/day_21.ex | 0.500488 | 0.471771 | day_21.ex | starcoder |
defmodule Yggdrasil.Publisher.Adapter do
@moduledoc """
Publisher adapter behaviour.
"""
alias Yggdrasil.Channel
alias Yggdrasil.Registry
@doc """
Callback to start a publisher with a `namespace` and some `GenServer`
`options`.
"""
@callback start_link(
namespace :: atom(),
... | lib/yggdrasil/publisher/adapter.ex | 0.876449 | 0.455501 | adapter.ex | starcoder |
defmodule Guss.StorageV2Signer do
@moduledoc """
Sign a `Guss.Resource` using the Cloud Storage V2 Signing Process for Service Accounts.
This module generates the _string to sign_ for a ` Guss.Resource`,
and signs it using the given `private_key`. The signature is then
added to the URL, along with any requir... | lib/guss/storage_v2_signer.ex | 0.867794 | 0.49823 | storage_v2_signer.ex | starcoder |
defmodule Strava.Route do
@moduledoc """
Routes are manually-created paths made up of sections called legs. Currently it is only possible to create routes using the Routebuilder web interface.
https://strava.github.io/api/v3/routes/
"""
import Strava.Util, only: [parse_timestamp: 1]
@type t :: %__MODULE__... | lib/strava/route.ex | 0.876039 | 0.465387 | route.ex | starcoder |
defmodule Nostrum.Cache.PresenceCache.ETS do
@tablename :presences
@moduledoc """
ETS-based cache for user presences.
The ETS table name associated with the User Cache is `#{@tablename}`. Besides
the methods provided below you can call any other ETS methods on the table.
If you need to access the name of t... | lib/nostrum/cache/presence_cache/ets.ex | 0.839865 | 0.720884 | ets.ex | starcoder |
defmodule Membrane.MP4.Payloader.AAC do
@moduledoc """
Payloads AAC stream so it can be embedded in MP4.
Resources:
- Packaging/Encapsulation And Setup Data section of https://wiki.multimedia.cx/index.php/Understanding_AAC
"""
use Membrane.Filter
alias Membrane.Buffer
def_input_pad :input, demand_unit... | lib/membrane_mp4/payloader/aac.ex | 0.841988 | 0.405861 | aac.ex | starcoder |
defmodule Attrition do
@moduledoc """
Attrition provides the ability to display specific data HTML attributes
based on the configuration of your mix environment.
For example, testing and QA can be performed using the `data-qa` or `data-test` attribute,
while these attributes are effectively removed from your... | lib/attrition.ex | 0.94098 | 0.964954 | attrition.ex | starcoder |
defmodule Plug.Cowboy.Drainer do
@moduledoc """
Process to drain cowboy connections at shutdown.
When starting `Plug.Cowboy` in a supervision tree, it will create a listener that receives
requests and creates a connection process to handle that request. During shutdown, a
`Plug.Cowboy` process will immediate... | lib/plug/cowboy/drainer.ex | 0.813498 | 0.441914 | drainer.ex | starcoder |
defmodule Paasaa do
@moduledoc """
Provides language detection functions
## Examples
iex> Paasaa.detect "Detect this!"
"eng"
"""
@scripts Paasaa.Data.scripts()
@languages Paasaa.Data.languages()
@max_difference 300
@type result :: [{language :: String.t(), score :: number}]
@type o... | lib/paasaa.ex | 0.896407 | 0.529568 | paasaa.ex | starcoder |
defmodule Scenic.Battery.Monitor do
@moduledoc """
A component that displays battery charge in four segments, including empty.
"""
use Scenic.Component, has_children: false
alias Scenic.Graph
alias Scenic.Primitive.Style.Theme
import Scenic.Primitives
@default_theme :dark
@default_data %{charge_le... | lib/monitor.ex | 0.790975 | 0.425277 | monitor.ex | starcoder |
defmodule Dispenser.Buffer do
@moduledoc """
A `Dispenser.Buffer` is a buffer that manages incoming events and demand for those events.
"""
alias Dispenser.{Demands, AssignmentStrategy}
alias LimitedQueue
@typedoc """
The opaque internal state of the `Buffer`.
"""
@opaque t(event, subscriber) :: %__M... | lib/dispenser/buffer.ex | 0.876145 | 0.578627 | buffer.ex | starcoder |
defmodule Ergo.Numeric do
alias Ergo.{Context, Parser}
import Ergo.{Terminals, Combinators}
@moduledoc """
The Parsers module exists to house utility parsers that while they are terminals in the sense that they are not parameterised, they internally make use of parsers from the Combinators module.
# Parsers... | lib/ergo/numeric.ex | 0.76074 | 0.511961 | numeric.ex | starcoder |
defmodule Anaphora do
@vsn "0.1.2"
@moduledoc """
The anaphoric macro collection for Elixir
"""
defmacro __using__(_) do
quote do
import Anaphora
end
end
## Returns the `it` variable defined in user context
defp it do
Macro.var(:it, nil)
end
@doc """
Binds the `expression` to... | lib/anaphora.ex | 0.798462 | 0.635703 | anaphora.ex | starcoder |
defmodule PingPlug do
@moduledoc """
PingPlug, a plug to echo a defined message.
PingPlug can be used in two ways, execute a function or echo a message.
#### Execute a function
To execute any function you must define a module function that return:
{:ok, String.t()} | {:error, String.t()}
In which... | lib/ping_plug.ex | 0.837852 | 0.90657 | ping_plug.ex | starcoder |
defmodule Advent.Y2020.D12 do
@moduledoc """
https://adventofcode.com/2020/day/12
"""
def part_one(input) do
input
|> Stream.map(&split_instruction/1)
|> Enum.reduce({0, 0, 90}, fn
# Move North
{"N", value}, {x, y, deg} -> {x, y + value, deg}
{"F", value}, {x, y, 0} -> {x, y + val... | lib/advent/y2020/d12.ex | 0.788583 | 0.827061 | d12.ex | starcoder |
defmodule FloUI.Scrollable.Container do
@moduledoc """
## Usage in SnapFramework
Scrollable container is used for large content that you want to scroll. It renders a component child within.
this is meant to be as plug and play as possible. With minimal fiddling to get it to work.
You can use the ScrollBar co... | lib/scrollable/container.ex | 0.835282 | 0.731011 | container.ex | starcoder |
defmodule CommonGraphqlClient.StaticValidator do
@moduledoc """
Validates a query against a static graphql schema
"""
@doc """
This method validates a query against a graphql schema and returns `:ok` if
the query is valid or returns `{:error, reason}`.
This method takes:
* a `query_string`: A graphql ... | lib/common_graphql_client/static_validator.ex | 0.918713 | 0.577049 | static_validator.ex | starcoder |
defmodule Yaq do
@moduledoc """
Yet Another Queue module for Elixir
"""
@type value :: term()
@opaque t :: %__MODULE__{
l_data: list(),
r_data: list(),
l_size: non_neg_integer(),
r_size: non_neg_integer()
}
@opaque t(value) :: %__MODULE__{
... | lib/yaq.ex | 0.908312 | 0.596962 | yaq.ex | starcoder |
defmodule KantanCluster do
@moduledoc """
Form a simple Erlang cluster easily in Elixir.
"""
require Logger
@typedoc """
A node type. See `Node.start/3`.
"""
@type node_type :: :longnames | :shortnames
@typedoc """
Options for a cluster.
* `:node`
- the name of a node that you want to star... | lib/kantan_cluster.ex | 0.879555 | 0.519948 | kantan_cluster.ex | starcoder |
defprotocol Collidable do
@moduledoc """
Protocol defining an interface for checking whether objects are colliding.
In the event of collision, it also defines functions for resolution.
"""
@doc """
Determine whether a pair of collidable entities are in collision.
## Examples
iex> Collidable.coll... | lib/collidable.ex | 0.897313 | 0.710377 | collidable.ex | starcoder |
defmodule Ecbolic.Pretty do
@moduledoc """
This module provides small formating for when you want
to display your docs.
All functions intended for formating can be supplied
with a string, which allows you to use function names,
help and such. The default format is `":f - :h`
- :f
Inserts the name fun... | lib/ecbolic/pretty.ex | 0.848628 | 0.854642 | pretty.ex | starcoder |
defmodule Dayron.Request do
@moduledoc """
Defines a struct to store data necessary to send a request using an adapter.
Also provides helper functions to map request data to adapter method calls.
"""
defstruct method: :get, url: "", body: %{}, headers: [], options: []
@type t :: %__MODULE__{method: atom, ur... | lib/dayron/request.ex | 0.830457 | 0.514644 | request.ex | starcoder |
defmodule Day04.Board do
use Bitwise
defstruct state: 0, positions: %{}
@row1 String.to_integer("0000000000000000000011111", 2)
@row2 String.to_integer("0000000000000001111100000", 2)
@row3 String.to_integer("0000000000111110000000000", 2)
@row4 String.to_integer("0000011111000000000000000", 2)
@row5 St... | year_2021/lib/day_04/board.ex | 0.692746 | 0.565209 | board.ex | starcoder |
defmodule Protobuf.Protoc.Generator.Util do
@moduledoc false
alias Protobuf.Protoc.Context
@locals_without_parens [field: 2, field: 3, oneof: 2, rpc: 3, extend: 4, extensions: 1]
defguardp is_nil_or_nonempty_string(term) when is_nil(term) or (is_binary(term) and term != "")
@spec mod_name(Context.t(), [St... | lib/protobuf/protoc/generator/util.ex | 0.760117 | 0.409309 | util.ex | starcoder |
defmodule Asteroid.Client do
use AttributeRepository.Resource, otp_app: :asteroid
@moduledoc """
`AttributeRepository.Resource` for clients
Client refers to an OAuth2 client, that is a **application** (and not a machine). There are 2
types of clients:
- those who can keep a secret secret: *confidential cl... | lib/asteroid/client.ex | 0.90136 | 0.555375 | client.ex | starcoder |
defmodule Advent20.OperationOrder do
@moduledoc """
Day 18: Operation Order
Phew this day was hard. I am not used to parsing. I read up on algorithms for parsing math expressions
and read about the difference between infix and postfix notation. Infix is e.g. 2+4*(3+4) and the same
in postfix would be written... | lib/advent20/18_operation_order.ex | 0.786213 | 0.663778 | 18_operation_order.ex | starcoder |
defmodule EpiContacts.PatientCase do
alias EpiContacts.Contact
alias EpiContacts.Parsers
@moduledoc """
utilities for working with patient case map data
"""
@minimum_age 18
@spec age(patient_case :: map()) :: pos_integer() | nil
@spec age(patient_case :: map(), as_of :: DateTime.t()) :: pos_integer() ... | lib/epi_contacts/patient_case.ex | 0.581184 | 0.414247 | patient_case.ex | starcoder |
defmodule Authorizir do
@moduledoc ~S"""
Ecto-backed Authorization Library for Elixir Applications
See [README](README.md) for a description of the mathematical model used as
the basis of this system.
## Usage
Imagine you are creating an app that handles online ordering.
First, create your app's autho... | lib/authorizir.ex | 0.810591 | 0.799442 | authorizir.ex | starcoder |
defmodule Versioning.Changelog do
@moduledoc """
Creates changelogs for schemas.
The changelog is composed of a list of maps that describe the history of
the schema. For example:
[
%{
version: "1.1.0",
changes: [
%{type: Foo, descriptions: ["Changed this.", "Chang... | lib/versioning/changelog.ex | 0.875734 | 0.503174 | changelog.ex | starcoder |
defmodule Alchemetrics do
alias Alchemetrics.Event
alias Alchemetrics.Producer
@moduledoc """
Data Report Interface
All reported values follow the same flow:
1. They are stored in a dataset and stay there for a configurable time span;
2. After that time span the dataset is measured. Various measurem... | lib/alchemetrics.ex | 0.942797 | 0.928214 | alchemetrics.ex | starcoder |
defmodule SimpleMarkdown do
@moduledoc """
Converts markdown into the specified rendered output.
While this step is completely optional, if you need to configure
any rules the first thing to do is usually to generate the base
rule config.
$ mix simple_markdown.rules.new
And t... | lib/simple_markdown.ex | 0.819244 | 0.403361 | simple_markdown.ex | starcoder |
defmodule WaitForIt do
@moduledoc ~S"""
WaitForIt provides macros for various ways to wait for things to happen.
Since most Elixir systems are highly concurrent there must be a way to coordinate and synchronize
the processes in the system. While the language provides features (such as `Process.sleep/1` and
`... | lib/wait_for_it.ex | 0.901265 | 0.966537 | wait_for_it.ex | starcoder |
defmodule Thunking do
@moduledoc false
# The delay state of a thunk process, has the suspended value
# and a list of pids to send its forced value once forced.
def thunking(:delay, fun, ps) do
receive do
# Upon recieving the connect message will call its
# self with the new process cons'd to ... | lib/thunking.ex | 0.709321 | 0.5564 | thunking.ex | starcoder |
defmodule Advent2019Web.Day18Controller do
use Advent2019Web, :controller
@doc """
From an ASCII labyrinth produce a sparse representation as a map.
"""
@spec labyrinth_string_to_map(String.t()) :: map
def labyrinth_string_to_map(labyrinth) do
String.split(labyrinth, "\n")
|> Enum.with_index()
... | lib/advent2019_web/controllers/day18_controller.ex | 0.822617 | 0.491151 | day18_controller.ex | starcoder |
defmodule Plymio.Vekil.Forom.Proxy do
@moduledoc ~S"""
The module implements the `Plymio.Vekil.Forom` protocol and manages
a *proxy*.
A **proxy** *forom* holds a reference to another *proxy* in its `:forom`
field.
When a **proxy** *forom* is produced or realised the *proxy* in the
`:forom` fields is use... | lib/vekil/concrete/forom/proxy.ex | 0.859649 | 0.554531 | proxy.ex | starcoder |
defmodule ChallengeGov.Reports do
@moduledoc """
Context for creating a report
"""
import Ecto.Query
import Ecto.Changeset
alias ChallengeGov.Repo
alias ChallengeGov.Reports.Report
alias ChallengeGov.SecurityLogs.SecurityLog
# @doc """
# Stream security log records for CSV download
# """
def s... | lib/challenge_gov/reports.ex | 0.52902 | 0.400486 | reports.ex | starcoder |
defmodule Ueberauth.Strategy.Weebly do
@moduledoc """
Provides an Ueberauth strategy for authenticating with Weebly.
### Setup
Create an application in Weebly for you to use.
Register a new application at the [weebly developers page](https://dev.weebly.com/) and get the `client_id` and `client_secret`.
... | lib/strategy/weebly.ex | 0.688259 | 0.415462 | weebly.ex | starcoder |
defmodule Griffin.Model.Module do
@moduledoc """
Module for interacting with Griffin models. Griffin models are elixir
modules that expect certain functions to be defined for the sake of data
validation, database persistence, and GraphQL integration.
"""
@doc """
Gets the singular and plural namespace of... | lib/griffin/model/module.ex | 0.876311 | 0.883034 | module.ex | starcoder |
defmodule Regulator.Limit.Gradient do
@moduledoc """
Limiter based on the gradient of change. Based on Netflix's gradient2 algorithm.
https://github.com/Netflix/concurrency-limits.
## Options
* `:initial_limit` - The initial limit when the regulator is installed (defaults to 20).
* `:min_limit` - The minim... | lib/regulator/limit/gradient.ex | 0.902314 | 0.802556 | gradient.ex | starcoder |
defmodule AlchemyVM do
use GenServer
alias AlchemyVM.Decoder
alias AlchemyVM.ModuleInstance
alias AlchemyVM.Store
alias AlchemyVM.Executor
alias AlchemyVM.Helpers
require IEx
@enforce_keys [:modules, :store]
defstruct [:modules, :store]
@moduledoc """
Execute WebAssembly code
"""
@doc """... | lib/wasp_vm.ex | 0.824533 | 0.54698 | wasp_vm.ex | starcoder |
defmodule Secure.Bcrypt do
@moduledoc """
Elixir wrapper for the OpenBSD bcrypt password hashing algorithm.
"""
@spec salt(pos_integer) :: bitstring
@doc """
Generates a salt with a given work factor.
The work factor defaults to 12 if no factor is given.
"""
def salt(factor \\ 12) do
{:ok, salt... | lib/secure/bcrypt.ex | 0.864411 | 0.635802 | bcrypt.ex | starcoder |
defmodule Site.FlokiHelpers do
@moduledoc """
Helpers for working with Floki and the parsed HTML it returns.
"""
@typep tree_or_binary :: Floki.html_tree() | binary
@typep visitor :: (tree_or_binary -> tree_or_binary | nil)
@doc """
traverse/2 is the main way of manipulating the parse tree. It recursive... | apps/site/lib/site/floki_helpers.ex | 0.797675 | 0.405537 | floki_helpers.ex | starcoder |
defmodule RedisHash do
@moduledoc """
Offers read and write access to Redis' hash functions,
without caching. All functions directly result in calls to Redis.
Writing data will always overwrite existing values.
"""
require Logger
alias RedisHash
defstruct(
__redis_key__: nil,
__redis_adapter__... | lib/redis_hash.ex | 0.839273 | 0.523542 | redis_hash.ex | starcoder |
defmodule Money.ExchangeRates do
@moduledoc """
Implements a behaviour and functions to retrieve exchange rates
from an exchange rate service.
Configuration for the exchange rate service is defined
in a `Money.ExchangeRates.Config` struct. A default
configuration is returned by `Money.ExchangeRates.defaul... | lib/money/exchange_rates.ex | 0.926844 | 0.637962 | exchange_rates.ex | starcoder |
defmodule Exonerate.Filter.DependentSchemas do
@moduledoc false
# NB "dependentSchemas" is just a repackaging of "dependencies" except only permitting the
# maps (specification of full schema to be applied to the object)
@behaviour Exonerate.Filter
@derive Exonerate.Compiler
@derive {Inspect, except: [:co... | lib/exonerate/filter/dependent_schemas.ex | 0.731251 | 0.458894 | dependent_schemas.ex | starcoder |
defmodule Bamboo.SendGridHelper do
@moduledoc """
Functions for using features specific to Sendgrid.
## Example
email
|> with_template("80509523-83de-42b6-a2bf-54b7513bd2aa")
|> substitute("%name%", "<NAME>")
|> substitute("%location%", "Westeros")
"""
alias Bamboo.Email
@field_n... | lib/bamboo/adapters/send_grid_helper.ex | 0.840259 | 0.631537 | send_grid_helper.ex | starcoder |
defmodule DiodeClient.ABI do
alias DiodeClient.{Hash, Wallet}
use DiodeClient.Log
import Wallet
def encode_args(types, values) when is_list(types) and is_list(values) do
encode_data(types, values)
|> :erlang.iolist_to_binary()
end
def decode_types(types, data) do
{ret, ""} =
Enum.reduce(... | lib/diode_client/abi.ex | 0.640523 | 0.486819 | abi.ex | starcoder |
defmodule Snitch.Data.Schema.PackageItem do
@moduledoc """
Models a PackageItem, a `Package` is composed of many `PackageItem`s.
## Fulfillment
There are two kinds of fulfillments:
1. `immediate`, there is enough stock "on hand" at the origin stock location.
- `:backordered` is set to `false`
2. `deff... | apps/snitch_core/lib/core/data/schema/package_item.ex | 0.864053 | 0.886862 | package_item.ex | starcoder |
defmodule AdventOfCode.Y2021.Day1 do
@moduledoc """
--- Day 1: Sonar Sweep ---
You're minding your own business on a ship at sea when the overboard alarm goes off! You rush to see if you can help. Apparently, one of the Elves tripped and accidentally sent the sleigh keys flying into the ocean!
Before you know... | lib/y_2021/d1/day1.ex | 0.850173 | 0.929312 | day1.ex | starcoder |
defmodule Plaid.Accounts do
@moduledoc """
Functions for Plaid `accounts` endpoint.
"""
import Plaid, only: [make_request_with_cred: 4, validate_cred: 1]
alias Plaid.Utils
@derive Jason.Encoder
defstruct accounts: [], item: nil, request_id: nil
@type t :: %__MODULE__{
accounts: [Plaid.Acco... | lib/plaid/accounts.ex | 0.789112 | 0.608158 | accounts.ex | starcoder |
defmodule Ello.Stream.Slop do
@base_slop_factor Application.get_env(:ello_stream, :base_slop_factor)
@block_slop_multiplier Application.get_env(:ello_stream, :block_slop_multiplier)
@max_block_slop_factor Application.get_env(:ello_stream, :max_block_slop_factor)
@nsfw_slop_factor Application.get_env(... | apps/ello_stream/lib/ello_stream/slop.ex | 0.516839 | 0.409723 | slop.ex | starcoder |
defmodule Phoenix.Ecto.SQL.Sandbox do
@moduledoc """
A plug to allow concurrent, transactional acceptance tests with Ecto.Adapters.SQL.Sandbox.
## Example
This plug should only be used during tests. First, set a flag to
enable it in `config/test.exs`:
config :your_app, sql_sandbox: true
And use th... | lib/phoenix_ecto/sql/sandbox.ex | 0.826922 | 0.474692 | sandbox.ex | starcoder |
defmodule Bonny.Server.Scheduler.Binding do
@moduledoc """
Kubernetes [binding](#placeholder) interface.
Currently [undocumented](https://github.com/kubernetes/kubernetes/issues/75749) in Kubernetes docs.
## Links
* [Example using curl](https://gist.github.com/kelseyhightower/2349c9c645d32a3fcbe385082de7466... | lib/bonny/server/scheduler/binding.ex | 0.841631 | 0.453322 | binding.ex | starcoder |
defmodule AFK.State do
@moduledoc """
A GenServer process representing the current state of the keyboard.
The process can effectively be thought of as a realtime stream manipulator. It
receives key press and key release events (through `press_key/2` and
`release_key/2` respectively) and transforms them into ... | lib/afk/state.ex | 0.82308 | 0.582105 | state.ex | starcoder |
defmodule Xandra.Page do
@moduledoc ~S"""
A struct that represents a page of rows.
This struct represents a page of rows that have been returned by the
Cassandra server in response to a query such as `SELECT`, but have not yet
been parsed into Elixir values.
This struct implements the `Enumerable` protoco... | lib/xandra/page.ex | 0.891622 | 0.626267 | page.ex | starcoder |
defmodule Infer.Video do
@moduledoc """
Video type matchers based on the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming))
"""
@doc """
Takes the binary file contents as arguments. Returns `true` if it's a m4v.
"""
@spec m4v?(binary()) :: boolean()
def m4v?(<<_data::binary-size(4... | lib/matchers/video.ex | 0.790045 | 0.498779 | video.ex | starcoder |
defmodule Dagger.Step do
@moduledoc """
A step represents a recipe of dependent calculations to make for a given input.
Dagger Steps model dependent operations that can be run concurrently by a runner.
A top level step can be run when given the required parameters such as a `runner`, an `input`, a `name`, and... | lib/step.ex | 0.904682 | 0.917303 | step.ex | starcoder |
defmodule Faker.Food.En do
import Faker, only: [sampler: 2]
@moduledoc """
Functions for food data in English.
"""
@doc """
Returns a dish.
## Examples
iex> Faker.Food.En.dish()
"Vegetable Soup"
iex> Faker.Food.En.dish()
"Fish and chips"
iex> Faker.Food.En.dish()
"P... | lib/faker/food/en.ex | 0.693058 | 0.509764 | en.ex | starcoder |
defmodule Aoc.Year2018.Day02 do
@moduledoc """
Solution to Day 02 of 2018: Inventory Management System
## --- Day 2: Inventory Management System ---
You stop falling through time, catch your breath, and check the screen on the
device. "Destination reached. Current Year: 1518. Current Location: North Pole
... | lib/aoc/year_2018/day_02.ex | 0.735737 | 0.682917 | day_02.ex | starcoder |
defmodule Elsa.Group.Manager do
@moduledoc """
Defines the GenServer process that coordinates assignment
of workers to topics/partitions of a given consumer group.
Tracks consumer group state and reinstantiates workers to
the last unacknowledged message in the event of failure.
"""
use GenServer, shutdown... | lib/elsa/group/manager.ex | 0.71889 | 0.46217 | manager.ex | starcoder |
defmodule Arrow 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__{
arr: (any -> any)... | typeclassopedia/lib/arrow.ex | 0.857843 | 0.466663 | arrow.ex | starcoder |
defmodule Tai.Venues.Config do
@moduledoc """
Venue configuration for a `tai` instance. This module provides a utility
function `Tai.Venues.Config.parse/0` that hydrates a list of venues from
the `%Tai.Config{}`.
It can be configured with the following options:
```
config :tai,
venues: %{
okex... | apps/tai/lib/tai/venues/config.ex | 0.886969 | 0.807157 | config.ex | starcoder |
defmodule Workex do
@moduledoc """
A behaviour which separates message receiving and aggregating from message processing.
Example:
defmodule Consumer do
use Workex
# Interface functions are invoked inside client processes
def start_link do
Workex.start_link(__MODULE... | lib/workex.ex | 0.781914 | 0.615146 | workex.ex | starcoder |
defmodule Blogit.Settings do
@moduledoc """
Provides application-wide settings for `Blogit`.
All of the functions in this modules are settings, which can be reused
through the other modules.
"""
@posts_folder "posts"
@meta_divider "\n---\n"
@doc """
Retrieves the list of supported languages configu... | lib/blogit/settings.ex | 0.916843 | 0.657153 | settings.ex | starcoder |
defmodule Personnummer do
@moduledoc """
Validate Swedish personal identity numbers `Personnummer`.
"""
defstruct [:date, :serial, :control, :separator, :coordination]
def new(pnr_string) do
matches =
Regex.run(~r/^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([-+]{0,1})(\d{3})(\d{0,1})$/, pnr_string)
if... | lib/personnummer.ex | 0.814496 | 0.415788 | personnummer.ex | starcoder |
defmodule NervesHub.HTTPFwupStream do
@moduledoc """
Handles streaming a fwupdate via HTTP.
a `callback` module is expected to be passed to `start_link/1`
messages will be recieved in the shape:
* `{:fwup_message, message}` - see the docs for
[Fwup](https://hexdocs.pm/fwup/) for more info.
* `{:http_e... | lib/nerves_hub/http_fwup_stream.ex | 0.765769 | 0.402304 | http_fwup_stream.ex | starcoder |
defmodule AWS.IoT do
@moduledoc """
AWS IoT
AWS IoT provides secure, bi-directional communication between
Internet-connected things (such as sensors, actuators, embedded devices, or
smart appliances) and the AWS cloud. You can discover your custom IoT-Data
endpoint to communicate with, configure rules for... | lib/aws/iot.ex | 0.757301 | 0.52208 | iot.ex | starcoder |
defmodule ShEx.ShExJ.Decoder do
@moduledoc false
import ShEx.Utils
def decode(content, options \\ []) do
with {:ok, json_object} <- parse_json(content, options) do
to_schema(json_object, options)
end
end
defp to_schema(%{type: "Schema"} = schema, options) do
with {:ok, shapes} <-
... | lib/shex/shexj/decoder.ex | 0.710829 | 0.46478 | decoder.ex | starcoder |
defmodule Bank.Ledger do
@moduledoc ~S"""
A simple implementation of double-entry accounting system.
Basically, we store every `Bank.Ledger.Entry` twice - once for each account affected.
Thus, if Alice transfers $10.00 to Bob we'll have two entries:
- debit Alice's account for $10.00
- credit Bob's accou... | apps/bank/lib/bank/ledger.ex | 0.822474 | 0.668586 | ledger.ex | starcoder |
defmodule Tint.RGB do
@moduledoc """
A color in the RGB (red, green, blue) colorspace.
"""
import Tint.Utils.Cast
alias Tint.Distance
alias Tint.RGB.HexCode
alias Tint.Utils.Interval
defstruct [:red, :green, :blue]
@type t :: %__MODULE__{
red: non_neg_integer,
green: non_neg_in... | lib/tint/rgb.ex | 0.966992 | 0.433082 | rgb.ex | starcoder |
defmodule Plotex.ViewRange do
alias __MODULE__
@unix_epoch ~N[1970-01-01 00:00:00]
defstruct start: 10,
stop: 90,
projection: :cartesian
@type t :: %Plotex.ViewRange{start: number(), stop: number(), projection: :cartesian | :polar}
def new({a, b}, proj \\ :cartesian) do
%ViewRa... | lib/plotex/view_range.ex | 0.782579 | 0.654053 | view_range.ex | starcoder |
defmodule ExPNG.Image do
alias __MODULE__, as: Image
defstruct width: 0, height: 0, pixels: <<>>
def new(width, height) do
new(width, height, ExPNG.Color.transparent)
end
def new(width, height, background_color) do
%Image{width: width, height: height, pixels: String.duplicate(background_color, wid... | lib/ex_png/image.ex | 0.502197 | 0.489198 | image.ex | starcoder |
defmodule Grizzly.CommandClass.Powerlevel.Set do
@moduledoc """
Command module for working with the Powerlevel command class SET command.
It is used to temporarily decrease the RF transmit power level of a device.
Command Options:
* `:power_level` - By how much to decrease the RF transmit power level (:no... | lib/grizzly/command_class/powerlevel/set.ex | 0.84241 | 0.556159 | set.ex | starcoder |
defmodule Grizzly.Security do
@moduledoc """
Helpers for security
"""
import Bitwise
@type key :: :s2_unauthenticated | :s2_authenticated | :s2_access_control | :s0
@type key_byte :: 0x01 | 0x02 | 0x04 | 0x80
@typedoc """
Possible key exchange failures
- `:none` - Bootstrapping was successful
- ... | lib/grizzly/security.ex | 0.853027 | 0.523968 | security.ex | starcoder |
defmodule EctoTestDSL.Variants.PhoenixClassic.Insert do
use EctoTestDSL.Drink.Me
alias T.Variants.PhoenixClassic.Insert, as: ThisVariant
alias T.Parse.Start
alias T.Parse.Callbacks
import FlowAssertions.Define.BodyParts
alias T.Variants.Common.DefaultFunctions
# ------------------- Workflows ------------... | lib/variants/phoenix_classic_insert.ex | 0.532182 | 0.443239 | phoenix_classic_insert.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.