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 Client do
@moduledoc """
Client interface for the StockFighter Trades.exec web api
"""
alias Client.Url
defmodule StockId do
defstruct [:venue, :stock, :account]
end
defmodule Action do
defstruct [:price, :qty, :order_type, :direction]
end
@doc """
A simple health check for the... | lib/client.ex | 0.713032 | 0.405184 | client.ex | starcoder |
defmodule Godfist.HTTP do
@moduledoc false
@endpoint %{
br: "https://br1.api.riotgames.com",
eune: "https://eun1.api.riotgames.com",
euw: "https://euw1.api.riotgames.com",
jp: "https://jp1.api.riotgames.com",
kr: "https://kr.api.riotgames.com",
lan: "https://la1.api.riotgames.com",
las:... | lib/godfist/http.ex | 0.719876 | 0.637602 | http.ex | starcoder |
defmodule BuildCalendar do
@type url :: String.t()
defmodule Calendar do
@moduledoc """
Represents a calendar for display.
* previous_month_url: either a URL to get to the previous month, or nil if we shouldn't link to it
* next_month_url: a URL to get to the next month, or nil if we shouldn't li... | apps/site/lib/build_calendar.ex | 0.88173 | 0.510619 | build_calendar.ex | starcoder |
defmodule PelemaySample do
import Pelemay
@moduledoc """
```elixir
defpelemay do
def cal(list) do
list
|> Enum.map(& &1 + 2)
|> Enum.map(fn x -> x * 2 end)
end
#=>
def cal(list) do
list
|> PelemayNif.map_mult
|> PelemayNif.map_plus
end
```
"""
defpelemay do
de... | lib/pelemay_sample.ex | 0.528047 | 0.431464 | pelemay_sample.ex | starcoder |
defmodule Rubbergloves.Handler do
@moduledoc"""
A series of macros to determine how to authorize a specific action for a principle.
# Usage
## 1. Define what your rubber gloves can handle
```
defmodule MyApp.Gloves do
use Rubbergloves.Handler, wearer: MyApp.User
# wizzards can handle any poison
... | lib/handler/handler.ex | 0.714927 | 0.797123 | handler.ex | starcoder |
defmodule Aecore.Chain.BlockValidation do
@moduledoc """
Contains functions used to validate data inside of the block structure
"""
alias Aecore.Chain.{Block, Chainstate, Genesis, Header, Target}
alias Aecore.Governance.GovernanceConstants
alias Aecore.Pow.Cuckoo
alias Aecore.Tx.SignedTx
alias Aeutil.P... | apps/aecore/lib/aecore/chain/block_validation.ex | 0.85408 | 0.502808 | block_validation.ex | starcoder |
defmodule X509.Certificate.Extension do
@moduledoc """
Convenience functions for creating `:Extension` records for use in
certificates.
"""
import X509.ASN1, except: [basic_constraints: 2, authority_key_identifier: 1]
@typedoc "`:Extension` record, as used in Erlang's `:public_key` module"
@opaque t :: ... | lib/x509/certificate/extension.ex | 0.87866 | 0.415017 | extension.ex | starcoder |
defmodule Application do
@moduledoc """
A module for working with applications and defining application callbacks.
Applications are the idiomatic way to package software in Erlang/OTP. To get
the idea, they are similar to the "library" concept common in other
programming languages, but with some additional c... | lib/elixir/lib/application.ex | 0.858585 | 0.528594 | application.ex | starcoder |
defmodule Bitcoinex.Bech32 do
@moduledoc """
Includes Bech32 serialization and validation.
Reference: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32
"""
use Bitwise
@gen [0x3B6A57B2, 0x26508E6D, 0x1EA119FA, 0x3D4233DD, 0x2A1462B3]
@data_charset_list 'qpzry9x8gf2tvdw0s3jn54khce6mu... | server/bitcoinex/lib/bech32.ex | 0.863809 | 0.433202 | bech32.ex | starcoder |
defmodule Random do
use Bitwise
@moduledoc """
This module contains pseudo-random number generators for various distributionsported from Python 3 `random` module The documentation below is adapted from that module as well.
For integers, there is uniform selection from a range. For sequences, there is uniform... | lib/Random.ex | 0.903754 | 0.630145 | Random.ex | starcoder |
defmodule Day14 do
def part1 num_recipes do
stream = recipe_stream 3, 7
stream
|> Stream.drop(num_recipes)
|> Stream.take(10)
|> Enum.to_list
|> Enum.map(&(&1 + ?0))
|> List.to_string
end
# Fast solution.
def part2 pattern do
pattern =
pattern
|> String.to_charlist
... | day14/lib/day14.ex | 0.501709 | 0.48182 | day14.ex | starcoder |
defmodule ExOkex.Futures.Private do
@moduledoc """
Futures account client.
[API docs](https://www.okex.com/docs/en/#futures-README)
"""
alias ExOkex.Futures.Private
@type params :: map
@type instrument_id :: String.t()
@type config :: ExOkex.Config.t()
@type response :: ExOkex.Api.response()
@do... | lib/ex_okex/futures/private.ex | 0.790166 | 0.492493 | private.ex | starcoder |
defmodule ExSlackBot.GitHubRepoBot do
@moduledoc ~s"""
`GitHubRepoBot` is an Elixir behavior that makes working with GitHub repositories easier. You can assign a repo to the bot by passing `repo: "org/repo"` and optionally `branch: "branch_or_tag"` to the options when declaring the behavior in the `use` statement.
... | lib/exslackbot/githubrepobot.ex | 0.695131 | 0.432303 | githubrepobot.ex | starcoder |
defmodule Horde.Registry do
@moduledoc """
A distributed process registry.
Horde.Registry implements a distributed Registry backed by an add-wins last-write-wins δ-CRDT (provided by `DeltaCrdt.AWLWWMap`). This CRDT is used for both tracking membership of the cluster and implementing the registry functionality it... | lib/horde/registry.ex | 0.8709 | 0.801042 | registry.ex | starcoder |
defmodule Bitcoin.Util do
@doc """
Random 64 bit nonce
"""
@spec nonce64 :: number
def nonce64, do: (:rand.uniform(0xFF_FF_FF_FF_FF_FF_FF_FF) |> round) - 1
# Timestamp represented as a float
def militime do
{megas, s, milis} = :os.timestamp()
1.0e6 * megas + s + milis * 1.0e-6
end
# Measure ... | lib/bitcoin/util.ex | 0.84653 | 0.446072 | util.ex | starcoder |
defmodule ExternalState do
@moduledoc """
Support storing all or part of some state externally to the owning pid(s).
Builds on ETS existing functionality.
"""
@doc """
The __using__/1 macro introduces the external state data structure and
the module functions used to interact with the external state.
... | lib/external_state.ex | 0.833358 | 0.898855 | external_state.ex | starcoder |
defmodule Spandex.Span do
@moduledoc """
A container for all span data and metadata.
"""
alias Spandex.Span
defstruct [
:completion_time,
:env,
:error,
:http,
:id,
:name,
:parent_id,
:private,
:resource,
:service,
:services,
:sql_query,
:start,
:tags,
... | lib/span.ex | 0.754463 | 0.784195 | span.ex | starcoder |
defmodule Timex.Comparable.Diff do
@moduledoc false
alias Timex.Types
alias Timex.Duration
alias Timex.Comparable
@spec diff(Types.microseconds(), Types.microseconds(), Comparable.granularity()) :: integer
@spec diff(Types.valid_datetime(), Types.valid_datetime(), Comparable.granularity()) :: integer
de... | lib/comparable/diff.ex | 0.74055 | 0.690155 | diff.ex | starcoder |
defmodule Norm.Contract do
@moduledoc """
Design by Contract with Norm.
This module provides a `@contract` macro that can be used to define specs for arguments and the
return value of a given function.
To use contracts, call `use Norm` which also imports all `Norm` functions.
Sometimes you may want to tu... | lib/norm/contract.ex | 0.847353 | 0.585575 | contract.ex | starcoder |
defmodule Timedot do
@moduledoc """
Documentation for `Timedot`.
"""
@type t :: %__MODULE__{items: list(Timedot.Item.t()), ir: Timedot.IR.t()}
defstruct [:items, :ir]
@doc """
Parse a timedot string.
If year is missing from an entry, the current year will be used instead.
See `parse_line/2` to pars... | lib/timedot.ex | 0.849176 | 0.676717 | timedot.ex | starcoder |
defmodule Graph.Reducers.Dfs do
@moduledoc """
This reducer traverses the graph using Depth-First Search.
"""
use Graph.Reducer
@doc """
Performs a depth-first traversal of the graph, applying the provided mapping function to
each new vertex encountered.
NOTE: The algorithm will follow lower-weighted ... | lib/graph/reducers/dfs.ex | 0.891037 | 0.716541 | dfs.ex | starcoder |
defmodule Geometry.GeometryCollection do
@moduledoc """
A collection set of 2D geometries.
`GeometryCollection` implements the protocols `Enumerable` and `Collectable`.
## Examples
iex> Enum.map(
...> GeometryCollection.new([
...> Point.new(11, 12),
...> LineString.new([
... | lib/geometry/geometry_collection.ex | 0.95902 | 0.642461 | geometry_collection.ex | starcoder |
defmodule OsuEx.API.Enums do
@moduledoc "Utility functions for handling enum values."
@doc """
Translates the game mode enum to an atom and vice versa.
## Examples
iex> OsuEx.API.Enums.mode(0)
:standard
iex> OsuEx.API.Enums.mode(:taiko)
1
"""
def mode(_m)
@spec mode(0..3) :: a... | lib/api/enums.ex | 0.898352 | 0.435902 | enums.ex | starcoder |
defmodule SteamEx.ISteamUserStats do
@moduledoc """
Used to access information about users.
For more info on how to use the Steamworks Web API please see the [Web API Overview](https://partner.steamgames.com/doc/webapi_overview).
"""
import SteamEx.API.Base
@interface "ISteamUserStats"
@doc """
Retri... | lib/interfaces/i_steam_user_stats.ex | 0.648911 | 0.452959 | i_steam_user_stats.ex | starcoder |
defmodule Google.Pubsub.V1.Topic do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
name: String.t,
labels: %{String.t => String.t}
}
defstruct [:name, :labels]
field :name, 1, type: :string
field :labels, 2, repeated: true, type: Google.Pubsub.V1.Topic.LabelsEntry, map:... | lib/proto/google/pubsub/v1/pubsub.pb.ex | 0.740831 | 0.456046 | pubsub.pb.ex | starcoder |
defmodule NervesTime.RTC.DS3231 do
@moduledoc """
DS3231 RTC implementation for NervesTime
To configure NervesTime to use this module, update the `:nerves_time` application
environment like this:
```elixir
config :nerves_time, rtc: NervesTime.RTC.DS3231
```
If not using `"i2c-1"` or the default I2C b... | lib/nerves_time/rtc/ds3231.ex | 0.790328 | 0.766031 | ds3231.ex | starcoder |
defmodule Poker.Classifier do
@moduledoc """
Classify cards category
"""
alias Poker.{Card, Utils}
@type category ::
:flush
| :four_of_a_kind
| :full_house
| :high_card
| :one_pair
| :straight
| :straight_flush
| :three_of_a_kind... | lib/poker/classifier.ex | 0.729327 | 0.498474 | classifier.ex | starcoder |
defmodule Microdata do
@moduledoc """
`Microdata` is an Elixir library for parsing [microdata](https://www.w3.org/TR/microdata) from a provided document.
### Dependencies
#### Meeseeks + Rust
Microdata parses HTML with [Meeseeks](https://github.com/mischov/meeseeks), which depends on [html5ever](https://gith... | lib/microdata.ex | 0.886543 | 0.895477 | microdata.ex | starcoder |
defmodule Mix.Tasks.Lei.BulkAnalyze do
use Mix.Task
@shortdoc "Run LowEndInsight and analyze a list of git repositories"
@moduledoc ~S"""
This is used to run a LowEndInsight scan against a repository, by cloning it locally, then looking
into it. Pass in the repo URL as a parameter to the task.
Skipping v... | lib/mix/tasks/bulk_analyze.ex | 0.624866 | 0.737914 | bulk_analyze.ex | starcoder |
defmodule Aoc2019Day2 do
import Intcode
@moduledoc """
https://adventofcode.com/2019/day/2
--- Day 2: 1202 Program Alarm ---
On the way to your gravity assist around the Moon, your ship computer beeps angrily about a "1202 program alarm". On the radio, an Elf is already explaining how to handle the situatio... | lib/aoc2019_day2.ex | 0.727201 | 0.862178 | aoc2019_day2.ex | starcoder |
defmodule Elrondex.Account do
alias Elrondex.{Account}
defstruct address: nil,
username: nil,
master_node: nil,
public_key: nil,
private_key: nil
@doc """
Returns an account's address from the public key.
## Arguments
* `public_key` - a public key (in bina... | lib/elrondex/account.ex | 0.816955 | 0.490114 | account.ex | starcoder |
defmodule Akd.Destination do
@moduledoc """
This module represents a `Destination` struct which contains metadata about
a destination/location/host.
The meta data involves:
* `user` - Represents the user who will be accessing a host/server.
Expects a string, defaults to `:current`.
* `host` - R... | lib/akd/destination.ex | 0.863794 | 0.729568 | destination.ex | starcoder |
defmodule AWS.Detective do
@moduledoc """
Detective uses machine learning and purpose-built visualizations to help you to
analyze and investigate security issues across your Amazon Web Services (Amazon
Web Services) workloads.
Detective automatically extracts time-based events such as login attempts, API
... | lib/aws/generated/detective.ex | 0.881857 | 0.666252 | detective.ex | starcoder |
defmodule Comeonin do
@moduledoc """
Comeonin is a password hashing library that aims to make the
secure validation of passwords as straightforward as possible.
It also provides extensive documentation to help developers keep
their apps secure.
Comeonin supports Argon2, Bcrypt and Pbkdf2 (sha512 a... | deps/comeonin/lib/comeonin.ex | 0.795102 | 0.74872 | comeonin.ex | starcoder |
defmodule Tzdata.TimeZoneDatabase do
@behaviour Calendar.TimeZoneDatabase
@moduledoc """
Module for interfacing with the standard library time zone related functions of Elixir 1.8+.
Implements the `Calendar.TimeZoneDatabase` behaviour.
"""
@impl true
def time_zone_period_from_utc_iso_days(iso_days, time... | lib/tzdata/time_zone_database.ex | 0.84626 | 0.571647 | time_zone_database.ex | starcoder |
defmodule ArtemisNotify.IntervalWorker do
@moduledoc """
A `use` able module for creating GenServer instances that perform tasks on a
set interval.
## Callbacks
Define a `call/1` function to be executed at the interval. Receives the
current `state.data`.
Must return a tuple `{:ok, _}` or `{:error, _}`.... | apps/artemis_notify/lib/artemis_notify/workers/interval_worker.ex | 0.854278 | 0.41941 | interval_worker.ex | starcoder |
defmodule TickerBase.Database do
@moduledoc false
use GenServer
alias TickerBase.Tick
@spec start_link(list(atom())) :: GenServer.on_start
def start_link(symbols) do
GenServer.start_link(__MODULE__, symbols, name: __MODULE__)
end
@spec insert_tick!(Tick.t()) :: true
def insert_tick!(%Tick{symbol... | lib/ticker_base/database.ex | 0.833189 | 0.432003 | database.ex | starcoder |
defmodule Dictionary do
@moduledoc """
Provides the functionality for retrieving dictionary
data types to determine the correct Type module to
cast payload fields to, as well as the `normalize/2`
function for invoking a field's implementation of the
Normalizer protocol to normalize the supplied message
da... | apps/definition_dictionary/lib/dictionary.ex | 0.818592 | 0.517083 | dictionary.ex | starcoder |
defmodule Bonbon.Model.Account.Business do
use Bonbon.Web, :model
@moduledoc """
A model representing the different business accounts.
##Fields
###:id
Is the unique reference to the business entry. Is an `integer`.
###:email
Is the email of the business. Is a `string`.
... | web/models/account/business.ex | 0.670069 | 0.534855 | business.ex | starcoder |
defmodule Data.Room do
@moduledoc """
Room Schema
"""
use Data.Schema
alias Data.Exit
alias Data.Item
alias Data.Room.Feature
alias Data.Shop
alias Data.Zone
@ecologies [
"default",
"ocean",
"river",
"lake",
"forest",
"jungle",
"town",
"inside",
"road",
"hi... | lib/data/room.ex | 0.662906 | 0.470676 | room.ex | starcoder |
defmodule NewRelic.Transaction do
@moduledoc """
Records information about an instrumented web transaction.
"""
defstruct [:name, :start_time]
@typedoc "A New Relixir transaction context."
@opaque t :: %__MODULE__{name: String.t, start_time: :erlang.timestamp}
@typedoc "The name of a model."
@type mo... | lib/new_relic/transaction.ex | 0.896592 | 0.533215 | transaction.ex | starcoder |
# An·cil·lar·y operations for the Learn Rest Client's Use
defmodule Learn.RestUtil, do: (
alias Learn.{RestUtil}
def sayhello(), do: (IO.inspect "hello")
@doc """
Take a list of dsks,which are maps themselves, and turn the list into a map
of maps where the key for each dsk map is the id. We're passing in th... | lib/learn/rest_util.ex | 0.737253 | 0.651189 | rest_util.ex | starcoder |
defmodule Integrate.SpecificationData do
@moduledoc """
Validate and transform specification data.
"""
use Memoize
alias ExJsonSchema.{
Schema,
Validator
}
alias Integrate.Util
alias Integrate.Specification.{
Spec,
Match,
MatchAlternative,
Path,
Field,
FieldAlternative... | lib/integrate/specification_data.ex | 0.799168 | 0.460168 | specification_data.ex | starcoder |
defmodule Essence.Vocabulary do
@moduledoc """
This module exports helpful methods around Vocabularies.
"""
@doc """
The `vocabulary` method computes the vocabulary of a given
`Essence.Document`. The vocabulary is the unique set of dictionary words in
that text.
"""
@spec vocabulary(any()) :: List.t
... | lib/essence/vocabulary.ex | 0.899202 | 0.527134 | vocabulary.ex | starcoder |
defmodule Automaton.Types.TWEANN.Sensor do
@moduledoc """
A sensor is any process which produces a vector signal that the NN then processes.
The signal can come from interacting with environ, or the Sensor can be a program that generates
the signal in any way.
Sensor's can be defined with the tuple: { id, c... | lib/automata/automaton_types/neuroevolution/sensor.ex | 0.709321 | 0.578657 | sensor.ex | starcoder |
defmodule ExWareki.Parser do
@moduledoc """
Parser module provides parsers of Japanese-formatted date string.
"""
alias ExWareki.Era
alias ExWareki.Structs.Wareki
alias ExWareki.Structs.Seireki
alias ExWareki.Number
@doc """
parse_wareki/1 parses wareki string
## Examples
iex> ExWareki... | lib/ex_wareki/parser.ex | 0.614278 | 0.588682 | parser.ex | starcoder |
defmodule AnsiToHTML.Theme do
@moduledoc """
`AnsiToHTML.Theme` structs define how the ANSI should be converted to html tags.
You can pass a custom theme to both `AnsiToHTML.generate_html/2` and `AnsiToHTML.generate_phoenix_html/2` as the second argument.
Tags are matches against their ANSI code and converted ... | lib/theme.ex | 0.881774 | 0.603085 | theme.ex | starcoder |
defmodule Filterable.Cast do
@moduledoc ~S"""
Contains functions which perform filter values type casting.
Each function should return casted value or `:error` atom.
"""
@spec integer(String.t() | number) :: integer | :error
def integer(value) when is_bitstring(value) do
case Integer.parse(value) do
... | lib/filterable/cast.ex | 0.869188 | 0.719014 | cast.ex | starcoder |
defmodule Neo4j.Sips.Models do
@moduledoc """
Neo4j.Sips models.
You can easily define your own Elixir modules like this:
```elixir
defmodule Person do
use Neo4j.Sips.Model
field :name, required: true
field :email, required: true, unique: true, format: ~r/\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4... | lib/neo4j_sips_models.ex | 0.738292 | 0.697094 | neo4j_sips_models.ex | starcoder |
defmodule Omise.Event do
@moduledoc ~S"""
Provides Event API interfaces.
<https://www.omise.co/events-api>
"""
use Omise.HTTPClient, endpoint: "events"
defstruct object: "event",
id: nil,
livemode: nil,
location: nil,
key: nil,
created: nil,
... | lib/omise/event.ex | 0.904564 | 0.432543 | event.ex | starcoder |
defmodule JSONAPI.Utils.DataToParams do
@moduledoc ~S"""
Converts a Map representation of the JSON:API resource object format into a flat Map convenient for
changeset casting.
"""
alias JSONAPI.Utils.String, as: JString
@spec process(map) :: map
def process(%{"data" => nil}), do: nil
def process(%{"da... | lib/jsonapi/utils/data_to_params.ex | 0.762336 | 0.444203 | data_to_params.ex | starcoder |
defmodule ExSlackBot.Router do
@moduledoc ~s"""
`ExSlackBot.Router` is responsible for routing messages received from the Slack Real-Time Messaging API and routing them to a `GenServer` registered under a name that corresponds to the first segement of the command text--which is the text of the message, split on whi... | lib/exslackbot/router.ex | 0.77586 | 0.497803 | router.ex | starcoder |
defmodule Ameritrade.Option do
@moduledoc false
@derive Jason.Encoder
defstruct putCall: nil,
symbol: nil,
description: nil,
exchangeName: nil,
bidPrice: 0,
askPrice: 0,
lastPrice: 0,
markPrice: 0,
bidSize: 0,
... | lib/schema/option.ex | 0.592784 | 0.494751 | option.ex | starcoder |
defmodule ExGherkin.Scanner.Token do
@moduledoc """
A token combines following three identifiers:
* Label
* Starting Coordinate
* Text
"""
alias ExGherkin.Scanner.Location
import Location
import Record
defrecord(:token,
label: :feature,
label_text: "Feature:",
cord: location(line... | lib/scanner/lib/token.ex | 0.796094 | 0.474449 | token.ex | starcoder |
defmodule Ash.Flow do
@moduledoc """
A flow is a static definition of a set of steps in your system. ALPHA - do not use
Flows are backed by `executors`, which determine how the workflow steps are performed.
The executor can be overriden on invocation, but not all executors will be capable of running all flows.... | lib/ash/flow/flow.ex | 0.782621 | 0.709334 | flow.ex | starcoder |
defmodule Swagger.Parser do
@moduledoc """
This module is responsible for parsing Swagger definition files
into a structure we can use elsewhere.
"""
@doc """
Given a path to a file, checks to see if the file extension is a parseable
type, and if so, parses it and returns the parsed structure.
It rais... | lib/parser.ex | 0.737536 | 0.437163 | parser.ex | starcoder |
defmodule VintageNet.PowerManager.PMControl do
use GenServer
require Logger
@moduledoc """
Power management control GenServer
This GenServer runs a PowerManager implementation for a network device. It
provides the API for powering on and off a device and for signally that it's
working well.
Internall... | lib/vintage_net/power_manager/pm_control.ex | 0.845097 | 0.497009 | pm_control.ex | starcoder |
defmodule Plymio.Codi.Pattern.Doc do
@moduledoc ~S"""
The *doc* pattern builds an `@doc` module attribute.
See `Plymio.Codi` for an overview and documentation terms.
## Pattern: *doc*
Valid keys in the *cpo* are:
| Key | Aliases |
| :--- | :--- |
| `:fun_name` | *:name, :spec_name, :fun_name, :func... | lib/codi/pattern/doc/doc.ex | 0.838134 | 0.521654 | doc.ex | starcoder |
defmodule PollutionDataStream do
@moduledoc false
def importLinesFromCSV(name \\ "pollution.csv") do
File.stream!(name)
end
def convertLine(line) do
[date, time, longitude, latitude, value] = line |> String.split(",")
parsedDate = date |> String.split("-") |> Enum.reverse() |> Enum.map( fn(x) -> el... | src/pollution_data_stream.ex | 0.647464 | 0.447098 | pollution_data_stream.ex | starcoder |
defmodule Cashmere do
@moduledoc """
This module provides the interface to work with Cashmere, a high performance
in-memory caching solution.
To get started with Cashmere, you need to create a module that calls
`use Cashmere`, like this:
defmodule MyApp.Cache do
use Cashmere, purge_interval: _... | lib/cashmere.ex | 0.892928 | 0.571169 | cashmere.ex | starcoder |
defmodule GGity.Examples do
@moduledoc false
def diamonds do
file_name = Path.join([:code.priv_dir(:ggity), "diamonds.csv"])
headers =
File.stream!(file_name)
|> NimbleCSV.RFC4180.parse_stream(skip_headers: false)
|> Enum.take(1)
|> hd()
|> Enum.drop(1)
File.stream!(file... | lib/mix/tasks/examples.ex | 0.514888 | 0.453867 | examples.ex | starcoder |
defmodule GrowthBook.Experiment do
@moduledoc """
Struct holding Experiment configuration.
Holds configuration data for an experiment.
"""
alias GrowthBook.ExperimentOverride
@typedoc """
Experiment
Defines a single **Experiment**. Has a number of properties:
- **`key`** (`String.t()`) - The glob... | lib/growth_book/experiment.ex | 0.92095 | 0.745004 | experiment.ex | starcoder |
defmodule ToYaml do
@moduledoc """
`ToYaml` is a simple module that converts a `map()` to an `iolist()` that will turn in to the expected [YAML](https://yaml.org/) output when printed as a string or written into a file.
This does not aim to contain a full spec implementation but a subset that should be enough for... | lib/to_yaml.ex | 0.858793 | 0.929184 | to_yaml.ex | starcoder |
defmodule Interactor do
@moduledoc"""
Sensors receive the input from the scape. As such, they ought to be tailored for each scape.
We'll use a macro to call the module from the Sensor type.
"""
defstruct id: nil, pid: nil, cortex_id: nil, cortex_pid: nil, name: nil, scape: nil, vl: nil, fanout_ids: "no fanou... | lib/interactor.ex | 0.707 | 0.61025 | interactor.ex | starcoder |
defmodule Pelican.GSX.HTTPClient do
@moduledoc """
Provides functions for interfacing with the gsx2json web API.
"""
@behaviour Pelican.GSX.Client
@endpoint "https://gsx2json-lagroups.herokuapp.com/api"
alias Pelican.Types.{Group, Event}
@doc """
Gets a list of groups from the Google Sheets document... | lib/pelican/gsx/http_client.ex | 0.819569 | 0.438304 | http_client.ex | starcoder |
defmodule HubStorage do
@moduledoc """
**HubStorage** adds a key/value storage mechenism to [Hub](http://github.com/cellulose/hub) with persistence using [PersistentStorage](http://github.com/cellulose/persistent_storage).
Adding HubStorage to your Hub allows remote runtime storage of key/value pairs. This may b... | lib/hub_storage.ex | 0.88634 | 0.973241 | hub_storage.ex | starcoder |
defmodule Unicode.Regex do
@moduledoc """
Implements [Unicode regular expressions](http://unicode.org/reports/tr18/)
by transforming them into regular expressions supported by
the Elixir Regex module.
"""
@default_options "u"
defguard is_perl_set(c) when c in ["p", "P"]
@doc """
Compiles a binary ... | lib/set/regex.ex | 0.880553 | 0.678397 | regex.ex | starcoder |
defmodule Memento.Mnesia do
@moduledoc false
# Helper module to delegate calls to Erlang's `:mnesia`
# via a macro, handle the result including re-raising
# any errors that have been caught.
# Helper API
# ----------
@doc "Call an Mnesia function"
defmacro call(method, arguments \\ []) do
quo... | lib/memento/mnesia.ex | 0.583441 | 0.419232 | mnesia.ex | starcoder |
defmodule SignalServerProxy do
@moduledoc """
Proxy interface to reach the intended `SignalBase`.
Reads the configuration file to get the pids of all available brokers
(`SignalBase`).
Several methods in this module accept a namespace argument. Use this argument
to specify which signal broker(s) to access... | apps/signal_base/lib/signal_server_proxy.ex | 0.617743 | 0.512998 | signal_server_proxy.ex | starcoder |
defmodule ExPng.Image.Pixelation do
@moduledoc """
This module contains code for converting between unfiltered bytestrings and
lists of `t:ExPng.Color.t/0`.
"""
use ExPng.Constants
alias ExPng.{Chunks.Palette, Chunks.Transparency, Color}
import ExPng.Utilities, only: [reduce_to_binary: 1]
@doc """
... | lib/ex_png/image/pixelation.ex | 0.832271 | 0.828558 | pixelation.ex | starcoder |
defmodule Advent.Y2021.D08 do
@moduledoc """
https://adventofcode.com/2021/day/8
"""
@doc """
In the output values, how many times do digits 1, 4, 7, or 8 appear?
"""
@spec part_one(Enumerable.t()) :: non_neg_integer()
def part_one(input) do
input
|> parse_input()
|> Stream.flat_map(fn {_si... | lib/advent/y2021/d08.ex | 0.775562 | 0.708578 | d08.ex | starcoder |
defmodule Monet.Result do
@moduledoc """
Represents the result from a query to MonetDB.
For a select `columns` are the column names and `rows` is a list of lists.
These can be accessed directly. However, the module also implements Enumerable
and Jason.Encode. By default, Enumerationa and Jason.Encode will expose ... | lib/result.ex | 0.831383 | 0.73874 | result.ex | starcoder |
defmodule Hunter.Status do
@moduledoc """
Status entity
## Fields
* `id` - status id
* `uri` - a Fediverse-unique resource ID
* `url` - URL to the status page (can be remote)
* `account` - the `Hunter.Account` which posted the status
* `in_reply_to_id` - `nil` or the ID of the status it repl... | lib/hunter/status.ex | 0.846133 | 0.643147 | status.ex | starcoder |
defmodule Exq.Redis.JobQueue do
@moduledoc """
The JobQueue module is the main abstraction of a job queue on top of Redis.
It provides functionality for:
* Storing jobs in Redis
* Fetching the next job(s) to be executed (and storing a backup of these).
* Scheduling future jobs in Redis
* Fetching... | lib/exq/redis/job_queue.ex | 0.624866 | 0.422862 | job_queue.ex | starcoder |
require Appsignal
appsignal = Application.get_env(:appsignal, :appsignal, Appsignal)
if appsignal.plug? do
require Logger
defmodule Appsignal.JSPlug do
import Plug.Conn
use Appsignal.Config
@transaction Application.get_env(:appsignal, :appsignal_transaction, Appsignal.Transaction)
@moduledoc """
... | lib/appsignal_js_plug.ex | 0.767385 | 0.823293 | appsignal_js_plug.ex | starcoder |
defmodule Juvet.BotFactory do
@moduledoc """
The top-level Supervisor for the whole factory floor.
"""
use Supervisor
@doc """
Starts a `Juvet.BotFactory` supervisor linked to the current process.
"""
def start_link(config) do
Supervisor.start_link(__MODULE__, config, name: __MODULE__)
end
@d... | lib/juvet/bot_factory.ex | 0.909219 | 0.864081 | bot_factory.ex | starcoder |
defmodule Surface.Components.Form do
@moduledoc """
Defines a **form** that lets the user submit information.
Provides a wrapper for `Phoenix.HTML.Form.form_for/3`. Additionally,
adds the form instance that is returned by `form_for/3` into the context,
making it available to any child input.
All options p... | lib/surface/components/form.ex | 0.792304 | 0.462594 | form.ex | starcoder |
defmodule Penelope.ML.Text.POSFeaturizer do
@moduledoc """
The POS featurizer converts a list of lists of tokens into
nested lists containing feature maps relevant to POS tagging for each token.
Features used for the POS tagger are largely inspired by
[A Maximum Entropy Model for Part-Of-Speech
Tagging](ht... | lib/penelope/ml/text/pos_featurizer.ex | 0.78964 | 0.861887 | pos_featurizer.ex | starcoder |
defmodule Brando.M2M do
@moduledoc """
Provides many_to_many helpers for Ecto Changesets.
The following example schema demonstrates how you would configure the
functionality of our examples below.
## Example Schema
schema "models" do
many_to_many :tags, App.Tag,
join_through: App.TagTo... | lib/brando/m2m.ex | 0.819713 | 0.47859 | m2m.ex | starcoder |
defmodule GenUtil.Map do
@doc """
Any map (atom keyed, string keyed, or struct) into an atom keyed map safely.
This function will discard any non-existing-atom string keys; this function
does not created new atoms.
iex> GenUtil.Map.to_atom_keys(%{"name" => "melbo"})
%{name: "melbo"}
iex> GenU... | lib/gen_util/map.ex | 0.715026 | 0.432363 | map.ex | starcoder |
defmodule Ecto.Query.Builder.OrderBy do
@moduledoc false
alias Ecto.Query.Builder
@doc """
Escapes an order by query.
The query is escaped to a list of `{direction, expression}`
pairs at runtime. Escaping also validates direction is one of
`:asc` or `:desc`.
## Examples
iex> escape(quote do [... | lib/ecto/query/builder/order_by.ex | 0.902718 | 0.504639 | order_by.ex | starcoder |
defmodule BruteSolver do
@moduledoc """
Some attempt to create solver for n-equations, of course there will be parser for said equation.
"""
def benchmark_brutes(brutes, string) do
%Persar{notation: notation, variables: vars} = Persar.do_some(string)
brutes |>
Enum.map(fn brute ->
IO.ins... | lib/brute_solver.ex | 0.736495 | 0.493042 | brute_solver.ex | starcoder |
defmodule CSV.Decoder do
@moduledoc ~S"""
The Decoder CSV module sends lines of delimited values from a stream to the parser and converts
rows coming from the CSV parser module to a consumable stream.
In setup, it parallelises lexing and parsing, as well as different lexer/parser pairs as pipes.
The number o... | lib/csv/decoder.ex | 0.90903 | 0.657057 | decoder.ex | starcoder |
defmodule Cryptocomparex do
use Tesla
alias Cryptocomparex.HistoOhlcvsOpts
alias Cryptocomparex.Opts
plug Tesla.Middleware.BaseUrl, "https://min-api.cryptocompare.com"
plug Cryptocomparex.ResponseMiddleware
plug Tesla.Middleware.JSON
@moduledoc """
Documentation for Cryptocomparex.
"""
@doc """
... | lib/cryptocomparex.ex | 0.779154 | 0.799227 | cryptocomparex.ex | starcoder |
defmodule Liquex.Render.Iteration do
@moduledoc false
alias Liquex.Argument
alias Liquex.Collection
alias Liquex.Context
@behaviour Liquex.Render
@impl Liquex.Render
@spec render(any, Context.t()) :: {iodata, Context.t()}
def render({:iteration, tag}, context), do: do_render(tag, context)
def rende... | lib/liquex/render/iteration.ex | 0.666171 | 0.461502 | iteration.ex | starcoder |
defmodule Artus.Entry do
@moduledoc "Model for bibliographic entries"
use Artus.Web, :model
schema "entries" do
# Type and part
field :type, :string
field :part, :integer
# Metadata
field :submit_date, :naive_datetime
field :public, :boolean
# Form fields
field :biblio_record_id... | web/models/entry.ex | 0.560012 | 0.423995 | entry.ex | starcoder |
defmodule PS2.SocketClient do
@moduledoc ~S"""
A module that handles all interaction with Daybreak Games' Planetside 2 Event Streaming service.
## Implementation
To handle incoming game events, your module should `use PS2.SocketClient` and call `PS2.SocketClient.start_link/2`, passing
the desired subscriptio... | lib/ps2/socket_client.ex | 0.890939 | 0.666432 | socket_client.ex | starcoder |
defmodule LastfmArchive.Load do
@moduledoc """
This module provides functions for loading Lastfm data into databases and search engines.
"""
alias LastfmArchive.Utils
@doc """
Ping a Solr core/collection endpoint to check if it is running.
The endpoint can either be a URL string or an atom referring t... | lib/load.ex | 0.874888 | 0.889625 | load.ex | starcoder |
defmodule Formex.View.Collection do
use Phoenix.HTML
import Formex.View
alias __MODULE__
alias Formex.Form
alias Formex.FormCollection
@moduledoc """
Helper functions for templating collection of forms.
See [Type docs](https://hexdocs.pm/formex/Formex.Type.html#module-collections-of-forms)
for examp... | lib/formex/view_collection.ex | 0.659515 | 0.517876 | view_collection.ex | starcoder |
defmodule GuardianTrackable do
@moduledoc """
A [Guardian](https://github.com/ueberauth/guardian) hook to track user sign in. Tracks the following values:
* `sign_in_count` - Increased every time a sign in is made
* `current_sign_in_at` - A timestamp updated when the user signs in
* `last_sign_in_at` ... | lib/guardian_trackable.ex | 0.854718 | 0.466481 | guardian_trackable.ex | starcoder |
defmodule EEx.Tokenizer do
@moduledoc false
@type content :: IO.chardata()
@type line :: non_neg_integer
@type column :: non_neg_integer
@type marker :: '=' | '/' | '|' | ''
@type token ::
{:text, line, column, content}
| {:expr | :start_expr | :middle_expr | :end_expr, line, column, ma... | lib/eex/lib/eex/tokenizer.ex | 0.738198 | 0.516291 | tokenizer.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
@app Mix.Project.config()[:app]
# load the NIF
@compile {:autoload, false}
@on_load :load_... | lib/scenic/math/line.ex | 0.925727 | 0.689417 | line.ex | starcoder |
defmodule Crdt.LWWSet do
@moduledoc """
A LWW-Set is set that supports removal and insertion of items an arbitrary number of times, but
client must provide timestamps for these events. The set can be tuned in a way that it is biased
towards adds or deletes, if an add operation occurs at the same timstamp of a r... | lib/crdt/lww_set.ex | 0.890836 | 0.58062 | lww_set.ex | starcoder |
defmodule MeshxConsul.Service.GenTcpPort do
@moduledoc """
Generates TCP port numbers used by mesh service and upstream endpoints.
Preparing mesh service and mesh upstream endpoints with `MeshxConsul.start/4` and `MeshxConsul.connect/3` requires creation of new TCP addresses used to connect user service provider... | lib/service/gen_tcp_port.ex | 0.835886 | 0.907312 | gen_tcp_port.ex | starcoder |
defmodule Mxpanel.People do
@shared_options_schema [
ip: [
type: :string,
doc: "IP address to get automatic geolocation info."
],
ignore_time: [
type: :boolean,
doc:
"Prevent the `$last_seen` property from incorrectly updating user profile properties with misleading timesta... | lib/mxpanel/people.ex | 0.852721 | 0.526708 | people.ex | starcoder |
defmodule Pushest do
@moduledoc ~S"""
Pushest is a Pusher library leveraging Elixir/OTP to combine server and client-side Pusher features.
Abstracts un/subscription, client-side triggers, private/presence channel authorizations.
Keeps track of subscribed channels and users presence when subscribed to a presence... | lib/pushest.ex | 0.858363 | 0.6563 | pushest.ex | starcoder |
defmodule Guardian.Plug do
@moduledoc """
Guardian.Plug contains functions that assist with interacting with Guardian
via Plugs.
Guardian.Plug is not itself a plug.
## Example
Guardian.Plug.sign_in(conn, user)
Guardian.Plug.sign_in(conn, user, :access)
# stores this JWT in a different lo... | lib/guardian/plug.ex | 0.804828 | 0.514888 | plug.ex | starcoder |
defmodule TypeTest.SpecExample do
defmodule Basics do
@spec any_spec(any) :: any
def any_spec(x), do: x
@spec term_spec(term) :: term
def term_spec(x), do: x
@spec none_spec(any) :: no_return
def none_spec(_), do: raise "foo"
@spec pid_spec(pid) :: pid
def pid_spec(x), do: x
@s... | test/_support/spec_example.ex | 0.849691 | 0.618348 | spec_example.ex | starcoder |
defmodule Printer.Server.Logic do
@moduledoc """
Business logic functions/gaurds/macros to help make the server a bit more readable.
This could(should?) probably be broken down more in the future.
"""
alias Printer.{Connection, Gcode, PubSub, Status}
alias Printer.Server.{Command, PrintJob, ResponseParser... | printer/lib/printer/server/logic.ex | 0.71123 | 0.461623 | logic.ex | starcoder |
defmodule MailSlurpAPI.Api.InboxController do
@moduledoc """
API calls for all endpoints tagged `InboxController`.
"""
alias MailSlurpAPI.Connection
import MailSlurpAPI.RequestBuilder
@doc """
Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can... | lib/mail_slurp_api/api/inbox_controller.ex | 0.734024 | 0.525612 | inbox_controller.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.