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 ReviewScraper do @moduledoc """ Exposes functions to fetch overly positive reviews. """ alias ReviewScraper.DealerRater.{Client, Review, Scraper} @doc """ Fetchs the reviews from DealerRater.com and returns the most positive reviews. Accepts the following options: - `:pages_to_fetch`: Nu...
lib/review_scraper.ex
0.809577
0.674235
review_scraper.ex
starcoder
defmodule Unplug do @moduledoc """ The purpose of `Unplug` is to provide a wrapper around any arbitrary plug, with the ability to conditionally execute that plug at run-time. The runtime conditions that are leveraged by `Unplug` must conform to the `Unplug.Predicate` behaviour. Out of the box `Unplug` comes w...
lib/unplug.ex
0.751648
0.770724
unplug.ex
starcoder
defmodule Cabbage.Feature do @moduledoc """ An extension on ExUnit to be able to execute feature files. ## Configuration In `config/test.exs` config :cabbage, # Default is "test/features/" features: "my/path/to/features/" # Default is [] global_tags: :integration - `f...
lib/cabbage/feature.ex
0.867892
0.651022
feature.ex
starcoder
defmodule Membrane.ParentSpec do @moduledoc """ Structure representing the topology of a pipeline/bin. It can be incorporated into a pipeline or a bin by returning `t:Membrane.Pipeline.Action.spec_t/0` or `t:Membrane.Bin.Action.spec_t/0` action, respectively. This commonly happens within `c:Membrane.Pipeline...
lib/membrane/parent_spec.ex
0.947588
0.879923
parent_spec.ex
starcoder
defmodule Scenic.Math.Line do @moduledoc """ A collection of functions to work with lines. Lines are always two points in a tuple. {point_a, point_b} {{x0,y0}, {x1,y1}} """ alias Scenic.Math # import IEx @app Mix.Project.config()[:app] # @env Mix.env # load the NIF @compile {...
lib/scenic/math/line.ex
0.875574
0.520557
line.ex
starcoder
defmodule Circuits.UART do use GenServer # Many calls take timeouts for how long to wait for reading and writing # serial ports. This is the additional time added to the GenServer message passing # timeout so that the interprocess messaging timers don't hit before the # timeouts on the actual operations. @...
lib/circuits_uart.ex
0.806624
0.697168
circuits_uart.ex
starcoder
defmodule IntCode do @moduledoc """ Executes the intcode """ def sum(x, y) do {x + y, 4} end def mul(x, y) do {x * y, 4} end def less_than(x, y) do {(if x < y, do: 1, else: 0), 4} end def equals(x, y) do {(if x == y, do: 1, else: 0), 4} end def parse_program(program) do p...
lib/intcode.ex
0.570212
0.594434
intcode.ex
starcoder
defmodule Membrane.RTP.H264.StapA do @moduledoc """ Module responsible for parsing Single Time Agregation Packets type A. Documented in [RFC6184](https://tools.ietf.org/html/rfc6184#page-22) ``` 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1...
lib/rtp_h264/nal_formats/stap_a.ex
0.732305
0.716962
stap_a.ex
starcoder
defmodule VintageNet.IP do @moduledoc """ This module contains utilities for handling IP addresses. By far the most important part of handling IP addresses is to pay attention to whether your addresses are names, IP addresses as strings or IP addresses at tuples. This module doesn't resolve names. While IP...
lib/vintage_net/ip.ex
0.887774
0.471345
ip.ex
starcoder
defmodule Mix.Tasks.Snoop do use Mix.Task @moduledoc """ A tool for snooping on DHCP transactions that are passing by this particular connected device. ## Usage Run this mix task on a device on the same layer-2 network as the network where you'd like to watch DHCP packets go by. It's probably a good ...
lib/mix.tasks.snoop.ex
0.764188
0.689456
mix.tasks.snoop.ex
starcoder
defmodule ST7789 do @moduledoc """ ST7789 Elixir driver """ use Bitwise @enforce_keys [:spi, :gpio, :opts] defstruct [:spi, :gpio, :opts] @doc """ New connection to an ST7789 - **port**: SPI port number Default value: `0` - **cs**: SPI chip-select number (0 or 1 for BCM). Default valu...
lib/st7789_elixir.ex
0.916367
0.867092
st7789_elixir.ex
starcoder
defmodule GrovePi.RGBLCD do @moduledoc """ Conveniences for controlling a RGB LCD Display. The display should be connected to the I2C-1 port. Example usage: ``` iex> {:ok, config} = GrovePi.RGBLCD.initialize() {:ok, %GrovePi.RGBLCD.Config{display_control: 12, entry_mode: 6, function: 56}} iex> {:ok, n...
lib/grovepi/rgblcd.ex
0.766337
0.580352
rgblcd.ex
starcoder
defmodule SoftBank.Entry do @moduledoc """ Entries are the recording of account debits and credits and can be considered as consituting a traditional accounting Journal. """ @type t :: %__MODULE__{ description: String.t(), date: Ecto.Date.t() } use Ecto.Schema import Ecto.Ch...
lib/repos/Bank/Entry.ex
0.821689
0.505615
Entry.ex
starcoder
defmodule ChessApp.Chess.Move do defstruct [:to,:from,:promotion,:chesspiece,:special,:side,:capture] alias ChessApp.Chess.Board alias ChessApp.Chess.Move import ChessApp.Chess.Board.Macros def from_algebraic_notation(an,board = %Board{}) do codes = String.downcase(an) |> String.codepoints wit...
lib/chess_app/chess/move.ex
0.602412
0.542379
move.ex
starcoder
defmodule Game.Lobby do @moduledoc """ Game lobby """ alias Game.{ Lobby, Settings } @pids 2 @type t :: %Lobby{ uuid: String.t(), turn: integer(), user: User.t(), status: :creating | :waiting | :playing | :finished, settings: Settings.t(), ...
src/server/lib/game/lobby.ex
0.621656
0.436862
lobby.ex
starcoder
defmodule Bolt.Cogs.Role.Allow do @moduledoc false @behaviour Nosedrum.Command alias Bolt.Converters alias Bolt.Helpers alias Bolt.Humanizer alias Bolt.ModLog alias Bolt.Repo alias Bolt.Schema.SelfAssignableRoles alias Nosedrum.Predicates alias Nostrum.Api @impl true def usage, do: ["role all...
lib/bolt/cogs/role/allow.ex
0.852091
0.522507
allow.ex
starcoder
defmodule Liberator.Trace do import Plug.Conn require Logger @moduledoc """ Decision tracing functions. """ @doc """ Get the log of all decisions made on the given conn. The trace is a list of maps, each map corresponding to one call to a decision function. Each map has the following keys: - `:...
lib/liberator/trace.ex
0.73659
0.527986
trace.ex
starcoder
defmodule RDF.XSD.Datatype.Primitive do @moduledoc """ Macros for the definition of primitive XSD datatypes. """ @doc """ Specifies the applicability of the given XSD `facet` on a primitive datatype. For a facet with the name `example_facet` this requires a function def example_facet_conform?(examp...
lib/rdf/xsd/datatype/primitive.ex
0.910545
0.637976
primitive.ex
starcoder
defprotocol Nestru.Decoder do @fallback_to_any true @doc """ Returns the hint of how to decode the struct fields. The first argument is an empty struct value adopting the protocol. The second argument is the context value given to the `Nestru.from_map/3` function call. The third argument is a map to be ...
lib/nestru/decoder.ex
0.883519
0.870927
decoder.ex
starcoder
defmodule AshPolicyAuthorizer.Checker do @moduledoc """ Determines if a set of authorization requests can be met or not. To read more about boolean satisfiability, see this page: https://en.wikipedia.org/wiki/Boolean_satisfiability_problem. At the end of the day, however, it is not necessary to understand ex...
lib/ash_policy_authorizer/checker.ex
0.779196
0.40928
checker.ex
starcoder
defmodule Ecto.Query do @moduledoc ~S""" Fake Query module. """ @doc """ Creates a query. """ defmacro from(expr, kw \\ []) do {expr, kw} end @doc """ A select query expression. Selects which fields will be selected from the schema and any transformations that should be performed on the f...
test/support/plugins/ecto/query.ex
0.869507
0.653963
query.ex
starcoder
defmodule Bonny.CRD do @moduledoc """ Represents the `spec` portion of a Kubernetes [CustomResourceDefinition](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/) manifest. > The CustomResourceDefinition API resource allows you to define custom resources. Definin...
lib/bonny/crd.ex
0.841386
0.692239
crd.ex
starcoder
defmodule Saucexages.IO.SauceFile do @moduledoc """ Functions for handling SAUCE files in the file system. Any devices passed are assumed to be file descriptors that are opened using `:read` and `:binary` at the minimum. SAUCE does not use UTF-8 files, so do not pass such devices or you risk incorrect behavior...
lib/saucexages/io/sauce_file.ex
0.706899
0.455804
sauce_file.ex
starcoder
import TypeClass defclass Witchcraft.Comonad do @moduledoc """ The dual of monads, `Comonad` brings an unwrapping function to `Extend`able data. Note that the unwrapping function (`extract`) *must return a value*, and is not available on many data structres that have an empty element. For example, there is ...
lib/witchcraft/comonad.ex
0.78345
0.503906
comonad.ex
starcoder
defmodule Nostrum.Cache.GuildCache do @moduledoc """ Functions for retrieving guild states. """ alias Nostrum.Cache.Guild.GuildServer alias Nostrum.Cache.Mapping.ChannelGuild alias Nostrum.Struct.Channel alias Nostrum.Struct.Guild alias Nostrum.Struct.Message alias Nostrum.Util import Nostrum.Stru...
lib/nostrum/cache/guild_cache.ex
0.811863
0.574902
guild_cache.ex
starcoder
defmodule Extract.Context do @moduledoc """ The extraction process is a reduce, and this module is its accumulator. ## Fields * `response` - Response of the last action in the reduce. This field should be overwritten, not accumulated. * `variables` - A `Map` accumulation of variable names and values. T...
apps/protocol_extract_step/lib/extract/context.ex
0.778986
0.577704
context.ex
starcoder
defmodule Annotations.Annotation do @moduledoc """ Module defining annotations for a String buffer. Use this to annotate Strings. An annotation associates a range delimited by * `from` represents the first index [inclusive] * `to` represents one past the last index [exclusive] with information struct...
lib/annotations/annotation.ex
0.778944
0.677221
annotation.ex
starcoder
defmodule AWS.CertificateManager do @moduledoc """ AWS Certificate Manager Welcome to the AWS Certificate Manager (ACM) API documentation. You can use ACM to manage SSL/TLS certificates for your AWS-based websites and applications. For general information about using ACM, see the [ *AWS Certificate Manag...
lib/aws/certificate_manager.ex
0.889487
0.579847
certificate_manager.ex
starcoder
defmodule Livebook.Utils.Time do @moduledoc false # A simplified version of https://gist.github.com/tlemens/88e9b08f62150ba6082f478a4a03ac52 @doc """ Formats the given point in time relatively to present. """ @spec time_ago_in_words(NaiveDateTime.t()) :: String.t() def time_ago_in_words(naive_date_time)...
lib/livebook/utils/time.ex
0.894083
0.520679
time.ex
starcoder
defmodule Wabbit.Basic do @moduledoc """ Functions to publish, consume and acknowledge messages. """ require Record import Wabbit.Record Record.defrecordp :amqp_msg, [props: p_basic(), payload: ""] @doc """ Publishes a message to an Exchange. This method publishes a message to a specific exchange....
lib/wabbit/basic.ex
0.886887
0.597256
basic.ex
starcoder
defmodule Bundlex.Project do @bundlex_file_name "bundlex.exs" @moduledoc """ Behaviour that should be implemented by each project using Bundlex in the `#{@bundlex_file_name}` file. """ use Bunch alias Bunch.KVList alias Bundlex.Helper.MixHelper alias __MODULE__.{Preprocessor, Store} @src_dir_name "...
lib/bundlex/project.ex
0.842248
0.41052
project.ex
starcoder
defmodule Spear.Connection.Configuration do @default_mint_opts [protocols: [:http2], mode: :active] @moduledoc """ Configuration for `Spear.Connection`s ## Options * `:name` - the name of the GenServer. See `t:GenServer.name/0` for more information. When not provided, the spawned process is not aliased ...
lib/spear/connection/configuration.ex
0.86306
0.52007
configuration.ex
starcoder
defmodule Serum.HeaderParser do @moduledoc false _moduledocp = """ This module takes care of parsing headers of page (or post) source files. Header is where all page or post metadata goes into, and has the following format: ``` --- key: value ... --- ``` where `---` in the first and last lin...
lib/serum/header_parser.ex
0.840029
0.890865
header_parser.ex
starcoder
defmodule Stargate.Producer.Acknowledger do @moduledoc """ By default, `Stargate.produce/2` will block the calling process until acknowledgement is received from Pulsar that the message was successfully produced. This can optionally switch to an asynchronous acknowledgement by passing an MFA tuple to `Starg...
lib/stargate/producer/acknowledger.ex
0.85166
0.404096
acknowledger.ex
starcoder
defmodule ArrowWeb.DisruptionView.DaysOfWeek do @moduledoc "Handles the display of disruption `days_of_week`." alias Arrow.Disruption.DayOfWeek @doc "Describes each day-of-week of a disruption and its time period." @spec describe([DayOfWeek.t()]) :: [{String.t(), String.t()}] def describe(days_of_week) when...
lib/arrow_web/views/disruption_view/days_of_week.ex
0.890109
0.623205
days_of_week.ex
starcoder
defmodule List do @moduledoc """ Implements functions that only make sense for lists and cannot be part of the Enum protocol. In general, favor using the Enum API instead of List. A decision was taken to delegate most functions to Erlang's standard lib but following Elixir's convention of receiving the t...
lib/elixir/lib/list.ex
0.842798
0.691972
list.ex
starcoder
defmodule Multiaddr.Codec do @moduledoc false import Multiaddr.Utils.Varint import Multiaddr.Utils alias Multiaddr.Protocol, as: Prot defp list_protocols(bytes, protocols) when bytes == <<>> do {:ok, protocols} end defp list_protocols(bytes, protocols) when is_binary(bytes) do case read_raw_pro...
lib/codec.ex
0.57821
0.441432
codec.ex
starcoder
defmodule Expression.DateHelpers do @moduledoc false import NimbleParsec def date_separator do choice([ string("-"), string("/") ]) end def us_date do integer(2) |> ignore(date_separator()) |> integer(2) |> ignore(date_separator()) |> integer(4) end def us_time d...
lib/date_helpers.ex
0.705684
0.42668
date_helpers.ex
starcoder
defmodule Astarte.Flow.Flows.DETSStorage do use GenServer alias Astarte.Flow.Config @behaviour Astarte.Flow.Flows.Storage @table_name :flows def start_link(args) do GenServer.start_link(__MODULE__, args, name: __MODULE__) end @impl true @doc "Return a list of all saved Flows in the form `{real...
lib/astarte_flow/flows/dets_storage.ex
0.778902
0.44348
dets_storage.ex
starcoder
defmodule EdgeDB.Protocol.Codecs.Builtin.Array do use EdgeDB.Protocol.Codec import EdgeDB.Protocol.Types.{ ArrayElement, Dimension } alias EdgeDB.Protocol.{ Datatypes, Error, Types } @reserved0 0 @reserved1 0 @empty_list_iodata [ Datatypes.Int32.encode(0), Datatypes.Int32....
lib/edgedb/protocol/codecs/builtin/array.ex
0.663015
0.408749
array.ex
starcoder
defmodule Gateway.Router.Portal.Commands.Handler.Wallet do @moduledoc ~S""" Processes the HTTP based requests and sends them to the correct handler. The handler or business logic is broken out of http request so I can change API versions later on but still keep backwards compatability support if possible "...
src/apps/gateway/lib/gateway/router/portal/commands/handler/wallet.ex
0.667581
0.428233
wallet.ex
starcoder
defmodule CssParser do import CssParser.File alias CssParser.Cache @moduledoc """ Provides css parsing in Elixir. CssParser was inspired by css.js (a lightweight, battle tested, fast, css parser in JavaScript). More information can be found at https://github.com/jotform/css.js. ### Adding CssParser ...
lib/css_parser.ex
0.802517
0.643609
css_parser.ex
starcoder
defmodule Jsonrpc.Request do @moduledoc """ `Jsonrpc.Request` represents a JSONRPC 2.0 request, as documented in the [JSON-RPC 2.0 specification](https://www.jsonrpc.org/specification#request_object) """ import Injector inject System @type t :: %__MODULE__{ jsonrpc: String.t(), metho...
lib/jsonrpc/request.ex
0.883895
0.713007
request.ex
starcoder
defmodule VelocyPack.Decoder do @moduledoc false # The implementation of this decoder is heavily inspired by that of Jason (https://github.com/michalmuskala/jason) use Bitwise alias VelocyPack.{Codegen, Error} import Codegen, only: [bytecase: 2] @spec parse(binary(), keyword()) :: {:ok, any()} | {:error,...
lib/velocy_pack/decoder.ex
0.524151
0.519643
decoder.ex
starcoder
defmodule Grizzly.CommandClass.Time.OffsetSet do @moduledoc """ Command module for working with TIME OFFSET_SET command. command options: * `:sign_tzo` - This field is used to indicate the sign (plus or minus) to apply to the Hour TZO and Minute TZO field * `:hour_tzo` - This field is used to ind...
lib/grizzly/command_class/time/offset_set.ex
0.871966
0.591015
offset_set.ex
starcoder
defmodule Phoenix.LiveView.Static do # Holds the logic for static rendering. @moduledoc false alias Phoenix.LiveView.{Socket, Utils, Diff} # Token version. Should be changed whenever new data is stored. @token_vsn 2 # Max session age in seconds. Equivalent to 2 weeks. @max_session_age 1_209_600 @doc...
lib/phoenix_live_view/static.ex
0.909884
0.474388
static.ex
starcoder
defmodule Tesla.Middleware.Logger.Formatter do @moduledoc false # Heavily based on Elixir's Logger.Formatter # https://github.com/elixir-lang/elixir/blob/v1.6.4/lib/logger/lib/logger/formatter.ex @default_format "$method $url -> $status ($time ms)" @keys ~w(method url status time) @type format :: [atom |...
lib/tesla/middleware/logger.ex
0.900455
0.598283
logger.ex
starcoder
defmodule Phoenix.HTML.Form do @moduledoc ~S""" Helpers related to producing HTML forms. The functions in this module can be used in three distinct scenario: * with model data - when information to populate the form comes from a model * with connection data - when a form is created based ...
lib/phoenix/html/form.ex
0.86712
0.691302
form.ex
starcoder
defmodule ForthVM do @moduledoc """ A toy Forth-like virtual machine. I have written it to experiment implementing a stack-based preemtive multitasking interpreter (and to play) with Elixir. """ @doc """ Starts a new VM supervisor, initializin `num_cores` cores. ## Examples ForthVM.start(num_cores...
lib/forthvm.ex
0.805823
0.472623
forthvm.ex
starcoder
defmodule OverDB.Protocol.V4.Frames.Requests.Query do @moduledoc """ Documentation for Query. Performs a CQL query. The body of the message must be: <query><query_parameters> where <query> is a [long string] representing the query and <query_parameters> must be <consistency><flags>[<n>[name_1]<value_...
lib/protocol/v4/frames/requests/query.ex
0.821725
0.601681
query.ex
starcoder
defmodule Conduit.Encoding do @moduledoc """ Encodes and decodes a message body based on the content encoding given. Custom content encodings can be specified in your configuration. config :conduit, Conduit.Encoding, [{"custom", MyApp.CustomEncoding}] Note that any new content encodings specified in th...
lib/conduit/encoding.ex
0.886862
0.430327
encoding.ex
starcoder
defmodule Phoenix.HTML do @moduledoc """ Helpers for working with HTML strings and templates. When used, it imports the given modules: * `Phoenix.HTML`- functions to handle HTML safety; * `Phoenix.HTML.Tag` - functions for generating HTML tags; * `Phoenix.HTML.Form` - functions for working with fo...
deps/phoenix_html/lib/phoenix_html.ex
0.758376
0.525612
phoenix_html.ex
starcoder
defmodule Akd.Build.Release do @moduledoc """ A native Hook module that comes shipped with Akd. This module uses `Akd.Hook`. Provides a set of operations that build a distillery release for a given app at a deployment's `build_at` destination. This hook assumes that a distillery rel config file, `rel/conf...
lib/akd/base/build/release.ex
0.869576
0.537891
release.ex
starcoder
defmodule Bolt.Sips.Internals.PackStream.Utils do alias Bolt.Sips.Internals.PackStream.Encoder alias Bolt.Sips.Types.Duration alias Bolt.Sips.Internals.PackStreamError defmacro __using__(_options) do quote do import unquote(__MODULE__) # catch all clause for encoding implementation defp ...
lib/bolt_sips/internals/pack_stream/utils.ex
0.780202
0.44065
utils.ex
starcoder
defmodule PaperTrail do alias PaperTrail.Version alias PaperTrail.Serializer defdelegate get_version(record), to: PaperTrail.VersionQueries defdelegate get_version(model_or_record, id_or_options), to: PaperTrail.VersionQueries defdelegate get_version(model, id, options), to: PaperTrail.VersionQueries defde...
lib/paper_trail.ex
0.840292
0.461381
paper_trail.ex
starcoder
defmodule LibraryFees do @spec datetime_from_string(binary) :: :incompatible_calendars | :invalid_date | :invalid_format | :invalid_time | NaiveDateTime.t() def datetime_from_string(string) do {_status, datetime} = NaiveDateTime.from_iso8601(string) datetime...
library-fees/lib/library_fees.ex
0.743168
0.404802
library_fees.ex
starcoder
defmodule MediaSample.Search.Definition do @indices %{ "ja" => [ settings: [ index: [ analysis: [ filter: [ pos_filter: [type: "kuromoji_part_of_speech", stoptags: ["助詞-格助詞-一般", "助詞-終助詞"]], greek_lowercase_filter: [type: "lowercase", language: "greek...
lib/media_sample/search/definition.ex
0.530966
0.477189
definition.ex
starcoder
defmodule Dict do @moduledoc ~S""" WARNING: this module is deprecated. If you need a general dictionary, use the `Map` module. If you need to manipulate keyword lists, use `Keyword`. To convert maps into keywords and vice-versa, use the `new` function in the respective modules. """ @type key :: any ...
lib/elixir/lib/dict.ex
0.597138
0.435781
dict.ex
starcoder
defmodule Conqueuer.Pool do @moduledoc """ Use this mixin to define a poolboy pool and supervisor. Given you want a pool named `:resolvers` and will define a worker named `MyApp.ResolverWorker`: defmodule MyApp.ResolversPoolSupervisor do use Conqueuer.Pool, name: :resolvers, ...
lib/conqueuer/pool.ex
0.694613
0.610526
pool.ex
starcoder
defmodule Tarearbol.DynamicManager do @moduledoc ~S""" The scaffold implementation to dynamically manage many similar tasks running as processes. It creates a main supervisor, managing the `GenServer` holding the state and `DynamicSupervisor` handling chidren. It has a strategy `:rest_for_one`, assuming th...
lib/tarearbol/dynamic_management/dynamic_manager.ex
0.895984
0.5816
dynamic_manager.ex
starcoder
defmodule Day11.Grid do @empty "L" @occupied "#" @space "." @seats [@empty, @occupied] def seat?(row, col, grid), do: Map.get(grid, {row, col}) in @seats def move(-1, _col, _delta, _area), do: {-1, -1} def move(_row, -1, _delta, _area), do: {-1, -1} def move(row, _col, _delta, {numrows, _, _}) when r...
2020/day11/lib/day11.ex
0.561215
0.625838
day11.ex
starcoder
defmodule ExWire.Message.Pong do @moduledoc """ A wrapper for ExWire's `Pong` message. """ alias ExWire.Struct.Endpoint @message_id 0x02 defstruct [ to: nil, hash: nil, timestamp: nil, ] @type t :: %__MODULE__{ to: Endpoint.t, hash: binary(), timestamp: integer() } @spec...
apps/ex_wire/lib/ex_wire/message/pong.ex
0.88113
0.418162
pong.ex
starcoder
defmodule Cassandrax.Query.Builder do @moduledoc """ Builds query clauses and adds them to a `Cassandrax.Query` """ @doc """ Converts the given `data` into a query clause and adds it to the given `Cassandrax.Query`. """ def build(type, queryable, {:^, _, [var]}) do quote do fragment = Cassandra...
lib/cassandrax/query/builder.ex
0.675978
0.53279
builder.ex
starcoder
defmodule Rummage.Ecto.Hook do @moduledoc """ This module defines a behaviour that `Rummage.Ecto.Hook`s have to follow. This module also defines a `__using__` macro which mandates certain behaviours for a `Hook` module to follow. Native hooks that come with `Rummage.Ecto` follow this behaviour. Custom Se...
lib/rummage_ecto/hook.ex
0.802091
0.891434
hook.ex
starcoder
defmodule CSMT.Utils do @moduledoc """ Utility functions required by `CSMT.Merkle`, `CSMT.Log`, `CSMT.Map`. """ @type tree :: CSMT.Types.tree() @type tree_node :: CSMT.Types.tree_node() @type backend :: CSMT.Types.backend() @type hash_algorithm :: CSMT.Types.hash_algorithm() @type hash :: CSMT.Typ...
lib/utils.ex
0.880912
0.574544
utils.ex
starcoder
defmodule Timex.Parse.DateTime.Parser do @moduledoc """ This is the base plugin behavior for all Timex date/time string parsers. """ import Combine.Parsers.Base, only: [eof: 0, map: 2, pipe: 2] alias Timex.{Timezone, TimezoneInfo, AmbiguousDateTime, AmbiguousTimezoneInfo} alias Timex.Parse.ParseError ali...
lib/parse/datetime/parser.ex
0.880116
0.511839
parser.ex
starcoder
defmodule MathHelper do @moduledoc """ Simple functions to help with common math functions. """ @decimal_context %Decimal.Context{precision: 1_000} @spec sub(integer(), integer()) :: integer() def sub(num1, num2) do op = fn x1, x2 -> Decimal.sub(x1, x2) end decimal_operation(num1, num2, op) en...
apps/evm/lib/math_helper.ex
0.866514
0.667561
math_helper.ex
starcoder
defmodule Sanbase.Clickhouse.HistoricalBalance.Behaviour do @moduledoc ~s""" Behavior for defining the callback functions for a module implemening historical balances for a given blockchain. In order to add a new blockchain the following steps must be done: - Implement the behaviour - Add dispatch logic in...
lib/sanbase/clickhouse/historical_balance/behaviour.ex
0.913223
0.510435
behaviour.ex
starcoder
defmodule Dynamo.Connection.Behaviour do @moduledoc """ Common behaviour used between `Dynamo.Connection` connection implementations. When used, it defines a private record via `Record.defrecordp` named `connection` with the following fields and their default values: * assigns - an empty list * params - ...
lib/dynamo/connection/behaviour.ex
0.815122
0.440951
behaviour.ex
starcoder
defmodule FunLand.Chainable do @moduledoc """ Defines a 'chain' operation to apply a function that takes a simple value and outputs a new Chainable to a value inside a Chainable. Something that is Chainable also needs to be Appliable. ## Fruit Salad Example There is one problem we haven't covered yet: Wha...
lib/fun_land/chainable.ex
0.78838
0.89096
chainable.ex
starcoder
defmodule P1 do alias P1.Parser, as: Parser @moduledoc """ P1 is a communication standard for Dutch Smartmeters Whenever a serial connection is made with the P1 port, the Smartmeter is sending out a telegram every 10 seconds. This library is able to parse this telegram and produces elixir types and st...
lib/p1.ex
0.907753
0.888469
p1.ex
starcoder
defmodule Astar do alias Astar.HeapMap require HeapMap.Pattern @moduledoc """ A* graph pathfinding. """ @type vertex :: any @type nbs_f :: ((vertex) -> [vertex]) @type distance_f :: ((vertex,vertex) -> non_neg_integer) @type env :: {nbs_f, distance_f, distance_f} @doc """ ...
lib/astar.ex
0.795539
0.647666
astar.ex
starcoder
defmodule AWS.ElasticLoadBalancing do @moduledoc """ Elastic Load Balancing A load balancer can distribute incoming traffic across your EC2 instances. This enables you to increase the availability of your application. The load balancer also monitors the health of its registered instances and ensures that ...
lib/aws/elastic_load_balancing.ex
0.923364
0.582788
elastic_load_balancing.ex
starcoder
defmodule Mix.Tasks.Netler.New do @moduledoc """ Creates a new embedded .NET project and an Elixir module for communicating with the .NET project ## Usage ```bash > mix netler.new ``` """ use Mix.Task alias Netler.Compiler.Dotnet @impl true def run(_args) do dotnet_project = Mix.Shel...
lib/mix/tasks/netler.new.ex
0.688887
0.50592
netler.new.ex
starcoder
defmodule Baseball.Base64.Decoder do @moduledoc """ Functions for Base64 Decoding The base64 encoded input should have a length that is divisible by 4, since it is emitted in 4-character chunks. 1 base64-encoded character represents 6 bits, and 1 base64-decoded character represents 8 bits. So 4 base64-encode...
lib/baseball/base64/decoder.ex
0.801315
0.536677
decoder.ex
starcoder
defmodule AWS.AppStream do @moduledoc """ Amazon AppStream 2.0 You can use Amazon AppStream 2.0 to stream desktop applications to any device running a web browser, without rewriting them. """ @doc """ Associates the specified fleet with the specified stack. """ def associate_fleet(client, input, op...
lib/aws/appstream.ex
0.860076
0.40698
appstream.ex
starcoder
defmodule ExJsonSchema.Schema do defmodule UnsupportedSchemaVersionError do defexception message: "unsupported schema version, only draft 4 is supported" end defmodule InvalidSchemaError do defexception message: "invalid schema" end alias ExJsonSchema.Schema.Draft4 alias ExJsonSchema.Schema.Root ...
lib/ex_json_schema/schema.ex
0.731251
0.450239
schema.ex
starcoder
defmodule OMG.Watcher.Web.Serializer.Response do @moduledoc """ Serializes the response into expected result/data format. """ @type response_result_t :: :success | :error @doc """ Append result of operation to the response data forming standard api response structure """ @spec serialize(any(), respon...
apps/omg_watcher/lib/web/serializers/response.ex
0.843557
0.5083
response.ex
starcoder
defmodule FileType do @moduledoc """ Detect the MIME type of a file based on it's content. """ import FileType.Utils.Hex @required_bytes 262 @enforce_keys [:ext, :mime] defstruct [:ext, :mime] @type ext :: binary() @type mime :: binary() @type t :: {ext(), mime()} @type error :: File.posix() |...
lib/file_type.ex
0.787605
0.422981
file_type.ex
starcoder
defmodule Isbndbex do use GenServer alias Isbndbex.Api, as: Api @doc """ Starts a process with the given API `key`. """ def start(key), do: GenServer.start_link(__MODULE__, key) @doc """ Sends a message to the process `pid` to get the book with the given `id`. The `id` can be the books's isbn10, is...
lib/isbndbex.ex
0.86575
0.682157
isbndbex.ex
starcoder
defmodule ExPcap.Binaries do @moduledoc """ This module provides utility functions for dealing with binaries. """ @doc """ Converts a list of bytes to a binary. Ideally, this would be replaced by a standard elixir function, but I have not been able to find such a function in the standard library. ...
lib/expcap/binaries.ex
0.718496
0.644882
binaries.ex
starcoder
defmodule NarouEx.Narou.API.Queries do @moduledoc """ Data representation of API query strings. """ @type user_id :: pos_integer() @type user_ids :: list(user_id) | [] @default_response_format :json defstruct( gzip: 5, out: @default_response_format, of: nil, lim: 20, st: 1, opt...
lib/narou/api/queries.ex
0.728748
0.747662
queries.ex
starcoder
defmodule Optimal.Type do @moduledoc """ Exposes functions for validating types, and determining if a value matches a type. """ @scalar_types [ :any, :atom, :binary, :bitstring, :boolean, :float, :function, :int, :integer, :keyword, :list, :map, nil, :num...
lib/optimal/type.ex
0.84124
0.613179
type.ex
starcoder
defmodule Expert do @engine :beer_expert def start do {:ok, _} = :seresye.start(@engine) Facts.add_to(@engine) Rules.add_to(@engine) end def stop do :ok = :seresye.stop(@engine) end def tell(beer_name, facts) when is_list(facts) do for fact <- facts, do: tell(beer_name, fact) end ...
lib/expert.ex
0.668015
0.534309
expert.ex
starcoder
defmodule Observables.Operator.ZipVar do @moduledoc false use Observables.GenObservable alias Observables.Obs def init([pids_inds, obstp]) do Logger.debug("CombineLatestn: #{inspect(self())}") # Define the index for the next observable. index = length(pids_inds) # Unzip the indices for the initi...
lib/observables/zip_var.ex
0.709623
0.621498
zip_var.ex
starcoder
defmodule YtPotion.Video do import YtPotion.Base @moduledoc """ Provides methods to interact with the YouTube Videos API """ @doc """ Returns the YouTube API response ## Examples ```elixir iex > YtPotion.Video.list(%{id: "gben9fsNYTM,LTke1j_fkLc", part: "statistics"}) {:ok, %HTTPoiso...
lib/yt_potion/yt_potion_video.ex
0.784897
0.416886
yt_potion_video.ex
starcoder
defmodule Bitset do @moduledoc """ Documentation for Bitset. the fixed-size N bits """ import Kernel, except: [to_string: 1] @set_bit 1 @unset_bit 0 @type t :: %__MODULE__{} defstruct size: 0, data: <<>> @spec new(bitstring() | non_neg_integer()) :: Bitset.t() def new(size) when is_integer(siz...
lib/bitset.ex
0.676086
0.489686
bitset.ex
starcoder
defmodule NcsaHmac.Plug do import Keyword, only: [has_key?: 2] @moduledoc """ Plug functions for loading and authorizing resources for the current request. The plugs all store data in conn.assigns (in Phoenix applications, keys in conn.assigns can be accessed with `@key_name` in templates) You must also sp...
lib/ncsa_hmac/plug.ex
0.810929
0.884688
plug.ex
starcoder
defmodule Membrane.Core.Child.PadModel do @moduledoc false # Utility functions for veryfying and manipulating pads and their data. use Bunch alias Membrane.Core.Child alias Membrane.{Pad, UnknownPadError} @type bin_pad_data_t :: %Membrane.Bin.PadData{ ref: Membrane.Pad.ref_t(), optio...
lib/membrane/core/child/pad_model.ex
0.767298
0.489198
pad_model.ex
starcoder
defmodule Quantity do @moduledoc """ A data structure that encapsulates a decimal value with a unit. """ alias Quantity.Math @type t :: %__MODULE__{ value: Decimal.t(), unit: unit } @type unit :: base_unit | {:div | :mult, unit, unit} @type base_unit :: String.t() | 1 def...
lib/quantity.ex
0.888463
0.753557
quantity.ex
starcoder
defmodule PlugSessionRedis.Store do @moduledoc """ To configure and install, add in your plug pipeline code like the following: ``` plug Plug.Session, store: PlugSessionRedis.Store, key: "_my_app_key", # Cookie name where the id is stored table: :redis_sessions, # Name of poolboy qu...
lib/plug_session_redis/store.ex
0.819533
0.716293
store.ex
starcoder
defmodule Timex.Parse.DateTime.Parser do @moduledoc """ This is the base plugin behavior for all Timex date/time string parsers. """ import Combine.Parsers.Base, only: [eof: 0, sequence: 1, map: 2, pipe: 2] alias Timex.Date alias Timex.Time alias Timex.DateTime alias Timex.TimezoneInfo alias Timex.Ti...
lib/parse/datetime/parser.ex
0.890702
0.567337
parser.ex
starcoder
defmodule Sue.DB.Graph do alias :mnesia, as: Mnesia alias Sue.DB alias Sue.DB.Schema.Vertex @type result() :: {:ok, any()} | {:error, any()} @edge_table :edges # Public API @doc """ Check if a Vertex exists in our graph. """ @spec exists?(Vertex.t()) :: boolean() def exists?(v) do {:ok, res}...
apps/sue/lib/sue/db/graph.ex
0.706596
0.513485
graph.ex
starcoder
defmodule Absinthe.Adapter do @moduledoc """ Absinthe supports an adapter mechanism that allows developers to define their schema using one code convention (eg, `snake_cased` fields and arguments), but accept query documents and return results (including names in errors) in another (eg, `camelCase`). Adapt...
lib/absinthe/adapter.ex
0.900234
0.874185
adapter.ex
starcoder
defmodule Timex.Ecto.DateTime do @moduledoc """ Support for using Timex with :datetime fields """ use Timex @behaviour Ecto.Type def type, do: :datetime @doc """ We can let Ecto handle blank input """ defdelegate blank?(value), to: Ecto.Type @doc """ Handle casting to Timex.Ecto.DateTime "...
lib/types/datetime.ex
0.811153
0.402862
datetime.ex
starcoder
defmodule ExAlgo.Queue do @moduledoc """ A basic queue implementation. """ @type underflow_error :: {:error, :underflow} @type value_type :: any() @type t :: %__MODULE__{left: [value_type()], right: [value_type()]} @doc """ A queue consists of a left and a right list. """ defstruct left: [], right:...
lib/ex_algo/queue/queue.ex
0.924253
0.567727
queue.ex
starcoder
defmodule Predicator do @moduledoc """ Documentation for Predicator. Lexer and Parser currently only compatible with 0.4.0 predicate syntax """ alias Predicator.Evaluator @lexer :predicate_lexer @atom_parser :atom_instruction_parser @string_parser :string_instruction_parser @type token_key_t :: :...
lib/predicator.ex
0.716715
0.524821
predicator.ex
starcoder
defmodule TflDemo.YoloX do alias TflDemo.YoloX.Prediction def apply_yolox(img_file) do img = CImg.load(img_file) # yolox prediction {:ok, res} = Prediction.apply(img) # draw result box Enum.reduce(res, CImg.builder(img), &draw_object(&2, &1)) |> CImg.runit() end defp draw_object(buil...
tfl_demo/lib/tfl_demo/yolo_x.ex
0.635222
0.52208
yolo_x.ex
starcoder
defmodule XeeThemeScript do @moduledoc """ A behaviour module for definition a Xee theme. ## Examples def YourTheme do use XeeThemeScript # Callbacks def init, do: %{ids: MapSet.new(), logs: []} def receive_meta(data, %{host_id: host_id, token: token}) do {:ok, data} end ...
lib/xeethemescript.ex
0.863622
0.450057
xeethemescript.ex
starcoder
defmodule Donut.GraphQL.Identity.Contact do use Donut.GraphQL.Schema.Notation @desc "The priority of a contact" enum :contact_priority do value :primary value :secondary end @desc "A generic contact interface" mutable_interface :contact do immutable do field...
apps/donut_graphql/lib/donut.graphql/identity/contact.ex
0.751101
0.405213
contact.ex
starcoder