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 RallyApi.Rallyties do
@moduledoc """
This module contains shared functions for making things Rallyfied
"""
@createable_types [
allowed_attribute_value: "allowedattributevalue", attachment: "attachment",
attachment_content: "attachmentcontent", attribute_definition: "attributedefinition",
... | lib/rally_api/rallyties.ex | 0.864382 | 0.612049 | rallyties.ex | starcoder |
defmodule Okta.Apps do
@moduledoc """
The `Okta.Apps` module provides access methods to the [Okta Apps API](https://developer.okta.com/docs/reference/api/apps/).
All methods require a Tesla Client struct created with `Okta.client(base_url, api_key)`.
## Examples
```
client = Okta.Client("https://dev-0... | lib/okta/apps.ex | 0.894487 | 0.705303 | apps.ex | starcoder |
defmodule Annex.Layer.Dense do
@moduledoc """
`rows` are the number outputs and `columns` are the number of inputs.
"""
use Annex.Debug, debug: true
alias Annex.{
Data,
Data.DMatrix,
Data.List1D,
Layer.Backprop,
Layer.Dense,
LayerConfig,
Shape,
Utils
}
require Data
us... | lib/annex/layer/dense.ex | 0.916794 | 0.64058 | dense.ex | starcoder |
defmodule Trans.Translator do
@moduledoc """
Provides easy access to struct translations.
Although translations are stored in regular fields of an struct and can be accessed directly, **it
is recommended to access translations using the functions provided by this module** instead. This
functions present addi... | lib/trans/translator.ex | 0.868813 | 0.498779 | translator.ex | starcoder |
defmodule Txpost.Parsers.CBOR do
@moduledoc """
A `Plug.Parsers` module for parsing CBOR request bodies.
CBOR documents that dont decode to maps are parsed into a `"_cbor"` key to
allow param merging. An empty request body is parsed as an empty map.
## Options
All options supported by `Plug.Conn.read_bod... | lib/txpost/parsers/cbor.ex | 0.798972 | 0.458106 | cbor.ex | starcoder |
defmodule XtbClient.Connection do
use GenServer
alias XtbClient.{MainSocket, StreamingSocket, StreamingMessage}
alias XtbClient.Messages.{
Candles,
ChartLast,
ChartRange,
DateRange,
ProfitCalculation,
Quotations,
SymbolInfo,
SymbolVolume,
TickPrices,
TradeInfos,
Trade... | lib/xtb_client/connection.ex | 0.872917 | 0.69999 | connection.ex | starcoder |
defmodule Operate.Cell do
@moduledoc """
Module for working with Operate tape cells.
A cell represents a single atomic procedure call. A `t:Operate.Cell.t/0`
contains the Op script and parameters. When the cell is executed it returns a
result.
## Examples
iex> %Operate.Cell{op: "return function(sta... | lib/operate/cell.ex | 0.721449 | 0.680135 | cell.ex | starcoder |
defmodule Nebulex.Adapters.Multilevel do
@moduledoc """
Adapter module for Multi-level Cache.
This is just a simple layer on top of local or distributed cache
implementations that enables to have a cache hierarchy by levels.
Multi-level caches generally operate by checking the fastest,
level 1 (L1) cache f... | lib/nebulex/adapters/multilevel.ex | 0.882263 | 0.544559 | multilevel.ex | starcoder |
defmodule Mix.Tasks.Deps.Tree do
use Mix.Task
@shortdoc "Prints the dependency tree"
@recursive true
@moduledoc """
Prints the dependency tree.
mix deps.tree
If no dependency is given, it uses the tree defined in the `mix.exs` file.
## Command line options
* `--only` - the environment to s... | lib/mix/lib/mix/tasks/deps.tree.ex | 0.804828 | 0.459682 | deps.tree.ex | starcoder |
defmodule Parser do
use Platform.Parsing.Behaviour
# ELEMENT IoT Parser for Adeunis Field Test Device
# According to documentation provided by Adeunis
# Link: https://www.adeunis.com/en/produit/ftd-868-915-2/
# Documentation: https://www.adeunis.com/wp-content/uploads/2017/08/FTD_LoRaWAN_EU863-870_UG_FR_GB_V... | lib/adeunis_ftd.ex | 0.582966 | 0.405184 | adeunis_ftd.ex | starcoder |
defmodule Oban.Crontab.Cron do
@moduledoc false
alias Oban.Crontab.Parser
@type expression :: [:*] | list(non_neg_integer())
@type t :: %__MODULE__{
minutes: expression(),
hours: expression(),
days: expression(),
months: expression(),
weekdays: expression(),
... | lib/oban/crontab/cron.ex | 0.889051 | 0.580887 | cron.ex | starcoder |
defmodule Sippet.Transactions.Server.Invite do
@moduledoc false
use Sippet.Transactions.Server, initial_state: :proceeding
alias Sippet.Message, as: Message
alias Sippet.Message.StatusLine, as: StatusLine
alias Sippet.Transactions.Server.State, as: State
@t2 4000
@before_trying 200
@timer_g 500
@ti... | lib/sippet/transactions/server/invite.ex | 0.601125 | 0.427098 | invite.ex | starcoder |
defmodule ExAdmin.Register do
@moduledoc """
Allows registering a resource or a page to be displayed with ExAdmin.
For each model you wanted rendered by ExAdmin, use the
`register_resource` call. For each general page (like a dashboard),
use the `register_page` call.
To allow ExAdmin to manage the resourc... | lib/ex_admin/register.ex | 0.842475 | 0.467149 | register.ex | starcoder |
defmodule OT.Text.Composition do
@moduledoc """
The composition of two non-concurrent operations into a single operation.
"""
alias OT.Text.{Operation, Scanner}
@doc """
Compose two operations into a single equivalent operation.
The operations are composed in such a way that the resulting operation has... | lib/ot/text/composition.ex | 0.814164 | 0.70202 | composition.ex | starcoder |
defmodule NeuralNet.Backprop do
@moduledoc """
This module provides the code that generates the feedforward and backprop data used for training. `get_feedforward` can also be used for normal network evaluation, and is used by `NeuralNet.eval`.
`get_feedforward` returns {output, time_frames}, where output is vecto... | lib/neural_net/backprop.ex | 0.920727 | 0.733309 | backprop.ex | starcoder |
defmodule EIP1559 do
@behaviour Cadex.Behaviour
alias Cadex.Types.{State, SimulationParameters, PartialStateUpdateBlock}
@timesteps 300
@constants %{
BASEFEE_MAX_CHANGE_DENOMINATOR: 8,
TARGET_GAS_USED: 10000000,
MAX_GAS_EIP1559: 16000000,
EIP1559_DECAY_RANGE: 800000,
EIP1559_GAS_INCREMENT_A... | lib/examples/eip1559.ex | 0.689515 | 0.414869 | eip1559.ex | starcoder |
defmodule AWS.WAFV2 do
@moduledoc """
This is the latest version of the **AWS WAF** API, released in November, 2019.
The names of the entities that you use to access this API, like endpoints and
namespaces, all have the versioning information added, like "V2" or "v2", to
distinguish from the prior version. ... | lib/aws/generated/waf_v2.ex | 0.912632 | 0.471588 | waf_v2.ex | starcoder |
defmodule MrRoboto.Warden do
@moduledoc """
The Warden is responsible for coordinating the retrieval, parsing and checking
of `robots.txt` files.
It maintains a map of hosts checked and the rules for those hosts. When asked
it will retrieve the rule in question and check to see if the specified
`user-agen... | lib/mr_roboto/warden.ex | 0.803637 | 0.802246 | warden.ex | starcoder |
defmodule ApiWeb.SwaggerHelpers do
@moduledoc """
Collect commonly used parameters for the Swagger documentation generation
using PhoenixSwagger.
https://github.com/xerions/phoenix_swagger
"""
alias PhoenixSwagger.{JsonApi, Path, Schema}
@sort_types ~w(ascending descending)s
def comma_separated_list, ... | apps/api_web/lib/api_web/swagger_helpers.ex | 0.867738 | 0.463262 | swagger_helpers.ex | starcoder |
defmodule Coxir.Struct.Integration do
@moduledoc """
Defines methods used to interact with guild integrations.
Refer to [this](https://discord.com/developers/docs/resources/guild#integration-object)
for a list of fields and a broader documentation.
"""
@type integration :: String.t | map
use Coxir.Struc... | lib/coxir/struct/integration.ex | 0.855881 | 0.593256 | integration.ex | starcoder |
defmodule JWT do
@moduledoc """
Encode claims for transmission as a JSON object that is used as the payload of a JSON Web
Signature (JWS) structure, enabling the claims to be integrity protected with a Message
Authentication Code (MAC), to be later verified
see http://tools.ietf.org/html/rfc7519
"""
ali... | lib/jwt.ex | 0.86501 | 0.605274 | jwt.ex | starcoder |
defmodule Ecto.Query.WindowAPI do
@moduledoc """
Lists all windows functions.
Windows functions must always be used as the first argument
of `over/2` where the second argument is the name of an window:
from e in Employee,
select: {e.depname, e.empno, e.salary, over(avg(e.salary), :depart... | deps/ecto/lib/ecto/query/window_api.ex | 0.876019 | 0.577704 | window_api.ex | starcoder |
defmodule ExZample.DSL do
@moduledoc """
Defines a domain-speficic language(DSL) to simplify the creation of your
factories.
You can use this DSL by using by defining a module and adding the `use`
directive. For example:
defmodule MyApp.Factories do
use ExZample.DSL
alias MyApp.User
... | lib/ex_zample/dsl/dsl.ex | 0.906033 | 0.501831 | dsl.ex | starcoder |
defmodule Distillery.Releases.Shell do
@moduledoc """
This module provides conveniences for writing output to the shell.
"""
use Distillery.Releases.Shell.Macros
@type verbosity :: :silent | :quiet | :normal | :verbose
# The order of these levels is from least important to most important
# When comparing... | lib/distillery/releases/shell.ex | 0.820829 | 0.519399 | shell.ex | starcoder |
defmodule Ecto.Adapter do
@moduledoc """
This module specifies the adapter API that an adapter is required to
implement.
"""
use Behaviour
@type t :: module
@type source :: binary
@type fields :: Keyword.t
@type filters :: Keyword.t
@type returning :: [atom]
@type autogenerate_id :: {field :: at... | lib/ecto/adapter.ex | 0.909285 | 0.466299 | adapter.ex | starcoder |
defmodule Membrane.Element.WithOutputPads do
@moduledoc """
Module defining behaviour for source and filter elements.
When used declares behaviour implementation, provides default callback definitions
and imports macros.
For more information on implementing elements, see `Membrane.Element.Base`.
"""
al... | lib/membrane/element/with_output_pads.ex | 0.850918 | 0.510985 | with_output_pads.ex | starcoder |
defmodule Forth do
@moduledoc """
Implements a simple Forth evaluator
"""
@default_dict %{
"dup" => [stackop: :dup],
"drop" => [stackop: :drop],
"swap" => [stackop: :swap],
"over" => [stackop: :over]
}
defstruct [stack: [], dict: @default_dict, startdef: false]
@type t :: %Forth{stack: ... | lib/forth.ex | 0.773644 | 0.65971 | forth.ex | starcoder |
defmodule Resty.Connection.HTTPoison do
alias Resty.Request
@moduledoc """
Default `Resty.Connection` implementation. It will use `HTTPoison` in order
to query the web API.
## Params
All the parameters will be sent to HTTPoison as the `options` you can know
more about the supported options here: `HTTPo... | lib/resty/connection/httpoison.ex | 0.822368 | 0.453927 | httpoison.ex | starcoder |
defmodule RethinkDB.Pseudotypes do
@moduledoc false
defmodule Binary do
@moduledoc false
defstruct data: nil
def parse(%{"$reql_type$" => "BINARY", "data" => data}, opts) do
case Dict.get(opts, :binary_format) do
:raw ->
%__MODULE__{data: data}
_ ->
:base64.dec... | lib/rethinkdb/pseudotypes.ex | 0.601711 | 0.550305 | pseudotypes.ex | starcoder |
defmodule Liquex.Parser.Tag.Iteration do
@moduledoc false
import NimbleParsec
alias Liquex.Parser.Argument
alias Liquex.Parser.Field
alias Liquex.Parser.Literal
alias Liquex.Parser.Tag
alias Liquex.Parser.Tag.ControlFlow
@spec for_expression(NimbleParsec.t()) :: NimbleParsec.t()
def for_expression(... | lib/liquex/parser/tag/iteration.ex | 0.736211 | 0.494995 | iteration.ex | starcoder |
defmodule Geometry.MultiPoint do
@moduledoc """
A set of points from type `Geometry.Point`.
`MultiPoint` implements the protocols `Enumerable` and `Collectable`.
## Examples
iex> Enum.map(
...> MultiPoint.new([
...> Point.new(1, 2),
...> Point.new(3, 4)
...> ]),
... | lib/geometry/multi_point.ex | 0.962081 | 0.83622 | multi_point.ex | starcoder |
defmodule Aeutil.TypeToTag do
@moduledoc """
Conversion from structure types to numeric tags for RLP encoding and reverse.
"""
@spec tag_to_type(non_neg_integer()) :: {:ok, atom()} | {:error, String.t()}
def tag_to_type(10), do: {:ok, Aecore.Account.Account}
def tag_to_type(11), do: {:ok, Aecore.Tx.SignedT... | apps/aeutil/lib/type_to_tag.ex | 0.811078 | 0.434401 | type_to_tag.ex | starcoder |
defmodule Strava.Activity do
@moduledoc """
Activities are the base object for Strava runs, rides, swims etc.
More info: https://strava.github.io/api/v3/activities/
"""
import Strava.Util, only: [parse_date: 1]
@type t :: %__MODULE__{
id: integer,
resource_state: integer,
external_id: String.... | lib/strava/activity.ex | 0.841468 | 0.459076 | activity.ex | starcoder |
defmodule Bincode.TestUtils do
@moduledoc """
Utilities to remove boilerplate in tests
"""
defmacro test_serialization(input, output, type, opts \\ []) do
quote do
test "#{inspect(unquote(type))} serialization (#{inspect(unquote(input))})" do
assert {:ok, serialized} = Bincode.serialize(unquot... | test/support/utils.ex | 0.752559 | 0.803019 | utils.ex | starcoder |
defmodule Rondo.Action.Store do
defstruct [affordances: %{},
actions: %{},
validators: %{},
prev_affordances: %{}]
@app_validator Application.get_env(:rondo, :validator, Rondo.Validator.Default)
alias Rondo.Action.Handler
def init(store = %{affordances: affordances}) do... | lib/rondo/action/store.ex | 0.641422 | 0.442396 | store.ex | starcoder |
defmodule ConfluentSchemaRegistry do
@moduledoc """
Elixir client for [Confluent Schema Registry](https://docs.confluent.io/current/schema-registry/)
[API](https://docs.confluent.io/current/schema-registry/develop/api.html).
"""
# Argument types
@type id :: pos_integer
@type schema :: binary
@type subj... | lib/confluent_schema_registry.ex | 0.841631 | 0.423816 | confluent_schema_registry.ex | starcoder |
defmodule Intcode do
require Logger
@doc """
An Intcode program is a list of integers separated by commas (like 1,0,0,3,99).
To run one, start by looking at the first integer (called position 0).
Here, you will find an opcode - either 1, 2, or 99. The opcode indicates
what to do; for example, 99 mea... | lib/intcode.ex | 0.775817 | 0.557875 | intcode.ex | starcoder |
defmodule NLTEx.WordVectors.GloVe do
@moduledoc ~S"""
Provides interface to retrieve and preprocess GloVe word vectors.
<NAME>, <NAME>, and <NAME>. 2014.
_GloVe: Global Vectors for Word Representation._
https://nlp.stanford.edu/projects/glove/
"""
@canonical_base_url "http://nlp.stanford.edu/data/"... | lib/nlt_ex/word_vectors/glove.ex | 0.545286 | 0.581184 | glove.ex | starcoder |
defmodule GoogleMaps.Geocode do
@moduledoc """
Perform geocoding-related lookups against the Google Maps API.
"""
use RepoCache, ttl: :timer.hours(24)
alias LocationService.Result
alias GoogleMaps.Geocode.Input
require Logger
@bounds %{
east: 41.3193,
north: -71.9380,
west: 42.8266,
so... | apps/location_service/lib/google_maps/geocode.ex | 0.830285 | 0.529811 | geocode.ex | starcoder |
defmodule Coxir.Struct.Channel do
@moduledoc """
Defines methods used to interact with Discord channels.
Refer to [this](https://discordapp.com/developers/docs/resources/channel#channel-object)
for a list of fields and a broader documentation.
In addition, the following fields are also embedded.
- `owner`... | lib/coxir/struct/channel.ex | 0.933877 | 0.489626 | channel.ex | starcoder |
defmodule Mongo do
@moduledoc """
The main entry point for doing queries. All functions take a pool to
run the query on.
## Read options
All read operations that returns a cursor take the following options
for controlling the behaviour of the cursor.
* `:batch_size` - Number of documents to fetch in ... | lib/mongo.ex | 0.911108 | 0.664935 | mongo.ex | starcoder |
defmodule Softmax.Distributed do
@master_rank 0
@world_size 6
def start(rank, list) do
name = String.to_atom("node_#{inspect(rank)}")
Process.register(self(), name)
send({:orchestrator, node()}, {:alive, rank})
wait_for_nodes()
node_normalization(list, rank)
end
def wait_for_nodes() do
... | lib/distributed_softmax.ex | 0.532911 | 0.491639 | distributed_softmax.ex | starcoder |
defmodule McamServerWeb.CameraLiveHelper do
@moduledoc """
Helper functions for `McamServerWeb.CameraLive`
"""
import Phoenix.LiveView.Utils, only: [assign: 3]
alias McamServer.{Accounts, Cameras, Cameras.Camera, Subscriptions}
alias Phoenix.LiveView.Socket
@doc """
Extract the camera from the list o... | apps/mcam_server_web/lib/mcam_server_web/live/camera/camera_live_helper.ex | 0.858467 | 0.517327 | camera_live_helper.ex | starcoder |
defmodule Speedtest.Result do
import Speedtest.Decoder
alias Speedtest.Result
@default_key "<KEY>"
@moduledoc """
A speedtest result.
"""
defstruct download: nil,
upload: nil,
ping: nil,
server: nil,
client: nil,
timestamp: nil,
b... | lib/result.ex | 0.68742 | 0.448185 | result.ex | starcoder |
defmodule Terminus.Bitsocket do
@moduledoc """
Module for interfacing with the [Bitsocket](https://bitsocket.network) API.
Bitsocket sends you realtime events from the Bitcoin blockchain. It uses
[Server Sent Events](https://en.wikipedia.org/wiki/Server-sent_events) to
stream new **unconfirmed** transactions... | lib/terminus/bitsocket.ex | 0.90774 | 0.869548 | bitsocket.ex | starcoder |
defmodule Edeliver.Relup.Instructions.FinishRunningRequests do
@moduledoc """
Notify request processes that a release upgrade starts.
This upgrade instruction waits a short time until current
requests finished and notifies the remaining, that a
code upgrade will appear. If a `phoenix` version is used
... | lib/edeliver/relup/instructions/finish_running_requests.ex | 0.711631 | 0.414573 | finish_running_requests.ex | starcoder |
defmodule Cluster.Strategy.ErlangHosts do
@moduledoc """
This clustering strategy relies on Erlang's built-in distribution protocol by
using a `.hosts.erlang` file (as used by the `:net_adm` module).
Please see [the net_adm docs](http://erlang.org/doc/man/net_adm.html) for more details.
In short, the follow... | lib/strategy/erlang_hosts.ex | 0.811639 | 0.783077 | erlang_hosts.ex | starcoder |
defmodule Membrane.RTSP.Request do
@moduledoc """
This module represents a RTSP 1.0 request.
"""
@enforce_keys [:method]
defstruct @enforce_keys ++ [:path, headers: [], body: ""]
@type t :: %__MODULE__{
method: binary(),
body: binary(),
headers: Membrane.RTSP.headers(),
... | lib/membrane_rtsp/request.ex | 0.876931 | 0.643616 | request.ex | starcoder |
defmodule BSV.Contract do
@moduledoc """
A behaviour module for implementing Bitcoin transaction contracts.
A Bitcoin transaction contains two sides: inputs and outputs.
Transaction outputs are script puzzles, called "locking scripts" (sometimes
also known as a "ScriptPubKey") which lock a number of satoshi... | lib/bsv/contract.ex | 0.911643 | 0.645679 | contract.ex | starcoder |
defmodule RedisGraph.Edge do
@moduledoc """
An Edge component relating two Nodes in a Graph.
Edges must have a source node and destination node, describing a relationship
between two entities in a Graph. The nodes must exist in the Graph in order
for the edge to be added.
Edges must have a relation which ... | lib/redis_graph/edge.ex | 0.922639 | 0.714155 | edge.ex | starcoder |
defmodule Iyzico.Card do
@moduledoc """
A module representing cards used in monetary transactions.
"""
@enforce_keys ~w(holder_name number exp_year exp_month)a
defstruct [
:holder_name,
:number,
:exp_year,
:exp_month,
:cvc,
:registration_alias,
]
@typedoc """
Represents type o... | lib/model/card.ex | 0.919072 | 0.58166 | card.ex | starcoder |
defmodule Reach.Game do
@type t :: %{optional(String.t) => %Reach.Team{}}
def start_link() do
Agent.start_link(fn ->
Map.new
|> Map.put("shiani", Reach.Team.new("shiani"))
|> Map.put("tano", Reach.Team.new("tano"))
end, name: __MODULE__)
end
@doc """
Gets the current game state... | lib/reach/game.ex | 0.652352 | 0.416203 | game.ex | starcoder |
defmodule XtbClient.Messages.Candle do
alias XtbClient.Messages.QuoteId
@moduledoc """
Info representing aggregated price & volume values for candle.
Default interval for one candle is one minute.
## Parameters
- `open` open price in base currency,
- `high` highest value in the given period in base... | lib/xtb_client/messages/candle.ex | 0.854475 | 0.434641 | candle.ex | starcoder |
defmodule LiveViewExamples.Tabs.Home do
import LiveViewExamples.Format
@top_attributes [:memory, :reductions]
def collect(%{
stats: %{
io: io_stats,
gc: gc_stats,
schedulers: schedulers
} = stats,
settings: _
} = state) do
put_in(state[:stats], Map.merge(stats, base_stats()))... | lib/live_view_examples/tabs/home.ex | 0.588061 | 0.40539 | home.ex | starcoder |
defmodule Rummage.Ecto.Hook.Sort do
@moduledoc """
`Rummage.Ecto.Hook.Sort` is the default sort hook that comes with
`Rummage.Ecto`.
This module provides a operations that can add sorting functionality to
a pipeline of `Ecto` queries. This module works by taking the `field` that should
be used to `order_by... | lib/rummage_ecto/hooks/sort.ex | 0.816589 | 0.946547 | sort.ex | starcoder |
defmodule Garlic.Crypto.Ed25519 do
@moduledoc """
Hand-crafted Ed25519 primitives and public key blinding
"""
use Bitwise
import Integer, only: [mod: 2]
@t254 0x4000000000000000000000000000000000000000000000000000000000000000
@p 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFED
@d -... | lib/garlic/crypto/ed25519.ex | 0.757525 | 0.439507 | ed25519.ex | starcoder |
defmodule Snitch.Data.Model.TaxRate do
@moduledoc """
Exposes APIs for tax rate CRUD.
"""
use Snitch.Data.Model
alias Snitch.Data.Schema.TaxRate
@doc """
Creates a tax rate for the supplied params.
Expects the following keys in the `params`:
- `*name`: Name of the tax rate.
- `*tax_zone_id`: id o... | apps/snitch_core/lib/core/data/model/tax/tax_rate.ex | 0.878581 | 0.867317 | tax_rate.ex | starcoder |
defmodule GymAgent do
@moduledoc false
alias GymAgent.Experience
@batch_size 10
@history_size_min 100
@history_size_max 10_000
defstruct num_actions: 0, num_states: 0, gamma: 0.99, eps: 0.25, eps_decay: 0.99, learner: nil, fit: false, trained: false, history: nil, s: nil, a: nil
def new(opts \\ []) do... | lib/gym_agent.ex | 0.723505 | 0.53279 | gym_agent.ex | starcoder |
defmodule RDF.Star.Quad do
@moduledoc """
Helper functions for RDF-star quads.
An RDF-star quad is represented as a plain Elixir tuple consisting of four valid
RDF values for subject, predicate, object and a graph name.
As opposed to an `RDF.Quad` the subject or object can be a triple.
"""
alias RDF.Sta... | lib/rdf/star/quad.ex | 0.88761 | 0.62342 | quad.ex | starcoder |
defmodule Absinthe.Fixtures.ContactSchema do
use Absinthe.Schema
use Absinthe.Fixture
@bruce %{name: "Bruce", age: 35}
@others [
%{name: "Joe", age: 21},
%{name: "Jill", age: 43}
]
@business %{name: "Someplace", employee_count: 11}
query do
field :person,
type: :person,
resolve: ... | test/support/fixtures/contact_schema.ex | 0.628179 | 0.404243 | contact_schema.ex | starcoder |
defmodule TicTacToe.Board do
@moduledoc false
alias TicTacToe.Board
defstruct [
:player_1,
:player_2,
:tiles,
:scale
]
@doc """
Inits a board with given scale and player tiles
"""
def init(scale, p1 \\ :X, p2 \\ :O) do
%Board{
player_1: p1,
player_2: p2,
tiles: ... | lib/tic_tac_toe/board.ex | 0.877588 | 0.745398 | board.ex | starcoder |
defmodule Neuron do
defstruct id: nil,
cx_id: nil,
af: nil,
input_idps: [],
output_ids: []
def gen(exoself_pid) do
spawn_link fn -> loop(exoself_pid) end
end
def loop(exoself_pid) do
'''
Standby for initialization order from exoself
'''
re... | lib/neuron.ex | 0.620852 | 0.528777 | neuron.ex | starcoder |
defmodule RoboticaUi.Components.Nav do
@moduledoc false
use Scenic.Component
alias Scenic.Cache.Static.Texture
alias Scenic.Graph
import Scenic.Primitives
import Scenic.Clock.Components
def verify(tab) when is_atom(tab), do: {:ok, tab}
def verify(_), do: :invalid_data
# build the path to the stat... | robotica_ui/lib/components/nav.ex | 0.711732 | 0.48438 | nav.ex | starcoder |
defmodule Moeda do
@moduledoc """
Este módulo possui listas com informações sobre as moedas.
A lista está em compliance com o ISO 4217.
Acesse https://pt.wikipedia.org/wiki/ISO_4217 para saber mais.
"""
@doc """
Lista as informações das moedas.
## Exemplo
iex> Moeda.moeda_info[:AED].peso
2
iex... | lib/financeiro/moeda.ex | 0.631026 | 0.422028 | moeda.ex | starcoder |
defmodule Etherscan.API.Accounts do
@moduledoc """
Module to wrap Etherscan account endpoints.
[Etherscan API Documentation](https://etherscan.io/apis#accounts)
"""
use Etherscan.API
use Etherscan.Constants
alias Etherscan.{MinedBlock, MinedUncle, Transaction, InternalTransaction}
@account_transactio... | lib/etherscan/api/accounts.ex | 0.926976 | 0.444022 | accounts.ex | starcoder |
defmodule Appsignal.TransactionRegistry do
@moduledoc """
Internal module which keeps a registry of the transaction handles
linked to their originating process.
This is used on various places to link a calling process to its transaction.
For instance, the `Appsignal.ErrorHandler` module uses it to be able t... | lib/appsignal/transaction/registry.ex | 0.839356 | 0.546678 | registry.ex | starcoder |
defmodule KaufmannEx.Config do
@moduledoc """
Convenience Getters for pulling config.exs values
A config.exs may look like
```
# test env
config :kaufmann_ex,
consumer_group: System.get_env("CONSUMER_GROUP"),
default_topic: System.get_env("KAFKA_TOPIC"),
event_handler_demand: 50,
event_hand... | lib/config.ex | 0.766294 | 0.429549 | config.ex | starcoder |
defmodule Canvas do
@colour_to_ansi_fn %{
black: &IO.ANSI.black_background/0,
blue: &IO.ANSI.blue_background/0,
cyan: &IO.ANSI.cyan_background/0,
green: &IO.ANSI.green_background/0,
light_black: &IO.ANSI.light_black_background/0,
light_blue: &IO.ANSI.light_blue_background/0,
light_cyan: &I... | elixir/lib/canvas.ex | 0.756358 | 0.422117 | canvas.ex | starcoder |
defmodule LessVerifiesAlexa.Plug do
@moduledoc """
`LessVerifiesAlexa.Plug` is a plug that validates requests that
Amazon's Alexa service sends.
Add the plug to your router like this:
```
plug LessVerifiesAlexa.Plug, application_id: "your_app_id"
```
In order for the plug to work, there's an additiona... | lib/less_verifies_alexa/plug.ex | 0.685002 | 0.746878 | plug.ex | starcoder |
defmodule RubberBand.Client.Codec do
@moduledoc false
alias RubberBand.Client.CodecError
alias RubberBand.Client.Config
@doc """
Decodes data using the JSON codec from the given config.
"""
@spec decode(Config.t(), String.t(), any) ::
{:ok, any} | {:error, CodecError.t()}
def decode(config, ... | lib/rubber_band/client/codec.ex | 0.878796 | 0.400955 | codec.ex | starcoder |
defmodule GeoTIFF do
@doc ~S"""
Reads the headers of a GeoTIFF file.
### Examples:
iex> filename = "./test/resources/example_ii.tif"
iex> {:ok, response} = GeoTIFF.read_headers(filename)
iex> response.first_ifd_offset
270_276
iex> ifd = Enum.at response.ifds, 0
iex> Enum.at ifd.tags, 2
... | lib/geotiff.ex | 0.589953 | 0.437343 | geotiff.ex | starcoder |
defmodule Bertex do
@moduledoc """
This is a work TOTALLY based on @mojombo and @eproxus work:
More at: https://github.com/eproxus/bert.erl and http://github.com/mojombo/bert.erl
"""
import :erlang, only: [binary_to_term: 1,
binary_to_term: 2,
term_to_binary: ... | lib/bertex.ex | 0.736401 | 0.51379 | bertex.ex | starcoder |
defmodule Broadway.Options do
@moduledoc false
@basic_types [
:any,
:keyword_list,
:non_empty_keyword_list,
:atom,
:non_neg_integer,
:pos_integer,
:mfa,
:mod_arg
]
def validate(opts, spec) do
case validate_unknown_options(opts, spec) do
:ok -> validate_options(spec, o... | lib/broadway/options.ex | 0.626467 | 0.446374 | options.ex | starcoder |
defmodule PokerHands.DealtHand do
defstruct cards: [],
grouped_card_values: []
alias PokerHands.Card
@doc """
## Examples
iex> PokerHands.DealtHand.init("2H 4S 2S AH")
%PokerHands.DealtHand{
cards: [
%PokerHands.Card{value: "A", suit: "H", int_value: 14},
%... | lib/poker_hands/dealt_hand.ex | 0.617282 | 0.449151 | dealt_hand.ex | starcoder |
defmodule Chunky.Sequence.OEIS.Combinatorics do
@moduledoc """
Sequences from the [Online Encyclopedia of Integer Sequences](https://oeis.org) dealing with combinatorics, set
manipulations, and permutations.
## Available Sequences
### Catalan Numbers
Via [Catalan Number - Wikipedia](https://en.wikiped... | lib/sequence/oeis/combinatorics.ex | 0.86757 | 0.804866 | combinatorics.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.935744 | 0.698368 | time.ex | starcoder |
defmodule ResxCSV.Encoder do
@moduledoc """
Encode data resources into strings of CSV.
### Media Types
Only `x.erlang.native` types are valid. This can either be a subtype or suffix.
Valid: `application/x.erlang.native`, `application/geo+x.erlang.native`.
If an error is being return... | lib/resx_csv/encoder.ex | 0.910124 | 0.498962 | encoder.ex | starcoder |
defmodule Journey do
@moduledoc """
Represents a schedule at a stop (origin or destination) or a pair of stops (origin and destination)
"""
alias Predictions.Prediction
alias Schedules.{Schedule, Trip}
defstruct [:departure, :arrival, :trip]
@type t :: %__MODULE__{
departure: PredictedSchedule... | apps/site/lib/journey.ex | 0.893417 | 0.689021 | journey.ex | starcoder |
defmodule Hangman.Application do
use Application
@moduledoc """
Main `Hangman` application.
From `Wikipedia`
`Hangman` is a paper and pencil guessing game for two or more players.
One player thinks of a word, phrase or sentence and the other tries
to guess it by suggesting letters or numbers, withi... | lib/hangman.ex | 0.705278 | 0.722967 | hangman.ex | starcoder |
defmodule Zoneinfo do
@moduledoc """
Elixir time zone support for your OS-supplied time zone database
Tell Elixir to use this as the default time zone database by running:
```elixir
Calendar.put_time_zone_database(Zoneinfo.TimeZoneDatabase)
```
Time zone data is loaded from the path returned by `tzpath... | lib/zoneinfo.ex | 0.759404 | 0.61086 | zoneinfo.ex | starcoder |
defmodule Easypost.Address do
alias Easypost.Requester
defstruct [
id: "",
object: "Address",
street1: "",
street2: "",
city: "",
state: "",
zip: "",
country: "",
name: "",
company: "",
phone: "",
email: "",
residential: false,
created_at: "",
updated_at:... | lib/Easypost/address.ex | 0.601594 | 0.418429 | address.ex | starcoder |
defmodule Peach do
@moduledoc """
Peach provides fuzzy matching as well as tools for preprocessing text
## Example
iex> "hɘllo🧐 " |> Peach.pre_process |> Peach.levenshtein_distance("hello")
1
"""
@doc """
Normalize text
Unicode NFKC (Normalisation Form Compatibility Composition) normalisation... | lib/peach.ex | 0.798069 | 0.406509 | peach.ex | starcoder |
defmodule Elasr.KategorijaController do
use Elasr.Web, :controller
alias Elasr.Kategorija
def index(conn, _params) do
kategorije = Repo.all(Kategorija)
render(conn, "index.html", kategorije: kategorije)
end
def new(conn, _params) do
changeset = Kategorija.changeset(%Kategorija{})
render(con... | web/controllers/kategorija_controller.ex | 0.614163 | 0.489992 | kategorija_controller.ex | starcoder |
defmodule XPlane.Data do
@moduledoc """
Get and set X-Plane data.
"""
@startup_grace_period 1100
@listen_port 59000
use GenServer
# API
@doc """
Start GenServer to exchange data references with a specific X-Plane
instance.
## Parameters
- instance: X-Plane instance fro... | lib/xplane_data.ex | 0.822474 | 0.742958 | xplane_data.ex | starcoder |
defmodule PassiveSupport.PostBody do
@moduledoc """
Functions for working with `www-form-urlencoded` data
"""
@doc ~s"""
Deep-parses the map into a string formatted according to the `www-form-urlencoded` spec.
## Examples
iex> form_encoded(%{
...> "success_url" => "https://localhost:4001/fo... | lib/passive_support/ext/post_body.ex | 0.627495 | 0.435601 | post_body.ex | starcoder |
defmodule CollectableUtils do
@doc """
Routes an Enumerable into Collectables based on a `key_fun`.
This function is essentially a cross between `Enum.into/2` and `Enum.group_by/2`. Rather than
the simple lists of `Enum.group_by/2`, `into_by/3` populates a set of Collectables.
Like `Enum.group_by/2`, the ca... | lib/collectable_utils.ex | 0.857515 | 0.699139 | collectable_utils.ex | starcoder |
defmodule Moon do
# values for 2010 epoch
@sun_ecliptic_longitude 4.8791937
@sun_ecliptic_longitude_perigee 4.9412442
@sun_orbit_eccentricity 0.016_705
@mean_longitude_epoch 1.6044696 # radians
@mean_longitude_perigee 2.2714252 # radians
@mean_longitude_ascending_node_epoch 5.0908208 # radians
@incli... | lib/moon.ex | 0.620047 | 0.580055 | moon.ex | starcoder |
defmodule Crow.Plugin do
@moduledoc """
The behaviour all configured plugins should implement.
## Overview
Writing [Munin plugins](http://guide.munin-monitoring.org/en/latest/plugin/index.html)
is rather simple. A trivial plugin with the default
Munin node setup is a script with two main behaviours:
- ... | lib/crow/plugin.ex | 0.874252 | 0.571677 | plugin.ex | starcoder |
defmodule Tanks.Game.Cache.Position do
alias Tanks.Game.Components.Position
alias Tanks.Game.Components.Size
@component_types [Position, Size]
def component_types, do: @component_types
@initial_state []
def initial_state, do: @initial_state
@doc """
Rebuilds the cache.
"""
def update(game_id) do
... | lib/tanks/game/cache/position.ex | 0.609757 | 0.407746 | position.ex | starcoder |
defmodule Cast do
require IEx
defmodule Foo do
def head([h | _ ]) do
h
end
end
defmodule BadArgumentError do
defexception message: "Cast function couldn't process this argument tuple",
value: nil,
left_type: nil,
right_type: nil
def new(... | elixir_port/lib/cast.ex | 0.594904 | 0.448064 | cast.ex | starcoder |
defmodule Surface do
@moduledoc """
Surface is component based library for **Phoenix LiveView**.
Built on top of the new `Phoenix.LiveComponent` API, Surface provides
a more declarative way to express and use components in Phoenix.
A work-in-progress live demo with more details can be found at [surface-demo... | lib/surface.ex | 0.865437 | 0.622832 | surface.ex | starcoder |
defmodule Ecto.Adapter do
@moduledoc """
Specifies the API required from adapters.
"""
@type t :: module
@typedoc "The metadata returned by the adapter init/1"
@type adapter_meta :: term
@typedoc "Ecto.Query metadata fields (stored in cache)"
@type query_meta :: %{sources: tuple, preloads: term, sele... | lib/ecto/adapter.ex | 0.908092 | 0.400925 | adapter.ex | starcoder |
defprotocol Enumerable do
@moduledoc """
Enumerable protocol used by `Enum` and `Stream` modules.
When you invoke a function in the `Enum` module, the first argument
is usually a collection that must implement this protocol.
For example, the expression:
Enum.map([1, 2, 3], &(&1 * 2))
invokes `Enume... | lib/elixir/lib/enum.ex | 0.947381 | 0.830285 | enum.ex | starcoder |
defmodule IVCU.Converter.CMD do
@moduledoc """
Provides a helper to generate a [converter](`IVCU.Converter`) that
uses any cmd converter for files (`convert` binary from
[imagemagick](https://imagemagick.org/) in example).
## Usage
To use the converter you need to define a module.
defmodule MyApp.I... | lib/ivcu/converter/cmd.ex | 0.829665 | 0.527377 | cmd.ex | starcoder |
defmodule ChatApi.SlackAuthorizations do
@moduledoc """
The SlackAuthorizations context.
"""
import Ecto.Query, warn: false
alias ChatApi.Repo
alias ChatApi.SlackAuthorizations.SlackAuthorization
@spec list_slack_authorizations(map()) :: [SlackAuthorization.t()]
def list_slack_authorizations(filters ... | lib/chat_api/slack_authorizations.ex | 0.707708 | 0.4831 | slack_authorizations.ex | starcoder |
defmodule Nebulex.Adapter do
@moduledoc """
This module specifies the adapter API that a Cache adapter is required to
implement.
"""
@type t :: module
@typedoc """
The metadata returned by the adapter `c:init/1`.
It must be a map and Nebulex itself will always inject two keys into the meta:
* `:... | lib/nebulex/adapter.ex | 0.896654 | 0.521593 | adapter.ex | starcoder |
defmodule Tirexs.ElasticSearch do
@doc """
This module provides a simple convenience for connection options such as `port`, `uri`, `user`, `pass`
and functions for doing a `HTTP` request to `ElasticSearch` engine directly.
"""
require Record
Record.defrecord :record_config, [port: 9200, uri: "127.0.0.1"... | lib/tirexs/elastic_search.ex | 0.521959 | 0.401717 | elastic_search.ex | starcoder |
defmodule Swarm.IntervalTreeClock do
@moduledoc """
This is an implementation of an Interval Clock Tree, ported from
the implementation in Erlang written by <NAME> <<EMAIL>>
found [here](https://github.com/ricardobcl/Interval-Tree-Clocks/blob/master/erlang/itc.erl).
"""
use Bitwise
import Kernel, except: ... | lib/swarm/tracker/crdt.ex | 0.882124 | 0.671464 | crdt.ex | starcoder |
defmodule EmailEx.RFC2822 do
@moduledoc """
E-mail parser and validation according to rfc-2822.
"""
use Combine
@expected_address_error "Expected address."
@atext ~r/[\!\#\$\%\&\*\+\-\/\=\?\^\_\`\|\{\}\~\'x[:alpha:][:digit:]]/
defp no_ws_ctl(x),
do: (x >= 1 and x < 9) or (x > 10 and x < 13) or (x >... | lib/email_rfc2822.ex | 0.753648 | 0.448064 | email_rfc2822.ex | starcoder |
defmodule Uinta.Formatter do
@moduledoc """
The Uinta Formatter will wrap normal log statements in a JSON object. The log
level, timestamp, and metadata will all be attached to it as parts of the
object.
The formatter can also format stuctured log messages. When a JSON string is
received for formatting, it... | lib/uinta/formatter.ex | 0.756268 | 0.845305 | formatter.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.