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 Pass.Plugs do
@moduledoc """
The `Pass.Plugs` module is meant to be imported into a Phoenix Router
module so that its methods can be used as plugs in the router's pipelines.
## Example
```elixir
defmodule MyApp.Router do
use MyApp.Web, :router
import Pass.Plugs
pipeline :browser do
... | lib/pass/plugs.ex | 0.880791 | 0.66788 | plugs.ex | starcoder |
defmodule Advent20.Encoding do
@moduledoc """
Day 9: Encoding Error
"""
defp parse(input) do
input
|> String.split("\n", trim: true)
|> Enum.map(&String.to_integer/1)
end
@doc """
Part 1: The first step of attacking the weakness in the XMAS data
is to find the first number in the list (aft... | lib/advent20/09_encoding.ex | 0.660063 | 0.521288 | 09_encoding.ex | starcoder |
defmodule Gyx.Environments.Pure.FrozenLake do
@moduledoc """
This module implements the FrozenLake-v0
environment according to
OpenAI implementation: https://gym.openai.com/envs/FrozenLake-v0/
"""
alias Gyx.Core.{Env, Exp}
alias Gyx.Core.Spaces.Discrete
use Env
use GenServer
defstruct map: nil,
... | lib/environments/pure/frozenlake.ex | 0.849379 | 0.472257 | frozenlake.ex | starcoder |
defmodule Graphd.Node do
@moduledoc """
Simple high level API for accessing graphs
## Usage
defmodule Shared do
use Graphd.Node
shared do
field :id, :string, index: ["term"]
field :name, :string, index: ["term"]
end
end
defmodule User do
use Graphd.Node, dep... | lib/graphd/node.ex | 0.787155 | 0.469763 | node.ex | starcoder |
defmodule Day09 do
@moduledoc """
Documentation for `Day09`.
"""
def hack_xmas(filePath, preambleSize) do
input = load_input(filePath)
vulnerability = get_vulnerability(input, preambleSize)
IO.puts(vulnerability)
{i,j} = get_longest_combination(input,vulnerability)
input = input
... | src/Day09/day09/lib/day09.ex | 0.597725 | 0.433981 | day09.ex | starcoder |
defmodule Marker.Compiler do
@moduledoc """
`Marker.Compiler` renders the element macros to html. It tries do as much work during macro expansion,
resulting in a run time performance comparible to precompiled templates.
For example, this element call:
```elixir
div 1 + 1
```
will be expanded to... | lib/marker/compiler.ex | 0.724091 | 0.693135 | compiler.ex | starcoder |
defmodule Swagger.Schema.Operation do
@moduledoc """
An Operation defines a specific action one can take against an API.
An Operation contains all of the information necessary to execute a request to
perform that action, such as what parameters it requires, what content types it
will accept and return, the sp... | lib/schema/operation.ex | 0.729616 | 0.40642 | operation.ex | starcoder |
defmodule Cldr.Gettext.Interpolation do
@moduledoc """
As of [Gettext 0.19](https://hex.pm/packages/gettext/0.19.0), `Gettext`
supports user-defined [interpolation modules](https://hexdocs.pm/gettext/Gettext.html#module-backend-configuration).
This makes it easy to combine the power of ICU message formats with ... | lib/cldr/gettext/interpolation.ex | 0.793746 | 0.79538 | interpolation.ex | starcoder |
defmodule Monad.Maybe do
use Monad
use Monad.Pipeline
@moduledoc """
The Maybe monad.
The `Maybe` monad encapsulates an optional value. A `maybe` monad either
contains a value `x` (represented as "`{:just, x}`") or is empty (represented
as "`:nothing`").
`Maybe` can be used a simple kind of error mon... | lib/monad/maybe.ex | 0.905982 | 0.536252 | maybe.ex | starcoder |
defmodule Day17 do
def readinput() do
File.read!("17.input.txt")
|> String.split("\n", trim: true)
|> Enum.map(&String.split(&1, "", trim: true))
end
def neighbors3({x, y, z}) do
for i <- -1..1 do
for j <- -1..1 do
for k <- -1..1 do
{x + i, y + j, z + k}
end
... | 2020/day17/lib/day17.ex | 0.528047 | 0.548915 | day17.ex | starcoder |
defmodule DublinBusTelegramBot.Commands do
require Logger
import Meter
@as_markdown [{:parse_mode, "Markdown"}]
defmeter start(chat_id) do
Nadia.send_message(chat_id, "
Welcome to the Dublin Bus bot:
Access to the *Real Time Passenger Information (RTPI)* for Dublin Bus services. Data are retrieved pa... | lib/commands.ex | 0.554953 | 0.549157 | commands.ex | starcoder |
defmodule ForgeAbi.Util.TypeUrl do
@moduledoc """
quick convertion among type, type_url and type_mod
"""
require Logger
defmodule DummyCodec do
@moduledoc false
def encode(data), do: data
def decode(data), do: data
end
defmodule JsonCodec do
@moduledoc false
def encode(data), do: Ja... | lib/forge_abi/util/type_url.ex | 0.767429 | 0.683526 | type_url.ex | starcoder |
defmodule ExUnit do
defrecord Test, [:name, :case, :failure, :invalid] do
@moduledoc """
A record that keeps information about the test.
It is received by formatters and also accessible
in the metadata under the key `:test`.
"""
end
defrecord TestCase, [:name, :failure] do
@moduledoc """
... | lib/ex_unit/lib/ex_unit.ex | 0.832951 | 0.826677 | ex_unit.ex | starcoder |
defmodule CouchGears.App do
@moduledoc """
A CouchGears tries to load each application from `apps/*` directory.
Check the `CouchGears.Initializer` module for more details.
Developers can use module functions to configure execution environment.
## Application (aka gear)
This is a main module for gear app... | lib/couch_gears/app.ex | 0.767603 | 0.412175 | app.ex | starcoder |
defmodule Mechanize.Page do
@moduledoc """
The HTML Page.
This module defines `Mechanize.Page` and the main functions for working with Pages.
The Page is created as a result of a successful HTTP request.
```
alias Mechanize.{Browser, Page}
browser = Browser.new()
page = Browser.get!(browser, "https:/... | lib/mechanize/page.ex | 0.930703 | 0.818483 | page.ex | starcoder |
defmodule Phoenix.HTML.Link do
@moduledoc """
Conveniences for working with links and URLs in HTML.
"""
import Phoenix.HTML.Tag
@doc """
Generates a link to the given URL.
## Examples
link("hello", to: "/world")
#=> <a href="/world">hello</a>
link("hello", to: URI.parse("https://eli... | lib/phoenix_html/link.ex | 0.713731 | 0.485112 | link.ex | starcoder |
defmodule GroupManager.Data.Item do
require Record
require Chatter.NetID
alias Chatter.NetID
alias Chatter.Serializer
Record.defrecord :item,
member: nil,
op: :get,
start_range: 0,
end_range: 0xffffffff,
... | lib/group_manager/data/item.ex | 0.639173 | 0.505554 | item.ex | starcoder |
defmodule Plug.Router do
@moduledoc ~S"""
A DSL to define a routing algorithm that works with Plug.
It provides a set of macros to generate routes. For example:
defmodule AppRouter do
use Plug.Router
import Plug.Conn
plug :match
plug :dispatch
get "/hello" do
... | lib/plug/router.ex | 0.881328 | 0.525125 | router.ex | starcoder |
defmodule Cog.BusDriver do
@moduledoc """
BusDriver is responsible for configuring, starting, and stopping Cog's embedded
message bus.
## Configuration
BusDriver can be configured with the following configuration parameters.
`:host` - Listen host name or IP address. Defaults to `"127.0.0.1"`.
`:port` -... | lib/cog/bus_driver.ex | 0.835618 | 0.551272 | bus_driver.ex | starcoder |
defmodule Automaton.Blackboard do
@moduledoc """
The Node Blackboard
Blackboard Architectures
A blackboard system isn’t a decision making tool in its own right. It is a
mechanism for coordinating the actions of several decision makers. The
individual decision making systems can be implemente... | lib/automata/blackboard/automaton_blackboard.ex | 0.756268 | 0.757436 | automaton_blackboard.ex | starcoder |
defmodule Wallaby.Query do
@moduledoc ~S"""
Provides the query DSL.
Queries are used to locate and retrieve DOM elements from a browser (see
`Wallaby.Browser`). You create queries like so:
```
Query.css(".some-css")
Query.xpath(".//input")
```
## Form elements
There are several custom finders fo... | lib/wallaby/query.ex | 0.870721 | 0.842345 | query.ex | starcoder |
defmodule Slipstream.Configuration do
@definition [
uri: [
doc: """
The endpoint to which the websocket will connect. Schemes of "ws" and
"wss" are supported, and a scheme must be provided. Either binaries or
`URI` structs are accepted. E.g. `"ws://localhost:4000/socket/websocket"`.
... | lib/slipstream/configuration.ex | 0.903704 | 0.767232 | configuration.ex | starcoder |
defmodule Credo.Check.Readability.MaxLineLength do
@moduledoc """
Checks for the length of lines.
Ignores function definitions and (multi-)line strings by default.
"""
@explanation [
check: @moduledoc,
params: [
max_length: "The maximum number of characters a line may consist of.",
ignor... | lib/credo/check/readability/max_line_length.ex | 0.555435 | 0.466906 | max_line_length.ex | starcoder |
defmodule Game.Command.Map do
@moduledoc """
The "map" command
"""
use Game.Command
use Game.Zone
alias Game.Environment
alias Game.Session.GMCP
commands(["map"], parse: false)
@impl Game.Command
def help(:topic), do: "Map"
def help(:short), do: "View a map of the zone"
def help(:full) do
... | lib/game/command/map.ex | 0.73173 | 0.407422 | map.ex | starcoder |
defmodule AdventOfCode.Y2021.Day4 do
@moduledoc """
--- Day 4: Giant Squid ---
You're already almost 1.5km (almost a mile) below the surface of the ocean, already so deep that you can't see any sunlight. What you can see, however, is a giant squid that has attached itself to the outside of your submarine.
May... | lib/y_2021/d4/day4.ex | 0.751648 | 0.582016 | day4.ex | starcoder |
defmodule Sage.EmptyError do
@moduledoc """
Raised at runtime when empty sage is executed.
"""
defexception [:message]
@doc false
def exception(_opts) do
message = "trying to execute empty Sage is not allowed"
%__MODULE__{message: message}
end
end
defmodule Sage.AsyncTransactionTimeoutError do
... | lib/sage/exceptions.ex | 0.848659 | 0.409693 | exceptions.ex | starcoder |
defmodule TextBasedFPS.PlayerCommand.Fire do
import TextBasedFPS.CommandHelper
import TextBasedFPS.Text, only: [danger: 1, highlight: 1]
alias TextBasedFPS.{
GameMap,
Notification,
PlayerCommand,
Room,
RoomPlayer,
ServerState
}
@behaviour PlayerCommand
@impl true
def execute(sta... | lib/text_based_fps/player_commands/fire.ex | 0.625781 | 0.409988 | fire.ex | starcoder |
defmodule FarmbotExt.AMQP.PingPongChannel do
@moduledoc """
AMQP channel responsible for responding to `ping` messages.
Simply echos the exact data received on the `ping` channel
onto the `pong` channel.
Also has a ~15-20 minute timer that will do an `HTTP` request
to `/api/device`. This refreshes the `las... | farmbot_ext/lib/farmbot_ext/amqp/ping_pong_channel.ex | 0.770335 | 0.406214 | ping_pong_channel.ex | starcoder |
defmodule AWS.LexRuntime do
@moduledoc """
Amazon Lex provides both build and runtime endpoints.
Each endpoint provides a set of operations (API). Your conversational bot uses
the runtime API to understand user utterances (user input text or voice). For
example, suppose a user says "I want pizza", your bot ... | lib/aws/generated/lex_runtime.ex | 0.912034 | 0.523359 | lex_runtime.ex | starcoder |
defmodule Brook do
@moduledoc ~S"""
Brook provides an event stream client interface for distributed applications
to communicate indirectly and asynchronously. Brook sends and receives messages
with the event stream (typically a message queue service) via a driver module
and persists an application-specific vi... | lib/brook.ex | 0.912148 | 0.759504 | brook.ex | starcoder |
defmodule ExWire.Packet.Capability.Par.SnapshotData.StateChunk do
@moduledoc """
State chunks store the entire state of a given block. A "rich" account
structure is used to save space. Each state chunk consists of a list of
lists, each with two items: an address' sha3 hash and a rich account
structure correla... | apps/ex_wire/lib/ex_wire/packet/capability/par/snapshot_data/state_chunk.ex | 0.877135 | 0.798462 | state_chunk.ex | starcoder |
defmodule AWS.Route53 do
@moduledoc """
Amazon Route 53 is a highly available and scalable Domain Name System (DNS)
web service.
"""
@doc """
Associates an Amazon VPC with a private hosted zone.
<note> To perform the association, the VPC and the private hosted zone must
already exist. Also, you can't... | lib/aws/route53.ex | 0.899583 | 0.471892 | route53.ex | starcoder |
defmodule OT.Server.Impl do
@moduledoc """
Implements the business logic of interacting with data in an OT system.
"""
@adapter Application.get_env(:ot_server, :adapter, OT.Server.ETSAdapter)
@max_retries Application.get_env(:ot_server, :max_retries)
@doc """
Get a datum using the configured `OT.Server.... | lib/ot/server/impl.ex | 0.780537 | 0.476945 | impl.ex | starcoder |
defmodule AWS.PinpointEmail do
@moduledoc """
Amazon Pinpoint Email Service
Welcome to the *Amazon Pinpoint Email API Reference*. This guide provides
information about the Amazon Pinpoint Email API (version 1.0), including
supported operations, data types, parameters, and schemas.
[Amazon Pinpoint](https... | lib/aws/pinpoint_email.ex | 0.863837 | 0.630799 | pinpoint_email.ex | starcoder |
defmodule RDF.XSD.Datatype do
@moduledoc """
A behaviour for XSD datatypes.
A XSD datatype has three properties:
- A _value space_, which is a set of values.
- A _lexical space_, which is a set of _literals_ used to denote the values.
- A collection of functions associated with the datatype.
### Built... | lib/rdf/xsd/datatype.ex | 0.901531 | 0.916596 | datatype.ex | starcoder |
defmodule Rummage.Phoenix.SortController do
@moduledoc """
`SortController` a controller helper in `Rummage.Phoenix` which stores
helpers for Sort hook in `Rummage`. This formats params before `index`
action into a format that is expected by the default `Rummage.Ecto`'s sort
hook: `Rummage.Ecto.Sort`
```
... | lib/rummage_phoenix/hooks/controllers/sort_controller.ex | 0.792022 | 0.760295 | sort_controller.ex | starcoder |
defmodule EZCalendar.HTML do
@moduledoc """
Functions for rendering the calendars with HTML.
For easy access to the HTML render functions
add `EZCalendar` to your view.
defmodule MyApp.ShiftView do
use MyApp.Web, :view
import EZCalendar.HTML
end
This will import the functions i... | lib/ez_calendar/html.ex | 0.753829 | 0.415936 | html.ex | starcoder |
defmodule Etso.Adapter.TableRegistry do
@moduledoc """
Provides convenience function to spin up a Registry, which is used to hold the Table Servers
(registered by GenServer when starting up), alongside their ETS tables (registered when the
Table Server starts).
"""
@spec child_spec(Etso.repo()) :: Supervis... | lib/etso/adapter/table_registry.ex | 0.778186 | 0.474449 | table_registry.ex | starcoder |
defmodule Indicado.WR do
@moduledoc """
This is the WR module used for calculating Williams %R.
"""
@doc """
Calculates WR for the list.
Returns `{:ok, rs_list}` or `{:error, reason}`
## Examples
iex> Indicado.WR.eval([1, 3, 4, 3, 1, 5], 4)
{:ok, [0.3333333333333333, 1.0, 0.0]}
iex>... | lib/indicado/wr.ex | 0.911682 | 0.506836 | wr.ex | starcoder |
defmodule Beanstix do
alias Beanstix.Connection
@moduledoc """
Beanstix - A beanstalkd client coding with Elixir
Fored from ElixirTalk
Copyright 2014-2016 by jsvisa(<EMAIL>)
"""
@type connection_error :: :timeout | :closed | :inet.posix()
@type result :: {:ok, non_neg_integer} | {:error, term}
@vsn... | lib/beanstix.ex | 0.805823 | 0.410697 | beanstix.ex | starcoder |
defmodule Cryptopunk.Derivation.Path do
@moduledoc """
Utility functions to work with deriviation path
See https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
"""
defstruct [:type, :purpose, :coin_type, :account, :change, :address_index]
@type t :: %__MODULE__{}
@type raw_path :: {atom(), [no... | lib/cryptopunk/derivation/path.ex | 0.900275 | 0.689155 | path.ex | starcoder |
defmodule Rummage.Ecto.CustomHook.SimpleSort do
@moduledoc """
`Rummage.Ecto.CustomHook.SimpleSort` is the default sort hook that comes with
`Rummage.Ecto`.
This module provides a operations that can add sorting functionality to
a pipeline of `Ecto` queries. This module works by taking the `field` that shoul... | lib/rummage_ecto/custom_hooks/simple_sort.ex | 0.838117 | 0.946745 | simple_sort.ex | starcoder |
defmodule Credo.Code.Parameters do
@moduledoc """
This module provides helper functions to analyse the parameters taken by a
function.
"""
@def_ops [:def, :defp, :defmacro]
@doc "Returns the parameter count for the given function's AST"
def count(nil), do: 0
for op <- @def_ops do
def count({unquot... | lib/credo/code/parameters.ex | 0.606848 | 0.520253 | parameters.ex | starcoder |
defmodule Bigtable.RowSet do
@moduledoc """
Provides functions to build a `Google.Bigtable.V2.RowSet` and apply it to a `Google.Bigtable.V2.ReadRowsRequest`
"""
alias Bigtable.ReadRows
alias Google.Bigtable.V2
@doc """
Adds a single or list of row keys to a `Google.Bigtable.V2.ReadRowsRequest`
Returns... | lib/data/row_set.ex | 0.921274 | 0.607721 | row_set.ex | starcoder |
defmodule Ash.Filter.Predicate do
@moduledoc "Represents a filter predicate"
defstruct [:resource, :attribute, :relationship_path, :predicate, :value]
alias Ash.Error.Query.UnsupportedPredicate
alias Ash.Filter
alias Ash.Filter.{Expression, Not}
@type predicate :: struct
@type comparison ::
... | lib/ash/filter/predicate.ex | 0.891714 | 0.489015 | predicate.ex | starcoder |
defmodule GTFSRealtimeViz do
@moduledoc """
GTFSRealtimeViz is an OTP app that can be run by itself or as part of another
application. You can send it protobuf VehiclePositions.pb files, in sequence,
and then output them as an HTML fragment, to either open in a browser or embed
in another view.
Example usa... | lib/gtfs_realtime_viz.ex | 0.800224 | 0.774924 | gtfs_realtime_viz.ex | starcoder |
defmodule Pbuf.Protoc.Fields.Simple do
use Pbuf.Protoc.Field
def new(desc, context) do
typespec = typespec(desc)
repeated = is_repeated?(desc)
packed? = context.version == 3 || (desc.options != nil && desc.options.packed == true)
{tag, name, type, prefix} = extract_core(desc, packed?)
{encode... | lib/protoc/fields/simple.ex | 0.522933 | 0.420391 | simple.ex | starcoder |
defmodule TextDelta do
@moduledoc """
Delta is a format used to describe text states and changes.
Delta can describe any rich text changes or a rich text itself, preserving all
the formatting.
At the baseline level, delta is an array of operations (constructed via
`TextDelta.Operation`). Operations can be... | lib/text_delta.ex | 0.948725 | 0.766337 | text_delta.ex | starcoder |
defmodule Explorer.PolarsBackend.Shared do
# A collection of **private** helpers shared in Explorer.PolarsBackend.
@moduledoc false
alias Explorer.DataFrame, as: DataFrame
alias Explorer.PolarsBackend.DataFrame, as: PolarsDataFrame
alias Explorer.PolarsBackend.Native
alias Explorer.PolarsBackend.Series, as... | lib/explorer/polars_backend/shared.ex | 0.762954 | 0.649655 | shared.ex | starcoder |
defmodule AdventOfCode.Day12 do
@move_regex ~r/^(N|S|E|W|L|R|F)(\d+)$/
@angles %{
:E => 0,
:N => 90,
:W => 180,
:S => 270
}
@inverse_angles %{
0 => :E,
90 => :N,
180 => :W,
270 => :S
}
@spec move_ship(
[{:E | :F | :L | :N | :R | :S | :W, number}],
{{numbe... | lib/day12.ex | 0.797281 | 0.750118 | day12.ex | starcoder |
defmodule FlowMonitor.Inspector do
@moduledoc false
alias FlowMonitor.Collector
@mapper_types [:map, :flat_map, :each, :filter]
@binary_operators [
:+,
:-,
:*,
:++,
:--,
:..,
:<>,
:in,
:"not in",
:|>,
:<<<,
:>>>,
:~>>,
:<<~,
:~>,
:<~,
:<~>,
... | lib/flow_monitor/inspector.ex | 0.527073 | 0.569194 | inspector.ex | starcoder |
defmodule ApiWeb.RoutePatternController do
@moduledoc """
Controller for Routes. Filterable by:
* id
* route_id
"""
use ApiWeb.Web, :api_controller
alias State.RoutePattern
plug(:ensure_path_matches_version)
@filters ~w(id route direction_id stop)
@includes ~w(route representative_trip)
@pagina... | apps/api_web/lib/api_web/controllers/route_pattern_controller.ex | 0.874734 | 0.463019 | route_pattern_controller.ex | starcoder |
defmodule NYSETL.Engines.E1.State do
@moduledoc """
Used as an Agent-based state machine for processing a single ECLRS file.
"""
use Agent
alias NYSETL.ECLRS
require Logger
@enforce_keys [:file]
defstruct file: nil,
line_count: 0,
duplicate_records: %{total: 0},
err... | lib/nys_etl/engines/e1/state.ex | 0.640523 | 0.455986 | state.ex | starcoder |
defmodule Bonbon.TranslationCase do
@moduledoc """
This module defines the test case to be used by
translation model tests.
"""
use ExUnit.CaseTemplate
using(options) do
options = Keyword.merge([
model: to_string(__CALLER__.module) |> String.trim_trailing("Test") |> Str... | test/support/translation_case.ex | 0.811265 | 0.449755 | translation_case.ex | starcoder |
defmodule Cldr.Calendar.Formatter do
@moduledoc """
Calendar formatter behaviour.
This behaviour defines a set of
callbacks that are invoked during
the formatting of a calendar.
At each point in the formatting
process the callbacks are invoked
from the "inside out". That is,
`format_day/4` is invok... | lib/formatter.ex | 0.903572 | 0.649787 | formatter.ex | starcoder |
defmodule EthClient.Contract.Opcodes do
alias EthClient.Rpc
@moduledoc """
This module provides a function to turn any valid EVM byte code
into opcodes and a function to retrieve a contract and turn it into
its opcodes.
"""
def bytecode_to_opcodes(code) when is_binary(code) do
parse_code(code, [])... | eth_client/lib/eth_client/contract/opcodes.ex | 0.533397 | 0.460471 | opcodes.ex | starcoder |
defmodule Mix.Tasks.Eunit do
use Mix.Task
@recursive true
@preferred_cli_env :test
@shortdoc "Compile and run eunit tests"
@moduledoc """
Run eunit tests for a project.
This task compiles the project and its tests in the test environment,
then runs eunit tests. This task works recursively in umbrel... | lib/mix/tasks/eunit.ex | 0.705075 | 0.832951 | eunit.ex | starcoder |
defmodule EdgeDB.Query do
@moduledoc """
A structure carrying the information related to the query.
It's mostly used in driver internally, but user can retrive it along with `EdgeDB.Result` struct
from succeed query execution using `:raw` option for `EdgeDB.query*/4` functions. See `t:EdgeDB.query_option/0`.... | lib/edgedb/query.ex | 0.923653 | 0.54359 | query.ex | starcoder |
defmodule SSHKit.SSH do
@moduledoc ~S"""
Provides convenience functions for working with SSH connections
and executing commands on remote hosts.
## Examples
```
{:ok, conn} = SSHKit.SSH.connect("eg.io", user: "me")
{:ok, output, status} = SSHKit.SSH.run(conn, "uptime")
:ok = SSHKit.SSH.close(conn)
... | lib/sshkit/ssh.ex | 0.903033 | 0.82963 | ssh.ex | starcoder |
defmodule Snowpack.Protocol do
@moduledoc """
Implementation of `DBConnection` behaviour for `Snowpack.ODBC`.
Handles translation of concepts to what ODBC expects and holds
state for a connection.
This module is not called directly, but rather through
other `Snowpack` modules or `DBConnection` functions.
... | lib/snowpack/protocol.ex | 0.862323 | 0.449091 | protocol.ex | starcoder |
defmodule Sqlitex.Statement do
alias Sqlitex.Row
@moduledoc """
Provides an interface for working with SQLite prepared statements.
Care should be taken when using prepared statements directly - they are not
immutable objects like most things in Elixir. Sharing a statement between
different processes can ca... | deps/sqlitex/lib/sqlitex/statement.ex | 0.913351 | 0.781289 | statement.ex | starcoder |
defmodule AWS.SWF do
@moduledoc """
Amazon Simple Workflow Service
The Amazon Simple Workflow Service (Amazon SWF) makes it easy to build
applications that use Amazon's cloud to coordinate work across distributed
components. In Amazon SWF, a *task* represents a logical unit of work that
is performed by a ... | lib/aws/swf.ex | 0.928959 | 0.641591 | swf.ex | starcoder |
defmodule GroupManager.Data.LocalClock do
require Record
require Chatter.NetID
alias Chatter.NetID
alias Chatter.Serializer
Record.defrecord :local_clock,
member: nil,
time_val: 0
@type t :: record( :local_clock,
member: NetID.t,
... | lib/group_manager/data/local_clock.ex | 0.672439 | 0.446374 | local_clock.ex | starcoder |
defexception ExUnit.AssertionError, message: "assertion failed"
defmodule ExUnit.Assertions do
@moduledoc """
This module contains a set of assertions functions that are
imported by default into your test cases.
In general, a developer will want to use the general
`assert` macro in tests. The macro tries to... | lib/ex_unit/lib/ex_unit/assertions.ex | 0.914706 | 0.903166 | assertions.ex | starcoder |
defrecord Flect.Compiler.Syntax.Token, type: nil,
value: "",
location: nil do
@moduledoc """
Represents a token from a Flect source code document.
`type` is an atom describing the kind of token. `value` is a binary
containing... | lib/compiler/syntax/token.ex | 0.863722 | 0.938181 | token.ex | starcoder |
defmodule DeadLetter.Carrier do
@moduledoc """
Defines the behaviour that clients must implement
in order to properly dispatch dead letter messages
to the waiting message queue service.
"""
@doc """
Start a DeadLetter carrier and link to the current process.
"""
@callback start_link(term()) :: GenSer... | apps/dead_letter/lib/dead_letter/carrier.ex | 0.833731 | 0.462837 | carrier.ex | starcoder |
defmodule OAuth2TokenManager do
@moduledoc """
Manages OAuth2 tokens and OpenID Connect claims and ID tokens
## Options
- `:auto_introspect`: if set to `true`, access and refresh tokens are automatically inspected
when they are registered, so as to gather additional useful information about them. The
auth... | lib/oauth2_token_manager.ex | 0.889745 | 0.712082 | oauth2_token_manager.ex | starcoder |
defmodule Omise.Charge do
@moduledoc ~S"""
Provides Charge API interfaces.
<https://www.omise.co/charges-api>
"""
use Omise.HTTPClient, endpoint: "charges"
defstruct object: "charge",
id: nil,
livemode: nil,
location: nil,
amount: nil,
currency:... | lib/omise/charge.ex | 0.917778 | 0.472562 | charge.ex | starcoder |
defmodule Andy.Rover.Actuation do
@moduledoc "Provides the configurations of all rover actuators to be activated"
require Logger
alias Andy.{ActuatorConfig, MotorSpec, LEDSpec, SoundSpec, Activation, Script}
import Andy.Utils
@default_wait 500
@doc "Give the configurations of all Rover actuators"
def ... | lib/andy/platforms/rover/actuation.ex | 0.782746 | 0.476762 | actuation.ex | starcoder |
defmodule Bigtable.ReadRows do
@moduledoc """
Provides functions to build `Google.Bigtable.V2.ReadRowsRequest` and submit them to Bigtable.
"""
alias Bigtable.{ChunkReader, Utils}
alias Google.Bigtable.V2
alias V2.Bigtable.Stub
@doc """
Builds a `Google.Bigtable.V2.ReadRowsRequest` with a provided tabl... | lib/data/read_rows.ex | 0.859325 | 0.487185 | read_rows.ex | starcoder |
defmodule RigMetrics.EventsMetrics do
@moduledoc """
Metrics instrumenter for the Rig Events (consume, produce).
"""
use Prometheus.Metric
# Consumer
@counter name: :rig_consumed_events_total,
help: "Total count of consumed events.",
labels: [:source, :topic]
@counter name: :rig_co... | lib/rig_metrics/events_metrics.ex | 0.736685 | 0.5592 | events_metrics.ex | starcoder |
defmodule GiantSquid do
def read_input(filename) do
lines = File.stream!(filename) |> Enum.map(&String.trim_trailing/1)
[move_line, _blank | lines] = lines
moves =
move_line
|> String.split(",")
|> Enum.map(&String.to_integer/1)
{moves, read_boards(lines)}
end
defp read_boards(l... | day_4/giant_squid.ex | 0.766031 | 0.405625 | giant_squid.ex | starcoder |
defmodule Simplepq do
alias Simplepq.Queue
@moduledoc """
Simple queue that's store on the disc.
Warning! At this moment all functions don't handle case when the file don't exist. Errors can be raised.
"""
@doc """
Creates file on the filesystem and create Simplepq.Queue associated with this file.
Re... | lib/simplepq.ex | 0.832066 | 0.436082 | simplepq.ex | starcoder |
defmodule Mix.Tasks.Hex.Organization do
use Mix.Task
@shortdoc "Manages Hex.pm organizations"
@moduledoc """
Manages the list of authorized Hex.pm organizations.
Organizations is a feature of Hex.pm to host and manage private packages. See
<https://hex.pm/docs/private> for more information.
By default... | lib/mix/tasks/hex.organization.ex | 0.828072 | 0.478712 | hex.organization.ex | starcoder |
defmodule Commanded.EventStore.Adapters.EventStore do
@moduledoc """
[EventStore](https://github.com/commanded/eventstore) adapter for
[Commanded](https://github.com/commanded/commanded).
"""
alias Commanded.EventStore.Adapters.EventStore.Mapper
@behaviour Commanded.EventStore
@all_stream "$all"
@im... | lib/event_store_adapter.ex | 0.778186 | 0.429968 | event_store_adapter.ex | starcoder |
defmodule Patch.Mock.Value do
@moduledoc """
Interface for generating mock values.
In a test this module is imported into the test and so using this module directly is not
necessary.
"""
alias Patch.Apply
alias Patch.Mock.Values
@type t ::
Values.Callable.t()
| Values.CallableStac... | lib/patch/mock/value.ex | 0.953966 | 0.920896 | value.ex | starcoder |
defmodule YukiHelper.CLI do
@moduledoc """
Provides the following commands:
```console
yuki help
yuki config
yuki lang.list
yuki test
yuki testcase.list
yuki testcase.download
```
For the usage of each command, refer to the help command.
```console
yuki help COMMAND
```
"""
@command... | lib/yuki_helper/cli.ex | 0.569733 | 0.606702 | cli.ex | starcoder |
defmodule Hades.Helpers do
@moduledoc """
Provides some usefull functions for internal handling `NMAP` outputs.
"""
import SweetXml
require Logger
alias Hades.Command
alias Hades.Argument
@doc """
This functions parses the given file that is located at `filepath` and
returns a `t:map/0` filled with... | lib/helpers.ex | 0.848816 | 0.513059 | helpers.ex | starcoder |
defmodule EspEx.MessageStore.Postgres do
@moduledoc """
This is the real implementation of MessageStore. It will execute the needed
queries on Postgres through Postgrex by calling the functions provided in
[ESP](https://github.com/Carburetor/ESP/tree/master/app/config/functions/stream). You should be able to in... | lib/esp_ex/message_store/postgres.ex | 0.814754 | 0.521167 | postgres.ex | starcoder |
defmodule Spell do
@moduledoc """
`Spell` is a WAMP client library and an application for managing WAMP peers.
## Examples
See `Crossbar` for how to start a Crossbar.io server for interactive
development.
Once up, you can connect a new peer by calling:
{:ok, peer} = Spell.connect(Crossbar.uri,
... | lib/spell.ex | 0.88819 | 0.51751 | spell.ex | starcoder |
defmodule Game.Format.Template do
@moduledoc """
Template a string with variables
"""
@doc """
Render a template with a context
Variables are denoted with `[key]` in the template string. You can also
include leading spaces that can be collapsed if the variable is nil or does
not exist in the context.
... | lib/game/format/template.ex | 0.88639 | 0.410077 | template.ex | starcoder |
defmodule Ash.DataLayer.Ets do
@moduledoc """
An ETS (Erlang Term Storage) backed Ash Datalayer, for testing.
This is used for testing. *Do not use this data layer in production*
"""
alias Ash.Actions.Sort
alias Ash.Filter.{Expression, Not, Predicate}
alias Ash.Filter.Predicate.{Eq, GreaterThan, In, IsN... | lib/ash/data_layer/ets.ex | 0.847021 | 0.424233 | ets.ex | starcoder |
defmodule Phoenix.LiveDashboard.Router do
@moduledoc """
Provides LiveView routing for LiveDashboard.
"""
@doc """
Defines a LiveDashboard route.
It expects the `path` the dashboard will be mounted at
and a set of options.
This will also generate a named helper called `live_dashboard_path/2`
which ... | lib/phoenix/live_dashboard/router.ex | 0.895074 | 0.552419 | router.ex | starcoder |
defmodule Exq.Api.Server do
@moduledoc """
The API deals with getting current stats for the UI / API.
"""
alias Exq.Support.Config
alias Exq.Redis.JobQueue
alias Exq.Redis.JobStat
use GenServer
defmodule State do
defstruct redis: nil, namespace: nil
end
def start_link(opts \\ []) do
GenS... | lib/exq/api/server.ex | 0.659515 | 0.448426 | server.ex | starcoder |
defmodule HL7.Composite.Spec do
@moduledoc "Macros and functions used to define HL7 composite fields"
@type option ::
{:separators, [{key :: atom, separator :: byte}]}
| {:trim, boolean}
@doc false
defmacro __using__(_) do
quote do
import unquote(__MODULE__)
end
end
@doc ... | lib/ex_hl7/composite/spec.ex | 0.89391 | 0.486088 | spec.ex | starcoder |
defmodule Tic_Toc do
@moduledoc """
This is the Tic Toc module.
This module is an implementation for Tic Toc game
It is a basic implementation to get knowledge about
tuples, if conditions and recursivity funtions.
How to use:
1.- The game ask you about the gamers names like this:
Input the name ... | tic_toc_v2.ex | 0.60964 | 0.651258 | tic_toc_v2.ex | starcoder |
defmodule Elsa.Consumer.Worker do
@moduledoc """
Defines the worker GenServer that is managed by the DynamicSupervisor.
Workers are instantiated and assigned to a specific topic/partition
and process messages according to the specified message handler module
passed in from the manager before calling the ack f... | lib/elsa/consumer/worker.ex | 0.72331 | 0.509764 | worker.ex | starcoder |
defmodule Exkismet.Api do
@moduledoc """
Provides a simple method for calling the Akismet API. To use, be sure to set
your hostname, and api key by adding the following line in config.exs:
`config :exkismet, key: "<your api key>", blog: "http://yourhostname.com"`
"""
@doc """
Validates your API key wi... | lib/exkismet/api.ex | 0.660939 | 0.59564 | api.ex | starcoder |
defmodule AWS.CodeStarConnections do
@moduledoc """
AWS CodeStar Connections
The CodeStar Connections feature is in preview release and is subject to change.
This AWS CodeStar Connections API Reference provides descriptions and usage
examples of the operations and data types for the AWS CodeStar Connection... | lib/aws/generated/code_star_connections.ex | 0.883387 | 0.51379 | code_star_connections.ex | starcoder |
defmodule Mogrify do
use Mogrify.Compat
alias Mogrify.Compat
alias Mogrify.Image
alias Mogrify.Option
@doc """
Opens image source.
"""
def open(path) do
path = Path.expand(path)
unless File.regular?(path), do: raise(File.Error)
%Image{path: path, ext: Path.extname(path)}
end
@doc """... | lib/mogrify.ex | 0.806358 | 0.438966 | mogrify.ex | starcoder |
defmodule ConduitAMQP do
@moduledoc """
AMQP adapter for Conduit.
* `url` - Full connection url. Can be used instead of the individual connection options. Default is `amqp://guest:guest@localhost:5672/`.
* `host` - Hostname of the broker (defaults to \"localhost\");
* `port` - Port the broker is listen... | lib/conduit_amqp.ex | 0.699665 | 0.55941 | conduit_amqp.ex | starcoder |
defmodule Ash.Type.CiString do
@constraints [
max_length: [
type: :non_neg_integer,
doc: "Enforces a maximum length on the value"
],
min_length: [
type: :non_neg_integer,
doc: "Enforces a minimum length on the value"
],
match: [
type: {:custom, __MODULE__, :match, []}... | lib/ash/type/ci_string.ex | 0.836354 | 0.493958 | ci_string.ex | starcoder |
defmodule Ecto.Adapters.Jamdb.Oracle do
@moduledoc """
Adapter module for Oracle. `Ecto.Adapters.SQL` callbacks implementation.
It uses `jamdb_oracle` for communicating to the database.
## Features
* Using prepared statement functionality, the SQL statement you want
to run is precompiled and stored i... | lib/jamdb_oracle_ecto.ex | 0.749637 | 0.651854 | jamdb_oracle_ecto.ex | starcoder |
defmodule Phoenix.HTML do
@moduledoc """
Helpers for working with HTML strings and templates.
When used, it imports the given modules:
* `Phoenix.HTML` - functions to handle HTML safety;
* `Phoenix.HTML.Tag` - functions for generating HTML tags;
* `Phoenix.HTML.Form` - functions for working with f... | lib/phoenix_html.ex | 0.85315 | 0.539711 | phoenix_html.ex | starcoder |
defmodule ThousandIsland do
@moduledoc """
Thousand Island is a modern, pure Elixir socket server, inspired heavily by
[ranch](https://github.com/ninenines/ranch). It aims to be easy to understand
& reason about, while also being at least as stable and performant as alternatives.
Thousand Island is implement... | lib/thousand_island.ex | 0.917428 | 0.871803 | thousand_island.ex | starcoder |
defmodule AWS.CostExplorer do
@moduledoc """
The Cost Explorer API enables you to programmatically query your cost and usage
data.
You can query for aggregated data such as total monthly costs or total daily
usage. You can also query for granular data, such as the number of daily write
operations for Amaz... | lib/aws/generated/cost_explorer.ex | 0.919904 | 0.532304 | cost_explorer.ex | starcoder |
defmodule Stream.Reducers do
# Collection of reducers shared by Enum and Stream.
@moduledoc false
defmacro chunk(n, step, limit, f \\ nil) do
quote do
fn entry, acc(h, { buffer, count }, t) ->
buffer = [entry|buffer]
count = count + 1
new =
if count >= unquote(limit)... | lib/elixir/lib/stream/reducers.ex | 0.510741 | 0.463626 | reducers.ex | starcoder |
defmodule Clickhousex.Helpers do
@moduledoc false
defmodule BindQueryParamsError do
@moduledoc false
defexception [:message, :query, :params]
end
@doc false
def bind_query_params(query, []), do: query
def bind_query_params(query, params) do
query_parts = String.split(query, "?")
case le... | lib/clickhousex/helpers.ex | 0.712432 | 0.427158 | helpers.ex | starcoder |
defmodule Stripe.Error do
@moduledoc """
A struct which represents an error which occurred during a Stripe API call.
This struct is designed to provide all the information needed to effectively log and maybe respond
to an error.
It contains the following fields:
- `:source` – this is one of
* `:intern... | lib/stripe/error.ex | 0.917329 | 0.757357 | error.ex | starcoder |
defmodule Freddy.RPC.Client do
@moduledoc ~S"""
This module allows to build RPC client for any Freddy-compliant microservice.
## Example
defmodule PaymentsService do
use Freddy.RPC.Client
@config [timeout: 3500]
def start_link(conn, initial, opts \\ []) do
Freddy.RPC.Cl... | lib/freddy/rpc/client.ex | 0.886623 | 0.439807 | client.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.