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 Vex do @moduledoc """ Data Validation for Elixir. """ alias Vex.{ Extract, InvalidValidatorError, Validator, Validator.Source } def valid?(data) do valid?(data, Extract.settings(data)) end def valid?(data, settings) do errors(data, settings) == [] end def valida...
lib/vex.ex
0.780662
0.405802
vex.ex
starcoder
defmodule Stripe.PaymentIntent do @moduledoc """ Work with [Stripe `payment_intent` objects](https://stripe.com/docs/api/payment_intents). You can: - [Create a payment_intent](https://stripe.com/docs/api/payment_intents/create) - [Retrieve a payment_intent](https://stripe.com/docs/api/payment_intents/retriev...
lib/stripe/core_resources/payment_intent.ex
0.780286
0.459076
payment_intent.ex
starcoder
defmodule Timber.Formatter do @moduledoc """ Provides utilities for formatting log lines as text This formatter is designed for use with the default `:console` backend provided by Elixir Logger. To use this, you'll need to configure the console backend to call the `Timber.Formatter.format/4` function instead...
lib/timber/formatter.ex
0.823896
0.842604
formatter.ex
starcoder
defmodule Bump do def to_iodata(%{size: %{height: height, width: width}} = canvas) do resolution = 2835 info_header_size = 40 offset = 14 + info_header_size padding_size = rem(width, 4) padding = List.duplicate(0, padding_size) pixel_data = canvas |> Canvas.pixel_data() |> ...
lib/bump.ex
0.521715
0.427994
bump.ex
starcoder
defmodule Ockam.Vault do @moduledoc false ## NIF functions always infer as any() ## The types are useful for readability @dialyzer [:no_contracts] @default_secret_attributes [type: :curve25519, persistence: :ephemeral, length: 32] @doc """ Computes a SHA-256 hash based on input data. """ @spec sh...
implementations/elixir/ockam/ockam/lib/ockam/vault.ex
0.854156
0.436262
vault.ex
starcoder
defmodule State.Alert.Filter do @moduledoc """ Documented in State.Alert.filter_by/1. """ alias State.Alert alias State.Alert.{ActivePeriod, InformedEntity, InformedEntityActivity} @doc false @spec filter_by(Alert.filter_opts()) :: [Model.Alert.t()] def filter_by(filter_opts) do filter_opts |> ...
apps/state/lib/state/alert/filter.ex
0.645902
0.400398
filter.ex
starcoder
defmodule RePG2 do @moduledoc """ The RePG2 interface. From the [Erlang pg2 docs](http://erlang.org/doc/man/pg2.html): > This module implements process groups. Each message may be sent to one, > some, or all members of the group. > > A group of processes can be accessed by a common name. For example, if...
lib/repg2.ex
0.857694
0.567997
repg2.ex
starcoder
defmodule Ash.Filter do @moduledoc """ The representation of a filter in Ash. Ash filters are stored as nested `Ash.Query.Expression{}` and `%Ash.Query.Not{}` structs, terminating in an operator or a function struct. An expression is simply a boolean operator and the left and right hand side of that operator...
lib/ash/filter/filter.ex
0.92391
0.903635
filter.ex
starcoder
defmodule Ockam.Examples.Stream.BiDirectional.SecureChannel do @moduledoc """ Ping-pong example for bi-directional stream communication Use-case: integrate ockam nodes which implement stream protocol consumer and publisher Pre-requisites: Ockam hub running with stream service and TCP listener Two ockam...
implementations/elixir/ockam/ockam/lib/ockam/examples/stream/bi_directional/secure_channel.ex
0.844104
0.525004
secure_channel.ex
starcoder
defmodule CircuitRunner do use Bitwise require CircuitParser def main([filename, output|_]) do circuit = parse_file(filename) {circuit, value} = get_gate(circuit, String.to_atom(output)) IO.inspect(value) end def main([filename|_]) do IO.puts("No output gate. Defaulting to 'a'") main([fi...
advent_umbrella_2016/apps/day7/lib/circuit_runner.ex
0.696991
0.449513
circuit_runner.ex
starcoder
defmodule SMPPEX.Pdu.PP do @moduledoc """ Module for colored pretty printing Pdu structs. """ alias IO.ANSI, as: C alias SMPPEX.Pdu alias SMPPEX.Protocol.TlvFormat @pad "" @indent " " @field_inspect_limit 999999 @spec format(pdu :: Pdu.t, indent :: String.t, pad :: String.t) :: iolist @doc ""...
lib/smppex/pdu/pp.ex
0.805058
0.677904
pp.ex
starcoder
defmodule Quantum.Storage do @moduledoc """ Behaviour to be implemented by all Storage Adapters. The calls to the storage are blocking, make sure they're fast to not block the job execution. """ alias Quantum.Job @typedoc """ The location of the `server`. ### Values * `nil` if the storage was not...
lib/quantum/storage.ex
0.919971
0.502258
storage.ex
starcoder
defmodule Sneex.AddressMode do @moduledoc """ This module contains the logic for converting an address offset into a full address using the current state of the CPU and the logic for each addressing mode. """ alias Sneex.Address.Helper alias Sneex.{BasicTypes, Cpu} use Bitwise @typep word :: BasicTypes...
lib/sneex/address_mode.ex
0.728265
0.448487
address_mode.ex
starcoder
defmodule Grakn.Protocol do @moduledoc """ This is the DBConnection behaviour implementation for Grakn database """ use DBConnection defstruct [:session, :transaction] defguardp transaction_open?(tx) when not is_nil(tx) def checkin(state) do # empty - process is independent from state {:ok, st...
lib/grakn/protocol.ex
0.757705
0.401658
protocol.ex
starcoder
defmodule EWalletDB.SoftDelete do @moduledoc """ Allows soft delete of Ecto records. Requires a `:deleted_at` column with type `:naive_datetime_usec` on the schema. The type `:naive_datetime_usec` is used so that it aligns with `Ecto.Migration.timestamps/2`. See https://elixirforum.com/t/10129 and https://...
apps/ewallet_db/lib/ewallet_db/soft_delete.ex
0.834609
0.903166
soft_delete.ex
starcoder
defmodule Lexin.Dictionary.XMLConverter do @moduledoc """ In order to get quick lookups for the words in the dictionary files, we want to convert original XML files into similar SQLite counterparts with simple structure. Every word definition might have referential `Index`-es – the words that can point to the ...
lib/lexin/dictionary/xml_converter.ex
0.873485
0.943243
xml_converter.ex
starcoder
defmodule Ello.V3.Schema.AssetTypes do import Ello.V3.Schema.Helpers use Absinthe.Schema.Notation object :asset do field :id, :id field :attachment, :responsive_image_versions, resolve: fn(_args, %{source: post}) -> {:ok, post.attachment_struct} end end object :tshirt_image_versions do ...
apps/ello_v3/lib/ello_v3/schema/asset_types.ex
0.572723
0.401101
asset_types.ex
starcoder
defmodule CommonParser.Expr do @moduledoc """ Documentation for Parser. """ import NimbleParsec import CommonParser.Helper # tag := ascii_tag_with_space([?a..?z]) # single_value := string_with_quote | integer | atom_with_space # list_value := [ single_value | single_value , single_value ] # value := ...
lib/expr.ex
0.51879
0.543409
expr.ex
starcoder
defmodule AdventOfCode.Day8 do @input_example """ rect 3x2 rotate column x=1 by 1 rotate row y=0 by 4 rotate column x=1 by 1 """ defmodule Field do defstruct height: 6, width: 50, marks: Keyword.new([]) def apply_ops(%Field{} = field, []), do: field def apply_ops(%Field{} = field, [op|ops]) do ...
lib/advent_of_code/day8.ex
0.600305
0.528716
day8.ex
starcoder
defmodule PhxIzitoast do @moduledoc """ Documentation for `PhxIzitoast` - Phoenix Notification Package. ![img](https://github.com/manuelgeek/phx_izitoast/raw/master/priv/static/img/iziToast.png) ## Configuration Add the below config to `config/config.exs`. This includes the default configurations(optional)....
lib/phx_izitoast.ex
0.731251
0.836988
phx_izitoast.ex
starcoder
require Utils defmodule D4 do @moduledoc """ --- Day 4: Secure Container --- You arrive at the Venus fuel depot only to discover it's protected by a password. The Elves had written the password on a sticky note, but someone threw it out. However, they do remember a few key facts about the password: It is a...
lib/days/04.ex
0.706697
0.730915
04.ex
starcoder
defmodule Mexpanel.EngageRequest do @enforce_keys [:token, :distinct_id] defstruct [ :token, :distinct_id, :time, :ip, :ignore_time, :operation, :properties ] @type properties :: map() | list() | nil @type operation :: :set | :set_once | :add ...
lib/mexpanel/engage_request.ex
0.79858
0.459561
engage_request.ex
starcoder
defmodule Comeonin.Bcrypt.Base64 do @moduledoc """ Module that provides base64 encoding for bcrypt. Bcrypt uses an adapted base64 alphabet (using `.` instead of `+`, starting with `./` and with no padding). """ use Bitwise @decode_map {:bad,:bad,:bad,:bad,:bad,:bad,:bad,:bad,:bad,:ws,:ws,:bad,:bad,:ws,...
deps/comeonin/lib/comeonin/bcrypt/base64.ex
0.790004
0.74001
base64.ex
starcoder
defmodule OnFlow.Credentials do @moduledoc """ Defines a struct that contains an address, a public key, and a private key. `:address` might be `nil`, but the key will be present in the struct. Do not initialize this directly. Instead, call `Credentials.new/1` or `Credentials.new!/1`. """ @enforce_keys ...
lib/on_flow/credentials.ex
0.851042
0.560102
credentials.ex
starcoder
defmodule ConnectFour do use Servus.Game, features: [:hiscore] require Logger alias Servus.Serverutils def init(players) do Logger.debug("Initializing game state machine") [player2, player1] = players {:ok, field_pid} = Gamefield.start_link() fsm_state = %{player1: player1, player2: player2,...
lib/Backends/connect_four/connectfour.ex
0.599016
0.400251
connectfour.ex
starcoder
defmodule Day03 do @moduledoc """ AoC 2019, Day 3 - Crossed Wires """ @doc """ Find the distance to the closes intersection point """ def part1 do eval(&intersection_distance/1) end @doc """ Find the distance to the shortest path intersection """ def part2 do eval(&intersection_shortes...
apps/day03/lib/day03.ex
0.793266
0.691243
day03.ex
starcoder
defmodule Periodic do @moduledoc """ Periodic job execution. This module can be used when you need to periodically run some code in a separate process. To setup the job execution, you can include the child_spec in your supervision tree. The childspec has the following shape: ``` {Periodic, run: mfa_o...
lib/periodic.ex
0.879768
0.884639
periodic.ex
starcoder
defmodule Oli.Utils.Database do alias Oli.Repo require Logger @doc """ Explains the query plan for a given raw, string based query. Options to either inline log the result and return the query, or to just return to analyzed result. Results can be in either json, text, or yaml format. Default is to log o...
lib/oli/utils/database.ex
0.74512
0.755614
database.ex
starcoder
defmodule CTE.InMemory do @moduledoc """ CT implementation using the memory adapter. The good ol' friends Rolie, Olie and Polie, debating the usefulness of this implementation :) You can watch them in action on: [youtube](https://www.youtube.com/watch?v=LTkmaE_QWMQ) After seeding the data, we'll have this g...
test/support/in_memory.ex
0.610453
0.587322
in_memory.ex
starcoder
defmodule Grizzly.DSK do @moduledoc """ Module for working with the SmartStart and S2 DSKs """ @typedoc """ The DSK string is the string version of the DSK The general format is `XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX` That is 8 blocks of 16 bit integers separated by a dash. An example of ...
lib/grizzly/dsk.ex
0.904251
0.822724
dsk.ex
starcoder
defmodule Commanded.Assertions.EventAssertions do @moduledoc """ Provides test assertion and wait for event functions to help test applications built using Commanded. The default assert and refute receive timeouts are one second. You can override the default timeout in config (e.g. `config/test.exs`): ...
lib/commanded/assertions/event_assertions.ex
0.910253
0.789741
event_assertions.ex
starcoder
defmodule InfluxDB do @moduledoc """ Main interface to query and insert data into InfluxDB. """ alias InfluxDB.Config @type config :: Config.t @type time_unit :: :hour | :minute | :second | :millisecond | :microsecond | :nanosecond @doc """ Send a query to InfluxDB and return the result. In case o...
lib/influxdb.ex
0.859649
0.605041
influxdb.ex
starcoder
defmodule ARP.Account.Promise do @moduledoc false alias ARP.{Config, Crypto, Utils} use GenServer defstruct [:cid, :from, :to, :amount, :sign, :paid] def create(private_key, cid, from, to, amount, paid \\ 0) do decoded_from = from |> String.slice(2..-1) |> Base.decode16!(case: :mixed) decoded_to =...
lib/arp_server/account/promise.ex
0.702428
0.400075
promise.ex
starcoder
defmodule AWS.Textract do @moduledoc """ Amazon Textract detects and analyzes text in documents and converts it into machine-readable text. This is the API reference documentation for Amazon Textract. """ @doc """ Analyzes an input document for relationships between detected items. The types of info...
lib/aws/generated/textract.ex
0.920057
0.818809
textract.ex
starcoder
defmodule Map do @moduledoc """ A Dict implementation that works on maps. Maps are key-value stores where keys are compared using the match operator (`===`). Maps can be created with the `%{}` special form defined in the `Kernel.SpecialForms` module. For more information about the functions in this modu...
lib/elixir/lib/map.ex
0.821438
0.674446
map.ex
starcoder
defmodule Pie.Pipeline do @moduledoc """ Pipeline handling. A pipeline consists of a state and several steps. When executed, the updated stated will be passed to each step, in order, until all of them are executed. At the end, the final version of the state will be evaluated and returned. """ defstruct s...
lib/pie/pipeline.ex
0.890844
0.697686
pipeline.ex
starcoder
defmodule GGity.Plot do @moduledoc """ Configures and generates an iolist representing an SVG plot. The Plot module is GGity's public interface. A Plot struct is created with `new/3`, specifying the data and aesthetic mappings to be used, along with options associated with the plot's general appearance. D...
lib/ggity/plot.ex
0.952959
0.985482
plot.ex
starcoder
defmodule HPDF do @moduledoc """ Uses Chrome in Headless mode to print pages to PDF. Each page is loaded in it's own browser context, similar to an Incognito window. Pages may be printed that require authentication allowing you to print pages that are behind login wall. When using HPDF you need to have a he...
lib/hpdf.ex
0.895168
0.746624
hpdf.ex
starcoder
defmodule PortMidi do @moduledoc """ The entry module of portmidi. Through this module you can open and close devices, listen on input devices, or write to output devices. """ alias PortMidi.Input alias PortMidi.Output alias PortMidi.Listeners alias PortMidi.Devices use Application @doc """ ...
lib/portmidi.ex
0.841793
0.478894
portmidi.ex
starcoder
defmodule Recurly.Transaction do @moduledoc """ Module for handling transactions in Recurly. See the [developer docs on transactions](https://dev.recurly.com/docs/list-transactions) for more details """ use Recurly.Resource alias Recurly.{Resource,Transaction,TransactionDetails,Account,Invoice,Subscriptio...
lib/recurly/transaction.ex
0.919683
0.836087
transaction.ex
starcoder
defmodule Day15 do def part1 lines do {map, units} = read_map lines do_round units, map, 0 end def part2 lines do {map, units} = read_map lines do_power(units, map, 4) end defp do_power(units, map, power) when power < 40 do :io.format("power: ~p\n", [power]) units = units_set_elf_po...
day15/lib/day15.ex
0.518059
0.53279
day15.ex
starcoder
defmodule DateTimeParser.Combinators.Time do @moduledoc false import DateTimeParser.Combinators.TimeZone, only: [second_letter_of_timezone_abbreviation: 0] import NimbleParsec @hour_num ~w(00 01 02 03 04 05 06 07 08 09) ++ Enum.map(23..0, &to_string/1) @second_minute_num ~w(00 01 02 03 04 05 06 07 08 09) ++...
lib/combinators/time.ex
0.784979
0.482673
time.ex
starcoder
defmodule OAuthXYZ.Model.KeyRequest do @moduledoc """ Key Request Struct and Handling Functions. ``` # full? "keys": { "proof": "jwsd", "jwks": { "keys": [ { "kty": "RSA", "e": "AQAB", "kid": "xyz-1", "alg": "RS256", "n": "kOB5rR4Jv0GMeL...
lib/oauth_xyz/model/key_request.ex
0.62223
0.672048
key_request.ex
starcoder
defmodule Multiverses.DynamicSupervisor do @moduledoc """ This module is intended to be a drop-in replacement for `DynamicSupervisor`. It launches the supervised process during a slice of time in which the universe of the DynamicSupervisor is temporarily set to the universe of its caller. For example, if t...
lib/multiverses/dynamic_supervisor.ex
0.820757
0.560974
dynamic_supervisor.ex
starcoder
defmodule Mathmatical.Runs do @moduledoc """ The Runs context. """ import Ecto.Query, warn: false alias Mathmatical.Repo alias Mathmatical.Runs.Attempt @doc """ Returns the list of attempts. ## Examples iex> list_attempts() [%Attempt{}, ...] """ def list_attempts do Repo.all(...
lib/mathmatical/runs.ex
0.853043
0.425068
runs.ex
starcoder
defmodule Wabbit.Connection do use Connection import Wabbit.Record require Logger @doc """ Starts a new connection # Connection Options * `:username` - Default is `"guest"` * `:password` - Default is `"<PASSWORD>"` * `:virtual_host` - The name of the virtual host to work with. Default is `"/"...
lib/wabbit/connection.ex
0.765506
0.471832
connection.ex
starcoder
defmodule Plaid.Institutions do @moduledoc """ Functions for Plaid `institutions` endpoint. """ import Plaid, only: [make_request_with_cred: 4, get_cred: 0, get_key: 0] alias Plaid.Utils defstruct institutions: [], request_id: nil, total: nil @type t :: %__MODULE__{institutions: [Plaid.Institutions.In...
lib/plaid/institutions.ex
0.790247
0.648703
institutions.ex
starcoder
defmodule Discord.SortedSet.Test.Support.Generator do def supported_terms(options \\ []) do term_list(supported_term(), options) end def supported_term do StreamData.one_of([ supported_term_scalars(), nested_tuple(supported_term_scalars()), nested_list(supported_term_scalars()) ]) ...
test/support/generators.ex
0.629319
0.411318
generators.ex
starcoder
defmodule SbrokerPlayground do @moduledoc """ Sbroker regulator simulator for testing various regulator configurations from iex console. ## Usage Run from `iex`: Transporter.Regulator.Simulator.run(iterations, config) Returns performance report, grouped into buckets. Each bucket contains the followi...
lib/sbroker_playground.ex
0.906161
0.612194
sbroker_playground.ex
starcoder
defmodule I18nHelpers.Ecto.Translator do @doc ~S""" Translates an Ecto struct, a list of Ecto structs or a map containing translations. Translating an Ecto struct for a given locale consists of the following steps: 1. Get the list of the fields that need to be translated from the Schema. The Schema m...
lib/ecto/translator.ex
0.804329
0.489198
translator.ex
starcoder
defmodule BorshEx.Schema do @moduledoc """ Define a Borsh schema for a given struct ## Example defmodule Data do use BorshEx.Data defstruct id: nil, sub_data: nil borsh_schema do field :id, "u16" field :sub_data, SubData end end """ @doc """ ...
lib/borsh_ex/schema.ex
0.777469
0.410963
schema.ex
starcoder
defmodule Oli.Authoring.Locks do @moduledoc """ This module provides an interface to durable write locks. These locks are durable in the sense that they will survive server restarts given that they are stored in the database. ## Scoping Locks are scoped to publication and resource. This allows the implemen...
lib/oli/authoring/locks.ex
0.863751
0.456289
locks.ex
starcoder
defmodule BambooSMTPSandbox.Email do @moduledoc """ Contains functions for creating email structures using Bamboo. This module can be considered as a Factory module. Each time we want to build a new email structure that slightly differed from the existing ones, we should add a new function here. """ impo...
lib/bamboo_smtp_sandbox/email.ex
0.859266
0.618089
email.ex
starcoder
defmodule MarsWater.Algos.SlidingWindow do def run(input) when is_binary(input) do [results_requested, grid_size | measurements] = String.split(input, " ", trim: true) |> Enum.map(& Integer.parse(&1) |> elem(0)) compute_water_scores(measurements, grid_size) |> Enum.take(results_requested) ...
elixir/elixir-mars-water/lib/algos/sliding_window.ex
0.713731
0.665854
sliding_window.ex
starcoder
defmodule ExAeonsEnd.Deck do @moduledoc " This is a generic abstraction for a deck of cards, consisting of a draw pile and a discard pile. " alias ExAeonsEnd.Card defstruct [:draw, :discard] @type t :: %__MODULE__{ draw: list(Card.t()), discard: list(Card.t()) } @type pile ...
lib/ExAeonsEnd/deck.ex
0.842669
0.440951
deck.ex
starcoder
defmodule Crontab.CronExpression do @moduledoc """ This is the Crontab.CronExpression module / struct. """ alias Crontab.CronExpression.Parser @type t :: %Crontab.CronExpression{ extended: boolean, reboot: boolean, second: [value], minute: [value], hour: [va...
lib/crontab/cron_expression.ex
0.890048
0.619126
cron_expression.ex
starcoder
defmodule Rabbit.Message do @moduledoc """ A message consumed by a `Rabbit.Consumer`. After starting a consumer, any message passed to the `c:Rabbit.Consumer.handle_message/1` callback will be wrapped in a messsage struct. The struct has the following fields: * `:consumer` - The PID of the consumer proces...
lib/rabbit/message.ex
0.886211
0.483161
message.ex
starcoder
defmodule Chunky.Geometry.Triangle do @moduledoc """ Functions for working with **triangles**. For _predicate functions_ related to Triangles, see `Chunky.Geometry.Triangle.Predicates`. Triangles in Chunky are represented as a tuple of three positive integers, with each integer greater than or equal to `1`. So `...
lib/geometry/triangle.ex
0.956022
0.96641
triangle.ex
starcoder
defmodule StarkInfra.PixInfraction do alias __MODULE__, as: PixInfraction alias StarkInfra.Utils.Rest alias StarkInfra.Utils.Check alias StarkInfra.User.Project alias StarkInfra.User.Organization alias StarkInfra.Error @moduledoc """ Groups PixInfraction related functions """ @doc """ PixInfract...
lib/pix_infraction/pix_infraction.ex
0.904533
0.579817
pix_infraction.ex
starcoder
defmodule NewRelic.Instrumented.Task.Supervisor do @moduledoc """ Provides a pre-instrumented convienince module to connect non-linked `Task.Supervisor` processes to the Transaction that called them. You may call these functions directly, or `alias` the `NewRelic.Instrumented.Task` module and continue to u...
lib/new_relic/instrumented/task/supervisor.ex
0.771327
0.753988
supervisor.ex
starcoder
defmodule Epicenter.Cases.Demographic do use Ecto.Schema import Ecto.Changeset import Epicenter.PhiValidation, only: [validate_phi: 2] alias Epicenter.Cases.Person alias Epicenter.Cases.Ethnicity @required_attrs ~w{}a @optional_attrs ~w{ dob external_id first_name last_name preferre...
lib/epicenter/cases/demographic.ex
0.550124
0.478468
demographic.ex
starcoder
if Code.ensure_loaded?(Plug) do defmodule Guardian.Plug.VerifySession do @moduledoc """ Looks for and validates a token found in the session. In the case where: a. The session is not loaded b. A token is already found for `:key` This plug will not do anything. This, like all other Guar...
lib/guardian/plug/verify_session.ex
0.73307
0.476336
verify_session.ex
starcoder
defmodule PlugEarlyHints do defmodule BadArityError do defexception [:function, :arity, :key] @impl true def message(exception) do {:arity, arity} = Function.info(exception.function, :arity) "Function passed to #{exception.key} has arity #{arity} while expected" <> "arity is #{except...
lib/plug_early_hints.ex
0.7586
0.457016
plug_early_hints.ex
starcoder
defmodule Hunter.Account do @moduledoc """ Account entity This module defines a `Hunter.Account` struct and the main functions for working with Accounts. ## Fields * `id` - the id of the account * `username` - the username of the account * `acct` - equals `username` for local users, includes `@...
lib/hunter/account.ex
0.901302
0.623492
account.ex
starcoder
defmodule ExMpesa.Stk do @moduledoc """ Lipa na M-Pesa Online Payment API is used to initiate a M-Pesa transaction on behalf of a customer using STK Push. This is the same technique mySafaricom App uses whenever the app is used to make payments. """ import ExMpesa.MpesaBase import ExMpesa.Util @doc """ ...
lib/ex_mpesa/stk.ex
0.831896
0.750804
stk.ex
starcoder
defmodule Nerves.Artifact.BuildRunners.Docker do @moduledoc """ Produce an artifact for a package using Docker. The Nerves Docker artifact build_runner will use docker to create the artifact for the package. The output in Mix will be limited to the headlines from the process and the full build log can be fou...
lib/nerves/artifact/build_runners/docker.ex
0.841565
0.469155
docker.ex
starcoder
defmodule BusDetective.GTFS.StopSearch do @moduledoc """ This module provides stop search functionality. """ import Ecto.Query import Geo.PostGIS, only: [st_distance: 2] alias BusDetective.GTFS.Substitutions @substitutions Substitutions.build_substitutions() def query_nearby(query, latitude, longitu...
apps/bus_detective/lib/bus_detective/gtfs/stop_search.ex
0.679817
0.449151
stop_search.ex
starcoder
|QUESTIONNAME| Find telephone numbers with parentheses |QUESTION| You've noticed that the club's member table has telephone numbers with very inconsistent formatting. You'd like to find all the telephone numbers that contain parentheses, returning the member ID and telephone number sorted by member ID. |QUERY| select ...
questions/string/00017500-reg.ex
0.52829
0.527986
00017500-reg.ex
starcoder
defmodule TDMS.Parser do @moduledoc """ This module is the main parser for TDMS files. TDMS files organize data in a three-level hierarchy of objects. The top level is comprised of a single object that holds file-specific information like author or title. Each file can contain an unlimited number of groups, ...
lib/parser.ex
0.876337
0.548915
parser.ex
starcoder
defmodule Membrane.Pad do @moduledoc """ Pads are units defined by elements and bins, allowing them to be linked with their siblings. This module consists of pads typespecs and utils. Each pad is described by its name, direction, availability, mode and possible caps. For pads to be linkable, these properties...
lib/membrane/pad.ex
0.910212
0.736685
pad.ex
starcoder
defmodule BSV do @moduledoc """ ![Hex.pm](https://img.shields.io/hexpm/v/bsv?color=informational) ![License](https://img.shields.io/github/license/libitx/bsv-ex?color=informational) ![Build](https://img.shields.io/github/workflow/status/libitx/bsv-ex/Elixir%20CI) BSV-ex is a general purpose library for build...
lib/bsv.ex
0.865948
0.671538
bsv.ex
starcoder
defmodule Timber do @moduledoc """ The functions in this module are high level convenience functions instended to define the broader / public API of the Timber library. It is recommended to use these functions instead of their deeper counterparts. """ alias Timber.Context alias Timber.LocalContext alia...
lib/timber.ex
0.856047
0.797754
timber.ex
starcoder
defmodule AWS.AlexaForBusiness do @moduledoc """ Alexa for Business helps you use Alexa in your organization. Alexa for Business provides you with the tools to manage Alexa devices, enroll your users, and assign skills, at scale. You can build your own context-aware voice skills using the Alexa Skills Kit an...
lib/aws/generated/alexa_for_business.ex
0.741393
0.568955
alexa_for_business.ex
starcoder
defmodule ExIban.Validators do @moduledoc """ Set of validation rules to perform on checking IBAN account number. """ import ExIban.Rules import ExIban.Parser @doc """ Performs validation checks: - length greater or equal to 5 (:too_short) - only ilegal chars used [A-Z0-9] (bad_chars) - known coun...
lib/exiban/validators.ex
0.799011
0.47591
validators.ex
starcoder
defmodule AWS.Config do @moduledoc """ AWS Config AWS Config provides a way to keep track of the configurations of all the AWS resources associated with your AWS account. You can use AWS Config to get the current and historical configurations of each AWS resource and also to get information about the rela...
lib/aws/config.ex
0.89833
0.519399
config.ex
starcoder
defmodule DarknetToOnnx.ConvParams do @moduledoc """ Helper class to store the hyper parameters of a Conv layer, including its prefix name in the ONNX graph and the expected dimensions of weights for convolution, bias, and batch normalization. Additionally acts as a wrapper for generating safe names f...
lib/darknet_to_onnx/convparams.ex
0.7478
0.716888
convparams.ex
starcoder
defmodule Hunter.Card do @moduledoc """ Card entity This module defines a `Hunter.Card` struct and the main functions for working with Cards ## Fields * `url`- the url associated with the card * `title` - the title of the card * `description` - the card description * `image` - the image ass...
lib/hunter/card.ex
0.853088
0.53783
card.ex
starcoder
defmodule Yaps.PushBackend do @moduledoc """ This module is used to define a push backend service. When used, the following options are allowed: * `:adapter` - the adapter to be used for the backend. * `:env` - configures the repository to support environments ## Example defmodule APNSBackend do ...
lib/yaps/push_backend.ex
0.806586
0.469095
push_backend.ex
starcoder
defmodule Resty.Resource.Base do alias Resty.Resource.Relations @moduledoc """ This module is used to create **resource struct** that you'll then be able to use with `Resty.Repo` and `Resty.Resource`. ## Using the module `Resty.Resource.Base` is here to help you create resource structs. The resource st...
lib/resty/resource/base.ex
0.837088
0.571318
base.ex
starcoder
defmodule Nebulex.Cache.Stats do @moduledoc """ This module defines the supported built-in stats. By default, each adapter is responsible for providing stats support. However, Nebulex suggests supporting the built-in stats described in this module, which are also supported by the built-in adapters. ## Usa...
lib/nebulex/cache/stats.ex
0.887174
0.576304
stats.ex
starcoder
defmodule Sider do @type key :: any() @type value :: any() @type args :: %{ reap_interval: pos_integer(), capacity: pos_integer(), name: atom, } | %{ name: atom, capacity: pos_integer() } | %{ ...
lib/sider.ex
0.8789
0.755141
sider.ex
starcoder
defmodule Stripe.Invoice do @moduledoc """ Work with Stripe invoice objects. You can: - Create an invoice - Retrieve an invoice - Update an invoice Does not take options yet. Stripe API reference: https://stripe.com/docs/api#invoice """ @type t :: %__MODULE__{} defstruct [ :id, :object, ...
lib/stripe/invoice.ex
0.739705
0.568805
invoice.ex
starcoder
defmodule Licensir.TableRex.Cell do @moduledoc """ Defines a struct that represents a single table cell, and helper functions. A cell stores both the original data _and_ the string-rendered version, this decision was taken as a tradeoff: this way uses more memory to store the table structure but the renderer...
lib/table_rex/cell.ex
0.878725
0.865452
cell.ex
starcoder
defmodule Zaryn.Election.HypergeometricDistribution do @moduledoc """ Hypergeometric distribution has the property to guarantee than even with 90% of malicious nodes the risk that an honest cannot detect a fraudulent transaction is only 10^-9 or once chance in one billion. (beyond the standards of the acceptabl...
lib/zaryn/election/hypergeometric_distribution.ex
0.880489
0.792103
hypergeometric_distribution.ex
starcoder
defmodule Number do @moduledoc """ Number library. """ @doc """ Round ## Examples iex> Number.round( 123 ) 123 iex> Number.round( 123.456 ) 123.456 iex> Number.round( 123.456, 2 ) 123.46 iex> Number.round( 123.456, 1 ) 123.5 """ def round( value, precision \\ -1 ) # <- default parameter functi...
lib/number.ex
0.715325
0.47658
number.ex
starcoder
defmodule MeshxRpc.Client.Worker do @moduledoc false @behaviour :gen_statem @behaviour :poolboy_worker alias MeshxRpc.App.T alias MeshxRpc.Common.{Telemetry, Structs.Data, Structs.Svc} alias MeshxRpc.Protocol.{Hsk, Block.Decode, Block.Encode} @error_prefix :error_rpc @error_prefix_remote :error_rpc_rem...
lib/client/worker.ex
0.625095
0.438545
worker.ex
starcoder
defmodule Tox.NaiveDateTime do @moduledoc """ A set of functions to work with `NaiveDateTime`. """ alias Tox.IsoDays @doc """ Shifts the `naive_datetime` by the given `duration`. The `durations` is a keyword list of one or more durations of the type `Tox.duration` e.g. `[year: 1, day: 5, minute: 500...
lib/tox/naive_datetime.ex
0.923351
0.598928
naive_datetime.ex
starcoder
defmodule SpiderMan do @moduledoc """ SpiderMan, a fast high-level web crawling & scraping framework for Elixir. ## Components Each Spider had 3 components, each component has theirs work: * [Downloader](SpiderMan.Component.Downloader.html): Download request. * [Spider](SpiderMan.Component.Spider.html): A...
lib/spider_man.ex
0.859162
0.463019
spider_man.ex
starcoder
defmodule ExGherkin.Scanner do @moduledoc false alias __MODULE__.{ Context, SyntaxError, Token, Utils } def tokenize!(content), do: tokenize(content) def tokenize!(content, context = %Context{}), do: tokenize(content, context) def tokenize(content), do: tokenize(content, Context.new()) ...
lib/scanner/scanner.ex
0.706798
0.729077
scanner.ex
starcoder
defmodule MAVLink.Utils do @moduledoc ~s""" MAVLink support functions used during code generation and runtime Parts of this module are ported from corresponding implementations in mavutils.py """ use Bitwise, only_operators: true import List, only: [flatten: 1] import Enum, only: [sort_by: 2...
lib/mavlink/utils.ex
0.677687
0.415907
utils.ex
starcoder
defmodule Membrane.Caps.Audio.MPEG do @moduledoc """ This module implements struct for caps representing MPEG audio stream. See [MPEG Frame header documentation](https://www.mp3-tech.org/programmer/frame_header.html) """ @compile {:inline, [ samples_per_frame: 2, soun...
lib/membrane_caps_audio_mpeg.ex
0.880714
0.415492
membrane_caps_audio_mpeg.ex
starcoder
defmodule Statistics.Distributions.Hypergeometric do @moduledoc """ Hypergeometric distribution. It models the probability that an n numbers of trials result in exactly k successes, with a population of pn items, where pk are considered as successes. """ alias Statistics.Math @doc """ The probabili...
lib/statistics/distributions/hypergeometric.ex
0.847021
0.693187
hypergeometric.ex
starcoder
defmodule AWS.ECRPUBLIC do @moduledoc """ Amazon Elastic Container Registry Public Amazon Elastic Container Registry (Amazon ECR) is a managed container image registry service. Amazon ECR provides both public and private registries to host your container images. You can use the familiar Docker CLI, or th...
lib/aws/generated/ecrpublic.ex
0.885155
0.430985
ecrpublic.ex
starcoder
defmodule Volley.InOrderSubscription do @moduledoc """ A subscription which guarantees ordering An in-order subscription consumes an EventStoreDB stream in order, as if subscribed via `Spear.subscribe/4`. InOrder subscriptions are simpler than persistent subscriptions and can be used in cases where unordered...
lib/volley/in_order_subscription.ex
0.890622
0.911535
in_order_subscription.ex
starcoder
defmodule NYSETL.Engines.E4.Transfer do alias NYSETL.Commcare alias NYSETL.Extra @doc """ Looks for an existing index case for the provided case_id and county_id, and returns it if found. Otherwise, creates a new index case and lab results that mirror an index case and lab results that have been transferred...
lib/nys_etl/engines/e4/transfer.ex
0.521959
0.612484
transfer.ex
starcoder
defmodule Sparklinex.Bar do alias Sparklinex.Bar.Options alias Sparklinex.ChartData alias Sparklinex.MogrifyDraw def draw(data, spec = %Options{height: height, background_color: background_color}) do spec_with_width = %{spec | width: width(data, spec)} normalized_data = ChartData.normalize_data(data, :...
lib/sparklinex/bar.ex
0.704058
0.499268
bar.ex
starcoder
defmodule Cassandrax.Query do @moduledoc """ Provides the query macros. Queries are used to retrieve or manipulate data from a repository (see Cassandrax.Keyspace). """ alias Cassandrax.Query.Builder @type t :: %__MODULE__{} @limit_default 100 @per_partition_limit_default 100 defstruct schema:...
lib/cassandrax/query.ex
0.921534
0.901314
query.ex
starcoder
defmodule TicTacToe.Board do @moduledoc """ Functions for interacting with a board. """ @type t :: triplet(triplet()) @type triplet(triple) :: [triple] @type triplet :: [nil | player()] @type player :: :player1 | :computer @type position :: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 @type point :: {0 | 1 | 2,...
lib/tic_tac_toe/board.ex
0.8899
0.682871
board.ex
starcoder
defmodule ExploringMars.Mission.Direction do @moduledoc """ This module defines functions that create and operate on directions in the probe's coordinate space. This module should change if the coordinate representation used in the problem changes in degrees of freedom - for instance, if we decide the probe ...
lib/exploring_mars/mission/direction.ex
0.924993
0.960988
direction.ex
starcoder
defmodule Plaid.Investments.Transactions do @moduledoc """ Functions for Plaid `investments/transactions` endpoints. """ import Plaid, only: [make_request_with_cred: 4, validate_cred: 1] alias Plaid.Utils @derive Jason.Encoder defstruct accounts: [], item: nil, securities: [], ...
lib/plaid/investments/transactions.ex
0.800926
0.611164
transactions.ex
starcoder