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 Chapter_2 do @moduledoc """ Chapter 2 - Induction and Recursion """ @spec are_equal?([any], [any]) :: boolean @doc """ Def. 2.12 - Two sequences S and T are equal iff 1. they are both empty or 2. the head of S equals the head of T and the tail of S equals the tail of T """ def are_equal?(...
lib/chapter_2.ex
0.823328
0.610541
chapter_2.ex
starcoder
defmodule ExType.Example.Foo.StructExample do @moduledoc false @type t() :: %__MODULE__{ hi: binary(), ok: integer() } defstruct [:hi, :ok] end defmodule ExType.Example.Foo do @moduledoc false require ExType.T alias ExType.T @spec unquote_example() :: integer() hi = 12 ...
lib/example/foo.ex
0.839043
0.632545
foo.ex
starcoder
defmodule Storage.Object do @moduledoc """ Use of this module helps with easy configuration to store, retrieve and delete similar files. ## Definition New file module can be created really easy: defmodule Photo do use Storage.Object, directory: "photos" end As a options you c...
lib/object.ex
0.791499
0.582966
object.ex
starcoder
defmodule Search.Paginator do @moduledoc """ Handles the formatting of JSONAPI pagination params to Elasticsearch from and size. Also translates the the result counts to the proper page links for the response. """ import Destructure alias Plug.Conn alias Plug.Conn.Query, as: ConnQuery @default_page_s...
lib/elastic_jsonapi/paginator.ex
0.762998
0.476884
paginator.ex
starcoder
defmodule Phoenix.HTML do @moduledoc """ Helpers for working HTML strings and templates. When used, it brings the given functionality: * `use Phoenix.HTML.Controller` - imports controllers functions commonly used in views; * `import Phoenix.HTML`- imports functions for handle HTML safety; * ...
lib/phoenix/html.ex
0.785267
0.515193
html.ex
starcoder
defmodule Apoc.Hazmat.RSA do @moduledoc """ RSA Public Key Cryptography with Elixir. This module wraps the erlang `:crypto` and `:public_key` modules (which in turn wrap OpenSSL) but simplifies the syntax, uses its own types and combines the main functions into one module. ## RSA Basics Public Key cryp...
lib/apoc/hazmat/rsa.ex
0.853134
0.874614
rsa.ex
starcoder
defmodule Idefix.AST do @doc """ Parse Elixir code in a format for easy manipulation """ def parse(input) do opts = [ columns: true, token_metadata: true, warn_on_unnecessary_quotes: false ] Code.string_to_quoted(input, opts) end @doc """ Given a line/column pair; find the ...
lib/idefix/ast.ex
0.646349
0.457803
ast.ex
starcoder
defmodule Owl.IO do @moduledoc "A set of functions for handling IO with support of `t:Owl.Data.t/0`." @type select_option :: {:label, Owl.Data.t() | nil} | {:render_as, (any() -> Owl.Data.t())} @doc """ Selects one item from the given nonempty list. Returns value immediately if list contains only 1 element....
lib/owl/io.ex
0.832305
0.485966
io.ex
starcoder
defmodule Raxx.SimpleServer do @moduledoc """ Server interface for simple `request -> response` interactions. *Modules that use Raxx.SimpleServer implement the Raxx.Server behaviour. Default implementations are provided for the streaming interface to buffer the request before a single call to `handle_request/2...
lib/raxx/simple_server.ex
0.938969
0.487246
simple_server.ex
starcoder
defmodule BusDetective.GTFS do @moduledoc """ The GTFS context module contains all of the functions needed to serve requests about scheduled or realtime GTFS data """ import Ecto.Query require Logger alias BusDetective.GTFS.{ Departure, Feed, ProjectedStopTime, Stop, StopSearch, ...
apps/bus_detective/lib/bus_detective/gtfs/gtfs.ex
0.736874
0.427217
gtfs.ex
starcoder
defmodule OliWeb.Common.PagingParams do defstruct [ :rendered_pages_count, :start_page_index, :current_page_index, :last_page_index, :label ] def calculate(total_count, offset, limit, max_rendered_pages) do half = ceil((max_rendered_pages - 1) / 2) # Calculate the index of the absolu...
lib/oli_web/live/common/paging_params.ex
0.832849
0.439687
paging_params.ex
starcoder
defmodule GrovePi.Ultrasonic do alias GrovePi.Board use GrovePi.Poller, default_trigger: GrovePi.Ultrasonic.DefaultTrigger, read_type: GrovePi.Digital.level() @moduledoc """ Read distance and subscribe to changes from the Grove Ultrasonic Ranger sensor. Listen for events from a GrovePi Ultrasonic R...
lib/grovepi/ultrasonic.ex
0.853425
0.900879
ultrasonic.ex
starcoder
defmodule LiveStruct do @moduledoc """ LiveStruct is a tool that lets you use a struct as the 'assigns' of a `Phoenix.LiveView`. Note this is probably done, but it's still alpha, and it *might* cause problems with LiveView in the future. ## Installation The package can be installed by adding `live_stru...
lib/live_struct.ex
0.825695
0.822581
live_struct.ex
starcoder
defmodule Vivid.Arc do alias Vivid.{Arc, Point, Path} import Vivid.Math defstruct ~w(center radius start_angle range steps)a @moduledoc ~S""" This module represents an Arc, otherwise known as a circle segment. ## Example iex> use Vivid ...> Arc.init(Point.init(10,10), 10, 0, 45) ...> |>...
lib/vivid/arc.ex
0.934035
0.443721
arc.ex
starcoder
defmodule AMQPX.ConnectionPool do use GenServer require Logger @moduledoc """ A pool of connections for shared use. AMQPX encourages using multiple channels per TCP connection instead of multiple connections, wherever possible. `AMQPX.ConnectionPool` stores open connections that other modules can retrieve...
lib/amqpx/connection_pool.ex
0.813757
0.591753
connection_pool.ex
starcoder
defmodule Paginator.Cursor do @moduledoc false def decode(nil), do: nil def decode(encoded_cursor) do encoded_cursor |> Base.url_decode64!() |> safe_binary_to_term() |> Enum.map(&Paginator.Cursor.Decode.convert/1) end def encode(values) when is_list(values) do values |> Enum.map(&Pag...
lib/paginator/cursor.ex
0.766294
0.433802
cursor.ex
starcoder
defmodule HandheldHalting do @spec run_until_done(String.t()) :: {non_neg_integer, %{acc: integer, ip: integer}} @doc """ iex> import HandheldHalting iex> run_until_done(sample_input()) {7, %{ip: 9, acc: 8}} """ def run_until_done(code), do: load_code(code) |> run_until_done(0) @spec run_until_done(:ar...
8-HandheldHalting/lib/handheld_halting.ex
0.785309
0.469703
handheld_halting.ex
starcoder
defmodule Elixircom do alias Elixircom.Server @moduledoc """ A serial port terminal emulator for IEx Run interactively be starting it from the `IEx` prompt. Here's an example that uses `Elixircom` to interact with a modem: ```elixir iex> Elixircom.run("/dev/tty.usbmodem14103", speed: 115_200) AT OK...
lib/elixircom.ex
0.81841
0.805364
elixircom.ex
starcoder
defmodule ConciergeSite.TripCardHelper do @moduledoc """ Display our Trip Card in templates """ import Phoenix.HTML.Tag, only: [content_tag: 3] import Phoenix.HTML.Link, only: [link: 2] import Phoenix.Controller, only: [get_csrf_token: 0] import ConciergeSite.TimeHelper, only: [format_time_string: 2, time...
apps/concierge_site/lib/views/trip_card_helper.ex
0.700895
0.426799
trip_card_helper.ex
starcoder
defmodule Benchee.Formatters.Console.Helpers do @moduledoc false # These are common functions shared between the formatting of the run time and # memory usage statistics. alias Benchee.Conversion.{Count, DeviationPercent, Format, Scale, Unit} alias Benchee.Scenario alias Benchee.Statistics @type unit_p...
lib/benchee/formatters/console/helpers.ex
0.78316
0.458773
helpers.ex
starcoder
defmodule Itsy.Bit do use Bitwise @doc """ A guard expression that checks whether the integer is a power of 2 or not. """ @spec is_power_of_2(integer) :: Macro.t defmacro is_power_of_2(x), do: quote do: (unquote(x) &&& ~~~-unquote(x)) == 0 @doc """ Get the lowest unset bit. ...
lib/itsy/bit.ex
0.842766
0.600979
bit.ex
starcoder
defmodule Toby.Data.Node do @moduledoc """ Retrieves system information for a particular connected node via RPC call. """ # General def system_info(node, key) do call(node, :erlang, :system_info, [key]) end def memory(node) do call(node, :erlang, :memory) end def statistics(node, key) do ...
lib/toby/data/node.ex
0.706697
0.500366
node.ex
starcoder
defmodule S3DirectUpload do @moduledoc """ Pre-signed S3 upload helper for client-side multipart POSTs. See: [Browser-Based Upload using HTTP POST (Using AWS Signature Version 4)](http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-post-example.html) [Task 3: Calculate the Signature for AWS Signature Ver...
lib/s3_direct_upload.ex
0.885593
0.710101
s3_direct_upload.ex
starcoder
defmodule Niffler.Library do @moduledoc """ `Niffler.Library` allows to wrap dynamically loaded libraries. And create foreign function interfaces (FFI) for them. This usually requires: * Shared headers such for type definitions * Some init code involving `dlopen()` * Static variables/state that is part of ...
lib/niffler/library.ex
0.905982
0.561275
library.ex
starcoder
defmodule StreamStats do @moduledoc """ Enables concurrent calculation of count, mean and standard deviation. New values can be aggregated into an existing stat tuple and two stat tuples can be merged into one. Inspired by the following article by <NAME>: https://www.johndcook.com/blog/skewness_kurtosis/ ...
lib/stream_stats.ex
0.78572
0.819641
stream_stats.ex
starcoder
defmodule Loppers do alias Loppers.{Walk, Validate, Match, List} @type error :: {:not_allowed, ast :: term} @type function_ref :: {module :: atom, :__all__} | {module :: atom, :__submodules_all__} | {module :: atom, function :: atom} | (function :: atom) @type validate_option :: {:whitelis...
lib/loppers.ex
0.645232
0.505066
loppers.ex
starcoder
defmodule Spat.Geometry.Box do use Bitwise @doc """ Obtain the indexes of a box within the subdivided bounds. iex> Spat.Geometry.Box.index({ 0 }, { 1 }, Spat.Bounds.new({ 10 }), 1) [[0]] iex> Spat.Geometry.Box.index({ 5 }, { 6 }, Spat.Bounds.new({ 10 }), 1) [[0], [1]] ...
lib/spat/geometry/box.ex
0.842313
0.800809
box.ex
starcoder
defmodule Plug.Crypto do @moduledoc """ Namespace and module for crypto-related functionality. For low-level functionality, see `Plug.Crypto.KeyGenerator`, `Plug.Crypto.MessageEncryptor`, and `Plug.Crypto.MessageVerifier`. """ use Bitwise alias Plug.Crypto.{KeyGenerator, MessageVerifier, MessageEncrypto...
lib/plug/crypto.ex
0.910275
0.607867
crypto.ex
starcoder
defmodule Segment do @moduledoc """ The Segement analytics-elixir is a non-official third-party client for [Segment](https://segment.com). Since version `0.2.0` it supports batch delivery of events and retries for the API. ## Installation Add `segment` to your list of dependencies in mix.exs ``` def de...
lib/segment.ex
0.896622
0.956553
segment.ex
starcoder
defmodule Logi.BuiltIn.Sink.IoDevice do @moduledoc """ A built-in IO device sink. Behaviours: `Logi.SinkWriter`. This sink writes log messages to an IO device (e.g. standard output, file, etc). The default layout is `Logi.BuiltIn.Layout.Default.new`. ## Note This module is provided for debugging/test...
lib/logi/builtin/sink/io_device.ex
0.795975
0.67874
io_device.ex
starcoder
defmodule OMG.State.Transaction.Recovered do @moduledoc """ Representation of a signed transaction, with addresses recovered from signatures (from `OMG.State.Transaction.Signed`) Intent is to allow concurrent processing of signatures outside of serial processing in `OMG.State`. `Transaction.Recovered` represe...
apps/omg/lib/omg/state/transaction/recovered.ex
0.89878
0.466724
recovered.ex
starcoder
defmodule Snitch.Data.Model.CountryZone do @moduledoc """ CountryZone API """ use Snitch.Data.Model use Snitch.Data.Model.Zone import Ecto.Query alias Snitch.Data.Model.Zone, as: ZoneModel alias Snitch.Data.Schema.{Country, CountryZoneMember, Zone} @doc """ Creates a new country `Zone` whose memb...
apps/snitch_core/lib/core/data/model/zone/country_zone.ex
0.900985
0.502014
country_zone.ex
starcoder
defmodule Day7 do def from_file(path) do File.read!(path) |> String.split(",") |> Enum.map(&Integer.parse/1) |> Enum.map(&(elem(&1, 0))) end def modify(memory, address, value) do memory |> List.delete_at(address) |> List.insert_at(address, value) end def read_instruction(value) ...
lib/day7.ex
0.608943
0.540985
day7.ex
starcoder
defmodule REnum.Ruby do @moduledoc """ Summarized all of Ruby functions. If a function with the same name already exists in Elixir, that is not implemented. Also, the function that returns Enumerator in Ruby is customized each behavior on the characteristics. Defines all of here functions when `use REnum.Ruby...
lib/r_enum/ruby.ex
0.864382
0.445168
ruby.ex
starcoder
defmodule Bencodex do @moduledoc """ Bencodex is a encoder/decoder for the bencode protocol. Bencode supports four types of objects * `string` - Implemented as an ASCII encoded binary * `integer` - Encoded in base 10 ASCII * `list` - Ordered, heterogenious list * `dictio...
lib/bencodex.ex
0.732209
0.539893
bencodex.ex
starcoder
defmodule Ash.Resource.Validation do @moduledoc """ Represents a validation in Ash. See `Ash.Resource.Validation.Builtins` for a list of builtin validations. To write your own validation, define a module that implements the `c:init/1` callback to validate options at compile time, and `c:validate/2` callback...
lib/ash/resource/validation.ex
0.843766
0.832985
validation.ex
starcoder
defmodule ZupplerUsers.Auth.Supervisor do @moduledoc """ Provides oauth toke authorization with zuppler ## Dependencies poolboy, lrucache ## Setup In the app module add a new child supervisor(Zuppler.Auth, []]) ## Usage ``` user_info = Zuppler.Auth.auth(token) Authorization.ZupplerAuth.h...
lib/authorization/supervisor.ex
0.637708
0.540621
supervisor.ex
starcoder
defmodule MelodyMatch.Matchmaker do @moduledoc """ Server for matching users on the system with each other. Which matcher is configurable via application config, for example ```elixir config :melody_match, default_matcher: MelodyMatch.Matchmaker.MatcherAny ``` ## Attribution The code in this ...
server/lib/melody_match/matchmaker.ex
0.797281
0.645106
matchmaker.ex
starcoder
defmodule InlineSvg do require Logger @moduledoc """ Simple and fast in-line SVG library and renderer for web applications. SVG files are images that are formatted as very simple, and usually small, text files. It is faster, and recommended, that you directly include the svg data in-line with your web pag...
lib/inline_svg.ex
0.877207
0.707076
inline_svg.ex
starcoder
defmodule Instream.Encoder.Line do @moduledoc false @type point_map :: %{ required(:fields) => [{term, term}], required(:measurement) => term, optional(:tags) => [{term, term}], optional(:timestamp) => term } @doc """ Creates the write string for a list of data ...
lib/instream/encoder/line.ex
0.762689
0.405419
line.ex
starcoder
defmodule Bonfire.Epics.Epic do defstruct [ prev: [], # list of steps we've already run. next: [], # the remaining steps, may be modified during run. errors: [], # any errors accrued along the way. assigns: %{}, # any information accrued along the way ] alias Bonfire.Epics alias Bonfi...
lib/epic.ex
0.612078
0.48054
epic.ex
starcoder
defmodule Instream.Encoder.Line do @moduledoc """ Encoder for the InfluxDB line protocol. """ alias Instream.Decoder.RFC3339 @type point :: %{ required(:fields) => map, required(:measurement) => binary, optional(:tags) => map, optional(:timestamp) =>...
lib/instream/encoder/line.ex
0.848235
0.430866
line.ex
starcoder
defmodule Benchee.Formatter do @moduledoc """ Defines a behaviour for formatters in Benchee, and also defines functions to handle invoking that defined behavior. When implementing a benchee formatter as a behaviour please adopt this behaviour, as it helps with uniformity and also allows at least the `.format...
lib/benchee/formatter.ex
0.84966
0.721768
formatter.ex
starcoder
defmodule Ockam.Session.Spawner do @moduledoc """ Simple worker spawner which does not track spawned workers Options: `worker_mod` - worker module to spawn, required `worker_opions` - additional options of the spawned worker, defaults to [] `message_parser` - function parsing init message to a Keyword lis...
implementations/elixir/ockam/ockam/lib/ockam/session/spawner.ex
0.881997
0.726062
spawner.ex
starcoder
defmodule SGP40 do @moduledoc """ Use Sensirion SGP40 air quality sensor in Elixir """ use GenServer, restart: :transient require Logger @typedoc """ SGP40 GenServer start_link options * `:name` - A name for the `GenServer` * `:bus_name` - Which I2C bus to use (defaults to `"i2c-1"`) * `:bus_addr...
lib/sgp40.ex
0.899476
0.438845
sgp40.ex
starcoder
defmodule SpeechMarkdown do @moduledoc """ Elixir implementation for the Speech Markdown format. https://www.speechmarkdown.org/ Speech Markdown is a text format which is akin to regular Markdown, but with an alternative syntax and built for the purpose of generating platform-specific [SSML](https://en....
lib/speech_markdown.ex
0.880309
0.670635
speech_markdown.ex
starcoder
defmodule Ace.Governor do @moduledoc """ A governor maintains servers ready to handle clients. A governor process starts with a reference to supervision that can start servers. It will then wait until the server has accepted a connection. Once it's server has accepted a connection the governor will start a n...
lib/ace/governor.ex
0.68637
0.401306
governor.ex
starcoder
defmodule MvOpentelemetry.SpanTracer do @moduledoc """ Reusable behaviour for listening to events emmited with `:telemetry.span/3` convention and converting them into OpenTelemetry traces. You can define custom tracers modules and then register them at the start of your application. You are required to imple...
lib/mv_opentelemetry/span_tracer.ex
0.917048
0.76999
span_tracer.ex
starcoder
defmodule Collidex.Detection.MixedShapes do @moduledoc """ Handles detection of collisions between disparate shapes. (i.e. Rects and Circles, Rects and Polygons, Polygons and Circles) """ alias Collidex.Geometry.Rect alias Collidex.Geometry.Circle alias Collidex.Geometry.Polygon alias Graphmath.Vec2 ...
lib/collidex/detection/mixed_shapes.ex
0.835802
0.89115
mixed_shapes.ex
starcoder
defmodule Sandbox do @moduledoc """ #### --- Warning --- #### This library is under heavy development and will have breaking changes until the 1.0.0 release. Sandbox provides restricted, isolated scripting environments for Elixir through the use of embedded Lua. This project is powered by <NAME>'s amazing ...
lib/sandbox.ex
0.847968
0.651715
sandbox.ex
starcoder
defmodule Timex.Timezone do @moduledoc """ This module is used for looking up the timezone information for a given point in time, in the desired zone. Timezones are dependent not only on locale, but the date and time for which you are querying. For instance, the timezone offset from UTC for `Europe/Moscow` is...
lib/timezone/timezone.ex
0.830388
0.651078
timezone.ex
starcoder
defmodule Trunk.Processor do @moduledoc false alias Trunk.State def store(%{versions: versions, async: true} = state), do: store_async(versions, state) def store(%{versions: versions, async: false} = state), do: store_sync(versions, state) defp store_async(versions, state) do process_async(versions, st...
lib/trunk/processor.ex
0.68763
0.417093
processor.ex
starcoder
defmodule Zuppler.Utilities.DataConvertor do @moduledoc """ Data Convertor module Used to convert from map to Restaurant struct """ @doc """ Convert a map to struct to enforce keys validation ## Example %{ name: "demo", permalink: "demorestaurant", amenities: "Online Orders, Cockt...
lib/utilities/data_convertor.ex
0.831314
0.550184
data_convertor.ex
starcoder
defmodule BtrzWebhooksEmitter do @moduledoc """ BtrzWebhooksEmitter emits webhooks to SQS for the Betterez platform. This module has the API to send messages asynchrounously to the `BtrzWebhooksEmitter.SQS`. You will have to set these ENV vars: * AWS_SERVICE_KEY * AWS_SERVICE_SECRET * SQS_QUEUE_NAME ...
lib/btrz_ex_webhooks_emitter.ex
0.868102
0.683908
btrz_ex_webhooks_emitter.ex
starcoder
defmodule Saucexages.IO.SauceBinary do @moduledoc """ Functions for working with SAUCE containing and related binaries. Provides basic building blocks for reading, writing, fixing, and analyzing binaries that may or may not contain SAUCE blocks. ## Notes Because of the way SAUCE works with regard to EOF po...
lib/saucexages/io/sauce_binary.ex
0.800068
0.498413
sauce_binary.ex
starcoder
defmodule IVCU do @moduledoc """ Provides an API to validate, convert, and save files to abstract storages. ## Usage Suppose you have [a definition](`IVCU.Definition`) `MyApp.Image`. Then you can save a file from `Plug.Upload` struct like this. def save(%Plug.Upload{path: path}) do path ...
lib/ivcu.ex
0.848722
0.422683
ivcu.ex
starcoder
defmodule Statistics do alias Statistics.Math @moduledoc """ Descriptive statistics functions """ @doc """ Sum the contents of a list Calls Enum.sum/1 """ @spec sum(list) :: number def sum(list) when is_list(list), do: do_sum(list, 0) defp do_sum([], t), do: t defp do_sum([x | xs], t), do: d...
lib/statistics.ex
0.822866
0.485173
statistics.ex
starcoder
defmodule Comet.Supervisor do use Supervisor @moduledoc """ Primary Supervisor for Comet This Supervisor will manage the `ChromeLauncher` and `:poolboy`. You can opt-in to the Supervisor managing `Comet.CacheWorker`. This Supervisor should be used directly in your own app's supervisor tree. You must pass...
lib/comet/supervisor.ex
0.76947
0.462291
supervisor.ex
starcoder
defmodule RDF.Serialization.Format do @moduledoc """ A behaviour for RDF serialization formats. A `RDF.Serialization` for a format can be implemented like this defmodule SomeFormat do use RDF.Serialization.Format import RDF.Sigils @id ~I<http://example.com/some_format> ...
lib/rdf/serialization/format.ex
0.850562
0.517815
format.ex
starcoder
defmodule Flux.Websocket.Frame do @moduledoc """ Convenience functions for building websocket frames. """ defstruct fin: false, reserved: %{}, opcode: nil, mask?: false, payload_length: nil, mask: nil, payload: nil, close_code: ...
lib/flux/websocket/frame.ex
0.854354
0.718767
frame.ex
starcoder
defmodule UberMulti do @moduledoc """ Provides the wrapper function for `Ecto.Multi`. There are two differences when using UberMulti compared to the normal Multi methods. The first is the addition of the 'keys' argument. The keys provided in this argument are used in two ways. First, each key is used to try an...
lib/uber_multi.ex
0.879082
0.937153
uber_multi.ex
starcoder
defmodule EVM.MachineState do @moduledoc """ Module for tracking the current machine state, which is roughly equivilant to the VM state for an executing contract. This is most often seen as µ in the Yellow Paper. """ alias EVM.Gas alias EVM.Stack alias EVM.MachineState alias EVM.ProgramCounter ali...
apps/evm/lib/evm/machine_state.ex
0.829734
0.536434
machine_state.ex
starcoder
defmodule ExSDP.RepeatTimes do @moduledoc """ This module represents the field of SDP that specifies rebroadcasts of a session. Works directly in conjunction with timing `t` parameter. - active_duration - how long session will last - repeat_interval - interval of session rebroadcast - offsets - offset...
lib/ex_sdp/repeat_times.ex
0.848863
0.716318
repeat_times.ex
starcoder
defmodule HashSet do @moduledoc """ A set store. The `HashSet` is meant to work well with both small and large sets. It is an implementation of the `Set` behaviour. For more information about the functions and their APIs, please consult the `Set` module. """ @behaviour Set # The ordered record cont...
lib/elixir/lib/hash_set.ex
0.789274
0.664241
hash_set.ex
starcoder
defmodule Inky.PixelUtil do @moduledoc """ PixelUtil maps pixels to bitstrings to be sent to an Inky screen """ def pixels_to_bits(pixels, width, height, rotation_degrees, color_map) do {outer_axis, dimension_vectors} = rotation_degrees |> normalised_rotation() |> rotation_opts() dim...
lib/display/pixelutil.ex
0.861247
0.580263
pixelutil.ex
starcoder
defmodule Day5 do def from_file(path) do File.read!(path) |> String.split(",") |> Enum.map(&Integer.parse/1) |> Enum.map(&(elem(&1, 0))) end def modify(memory, address, value) do memory |> List.delete_at(address) |> List.insert_at(address, value) end def read_instruction(value) ...
lib/day5.ex
0.552781
0.511595
day5.ex
starcoder
defmodule ExIbus.Message do use Bitwise @moduledoc """ A struct that keeps information about Ibus Message It contains 3 main fields: * `:src` - message source * `:dst` - message destination (receiver) * `:msg` - message content Module also contain several functions to operate with a message """...
lib/ex_ibus/message.ex
0.879509
0.722551
message.ex
starcoder
defmodule ExBreak.Breaker do @moduledoc """ A server that serves as a circuit breaker for a single function """ @typedoc """ A struct representing the state of a circuit breaker - `break_count` The number of breaks that have occurred - `tripped` Whether the circuit breaker is tripped - `tripped_at` Th...
lib/ex_break/breaker.ex
0.855081
0.505127
breaker.ex
starcoder
defmodule Grizzly.CommandClass.ThermostatFanMode.Set do @moduledoc """ Command module for the ThermostatFanMode command class SET command Command Options: * `:mode` - The mode of the fan: `:auto_low`, `:low`, `:auto_high`, `:high`, `:auto_medium`, `:medium`, `:circulation`, `:humidity_circula...
lib/grizzly/command_class/thermostat_fan_mode/set.ex
0.884981
0.468791
set.ex
starcoder
defmodule Freddy.Connection do @moduledoc """ Stable AMQP connection. """ alias Freddy.Utils.Backoff alias Freddy.Utils.MultikeyMap alias Freddy.Adapter alias Freddy.Core.Channel @params_docs [ adapter: """ Freddy adapter. Can be any module, but also can be passed as an alias `:amqp` or `:sand...
lib/freddy/connection.ex
0.892146
0.498108
connection.ex
starcoder
defmodule Earmark.Transform do import Earmark.Helpers, only: [replace: 3] alias Earmark.Options alias Earmark.TagSpecificProcessors, as: TSP alias Earmark.EarmarkParserProxy, as: Proxy @compact_tags ~w[a code em strong del] # https://www.w3.org/TR/2011/WD-html-markup-20110113/syntax.html#void-element ...
lib/earmark/transform.ex
0.758511
0.734239
transform.ex
starcoder
require Utils defmodule D9 do @moduledoc """ --- Day 9: Encoding Error --- With your neighbor happily enjoying their video game, you turn your attention to an open data port on the little screen in the seat in front of you. Though the port is non-standard, you manage to connect it to your computer through the...
lib/days/09.ex
0.642096
0.724724
09.ex
starcoder
defmodule Toolshed.Top do @default_n 10 @moduledoc """ Find the top processes """ @spec top_reductions(any()) :: :"do not show this result in output" def top_reductions(n \\ @default_n), do: top(order: :reductions, n: n) @spec top_mailbox(any()) :: :"do not show this result in output" def top_mailbox(...
lib/toolshed/top.ex
0.748076
0.565599
top.ex
starcoder
defmodule RailwayIpc.Publisher do @moduledoc """ Publishes Protobuf messages to the configured message bus. You will define one publisher for each message bus exchange to which you want to publish. Define a module that "uses" `RailwayIpc.Publisher`, specifying the name of the exchange. Add a function that ca...
lib/railway_ipc/publisher.ex
0.914171
0.737442
publisher.ex
starcoder
defmodule Arguments.Parser do @moduledoc """ Parses arguments into a map for easy pattern matching """ @doc """ Parse will take a list of incoming arguments and a list of built arguments to generate a map """ @spec parse(String.t, [map]) :: map def parse(incoming, arguments) do incoming |> Opti...
lib/parser.ex
0.784567
0.411643
parser.ex
starcoder
defmodule AdventOfCode.Y2020.Day11 do def run() do AdventOfCode.Helpers.Data.read_from_file("2020/day11.txt") |> to_room() |> Stream.iterate(&iterate/1) |> Stream.chunk_every(2, 1) |> Stream.filter(fn [new, last] -> new == last end) |> Enum.take(1) |> (fn [[x, _]] -> x end).() |> occup...
lib/2020/day11.ex
0.567218
0.545346
day11.ex
starcoder
defmodule Axon do @moduledoc """ A high-level interface for creating neural network models. Axon is built entirely on top of Nx numerical definitions, so every neural network can be JIT or AOT compiled using any Nx compiler, or even transformed into high-level neural network formats like TensorFlow Lite an...
lib/axon.ex
0.953373
0.737454
axon.ex
starcoder
defmodule RulEx.Fixtures.Eval do def test_cases, do: valid_expressions() ++ invalid_expressions() ++ value_expressions() def valid_expressions do comparison_test_cases() ++ comparison_operands_type_mismatch() ++ [ # By default we reject unknown operands %{ expr: ["custom",...
test/fixtures/eval.ex
0.805517
0.523177
eval.ex
starcoder
defmodule Himamo.Logzero do @type ext_float :: float | :logzero @doc ~S""" Returns the `:logzero` constant. """ @spec const() :: :logzero def const, do: :logzero @doc ~S""" Extended exponential function. Standard exponential function `e^x`, extended to handle the input `0`: * `e^LOGZERO = 0` ...
lib/himamo/logzero.ex
0.8874
0.652926
logzero.ex
starcoder
defmodule Andy.Profiles.Rover.GMDefs.ObservingOther do @moduledoc "The GM definition for :observing_other" alias Andy.GM.{GenerativeModelDef, Intention, Conjecture, ConjectureActivation} import Andy.GM.Utils import Andy.Utils, only: [now: 0] def gm_def() do %GenerativeModelDef{ name: :observing_ot...
lib/andy/profiles/rover/gm_defs/observing_other.ex
0.842378
0.574693
observing_other.ex
starcoder
defmodule Mayo.Map do @doc """ Checks the minimum number of the keys in the map. iex> Mayo.Map.min(%{foo: "bar"}, 1) %{foo: "bar"} iex> Mayo.Map.min(%{}, 1) {:error, %Mayo.Error{type: "map.min"}} """ def min(value, limit) when is_map(value) do if length(Map.keys(value)) < limit do ...
lib/mayo/map.ex
0.779154
0.440529
map.ex
starcoder
defmodule Observable.Repo do @moduledoc """ Defines observable functionality for an `Ecto.Repo`. Observable functionality is defined as the ability to hook into the lifecyle of a struct to perform some kind of work based on the repo action performed. ## Setup Lets say we have a `Post` schema. Each post c...
lib/observable/repo.ex
0.93315
0.573559
repo.ex
starcoder
defmodule Elsa.Wrapper do @moduledoc """ Provides a supervisable wrapper for the Elsa supervision tree to manage brod producers and consumers. Provides convenience functions for starting producer and consumer processes directly without the default supervisors brod interposes between them and the application...
lib/elsa/wrapper.ex
0.595963
0.415373
wrapper.ex
starcoder
defprotocol InvoiceTracker.TimeEntry do @doc """ Returns the time for the entry """ alias Timex.Duration @spec time(t) :: Duration.t() def time(entry) end defmodule InvoiceTracker.TimeSummary do @moduledoc """ A struct that summarizes time entries for an invoice period. """ alias InvoiceTracker....
lib/invoice_tracker/time_summary.ex
0.848235
0.491212
time_summary.ex
starcoder
defmodule Cocktail.Span do @moduledoc """ Struct used to represent a span of time. It is composed of the following fields: * from: the start time of the span * until: the end time of the span When expanding a `t:Cocktail.Schedule.t/0`, if it has a duration it will produce a list of `t:t/0` instead of a ...
lib/cocktail/span.ex
0.890644
0.777891
span.ex
starcoder
defmodule BPXE.BPMN.Interpolation do @moduledoc """ This is a generalized approach to interpolation in BPXE/BPMN, allowing to pass runtime-derived values into content and attributes of various nodes. The interpolation syntax is simple: anything enclosed between `${{` and `}}` will be considered an expression. ...
lib/bpxe/bpmn/interpolation.ex
0.852522
0.729664
interpolation.ex
starcoder
defmodule Numeracy.Polynomial do @moduledoc """ Operations on polynomial """ import Numeracy.Precision @typedoc """ A representation of a polynomial, where the list is the coefficients of the polynomial, starting with the constant term """ @type polynomial :: list(number) @doc """ Add two polyn...
lib/numeracy/polynomial.ex
0.94252
0.880797
polynomial.ex
starcoder
defmodule SecureX do alias SecureX.Context @moduledoc """ SecureX (An Advancement To ACL) is Role Based Access Control(RBAC) and Access Control List (ACL) to handle "User Roles And Permissions". You can handle all list of permissions attached to a specific object for certain users or give limited or full Acces...
lib/securex.ex
0.790369
0.759091
securex.ex
starcoder
defmodule Tournament do @doc """ Given `input` lines representing two teams and whether the first of them won, lost, or reached a draw, separated by semicolons, calculate the statistics for each team's number of games played, won, drawn, lost, and total points for the season, and return a nicely-formatted str...
tournament/lib/tournament.ex
0.846451
0.614741
tournament.ex
starcoder
defmodule PlugBodyDigest do @moduledoc """ Plug to verify the request body against the digest value sent in the HTTP 'Digest' header, as defined in [RFC3230, section 4.3.2](https://tools.ietf.org/html/rfc3230#section-4.3.2). Supported digests are "sha-512", "sha-256" and "sha". ## Options * `:on_succes...
lib/plug_body_digest.ex
0.878092
0.786848
plug_body_digest.ex
starcoder
defmodule RssWatcher do @moduledoc """ A small worker that watches a single RSS feed, parses the changes, and dispatches updates. ## Installation ### Dependencies Add the following to your dependencies: ```elixir {:rss_watcher, "~> 0.1.0"} ``` For _easy mode_, you can use the default adapters t...
lib/rss_watcher.ex
0.905723
0.883387
rss_watcher.ex
starcoder
defmodule Goth.Client do alias Goth.Config alias Goth.Token @moduledoc """ `Goth.Client` is the module through which all interaction with Google's APIs flows. For the most part, you probably don't want to use this module directly, but instead use the other modules that cache and wrap the underlying API cal...
lib/goth/client.ex
0.77137
0.417271
client.ex
starcoder
if Code.ensure_loaded?(Sidewalk) do defmodule ActiveJorb.QueueAdapter.Sidekiq do @moduledoc """ Uses the [sidewalk](https://hex.pm/packages/sidewalk) library to enqueue jobs with Sidekiq. ## Example ``` iex> job = %ActiveJorb.Job{job_class: "MyJob", arguments: [1, 2, 3], queue_name: "high"} ...
lib/active_jorb/queue_adapter/sidekiq.ex
0.809427
0.657195
sidekiq.ex
starcoder
defmodule GenSpoxy.Cache do @moduledoc """ This behaviour is responsible for implementing a caching layer on top of the prerender """ defmacro __using__(opts) do quote bind_quoted: [opts: opts] do alias Spoxy.Cache alias GenSpoxy.Stores.Ets @behaviour Spoxy.Cache.Behaviour @store_...
lib/cache/gen_cache.ex
0.826151
0.427217
gen_cache.ex
starcoder
defmodule Timber.Plug.HTTPContext do @moduledoc """ Automatically captures the HTTP method, path, and request_id in Plug-based frameworks like Phoenix and adds it to the context. By adding this data to the context, you'll be able to associate all the log statements that occur while processing that HTTP reque...
lib/timber_plug/http_context.ex
0.851814
0.651985
http_context.ex
starcoder
defprotocol RDF.Data do @moduledoc """ An abstraction over the different data structures for collections of RDF statements. """ @type t :: RDF.Description.t() | RDF.Graph.t() | RDF.Dataset.t() @doc """ Adds statements to a RDF data structure. As opposed to the specific `add` functions on the RDF data s...
lib/rdf/data.ex
0.933975
0.960212
data.ex
starcoder
defmodule MazesWeb.RectangularMazeView do use MazesWeb, :view import MazesWeb.MazeHelper alias Mazes.Maze def square_size(maze) do Integer.floor_div(max_svg_width(), Enum.max([maze.width, maze.height])) end def svg_width(maze) do 2 * svg_padding() + square_size(maze) * maze.width end def svg...
lib/mazes_web/views/rectangular_maze_view.ex
0.557966
0.425665
rectangular_maze_view.ex
starcoder
defmodule Faker.Airports do import Faker, only: [sampler: 2, localize: 1] @moduledoc """ Functions for generating airports related data """ @doc """ Returns a random ICAO ## Examples iex> Faker.Airports.icao() "SNOS" iex> Faker.Airports.icao() "UNBG" iex> Faker.Airports.i...
lib/faker/airports.ex
0.598077
0.513303
airports.ex
starcoder
defmodule Geotz do @moduledoc """ Provides functions for fast timezone lookup for a given latitude and longtitude """ alias Geotz.Data @tzdata Data.tz_data() @tzlist Data.tz_list() @tzlength length(Data.tz_list()) @doc """ Get a timezone from a given latitude and longtitude. ## Examples i...
lib/geotz.ex
0.799599
0.584805
geotz.ex
starcoder
defmodule Definition.Schema.Validation do @moduledoc """ Defines custom functions for easily validating requirements for commonly encountered data types evaluate to a boolean. """ @doc """ Evaluates whether or not the supplied value is a valid ISO8601-formatted timestamp. # Examples iex> Defini...
apps/definition/lib/definition/schema/validation.ex
0.932898
0.541469
validation.ex
starcoder