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 DobbleGenerator.ImageProcessing.Algorithm do
@moduledoc """
We will base our algorithm based on the following key findings:
If a game of Dobble needs (n+1) symbols on each card, n being a primary number then we will need:
A collection of n2 + n + 1 symbols
We will be able to generate n2 + n + 1 uni... | lib/dobble_generator/image_processing/algorithm.ex | 0.77569 | 0.679764 | algorithm.ex | starcoder |
defmodule Sanbase.Price.Utils do
import Sanbase.DateTimeUtils, only: [round_datetime: 1]
defguard is_zero(price)
when is_number(price) and price >= -1.0e-7 and price <= 1.0e-7
@spec fetch_last_prices_before(String.t(), DateTime.t()) ::
{number() | nil, number() | nil}
def fetch_last_price... | lib/sanbase/prices/utils.ex | 0.786049 | 0.610715 | utils.ex | starcoder |
defmodule Robot do
defstruct [direction: :north, position: {0, 0}]
end
defmodule RobotSimulator do
@directions [
:north,
:east,
:south,
:west
]
@doc """
Create a Robot Simulator given an initial direction and position.
Valid directions are: `:north`, `:east`, `:south`, `:west`
"""
@sp... | lib/robot_simulator.ex | 0.928668 | 0.895933 | robot_simulator.ex | starcoder |
defmodule Ppc.Plan do
@moduledoc """
Manage product plans.
## Reference
- [Plan docs](https://developer.paypal.com/api/subscriptions/v1/#plans_list)
"""
alias Ppc.{Client, Common}
@path "/v1/billing/plans"
@doc """
Get list of plans.
## Accepted options
- :params with accepted values
- :... | lib/ppc/plan.ex | 0.861727 | 0.570989 | plan.ex | starcoder |
defprotocol Plymio.Vekil do
@moduledoc ~S"""
The `Plymio.Vekil` protocol is implemented by a collection -- the *vekil* -- that
associates *proxies* with *foroms*.
The *vekil* may be thought of as a dictionary where a
*proxy* is a `key` and its `value` is a *forom*.
A *vekil's* *proxies* will usually be h... | lib/vekil/protocol/vekil.ex | 0.884252 | 0.652006 | vekil.ex | starcoder |
defmodule Mix.Tasks.Cssex.Parser do
use Mix.Task
require Logger
@moduledoc """
Task to parse cssex files into css files.
You can use two types of flags, `--e` (and additionally `--a`) or `--c`.
For the --e flag you use any number of
`--e path/to_cssex/file.cssex=path/to_css/output.css`
And if you wa... | lib/mix/tasks/css.parser.ex | 0.818918 | 0.77586 | css.parser.ex | starcoder |
defmodule Day01 do
def part1(input) do
parse(input)
|> Enum.reduce({{0, 0}, 0}, fn command, {location, facing} ->
case command do
{:left, amount} ->
facing = turn_left(facing)
{move(location, facing, amount), facing}
{:right, amount} ->
facing = turn_right(f... | day01/lib/day01.ex | 0.662796 | 0.547101 | day01.ex | starcoder |
defmodule Satori.Stream do
@moduledoc """
The Stream context.
"""
import Ecto.Query, warn: false
alias Satori.Repo
alias Satori.Stream.Observation
@doc """
Returns the list of observation.
## Examples
iex> list_observation()
[%Observation{}, ...]
"""
def list_observation do
R... | server/satori/lib/satori/stream.ex | 0.923868 | 0.49347 | stream.ex | starcoder |
defmodule Grax.Validator do
@moduledoc false
alias Grax.{ValidationError, InvalidIdError}
alias Grax.Schema.{TypeError, CardinalityError}
alias RDF.{IRI, BlankNode, Literal, XSD}
import ValidationError, only: [add_error: 3]
def call(mapping, opts) do
ValidationError.exception(context: Map.get(mapping... | lib/grax/validator.ex | 0.737064 | 0.440048 | validator.ex | starcoder |
defmodule Blackout do
@moduledoc """
A very thin wrapper around Erlang's mnesia used to
provide distributed rate limiting,
with little to no configuration
and a simple API for developer happiness.
"""
@doc """
Setup an mnesia schema and table while joining a cluster.
This function must be ca... | lib/blackout.ex | 0.860735 | 0.534066 | blackout.ex | starcoder |
defmodule Grouper.Group do
@moduledoc """
Starting a group turns whatever is starting it into a "group". This is
typically either run from a standalone process or under a supervisor as the
first child. It is not usually necessary under an `Application`, as the
application itself is used as a group identifier.... | lib/grouper/group.ex | 0.81582 | 0.486941 | group.ex | starcoder |
defmodule Calex.Decoder do
@moduledoc false
# https://rubular.com/r/sXPKG84KfgtfMV
@utc_datetime_pattern ~r/^\d{8}T\d{6}Z$/
@local_datetime_pattern ~r/^\d{8}T\d{6}$/
@date_pattern ~r/^\d{8}$/
@gmt_offset_pattern ~r/^GMT(\+|\-)(\d{2})(\d{2})$/
def decode!(data) do
data
|> decode_lines
|> dec... | lib/calex/decoder.ex | 0.779028 | 0.451024 | decoder.ex | starcoder |
defmodule Flawless.Types do
@moduledoc """
Provides a number of helper functions to deal with types.
"""
@valid_types [
:any,
:string,
:number,
:integer,
:float,
:boolean,
:atom,
:pid,
:ref,
:function,
:port,
:list,
:tuple,
:map,
:struct
]
@type ... | lib/flawless/types.ex | 0.838845 | 0.70724 | types.ex | starcoder |
defmodule PayDayLoan.EtsBackend do
@moduledoc """
ETS-based backend capable of handling raw values, pids, or callbacks.
This is the default backend used by PayDayLoan and is designed for storing
process ids. However, it can be used with raw values or callback functions.
With pids, special care is taken to ... | lib/pay_day_loan/ets_backend.ex | 0.849644 | 0.650322 | ets_backend.ex | starcoder |
defmodule NearApi.Transaction do
@moduledoc """
Create NEAR [transactions](https://docs.near.org/docs/tutorials/create-transactions) here
"""
require Logger
@type t :: %__MODULE__{
signer_id: String.t(),
receiver_id: String.t(),
nonce: integer,
public_key: NearApi.Publ... | lib/transaction.ex | 0.860589 | 0.442094 | transaction.ex | starcoder |
defmodule Membrane.RTP.JitterBuffer.BufferStore do
@moduledoc false
# Store for RTP packets. Packets are stored in `Heap` ordered by packet index. Packet index is
# defined in RFC 3711 (SRTP) as: 2^16 * rollover count + sequence number.
# ## Fields
# - `rollover_count` - count of all performed rollovers (... | lib/membrane/rtp/jitter_buffer/buffer_store.ex | 0.77675 | 0.520192 | buffer_store.ex | starcoder |
defmodule Membrane.Pipeline do
@moduledoc """
Module containing functions for constructing and supervising pipelines.
Pipelines are units that make it possible to instantiate, link and manage
elements and bins in convenient way (actually they should always be used inside
a pipeline). Linking pipeline childre... | lib/membrane/pipeline.ex | 0.908906 | 0.667229 | pipeline.ex | starcoder |
defmodule Game do
def new(%{width: width, height: height, mines: mines}) do
:random.seed(:erlang.now)
indices = get_indices(width, height)
mine_list = Enum.take_random(indices, mines)
for index <- indices, into: %{} do
{index, generate_field(index, mine_list)}
end
end
def get_indices(wi... | lib/game.ex | 0.545528 | 0.628778 | game.ex | starcoder |
defmodule Ecto.Repo do
@moduledoc """
Defines a repository.
A repository maps to an underlying data store, controlled by the
adapter. For example, Ecto ships with a Postgres adapter that
stores data into a PostgreSQL database.
When used, the repository expects the `:otp_app` as option.
The `:otp_app` sh... | lib/ecto/repo.ex | 0.876423 | 0.496399 | repo.ex | starcoder |
defmodule Odoo do
@moduledoc """
Library to access Odoo JSON-RPC API.
Provides the following methods for interacting with Odoo:
- login
- search
- search_read
- read
- read_group
- create
- write
- delete
"""
@doc """
- Login in Odoo and set session_id for future calls
### Params
- ... | lib/odoo.ex | 0.756627 | 0.594728 | odoo.ex | starcoder |
defmodule ActionMap do
@moduledoc """
Maps action names to names of modules which implement the `:Action` behaviour
"""
@actions %{
"multiplot" => "MultiplotAction",
"scatter" => "ScatterAction",
"ellipse" => "EllipseAction",
"timeseries" => "TimeSeriesAction"
}
@doc """
Lists the availa... | apps/imposc/lib/core/actions/action_map.ex | 0.751283 | 0.505859 | action_map.ex | starcoder |
defmodule Aecore.Chain.Identifier do
@moduledoc """
Utility module for interacting with identifiers.
Our binaries like account pubkey or hashes will already be represented as encoded (with already specified tag) binaries, using the following format:
<<Tag:1/unsigned-integer-unit:8, Binary:32/binary-unit:8>>,
... | apps/aecore/lib/aecore/chain/identifier.ex | 0.832747 | 0.438725 | identifier.ex | starcoder |
defmodule FarmbotCore.Firmware.RxBuffer do
@moduledoc """
Serial character buffering doesn't always make sense. When
reading serial input of line oriented data, you might not
always capture a full line of text.
* You might see only the end of a line.
* You might get a complete line in two parts.
* You ... | lib/firmware/rx_buffer.ex | 0.673084 | 0.444565 | rx_buffer.ex | starcoder |
defmodule Gossip.Client do
@moduledoc """
Behaviour for integrating Gossip into your game
"""
defmodule Core do
@moduledoc """
Callbacks for the "channels" flag
This is the only _required_ module.
"""
@doc """
Get the game's User Agent.
This should return the game name with a ver... | lib/gossip/client.ex | 0.802865 | 0.411081 | client.ex | starcoder |
defmodule Slugy do
@moduledoc ~S"""
A Phoenix library to generate slug for your schema fields
## Examples
Let's suppose we have a `Post` schema and we want to generate a slug from `title` field and save it to the `slug` field. To achieve that we need to call `slugify/2` following the changeset pipeline passin... | lib/slugy.ex | 0.826991 | 0.570122 | slugy.ex | starcoder |
defmodule Janus.Mock.Transport do
@moduledoc """
Allows to mock transport module in a predictable way.
One has to pass list of tuples representing request-response pairs to `c:connect/1` callback which will put them in the returned state.
For each `c:send/3` invocation `#{inspect(__MODULE__)}` will try to matc... | lib/mock/transport.ex | 0.899868 | 0.788094 | transport.ex | starcoder |
defmodule Raft do
@moduledoc """
A simple implementation of the raft protocol
https://raft.github.io/
"""
use GenServer
alias Raft.PG
alias Raft.Server
alias Raft.State
require Logger
@key :raft
@election_initial_delay 500
@election_random_delay 500
def start_link() do
GenServer.star... | lib/raft.ex | 0.682891 | 0.61986 | raft.ex | starcoder |
defmodule RethinkDB.Query.Macros do
alias RethinkDB.Q
alias RethinkDB.Query
@moduledoc false
defmacro operate_on_two_args(op, opcode, options \\ []) do
opt_support = Keyword.get(options, :opts, false)
quote do
def unquote(op)(left, right) do
%Q{query: [unquote(opcode), [wrap(left), wrap(... | lib/rethinkdb/query/macros.ex | 0.532668 | 0.487002 | macros.ex | starcoder |
import Kernel, except: [apply: 2]
defmodule Ecto.Query.Builder.Dynamic do
@moduledoc false
alias Ecto.Query.Builder
@doc """
Builds a dynamic expression.
"""
@spec build([Macro.t], Macro.t, Macro.Env.t) :: Macro.t
def build(binding, expr, env) do
{query, vars} = Builder.escape_binding(quote(do: que... | lib/ecto/query/builder/dynamic.ex | 0.754373 | 0.469277 | dynamic.ex | starcoder |
defmodule Integer do
@moduledoc """
Functions for working with integers.
"""
import Bitwise
@doc """
Determines if an integer is odd.
Returns `true` if `n` is an odd number, otherwise `false`.
Allowed in guard clauses.
"""
defmacro is_odd(n) do
quote do: (unquote(n) &&& 1) == 1
end
@doc... | lib/elixir/lib/integer.ex | 0.948082 | 0.590573 | integer.ex | starcoder |
defmodule QueryBuilder do
require Ecto.Query
alias Ecto.Query
defmacro __using__(opts) do
quote do
require QueryBuilder.Schema
QueryBuilder.Schema.__using__(unquote(opts))
end
end
@doc ~S"""
Preloads the associations.
Bindings are automatically set if joins have been made, or if it ... | lib/query_builder.ex | 0.876463 | 0.850841 | query_builder.ex | starcoder |
defmodule ArtemisWeb.ViewHelper.Form do
use Phoenix.HTML
import Phoenix.HTML.Tag
@doc """
Returns a blank option value
"""
def blank_option(), do: [key: " ", value: ""]
@doc """
Returns option data for a select field
Options
:key_field -> atom. required if passing a list of maps or list of ke... | apps/artemis_web/lib/artemis_web/view_helpers/form.ex | 0.848314 | 0.490236 | form.ex | starcoder |
defmodule Parse.TripUpdates do
@moduledoc """
Parser for the GTFS-RT TripUpdates protobuf output.
"""
@behaviour Parse
alias Model.Prediction
use Timex
import :binary, only: [copy: 1]
def parse("{" <> _ = blob) do
Parse.CommuterRailDepartures.JSON.parse(blob)
end
def parse(blob) do
blob
... | apps/parse/lib/parse/trip_updates.ex | 0.680879 | 0.450903 | trip_updates.ex | starcoder |
defmodule AWS.CognitoIdentityProvider do
@moduledoc """
Using the Amazon Cognito User Pools API, you can create a user pool to manage
directories and users.
You can authenticate a user to obtain tokens related to user identity and access
policies.
This API reference provides information about user pools ... | lib/aws/generated/cognito_identity_provider.ex | 0.866175 | 0.462655 | cognito_identity_provider.ex | starcoder |
defmodule EV do
@moduledoc """
EV is a library for implementing events-based architecture.
At a high level the goal is to split data processing and persistance (or API calls). An event is a standardised intermediary passed between these to steps.
Suppose you have a function to create a user:
```elixir
de... | lib/ev.ex | 0.942771 | 0.869659 | ev.ex | starcoder |
defmodule GGity.Scale.Shape.Manual do
@moduledoc false
alias GGity.{Draw, Labels}
alias GGity.Scale.Shape
@type t() :: %__MODULE__{}
defstruct levels: nil,
transform: nil,
labels: :waivers,
guide: :legend,
values: []
@spec new(keyword()) :: Shape.Manual.t(... | lib/ggity/scale/shape_manual.ex | 0.855384 | 0.479321 | shape_manual.ex | starcoder |
defmodule Talib.BollingerBand do
alias Talib.SMA
alias Talib.Average
require OK
require Logger
@moduledoc ~S"""
Defines a Bollinger bands.
## History
Version: 1.0
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:bollinger_bands
Audited by:
| Name | Title ... | lib/talib/bollinger_band.ex | 0.875048 | 0.656101 | bollinger_band.ex | starcoder |
defmodule Snap.Cluster do
@moduledoc """
Defines a cluster.
A cluster maps to an Elasticsearch endpoint.
When used, the cluster expects `:otp_app` as an option. The `:otp_app`
should point to an OTP application that has the cluster configuration. For
example, this cluster:
```
defmodule MyApp.Cluster... | lib/snap/cluster.ex | 0.916629 | 0.783699 | cluster.ex | starcoder |
defmodule Rajska.QueryAuthorization do
@moduledoc """
Absinthe middleware to ensure query permissions.
## Usage
[Create your Authorization module and add it and QueryAuthorization to your Absinthe.Schema](https://hexdocs.pm/rajska/Rajska.html#module-usage). Then set the permitted role to access a query or mut... | lib/middlewares/query_authorization.ex | 0.796451 | 0.776623 | query_authorization.ex | starcoder |
defmodule Solid.Tag do
@moduledoc """
Control flow tags can change the information Liquid shows using programming logic.
More info: https://shopify.github.io/liquid/tags/control-flow/
"""
alias Solid.{Expression, Argument, Context}
defmodule CustomTag do
@moduledoc """
This module define behaviou... | lib/solid/tag.ex | 0.88387 | 0.529203 | tag.ex | starcoder |
defmodule Bolt.Cogs.BanRange do
@moduledoc false
@behaviour Nosedrum.Command
alias Bolt.Constants
alias Bolt.Moderation
alias Bolt.Paginator
alias Nosedrum.Predicates
alias Nostrum.Api
alias Nostrum.Cache.GuildCache
alias Nostrum.Struct.Embed
alias Nostrum.Struct.Guild
alias Nostrum.Struct.Messag... | lib/bolt/cogs/banrange.ex | 0.810254 | 0.606324 | banrange.ex | starcoder |
defmodule ModelFox do
@moduledoc """
This is the main module in the `modelfox` package.
"""
defmodule Model do
@moduledoc """
Use this struct to load a model, make predictions, and log events to the app.
"""
@type t :: %__MODULE__{
model: reference,
log_queue: [ModelFox.... | languages/elixir/lib/tangram.ex | 0.944511 | 0.71773 | tangram.ex | starcoder |
defmodule Google.Bigtable.Admin.V2.Table do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
name: String.t(),
cluster_states: %{String.t() => Google.Bigtable.Admin.V2.Table.ClusterState.t()},
column_families: %{String.t() => Google.Bigtable.Admin.V2.ColumnFami... | lib/grpc/admin/table.pb.ex | 0.703244 | 0.46478 | table.pb.ex | starcoder |
defmodule Cluster.Strategy do
@moduledoc """
This module defines the behaviour for implementing clustering strategies.
"""
defmacro __using__(_) do
quote do
@behaviour Cluster.Strategy
@impl true
def child_spec(args) do
%{id: __MODULE__, type: :worker, start: {__MODULE__, :start_l... | lib/strategy/strategy.ex | 0.841939 | 0.402891 | strategy.ex | starcoder |
defmodule Grizzly.ZWave.Commands.MeterReport do
@moduledoc """
This module implements the command METER_REPORT of the COMMAND_CLASS_METER command class.
This command is used to advertise the current meter reading at the sending node.
Params:
* `:meter_type` - the type of metering physical unit being repo... | lib/grizzly/zwave/commands/meter_report.ex | 0.892659 | 0.435361 | meter_report.ex | starcoder |
defmodule LayoutOMatic.Layouts.Grid do
import Scenic.Primitives
@moduledoc """
Add a grid to a viewport.
Grids allow you to segment a viewport much like a CSS grid. This allows for
clear and symantic layouts. Creating a grid is as simple as passing a
%GridBuilder{} with some values and your viewport will ... | lib/layouts/grid.ex | 0.850375 | 0.931649 | grid.ex | starcoder |
defmodule Code.Identifier do
@moduledoc false
@doc """
Checks if the given identifier is an unary op.
## Examples
iex> Code.Identifier.unary_op(:+)
{:non_associative, 300}
"""
@spec unary_op(atom) :: {:non_associative, precedence :: pos_integer} | :error
def unary_op(op) do
cond do
... | lib/elixir/lib/code/identifier.ex | 0.789964 | 0.596639 | identifier.ex | starcoder |
defmodule Radixir.Gateway.Request.BuildTransaction.Action.CreateToken do
@moduledoc false
# @moduledoc """
# Methods to create each map in `CreateToken` action.
# """
alias Radixir.StitchPlan
@type stitch_plans :: list(keyword)
@type params :: keyword
@doc """
Generates stitch plan for `type` map in... | lib/radixir/gateway/request/build_transaction/action/create_token.ex | 0.874413 | 0.432243 | create_token.ex | starcoder |
defmodule Explorer.PolarsBackend.DataFrame do
@moduledoc false
alias Explorer.DataFrame, as: DataFrame
alias Explorer.PolarsBackend.Native
alias Explorer.PolarsBackend.Series, as: PolarsSeries
alias Explorer.PolarsBackend.Shared
alias Explorer.Series, as: Series
@type t :: %__MODULE__{resource: binary()... | lib/explorer/polars_backend/data_frame.ex | 0.846006 | 0.420481 | data_frame.ex | starcoder |
defmodule Dune.Allowlist do
@moduledoc """
Behaviour to customize the modules and functions that are allowed or restricted.
## Warning: security considerations
The default implementation is `Dune.Allowlist.Default`, and should only allow safe
functions: no atom leaks, no execution of arbitrary code, no acce... | lib/dune/allowlist.ex | 0.798776 | 0.567997 | allowlist.ex | starcoder |
defmodule Bitcoinex.Secp256k1.Math do
@moduledoc """
Contains math utilities when dealing with secp256k1 curve points and scalars.
All of the addition and multiplication uses the secp256k1 curve paramaters.
Several of the jacobian multiplication and addition functions are borrowed heavily from https://github.... | lib/secp256k1/math.ex | 0.919638 | 0.663866 | math.ex | starcoder |
defmodule SiteEncrypt.Phoenix do
@moduledoc """
`SiteEncrypt` adapter for Phoenix endpoints.
## Usage
1. Add `use SiteEncrypt.Phoenix` to your endpoint immediately after `use Phoenix.Endpoint`
2. Configure https via `configure_https/2`.
3. Add the implementation of `c:SiteEncrypt.certification/0` to the e... | lib/site_encrypt/phoenix.ex | 0.808483 | 0.546557 | phoenix.ex | starcoder |
defmodule UrbitEx.API.Notifications do
alias UrbitEx.{Airlock, Actions, API}
alias UrbitEx.Timebox
import UrbitEx.HarkStore
@moduledoc """
Client API to interact with `hark-store`, the notifications system of Urbit.
"""
@doc """
Fetches all notifications stored on your ship.
Takes an UrbitEx.Session... | lib/api/gall/hark.ex | 0.659405 | 0.437884 | hark.ex | starcoder |
defmodule ScrollHat.Font.Big do
@moduledoc """
Large 5x7 Font
Transposed from https://github.com/pimoroni/scroll-phat-hd/blob/master/library/scrollphathd/fonts/font5x7.py
"""
@behaviour ScrollHat.Font
def char_matrix(char, brightness \\ 0xFF)
def char_matrix(0x0, _b) do
[
[0x0, 0x0, 0x0, 0x0,... | lib/scroll_hat/fonts/big.ex | 0.577734 | 0.479626 | big.ex | starcoder |
defmodule SetOne.ChallengeSix do
use Bitwise
alias SetOne.ChallengeThree, as: ChallengeThree
@doc """
Attempts to find the key of a given ciphertext encrypted with repeating XOR.
http://cryptopals.com/sets/1/challenges/6
"""
@spec find_key_repeating_xor(binary) :: [binary]
def find_key_repeating_xor(ci... | lib/set_1/challenge_6.ex | 0.886988 | 0.427935 | challenge_6.ex | starcoder |
defmodule ExMpesa.Reversal do
@moduledoc """
Reversal API enables reversal of transactions done
You will be able to reverse a transaction where you are the credit party. This means it will be done via the Web portal, and may require manual authorization from the Service Provider side. But if you are allowed to re... | lib/ex_mpesa/reversal.ex | 0.868674 | 0.85984 | reversal.ex | starcoder |
defmodule Dune.Session do
@moduledoc """
Sessions provide a way to evaluate code and keep state (bindings, modules...) between evaluations.
- Use `Dune.eval_string/2` to execute code as a one-off
- Use `Dune.Session.eval_string/3` to execute consecutive code blocks
`Dune.Session` could be used to implement ... | lib/dune/session.ex | 0.86757 | 0.729158 | session.ex | starcoder |
defmodule Anansi.Sequence do
@moduledoc """
Tools for generating escape codes for multiple ANSI instructions in one go.
"""
# @doc """
# Macro for generating multiple ANSI escape instructions in one go.
# """
# defmacro compose(sequence, block \\ []) do
# sequence = List.wrap sequence
# {code, se... | lib/anansi/sequence.ex | 0.573798 | 0.513059 | sequence.ex | starcoder |
defmodule Talib.EMA do
@moduledoc ~S"""
Defines an Exponential Moving Average.
## History
Version: 1.0
Source: http://www.itl.nist.gov/div898/handbook/pmc/section3/pmc324.htm
Audited by:
| Name | Title |
| :----------- | :---------------- |
| | |
... | lib/talib/ema.ex | 0.905165 | 0.659629 | ema.ex | starcoder |
defmodule AWS.CodeCommit do
@moduledoc """
AWS CodeCommit
This is the *AWS CodeCommit API Reference*. This reference provides
descriptions of the operations and data types for AWS CodeCommit API along
with usage examples.
You can use the AWS CodeCommit API to work with the following objects:
Repositor... | lib/aws/code_commit.ex | 0.881424 | 0.507568 | code_commit.ex | starcoder |
defmodule GuessWho.Contenders.TrevorBrown do
@moduledoc """
A strategy that finds the character by finding an attribute that splits the
remaining characters into two groups of similar size in order to perform a
binary search. Sometimes there is no attribute that splits the remaining
characters 50/50, so this ... | lib/guess_who/contenders/trevor_brown.ex | 0.729905 | 0.482673 | trevor_brown.ex | starcoder |
defmodule AstraeaVirgoWeb.JudgementTypeView do
use AstraeaVirgoWeb, :view
@moduledoc """
Response for Judgement Type API
"""
defp ce() do
%{
id: "CE",
name: "Compile Error",
penalty: false,
solved: false
}
end
defp ac() do
%{
id: "AC",
name: "Accepted",
... | lib/virgo_web/views/judgement_type_view.ex | 0.743913 | 0.53959 | judgement_type_view.ex | starcoder |
defmodule Cronex.Job do
@moduledoc """
This module represents a job.
"""
import Cronex.Parser
defstruct frequency: nil,
task: nil,
pid: nil
@doc """
Creates a `%Job{}` with a given frequency and task.
Check `Cronex.Every.every/3` documentation, to view the accepted `frequency... | lib/cronex/job.ex | 0.826852 | 0.774839 | job.ex | starcoder |
defmodule Axon.Layers do
@moduledoc ~S"""
Functional implementations of common neural network layer
operations.
Layers are the building blocks of neural networks. These
functional implementations can be used to express higher-level
constructs using fundamental building blocks. Neural network
layers are s... | lib/axon/layers.ex | 0.959193 | 0.891999 | layers.ex | starcoder |
defmodule Chunky.Sequence.OEIS.Repr do
@moduledoc """
Sequences from the [Online Encyclopedia of Integer Sequences](https://oeis.org) dealing with number
representations, like alternate bases, digit contents, and patterns of digits.
## Available Sequences
### Omissions and Deletions of digits
- `create_... | lib/sequence/oeis/repr.ex | 0.859782 | 0.749798 | repr.ex | starcoder |
defmodule AMQP.Basic do
@moduledoc """
Functions to publish, consume and acknowledge messages.
"""
require Record
import AMQP.Core
alias AMQP.Channel
Record.defrecordp :amqp_msg, [props: p_basic(), payload: ""]
@doc """
Publishes a message to an Exchange.
This method publishes a message to a spe... | lib/amqp/basic.ex | 0.883939 | 0.489137 | basic.ex | starcoder |
defmodule HPack.Table do
@moduledoc """
Functions to maintain the (de)compression context.
Contains the static tables as well as all menagement of the dynamic table.
"""
@static [
{":authority", nil},
{":method", "GET"},
{":method", "POST"},
{":path", "/"},
{":path", "/index.html"},
... | lib/hpack/table.ex | 0.766556 | 0.590514 | table.ex | starcoder |
defmodule Mathmatical.Questions do
@moduledoc """
The Questions context.
"""
import Ecto.Query, warn: false
alias Mathmatical.Repo
alias Mathmatical.Questions.Subject
@doc """
Returns the list of subjects.
## Examples
iex> list_subjects()
[%Subject{}, ...]
"""
def list_subjects d... | lib/mathmatical/questions.ex | 0.86548 | 0.456168 | questions.ex | starcoder |
defmodule AWS.Health do
@moduledoc """
Health
The Health API provides programmatic access to the Health information that
appears in the [Personal Health Dashboard](https://phd.aws.amazon.com/phd/home#/).
You can use the API operations to get information about events that might affect
your Amazon Web Serv... | lib/aws/generated/health.ex | 0.893356 | 0.635067 | health.ex | starcoder |
defmodule NervesTime.RTC.MCP7940 do
@moduledoc """
Microchip MCP7940N RTC implementation for NervesTime
To configure NervesTime to use this module, update the `:nerves_time` application
environment like this:
```elixir
config :nerves_time, rtc: NervesTime.RTC.MCP7940
```
If not using `"i2c-1"` or the... | lib/nerves_time/rtc/mcp7940.ex | 0.732974 | 0.702326 | mcp7940.ex | starcoder |
defmodule LastCrusader.Micropub.PostTypeDiscovery do
@moduledoc """
Indieweb Post Type discovery implementation
see https://indieweb.org/post-type-discovery
Post Type Discovery specifies an algorithm for consuming code to determine the type of a post by its content properties and their values rather tha... | lib/last_crusader/micropub/post_type_discovery.ex | 0.824744 | 0.571826 | post_type_discovery.ex | starcoder |
defmodule Structex do
@doc """
Calculates expected distortion response by equivalent linearization.
iex> model =
...> fn %Tensorex{shape: [2]} = distortion ->
...> mass = Tensorex.from_list([[10.2, 0], [0, 20.4]])
...> k0 = 88.1 - distortion[[0]] * 10
...> k1 = 165.2 - d... | lib/structex.ex | 0.704465 | 0.541712 | structex.ex | starcoder |
defmodule Tensorflow.Profiler.Trace.DevicesEntry do
@moduledoc false
use Protobuf, map: true, syntax: :proto3
@type t :: %__MODULE__{
key: non_neg_integer,
value: Tensorflow.Profiler.Device.t() | nil
}
defstruct [:key, :value]
field(:key, 1, type: :uint32)
field(:value, 2, type... | lib/tensorflow/core/protobuf/trace_events.pb.ex | 0.776072 | 0.519156 | trace_events.pb.ex | starcoder |
defmodule Squabble.Server do
@moduledoc """
Implementation for the squabble server
"""
alias Squabble.PG
alias Squabble.State
require Logger
@behaviour Squabble.Leader
@type debug() :: map()
@key :squabble
@check_election_timeout 1500
@doc """
Get the winner subscription notices
"""
de... | lib/squabble/server.ex | 0.797911 | 0.430806 | server.ex | starcoder |
defmodule Grizzly.ZWave.SmartStart.MetaExtension.BootstrappingMode do
@moduledoc """
This extension is used to advertise the bootstrapping mode to use when
including the node advertised in the provisioning list
"""
@typedoc """
The modes are:
- `:security_2` - the node must be manually set to learn mode... | lib/grizzly/zwave/smart_start/meta_extension/bootstrapping_mode.ex | 0.886911 | 0.422415 | bootstrapping_mode.ex | starcoder |
defmodule AWS.Directory do
@moduledoc """
Directory Service
Directory Service is a web service that makes it easy for you to setup and run
directories in the Amazon Web Services cloud, or connect your Amazon Web
Services resources with an existing self-managed Microsoft Active Directory.
This guide provi... | lib/aws/generated/directory.ex | 0.8789 | 0.447098 | directory.ex | starcoder |
defmodule Ash.CiString do
@moduledoc """
Represents a case insensitive string
While some data layers are aware of case insensitive string types, in order for values
of this type to be used in other parts of Ash Framework, it has to be embedded in a module
this allows us to implement the `Comparable` protocol... | lib/ash/ci_string.ex | 0.854582 | 0.525734 | ci_string.ex | starcoder |
defmodule CSQuery.FieldValue do
@moduledoc """
A representation of a field value pattern matcher for the AWS CloudSearch
structured query syntax. If the `CSQuery.FieldValue` does not have a `name`,
then all text and text-array fields will be searched. If it does have a
`name`, then only the named field will b... | lib/csquery/field_value.ex | 0.906798 | 0.694173 | field_value.ex | starcoder |
defmodule Cartograf do
@let :let
@drop :drop
@nest :nest
@const :const
@moduledoc """
Cartograf is a set of elixir macros for mapping fields from
one struct to another.
The goal is to make these struct-to-struct translations more
robust and less cumbersome to write and maintian.
## Basic Form
The... | lib/cartograf.ex | 0.785514 | 0.882782 | cartograf.ex | starcoder |
defmodule MangoPay.Refund do
@moduledoc """
Functions for MangoPay [refund](https://docs.mangopay.com/endpoints/v2.01/refunds#e316_the-refund-object).
"""
use MangoPay.Query.Base
set_path "refunds"
@doc """
Get a refund.
## Examples
{:ok, refund} = MangoPay.Refund.get(id)
"""
def get id do
... | lib/mango_pay/refund.ex | 0.682468 | 0.521959 | refund.ex | starcoder |
defmodule StaffNotes.Files do
@moduledoc """
Represents the business-logic layer of handling files.
"""
require Logger
alias ExAws.S3
alias StaffNotes.ConfigurationError
@doc """
Accepts a Base64-encoded file and uploads it to S3.
## Examples
```
iex> upload_file(..., "image/png")
"https://i... | lib/staff_notes/files.ex | 0.845528 | 0.599808 | files.ex | starcoder |
defmodule Konvex do
@moduledoc """
Provides modular KV-storage abstractions.
Each KV-storage shares a common set of abilities (e.g. get value by key),
but at the same time can expose it's own unique one.
So to address this heterogeneity and be able to compose modular clients
the library exposes this abilit... | lib/konvex.ex | 0.75183 | 0.463384 | konvex.ex | starcoder |
defmodule Yggdrasil.Backend do
@moduledoc """
Backend behaviour that defines how to subscribe, unsubscribe and publish as
well as send messages of connection and disconnection to subscribers.
By default, the implementation uses `Phoenix.PubSub` as backend.
## Backend alias
When defining backends it is po... | lib/yggdrasil/backend.ex | 0.882592 | 0.789112 | backend.ex | starcoder |
defmodule AWS.NetworkManager do
@moduledoc """
Transit Gateway Network Manager (Network Manager) enables you to create a global
network, in which you can monitor your AWS and on-premises networks that are
built around transit gateways.
"""
@doc """
Associates a customer gateway with a device and optiona... | lib/aws/generated/network_manager.ex | 0.798619 | 0.424591 | network_manager.ex | starcoder |
defmodule AWS.SFN do
@moduledoc """
AWS Step Functions
AWS Step Functions is a service that lets you coordinate the components of
distributed applications and microservices using visual workflows.
You can use Step Functions to build applications from individual components,
each of which performs a discre... | lib/aws/generated/sfn.ex | 0.934865 | 0.750553 | sfn.ex | starcoder |
defmodule Environment do
@moduledoc """
Environment name and value storage.
"""
@initial_environment %{
"parent_env" => nil,
"null" => nil,
"true" => true,
"false" => false,
"VERSION" => "0.1"
}
@doc """
The global variables always defined at the start of the program.
"""
@spec g... | lib/environment.ex | 0.80147 | 0.425486 | environment.ex | starcoder |
defmodule Numy.Vector do
@moduledoc """
Vector, basic implementation.
Implements protocols: `Numy.Vc`
"""
@enforce_keys [:nelm]
defstruct [
:nelm, # length of the vector
:data # actual data, type is list
]
def new(nelm) when is_integer(nelm) do
%Numy.Vector{nelm: nelm, data: List.duplica... | lib/vector/vector.ex | 0.829596 | 0.850903 | vector.ex | starcoder |
defmodule Starship do
@moduledoc """
The Starship Webserver.
This module is the starting point for the Starship Webserver.
If you are an end user of Starship, this is the only thing that you need to worry about.
Here is where you will `warp_in` your configuration (or use the default configuration provided) ... | lib/starship.ex | 0.79736 | 0.659556 | starship.ex | starcoder |
defmodule Isbndbex.Api do
use HTTPoison.Base
@base_url "http://isbndb.com/api/v2/json"
defp process_url(url), do: @base_url <> url
@doc """
Gets the book with the given `id` using `key` as the API key.
The `id` can be the books's isbn10, isbn13 or the internal isbndb book id.
"""
def get_book(key, id)... | lib/isbndbex/api.ex | 0.874948 | 0.62986 | api.ex | starcoder |
defmodule Ecto.Migration do
@moduledoc """
Migrations are used to modify your database schema over time.
This module provides many helpers for migrating the database,
allowing developers to use Elixir to alter their storage in
a way that is database independent.
Here is an example:
defmod... | deps/ecto_sql/lib/ecto/migration.ex | 0.838084 | 0.409664 | migration.ex | starcoder |
defmodule Kernel.ParallelCompiler do
@moduledoc """
A module responsible for compiling and requiring files in parallel.
"""
@doc """
Starts a task for parallel compilation.
If you have a file that needs to compile other modules in parallel,
the spawned processes need to be aware of the compiler environm... | lib/elixir/lib/kernel/parallel_compiler.ex | 0.707203 | 0.427397 | parallel_compiler.ex | starcoder |
defmodule Stargate.Receiver do
@moduledoc """
Provides a Stargate websocket process that can be either a
reader or consumer connection based on the configuration passed
when starting the process.
"""
require Logger
use Stargate.Connection
import Stargate.Supervisor, only: [via: 2]
alias Stargate.{Cons... | lib/stargate/receiver.ex | 0.865793 | 0.446857 | receiver.ex | starcoder |
defmodule Plug.SSL do
@moduledoc """
A plug to force SSL connections.
If the scheme of a request is https, it'll add a `strict-transport-security`
header to enable HTTP Strict Transport Security.
Otherwise, the request will be redirected to a corresponding location
with the `https` scheme by setting the `... | deps/plug/lib/plug/ssl.ex | 0.854126 | 0.602617 | ssl.ex | starcoder |
defmodule Domo.TypeEnsurerFactory.Generator.MatchFunRegistry.Lists do
@moduledoc false
alias Domo.TypeEnsurerFactory.Precondition
alias Domo.TypeEnsurerFactory.Generator.TypeSpec
def list_spec?(type_spec_precond) do
{type_spec, _precond} = TypeSpec.split_spec_precond(type_spec_precond)
case type_spec... | lib/domo/type_ensurer_factory/generator/match_fun_registry/lists.ex | 0.602763 | 0.416352 | lists.ex | starcoder |
defmodule ExAws do
@moduledoc """
Module for making and processing AWS request
"""
use Application
@behaviour ExAws.Behaviour
@doc """
Perform an AWS request
First build an operation from one of the services, and then pass it to this
function to perform it.
If you want to build an operation man... | lib/ex_aws.ex | 0.799912 | 0.450541 | ex_aws.ex | starcoder |
defmodule ExSieve.Builder.Where do
@moduledoc false
import Ecto.Query
alias ExSieve.Node.{Attribute, Condition, Grouping}
@true_values [1, '1', 'T', 't', true, 'true', 'TRUE', "1", "T", "t", "true", "TRUE"]
@spec build(Ecto.Queryable.t(), Grouping.t()) :: Ecto.Query.t()
def build(query, %Grouping{combina... | lib/ex_sieve/builder/where.ex | 0.719088 | 0.457137 | where.ex | starcoder |
defmodule Slack do
@moduledoc """
A client for the Slack API.
This library exports a module for each namespace on the Slack API. For each
method in that namespace, a function is exported from its parent module.
Nested namespaces are in nested modules.
When looking at the Slack API documentation, if you se... | lib/slack.ex | 0.856453 | 0.537891 | slack.ex | starcoder |
defmodule Timex.Time do
@million 1_000_000
Enum.each [usecs: @million, msecs: 1_000], fn {type, coef} ->
def to_usecs(value, unquote(type)), do: value * @million / unquote(coef)
def to_msecs(value, unquote(type)), do: value * 1000 / unquote(coef)
def to_secs(value, unquote(type)), do: value / unquote... | lib/time/time.ex | 0.50415 | 0.774669 | time.ex | starcoder |
defmodule X509.CSR do
@moduledoc """
Implements PKCS#10 Certificate Signing Requests (CSRs), formally known by
their ASN.1 type CertificationRequest.
For conversion to and from PEM or DER format, use the generic functions in
the `X509` module.
"""
import X509.ASN1
alias X509.RDNSequence
@typedoc "... | lib/x509/csr.ex | 0.891941 | 0.523968 | csr.ex | starcoder |
defmodule Axon do
@moduledoc """
A high-level interface for creating neural network models.
Axon is built entirely on top of Nx numerical definitions,
so every neural network can be JIT or AOT compiled using
any Nx compiler, or even transformed into high-level neural
network formats like TensorFlow Lite an... | lib/axon.ex | 0.946312 | 0.696694 | axon.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.