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 Payjp.Plans do
@moduledoc """
Basic List, Create, Delete API for Plans
- create a plan
- get a plan
- update a plan
- delete a single plan
- delete all plan
- list plans
- get all plans
https://pay.jp/docs/api/#plan-プラン
"""
@endpoint "plans"
@doc """
Creates a Plan. Note that `... | lib/payjp/plans.ex | 0.887085 | 0.901271 | plans.ex | starcoder |
defmodule BSV.Util do
@moduledoc """
Collection of shared helper functions, used frequently throughout the library.
"""
@typedoc "Binary encoding format"
@type encoding() :: :base64 | :hex
@doc """
Decodes the given binary data using the specified `t:BSV.Util.encoding/0`.
Returns the result in an `:o... | lib/bsv/util.ex | 0.93603 | 0.61025 | util.ex | starcoder |
defmodule Bonbon.API.Schema.Cuisine.Region do
use Absinthe.Schema
use Translecto.Query
@moduledoc false
@desc "A culinary region"
object :region do
field :id, :id, description: "The id of the region"
field :continent, :string, description: "The continent of the region"
field... | web/api/schema/cuisine/region.ex | 0.606498 | 0.546557 | region.ex | starcoder |
defmodule Kitt.Message.MAP do
@moduledoc """
Defines the structure and instantiation function
for creating a J2735-compliant MapData message
A MapData message defines the geometry of a roadway
intersection including the lanes, ingress/egress vectors
and other defined rules for traversing the intersection.
... | lib/kitt/message/map.ex | 0.865934 | 0.675611 | map.ex | starcoder |
defmodule DiodeClient.Rlp do
alias DiodeClient.Rlpx
@compile :inline_list_funcs
@type rlp() :: binary() | [rlp()]
@moduledoc """
Encoding and Decoding of Recursive Length Prefix (RLP) https://eth.wiki/fundamentals/rlp
RLP is easy to decode and encode and has only two types of data:
list() and binar... | lib/diode_client/rlp.ex | 0.744006 | 0.847463 | rlp.ex | starcoder |
defmodule Accent.Plug.Response do
@moduledoc """
Transforms the keys of an HTTP response to the case requested by the client.
A client can request what case the keys are formatted in by passing the case
as a header in the request. By default the header key is `Accent`. If the
client does not request a case o... | lib/accent/plugs/response.ex | 0.919881 | 0.771672 | response.ex | starcoder |
defmodule Ravix.RQL.Tokens.Condition do
@moduledoc """
Supported RQL Conditions
"""
defstruct [
:token,
:field,
:params
]
alias Ravix.RQL.Tokens.Condition
@type t :: %Condition{
token: atom(),
field: String.t() | Condition.t(),
params: list()
}
@doc "... | lib/rql/tokens/conditions.ex | 0.907382 | 0.404243 | conditions.ex | starcoder |
defmodule Waffle.Storage.Google.UrlV2 do
@moduledoc """
This is an implementation of the v2 URL signing for Google Cloud Storage. See
[the Google documentation](https://cloud.google.com/storage/docs/access-control/signed-urls-v2)
for more details.
The bulk of the major logic is taken from Martide's `arc_gcs`... | lib/waffle/storage/google/url_v2.ex | 0.782372 | 0.501892 | url_v2.ex | starcoder |
defmodule AshPolicyAuthorizer.Authorizer do
@moduledoc false
defstruct [
:actor,
:resource,
:query,
:changeset,
:data,
:action,
:api,
:verbose?,
:scenarios,
:real_scenarios,
:check_scenarios,
:access_type,
policies: [],
facts: %{true => true, false => false},... | lib/ash_policy_authorizer/authorizer.ex | 0.90644 | 0.689812 | authorizer.ex | starcoder |
defmodule Vela do
@moduledoc """
`Vela` is a tiny library providing easy management of
validated cached state with some history.
Including `use Vela` in your module would turn the module
into struct, setting field accordingly to the specification,
passed as a parameter.
`Vela` allows the following confi... | lib/vela.ex | 0.918412 | 0.909867 | vela.ex | starcoder |
defmodule Shared.Zeitperiode do
@moduledoc """
Repräsentiert eine Arbeitszeit-Periode oder Schicht
"""
@type t :: Timex.Interval.t()
@type interval :: [
start: DateTime.t() | NaiveDateTime.t(),
ende: DateTime.t() | NaiveDateTime.t()
]
@default_base_timezone_name "Europe/Berlin"
... | lib/zeitperiode.ex | 0.810366 | 0.477371 | zeitperiode.ex | starcoder |
defmodule Ecto.Query.Typespec do
@moduledoc false
# A very simple type system to declare the operators and functions
# available in Ecto with their types. At runtime, the type system
# does no inference, it simply maps input types to output types.
@doc """
Defines a new Ecto.Query type.
"""
defmacro d... | lib/ecto/query/typespec.ex | 0.725746 | 0.555797 | typespec.ex | starcoder |
defmodule DynamoMigration do
@moduledoc """
Version management module for migration file of DynamoDB.
Dependes on ExAws and ExAws.Dynamo.
See also https://github.com/ex-aws/ex_aws_dynamo.
Usage:
1. $ mix dynamo.setup # Creates migrations table.
2. $ mix dynamo.gen.migration create_tests_table --table ... | lib/dynamo_migration.ex | 0.717705 | 0.712657 | dynamo_migration.ex | starcoder |
defmodule Publishing.Markdown do
@moduledoc """
Module for handling raw markdown texts.
"""
@heading_tags ["h1", "h2", "h3", "h4", "h5", "h6"]
@heading_default "Untitled"
@description_default ""
@cover_default ""
@doc """
Transform markdown into HMTL performing additional mutations.
## Features
... | apps/publishing/lib/publishing/markdown.ex | 0.826011 | 0.481941 | markdown.ex | starcoder |
defmodule Serum.Build do
@moduledoc """
This module contains functions for actually building a Serum project.
"""
import Serum.Util
alias Serum.Error
alias Serum.Build.Pass1
alias Serum.Build.Pass2
alias Serum.TemplateLoader
@type mode :: :parallel | :sequential
@type template_ast :: Macro.t | nil... | lib/serum/build.ex | 0.695545 | 0.523481 | build.ex | starcoder |
defmodule GGity.Geom.Ribbon do
@moduledoc false
alias GGity.{Draw, Geom, Plot}
@type t() :: %__MODULE__{}
@type record() :: map()
@type mapping() :: map()
defstruct data: nil,
mapping: nil,
stat: :identity,
position: :identity,
key_glyph: :rect,
... | lib/ggity/geom/ribbon.ex | 0.846641 | 0.482307 | ribbon.ex | starcoder |
defmodule RayTracer.Camera do
@moduledoc """
This module defines a camera which maps the three-dimensional scene onto a
two-dimensional canvas.
Camera's canvas will always be exactly one unit in front of the camera. This makes
the math a bit cleaner.
"""
alias RayTracer.Matrix
alias RayTracer.Ray
ali... | lib/camera.ex | 0.941048 | 0.880181 | camera.ex | starcoder |
defmodule Saucexages.AnsiFlags do
@moduledoc """
ANSiFlags allow an author of ANSi and similar files to provide a clue to a viewer / editor how to render the image.
ANSiFlags use the following binary layout:
`<<0, 0, 0, aspect_ratio::2, letter_spacing::2, non_blink_mode::1>>`
## Aspect ratio
Most modern... | lib/saucexages/ansi_flags.ex | 0.902615 | 0.748053 | ansi_flags.ex | starcoder |
defmodule Telegex.Marked.LinkRule do
@moduledoc false
# Matching and parsing of link nodes.
use Telegex.Marked.Rule
@ntype :link
@open_bracket "["
@close_bracket "]"
@open_parenthesis "("
@close_parenthesis ")"
@impl true
def match(state) do
%{line: %{src: src, len: len}, pos: pos} = state
... | lib/telegex/marked/rules/link_rule.ex | 0.506836 | 0.402421 | link_rule.ex | starcoder |
defmodule StopWatch.Server do
@moduledoc """
A simple stopwatch GenServer used for exploring the common pattern
of autonomous GenServers that make notifications.
Implements a basic counter with configurable resolution (down to 10ms).
Implements "go", "stop", and "clear" functions. Also implements a "time"
... | lib/stop_watch/server.ex | 0.725746 | 0.573887 | server.ex | starcoder |
defmodule StrictlySpeaking.En do
@singles {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}
@tens {"twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety"}
@teens {"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen"... | lib/strictly_speaking/en.ex | 0.562297 | 0.44571 | en.ex | starcoder |
defmodule Resourceful.Collection.Ecto.Filters do
@moduledoc """
Functions for converting Resourceful-style filters into Ecto-style SQL
filters.
See `Resourceful.Collection.Filter` for more details on filters.
There's a lot of duplication here that can, hopefully, be resolved with a
better understanding of... | lib/resourceful/collection/ecto/filters.ex | 0.689306 | 0.680968 | filters.ex | starcoder |
defmodule Bot do
@moduledoc """
Intcode Wired Cameras and Vacuum Bot
"""
defstruct map: %{}, loc: {0, 0}, bot: nil, dir: nil, output: []
def print(map) do
{{min_x, max_x}, {min_y, max_y}} = bounds(map)
for y <- min_y..max_y do
for x <- min_x..max_x do
IO.write(print_char(Map.get(map, ... | apps/day17/lib/bot.ex | 0.72662 | 0.47457 | bot.ex | starcoder |
defmodule Terminus.BitFS do
@moduledoc """
Module for interfacing with the [BitFS](https://bitfs.network) API.
BitFS crawls the Bitcoin blockchain to find and store all the bitcoin script
pushdata chunks **larger than 512 bytes**.
> BitFS is an autonomous file system constructed from Bitcoin transactions.
... | lib/terminus/bitfs.ex | 0.888099 | 0.639989 | bitfs.ex | starcoder |
defmodule Ecto.Sort do
@moduledoc """
Ecto.Sort is a simple module which provides a macro for explicitly applying ecto order_by expressions.
### Example
```elixir
defmodule Post do
use Ecto.Schema
schema "post" do
field(:name, :string)
field(:featured, :boolean)
has_many(:comments,... | lib/ecto/sort.ex | 0.863837 | 0.787032 | sort.ex | starcoder |
defmodule NotQwerty123.WordlistManager do
@moduledoc """
Module to manage the common password list and handle password checks.
The main function that NotQwerty123 performs is to check that the
password or a variant of the password (in other words, even with minor changes)
is not in the list of common passwor... | lib/not_qwerty123/wordlist_manager.ex | 0.672977 | 0.484746 | wordlist_manager.ex | starcoder |
defmodule Relax.Resource.FetchAll do
use Behaviour
@moduledoc """
Include in your resource to respond to GET / and GET /?filter[foo]=bar.
Typically brought into your resource via `use Relax.Resource`.
FetchAll defines three callback behaviours, all of which have a default,
overrideable implementation.
... | lib/relax/resource/fetch_all.ex | 0.717903 | 0.406302 | fetch_all.ex | starcoder |
defmodule Sanbase.Utils.Transform do
def wrap_ok(data), do: {:ok, data}
@doc ~s"""
Transform the maps from the :ok tuple data so the `key` is duplicated under the
`new_key` name, preserving the original value.
## Examples:
iex> Sanbase.Utils.Transform.duplicate_map_keys({:ok, [%{a: 1}, %{a: 2}]}, old_... | lib/sanbase/utils/transform.ex | 0.84653 | 0.67652 | transform.ex | starcoder |
defmodule Day23 do
def part1(lines) do
bots = lines
|> Enum.map(&parse_line/1)
{strongest_pos, radius} = Enum.max_by(bots, fn {_, r} -> r end)
bots
|> Stream.filter(fn {pos, _} ->
manhattan_distance(strongest_pos, pos) <= radius
end)
|> Enum.count
end
def part2(lines) do
bot... | day23/lib/day23.ex | 0.723016 | 0.694458 | day23.ex | starcoder |
defmodule KaufmannEx.ReleaseTasks.MigrateSchemas do
@moduledoc """
Task for registering all schemas in `priv/schemas` with the schema registry.
Expects
- schemas to be defined in `priv/schemas`.
- an `event_metadata.avsc` schema should be defined and required by all events
Can be called in a production ... | lib/kaufmann_ex/release_tasks/migrate_schemas.ex | 0.703957 | 0.607023 | migrate_schemas.ex | starcoder |
defmodule AdventOfCode.Solutions.Day13 do
@moduledoc """
Solution for day 13 exercise.
### Exercise
https://adventofcode.com/2021/day/13
"""
require Logger
def run(filename) do
{points, instructions} =
filename
|> File.read!()
|> parse_input()
first_fold = hd(instructions)
... | lib/advent_of_code/solutions/day13.ex | 0.712732 | 0.41052 | day13.ex | starcoder |
defmodule Expool do
@moduledoc """
This module provides a simple interface for concurrent process usage. The
`Expool.create_pool/2` function is used to create a base pool of processes,
and is then used for task submission using `Expool.submit/2`.
"""
# alias some stuff
alias Expool.Balancers
alias Expo... | lib/expool.ex | 0.819641 | 0.584775 | expool.ex | starcoder |
defmodule GenRouter.Conn do
@moduledoc """
Structure which represents connection with Telegram bot.
Inspired by %Plug.Conn{}, adapted for bots.
Attributes:
* __skip__: system buffer to keep track of skipped scopes;
* path: route to controller which should handle this object;
* params: payload whic... | lib/conn.ex | 0.798776 | 0.408926 | conn.ex | starcoder |
defmodule AdventOfCode.Day04 do
@spec problem1 :: any
def problem1 do
{numbers, boards} = input()
numbers
|> Enum.reduce_while([], fn elem, acc ->
matches = [elem | acc]
case Enum.find(boards, &winning_board?(&1, matches)) do
nil -> {:cont, matches}
board -> {:halt, Enum.su... | 2021/lib/aoc04.ex | 0.615203 | 0.44077 | aoc04.ex | starcoder |
defmodule Callisto.GraphDB do
alias Callisto.{Edge, Query, Vertex}
@moduledoc """
Defines a graph DB (repository).
When used, the graph DB expects `:otp_app` option, which should point to
the OTP application that has the repository configuration. For example,
defmodule Graph do
use Cal... | lib/callisto/graph_db.ex | 0.867008 | 0.484441 | graph_db.ex | starcoder |
defmodule BigchaindbEx.Transaction do
alias BigchaindbEx.{Crypto, Utils, Http}
alias BigchaindbEx.Transaction.{Input, Output}
@type t :: %__MODULE__{
id: String.t,
operation: String.t,
asset: Map.t,
inputs: Enum.t,
outputs: Enum.t,
metadata: Map.t,
fulfillments: Enum.t,
conditions... | lib/bigchaindb_ex/transaction.ex | 0.90709 | 0.449513 | transaction.ex | starcoder |
defmodule ExWire.Packet.Capability.Par.SnapshotData.BlockChunk do
@moduledoc """
Block chunks contain raw block data: blocks themselves, and their transaction
receipts. The blocks are stored in the "abridged block" format (referred to
by AB), and the the receipts are stored in a list: [`receipt_1`: `P`,
`rece... | apps/ex_wire/lib/ex_wire/packet/capability/par/snapshot_data/block_chunk.ex | 0.858318 | 0.516352 | block_chunk.ex | starcoder |
defmodule AWS.MigrationHubStrategy do
@moduledoc """
Migration Hub Strategy Recommendations
` This API reference provides descriptions, syntax, and other details about each
of the actions and data types for Migration Hub Strategy Recommendations
(Strategy Recommendations).
The topic for each action shows... | lib/aws/generated/migration_hub_strategy.ex | 0.728459 | 0.473475 | migration_hub_strategy.ex | starcoder |
defmodule Holobot.Telegram.Commands.Ask do
@moduledoc """
Ask query command handler.
"""
use Holobot.Telegram.Commander
@about_cover "COVER corp. is a cutting edge 2D entertainment company. It is the parent company of Hololive Production."
@about_hololive "Hololive Production is a virtual YouTuber talent a... | lib/holobot/telegram/commands/ask.ex | 0.52756 | 0.400046 | ask.ex | starcoder |
defmodule Imagineer.Image.PNG.Chunk.Decoders.Transparency do
alias Imagineer.Image.PNG
@color_type_grayscale 0
@color_type_color 2
@color_type_palette_and_color 3
@color_type_grayscale_with_alpha 4
@color_type_color_and_alpha 6
# fully opaque
@palette_default_opacity 255
def decode(content, %PNG{co... | lib/imagineer/image/png/chunk/decoders/transparency.ex | 0.505615 | 0.416648 | transparency.ex | starcoder |
defmodule ExTwilio.JWT.AccessToken do
@moduledoc """
A Twilio JWT access token, as described in the Twilio docs.
https://www.twilio.com/docs/iam/access-tokens
"""
alias ExTwilio.JWT.Grant
alias ExTwilio.Ext
use Joken.Config
@enforce_keys [:account_sid, :api_key, :api_secret, :identity, :grants, :expi... | lib/ex_twilio/jwt/access_token.ex | 0.854688 | 0.406479 | access_token.ex | starcoder |
defmodule ExNric do
@moduledoc """
Documentation for ExNric.
"""
@doc """
Validates Singapore NRIC
## Examples
iex> ExNric.validate("S7343684B")
{:ok, "S7343684B"}
iex> ExNric.validate("T9901744E")
{:ok, "T9901744E"}
iex> ExNric.validate("F4365949U")
{:ok, "F4365949U... | lib/ex_nric.ex | 0.796451 | 0.5564 | ex_nric.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/generated/swf.ex | 0.931174 | 0.632361 | swf.ex | starcoder |
defmodule Bingo.Game do
@enforce_keys [:squares]
defstruct squares: nil, scores: %{}, winner: nil
alias Bingo.{Buzzwords, Game, Square, BingoChecker}
@doc """
Creates a game with a `size` x `size` collection of squares
taken randomly from the given list of `buzzwords` where
each buzzword is of the for... | apps/bingo/lib/bingo/game.ex | 0.842442 | 0.622244 | game.ex | starcoder |
defmodule Loom.RWORSet do
alias Loom.RWORSet, as: Set
alias Loom.Dots
@moduledoc """
A remove-wins (optimized) oberserved-remove set (without tombstones).
This CRDT breaks ties (concurrency) in favor of removing an element from a set.
This CRDT isn't as "natural" as the add-wins set, which usually matches... | lib/loom/rworset.ex | 0.855429 | 0.460895 | rworset.ex | starcoder |
defmodule Exceptional.Raise do
@moduledoc ~S"""
Raise an exception if one has been propagated, otherwise continue
## Convenience `use`s
Everything:
use Exceptional.Raise
Only named functions (`raise_or_continue!`):
use Exceptional.Raise, only: :named_functions
Only operators (`>>>`):
... | lib/exceptional/raise.ex | 0.812644 | 0.500305 | raise.ex | starcoder |
defmodule Elasticlunr.Dsl.TermsQuery do
use Elasticlunr.Dsl.Query
alias Elasticlunr.Dsl.Query
alias Elasticlunr.{Index, Token}
defstruct ~w[minimum_should_match expand field terms boost fuzziness]a
@type t :: %__MODULE__{
minimum_should_match: pos_integer(),
expand: boolean(),
... | lib/elasticlunr/dsl/query/terms_query.ex | 0.691914 | 0.463384 | terms_query.ex | starcoder |
defmodule Maptu.Extension do
@moduledoc """
Contains custom functions extending [Maptu](https://github.com/lexhide/maptu)
and superfluous to Maptu requirements. This module builds on top of `maptu.ex`
and with extracts and modifications of `maptu.ex`. Mapail would not
work without the additional functionality... | lib/maptu/extension.ex | 0.911864 | 0.562958 | extension.ex | starcoder |
defmodule Ecto.Query do
@moduledoc ~S"""
Provides the Query DSL.
Queries are used to retrieve and manipulate data in a repository
(see `Ecto.Repo`). Although this module provides a complete API,
supporting expressions like `where/3`, `select/3` and so forth,
most of the time developers need to import only ... | lib/ecto/query.ex | 0.908413 | 0.771456 | query.ex | starcoder |
defmodule XPlane.DataRef do
@moduledoc """
Represent an X-Plane Data Reference (DataRef) and provide helper methods
to load the closest available set of DataRefs for a given X-Plane version
"""
@type xtype :: {:byte | :float | :int | :uint | :short | :ushort, list(integer)} | :void
defstruct [
nam... | lib/xplane_data_ref.ex | 0.729423 | 0.619586 | xplane_data_ref.ex | starcoder |
defmodule Example do
def start(_type, _args) do
# If you are running the ModelFox app locally or on your own server you can pass the URL to it with the MODELFOX_URL environment variable.
modelfox_url = System.get_env("MODELFOX_URL")
# Get the path to the .modelfox file.
model_path = Path.join(:code.p... | languages/elixir/examples/advanced/lib/application.ex | 0.806472 | 0.410402 | application.ex | starcoder |
defmodule FinTex.Model.Account do
@moduledoc """
The following fields are public:
* `account_number` - Account number
* `subaccount_id` - Subaccount ID
* `blz` - Bank code
* `bank_name` - Bank name
* `currency` - Three-character... | lib/model/account.ex | 0.865025 | 0.480905 | account.ex | starcoder |
defmodule Mnemonix do
@moduledoc """
Provides easy access to a store through a Map-like interface.
Rather than a map, use the `t:GenServer.server/0` reference returned
by a store's `start_link/2` to perform operations on them.
## Map Features
`Mnemonix.Features.Map` lets you manipulate a store just like ... | lib/mnemonix.ex | 0.894361 | 0.451629 | mnemonix.ex | starcoder |
defmodule ExZendesk do
use HTTPoison.Base
@moduledoc """
Simple [HTTPoison](https://hexdocs.pm/httpoison/overview.html) based helper library to interact with the [Zendesk API](https://developer.zendesk.com/rest_api/docs/core/introduction)
## Configuration
First you must configure the subdomain, username, a... | lib/ex_zendesk.ex | 0.775307 | 0.723621 | ex_zendesk.ex | starcoder |
defmodule RigInboundGateway.Proxy do
@moduledoc """
Enables persisting and CRUD operations for Proxy's API definitions in presence.
In a distributed setting, the node that does the persisting of API definitions
spreads the information via Phoenix' PubSub Server as Phoenix Presence information.
The other node... | lib/rig_inbound_gateway/proxy.ex | 0.810291 | 0.433082 | proxy.ex | starcoder |
defmodule Wadm.Deployments.DeploymentMonitor do
@doc """
One of these processes should be running to observe and reconcile
an appspec+version instance.
This is a Horde-managed server and so only one of these will be running within
the horde cluster at any given time, and Horde can relocate this to any cluste... | wadm/lib/wadm/deployments/deployment_monitor.ex | 0.637257 | 0.414751 | deployment_monitor.ex | starcoder |
defmodule Mcc.Lib do
@moduledoc """
This module contains functions to manipulate cluster based on mnesia.
Includes:
- 1, start mnesia and mnesia table
- 2, make node join into the mnesia cluster
- 3, make node leave from the mnesia cluster
- 4, remove one node from mnesia cluster
- 5, get st... | lib/mcc/lib.ex | 0.755186 | 0.680494 | lib.ex | starcoder |
defmodule Infer.Loaders.Dataloader do
@moduledoc """
Uses `Dataloader` to load missing data incrementally.
"""
alias Infer.Result
def lookup(cache, data_req) do
case apply(Dataloader, :get, [cache | args_for(data_req)]) do
{:error, "Unable to find " <> _} -> {:not_loaded, MapSet.new([data_req])}
... | lib/infer/loaders/dataloader.ex | 0.629319 | 0.40645 | dataloader.ex | starcoder |
defmodule Deneb.Chart do
@moduledoc """
Vega-lite chart implementation
"""
use TypedStruct
alias Deneb.{Chart, Mark, Encoding, Projection, Selection, Transform, Utils}
typedstruct do
@typedoc "chart properties"
field :mark, Mark.t() | nil, default: nil
field :encoding, Encoding.t() | nil, defa... | lib/deneb/chart.ex | 0.739799 | 0.470433 | chart.ex | starcoder |
defmodule Numexy do
alias Numexy.Array
@moduledoc """
Documentation for Numexy.
"""
@doc """
New matrix.
## Examples
iex> Numexy.new([1,2,3])
%Numexy.Array{array: [1, 2, 3], shape: {3, nil}}
iex> Numexy.new([[1,2,3],[1,2,3]])
%Numexy.Array{array: [[1, 2, 3], [1, 2, 3]], shape: ... | lib/numexy.ex | 0.842798 | 0.643133 | numexy.ex | starcoder |
defmodule Contentful.Delivery.Entries do
@moduledoc """
Entries allows for querying the entries of a space via `Contentful.Query`.
## Fetching a single entry
import Contentful.Query
alias Contentful.Delivery.Entries
{:ok, entry} = Entries |> fetch_one("my_entry_id")
## Simple querying of a... | lib/contentful_delivery/entries.ex | 0.780621 | 0.485661 | entries.ex | starcoder |
defmodule JaSerializer.PhoenixView do
@moduledoc """
Use in your Phoenix.View to render jsonapi.org spec json.
See JaSerializer.Serializer for documentation on defining your serializer.
## Usage example
defmodule PhoenixExample.ArticleView do
use PhoenixExample.Web, :view
use JaSerializ... | lib/ja_serializer/phoenix_view.ex | 0.7324 | 0.42057 | phoenix_view.ex | starcoder |
defmodule Calendar.DateTime.Parse do
import Calendar.ParseUtil
@secs_between_year_0_and_unix_epoch 719528*24*3600 # From erlang calendar docs: there are 719528 days between Jan 1, 0 and Jan 1, 1970. Does not include leap seconds
@doc """
Parses an RFC 822 datetime string and shifts it to UTC.
Takes an RFC... | data/web/deps/calendar/lib/calendar/date_time/parse.ex | 0.835383 | 0.531209 | parse.ex | starcoder |
defmodule RealworldPhoenix.Articles do
@moduledoc """
The Articles context.
"""
import Ecto.Query, warn: false
alias RealworldPhoenix.Repo
alias RealworldPhoenix.Articles.Article
alias RealworldPhoenix.Articles.Comment
alias RealworldPhoenix.Accounts.User
alias RealworldPhoenix.Articles.Favorite
a... | lib/realworld_phoenix/articles.ex | 0.819713 | 0.474875 | articles.ex | starcoder |
defmodule MeshxRpc.Common.Options do
@moduledoc false
def common(),
do: [
pool_opts: [
type: :keyword_list,
default: [],
doc: """
worker pool options for RPC client and server.
Server pool is build using [`ranch` socket acceptor pool](https://hex.pm/packages/ranch).... | lib/common/options.ex | 0.91243 | 0.553385 | options.ex | starcoder |
defmodule RDF.Star.Statement do
@moduledoc """
Helper functions for RDF-star statements.
An RDF-star statement is either a `RDF.Star.Triple` or a `RDF.Star.Quad`.
"""
alias RDF.Star.{Triple, Quad}
alias RDF.PropertyMap
@type subject :: RDF.Statement.subject() | Triple.t()
@type predicate :: RDF.State... | lib/rdf/star/statement.ex | 0.919503 | 0.600481 | statement.ex | starcoder |
defmodule Flex.Set do
alias Flex.{MembershipFun, Set}
@moduledoc """
An interface to create Fuzzy Sets struct.
"""
defstruct mf_type: nil,
mf: nil,
mf_center: nil,
mf_params: nil,
tag: nil
@typedoc """
Fuzzy Set struct.
- `:mf_type` - Defines which type ... | lib/set.ex | 0.869867 | 0.650557 | set.ex | starcoder |
defmodule Asteroid.OIDC.AuthenticatedSession do
@moduledoc """
Convenience functions to work with authenticated sessions
The `%Asteroid.OIDC.AuthenticatedSession{}` object has the following meaningful members in
its `:data` field:
- `"current_acr"`: the current ACR, as calculated (`t:Asteroid.OIDC.acr/0`)
... | lib/asteroid/oidc/authenticated_session.ex | 0.897863 | 0.400456 | authenticated_session.ex | starcoder |
defmodule Nerves.Grove.PCA9685.DeviceSupervisor do
use Supervisor
@dev_srv Nerves.Grove.PCA9685.Device
@device_registry_name :PCA9685_proccess_registry
@moduledoc """
Device pca9685 Worker
config :pca9685,
devices: [%{bus: 1, address: 0x40, pwm_freq: 50}],
servos: [%{bus: 1, address: 0x40, channel: 0, p... | lib/nerves_grove/pca9685/device_supervisor.ex | 0.576304 | 0.481393 | device_supervisor.ex | starcoder |
defmodule Callisto.Properties do
@moduledoc """
Module for defining properties on a struct. Macro properties lets you
define fields that are "known" to the vertex that uses this as a label
(or the edge that uses this as a type). You can define if these fields
are required to be set when calling .new... | lib/callisto/properties.ex | 0.803906 | 0.475788 | properties.ex | starcoder |
defmodule AWS.CloudHSM do
@moduledoc """
AWS CloudHSM Service
This is documentation for **AWS CloudHSM Classic**.
For more information, see [AWS CloudHSM Classic FAQs](http://aws.amazon.com/cloudhsm/faqs-classic/), the [AWS CloudHSM Classic User Guide](http://docs.aws.amazon.com/cloudhsm/classic/userguide/),... | lib/aws/generated/cloud_hsm.ex | 0.796292 | 0.630059 | cloud_hsm.ex | starcoder |
defmodule Rummage.Ecto.Services.BuildSearchQuery do
@moduledoc """
`Rummage.Ecto.Services.BuildSearchQuery` is a service module which serves the
default search hook, `Rummage.Ecto.Hook.Search` that comes shipped with `Rummage.Ecto`.
## Module Attributes
```elixir
@search_types ~w{like ilike eq gt lt gteq ... | lib/rummage_ecto/services/build_search_query.ex | 0.724481 | 0.930268 | build_search_query.ex | starcoder |
defmodule Membrane.File.Source do
@moduledoc """
Element that reads chunks of data from given file and sends them as buffers
through the output pad.
"""
use Membrane.Source
alias Membrane.{Buffer, RemoteStream}
@common_file Membrane.File.CommonFileBehaviour.get_impl()
def_options location: [
... | lib/membrane_file/source.ex | 0.799755 | 0.450662 | source.ex | starcoder |
defmodule Membrane.Pad do
@moduledoc """
Pads are units defined by elements and bins, allowing them to be linked with their
siblings. This module consists of pads typespecs and utils.
Each pad is described by its name, direction, availability, mode and possible caps.
For pads to be linkable, these properties... | lib/membrane/pad.ex | 0.896671 | 0.700805 | pad.ex | starcoder |
defmodule OrderDistributor do
@moduledoc """
A module for assigning and distributing orders from the local button panel to the most optimal order handler.
It should be noted that the `OrderDistributor` has no state like a regular `GenServer` would have, but the `GenServer` behavior is still used for casting and c... | elevator/lib/orderDistributor.ex | 0.76105 | 0.613541 | orderDistributor.ex | starcoder |
defmodule Queutils.BlockingProducer do
use GenStage
@moduledoc """
A `GenStage` producer that acts as a blocking queue, with a fixed length.
Blocks any time `Queutils.BlockingProducer.push/2` is called when the queue
is at its maximum length.
This can be used as an entry-point to a `GenStage` pipeline, si... | lib/queutils/blocking_producer.ex | 0.826222 | 0.760917 | blocking_producer.ex | starcoder |
defmodule Dynamo.Router.Filters do
@moduledoc """
This module is responsible for providing filters to a router or a Dynamo.
A filter is a module that is invoked before, during or after a service match.
While hooks are executed only if a route match, filters are always
executed. In general, filters are a more... | lib/dynamo/router/filters.ex | 0.886595 | 0.725697 | filters.ex | starcoder |
defmodule Coxir.Commander.Utils do
use Bitwise
alias Coxir.Struct.{Guild, Role}
alias Coxir.Struct.{Member, Channel}
@permissions [
CREATE_INSTANT_INVITE: 1 <<< 0,
KICK_MEMBERS: 1 <<< 1,
BAN_MEMBERS: 1 <<< 2,
ADMINISTRATOR: 1 <<< 3,
MANAGE_CHANNELS: 1 <<< 4,
MANAGE_GUILD: 1 <<< 5,
... | lib/commander/utils.ex | 0.528777 | 0.401365 | utils.ex | starcoder |
use Bitwise
defmodule Aoc2021.Day13 do
def process1(s) do
[ a, b ] = String.split(s, ",")
{ String.to_integer(a), String.to_integer(b) }
end
def process2(s) do
[ l, r ] = String.split(s, "=")
xy = List.last(String.split(l, " "))
{ String.to_atom(xy), String.to_integer(r) }
end
def foldxy... | lib/day13.ex | 0.581422 | 0.530601 | day13.ex | starcoder |
defmodule Depot do
@external_resource "README.md"
@moduledoc @external_resource
|> File.read!()
|> String.split("<!-- MDOC !-->")
|> Enum.fetch!(1)
@type adapter :: module()
@type filesystem :: {module(), Depot.Adapter.config()}
@doc """
Write to a filesystem
## E... | lib/depot.ex | 0.847306 | 0.444625 | depot.ex | starcoder |
defmodule FunLand.Reducible do
@moduledoc """
Anything that implements the Reducible behaviour, can be reduced to a single value, when given a combinable (or combining-function + base value).
This is enough information to convert any reducible to a List.
It even is enough information to implement most enumerab... | lib/fun_land/reducible.ex | 0.800068 | 0.62892 | reducible.ex | starcoder |
defmodule Tensorflow.GetStatusRequest do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{}
defstruct []
end
defmodule Tensorflow.GetStatusResponse do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
device_attributes: [Tensorflow.DeviceAttributes.t(... | lib/tensorflow/core/protobuf/worker.pb.ex | 0.733165 | 0.500793 | worker.pb.ex | starcoder |
if Code.ensure_loaded?(Broadway) do
defmodule PromEx.Plugins.Broadway do
@moduledoc """
This plugin captures metrics emitted by Broadway.
This plugin exposes the following metric groups:
- `:broadway_init_event_metrics`
- `:broadway_message_event_metrics`
- `:broadway_batch_event_metrics`
... | lib/prom_ex/plugins/broadway.ex | 0.906291 | 0.703864 | broadway.ex | starcoder |
defmodule TelemetryInfluxDB do
alias TelemetryInfluxDB.BatchReporter
alias TelemetryInfluxDB.BatchHandler
alias TelemetryInfluxDB.EventHandler
alias TelemetryInfluxDB.HTTP
alias TelemetryInfluxDB.UDP
require Logger
@moduledoc """
`Telemetry` reporter for InfluxDB compatible events.
To use it, start ... | lib/telemetry_influx_db.ex | 0.86813 | 0.648731 | telemetry_influx_db.ex | starcoder |
defmodule LRU do
require Cbuf.Map, as: Buf
defstruct impl: %{}, ages: nil, size: 0, count: 0
@doc """
Make a new LRU cache of a given size backed by a map-based circular buffer.
iex> LRU.new(5)
#LRU<%{}>
"""
def new(size) when size > 0 do
%__MODULE__{impl: %{}, ages: Buf.new(size), size: s... | lib/lru.ex | 0.77535 | 0.508422 | lru.ex | starcoder |
defmodule Commanded.ExampleDomain.BankAccount do
@moduledoc false
defstruct [
account_number: nil,
balance: 0,
state: nil,
]
alias Commanded.ExampleDomain.BankAccount
defmodule Commands do
defmodule OpenAccount, do: defstruct [:account_number, :initial_balance]
defmodule DepositMo... | test/example_domain/bank_account/bank_account.ex | 0.694717 | 0.62949 | bank_account.ex | starcoder |
defmodule GGity.Geom.Text do
@moduledoc false
alias GGity.{Draw, Geom, Plot, Scale}
@hjust_anchor_map %{left: "start", center: "middle", right: "end"}
@vjust_anchor_map %{top: "baseline", middle: "middle", bottom: "hanging"}
@type t() :: %__MODULE__{}
@type plot() :: %Plot{}
@type record() :: map()
@... | lib/ggity/geom/text.ex | 0.903385 | 0.45532 | text.ex | starcoder |
defprotocol Realm.Semigroup do
@moduledoc ~S"""
A semigroup is a structure describing data that can be appendenated with others of its type.
That is to say that appending another list returns a list, appending one map
to another returns a map, and appending two integers returns an integer, and so on.
These ca... | lib/realm/semigroup.ex | 0.822973 | 0.544438 | semigroup.ex | starcoder |
defmodule FiveHundred.Game do
@moduledoc """
Models a game of 500
TODO:
- score
- turn
"""
alias FiveHundred.{Bid, Game, Player, PlayerBid}
@derive Jason.Encoder
defstruct [
:winning_bid,
:players,
:turn,
:code,
:max_players,
:last_round_winner,
:bid_exclusion,
state:... | lib/five_hundred/game.ex | 0.623033 | 0.438485 | game.ex | starcoder |
defmodule Plan do
alias Engine.Adapters.RMQRPCWorker
import Logger
@jsprit_time_constraint_msg "Time of time window constraint is in the past!"
def find_optimal_routes(vehicle_ids, booking_ids) do
Logger.info("call calculate_route_optimization")
%{}
|> Map.put(:vehicles, Enum.map(vehicle_ids, &Veh... | packages/engine_umbrella/apps/engine/lib/plan.ex | 0.666714 | 0.408601 | plan.ex | starcoder |
defmodule TeaVent do
@moduledoc """
TeaVent allows you to perform event-dispatching in a style that is a mixture of Event Sourcing and The 'Elm Architecture' (TEA).
The idea behind this is twofold:
1. Event dispatching is separated from event handling. The event handler (the `reducer`) can thus be a pure func... | lib/tea_vent.ex | 0.917182 | 0.72876 | tea_vent.ex | starcoder |
defmodule Absinthe.Plug do
@moduledoc """
A plug for using Absinthe
See [The Guides](http://absinthe-graphql.org/guides/plug-phoenix/) for usage details
## Uploaded File Support
Absinthe.Plug can be used to support uploading of files. This is a schema that
has a mutation field supporting multiple files. ... | lib/absinthe/plug.ex | 0.884526 | 0.791418 | plug.ex | starcoder |
defmodule SmartNote.Questions do
@moduledoc """
Context for creating and managing common questions
"""
import Ecto.Query, except: [update: 2]
alias SmartNote.Questions.Question
alias SmartNote.Repo
def new(), do: %Question{} |> Question.create_changeset(%{})
def edit(question), do: question |> Quest... | lib/smart_note/questions.ex | 0.619241 | 0.430806 | questions.ex | starcoder |
defmodule Resx.Resource.Content.Stream do
@moduledoc """
The streamable content of a resource.
%Resx.Resource.Content.Stream{
type: ["text/html]",
data: ["<p>", "Hello", "</p>"]
}
"""
alias Resx.Resource.Content
@enforce_keys [:type, :data]
defstruct... | lib/resx/resource/content.stream.ex | 0.756178 | 0.460168 | content.stream.ex | starcoder |
defmodule AWS.Athena do
@moduledoc """
Amazon Athena is an interactive query service that lets you use standard SQL to
analyze data directly in Amazon S3.
You can point Athena at your data in Amazon S3 and run ad-hoc queries and get
results in seconds. Athena is serverless, so there is no infrastructure to ... | lib/aws/generated/athena.ex | 0.920919 | 0.70388 | athena.ex | starcoder |
defmodule BikeBrigade.Utils do
def dev? do
Application.get_env(:bike_brigade, :environment) == :dev
end
def prod? do
Application.get_env(:bike_brigade, :environment) == :prod
end
def test? do
Application.get_env(:bike_brigade, :environment) == :test
end
defmacro get_config(keyword) do
q... | lib/bike_brigade/utils.ex | 0.685318 | 0.438064 | utils.ex | starcoder |
defmodule Locations.AssertHelpers do
import ExUnit.Assertions
alias Ecto.Changeset
def assert_valid_changeset(keys, expected_params, %Changeset{} = changeset) do
assert %Changeset{valid?: true, changes: changes} = changeset
Enum.each(keys, fn key ->
expected = Map.get(expected_params, Atom.to_str... | test/support/assert_helpers.ex | 0.795022 | 0.509764 | assert_helpers.ex | starcoder |
defmodule ConciergeSite.DaySelectHelper do
@moduledoc """
Render the day select component in templates
"""
import Phoenix.HTML.Tag, only: [content_tag: 3, tag: 2]
@weekdays ["monday", "tuesday", "wednesday", "thursday", "friday"]
@weekend ["saturday", "sunday"]
@days @weekdays ++ @weekend
@short_days [... | apps/concierge_site/lib/views/day_select_helper.ex | 0.564459 | 0.415136 | day_select_helper.ex | starcoder |
defmodule RobotSimulator do
defp is_valid_position(position) do
is_tuple(position) && tuple_size(position) == 2 && Enum.all?(Tuple.to_list(position), &(is_integer(&1)))
end
defp list_contains(list, item) do
item in list
end
defp next_direction(direction, move) do
case {direction, move} do
... | robot-simulator/lib/robot_simulator.ex | 0.835148 | 0.63426 | robot_simulator.ex | starcoder |
defmodule JSX do
def encode!(term, opts \\ []) do
parser_opts = :jsx_config.extract_config(opts ++ [:escaped_strings])
parser(:jsx_to_json, opts, parser_opts).(JSX.Encoder.json(term) ++ [:end_json])
end
def encode(term, opts \\ []) do
{ :ok, encode!(term, opts) }
rescue
ArgumentError -> { :erro... | lib/jsx.ex | 0.656328 | 0.613208 | jsx.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.