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 ExPropriate.MarkedFunctions do @moduledoc """ This module handles expropriation of function-level granularity. It can be set up like this: ```elixir defmodule MyModule do use ExPropriate # Function becomes public @expropriate true defp expropriated_function, do: :am_expropri...
lib/ex_propriate/marked_functions.ex
0.813498
0.802285
marked_functions.ex
starcoder
defmodule GGity.Scale.Y.Continuous do @moduledoc false alias GGity.Scale.Y @base_axis_intervals [0.1, 0.2, 0.25, 0.4, 0.5, 0.75, 1.0, 2.0, 2.5, 4.0, 5.0, 7.5, 10] @type t() :: %__MODULE__{} @type mapping() :: map() defstruct width: 200, breaks: 5, labels: :waivers, ti...
lib/ggity/scale/y_continuous.ex
0.825836
0.540985
y_continuous.ex
starcoder
defmodule Ameritrade.OAuth do use OAuth2.Strategy @defaults [ strategy: __MODULE__, site: "https://auth.tdameritrade.com", authorize_url: "https://auth.tdameritrade.com/auth", token_url: "https://api.tdameritrade.com/v1/oauth2/token" ] def client(opts \\ []) do config = Application.fetch_e...
lib/oauth.ex
0.63443
0.426441
oauth.ex
starcoder
defmodule ExUnit.ClusteredCase.Node.Manager do @moduledoc false require Logger alias ExUnit.ClusteredCaseError alias ExUnit.ClusteredCase.Utils alias ExUnit.ClusteredCase.Node.Agent, as: NodeAgent alias ExUnit.ClusteredCase.Node.Ports defstruct [ :name, :cookie, :manager_name, :agent_nam...
lib/node/manager.ex
0.719186
0.431405
manager.ex
starcoder
defmodule Coxir.API do @moduledoc """ Entry-point to the Discord REST API. """ use Tesla, only: [], docs: false alias Tesla.Env alias Coxir.{Gateway, Token} alias Coxir.API.Error @typedoc """ The options that can be passed to `perform/4`. If the `:as` option is present, the token of the given gat...
lib/coxir/api.ex
0.894876
0.439868
api.ex
starcoder
defmodule RobotSimulator do defstruct dir: nil, pos: nil @directions [:north, :east, :south, :west] defguardp is_valid_direction(dir) when dir in @directions defguardp is_valid_position(x, y) when is_number(x) and is_number(y) @doc """ Create a Robot Simulator given an initial direction and position. ...
exercism/elixir/robot-simulator/lib/robot_simulator.ex
0.899481
0.750781
robot_simulator.ex
starcoder
defmodule Day3 do def gen_grid(x, y) do zeroed_row = 0..y |> Enum.reduce([], fn _, acc -> [0 | acc] end) Enum.reduce(0..x, %{}, fn r, acc -> Map.put_new(acc, r, List.to_tuple(zeroed_row)) end) end @doc """ Over claimed inches ## Examples iex> claims = String.split("#1 @ 1,3: 4x4|#2 ...
lib/day3.ex
0.653569
0.52074
day3.ex
starcoder
defmodule Infer.Image do @moduledoc """ Image type matchers based on the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)) """ @doc """ Takes the binary file contents as arguments. Returns `true` if it's a jpeg. ## Examples iex> binary = File.read!("test/images/sample.jpg") ...
lib/matchers/image.ex
0.871734
0.464598
image.ex
starcoder
defmodule PassiveSupport.Logging do @moduledoc """ Helper functions for logging and inspecting. These functions serve two primary purposes and one subtle but kinda nice purpose: 1. To keep outputs colorized even when they're sent to Logger, 2. To keep `IO.inspect` and `Kernel.inspect` from truncating away d...
lib/passive_support/ext/logging.ex
0.73848
0.638765
logging.ex
starcoder
defmodule Membrane.AudioMixerBin do @moduledoc """ Bin element distributing a mixing job between multiple `Membrane.AudioMixer` elements. A tree of AudioMixers is created according to `max_inputs_per_node` parameter: - if number of input tracks is smaller than `max_inputs_per_node`, only one AudioMixer element...
lib/membrane_audio_mixer_bin.ex
0.865878
0.591458
membrane_audio_mixer_bin.ex
starcoder
defmodule Membrane.MP4.Container do @moduledoc """ Module for parsing and serializing MP4 files. Bases on MP4 structure specification from `#{inspect(__MODULE__)}.Schema`. """ use Bunch alias __MODULE__.{ParseHelper, Schema, SerializeHelper} @schema Schema.schema() @type box_name_t :: atom @type fi...
lib/membrane_mp4/container.ex
0.869922
0.540985
container.ex
starcoder
defmodule Saucexages.Util.Binary do @moduledoc false ## General functions for working with Elixir/Erlang binaries. @doc """ Pads a binary with the provided `padding` at the end, repeating the padding until `count` bytes is reached. If `count` is larger than the existing binary, no padding is applied. If ...
lib/saucexages/util/binary.ex
0.872293
0.704084
binary.ex
starcoder
defmodule Crux.Structs.Channel do @moduledoc """ Represents a Discord [Channel Object](https://discordapp.com/developers/docs/resources/channel#channel-object-channel-structure). List of where every property can be present: | Property | Text (0) | DM (1) | Voice (2) | Group (3) | Ca...
lib/structs/channel.ex
0.854915
0.732185
channel.ex
starcoder
defmodule Day7 do @moduledoc """ Documentation for `Day7`. """ @doc """ Hello world. """ def run() do get_input() |> process(:first) |> present() get_input() |> process(:second) |> present() end def present({n, nx, x, xx} = _answer) do IO.puts("minimum cost = #{n}, posit...
apps/day7/lib/day7.ex
0.749821
0.40342
day7.ex
starcoder
defmodule DeckhubWeb.PrimerHelpers do @moduledoc """ View helper functions for generating elements that work with [GitHub's Primer](https://primer.github.io/) CSS framework. All functions can be used either within a template or composed together in code. Each function should always emit `t:Phoenix.HTML.safe/...
lib/deckhub_web/helpers/primer_helpers.ex
0.88922
0.853425
primer_helpers.ex
starcoder
defmodule Morse do def test() do signal = '... --- ... ' decode(signal) end def decode(signal) do table = decode_table() decode(signal, table, table) end ## Fill in the empty ... spaces def decode([], _, _) do [] end def decode([?- | seq], {:node, _, left, right}, tree) do decode...
morse.ex
0.721056
0.469399
morse.ex
starcoder
defmodule Dayron do @moduledoc ~S""" Dayron is split into 2 main components: * `Dayron.Repo` - repositories are wrappers around HTTP clients. Via the repository, we can send requests to external REST APIs, performing actions to get, create, update or destroy resources. A repository needs an a...
lib/dayron.ex
0.860911
0.534491
dayron.ex
starcoder
defmodule AWS.KMS do @moduledoc """ Key Management Service Key Management Service (KMS) is an encryption and key management web service. This guide describes the KMS operations that you can call programmatically. For general information about KMS, see the [ *Key Management Service Developer Guide* ](https:...
lib/aws/generated/kms.ex
0.895788
0.615088
kms.ex
starcoder
defmodule Songmate.DataCase do @moduledoc """ This module defines the setup for tests requiring access to the application's data layer. You may define functions here to be used as helpers in your tests. Finally, if the test case interacts with the database, we enable the SQL sandbox, so changes done to ...
test/support/data_case.ex
0.790207
0.464598
data_case.ex
starcoder
defmodule Unicode.CanonicalCombiningClass do @moduledoc """ Functions to introspect Unicode canonical combining classes for binaries (Strings) and codepoints. """ @behaviour Unicode.Property.Behaviour alias Unicode.Utils @combining_classes Utils.combining_classes() |> Utils.remo...
lib/unicode/combining_class.ex
0.903419
0.58818
combining_class.ex
starcoder
defmodule Fuzzyurl do ## N.B. when this moduledoc changes, it should be copy/pasted into README.md @moduledoc ~S""" Fuzzyurl provides two related functions: non-strict parsing of URLs or URL-like strings into their component pieces (protocol, username, password, hostname, port, path, query, and fragment), and...
lib/fuzzyurl.ex
0.833392
0.4575
fuzzyurl.ex
starcoder
defmodule AdventOfCode.Solutions.Day09 do @moduledoc """ Solution for day 9 exercise. ### Exercise https://adventofcode.com/2021/day/9 """ require Logger def calculate_risk(filename) do map = filename |> File.read!() |> parse_map() result = do_calculate_risk(map) IO.puts...
lib/advent_of_code/solutions/day09.ex
0.6508
0.635293
day09.ex
starcoder
defmodule MvOpentelemetry.LiveView do use MvOpentelemetry.SpanTracer, name: :live_view, prefix: :phoenix, events: [ [:phoenix, :live_view, :mount, :start], [:phoenix, :live_view, :mount, :stop], [:phoenix, :live_view, :mount, :exception], [:phoenix, :live_view, :handle_params, :sta...
lib/mv_opentelemetry/live_view.ex
0.565299
0.418786
live_view.ex
starcoder
defmodule Commanded.Aggregates.AggregateLifespan do @moduledoc """ The `Commanded.Aggregates.AggregateLifespan` behaviour is used to control the aggregate `GenServer` process lifespan. By default an aggregate instance process will run indefinitely once started. You can change this default by implementing the...
lib/commanded/aggregates/aggregate_lifespan.ex
0.874212
0.561185
aggregate_lifespan.ex
starcoder
defmodule Bonny.Server.Scheduler do @moduledoc """ Kubernetes custom scheduler interface. Built on top of `Reconciler`. The only function that needs to be implemented is `select_node_for_pod/2`. All others defined by behaviour have default implementations. ## Examples Will schedule each unschedule pod wit...
lib/bonny/server/scheduler.ex
0.900094
0.54583
scheduler.ex
starcoder
defmodule Farmbot do @moduledoc """ Supervises the individual modules that make up the Farmbot Application. """ require Logger use Supervisor alias Farmbot.Sync.Database alias Farmbot.System.Supervisor, as: FBSYS @spec init(map) :: [{:ok, pid}] def init(%{target: target, compat_version...
lib/farmbot.ex
0.655115
0.403185
farmbot.ex
starcoder
defmodule Engine.Ethereum.RootChain.Abi do @moduledoc """ Functions that provide ethereum log decoding """ alias Engine.Ethereum.RootChain.AbiEventSelector alias Engine.Ethereum.RootChain.AbiFunctionSelector alias Engine.Ethereum.RootChain.Event alias Engine.Ethereum.RootChain.Fields alias ExPlasma.Cryp...
apps/engine/lib/engine/ethereum/root_chain/abi.ex
0.73848
0.435241
abi.ex
starcoder
defmodule Cloudevents.Format.V_0_1.Decoder.JSON do @moduledoc false @behaviour Cloudevents.Format.Decoder.JSON alias Cloudevents.Format.Decoder.DecodeError alias Cloudevents.Format.ParseError alias Cloudevents.Format.V_0_1.Event @doc """ Turns a JSON string into a Cloudevent 0.1 struct. ## Examples ...
lib/cloudevents/format/v_0_1/decoder/json.ex
0.756268
0.406656
json.ex
starcoder
defmodule Faker.Yoga.En do import Faker, only: [sampler: 2] @moduledoc """ Functions for Yoga studios, poses in English """ @spec adjective() :: String.t() sampler(:adjective, [ "Grateful", "Thankful", "Beholden", "Contented", "Gratified", "Serene", "Cheerful", "Satisfied",...
lib/faker/yoga/en.ex
0.585575
0.491517
en.ex
starcoder
defmodule Membrane.Sink do @moduledoc """ Module defining behaviour for sinks - elements consuming data. Behaviours for sinks are specified, besides this place, in modules `Membrane.Element.Base`, and `Membrane.Element.WithInputPads`. Sink elements can define only input pads. Job of a usual sink is to rec...
lib/membrane/sink.ex
0.836788
0.437944
sink.ex
starcoder
defmodule Swiss.String do @moduledoc """ A few extra functions to deal with Strings. Heavily inspired by lodash. """ @word_regex ~r/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/ @upper_word_regex ~r/(^[A-Z]+$)|[A-Z][a-z0-9]*/ @doc """ Deburrs a string from unicode to its ascii equivalent. ## Examples ...
lib/swiss/string.ex
0.780579
0.442335
string.ex
starcoder
defmodule GitRekt do @moduledoc false alias GitRekt.Git defmodule GitCommit do @moduledoc """ Represents a Git commit. """ defstruct [:oid, :commit] @type t :: %__MODULE__{oid: Git.oid, commit: Git.commit} defimpl Inspect do def inspect(commit, _opts), do: "<GitCommit:#{Git.oid_fm...
apps/gitrekt/lib/gitrekt.ex
0.814496
0.494446
gitrekt.ex
starcoder
defmodule Solana.SystemProgram do @moduledoc """ Functions for interacting with Solana's [System Program](https://docs.solana.com/developing/runtime-facilities/programs#system-program) """ alias Solana.{Instruction, Account} import Solana.Helpers @doc """ The System Program's program ID. """ def i...
lib/solana/system_program.ex
0.866698
0.546496
system_program.ex
starcoder
defmodule ShEx.Shape do @moduledoc false defstruct [ # shapeExprLabel? :id, # tripleExpr? :expression, # BOOL? :closed, # [IRI]? :extra, # [SemAct]? :sem_acts, # [Annotation+]? :annotations ] import ShEx.GraphUtils def satisfies(shape, graph, schema, associat...
lib/shex/shape_expressions/shape.ex
0.717111
0.659655
shape.ex
starcoder
defmodule Spandex.Tracer do @moduledoc """ A module that can be used to build your own tracer. Example: ``` defmodule MyApp.Tracer do use Spandex.Tracer, otp_app: :my_app end ``` """ alias Spandex.{ Span, SpanContext, Trace } @type tagged_tuple(arg) :: {:ok, arg} | {:error, ter...
lib/tracer.ex
0.821939
0.685529
tracer.ex
starcoder
defmodule PcanlogParse.Examples.ExportToCsv do require PcanlogParser require CSV alias PcanlogParser, as: Parser @moduledoc """ Documentation for `PcanlogParser.Examples.ExportToCsv`. This is an example of usage for PcanlogParser. It parses a P-CAN log file and exports the Payload as CSV data """ # c...
lib/examples/export_to_csv.ex
0.852076
0.446857
export_to_csv.ex
starcoder
defmodule Tai.Config do @moduledoc """ Global configuration for a `tai` instance. This module provides a utility function to hydrate a struct from the OTP `Application` environment. It can be configured with the following options: ``` # [default: 10_000] [optional] Adapter start timeout in milliseconds ...
apps/tai/lib/tai/config.ex
0.863392
0.774199
config.ex
starcoder
defmodule Wallet do alias UltraDark.Transaction alias UltraDark.Utilities alias UltraDark.UtxoStore alias UltraDark.KeyPair def new_transaction(address, amount, desired_fee) do inputs = find_suitable_inputs(amount + desired_fee) designations = [%{amount: amount, addr: address}] designations = i...
lib/wallet.ex
0.791378
0.41401
wallet.ex
starcoder
defmodule Correios.CEP do @moduledoc """ Find Brazilian addresses by zip code, directly from Correios API. No HTML parsers. """ alias Correios.CEP.{Address, Client, Error, Parser} @type t :: {:ok, Address.t()} | {:error, Error.t()} @zipcode_regex ~r/^\d{5}-?\d{3}$/ @doc """ Finds address by the give...
lib/correios/cep.ex
0.875168
0.457197
cep.ex
starcoder
defmodule Plug.Static do @moduledoc """ A plug for serving static assets. It requires two options: * `:at` - the request path to reach for static assets. It must be a string. * `:from` - the file system path to read static assets from. It can be either: a string containing a file system pat...
lib/plug/static.ex
0.909829
0.628507
static.ex
starcoder
defmodule Grizzly.ZWave.NodeId do @moduledoc false # helper module for encoding and parsing node ids alias Grizzly.ZWave # When encoding for 16 bit node ids in the context of the node remove family of # command (node ids > 255) the 8 bit node id byte of the binary needs to be set # to 0xFF as per the spe...
lib/grizzly/zwave/node_id.ex
0.823648
0.833596
node_id.ex
starcoder
defmodule Foldable do @typedoc """ Functor dictionary intuitive type: fmap : f (a -> b) -> f a -> f b * `fmap`: (f a, a -> b) -> f b # params are swapped to facilitate piping, mandatory * `lift_left`: a -> f b -> f a # default implementation provided, optional """ @type t :: %__MODULE__{ } def __st...
typeclassopedia/lib/foldable.ex
0.831964
0.564098
foldable.ex
starcoder
defmodule Grizzly do @moduledoc """ Send commands to Z-Wave devices Grizzly provides the `send_command` function as the way to send a command to Z-Wave devices. The `send_command` function takes the node id that you are trying to send a command to, the command name, and optionally command arguments and co...
lib/grizzly.ex
0.836821
0.848282
grizzly.ex
starcoder
defimpl Timex.Comparable, for: Timex.DateTime do alias Timex.Time alias Timex.DateTime alias Timex.AmbiguousDateTime alias Timex.Comparable alias Timex.Convertable alias Timex.Types import Timex.Macros @units [:years, :months, :weeks, :calendar_weeks, :days, :hours, :minutes, :seconds, :timestamp] ...
lib/comparable/datetime.ex
0.690976
0.551634
datetime.ex
starcoder
defmodule Artemis.Helpers do require Logger @doc """ Generate a random string """ def random_string(string_length) do string_length |> :crypto.strong_rand_bytes() |> Base.url_encode64() |> binary_part(0, string_length) end @doc """ Detect if value is truthy """ def present?(nil), d...
apps/artemis/lib/artemis/helpers.ex
0.862844
0.482307
helpers.ex
starcoder
defmodule SecureServer do @moduledoc """ SecureServer provides the encoder and decoder for secure Phoenix web servers. While not all the functions defined here are used in Phoenix or Plug, they are important to have to implement a 'complete' encoder/decoder. The encoding and decoding functions in this file ...
lib/secure_server.ex
0.907545
0.480052
secure_server.ex
starcoder
defmodule Pager do @moduledoc """ Pager is a library for adding cursor-based pagination to Ecto. It provides an efficient means of paginating through a resultset, but it requires some buy-in to take advantage of. In the cursor model, each record in the resultset has an associated 'cursor', a value that rep...
lib/pager.ex
0.836237
0.894237
pager.ex
starcoder
defmodule Accent.Scopes.Translation do import Ecto.Query alias Ecto.Queryable alias Accent.{Operation, Repo, Translation} @doc """ Default ordering is by ascending key ## Examples iex> Accent.Scopes.Translation.parse_order(Accent.Translation, nil) #Ecto.Query<from t0 in Accent.Translation, order...
lib/accent/scopes/translation.ex
0.780621
0.403861
translation.ex
starcoder
defmodule Oban.Plugins.Reindexer do @moduledoc """ Periodically rebuild indexes to minimize database bloat. Over time various Oban indexes may grow without `VACUUM` cleaning them up properly. When this happens, rebuilding the indexes will release bloat. The plugin uses `REINDEX` with the `CONCURRENTLY` opti...
lib/oban/plugins/reindexer.ex
0.870721
0.614047
reindexer.ex
starcoder
defmodule Romanex do @moduledoc """ Encode, Decode, and Validate roman numerals. Letter values are: M = 1000, D = 500, C = 100, L = 50, X = 10, V = 5, I = 1 The Range of Values representable by roman numerals is: 1 - 4999 """ @doc "Encode an Integer into a Roman Numeral." @spec encode(integ...
lib/romanex.ex
0.763351
0.512876
romanex.ex
starcoder
defmodule GCM do @moduledoc """ GCM push notifications to devices. ``` iex> GCM.push("api_key", ["registration_id"], %{notification: %{ title: "Hello!"} }) {:ok, %{body: "...", canonical_ids: [], failure: 0, headers: [{"Content-Type", "application/json; charset=UTF-8"}, {"Vary", "Accept-En...
lib/gcm.ex
0.779238
0.606761
gcm.ex
starcoder
defmodule Ratatouille.Runtime.Command do @moduledoc """ Commands provide a way to start an expensive call in the background and get the result back via `c:Ratatouille.App.update/2`. Commands should be constructed via the functions below and not via the struct directly, as this is internal and subject to chan...
lib/ratatouille/runtime/command.ex
0.677261
0.495056
command.ex
starcoder
defmodule Croma.Defun do @moduledoc """ Module that provides `Croma.Defun.defun/2` macro. """ @doc """ Defines a function together with its typespec. This provides a lighter-weight syntax for functions with type specifications and functions with multiple clauses. ## Example The following examples as...
lib/croma/defun.ex
0.867983
0.692973
defun.ex
starcoder
defmodule Faker.Pizza do import Faker, only: [sampler: 2] alias Faker.Util @moduledoc """ Functions for generating Pizza related data in English. """ @doc """ Returns a list with a number of pizzas. If an integer is provided, exactly that number of pizzas will be returned. If a range is provided, ...
lib/faker/pizza.ex
0.772874
0.507446
pizza.ex
starcoder
defmodule Mix.Tasks.Compile.Thrift do @moduledoc """ Provides a mix task for compiling Thrift IDL files to Erlang. Once Thrash is compiled, you can execute `mix compile.thrift` to generate Erlang code (a required precursor for Thrash) from your Thrift IDL files (i.e., `.thrift` files). By default, `mix co...
lib/mix/tasks/compile/thrift.ex
0.693992
0.539226
thrift.ex
starcoder
defmodule GrokEX do @moduledoc """ Compiles grok patterns into Elixir objects which can be used for testing strings against patterns. ## Examples ``` iex> GrokEX.compile_regex("Here's a number %{NUMBER:the_number}") {:ok, ~r/Here's a number (?<the_number>(?:(?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\\.[0-9...
lib/grokex.ex
0.873741
0.837487
grokex.ex
starcoder
defmodule Pixie.LocalSubscription do use GenServer @moduledoc """ Represents an in-VM subscription to a Bayeux channel. """ @doc """ Subscribe to a channel and call the provided function with messages. ```elixir {:ok, sub} = Pixie.subscribe "/my_awesome_channel", fn(message,_)-> IO.inspect messag...
lib/pixie/local_subscription.ex
0.715921
0.567128
local_subscription.ex
starcoder
defmodule Rummage.Ecto.CustomHooks.KeysetPaginate do @moduledoc """ `Rummage.Ecto.CustomHooks.KeysetPaginate` is a custom paginate hook that comes shipped with `Rummage.Ecto`. This module can be used by overriding the default paginate module. This can be done in the following ways: In the `Rummage.Ecto` c...
lib/rummage_ecto/custom_hooks/keyset_paginate.ex
0.800185
0.731071
keyset_paginate.ex
starcoder
defmodule Zaryn.BeaconChain.Slot.Validation do @moduledoc false alias Zaryn.BeaconChain.Slot alias Zaryn.BeaconChain.Slot.EndOfNodeSync alias Zaryn.BeaconChain.Slot.TransactionSummary alias Zaryn.BeaconChain.SummaryTimer alias Zaryn.Crypto alias Zaryn.P2P alias Zaryn.P2P.Message.GetTransactionSummary...
lib/zaryn/beacon_chain/slot/validation.ex
0.828973
0.432243
validation.ex
starcoder
defmodule DarkEcto.Projections.Types do @moduledoc """ Type conversions """ alias DarkEcto.Projections.PermuteConversions # @types [:ecto, :postgrex, :typespec, :cli, :typescript, :absinthe, :prop_schema] # @types [:ecto, :absinthe, :typespec, :typescript, :cli] @types [:ecto, :absinthe, :typespec, :ty...
lib/dark_ecto/projections/types.ex
0.719186
0.449997
types.ex
starcoder
defmodule Particle.Stream.Event do @moduledoc false defstruct event: nil, data: nil, ttl: nil, published_at: nil, coreid: nil end defmodule Particle.Stream do require Logger alias Experimental.GenStage alias Particle.Stream.Event alias Particle.Http use GenStage @moduledoc false @base_url "https:/...
lib/particle/stream.ex
0.628749
0.457743
stream.ex
starcoder
defmodule ExIcal.Event do @moduledoc """ Represents an iCalendar event. For more information on iCalendar events, please see the official specs ([RFC 2445]). Here is a brief summary of the available properties of `ExIcal.Event` as well as links for more detailed information: ## Fields - `start`: ...
lib/ex_ical/event.ex
0.831349
0.574126
event.ex
starcoder
defmodule ExUnitJsonFormatter do use GenServer @moduledoc """ Formats ExUnit output as a stream of JSON objects (roughly compatible with Mocha's json-stream reporter) """ # GenServer callbacks that receive test runner messages def init(opts) do config = %{ seed: opts[:seed], trace: opts[...
lib/exunit_json_formatter.ex
0.667364
0.521654
exunit_json_formatter.ex
starcoder
defmodule LiveAttribute do use GenServer require Logger defstruct [:refresher, :subscribe, :target, :filter, :keys] @moduledoc """ LiveAttribute makes binding updateable values easier. To use it add it to your LiveView using `use LiveAttribute` and then use the function `assign_attribute(socket, subscribe_...
lib/live_attribute.ex
0.916152
0.76745
live_attribute.ex
starcoder
defmodule Erl2ex.Source do @moduledoc """ Erl2ex.Source is a process that produces Erlang source, normally reading files from the file system. """ @typedoc """ The ProcessID of a source process. """ @type t :: pid() @doc """ Starts a source and returns its PID. """ @spec start_link(list) ...
lib/erl2ex/source.ex
0.549882
0.434941
source.ex
starcoder
defmodule Qoix do @moduledoc """ Qoix is an Elixir implementation of the [Quite OK Image format](https://qoiformat.org). """ alias Qoix.Image use Bitwise @index_op <<0::2>> @diff_op <<1::2>> @luma_op <<2::2>> @run_op <<3::2>> @rgb_op <<254::8>> @rgba_op <<255::8>> @padding :binary.copy(<<0>>, ...
lib/qoix.ex
0.887125
0.454654
qoix.ex
starcoder
defmodule Membrane.Element do @moduledoc """ Module containing functions spawning, shutting down, inspecting and controlling playback of elements. These functions are usually called by `Membrane.Pipeline`, and can be called from elsewhere only if there is a really good reason for doing so. """ alias __MO...
lib/membrane/element.ex
0.872048
0.431464
element.ex
starcoder
defmodule Membrane.RTP.H264.Depayloader do @moduledoc """ Depayloads H264 RTP payloads into H264 NAL Units. Based on [RFC 6184](https://tools.ietf.org/html/rfc6184). Supported types: Single NALU, FU-A, STAP-A. """ use Membrane.Filter use Membrane.Log alias Membrane.Buffer alias Membrane.{RTP, Remot...
lib/rtp_h264/depayloader.ex
0.78233
0.417064
depayloader.ex
starcoder
defprotocol Socket.Datagram.Protocol do @doc """ Send a packet to the given recipient. """ @spec send(t, iodata, term) :: :ok | { :error, term } def send(self, data, to) @doc """ Receive a packet from the socket. """ @spec recv(t) :: { :ok, { iodata, { Socket.Address.t, :inet.port_number } } } | { :...
deps/socket/lib/socket/datagram.ex
0.82308
0.438424
datagram.ex
starcoder
defmodule Riak.Object do @moduledoc """ The Data wrapper makes it convenient to work with Riak data in Elixir """ @doc """ Struct representing a Riak Object. Attributes: * `type`: String; Bucket Type with a unique name within the cluster namespace * `bucket`: String; Bucket with a unique name within the ...
lib/riak/object.ex
0.688154
0.476823
object.ex
starcoder
defmodule Wax do @moduledoc """ Functions for FIDO2 registration and authentication ## Options The options are set when generating the challenge (for both registration and authentication). Options can be configured either globally in the configuration file or when generating the challenge. Some also have ...
lib/wax.ex
0.940497
0.913445
wax.ex
starcoder
defmodule Dynamo.HTTP.Hibernate do @moduledoc """ Conveniences that allows a connection to hibernate or wait a given amount or an unlimited amount of time. Such conveniences are useful when a connection needs to be kept open (because of long polling, websockets or streaming) but you don't want to keep the ...
lib/dynamo/http/hibernate.ex
0.880245
0.420005
hibernate.ex
starcoder
defmodule Zaryn.Mining.DistributedWorkflow do @moduledoc """ ARCH mining workflow is performed in distributed manner through a Finite State Machine to ensure consistency of the actions and be able to postpone concurrent events and manage timeout Every transaction mining follows these steps: - Mining Context ...
lib/zaryn/mining/distributed_workflow.ex
0.833562
0.546496
distributed_workflow.ex
starcoder
defmodule FinancialSystem.Converter do alias FinancialSystem.Coin, as: Coin @moduledoc """ Module that deals with operations such as currency value conversion. Uses the dollar as a base to make the other conversions. If the currency is not ISO 4217 standard and an error is returned. """ @doc false def e...
apps/financial_system/lib/converter.ex
0.854854
0.651729
converter.ex
starcoder
defmodule Votex.Votable do @moduledoc """ Defines a Votable Model A Votable model will expose the required methods to enable voting functionality Typically be used by models like Post, Image, Answer etc. ## Example defmodule Post do use Ecto.Schema use Votex.Votable schema "...
lib/votex/votable.ex
0.738763
0.523542
votable.ex
starcoder
defmodule Scenic.Scrollable.ScrollBars do use Scenic.Component use Scenic.Scrollable.SceneInspector, env: [:test, :dev] import Scenic.Scrollable.Components, only: [scroll_bar: 3] alias Scenic.Graph alias Scenic.Scrollable.ScrollBar alias Scenic.Scrollable.Direction @moduledoc """ The scroll bars comp...
lib/components/scroll_bars.ex
0.892281
0.574574
scroll_bars.ex
starcoder
defmodule StarkInfra.IssuingAuthorization do alias __MODULE__, as: IssuingAuthorization alias StarkInfra.Error alias StarkInfra.Utils.JSON alias StarkInfra.Utils.Parse alias StarkInfra.Utils.Check alias StarkInfra.User.Project alias StarkInfra.User.Organization @moduledoc """ Groups IssuingAuthoriza...
lib/issuing_authorization/issuing_authorization.ex
0.812496
0.663396
issuing_authorization.ex
starcoder
defmodule Export.Python do @moduledoc """ Wrapper for ruby. ## Example ```elixir defmodule SomePythonCall do use Export.Python def call_python_method # path to our python files {:ok, py} = Python.start(python_path: Path.expand("lib/python")) # call "upcase" method from "test" file...
lib/export/python.ex
0.860105
0.849285
python.ex
starcoder
defmodule Bonbon.APICase do @moduledoc """ This module defines the test case to be used by GraphQL endpoint tests. """ use ExUnit.CaseTemplate use Phoenix.ConnTest using do quote do import Bonbon.APICase use Phoenix.ConnTest alias Bonbon.Rep...
test/support/api_case.ex
0.739611
0.431045
api_case.ex
starcoder
defmodule OT.Text.Component do @moduledoc """ An individual unit of work to be performed on a piece of text. A component represents a retain or modification of the text: - `5`: Retain 5 characters of the text - `%{i:"Hello"}`: Insert the string "Hello" - `%{d:"World"}`: Delete the string "World...
lib/ot/text/component.ex
0.876344
0.626067
component.ex
starcoder
defmodule StructyRecord do @moduledoc """ `StructyRecord` provides a Struct-like interface for your `Record`s. - Use your record's macros in the _same module_ where it is defined! - Access and update fields in your record through named macro calls. - Create and update records at runtime (not limited to comp...
lib/structy_record.ex
0.920576
0.915507
structy_record.ex
starcoder
defmodule NaiveBayes do defstruct vocab: %Vocab{}, data: %Data{}, smoothing: 1, binarized: false, assume_uniform: false def new(opts \\ []) do binarized = opts[:binarized] || false assume_uniform = opts[:assume_uniform] || false smoothing = opts[:smoothing] || 1 %NaiveBayes{smoothing: smoothing, b...
lib/naive_bayes.ex
0.678966
0.62691
naive_bayes.ex
starcoder
defmodule Pavlov.Matchers.Messages do @moduledoc false @doc false def message_for_matcher(matcher_name, [actual, expected], :assertion) do actual = inspect actual expected = inspect expected case matcher_name do :eq -> "Expected #{actual} to equal #{expected}" :have_key -> "Expected #{ac...
lib/matchers/messages.ex
0.698844
0.582966
messages.ex
starcoder
defmodule XDR.Error do @typedoc """ A single piece of a path, which will be either an atom or a binary """ @type path_segment() :: binary() | atom() @typedoc """ The "cursor" in the current path, which is usually just one segment, but may be a list. For example, if an error happens while resolving the ...
lib/xdr/error/error.ex
0.889646
0.482917
error.ex
starcoder
defmodule ExSenml.SenmlStruct do @moduledoc """ Below Table provides an overview of all SenML fields defined by rfc8428 with their respective labels and data types. +---------------+-------+------------+------------+------------+ | Name | Label | CBOR Label | JSON Type | XML Type | ...
lib/ex_senml/senml_struct.ex
0.880496
0.611527
senml_struct.ex
starcoder
defmodule Gealts do @moduledoc """ Gealts is a basic implementation of a genetic algorithm based on http://arxiv.org/pdf/1308.4675.pdf exposed functions: Gealts.start/1 Gealts.iterate/1 Gealts.best/0 Gealts.population/0 Gealts.config/0 """ alias Gealts.Population ali...
lib/gealts.ex
0.859575
0.683789
gealts.ex
starcoder
defmodule Mix.Utils do @moduledoc """ Utilities used throughout Mix and tasks. ## Conversions This module handles two types of conversions: * From command names to module names, i.e. how the command `deps.get` translates to `Deps.Get` and vice-versa; * From underscore to camelize, i.e. how the file ...
lib/mix/lib/mix/utils.ex
0.86501
0.613237
utils.ex
starcoder
defmodule Gettext.Interpolation do @moduledoc false @interpolation_regex ~r/ (?<left>) # Start, available through :left %{ # Literal '%{' [^}]+ # One or more non-} characters } # Literal '}' (?<right>) # End, available through :right /x @doc """ Extracts interpolat...
deps/gettext/lib/gettext/interpolation.ex
0.901758
0.52074
interpolation.ex
starcoder
defmodule PgContrivance do alias PgContrivance.SqlCommand alias PgContrivance.Query @doc """ Primary entry point to working with sql statements. Parameters can be either $1,$2...$n or atom format (:first, :last). When parameters are in atom format, a hash must be passed to the params function. ```ex ...
lib/pg_contrivance.ex
0.659405
0.746278
pg_contrivance.ex
starcoder
defmodule RList.ActiveSupport do @moduledoc """ Summarized all of List functions in Rails.ActiveSupport. If a function with the same name already exists in Elixir, that is not implemented. Defines all of here functions when `use RList.ActiveSupport`. """ @spec __using__(any) :: list defmacro __using__(_op...
lib/r_list/active_support.ex
0.818374
0.464659
active_support.ex
starcoder
defmodule PiviEx.Period do @moduledoc """ Helper to create a period from an integer. """ ## NaiveDates def naive_date(day) do {:ok, date} = NaiveDateTime.from_iso8601 "#{day} 00:00:00" date end def period(%Date{} = date) do date.year * 100 + date.month end def period_dates(str) when is...
lib/period.ex
0.809803
0.599602
period.ex
starcoder
defmodule TheFuzz do @moduledoc """ Contains shortforms to execute different string metric algorithms to compare given strings. """ @spec compare(atom, String.t(), String.t()) :: number @doc """ Compares given strings using the corresponding string metric algorithm. Available metric types are: - So...
lib/the_fuzz.ex
0.908866
0.757436
the_fuzz.ex
starcoder
defmodule Comeonin.Password do @moduledoc """ Module to generate random passwords and check password strength. The function to check password strength checks that it is long enough and contains at least one digit and one punctuation character. # Password policy The guidelines below are mainly intended fo...
deps/comeonin/lib/comeonin/password.ex
0.699768
0.704745
password.ex
starcoder
defmodule Crux.Structs.Guild do @moduledoc """ Represents a Discord [Guild Object](https://discord.com/developers/docs/resources/guild#guild-object). Differences opposed to the Discord API Object: - `:channels` is a `MapSet` of channel ids - `:emojis` is a `MapSet` of emoji ids - `:presences` does not exis...
lib/structs/guild.ex
0.804905
0.624923
guild.ex
starcoder
defmodule Modbus.Rtu.Master do @moduledoc """ RTU module. ```elixir ``` """ alias Modbus.Rtu @doc """ Starts the RTU server. `params` *must* contain a keyword list to be merged with the following defaults: ```elixir [ device: nil, #serial port name: "COM1", "ttyUSB0", "cu.usb...
lib/Master.ex
0.776877
0.698882
Master.ex
starcoder
defmodule Soap.Response.Parser do @moduledoc """ Provides a functions for parse an xml-like response body. """ import SwXml, only: [xpath: 2, sigil_x: 2] @soap_version_namespaces %{ "1.1" => :"http://schemas.xmlsoap.org/soap/envelope/", "1.2" => :"http://www.w3.org/2003/05/soap-envelope" } @doc ...
lib/soap/response/parser.ex
0.648578
0.412412
parser.ex
starcoder
defmodule Plaid.Accounts do @moduledoc """ [Plaid Accounts API](https://plaid.com/docs/api/accounts) calls and schema. """ alias Plaid.Castable defmodule GetResponse do @moduledoc """ [Plaid API /accounts/get response schema.](https://plaid.com/docs/api/accounts). """ @behaviour Castable ...
lib/plaid/accounts.ex
0.852935
0.450057
accounts.ex
starcoder
defmodule Bamboo.ElasticEmail do @moduledoc """ Helper functions for manipulating Bamboo.Email to enable Elastic Email functionality. """ alias Bamboo.Email @doc """ Add attachment identifiers to the email. > Names or IDs of attachments previously uploaded to your account (via the > File/Upload req...
lib/bamboo/elastic_email.ex
0.784649
0.50415
elastic_email.ex
starcoder
defmodule Hangman.Action.Robot do @moduledoc """ Implements robot action player specific functionality The `robot` action is reliant on the game strategy to automatically self select the best guess. """ alias Hangman.{Action.Robot, Round, Letter.Strategy, Pass} defstruct type: :robot, display: false, ...
lib/hangman/action_robot.ex
0.863694
0.514522
action_robot.ex
starcoder
defmodule Nectar.Product do use Nectar.Web, :model use Arc.Ecto.Model schema "products" do field :name, :string field :description, :string field :available_on, Ecto.Date field :discontinue_on, Ecto.Date field :slug, :string has_one :master, Nectar.Variant, on_delete: :nilify_all # As th...
apps/nectar/web/models/product.ex
0.736021
0.416292
product.ex
starcoder