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 ExTwiml.Utilities do
@moduledoc """
A grab bag of helpful functions used to generate XML.
"""
import String, only: [downcase: 1, replace: 3]
@doc """
Generates an XML tag.
## Examples
iex> ExTwiml.Utilities.create_tag(:opening, :say, [voice: "woman"])
"<Say voice=\\"woman\\">"
... | lib/ex_twiml/utilities.ex | 0.803714 | 0.431584 | utilities.ex | starcoder |
defmodule Ash.Filter.Runtime do
@moduledoc """
Checks a record to see if it matches a filter statement.
We can't always tell if a record matches a filter statement, and as such this
function may return `:unknown`. Additionally, some expressions wouldn't ever
make sense outside of the context of the data laye... | lib/ash/filter/runtime.ex | 0.874955 | 0.633736 | runtime.ex | starcoder |
defmodule TaskBunny.Connection do
@moduledoc """
A GenServer that handles RabbitMQ connection.
It provides convenience functions to access RabbitMQ through the GenServer.
## GenServer
TaskBunny loads the configurations and automatically starts a GenServer for each host definition.
They are supervised by T... | lib/task_bunny/connection.ex | 0.822403 | 0.515925 | connection.ex | starcoder |
defmodule FreedomFormatter do
@moduledoc ~S"""
Freedom Formatter is a fork of Elixir's code formatter,
with added freedom.
It respects `.formatter.exs` and supports all features of
the standard code formatter, as well as additional features
unlikely to arrive soon in core Elixir.
## Usage
Install:
... | lib/freedom_formatter.ex | 0.779322 | 0.889673 | freedom_formatter.ex | starcoder |
defmodule Phoenix.Digester do
@digested_file_regex ~r/(-[a-fA-F\d]{32})/
@moduledoc """
Digests and compresses static files.
For each file under the given input path, Phoenix will generate a digest
and also compress in `.gz` format. The filename and its digest will be
used to generate the manifest file. I... | lib/phoenix/digester.ex | 0.670716 | 0.517083 | digester.ex | starcoder |
defmodule Geometry.Hex do
@moduledoc false
@type t :: binary()
@type size :: 8 | 16
@type force :: :none | :float
@nan nil
@spec from_binary(binary) :: String.t()
def from_binary(binary), do: from_binary(binary, "")
defp from_binary(<<>>, acc), do: acc
defp from_binary(<<x::8, rest::binary()>>, a... | lib/geometry/hex.ex | 0.836154 | 0.44348 | hex.ex | starcoder |
defmodule ExAliyunOts do
@moduledoc ~S"""
The `ExAliyunOts` module provides a tablestore-based API as a client for working with Alibaba TableStore product servers.
Here are links to official documents in [Chinese](https://help.aliyun.com/document_detail/27280.html) | [English](https://www.alibabacloud.com/help/p... | lib/ex_aliyun_ots.ex | 0.899055 | 0.430806 | ex_aliyun_ots.ex | starcoder |
defmodule PlugHackneyTrace do
@moduledoc """
A plug to enable `hackney_trace` in [hackney](https://github.com/benoitc/hackney).
To use it, just plug it into the desired module.
```
plug PlugHackneyTrace, trace: :min
```
In a Phoenix powered project, you can plug it into a specific action.
```
plug... | lib/plug_hackney_trace.ex | 0.846101 | 0.926901 | plug_hackney_trace.ex | starcoder |
defmodule Griffin.Model.Validations do
@moduledoc """
Library of validation functions and a `valid?/2` function that will
check a map of GraphQL/JSON-like data passes a series of validations.
Used in the models to enforce a database dsl that works for the database
and exposing to GraphQL.
"""
@doc """
... | lib/griffin/model/validations.ex | 0.811228 | 0.880951 | validations.ex | starcoder |
if Code.ensure_loaded?(Absinthe) do
defmodule PromEx.Plugins.Absinthe do
@moduledoc """
This plugin captures metrics emitted by Absinthe. Specifically, it captures timings and metrics
around execution times, query complexity, and subscription timings. In order to get complexity
metrics you'll need to ... | lib/prom_ex/plugins/absinthe.ex | 0.805211 | 0.581125 | absinthe.ex | starcoder |
defmodule EdgehogWeb.Schema.DevicesTypes do
use Absinthe.Schema.Notation
use Absinthe.Relay.Schema.Notation, :modern
alias EdgehogWeb.Resolvers
@desc """
Denotes a type of hardware that devices can have.
It refers to the physical components embedded in a device.
This can represent, e.g., multiple revi... | backend/lib/edgehog_web/schema/devices_types.ex | 0.814864 | 0.470128 | devices_types.ex | starcoder |
defmodule Membrane.Time do
@moduledoc """
Module containing functions needed to perform handling of time.
Membrane always internally uses nanosecond as a time unit. This is how all time
units should represented in the code unless there's a good reason to act
differently.
Please note that Erlang VM may int... | lib/membrane/time.ex | 0.92534 | 0.581927 | time.ex | starcoder |
defmodule Snake.Scene.Legacy.GameOriginal do
use Scenic.Scene
alias Scenic.Graph
alias Scenic.ViewPort
import Scenic.Primitives, only: [rrect: 3, text: 3]
# Constants
@graph Graph.build(font: :roboto, font_size: 36)
@tile_size 32
@snake_starting_size 5
@tile_radius 8
@frame_ms 192
@pellet_score 1... | lib/scenes/legacy/game_original.ex | 0.708011 | 0.452113 | game_original.ex | starcoder |
defmodule Entrance do
@moduledoc """
Provides authentication helpers that take advantage of the options configured
in your config files.
"""
import Entrance.Config, only: [config: 1]
import Ecto.Query, only: [from: 2, or_where: 3]
@doc """
Authenticates an user by the default authenticable field (defi... | lib/entrance.ex | 0.887747 | 0.817647 | entrance.ex | starcoder |
defmodule Spat do
@moduledoc """
Functions for dealing with indexes.
"""
require Itsy.Binary
use Bitwise
@type grid_index :: [non_neg_integer]
@type packed_grid_index :: bitstring
@type encoded_index :: String.t
@type address_modes :: :clamp | :wrap
@type packing_options :: [... | lib/spat.ex | 0.848894 | 0.55652 | spat.ex | starcoder |
defmodule TagCloud do
@moduledoc ~S"""
[](https://github.com/RobertDober/tag_cloud/actions/workflows/ci.yml)
[](https://coveralls.io/g... | lib/tag_cloud.ex | 0.851119 | 0.913213 | tag_cloud.ex | starcoder |
defmodule Imagineer.Image.PNG.Interlace.Adam7.Scanlines do
alias Imagineer.Image.PNG
alias PNG.Interlace.Adam7.Pass
import PNG.Helpers
@moduledoc """
Module for handling PNG-specific behaviour of Adam7
"""
@doc """
Takes in raw image content along with basic dimensions about the image.
Converts that... | lib/imagineer/image/png/interlace/adam7/scanlines.ex | 0.81721 | 0.527925 | scanlines.ex | starcoder |
defmodule Blockchain.Genesis do
@moduledoc """
Defines functions for genesis block generation.
"""
alias Block.Header
alias Blockchain.{Account, Block, Chain}
alias MerklePatriciaTree.TrieStorage
@type seal_config :: %{
mix_hash: binary(),
nonce: binary()
}
@type seal :: %... | apps/blockchain/lib/blockchain/genesis.ex | 0.627951 | 0.515315 | genesis.ex | starcoder |
defmodule ExInsights.Envelope do
@moduledoc ~S"""
Track request envelope
Envelope data looks like this
```json
{
"time": "2017-08-24T08:55:56.968Z",
"iKey": "some-guid-value-key",
"name": "Microsoft.ApplicationInsights.someguidvaluekey.Event",
"tags": {
"ai.session.id": "SLzG... | lib/ex_insights/envelope.ex | 0.736306 | 0.519887 | envelope.ex | starcoder |
defmodule Radixir.System.API do
@moduledoc false
# @moduledoc """
# Submits requests to System API.
# """
alias Radixir.Util
@type options :: keyword
@type error_message :: String.t()
@doc """
Submits request to `/system/version`.
## Parameters
- `options`: Keyword list that contains
- ... | lib/radixir/system/api.ex | 0.888662 | 0.67078 | api.ex | starcoder |
defmodule Ecto.Query.API do
use Ecto.Query.Typespec
@moduledoc """
The Query API available by default in Ecto queries.
All queries in Ecto are typesafe and this module defines all
database functions based on their type. Note that this module defines
only the API, each database adapter still needs to suppo... | lib/ecto/query/api.ex | 0.915491 | 0.41834 | api.ex | starcoder |
defmodule Tanx.Game.Step do
def update(arena, internal, elapsed) do
tanks = move_tanks(arena.tanks, arena.size, internal.decomposed_walls, elapsed)
{explosions, chains} = update_explosions(arena.explosions, elapsed)
{tanks, explosions, events} = resolve_explosion_damage(tanks, explosions, chains)
{mi... | apps/tanx/lib/tanx/game/step.ex | 0.511473 | 0.601242 | step.ex | starcoder |
defmodule Annex.Shape do
@moduledoc """
The Shape module encapsulates helper functions for use in determining the shapes
and validity of shapes between Layers and Layers; Data and Data; and Data and Layers.
"""
import Annex.Utils, only: [is_pos_integer: 1]
alias Annex.AnnexError
@type shape_any :: :any
... | lib/annex/shape.ex | 0.883186 | 0.725041 | shape.ex | starcoder |
defmodule Scenic.Primitive.Path do
@moduledoc """
Draw a complex path on the screen described by a list of actions.
## Data
`list_of_commands`
The data for a path is a list of commands. They are interpreted in order
when the path is drawn. See below for the commands it will accept.
## Styles
This ... | lib/scenic/primitive/path.ex | 0.90479 | 0.780955 | path.ex | starcoder |
defmodule Interpreter do
@moduledoc """
Module responsible for understand brainfuck scripts and perform the corresponding action.
"""
import List
@doc """
Interprets an entire command line in brainfuck.
"""
def execute(command) do
execute(command, 0, [ ])
end
@... | lib/btw_brainfuck/interpreter.ex | 0.604282 | 0.543711 | interpreter.ex | starcoder |
defmodule CanvasAPI.UserService do
@moduledoc """
A service for viewing and manipulating users.
"""
use CanvasAPI.Web, :service
alias CanvasAPI.{Account, Team, User}
@preload [:team]
@doc """
Insert a new user from the given params.
The creator must provide an account and a team.
Options:
- ... | lib/canvas_api/services/user_service.ex | 0.772359 | 0.751557 | user_service.ex | starcoder |
defmodule Miss.Map do
@moduledoc """
Functions to extend the Elixir `Map` module.
"""
@type keys_to_rename :: [{actual_key :: Map.key(), new_key :: Map.key()}] | map()
@type transform :: [{module(), (module() -> term()) | :skip}]
@typep map_to_list :: [{Map.key(), Map.value()}]
@doc """
Converts a `st... | lib/miss/map.ex | 0.910386 | 0.53959 | map.ex | starcoder |
defmodule Pummpcomm.DateDecoder do
@moduledoc """
Decodes `Pummpcomm.History` and `Pummpcomm.Cgm` timestamps to `NaiveDateTime.t`.
"""
use Bitwise
# Types
@typedoc """
A cgm timestamp binary whose format is described in the following table:
+==========================================================... | lib/pummpcomm/date_decoder.ex | 0.874386 | 0.523177 | date_decoder.ex | starcoder |
defmodule Nebulex.Adapter.Queryable do
@moduledoc """
Specifies the query API required from adapters.
## Query values
There are two types of query values. The ones shared and implemented
by all adapters and the ones that are adapter specific.
### Common queries
The following query values are shared an... | lib/nebulex/adapter/queryable.ex | 0.919561 | 0.76388 | queryable.ex | starcoder |
defmodule LcdDisplay.HD44780.Driver do
@moduledoc """
Defines a behaviour required for an LCD driver.
"""
@type num_rows :: 1..4
@type num_cols :: 8..20
@typedoc """
Type that represents the display state.
"""
@type t :: %{
required(:driver_module) => atom,
required(:rows) => num... | lib/lcd_display/driver/hd44780_driver.ex | 0.892073 | 0.54952 | hd44780_driver.ex | starcoder |
defmodule MerklePatriciaTree.Trie.Storage do
@moduledoc """
Module to get and put nodes in a trie by the given
storage mechanism. Generally, handles the function `n(I, i)`,
Eq.(178) from the Yellow Paper.
"""
alias ExthCrypto.Hash.Keccak
alias MerklePatriciaTree.{DB, Trie}
# Maximum RLP length in byte... | apps/merkle_patricia_tree/lib/merkle_patricia_tree/trie/storage.ex | 0.858185 | 0.402451 | storage.ex | starcoder |
defmodule IslandsEngine.Board do
@moduledoc """
Board handling stuff
"""
alias IslandsEngine.{Coordinate, Island}
def new, do: %{}
@doc """
Guesses a coordinate in a board and check it was succesful and if the player
won.
"""
@spec guess(map(), Coordinate.t()) :: {:hit | :miss, atom(), :win | :no_... | lib/islands_engine/board.ex | 0.835349 | 0.482551 | board.ex | starcoder |
defmodule Matrex.Operators do
@moduledoc """
Overrides Kernel math operators and adds common math functions shortcuts for use with matrices.
Use with caution.
## Usage
iex> import IEx.Helpers, except: [t: 1] # Only in iex, conflicts with transpose function
iex> import Matrex.Operators
iex> i... | lib/matrex/operators.ex | 0.741112 | 0.572125 | operators.ex | starcoder |
defmodule Snowflake.Cluster do
@moduledoc """
The Cluster module was included to illustrate how a system could be resilient during node failures
- e.g. a network partition
If a request coming into node1 was to be routed to node3 but node3 is down, it will get routed to another node
The use case here is when ... | lib/snowflake/cluster.ex | 0.816918 | 0.445409 | cluster.ex | starcoder |
defmodule ARI.HTTP.Asterisk do
@moduledoc """
HTTP Interface for CRUD operations on Asterisk
REST Reference: https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Asterisk+REST+API
AsteriskInfo Object: https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+REST+Data+Models#Asterisk18RESTDataModels-AsteriskIn... | lib/ex_ari/http/asterisk.ex | 0.825027 | 0.481881 | asterisk.ex | starcoder |
defmodule Elastic.HTTP do
require Logger
alias Elastic.AWS
@moduledoc ~S"""
Used to make raw calls to Elastic Search.
Each function returns a tuple indicating whether or not the request
succeeded or failed (`:ok` or `:error`), the status code of the response,
and then the processed body of the response.
... | lib/elastic/http.ex | 0.898434 | 0.779238 | http.ex | starcoder |
defmodule BN.FQ do
defstruct [:value, :modulus]
@type t :: %__MODULE__{
value: integer(),
modulus: integer()
}
@default_modulus 21_888_242_871_839_275_222_246_405_745_257_275_088_696_311_157_297_823_662_689_037_894_645_226_208_583
alias BN.FQ.ExtendedEuclideanAlgorithm
@spec ne... | lib/bn/fq.ex | 0.878777 | 0.480113 | fq.ex | starcoder |
defmodule Clustorage.Node do
@moduledoc """
Documentation for Clustorage.Node.
"""
use GenServer
@name :clustorage_node
def start_link([]) do
GenServer.start_link(__MODULE__, %{nodes: MapSet.new()}, [name: @name])
end
def compile(key, arg, type) do
GenServer.cast(@name, {:compile, key, arg, ... | lib/clustorage/node.ex | 0.566738 | 0.419321 | node.ex | starcoder |
defmodule ExZkb.Pathfinder.Chain do
@moduledoc """
Functions for building the home chain from data in the Pathfinder database
"""
import Ecto.Query
require Logger
alias ExZkb.Pathfinder.{Connection, Repo, System}
defstruct [
:map_id,
:root,
:chain,
:connected,
:updated
]
def fin... | lib/ex_zkb/pathfinder/chain.ex | 0.726134 | 0.430327 | chain.ex | starcoder |
defmodule Mix.Compilers.Phoenix.TsInterface do
@moduledoc false
@manifest_vsn :v1
@doc """
This compiler works a little bit different than the usual in the sense that it does not compile sources,
it compiles Router modules into typescript files instead.
The big difference is that the ```source files``` a... | lib/mix/phoenix_ts_interface/compiler.ex | 0.804598 | 0.772531 | compiler.ex | starcoder |
defmodule Maxwell.Conn do
@moduledoc """
The Maxwell connection.
This module defines a `Maxwell.Conn` struct and the main functions
for working with Maxwell connections.
### Request fields
These fields contain request information:
* `url` - the requested url as a binary, example: `"www.example.com:... | lib/maxwell/conn.ex | 0.893762 | 0.483892 | conn.ex | starcoder |
defmodule XMLParser do
@moduledoc """
- Uses external dependencies [:erlsom](https://github.com/willemdj/erlsom) to parse the XML string.
- For converting XML to [Map](https://hexdocs.pm/elixir/Map.html) use `XMLParser.parse/1` or `XMLParser.parse!/1`
"""
@doc """
- Parses the XML string given to the [Ma... | lib/xmlparser.ex | 0.849675 | 0.403273 | xmlparser.ex | starcoder |
defmodule File.Stream do
@moduledoc """
Defines a `File.Stream` struct returned by `File.stream!/3`.
The following fields are public:
* `path` - the file path
* `modes` - the file modes
* `raw` - a boolean indicating if bin functions should be used
* `line_or_bytes` - ... | lib/elixir/lib/file/stream.ex | 0.793986 | 0.483648 | stream.ex | starcoder |
defmodule WorkerTracker.ProcessHelper do
@moduledoc """
A module to help with processing process strings
"""
@doc ~S"""
This function populates the given `accumulator` with the contents of the `process_string` based on the provided callback `function`.
## Example
iex> "1 2 3" |> WorkerTracker.Proce... | lib/worker_tracker/process_helper.ex | 0.766862 | 0.515498 | process_helper.ex | starcoder |
defmodule CoopMinesweeper.Game.Game do
@moduledoc """
This module holds the logic to interact with a minesweeper field. All calls
to one field are done through its corresponding process so that no race
conditions occur, when multiple players interact with the same field.
"""
use GenServer, restart: :tempor... | lib/coop_minesweeper/game/game.ex | 0.785226 | 0.528473 | game.ex | starcoder |
defmodule Map do
@moduledoc """
A set of functions for working with maps.
Maps are key-value stores where keys can be any value and
are compared using the match operator (`===`). Maps can be
created with the `%{}` special form defined in the
`Kernel.SpecialForms` module.
"""
@type key :: any
@type v... | lib/elixir/lib/map.ex | 0.926162 | 0.638906 | map.ex | starcoder |
defmodule MapX do
@moduledoc ~S"""
Some map extensions.
"""
import Map, only: [put: 3]
@compile {:inline, get: 2, get: 3, delete: 2, fetch: 2}
@doc ~S"""
Merges two maps into one, resolving conflicts through the given `fun`.
All keys in `map2` will be added to `map1`. The given function will be invoked... | lib/common_x/map_x.ex | 0.915224 | 0.918517 | map_x.ex | starcoder |
defmodule ExFSM do
@type fsm_spec :: %{{state_name :: atom, event_name :: atom} => {exfsm_module :: atom,[dest_statename :: atom]}}
@moduledoc """
After `use ExFSM` : define FSM transition handler with `deftrans fromstate({action_name,params},state)`.
A function `fsm` will be created returning a map of the `fsm... | lib/exfsm.ex | 0.795936 | 0.487429 | exfsm.ex | starcoder |
defmodule InvoiceTracker.TimeReporter do
@moduledoc """
Report on the time entries that make up an invoice.
"""
import ShorterMaps
alias InvoiceTracker.{Detail, ProjectTimeSummary, Rounding, TimeSummary}
alias Number.Delimit
alias TableRex.Table
alias Timex.Duration
@doc """
Generate a tabular sum... | lib/invoice_tracker/time_reporter.ex | 0.790854 | 0.525978 | time_reporter.ex | starcoder |
defmodule Swoosh.Email do
@moduledoc """
Defines an Email.
This module defines a `Swoosh.Email` struct and the main functions for composing an email. As it is the contract for
the public APIs of Swoosh it is a good idea to make use of these functions rather than build the struct yourself.
## Email fields
... | lib/swoosh/email.ex | 0.765944 | 0.617541 | email.ex | starcoder |
defmodule Sentix.Bridge.Options do
@moduledoc """
This module handles option parsing for the command line flags Sentix allows
using against `fswatch`. We separate this into a new module to aid testing and
keep all logic contained.
"""
# alias the Bridge
alias Sentix.Bridge
@doc """
Simple accessor f... | lib/sentix/bridge/options.ex | 0.832305 | 0.40489 | options.ex | starcoder |
defmodule Geolix.Adapter.Fake do
@moduledoc """
Fake adapter for testing environments.
## Usage
This adapter is intended to be used only with static data you can provide
when the adapter is started, i.e. when performing unit tests.
iex> Geolix.load_database(%{
...> id: :fake_sample,
...... | lib/geolix/adapter/fake.ex | 0.787564 | 0.446555 | fake.ex | starcoder |
defmodule Spellbook do
@moduledoc """
Introduction
------------
Spellbook is an Elixir library providing dynamic hierarchical configurations loading for your application.
It is based on the ideas implemented in the Javascript [node-config](https://nodei.co/npm/config/) module.
It lets you define a set of ... | lib/spellbook.ex | 0.77928 | 0.603114 | spellbook.ex | starcoder |
defmodule RobotSimulator do
@type direction :: :north | :east | :south | :west
@type position :: {integer, integer}
@type robot :: {direction, position}
@directions [:north, :east, :south, :west]
defguardp is_direction(direction) when direction in @directions
defguardp is_position(x, y) when is_integer(x)... | exercism/robot-simulator/robot_simulator.ex | 0.927847 | 0.825238 | robot_simulator.ex | starcoder |
defmodule Cldr.Unit.Backend do
def define_unit_module(config) do
module = inspect(__MODULE__)
backend = config.backend
additional_units = Module.concat(backend, Unit.Additional)
config = Macro.escape(config)
quote location: :keep,
bind_quoted: [
module: module,
b... | lib/cldr/unit/backend.ex | 0.828592 | 0.603406 | backend.ex | starcoder |
defmodule Cmark do
@moduledoc """
Converts Markdown to supported target formats.
All functions below support the following options:
- `:sourcepos` -
Include a `data-sourcepos` attribute on all block elements.
- `:hardbreaks`
Render `softbreak` elements as hard line breaks.
- `:nobreaks`
... | lib/cmark.ex | 0.821975 | 0.542742 | cmark.ex | starcoder |
defmodule Mix.Tasks.Gettext.Merge do
use Mix.Task
@recursive true
@shortdoc "Merge template files into translation files"
@moduledoc """
Merges PO/POT files with PO files.
This task is used when translations in the source code change: when they do,
`mix gettext.extract` is usually used to extract the n... | deps/gettext/lib/mix/tasks/gettext.merge.ex | 0.843509 | 0.424114 | gettext.merge.ex | starcoder |
defmodule X do
@moduledoc """
Component-based HTML templates for Elixir/Phoenix, inspired by Vue.
Zero-dependency. Framework/library agnostic. Optimized for Phoenix and Gettext.
## Features
* Declarative HTML template syntax close to Vue.
* Compile time errors and warnings.
* Type checks with dial... | lib/x.ex | 0.86501 | 0.46035 | x.ex | starcoder |
defmodule Day16Ex do
@moduledoc """
Documentation for `Day16Ex`.
"""
def part1() do
input = InputParser.parse("input.txt")
%{nearby: nearby, rules: rules} = input
nearby
|> Enum.flat_map(fn ticket ->
ticket
|> Enum.map(fn x -> {x, valid?(x, rules)} end)
|> Enum.filter(fn {_, ... | day16_ex/lib/day16_ex.ex | 0.697609 | 0.409398 | day16_ex.ex | starcoder |
defmodule ArkEcosystem.Crypto.Helpers.Base58Check do
@b58_characters '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
def decode58(code) when is_binary(code) do
code |> to_charlist |> decode58(0)
end
def decode58(_code) do
raise(ArgumentError, "expects base58-encoded binary")
end
def... | lib/arkecosystem/crypto/helpers/base58check.ex | 0.55447 | 0.419767 | base58check.ex | starcoder |
defmodule Arangoex.User do
@moduledoc """
This module contains functions used to manage users.
"""
@doc """
Create a new user.
The `conn` parameter is an ArangoDB connection PID. The `user` parameter is a map describing the user to be created.
## Endpoint
POST /_api/user
## Options
See the "S... | lib/arangoex/user.ex | 0.850344 | 0.428114 | user.ex | starcoder |
defmodule Merkel.Printer do
@moduledoc """
Module implements pretty printing of merkle binary hash tree
"""
alias Merkel.BinaryNode, as: Node
alias Merkel.BinaryHashTree, as: Tree
@level_delta 7
@doc """
Prints the merkle binary hash tree rotated to the left 90 degrees so that
large trees will fit ... | lib/merkel/printer.ex | 0.756537 | 0.559681 | printer.ex | starcoder |
defmodule Benchee.RelativeStatistics do
@moduledoc """
Statistics that are relative from one scenario to another.
Such as how much slower/faster something is or what the absolute difference is in the measured
values.
Is its own step because it has to be executed after scenarios have been loaded via
`Benche... | lib/benchee/relative_statistics.ex | 0.868611 | 0.754214 | relative_statistics.ex | starcoder |
defmodule Snitch.Data.Schema.CardPayment do
@moduledoc """
Models a Payment by credit or debit cards.
This is a subtype of `Payment`. The record will be deleted if the supertype
`Payment` is deleted!
> **On the other hand**, the subtype `CardPayment` can be freely deleted without
deleting it's supertype... | apps/snitch_core/lib/core/data/schema/payment/card_payment.ex | 0.860164 | 0.407952 | card_payment.ex | starcoder |
defmodule ExWire.Message.Neighbours do
@moduledoc """
A wrapper for ExWire's `Neighbours` message.
"""
alias ExWire.Struct.Neighbour
@behaviour ExWire.Message
@message_id 0x04
defstruct nodes: [],
timestamp: []
@type t :: %__MODULE__{
nodes: [Neighbour.t()],
timestamp... | apps/ex_wire/lib/ex_wire/message/neighbours.ex | 0.861159 | 0.444806 | neighbours.ex | starcoder |
defmodule PolyPartition.Fixtures do
@moduledoc"""
Fixture data for tests
"""
def non_convex do
[
[0, 1],
[0.25, 0.25],
[1, 0],
[0.25, -0.25],
[0, -1],
[0.1, 0.1],
[-1, 0],
[-0.25, 0.25]
]
end
def non_convex_split do
[
[
[0, 1],
... | lib/fixtures.ex | 0.592313 | 0.508605 | fixtures.ex | starcoder |
defmodule Quantum do
use TelemetryRegistry
telemetry_event(%{
event: [:quantum, :job, :add],
description: "dispatched when a job is added",
measurements: "%{}",
metadata: "%{job: Quantum.Job.t(), scheduler: atom()}"
})
telemetry_event(%{
event: [:quantum, :job, :update],
description: "... | lib/quantum.ex | 0.822153 | 0.612947 | quantum.ex | starcoder |
defmodule Oban.Plugins.Repeater do
@moduledoc """
Repeatedly send inserted messages to all registered producers to simulate polling.
⚠️ This plugin is a **last resort** and only necessary if you're running Oban in an environment
where neither Postgres nor PG notifications work. That situation should be rare, a... | lib/oban/plugins/repeater.ex | 0.798187 | 0.451206 | repeater.ex | starcoder |
defmodule PlugAttack.Storage.Ets do
@moduledoc """
Storage solution for PlugAttack using a local ets table.
## Usage
You need to start the process in your supervision tree, for example:
children = [
# ...
worker(PlugAttack.Storage.Ets, [MyApp.PlugAttackStorage])
]
This will lat... | lib/storage/ets.ex | 0.865579 | 0.51879 | ets.ex | starcoder |
defmodule Data.Character do
@moduledoc """
A user's character
Should be used instead of their character as often as possible
"""
use Data.Schema
alias Data.Class
alias Data.QuestProgress
alias Data.Race
alias Data.Save
alias Data.User
schema "characters" do
field(:type, :string, virtual: t... | lib/data/character.ex | 0.772273 | 0.483526 | character.ex | starcoder |
defmodule <%= @project_name_camel_case %>API.Schema.Assoc do
@moduledoc """
Helpers for resolving GraphQL associations without N+1 issues. An alternative
to `absinthe_ecto`, allowing us to call domain functions instead of Ecto Repos
to get associations.
See `assoc/2` for more details.
"""
import Absinth... | template/$PROJECT_NAME$/apps/$PROJECT_NAME$_api/lib/$PROJECT_NAME$_api/types/assoc.ex | 0.816882 | 0.479565 | assoc.ex | starcoder |
defmodule MishkaInstaller.PluginETS do
@moduledoc """
## ETS part to optimization state instead of dynamic supervisor and Genserver
`public` — Read/Write available to all processes.
`protected` — Read available to all processes. Only writable by owner process. This is the default.
`private` — Read/Wr... | lib/plugin_manager/state/plugin_ets.ex | 0.810216 | 0.856092 | plugin_ets.ex | starcoder |
defmodule Games.Static do
require OK
use GenServer, restart: :transient
defmodule State do
use TypedStruct
typedstruct enforce: true do
field :id, String.t()
field :running, boolean(), default: false
field :images, Qex.t({integer(), NativeMatrix.t()})
end
end
# how often we ... | web/lib/infolab_light_games/games/static.ex | 0.734786 | 0.4917 | static.ex | starcoder |
defmodule XDR.HyperInt do
@moduledoc """
This module manages the `Hyper Integer` type based on the RFC4506 XDR Standard.
"""
@behaviour XDR.Declaration
alias XDR.Error.HyperInt, as: HyperIntError
defstruct [:datum]
@typedoc """
`XDR.HyperInt` structure type specification.
"""
@type t :: %XDR.Hyp... | lib/xdr/hyper_int.ex | 0.921234 | 0.564999 | hyper_int.ex | starcoder |
defmodule Crutches.Map do
require Logger
@moduledoc ~s"""
Convenience functions for maps.
This module provides several convenience functions operating on maps.
Simply call any function (with any options if applicable) to make use of it.
"""
@type key :: any
@type value :: any
@doc ~S"""
Recursive... | lib/crutches/map.ex | 0.864196 | 0.59611 | map.ex | starcoder |
defmodule FormatParser.Image do
alias __MODULE__
@moduledoc """
An Image struct and functions.
The Image struct contains the fields format, width_px, height_px, intrinsics and nature.
"""
defstruct [:format, :width_px, :height_px, nature: :image, intrinsics: %{}]
@doc """
Parses a file and extracts ... | lib/format_parser/image.ex | 0.721841 | 0.654867 | image.ex | starcoder |
defprotocol JSON.Decoder do
@moduledoc """
Defines the protocol required for converting raw JSON into Elixir terms
"""
@doc """
Returns an atom and an Elixir term
"""
@spec decode(any) :: {atom, term}
def decode(bitstring_or_char_list)
end
defmodule JSON.Decoder.DefaultImplementations do
require Log... | node_modules/@snyk/snyk-hex-plugin/elixirsrc/deps/json/lib/json/decoder.ex | 0.864511 | 0.410018 | decoder.ex | starcoder |
defmodule ExqLimit.And do
@moduledoc """
This module provides the ability to combine multiple rate limiters
together.
{ExqLimit.And,
[
{ExqLimit.Local, limit: 20},
{ExqLimit.Global, limit: 100},
{ExqLimit.GCRA, [period: :second, rate: 60, burst: 0], short_circuit: true... | lib/exq_limit/and.ex | 0.860398 | 0.73756 | and.ex | starcoder |
defmodule Kalevala.Cache do
@moduledoc """
GenServer for caching in game resources
## Example
```
defmodule Kantele.World.Items do
use Kalevala.Cache
end
```
```
iex> Kalevala.Items.put("sammatti:sword", %Item{})
iex> Kalevala.Items.get("sammatti:sword")
%Item{}
```
"""
use GenServer... | lib/kalevala/cache.ex | 0.825132 | 0.746486 | cache.ex | starcoder |
defmodule Mix.Tasks.Eunomo do
@moduledoc """
Formats the given files/patterns.
The default Elixir formatter has the philosophy of not modifying non metadata parts of the AST.
`Eunomo` does not adhere to this philosophy and is meant to be used as an extension to the
default formatter. As of now the use case i... | lib/mix/tasks/eunomo.ex | 0.87456 | 0.85555 | eunomo.ex | starcoder |
defmodule Eeyeore.Config.Bolt do
require Logger
@moduledoc """
Represents a single bolt, as a strip of LEDs in blinkchain.
*`id`: The number in the array of bolts
*`length`: The number of LEDs in the bolt
*`start`: The first LED in the strip
*`end`: The last LED in the strip
*`neighbors`: Any neighbor... | lib/eeyeore/config/bolt.ex | 0.919588 | 0.951684 | bolt.ex | starcoder |
defmodule NervesPack.SSH do
@moduledoc """
Manages an ssh daemon.
Currently piggy-backs off authorized keys defined for `NervesFirmwareSSH`
and enables SFTP as a subsystem of SSH as well.
It also configures and execution point so you can use `ssh` command
to execute one-off Elixir code within IEx on the d... | lib/nerves_pack/ssh.ex | 0.578091 | 0.663861 | ssh.ex | starcoder |
defmodule BitstylesPhoenix.Helper.Button do
use Phoenix.HTML
import Phoenix.HTML.Link, only: [link: 2]
import Phoenix.HTML.Tag, only: [content_tag: 3]
import Phoenix.LiveView.Helpers
import BitstylesPhoenix.Helper.Classnames
import BitstylesPhoenix.Component.Icon
import BitstylesPhoenix.Showcase
@modul... | lib/bitstyles_phoenix/helper/button.ex | 0.784278 | 0.417568 | button.ex | starcoder |
defmodule Unicode.String.Case.Folding do
@moduledoc """
Implements the Unicode Case Folding algorithm.
The intention of case folding is to faciliate
case-insensitive string comparisons. It is not
intended to be a general purpose transformation.
Although case folding does generally use lower
case as its ... | lib/unicode/casing/folding.ex | 0.879335 | 0.607954 | folding.ex | starcoder |
defmodule ExSlp.Service do
alias ExSlp.Server
alias ExSlp.Client
import ExSlp.Util, only: [ parse_url: 1 ]
@service "exslp"
@doc """
Registers a new SLP service with type using
the current Node name as the authority.
Takes 2 optional keyword list parameters: slptool arguments
and the service options... | lib/ex_slp/service.ex | 0.802556 | 0.487429 | service.ex | starcoder |
defmodule Niex.Notebook do
@moduledoc """
Interface to the Notebook data. Generally not used directly - instead, use the
functions in Niex.State to manipute the full app state including the notebook.
"""
defstruct(
worksheets: [%{cells: []}],
metadata: %{name: "", version: "1.0"}
)
@doc """
T... | niex/lib/niex/notebook.ex | 0.766206 | 0.659881 | notebook.ex | starcoder |
defmodule BootsOfSpeed.GameStateAgent do
@moduledoc """
Handles management of game state
"""
use Agent
@type game_state :: %{round_stack: [round, ...]}
@type round :: %{characters: map()}
@type character :: %{name: String.t(), type: character_type, image: String.t()}
@type character_type :: String.t(... | lib/boots_of_speed/game_state_agent.ex | 0.774455 | 0.476701 | game_state_agent.ex | starcoder |
defmodule ReIntegrations.Simulators.Credipronto.Params do
@moduledoc """
Module for grouping credipronto simulator query params
"""
use Ecto.Schema
import Ecto.Changeset
schema "simulator_credipronto_params" do
field :mutuary, :string
field :birthday, :date
field :include_coparticipant, :boole... | apps/re_integrations/lib/simulators/credipronto/params.ex | 0.566139 | 0.42662 | params.ex | starcoder |
defmodule Arguments do
@moduledoc """
Arguments provides a module with argument parsing through `YourArguments.parse(incoming)`
`use Arguments`
There are two styles of arguments allowed
- `command` - `$ cmd new project`
- `flag` - `$ cmd --dir /etc`
These two styles can be mixed, but the ... | lib/arguments.ex | 0.907428 | 0.908171 | arguments.ex | starcoder |
defmodule WhoWeb.BillPresenter do
@moduledoc """
Takes in and processes data having to do with a given
Bill and returns an object containing the aforementioned info.
WhoWeb.BillPresenter.new()
"""
@type t :: %__MODULE__{
bill_id: String.t(),
number: String.t(),
title: String.t(),
sum... | lib/who_web/presenters/bill_presenter.ex | 0.7011 | 0.422356 | bill_presenter.ex | starcoder |
defmodule Goldie.LocGrid do
use GenServer
require Logger
@max_lat_cells 20000
@max_lng_cells 20000
defstruct [:entities, :reverse]
def start_link(_opts = []) do
GenServer.start_link(__MODULE__, :ok, [name: {:global, __MODULE__}])
end
@doc """
Finds entities of a certain type around given Lat/L... | lib/goldie/loc_grid.ex | 0.677687 | 0.441071 | loc_grid.ex | starcoder |
defmodule Request.Validator do
alias Ecto.Changeset
alias Request.Validator.{DefaultRules, Rules, Rules.Array, Rules.Map_}
@type validation_result :: :ok | {:error, map()}
@doc ~S"""
Get the validation rules that apply to the request.
"""
@callback rules(Plug.Conn.t()) :: keyword()
@doc ~S"""
Deter... | lib/request.ex | 0.793306 | 0.502014 | request.ex | starcoder |
defmodule AWS.Synthetics do
@moduledoc """
Amazon CloudWatch Synthetics
You can use Amazon CloudWatch Synthetics to continually monitor your services.
You can create and manage *canaries*, which are modular, lightweight scripts
that monitor your endpoints and APIs from the outside-in. You can set up your
... | lib/aws/generated/synthetics.ex | 0.832237 | 0.551453 | synthetics.ex | starcoder |
defmodule Web.RaceView do
use Web, :view
require Representer
alias Data.Stats
alias Web.Endpoint
alias Web.Router.Helpers, as: RouteHelpers
def stat(%{starting_stats: stats}, field) do
stats
|> Stats.default()
|> Map.get(field)
end
def render("index.json", %{races: races}) do
%{
... | lib/web/views/race_view.ex | 0.679285 | 0.411761 | race_view.ex | starcoder |
defmodule Temple.Component do
@moduledoc """
API for defining components.
Component modules are basically normal Phoenix View modules. The contents of the `render` macro are compiled into a `render/2` function. This means that you can define functions in your component module and use them in your component marku... | lib/temple/component.ex | 0.845049 | 0.872673 | component.ex | starcoder |
defmodule GenSpider do
@readme "README.md"
|> File.read!()
|> String.split("<!-- MDOC !-->")
@moduledoc """
#{Enum.fetch!(@readme, 1)}
```erlang
#{File.read!("examples/quotes_spider.erl")}
```
```elixir
#{File.read!("examples/quotes_spider.ex")}
```
#{Enum.fetch!(@readme, 2)}... | lib/gen_spider.ex | 0.716516 | 0.630472 | gen_spider.ex | starcoder |
defmodule Chronos.Formatter do
import Chronos.Timezones
@moduledoc """
The Chronos.Formatter module is used to format date/time tuples.
"""
@short_date "%Y-%m-%d"
@monthnames [nil, "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "No... | lib/chronos/formatter.ex | 0.79799 | 0.749569 | formatter.ex | starcoder |
defmodule Homework.Transactions do
@moduledoc """
The Transactions context.
"""
import Ecto.Query, warn: false
alias Homework.Repo
alias Homework.Transactions.Transaction
alias Homework.Companies
alias Homework.Util.Transforms
alias Homework.Util.Paginator
@doc """
Returns the list of transacti... | elixir/lib/homework/transactions.ex | 0.868353 | 0.462534 | transactions.ex | starcoder |
defmodule EctoList do
@moduledoc """
Implements conveniences to handle the items order of a list.
"""
@doc """
Returns the list of items ordered according to the items_order list.
If ids are missing in items_order, the items will be ordered according to their inserted date.
## Examples
all_items... | lib/ecto_list.ex | 0.78016 | 0.481332 | ecto_list.ex | starcoder |
defmodule KeycloakEx do
@moduledoc """
A Keycloak client to easily manage authenetication. with focus on ease of use.
KeycloakEx is made up of clients and plugs. There are 2 clients:
* `KeycloakEx.Client.User` - Requires a client to be setup in keycloak and for security should be the primary client to be us... | lib/keycloak.ex | 0.752922 | 0.438785 | keycloak.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.