content_id large_stringlengths 40 40 | size_bytes int64 1.5k 25k | repo_ids large listlengths 1 410 | tags large listlengths 0 7 | content large_stringlengths 681 25k |
|---|---|---|---|---|
032bfebabc3fd663e66ddcd371cdd4f6ea363c8b | 5,742 | [
63643631,
56907842,
63885140,
67626331,
63335915
] | [
"genserver",
"supervisor",
"documented",
"phoenix"
] | defmodule Phoenix.Transports.LongPoll.Supervisor do
@moduledoc false
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, [], name: __MODULE__)
end
def init([]) do
children = [
worker(Phoenix.Transports.LongPoll.Server, [], restart: :temporary)
]
supervise(children, stra... |
032c345d98c4ba8e7876068c2bc0eeb8da3a3b04 | 4,540 | [
588790131
] | [
"documented"
] | defmodule Explorer.SmartContract.RustVerifierInterface do
@moduledoc """
Adapter for contracts verification with https://github.com/blockscout/blockscout-rs/blob/main/smart-contract-verifier
"""
alias Explorer.Utility.RustService
alias HTTPoison.Response
require Logger
@post_timeout :infinity
@reques... |
032c53d4dcf47546034968e2fc1b5e82c5786c3d | 6,530 | [
970817672
] | [
"documented"
] | defmodule Frestyl.AIService do
@moduledoc """
Service for interacting with AI providers (OpenAI, Anthropic, etc.)
"""
@doc """
Configure which AI provider to use.
"""
def provider do
Application.get_env(:frestyl, :ai_provider, :openai)
end
@doc """
Generate a response from the AI model for a g... |
032c74d57b579476dd5ace7f6a7e4973067dd92f | 4,319 | [
200460593
] | [
"documented"
] | defmodule Elxcomp do
@moduledoc """
generated compiled code
"""
def is_compiled([_, [name | _]]) do
Enum.member?([], name)
end
def prove_builtin(_, _, _, _, _) do
nil
end
end
defmodule Compile do
@moduledoc """
Compile module include compiler of Elxlog
"""
def compile(fname, def, elixir... |
032c9f41e8832ba14bf14baf2c02c86df2448119 | 1,831 | [
104793233
] | [
"documented",
"ecto"
] | defmodule Microblog.Feedback do
@moduledoc """
The Feedback context.
"""
import Ecto.Query, warn: false
alias Microblog.Repo
alias Microblog.Feedback.Like
alias Microblog.Account.User
@doc """
Returns the list of likes.
## Examples
iex> list_likes()
[%Like{}, ...]
"""
def list_... |
032ce834b2868e689157467c9fceee518a55248d | 2,383 | [
256005654
] | [
"test"
] | defmodule SallyDatapointTest do
use ExUnit.Case, async: true
use Sally.TestAid
@moduletag sally: true, sally_datapoint: true
setup [:dev_alias_add]
describe "Sally.Datapoint.status/2" do
@tag dev_alias_add: [auto: :ds, daps: [history: 10, milliseconds: -1]]
test "calculates correct average (default... |
032d7d19218d7044c58e16f0a54f767f3f1c4891 | 3,032 | [
89515020
] | [
"test"
] | defmodule IslandsEngine.Game.ServerTest do
use ExUnit.Case, async: true
alias IslandsEngine.{Game.Server, Player, IslandSet, Island, Board, Coordinate, Rules}
@name "Frank"
setup do
{:ok, pid} = Server.start_link(@name)
{:ok, server: pid}
end
test "should initalize a Game", %{server: server} do... |
032db962daa5dfc2b37d3970bc32cd1208a4d877 | 3,338 | [
104015562
] | [
"test"
] | defmodule EventsToolsWeb.OrganizationControllerTest do
use EventsToolsWeb.ConnCase
alias EventsTools.Organizations
@create_attrs %{email: "some email", facebook: "some facebook", github: "some github", linkedin: "some linkedin", name: "some name", phone: "some phone", summary: "some summary", twitter: "some twi... |
032dcf826f8d79ccccb80e35658fd7f9c39e303a | 14,155 | [
567833001,
66679983,
299848916,
644161054,
708209739
] | [
"macro",
"documented"
] | defmodule Nostrum.Voice.Opus do
@moduledoc false
import Bitwise
# Number of samples in a 20ms Opus frame at 48kHz sample rate
@samples_per_frame 960
# Number of microseconds per Opus frame/packet
@usec_per_frame 20_000
def samples_per_frame, do: @samples_per_frame
def usec_per_frame, do: @usec_per_... |
032df6a2dbde22785e5091cb301526a03584bb67 | 4,266 | [
989917979
] | [
"documented"
] | defmodule ExLLM.Plugs.Providers.BedrockParseStreamResponse do
@moduledoc """
Parses streaming responses from AWS Bedrock API.
Bedrock streams events in a specific format with different
event types for different model families.
"""
use ExLLM.Plug
alias ExLLM.Pipeline.Request
@impl true
def init(opt... |
032edd7b7979c7aea4bbf33cc1f32d0b5a8a27ee | 20,476 | [
883804673
] | [
"liveview",
"documented"
] | defmodule CommunityDemoWeb.Components.Avatar do
@moduledoc """
The `CommunityDemoWeb.Components.Avatar` module provides a set of components for creating and
managing avatar elements in your **Phoenix LiveView** applications.
It supports various avatar types, including standard avatars, placeholders, and placeh... |
032ef0b79b4dba2578bc7027f6af5908cade80df | 2,575 | [
69770581
] | [
"typespec",
"documented"
] | defmodule Alpr do
@doc """
Submit an image of a license that has been taken via IR or visible light.
The license plate number will be returned as a string.
"""
@spec process(String.t) :: String.t
def process(image_name) do
image_name
|> load_image
|> preprocess
|> localize
|> cc_anal... |
032efd27479344bb12cc9e0a757a24a91e10084a | 2,364 | [
840406253
] | [
"macro"
] | defmodule BasicVersus do
defmacro __using__(sub_versus: sub_versus, winning_score: winning_score, win_differential: win_differential, tiebreak_versus: tiebreak_versus) do
common_ast =
quote do
defp win(scores, point_winner) do
winner_new_score = Enum.at(scores, point_winner) + 1
... |
032f0557037c677bcc2d20f9216604ec1c88ca18 | 1,700 | [
332219444
] | [
"documented"
] | defmodule Mix.Tasks.Vite.Digest do
@moduledoc """
Generate a phoenix cache manifest from the vite generated manifest.json.
"""
@shortdoc "Generate a phoenix cache manifest for vite assets"
use Mix.Task
require Logger
@default_input_path "priv/static"
@impl Mix.Task
def run(_args) do
vite_manifes... |
032f0f7dab820d4c5919366328f138a3f9702214 | 2,497 | [
591388313
] | [
"typespec",
"documented"
] | defmodule NervesLivebook.MixInstall do
@moduledoc """
Simulate Mix.install for Nerves Livebook
Nerves Livebook currently doesn't support `Mix.install/2`, but hopefully it
will in the future. As a workaround, check whether dependencies that the user
specifies are available and give them a help message if not.... |
032f1efee92243bebd0d30f48d406f0422424f19 | 11,896 | [
962110627
] | [
"liveview",
"phoenix",
"test"
] | defmodule DalkovenWeb.UserAuthTest do
use DalkovenWeb.ConnCase
alias Phoenix.LiveView
alias Dalkoven.Accounts
alias Dalkoven.Accounts.Scope
alias DalkovenWeb.UserAuth
import Dalkoven.AccountsFixtures
@remember_me_cookie "_dalkoven_web_user_remember_me"
setup %{conn: conn} do
conn =
conn
... |
032f6615b366ccdd1656d53a36c195fa72ea9a59 | 2,465 | [
113190004
] | [] | defmodule Prominade do
def strtoarray(inputlist) do
trimmedstring=String.trim(inputlist)
endlgone=String.split(trimmedstring,",")
listofstrings=Enum.map(endlgone, fn(x)->String.split_at(x, 1) end)
listofstrings=Enum.map(listofstrings, fn({x,y})->{x,List.to_tuple(String.split(y, "/"))} end)
listofs... |
03303dc58a557a3845ced4b95970e81848f0a7f9 | 1,696 | [
219089995
] | [
"documented",
"ecto"
] | defmodule Hw06.Jobs do
@moduledoc """
The Jobs context.
"""
import Ecto.Query, warn: false
alias Hw06.Repo
alias Hw06.Jobs.Job
@doc """
Returns the list of jobs.
## Examples
iex> list_jobs()
[%Job{}, ...]
"""
def list_jobs do
Repo.all(Job)
end
@doc... |
03304223d8b9de2a8e02c5532d30f5982a597f5c | 3,282 | [
106712767
] | [
"typespec",
"macro",
"documented",
"liveview"
] | defmodule Sanbase.EventBus.EventEmitter do
@moduledoc """
A behaviour module for implementing Event Bus Emitter
When the module is used, it exposes a single `emit_event/3` function that
must be used by the callers. The module that implements the behaviour must
define the handle_event/3 function.
"""
def... |
0330435d7b8038b584105447d8de1ac71c1bbf1d | 3,201 | [
237945670
] | [
"genserver",
"documented"
] | require Logger
defmodule Colins.Timesteps.TimestepData do
use GenServer
@moduledoc "
Data store for the timesteps. ie benchmark data.
"
def start_link() do
GenServer.start_link(__MODULE__,[],[name: __MODULE__])
end
def init([]) do
state = %{"timepoint_data" => %{},
"... |
03305015e743cd5af25108dbc3bbc07e3573727d | 2,501 | [
433609103
] | [] | defmodule Day4.Part1 do
def run() do
# "lib/day4_data_test.txt"
# "lib/day4_data.txt"
[numbers | boards] =
"lib/day4_data.txt"
|> File.read!()
|> String.split("\n", trim: true)
numbers = String.split(numbers, ",") |> Enum.map(&String.to_integer/1)
boards = prepare_boards(boards... |
03306858891a74e03140ce5066b508d883e044bf | 8,587 | [
244924332
] | [] |
defmodule Poker do
@card_map %{
# Clubs
1 => {1, "C"}, # Ace
2 => {2, "C"},
3 => {3, "C"},
4 => {4, "C"},
5 => {5, "C"},
6 => {6, "C"},
7 => {7, "C"},
8 => {8, "C"},
9 => {9, "C"},
10 => {10, "C"},
11 => {11, "C"}, # Jack
12 => {12, "C"}, # Queen
13 => {13, "C"}, # King
# Diamonds
14... |
0330883e386ed30abb9f4182fdb4a60616e6b8e0 | 2,264 | [
162148260
] | [
"documented"
] | defmodule ExChecker.FEN.Writer do
@moduledoc """
Provides the ability to write the state of a chess game to FEN.
"""
alias ExChecker.{CastleHelper, Helpers, Piece}
@doc """
iex> game = ExChecker.Game.new
iex> ExChecker.FEN.Writer.write(game)
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w ... |
0330a9e4afb981e3d502b6bae7ad72a1b6dec640 | 2,433 | [
128714359
] | [
"documented",
"ecto"
] | defmodule Rapcor.ProviderAccounts.Provider do
use Ecto.Schema
import Ecto.Changeset
import Comeonin.Bcrypt, only: [hashpwsalt: 1, check_pass: 2]
alias Ecto.Changeset
@attrs [
:administrative_area,
:sub_administrative_area,
:contact_email,
:contact_number,
:country,
:locality,
:nam... |
0330d07155f5dd66d1c97f3b7b8a08252505e9d9 | 16,004 | [
118507326
] | [
"test"
] | defmodule SweetXmlTest do
use ExUnit.Case, async: true
doctest SweetXml
import SweetXml
setup do
simple = File.read!("./test/files/simple.xml")
complex = File.read!("./test/files/complex.xml")
complex_stream = File.stream!("./test/files/complex.xml")
simple_stream = File.stream!("./test/files/... |
0330ea949769629a3c7a7547d670a4644f1b199a | 6,498 | [
201242609
] | [
"documented"
] | defmodule CA.MDoc do
require CBOR
@moduledoc "CA/MDOC MSO mDOC library."
# [1]. https://mobiledl-e5018.web.app/ISO_18013-5_E_draft.pdf
# [2]. https://learn.mattr.global/docs/mdocs
def decode(nil) do nil end
def decode(bin) do CBOR.decode(bin) end
def replace(s,a,b) do :re.replace(s,a,b,[:global,{:return,:b... |
0330f618552c7a95ed26be2727146866242af699 | 1,776 | [
130729671
] | [
"phoenix"
] | defmodule PhoenixFinal.PostController do
use PhoenixFinal.Web, :controller
alias PhoenixFinal.Post
def index(conn, _params) do
posts = Repo.all(Post)
render(conn, "index.html", posts: posts)
end
def new(conn, _params) do
changeset = Post.changeset(%Post{})
render(conn, "new.html", changeset... |
03312bbc8e07f8f1ce7982d60dd8f9f7973dab5a | 11,580 | [
776474430
] | [] | # adapted from Java version in 1brc repo (https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CreateMeasurements.java)
defmodule OneBRC.MeasurementsGenerator do
@measurements_file "./data/measurements.{COUNT}.txt"
@count 1_000_000_000
alias OneBRC.MeasurementsGenerator.WeatherStatio... |
03312cce96c351c73f1cc158db74df0e328b703b | 1,666 | [
155293448
] | [
"phoenix",
"ecto"
] | defmodule LasWeb.SongController do
use LasWeb, :controller
alias Las.Songs
alias Las.Songs.Song
def index(conn, _params) do
songs = Songs.list_songs()
render(conn, "index.html", songs: songs)
end
def new(conn, _params) do
changeset = Songs.change_song(%Song{})
render(conn, "new.html", cha... |
0331309023b6c7c780489e12a87496b394611e13 | 15,235 | [
279715065,
780334795,
437906643,
493863264
] | [
"macro",
"typespec",
"test",
"documented"
] | Code.require_file("../test_helper.exs", __DIR__)
defmodule Code.Formatter.GeneralTest do
use ExUnit.Case, async: true
import CodeFormatterHelpers
@short_length [line_length: 10]
test "does not emit warnings" do
assert_format "fn -> end", "fn -> nil end"
end
describe "unicode normalization" do
t... |
03318f21f617565bbda819cdddc21b93729b979d | 1,856 | [
458194496
] | [
"macro",
"documented",
"phoenix"
] | defmodule NeosWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, views, channels and so on.
This can be used in your application as:
use NeosWeb, :controller
use NeosWeb, :view
The definitions below will be executed for every view,
controller, etc, so k... |
0331ad3388a3016c2a37f694747ffc061041cf74 | 7,046 | [
173561092
] | [
"documented",
"ecto"
] | defmodule Gigpillar.Gigs do
@moduledoc """
The Gigs context.
"""
import Ecto.Query, warn: false
alias Gigpillar.Repo
alias Gigpillar.Gigs.Gig
@doc """
Returns the list of gigs.
## Examples
iex> list_gigs()
[%Gig{}, ...]
"""
def list_gigs do
Repo.all(from(g in Gig, preload: [:... |
0331ef2ad78474064e80f80d58e91adc3c3b849d | 1,576 | [
46932258
] | [
"documented",
"ecto"
] | defmodule Registrations.Waydowntown.Reveal do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias Registrations.Repo
alias Registrations.Waydowntown.Answer
alias Registrations.Waydowntown.Run
@primary_key {:id, :binary_id, autogenerate: true}
@schema_prefix "waydowntown"
... |
0331f711ed9882119fa6148aaffecc87134444ce | 1,528 | [
81615151
] | [
"test"
] | defmodule Adpq.UserTest do
use Adpq.ModelCase
alias Adpq.{User, Repo}
@valid_attrs %{name: "name", password: "pw", role: "USER", department: "FOO"}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = User.changeset(%User{}, @valid_attrs)
assert changeset.valid?
end
test "c... |
03324fab7c6597a76491ec97987f116ffcacaef6 | 2,061 | [
474552370
] | [
"documented"
] | defmodule Poker.PokerSession.PokerMessenger do
@moduledoc """
module for handling sending messages for poker session
"""
alias Poker.Slack.{MessageBlocks, Slack}
def message_channel(%{channel: channel}, message) do
blocks = [MessageBlocks.text_section(message, "channel-message")]
Slack.send_message... |
03327d82d997546f851cb467333f6434e13e2fd1 | 4,046 | [
875907489
] | [
"typespec",
"test",
"documented",
"ecto"
] | defmodule Mix.Tasks.BorderBound.Gen.Action do
@shortdoc "Generates an action"
@moduledoc """
#{@shortdoc}
Generates a business logic "private" module and exposes it on the context
## Example
```bash
mix border_bound.gen.action -n CreateDevice -c Inventory -s Devices
```
## Options
* `--name` or... |
033289754f3d8c075c191aad07d0577166b71efe | 2,246 | [
395476931
] | [
"documented"
] | defmodule SurfaceRichComponents.TextEditor do
use Surface.Component
@moduledoc """
Headless rich text editor component.
Wrapper around [tiptap editor](https://www.tiptap.dev/)
**NOTE: You need to install `@tiptap/core` and `@tiptap/starter-kit` JS packages
To control the editor you need to create a tool... |
03333a6da4983cc676bb85242d7b7243ddc52f7d | 2,642 | [
450681132
] | [
"test"
] | defmodule Canvex.Draw.RectangleTest do
use Canvex.DataCase, async: true
alias Canvex.Canvas.Create
alias Canvex.Draw.Rectangle
setup do
{:ok, canvas} = Create.call(%{width: 5, height: 5, fill: ' ', user_id: Ecto.UUID.generate()})
%{canvas: canvas}
end
describe "call/2" do
test "should draw a ... |
0333f25daed11b237c020fa1b130dbcbc4d60230 | 11,878 | [
162377738
] | [
"phoenix"
] | defmodule MemberLinkWeb.Router do
use MemberLinkWeb, :router
if Mix.env == :dev || Mix.env == :test do
forward "/sent_emails", Bamboo.EmailPreviewPlug
else
use Plug.ErrorHandler
use Sentry.Plug
end
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
... |
033433eb082c4caacb90ca2d8fe04f3917efe412 | 3,512 | [
754752286
] | [
"liveview",
"ecto"
] | defmodule ArtGalleryWeb.GalleryLive.FormComponent do
use ArtGalleryWeb, :live_component
alias ArtGallery.Galleries
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage gallery records in your database.</:subtitle>
</.heade... |
03348db69a2ded6910442cd278ec377336e7958e | 1,687 | [
75657500
] | [
"documented"
] | defmodule Day24 do
@doc """
## Examples
iex> Helpers.input("day_24_example_1") |> Day24.part1()
2_129_920
iex> Helpers.input("day_24") |> Day24.part1()
18_350_099
"""
def part1(input) do
input
|> parse()
|> run()
|> biodiversity_rating()
end
defp run(grid, old_grids \\ MapS... |
0334934619b79c7d35efef4efdc6b58fdf77d704 | 11,622 | [
416383998
] | [
"liveview",
"documented",
"ecto"
] | defmodule BikeBrigadeWeb.Components.LiveLocation do
use BikeBrigadeWeb, :live_component
alias Phoenix.LiveView.JS
alias BikeBrigade.Locations.Location
import Ecto.Changeset
defmodule FormParams do
@moduledoc """
Parse the form name in the format "foo[bar][baz]" into ["foo", "bar", "baz"]
"""
... |
0334969ffe1e3e06adebb84ff311164d0aa577ad | 1,613 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1EventConfig do
@moduledoc """
Config for video event human labeling task.
## Attributes
* `annotationSpecSets` (*type:* `list(String.t)`, *default:* `nil`) - Required. The list of annotation spec set resource name. Similar to video... |
033499d5565ac61ea709d167c1de40975dbf0911 | 1,527 | [
643988620
] | [] | defmodule AshQueryBuilder.MixProject do
use Mix.Project
@app :ash_query_builder
@name "AshQueryBuilder"
@description "A simple query builder helper for Ash.Query"
@version "0.9.1"
@github "https://github.com/sezaru/#{@app}"
@author "Eduardo Barreto Alexandre"
@license "MIT"
def project do
[
... |
0335abf8ba81d91b59f5198b544d349b730cac33 | 1,653 | [
340929377
] | [
"ecto"
] | defmodule Pulitzer.Core do
alias Pulitzer.Repo
alias Pulitzer.Core.{
Article,
ArticleQuery,
Bucket,
Detector,
Scanner,
Tokenizer
}
def create_bucket(identifier) do
%Bucket{}
|> Bucket.create_changeset(%{identifier: identifier})
|> Repo.insert()
end
def get_bucket!(buck... |
0335b1ae46f09fffc7b7e0fa9ff2e7229d4c2e9a | 1,690 | [
635631775
] | [] | import Config
# For production, don't forget to configure the url host
# to something meaningful, Phoenix uses this information
# when generating URLs.
# Note we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the `mix phx.digest` task,
# wh... |
0336285b6bdc08104d7f36e0970c04812cc0cdd9 | 2,176 | [
716750047
] | [] | import Nx, only: :sigils
alias Cucurbit.OpenSCAD.Body
alias Cucurbit.OpenSCAD.CSG
alias Cucurbit.OpenSCAD.Sketch
alias Cucurbit.OpenSCAD.Transformation
defmodule ParametricTray do
def scene(tray_size_x, tray_size_y, regions) do
{num_rows, num_cols} = Nx.shape(regions)
wall_height = 20
wall_thickness = ... |
03366f1fc0a8fb2e4d7a96cec1affe499f73049e | 1,825 | [
650696792
] | [] | defmodule Data.MixProject do
use Mix.Project
def project do
[
app: :data,
version: "0.1.0",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mi... |
0336b9cfc27573f05b57349749e424ed144a59b8 | 1,967 | [
715923440
] | [
"typespec"
] | defmodule Ecobee.Api.Auth do
require Logger
use Tesla
plug(Tesla.Middleware.BaseUrl, Ecobee.Api.endpoint())
plug(Tesla.Middleware.Headers, Ecobee.Api.default_headers())
plug(Tesla.Middleware.JSON)
@spec request_pin() :: {:error, any()} | {:ok, Ecobee.Api.Models.PinResponse.t()}
def request_pin do
c... |
0336d54d2cca621570a2fcd72ed244b667025eee | 5,464 | [
987603131
] | [
"documented"
] | defmodule MCPServerDemo.EchoHandler do
@moduledoc """
A simple MCP handler implementation for demonstration and testing purposes.
It echoes some parameters and provides fixed responses.
"""
use MCPServer.Implementation # Assuming this will be available via path dependency
require Logger
@impl MCPServer.... |
0336f52a2f2c853f39f81e9e313ac5b60ed08a4f | 2,347 | [
260788987
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule PhxliveviewWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, views, channels and so on.
This can be used in your application as:
use PhxliveviewWeb, :controller
use PhxliveviewWeb, :view
The definitions below will be executed for every view,
... |
03375274a14d68ce58327fb93cb5a406dac8b7af | 20,040 | [
910586081
] | [
"documented"
] | defmodule BattleshipWeb.CoreComponents.SwiftUI do
@moduledoc """
Provides core UI components built for SwiftUI.
This file contains feature parity components to your applications's CoreComponent module.
The goal is to retain a common API for fast prototyping. Leveraging your existing knowledge
of the `Battles... |
0337549639784bb115dc2cf4ba0448231139e934 | 3,227 | [
490462769
] | [
"test"
] | defmodule ReportAsyncTest do
use ExUnit.Case
doctest ReportAsync
describe "build_async/1" do
test "fails when parameter is not a list" do
expected_response = {:error, "The parameter file_name must be a list!"}
response = ReportAsync.build_async("should fail")
assert response == expected_r... |
0337bd3ab20ad58c5be8369f2cd969d72280d0a3 | 2,505 | [
79916685
] | [
"genserver",
"typespec",
"test",
"documented"
] | defmodule Exfmt.Integration.ModuleTest do
use ExUnit.Case, async: true
import Support.Integration
test "multiple functions" do
assert_format """
defmodule App do
def run do
:ok
end
def stop do
:ok
end
end
"""
end
test "multiple clauses of a function"... |
0337eda80498316022ebd9ae5bdb63416603d2a2 | 2,150 | [
366862092
] | [] |
IO.inspect(x = 1) # 1
# a valid expression, and it matched because both the left and right side are equal to 1.
IO.inspect(1 = x) # 1
#2 = x
#** (MatchError) no match of right hand side value: 1
# A variable can only be assigned on the left side of =
#1 = unknown
#** (CompileError) iex:1: undefined function unknown/0
... |
0338a8a79886945ef9a9f2016fb3d78f04475e1b | 2,532 | [
861752384
] | [] | defmodule ParseLoader do
def parse_line(line) do
[
datetime_str,
pollutionType_str,
pollutionLevel_str,
stationId_str,
stationName_str,
location_str
] = line |> String.split(";")
%{
:location =>
location_str
|> String.split(",")
|> Enum.ma... |
0338d98a2e52dbf5719c3c4707bad4f93d3a13ac | 1,714 | [
473159795
] | [] | defmodule ExIsbndb.MixProject do
use Mix.Project
def project do
[
app: :ex_isbndb,
elixir: "~> 1.10",
start_permanent: Mix.env() == :prod,
deps: deps(),
# Package
version: "1.0.1",
description: description(),
package: package(),
# Coveralls
test_cov... |
033902fe9e40f80d63fbba6078741c50a801cd37 | 4,664 | [
297066362
] | [
"genserver",
"documented"
] | defmodule ExDag.Store.MemoryStoreData do
@moduledoc """
Backend data module for ExDag.Store.MemoryStore
"""
@enforce_keys [:dags, :runs, :options]
defstruct dags: %{},
runs: %{},
options: %{}
alias ExDag.DAG
alias ExDag.DAGRun
def new(options) do
struct!(__MODULE__, runs: %... |
033972611e384464467cfd71cab27b20c8f89b3d | 9,651 | [
77396842
] | [
"typespec",
"documented"
] | defmodule ELA.Matrix do
alias ELA.Vector, as: Vector
@moduledoc"""
Contains operations for working with matrices.
"""
@doc"""
Returns an identity matrix with the provided dimension.
## Examples
iex> Matrix.identity(3)
[[1, 0, 0],
[0, 1, 0],
[0, 0, 1]]
"""
@spec i... |
0339e69cdc6a2e694a5a04dd7c9265ae367be92b | 6,437 | [
150101643
] | [] | %{
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [... |
033a3bab166e5bc4f83c6684250f59756cb01fd2 | 4,496 | [
956317527
] | [] | defmodule Camera do
defstruct [
:image_width,
:aspect_ratio,
:samples_per_pixel,
:max_depth,
:vfov,
:lookfrom,
:lookat,
:vup,
:defocus_angle,
:focus_dist
]
def ray_color(r, max_depth, hittable_list) do
if max_depth <= 0 do
V.splat(0.0)
else
{hit, _max, ... |
033a5f31a4c9c52845834707fb8983fde2a43df5 | 2,376 | [
110998566
] | [
"test"
] | defmodule TartuParking.UserControllerTest do
use TartuParking.ConnCase
alias TartuParking.User
@valid_attrs %{name: "some name", password: "some password", username: "some username"}
@invalid_attrs %{}
test "lists all entries on index", %{conn: conn} do
conn = get conn, user_path(conn, :index)
asser... |
033ad469b8fc85854e26cd2a802a9be156589871 | 10,791 | [
764844821
] | [
"documented",
"ecto"
] | defmodule Quic.Parameters do
@moduledoc """
The Parameters context.
"""
import Ecto.Query, warn: false
alias Quic.Repo
alias Quic.Parameters.Parameter
@doc """
Returns the list of parameters.
## Examples
iex> list_parameters()
[%Parameter{}, ...]
"""
def list_parameters do
Rep... |
033b73c70b660fb17a5a15dcbbd92d8847a7df8a | 2,327 | [
916215915
] | [
"ecto"
] | defmodule RebuWebApi.Accounts.Affiliate do
use Ecto.Schema
import Ecto.Changeset
alias RebuWebApi.Accounts.AccountChangesetHelpers
@derive {Jason.Encoder,
only: [
:id,
:first_name,
:last_name,
:email,
:role,
:inserted_at,
... |
033bc181e0865ef79283297dec9340145fb4efc6 | 2,222 | [
28597164
] | [
"typespec",
"documented"
] | defmodule Ivy.Skeleton do
@moduledoc """
Contains functionality and templates to generate a basic skeleton for an ivy site.
"""
@gitignore """
_out/
"""
# FIXME: transition to run-time definition and use plain string substitution instead?
@ivy_conf """
use Mix.Config
# Add/modify ivy behaviour below:
config ... |
033c606b638efbecefad524fc507b85f014eb4ee | 1,960 | [
95521224
] | [
"test"
] | defmodule PortalTest do
use ExUnit.Case, async: true
test "create/1 creates Portal door" do
color = :blue
{:ok, pid} = Portal.create(color)
assert Process.info(pid, :registered_name) == {:registered_name, color}
children = Supervisor.which_children(Portal.Supervisor)
assert Enum.member?(childre... |
033c7381026e4d8c2d8281afb457ecb179f47e3e | 5,359 | [
810146441
] | [
"documented"
] | defmodule ChinaAdminDivisions.Gen.Lv4xg.M3208 do
@moduledoc false
def name("320871420000"), do: "张码办"
def name("320871412000"), do: "高铁商务区办"
def name("320871411000"), do: "福地路办"
def name("320871410000"), do: "富城路办"
def name("320871405000"), do: "金港路办"
def name("320871401000"), do: "新港办"
def name("32087... |
033c9da38b1a9c57ef8a873486f8d9e8f2a57124 | 1,982 | [
171021521
] | [
"typespec",
"documented"
] | defmodule Amortisen.FinancialTransactionTaxes do
@moduledoc """
Provide functions to compute Brazil financial transaction taxes (IOF).
"""
@fixed_rate 0.38
@daily_rate 0.0082
@doc """
Used to compute the taxes (IOF) for each amortization amount of a schedule table.
(amortization * (fixed_rate + daily_... |
033ccdb3d06d5692758e38ae4e2c927bbe5168e7 | 1,610 | [
167620676
] | [
"test"
] | defmodule Librarian.Responders.RemoveTest do
use ExUnit.Case
alias Librarian.{Admins, Library}
alias Librarian.Responders.Remove
setup do
Supervisor.terminate_child(Librarian.Supervisor, :library)
Supervisor.restart_child(Librarian.Supervisor, :library)
Supervisor.terminate_child(Librarian.Supervis... |
033cefc646a2a52b935e9a4f08a5b29c7f0b1908 | 6,031 | [
179286565
] | [
"test"
] | defmodule YamlixirTest do
use ExUnit.Case, async: true
import Yamlixir, only: [sigil_y: 2]
doctest Yamlixir
test "decode/2 should decode blank yaml" do
yaml = fixture("blank")
assert {:ok, []} = Yamlixir.decode(yaml)
end
test "decode!/2 should decode blank yaml" do
yaml = fixture("blank")
... |
033cfc31bd9cf559baf28362eed05a857955fb62 | 5,877 | [
317546749
] | [] | defmodule AdventOfCode.Solutions.Y24.Day24 do
alias AoC.Input
def parse(input, _part) do
[wires, gates] = String.split(String.trim(Input.read!(input)), "\n\n")
{parse_wires(wires), parse_gates(gates)}
end
defp parse_wires(lines) do
lines
|> String.split("\n")
|> Enum.map(fn <<name::binary-... |
033d11049fd7d2c4f7d5aaf87b58fe9259e73e4f | 4,289 | [
213995837
] | [
"test",
"ecto"
] | defmodule AbsinthePaginatorTest do
use ExUnit.Case
doctest AbsinthePaginator
import Ecto.Query
alias AbsinthePaginatorTest.{Repo, Item}
import AbsinthePaginator, only: [from_paginator: 4]
setup do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo)
{:ok, i1} = Repo.insert(%Item{title: "c"})
{:ok, ... |
033d50fa7c1605a2e8c70d0246d84503b8e4206f | 2,766 | [
812835767
] | [] | import Config
# Configure your database
config :film_app, FilmApp.Repo,
username: "postgres",
password: "password",
hostname: "localhost",
database: "film_app_dev",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
# For development, we disable any cache and enable
# debuggi... |
033da0bd504f2f5363c9fbfa305bb02e9c4e1852 | 2,192 | [
896875675
] | [] | defmodule Day11 do
@file_path "data/task.data"
defp read_data(file_path) do
case File.read(file_path) do
{:ok, content} ->
[first_line | _] = String.split(content, "\n")
first_line |> String.split(" ") |> Enum.map(&String.to_integer/1)
{:error, reason} ->
IO.puts("Failed to... |
033e496f84410e5c9749a41644053fa7f1774666 | 2,315 | [
180368458
] | [
"test"
] | if !System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("largest_series_product.exs", __DIR__)
end
ExUnit.start()
ExUnit.configure(exclude: :pending, trace: true)
defmodule LargestSeriesProductTest do
use ExUnit.Case
# @tag :pending
test "largest product of 2" do
assert Series.largest_product("012... |
033efff0f008af9f093dcfebaae6d7f6176d26bb | 2,823 | [
200046087
] | [
"test",
"documented"
] | defmodule Schemata.Validators.DateToTest do
@moduledoc false
use ExUnit.Case
use Schemata
describe "when schema matches" do
test "returns :ok when equal is not enabled" do
assert :ok =
SchemaValidator.validate(
%Schema{
properties: %{
... |
033fe2daeca5856e4f20b7d52dbdee8d45161c8d | 2,627 | [
147609128
] | [] | import Config
# For production, we often load configuration from external
# sources, such as your system environment. For this reason,
# you won't find the :http configuration below, but set inside
# LinksWeb.Endpoint.init/2 when load_from_system_env is
# true. Any dynamic configuration should be done there.
#
# Don't... |
03400861e57ca386a3670901389fb3c4b5c474c2 | 1,878 | [
206975762
] | [
"test",
"ecto"
] | defmodule Discussions.AccountTest do
use Discussions.DataCase
alias Discussions.Account
describe "users" do
alias Discussions.Account.User
@valid_attrs %{email: "some email"}
@update_attrs %{email: "some updated email"}
@invalid_attrs %{email: nil}
def user_fixture(attrs \\ %{}) do
{... |
03402b186c6dc5ce1895aa1efb7c6e132c80ebfd | 1,994 | [
299057193
] | [
"documented",
"ecto"
] | defmodule IncidentReport.Schema.Incident do
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :id, autogenerate: true}
@timestamps_opts [type: :utc_datetime]
@foreign_key_type :id
@all_attributes_create [
:name,
:relation,
:email,
:phone_number,
:image_url,
:notes,
:stat... |
0340c36153bacb07ed369c4f909129a13961991d | 1,564 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Redis.V1beta1.Model.MaintenanceSchedule do
@moduledoc """
Upcoming maintenance schedule. If no maintenance is scheduled, fields are not populated.
## Attributes
* `canReschedule` (*type:* `boolean()`, *default:* `nil`) - If the scheduled maintenance can be rescheduled, default is true.
... |
034102149507c0510dce5a9ef0b6d79ff9c5bab4 | 8,682 | [
974674586
] | [
"typespec",
"documented"
] | defmodule Apify.Storage.RequestQueues.Requests do
@moduledoc """
Provides API endpoints related to storage/request queues/requests
"""
@default_client Apify.Client
@doc """
Delete request
Deletes given request from queue.
## Options
* `clientKey`: A unique identifier of the client accessing the... |
03413e79f24df64fc41867e9a20f7efa9dc81972 | 1,864 | [
429403875
] | [
"test",
"ecto"
] | defmodule Timemanager.UsersTest do
use Timemanager.DataCase
alias Timemanager.Users
describe "users" do
alias Timemanager.Users.USER
import Timemanager.UsersFixtures
@invalid_attrs %{email: nil, username: nil}
test "list_users/0 returns all users" do
user = user_fixture()
assert U... |
03415b41b39f45ac2421db4d3105684a6ab9c17b | 3,315 | [
950751962
] | [
"test"
] | defmodule Admin.AdminDirTestConcurrency do
use ExUnit.Case, async: false
alias Sportify
alias Admin.AdminDir
# Función para reiniciar la secuencia de una tabla
defp reset_sequence(table_name) do
# Generar el nombre de la secuencia asociada a la tabla
sequence_name = "#{table_name}_id_seq"
# Ejec... |
0341dd38b84dbcc2425177ceb4f636705cedffe5 | 2,334 | [
26083748
] | [] | # Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Entice.Web.Repo.insert!(%SomeModel{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail ... |
0342519abad5488f99c7cb83b7237e78fea7893e | 1,548 | [
132670620
] | [
"ecto"
] | defmodule BlueJet.Repo.Migrations.CreateFile do
use Ecto.Migration
def change do
create table(:files, primary_key: false) do
add :id, :binary_id, primary_key: true
add :account_id, references(:accounts, type: :binary_id, on_delete: :delete_all)
add :user_id, references(:users, type: :binary_i... |
0342ff9a4a23e0fd080eef39054585b6bcf929e4 | 1,896 | [
384102053
] | [
"documented"
] | defmodule Syncthex.Proto.Protocol.Index do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
def descriptor do
# credo:disable-for-next-line
%Google.Protobuf.DescriptorProto{
name: "Index",
field: [
%Google.Protobuf.FieldDescriptorProto{
na... |
034346159128086dd9532fd7f7763d2002e3b282 | 2,558 | [
304888914
] | [] | defmodule KioskSystemRpi4.MixProject do
use Mix.Project
@app :kiosk_system_rpi4
@version Path.join(__DIR__, "VERSION")
|> File.read!()
|> String.trim()
def project do
[
app: @app,
version: @version,
elixir: "~> 1.6",
compilers: Mix.compilers() ++ [:nerves_pac... |
03434a5afa922b58515600df3687d5f24e7f19d0 | 3,327 | [
129699403
] | [
"documented",
"phoenix"
] | defmodule TuistWeb.OnPremisePlug do
@moduledoc """
This module contains plugs specific to on-premise customers.
"""
use TuistWeb, :controller
import Plug.Conn
alias Tuist.Environment
alias Tuist.License
alias Tuist.Time
alias TuistWeb.Authentication
alias TuistWeb.WarningsHeaderPlug
def init(:a... |
034366604ddf31dfbaa199ea7797bb95ba66abea | 4,025 | [
195741418,
388511880,
603610250,
574323694,
511371868,
580235090,
399631385,
417119332,
424214145,
558629623
] | [
"test"
] | defmodule Pleroma.Web.OAuth.LDAPAuthorizationTest do
use Pleroma.Web.ConnCase
alias Pleroma.Repo
alias Pleroma.Web.OAuth.Token
import Pleroma.Factory
import Mock
@skip if !Code.ensure_loaded?(:eldap), do: :skip
setup_all do: clear_config([:ldap, :enabled], true)
setup_all do: clear_config(Pleroma.Web... |
03437edeb7c05bc4de21a3e9252126f9384711c5 | 2,366 | [
70244242
] | [
"test"
] | defmodule Pxblog.PostControllerTest do
use Pxblog.ConnCase
alias Pxblog.Post
@valid_attrs %{body: "some content", title: "some content"}
@invalid_attrs %{}
test "lists all entries on index", %{conn: conn} do
conn = get conn, post_path(conn, :index)
assert html_response(conn, 200) =~ "Listing posts"
... |
0343be08b814bcb7697b8a2b857f16c0e668c29e | 1,907 | [
775179137,
220350975,
651679961
] | [
"test"
] | defmodule Plug.RewriteOnTest do
use ExUnit.Case, async: true
use Plug.Test
defp call(conn, rewrite) do
Plug.RewriteOn.call(conn, Plug.RewriteOn.init(rewrite))
end
test "rewrites http to https based on x-forwarded-proto" do
conn =
conn(:get, "http://example.com/")
|> put_req_header("x-for... |
034542adaa88426d75dd64fb9c71e94dc524f1fd | 5,474 | [
95977327
] | [
"test",
"ecto"
] | defmodule ErrorsApi.ProjectsTest do
use ErrorsApi.DataCase
alias ErrorsApi.Projects
alias ErrorsApi.Accounts
@create_user_attrs %{email: "<EMAIL>"}
@create_project_attrs %{name: "some name"}
def user_fixture(attrs \\ %{}) do
Accounts.find_or_create_user!("github", Enum.into(attrs, @create_user_attrs... |
0345a374febf7757973e23d73bdb50a4886dee68 | 5,711 | [
319249365
] | [
"genserver",
"test"
] | defmodule PGWire.ConnectionTest do
use ExUnit.Case
require Postgrex.Messages
require PGWire.Messages
alias PGWire.Connection
describe "state `connected`" do
setup do
state = make_state(TestProtocol)
{:ok, state: state}
end
test "with ssl_message stays in `connected` state", %{state... |
0345f607b235f0d6c4180b0c7440aa63f29591f6 | 2,266 | [
132073690
] | [
"typespec",
"documented"
] | defmodule Csvm.AST do
@moduledoc """
Handy functions for turning various data types into Farbot Celery Script
Ast nodes.
"""
alias Csvm.AST
alias AST.{Heap, Slicer, Unslicer}
@typedoc "Arguments to a ast node."
@type args :: map
@typedoc "Body of a ast node."
@type body :: [t]
@typedoc "Kind of... |
034659020695be13b503f6aea9612fe519271700 | 1,576 | [
192407200
] | [
"documented",
"ecto"
] | defmodule Andi.InputSchemas.AccessGroups do
@moduledoc false
alias Andi.Repo
alias Ecto.Changeset
alias Andi.InputSchemas.AccessGroup
alias Andi.InputSchemas.StructTools
require Logger
def get(id), do: Repo.get(AccessGroup, id)
def get_all(), do: Repo.all(AccessGroup)
def create() do
access_g... |
0346e4c2f689bd41482d92e5ff4983a1d70d64a6 | 2,268 | [
563834303
] | [
"test",
"phoenix"
] | defmodule ExampleWeb.ReviewControllerTest do
use ExampleWeb.ConnCase
import Example.MovieDBFixtures
alias Example.MovieDB.Review
@create_attrs %{
}
@update_attrs %{
}
@invalid_attrs %{}
setup %{conn: conn} do
{:ok, conn: put_req_header(conn, "accept", "application/json")}
end
describe "... |
03470d5b308e10ca65a1e241818f03613072f11b | 1,788 | [
216080783
] | [
"typespec",
"documented"
] | defmodule Garden do
@plant_codes %{
"C" => :clover,
"G" => :grass,
"R" => :radishes,
"V" => :violets
}
@default_names [
:alice, :bob, :charlie, :david, :eve, :fred,
:ginny, :harriet, :ileana, :joseph, :kincaid, :larry
]
@doc """
Accepts a string representing the arrangement of cu... |
0348df22d53a2d376e31fc3b6f0808f787a51d9a | 2,688 | [
572809838
] | [] | defmodule Day21 do
def get_input(test \\ false) do
filename = case test do
false -> "input/21.txt"
true -> "test_input/21.txt"
end
Input
# .ints(filename)
# .line_tokens(filename)
.lines(filename)
# .line_of_ints(filename)
end
def parse_lines(input) do
Enum.red... |
03499c3c2425c4869a057fbbad576a0d808a3e08 | 1,969 | [
192407200
] | [
"genserver",
"macro",
"documented"
] | defmodule Application.Initializer do
@moduledoc false
@callback do_init(keyword()) :: :ok | {:error, term()}
defmacro __using__(_opts) do
quote do
use GenServer
require Logger
require Retry
@behaviour Application.Initializer
@default_max_retries 10
@default_retry_delay 1... |
034a8c859f9eb6d993d84e77556ff4b22a0ac6f9 | 6,343 | [
993009676
] | [
"documented"
] | # ORIG_FILE
defmodule ElixirScope.AST.Enhanced.CPGBuilder.Core do
@moduledoc """
Core CPG building orchestration module.
Handles the main CPG building process, timeout management, and coordination
between different analysis components.
"""
require Logger
alias ElixirScope.AST.Enhanced.{
CPGData,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.