source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | mezis/blurrily | https://github.com/mezis/blurrily | spec/spec_helper.rb | Ruby | mit | 91 | master | 1,438 | require 'blurrily'
require 'socket'
require 'timeout'
require 'coveralls'
Coveralls.wear!
#
# Example:
# mock_tcp_next_request("<xml>junk</xml>")
#
class FakeTCPSocket
def initialize(canned_response)
@canned_response = canned_response
end
def puts(ignored = nil)
end
def gets
"#{@canned_respon... |
github | mezis/blurrily | https://github.com/mezis/blurrily | spec/blurrily/command_processor_spec.rb | Ruby | mit | 91 | master | 2,313 | require 'spec_helper'
require 'blurrily/command_processor'
require 'blurrily/map_group'
describe Blurrily::CommandProcessor do
subject { described_class.new(Blurrily::MapGroup.new) }
describe '#process_command' do
# Accepts input strings:
# CLEAR-><db>
# FIND -><db>-><needle>->[limit]
# PUT-><db>... |
github | mezis/blurrily | https://github.com/mezis/blurrily | spec/blurrily/map_spec.rb | Ruby | mit | 91 | master | 11,319 | # encoding: utf-8
require 'spec_helper'
require 'pathname'
require "blurrily/map"
describe Blurrily::Map do
subject { described_class.new }
let(:path) { Pathname.new('map.test') }
after do
path.delete_if_exists
end
describe '#stats' do
let(:result) { subject.stats }
it 'has :references' d... |
github | mezis/blurrily | https://github.com/mezis/blurrily | spec/blurrily/client_spec.rb | Ruby | mit | 91 | master | 1,965 | # encoding: utf-8
require 'spec_helper'
require "blurrily/client"
require 'pathname'
describe Blurrily::Client do
let(:config) { { :host => '0.0.0.0', :port => 12021, :db_name => 'location_en' } }
subject { described_class.new(config) }
context "find" do
it "fails if no needle is passed" do
expe... |
github | mezis/blurrily | https://github.com/mezis/blurrily | spec/blurrily/map_group_spec.rb | Ruby | mit | 91 | master | 1,538 | # encoding: utf-8
require 'spec_helper'
require 'blurrily/map_group'
describe Blurrily::MapGroup do
subject { described_class.new('.') }
context "creating, loading and returning a db" do
it "returns an instance of Map for a given DB" do
expect(subject.map("location_en")).to be_a(Blurrily::Map)
end... |
github | mezis/blurrily | https://github.com/mezis/blurrily | spec/blurrily/server_spec.rb | Ruby | mit | 91 | master | 1,453 | # encoding: utf-8
require 'spec_helper'
require 'pathname'
require 'eventmachine'
require 'socket'
require "blurrily/server"
describe Blurrily::Server do
context 'running server' do
let(:socket) { TCPSocket.new(host, @port) }
let(:directory) { 'tmp/data' }
let(:host) { 'localhost' }
before do
... |
github | mezis/blurrily | https://github.com/mezis/blurrily | lib/blurrily/client.rb | Ruby | mit | 91 | master | 4,009 | # encoding: utf-8
require 'socket'
require 'ipaddr'
require 'blurrily/defaults'
module Blurrily
class Client
Error = Class.new(RuntimeError)
# Initialize a new {Blurrily::Client} connection to {Blurrily::Server}.
#
# @param host IP Address or FQDN of the Blurrily::Server.
# Defaults t... |
github | mezis/blurrily | https://github.com/mezis/blurrily | lib/blurrily/server.rb | Ruby | mit | 91 | master | 1,244 | require 'eventmachine'
require 'blurrily/defaults'
require 'blurrily/command_processor'
require 'blurrily/map_group'
module Blurrily
class Server
def initialize(options)
@host = options.fetch(:host, '0.0.0.0')
@port = options.fetch(:port, Blurrily::DEFAULT_PORT)
directory ... |
github | mezis/blurrily | https://github.com/mezis/blurrily | lib/blurrily/defaults.rb | Ruby | mit | 91 | master | 215 | module Blurrily
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = 12021
DEFAULT_DATABASE = 'words'
LIMIT_DEFAULT = 10
LIMIT_RANGE = 1..1024
REF_RANGE = 1..(1<<31)
WEIGHT_RANGE = 0..(1<<31)
end |
github | mezis/blurrily | https://github.com/mezis/blurrily | lib/blurrily/map.rb | Ruby | mit | 91 | master | 1,204 | require 'blurrily/map_ext'
require 'active_support/core_ext/module/aliasing' # alias_method_chain
require 'active_support/core_ext/string/multibyte' # mb_chars
module Blurrily
class Map < RawMap
def put(needle, reference, weight=nil)
weight ||= 0
needle = normalize_string needle
@clean_path = ... |
github | mezis/blurrily | https://github.com/mezis/blurrily | lib/blurrily/command_processor.rb | Ruby | mit | 91 | master | 1,630 | # encoding: utf-8
require 'blurrily/defaults'
module Blurrily
class CommandProcessor
ProtocolError = Class.new(StandardError)
def initialize(map_group)
@map_group = map_group
end
def process_command(line)
command, map_name, *args = line.split(/\t/)
raise ProtocolError, 'Unknown co... |
github | mezis/blurrily | https://github.com/mezis/blurrily | lib/blurrily/map_group.rb | Ruby | mit | 91 | master | 649 | require 'pathname'
require 'blurrily/map'
module Blurrily
class MapGroup
def initialize(directory = nil)
@directory = Pathname.new(directory || Dir.pwd)
@maps = {}
end
def map(name)
@maps[name] ||= load_map(name) || Map.new
end
def save
@directory.mkpath
@maps.eac... |
github | BookOfGreg/react-rails-example-app | https://github.com/BookOfGreg/react-rails-example-app | Gemfile | Ruby | mit | 90 | master | 1,899 | source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.4'
# Use sqlite3 as the database for Active Record... |
github | BookOfGreg/react-rails-example-app | https://github.com/BookOfGreg/react-rails-example-app | config/application.rb | Ruby | mit | 90 | master | 607 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module ReactRailsExampleApp
class Application < Rails::Application
# Initialize configuration defaults for originally gene... |
github | BookOfGreg/react-rails-example-app | https://github.com/BookOfGreg/react-rails-example-app | config/environments/production.rb | Ruby | mit | 90 | master | 3,801 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | activerecord-rescue_from_duplicate.gemspec | Ruby | mit | 91 | main | 1,463 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "rescue_from_duplicate/active_record/version"
Gem::Specification.new do |spec|
spec.name = "activerecord-rescue_from_duplicate"
spec.version = Activerecord::RescueFromDuplicate:... |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | lib/rescue_from_duplicate/active_record.rb | Ruby | mit | 91 | main | 1,309 | require 'active_support'
require 'active_support/core_ext/object/try'
require "rescue_from_duplicate/active_record/version"
module RescueFromDuplicate
module ActiveRecord
end
def self.missing_unique_indexes
klasses = ::ActiveRecord::Base.descendants.select do |klass|
klass.validators.any? { |v| v.is_a... |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | lib/rescue_from_duplicate/uniqueness_rescuer.rb | Ruby | mit | 91 | main | 409 | module RescueFromDuplicate
class UniquenessRescuer
def initialize(validator)
@validator = validator
end
def rescue?
@validator.options.fetch(:rescue_from_duplicate, false)
end
def options
@validator.options
end
def attributes
@validator.attributes
end
de... |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | lib/rescue_from_duplicate/missing_unique_index.rb | Ruby | mit | 91 | main | 243 | module RescueFromDuplicate
class MissingUniqueIndex
attr_reader :model, :attributes, :columns
def initialize(model, attributes, columns)
@model = model
@attributes = attributes
@columns = columns
end
end
end |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | lib/rescue_from_duplicate/rescuer.rb | Ruby | mit | 91 | main | 313 | module RescueFromDuplicate
class Rescuer
attr_reader :attributes, :options, :columns
def initialize(attribute, options)
@attributes = [attribute]
@columns = [attribute, *Array(options[:scope])].map(&:to_s).sort
@options = options
end
def rescue?
true
end
end
end |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | lib/rescue_from_duplicate/active_record/extension.rb | Ruby | mit | 91 | main | 2,745 | require 'active_support/core_ext/class'
module RescueFromDuplicate::ActiveRecord
module Extension
extend ActiveSupport::Concern
module ClassMethods
def rescue_from_duplicate(attribute, options = {})
self._rescue_from_duplicates += [RescueFromDuplicate::Rescuer.new(attribute, options)]
en... |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | spec/spec_helper.rb | Ruby | mit | 91 | main | 3,120 | require 'simplecov'
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
SimpleCov.start do
add_filter '/spec/'
end
require 'active_record'
require 'activerecord-rescue_from_duplicate'
begin
require 'pry'
rescue LoadError
end
module RescueFromDuplicate
class Base... |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | spec/rescue_from_duplicate_spec.rb | Ruby | mit | 91 | main | 2,709 | require 'spec_helper'
include RescueFromDuplicate
shared_examples 'database error rescuing' do
let(:uniqueness_exception) { ::ActiveRecord::RecordNotUnique.new(message) }
subject { Rescuable.new }
before do
connection = double(schema_cache: double(indexes: [Rescuable.index]))
allow(Rescuable).to(receiv... |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | spec/rescuer_spec.rb | Ruby | mit | 91 | main | 1,218 | require 'spec_helper'
describe RescueFromDuplicate::Rescuer do
subject { RescueFromDuplicate::Rescuer.new(:name, scope: [:type, :shop_id], message: "Derp!") }
it "always rescues" do
expect(subject.rescue?).to eq true
end
it "sorts the columns" do
expect(subject.columns).to eq ['name', 'shop_id', 'typ... |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | spec/validator_spec.rb | Ruby | mit | 91 | main | 3,191 | require 'spec_helper'
shared_examples 'a model with rescued uniqueness validator' do
describe 'create!' do
context 'when catching a race condition' do
before(:each) {
allow_any_instance_of(ActiveRecord::Validations::UniquenessValidator)
.to(receive(:validate_each)).and_return(nil)
... |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | spec/uniqueness_rescuer_spec.rb | Ruby | mit | 91 | main | 1,007 | require 'spec_helper'
describe RescueFromDuplicate::UniquenessRescuer do
context "common" do
subject { RescueFromDuplicate::UniquenessRescuer.new(Rescuable.uniqueness_validator) }
it "returns the options" do
options = { case_sensitive: true, scope: [:type, :shop_id], rescue_from_duplicate: true }
... |
github | Shopify/activerecord-rescue_from_duplicate | https://github.com/Shopify/activerecord-rescue_from_duplicate | spec/support/model.rb | Ruby | mit | 91 | main | 2,269 | require "active_record"
require "json"
require "yaml"
CONNECTIONS = {
test_sqlite3: {
adapter: "sqlite3",
database: "/tmp/rescue_from_duplicate.db",
},
test_postgresql: {
adapter: "postgresql",
database: "rescue_from_duplicate",
username: "test",
password: "test",
host: "127.0.0.1",
... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | redis_timeline.gemspec | Ruby | mit | 91 | master | 911 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "timeline/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "redis-timeline"
s.version = Timeline::VERSION
s.authors = ["Felix Clack"]
s.email = ["felixclack... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | Rakefile | Ruby | mit | 91 | master | 703 | #!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.r... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | Gemfile | Ruby | mit | 91 | master | 497 | source "http://rubygems.org"
# Declare your gem's dependencies in timeline.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead of in
#... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | spec/track_spec.rb | Ruby | mit | 91 | master | 3,135 | require File.join(File.dirname(__FILE__), %w[spec_helper])
require 'active_model'
class Post
extend ActiveModel::Callbacks
define_model_callbacks :create
attr_accessor :id, :to_param, :creator_id, :name
include Timeline::Track
track :new_post
def initialize(options={})
@creator_id = options.delete ... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | spec/activity_spec.rb | Ruby | mit | 91 | master | 361 | require File.join(File.dirname(__FILE__), %w[spec_helper])
describe Timeline::Activity do
describe "initialized with json" do
let(:json) { { id: "1", verb: "new_post" } }
it "returns a Hashie-fied object" do
expect(Timeline::Activity.new(json).id).to eq("1")
expect(Timeline::Activity.new(json).v... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | spec/spec_helper.rb | Ruby | mit | 91 | master | 769 | require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib redis-timeline]))
dir = File.dirname(File.expand_path(__FILE__))
#
# make sure we can run redis
#
if !system("which redis-server")
puts '', "** can't find `redis-server` in your path"
puts "** try running `sudo rake install`"
abort ''
end
#
#... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | spec/actor_spec.rb | Ruby | mit | 91 | master | 415 | require File.join(File.dirname(__FILE__), %w[spec_helper])
class User
include Timeline::Actor
attr_accessor :id
end
describe Timeline::Actor do
describe "when included" do
before { @user = User.new }
it "defines a timeline association" do
expect(@user).to respond_to :timeline
end
descri... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | spec/timeline_spec.rb | Ruby | mit | 91 | master | 417 | require File.join(File.dirname(__FILE__), %w[spec_helper])
describe Timeline do
it("can set a redis instance") { expect(Timeline).to respond_to(:redis=) }
it("has a namespace, timeline") { expect(Timeline.redis.namespace).to eq(:timeline) }
it "sets the namespace through a url-like string" do
Timeline.redis... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | lib/redis-timeline.rb | Ruby | mit | 91 | master | 257 | require 'active_support/concern'
require 'multi_json'
require 'hashie'
require 'timeline/config'
require 'timeline/helpers'
require 'timeline/track'
require 'timeline/actor'
require 'timeline/activity'
module Timeline
extend Config
extend Helpers
end |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | lib/timeline/track.rb | Ruby | mit | 91 | master | 3,564 | module Timeline::Track
extend ActiveSupport::Concern
module ClassMethods
def track(name, options={})
@name = name
@callback = options.delete :on
@callback ||= :create
@actor = options.delete :actor
@actor ||= :creator
@object = options.delete :object
@target = options.... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | lib/timeline/config.rb | Ruby | mit | 91 | master | 1,302 | require 'redis/namespace'
module Timeline
module Config
# Accepts:
# 1. A 'hostname:port' String
# 2. A 'hostname:port:db' String (to select the Redis db)
# 3. A 'hostname:port/namespace' String (to set the Redis namespace)
# 4. A Redis URL String 'redis://host:port'
# 5. An instan... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | lib/timeline/helpers.rb | Ruby | mit | 91 | master | 466 | module Timeline
module Helpers
class DecodeException < StandardError; end
def encode(object)
::MultiJson.encode(object)
end
def decode(object)
return unless object
begin
::MultiJson.decode(object)
rescue ::MultiJson::DecodeError => e
raise DecodeException, e
... |
github | felixclack/redis-timeline | https://github.com/felixclack/redis-timeline | lib/timeline/actor.rb | Ruby | mit | 91 | master | 910 | module Timeline
module Actor
extend ActiveSupport::Concern
included do
def timeline(options={})
::Timeline.get_list(timeline_options(options)).map do |item|
::Timeline::Activity.new ::Timeline.decode(item)
end
end
def followers
[]
end
private
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | Rakefile | Ruby | mit | 91 | master | 298 | require "bundler/gem_tasks"
require "rake/testtask"
require "yard"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList['test/**/*_test.rb']
end
YARD::Rake::YardocTask.new do |t|
t.options = ['-m markdown', '--no-private']
end
task :default => :test |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | yadriggy.gemspec | Ruby | mit | 91 | master | 1,416 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'yadriggy/version'
Gem::Specification.new do |spec|
spec.name = "yadriggy"
spec.version = Yadriggy::VERSION
spec.authors = ["Shigeru Chiba"]
# spec.email = ["?"]... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy.rb | Ruby | mit | 91 | master | 768 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/version'
require 'yadriggy/source_code'
require 'yadriggy/ast'
require 'yadriggy/ast_value'
require 'yadriggy/ast_location'
require 'yadriggy/eval'
require 'yadriggy/eval_all'
require 'yadriggy/algebra'
require 'yadriggy/syntax'
require 'yad... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/ruby_typeinfer.rb | Ruby | mit | 91 | master | 12,246 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'set'
require 'yadriggy/ruby_typecheck'
module Yadriggy
# Type checker for Ruby with type inference. The type system is slightly
# different from Ruby's one.
# For example, once an integer is assigned to a local variable,
# assigning a Strin... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/ruby_typecheck.rb | Ruby | mit | 91 | master | 14,720 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/typecheck'
module Yadriggy
# Type checker for Ruby.
# Most values are typed as DynType but local variables
# are identified. So `type(ast)` returns
# a {LocalVarType} object if `ast` is of a local variable.
# A {LocalVarType} is a... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/ast_value.rb | Ruby | mit | 91 | master | 9,140 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
module Yadriggy
# Undefined value.
Undef = :undef
class ASTnode
# The value of the name represented by this AST node
# if the value is immutable. Otherwise, {Yadriggy::Undef}.
#
def const_value() Undef end
# The immutable value of ... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/source_code.rb | Ruby | mit | 91 | master | 4,729 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'ripper'
require 'pry'
# Interactive shell.
class Pry
# Log.
class History
# Records a line.
# We modify the original `Pry::History::push` to record a duplicated line as well.
# @param [String] line an input.
def push(line)
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/algebra.rb | Ruby | mit | 91 | master | 14,285 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/eval'
module Yadriggy
# An interface inspired by object algebra (and tag-less final)
#
class Algebra
def initialize(expr)
EvalAlgebra.new(self).evaluate(expr)
end
def nil_value()
raise NotImplementedError.new... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/c.rb | Ruby | mit | 91 | master | 201 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy'
require 'yadriggy/c/c'
require 'yadriggy/c/program'
module Yadriggy
# C language embedded in Ruby
module C
end
end |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/typecheck.rb | Ruby | mit | 91 | master | 8,417 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/syntax'
require 'yadriggy/checker'
require 'yadriggy/type'
module Yadriggy
# Type checker for ASTree.
# This provides several basic methods and utility classes for type checking.
# It does not specify any specific typing rules. Defin... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/pretty_print.rb | Ruby | mit | 91 | master | 11,032 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/typecheck'
require 'yadriggy/printer'
module Yadriggy
# Pretty printer for Ruby
class PrettyPrinter < Checker
# Obtains the string representation of the given AST.
#
# @param [ASTree|ASTnode] an_ast the AST.
# @return [S... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/checker.rb | Ruby | mit | 91 | master | 6,808 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/ast'
module Yadriggy
# Exception thrown by a checker.
class CheckError < RuntimeError
end
# AST checker.
# It visits the AST nodes and does various checks like type checking.
class Checker
include Yadriggy
# Defines th... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/py.rb | Ruby | mit | 91 | master | 207 | # Copyright (C) 2018- Shigeru Chiba. All rights reserved.
require 'yadriggy'
require 'yadriggy/py/python'
module Yadriggy
# Python language embedded in Ruby
module Py
# see py/python.rb
end
end |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/eval.rb | Ruby | mit | 91 | master | 3,679 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
module Yadriggy
# abstract evaluator (using visitor pattern)
#
class Eval
def evaluate(expr)
if expr.nil?
nil_value(nil)
else
expr.accept(self)
end
self
end
# A root.
#
def astree(expr)
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/ast.rb | Ruby | mit | 91 | master | 48,243 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/source_code'
module Yadriggy
# Gets the abstract syntax tree (AST) of the given procedure `proc`.
# If `proc` is nil, the block argument is converted into an abstract
# syntax tree. The returned {ASTree} object is a container holding... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/syntax.rb | Ruby | mit | 91 | master | 17,187 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/ast'
require 'yadriggy/ast_location'
module Yadriggy
# Defines syntax and returns a {Syntax} object.
# {Yadriggy#define_syntax} is not available in a method body.
# @param [Proc] block the syntax definition.
# @return [Syntax] the d... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/printer.rb | Ruby | mit | 91 | master | 1,490 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
module Yadriggy
# A helper class for pretty printing.
#
class Printer
# @param [Integer] indent the indent size. The default value is 2.
def initialize(indent=2)
@text = ''
@level = 0
@linebreak = false
@indent = ' ' * ... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/type.rb | Ruby | mit | 91 | master | 19,711 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
module Yadriggy
# @abstract
# Root of the classes representing a type.
# A {Type} object may consist of a chain of multiple {Type} objects.
#
# Don't use `is_a?` but use `has_role?` or `role`.
#
class Type
# @api private
def self.get_inst... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/eval_all.rb | Ruby | mit | 91 | master | 3,395 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/eval'
module Yadriggy
# A simple visitor.
#
class EvalAll < Eval
def nil_value(expr) end
def name(expr) end
def symbol(expr) end
def super_method(expr) end
def number(expr) end
# expressions, or progn in L... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/ast_location.rb | Ruby | mit | 91 | master | 1,547 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/eval_all'
# Yadriggy is a platform for building embedded DSLs.
#
# It means mistletoe in Japanese.
#
module Yadriggy
class ASTnode
# @return [String] the human-readable location of this AST node.
def source_location_string
l... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/assert.rb | Ruby | mit | 91 | master | 7,238 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy'
module Yadriggy
# Power assert by Yadriggy
module Assert
# Checks the given assertion is correct and prints the result
# if the assertion fails.
#
# @param [Proc] block the assertion.
def self.assert(&block)
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/py/python.rb | Ruby | mit | 91 | master | 1,824 | # Copyright (C) 2018- Shigeru Chiba. All rights reserved.
require 'pycall'
require 'yadriggy'
require 'yadriggy/py/syntax'
require 'yadriggy/py/codegen'
require 'yadriggy/py/py_typechecker'
require 'yadriggy/py/import'
module Yadriggy
module Py
def self.run(&blk)
ast = Yadriggy::reify(blk)
Syntax.r... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/py/import.rb | Ruby | mit | 91 | master | 2,015 | # Copyright (C) 2018- Shigeru Chiba. All rights reserved.
require 'yadriggy'
module Yadriggy
module Py
# The import statement in Python.
class Import
@@src = ''
@@state = 0
# @api private
def self.source
src = @@src
@@src = ''
@@state = 0
src
e... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/py/syntax.rb | Ruby | mit | 91 | master | 3,346 | # Copyright (C) 2018- Shigeru Chiba. All rights reserved.
require 'yadriggy'
module Yadriggy
module Py
Syntax = Yadriggy.define_syntax do
expr = Name | Number | Super | Binary | Unary | ternary |
StringLiteral | Lambda |
ArrayLiteral | Paren | lambda_call | with_call | fun_ca... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/py/codegen.rb | Ruby | mit | 91 | master | 11,467 | # Copyright (C) 2018- Shigeru Chiba. All rights reserved.
require 'yadriggy'
module Yadriggy
module Py
class CodeGen < Checker
# @return [Printer] the printer.
attr_reader :printer
# @param [Printer] printer
# @param [PyTypeChecker] checker
def initialize(printer, checker)
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/py/py_typechecker.rb | Ruby | mit | 91 | master | 1,983 | # Copyright (C) 2018- Shigeru Chiba. All rights reserved.
require 'yadriggy'
require 'yadriggy/py/syntax'
module Yadriggy
module Py
class PyTypeChecker < RubyTypeChecker
def initialize()
super(Py::Syntax)
@free_variables = Hash.new
end
# @return [Hash<Object,String>] all free... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/c/c.rb | Ruby | mit | 91 | master | 7,881 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy'
require 'yadriggy/c/ctypecheck'
require 'yadriggy/c/codegen'
require 'yadriggy/c/ffi'
require 'yadriggy/c/config'
module Yadriggy
module C
# yadriggy/c/ffi.rb also defiens methods in this module.
# An error thrown during compilat... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/c/ctypecheck.rb | Ruby | mit | 91 | master | 13,293 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/c/ctype'
require 'set'
module Yadriggy
module C
class ArrayType < CompositeType
attr_reader :element_type
def initialize(element_type)
super(Array, element_type)
end
def element_type()
first_a... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/c/opencl.rb | Ruby | mit | 91 | master | 13,909 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/c/ctype.rb'
require 'yadriggy/c/codegen'
require 'yadriggy/c/ctypecheck'
require 'yadriggy/c/program'
require 'yadriggy/c/config'
module Yadriggy
module C
# Compiles OpenCL methods into binary code.
#
def self.ocl_compile(obj, ... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/c/ctype.rb | Ruby | mit | 91 | master | 3,063 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy'
require 'yadriggy/c/ffi'
module Yadriggy
module C
# Types availalbe in C code.
module CType
def typedecl(arg) end
def arrayof(t) t end
# Single-precision floating point numbers.
# This is used only as a ty... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/c/config.rb | Ruby | mit | 91 | master | 1,315 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
module Yadriggy
module C
# Compiler options etc.
#
module Config
# Host OS
# @return [Symbol] `:linux`, `:macos`, `:unknown`.
HostOS = case RbConfig::CONFIG['host_os']
when /linux/
:linux
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/c/codegen.rb | Ruby | mit | 91 | master | 12,447 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/c/config'
require 'yadriggy/c/ffi'
require 'yadriggy/c/ctype'
module Yadriggy
module C
# C-code generator
#
# Since Checker implements Visitor pattern, use it for code
# generation.
#
class CodeGen < Checker
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/c/program.rb | Ruby | mit | 91 | master | 2,546 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'yadriggy/c/c'
require 'yadriggy/c/config'
module Yadriggy
module C
class Program
include Yadriggy::C::CType
# Compiles this class and makes a module including the
# compiled methods.
#
# @param [String] module_nam... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | lib/yadriggy/c/ffi.rb | Ruby | mit | 91 | master | 8,895 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'ffi'
module Yadriggy
module C
# @abstract
# A wrapper of memory object accessible from Ruby and C code.
#
class FFIArray
# @return [FFI::MemoryPointer] the object holding all data.
def memory_pointer()
@array
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | examples/opencl.rb | Ruby | mit | 91 | master | 427 | require 'yadriggy/c/opencl'
class Inc < Yadriggy::C::Program
def initialize
@data = OclArray.new(16)
end
def inc(arr, n) ! Void
typedecl arr: Float32Array, n: Int
@data.copyfrom(arr, n)
16.ocl_times {|i| @data[i] *= 2.0 }
@data.copyto(arr, n)
end
end
m = Inc.ocl_compile
arr = Yadriggy::C::... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | examples/fib.rb | Ruby | mit | 91 | master | 276 | require 'yadriggy'
require 'yadriggy/c'
include Yadriggy::C::CType
def fib(n) ! Integer
typedecl n: Integer
if n > 1
return fib(n - 1) + fib(n - 2)
else
return n
end
end
puts Yadriggy::C.run { return fib(32) }
n = 32
puts Yadriggy::C.run { return fib(n) } |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | examples/fib_class.rb | Ruby | mit | 91 | master | 277 | require 'yadriggy'
require 'yadriggy/c'
class Fib < Yadriggy::C::Program
def fib(n) ! Integer
typedecl n: Integer
if n > 1
return fib(n - 1) + fib(n - 2)
else
return n
end
end
end
m = Fib.compile('FastFib') # returns a module.
puts m.fib(32) |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | examples/array.rb | Ruby | mit | 91 | master | 626 | require 'yadriggy/c'
class ArrayToC < Yadriggy::C::Program
def inc(a, b, n) ! Void
typedecl a: arrayof(Int), b: arrayof(Int), n: Int
for i in 0...n
b[i] = a[i] + 1
end
end
def inc2(a, b, n) ! Void
typedecl a: arrayof(Int), b: arrayof(Int), n: Int
n.times do |i|
b[i] = a[i] + 1
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | examples/matplotlib.rb | Ruby | mit | 91 | master | 685 | # The following code was taken from the Matlab tutorial.
# https://matplotlib.org/gallery/pie_and_polar_charts/pie_features.html
require 'yadriggy/py'
# draw_pie() is a Python function.
def draw_pie(labels, sizes, explode)
fig1, ax1 = plt.subplots()
ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%'... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | examples/image_filters/laplacian_demo.rb | Ruby | mit | 91 | master | 2,955 | require 'yadriggy'
require 'yadriggy/c'
require 'yadriggy/c/opencl'
require 'image_filters/png_file'
class LaplacianDemo
class Laplacian < Yadriggy::C::Program
def kernel(image, image2, width, height) ! Void
typedecl image: arrayof(Float32), image2: arrayof(Float32),
width: Integer, height: Intege... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | examples/image_filters/png_file.rb | Ruby | mit | 91 | master | 6,409 | # Copyright (C) 2017- Shigeru Chiba. All rights reserved.
require 'zlib'
# Simple PNG file reader/writer
#
class PngFile
attr_reader :width, :height, :type, :srgb
# Reads a PNG file and constructs a `PngFile` object.
# @param [String] file_name the PNG file name.
#
def initialize(file_name)
raw_data ... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/eval_test.rb | Ruby | mit | 91 | master | 14,658 | require 'test_helper'
require 'yadriggy/ast'
require 'yadriggy/eval'
require 'yadriggy/eval_all'
module Yadriggy
def self.check_implementations(evaluator)
evaluator.nil_value(nil)
evaluator.identifier(Identifier.new([:@ident, "a", [1, 1]]))
evaluator.const(Const.new([:@const, "P", [6, 4]]))
evaluator... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/ruby_typeinfer_test.rb | Ruby | mit | 91 | master | 6,531 | require 'test_helper'
require 'yadriggy/ruby_typeinfer.rb'
require 'yadriggy/ast_test2.rb'
module Yadriggy
class TypeInferenceTester < Test::Unit::TestCase
typechecker = RubyTypeInferer.new
test 'typecheck a free variable' do
a = 3
ast = Yadriggy::reify { a }.tree.body
t = typechecker.typ... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/type_test.rb | Ruby | mit | 91 | master | 11,531 | require 'test_helper'
module Yadriggy
class TypeTester < Test::Unit::TestCase
test 'role' do
assert(DynType.equal?(DynType.role(DynType)))
assert_nil(DynType.role(Void))
assert(Void.equal?(Void.role(Void)))
assert_nil(Void.role(DynType))
assert(RubyClass.role(RubyClass::String).equ... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/ast_value_test.rb | Ruby | mit | 91 | master | 10,188 | require 'test_helper'
require 'yadriggy/ast'
require 'yadriggy/source_code'
require 'yadriggy/ast_value'
module Yadriggy
class AstValueTester < Test::Unit::TestCase
class A
ValueA = 1
end
test 'X::Y' do
Value = 10
p = lambda do |x|
V = 100
V + Value + A::ValueA
en... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/ruby_typecheck_test.rb | Ruby | mit | 91 | master | 2,247 | require 'test_helper'
require 'yadriggy/typecheck.rb'
require 'yadriggy/ruby_typecheck.rb'
require 'yadriggy/ast_test2.rb'
module Yadriggy
class RubyTypecheckTester < Test::Unit::TestCase
typechecker = RubyTypeChecker.new
test 'typecheck a ruby variable' do
a = 3
ast = Yadriggy::reify { a }.tre... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/pretty_print_test.rb | Ruby | mit | 91 | master | 557 | require 'test_helper'
require 'yadriggy/pretty_print'
require 'yadriggy/ast_test2.rb'
module Yadriggy
class PPTester < Test::Unit::TestCase
test 'to string' do
ast = Yadriggy.reify do
Yadriggy::PPTester
end
str = PrettyPrinter.ast_to_s(ast.tree.body)
assert_equal('Yadriggy::PPTest... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/mydsl_test.rb | Ruby | mit | 91 | master | 1,190 | require 'test_helper'
require 'yadriggy'
# Sample implementation of a DSL.
#
class MyDSLTester < Test::Unit::TestCase
include Yadriggy
@syntax = Yadriggy::define_syntax do
Binary <= { left: Binary | Number, op: :+, right: Number }
Block <= { body: Number | Binary }
end
class MyTypeChecker < TypeChec... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/printer_test.rb | Ruby | mit | 91 | master | 1,597 | require 'test_helper'
require 'yadriggy'
module Yadriggy
class PrinterTester < Test::Unit::TestCase
test 'empty printer' do
pr = Printer.new
assert_equal('', pr.output)
end
test 'printer << a' do
pr = Printer.new
pr << 'a'
assert_equal('a', pr.output)
end
test 'pri... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/syntax_test.rb | Ruby | mit | 91 | master | 16,291 | require 'test_helper'
require 'yadriggy/syntax.rb'
require 'yadriggy/ast_test2.rb'
module Yadriggy
class SyntaxTester < Test::Unit::TestCase
test 'syntax empty' do
syn = Yadriggy::define_syntax do
# any code causes a syntax error.
end
assert_false(syn.check(Yadriggy::reify {}.tree.body... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/ast_test2.rb | Ruby | mit | 91 | master | 9,235 | require 'test_helper'
require 'yadriggy/ast'
require 'yadriggy/source_code'
require 'yadriggy/ast_location'
module Yadriggy
class CheckAllAst
class CheckAllAst2
end
end
def self.check_all_asts_f0()
end
def self.check_all_asts_f1(i)
i
end
def self.check_all_asts_f2(i, j)
i
end
def ... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/source_code_test.rb | Ruby | mit | 91 | master | 3,633 | require 'test_helper'
require 'yadriggy/source_code'
module Yadriggy
class GetAstTester < Test::Unit::TestCase
sub_test_case 'SourceCode class' do
setup do
@lambda_expr = lambda {|x,y| x + y + 1 }
end
test 'get_sexp ' do
src = SourceCode.get_sexp(@lambda_expr)
# pp src
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/assert_test.rb | Ruby | mit | 91 | master | 1,241 | require 'test_helper'
require 'yadriggy/assert'
class TestAssert < Test::Unit::TestCase
test 'simple power assert' do
x = 7
assert_false(Yadriggy::Assert.assert { 7 < 4 })
assert_false(Yadriggy::Assert.assert { x < 4 })
assert_false(Yadriggy::Assert.assert { x + 1 < 4 })
assert_false(Yadriggy::As... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/checker_test.rb | Ruby | mit | 91 | master | 1,377 | require 'test_helper'
require 'yadriggy/checker.rb'
module Yadriggy
class CheckTester < Test::Unit::TestCase
class TestChecker < Checker
rule(Number) do
3
end
end
class TestChecker2 < TestChecker
rule(Number) do
proceed(ast) + 40
end
end
class TestChecker... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/py_test.rb | Ruby | mit | 91 | master | 6,021 | require 'test_helper'
require 'yadriggy/py'
class Py_Tester < Test::Unit::TestCase
test 'call a local function' do
r = Yadriggy::Py::run do
def foo(a)
return a + 1
end
foo(3)
end
assert_equal(4, r)
end
def add10(a)
return a + 10
end
test 'call an external function'... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/ast_test.rb | Ruby | mit | 91 | master | 3,684 | require 'test_helper'
require 'yadriggy/ast'
require 'yadriggy/source_code'
require 'yadriggy/ast_location'
module Yadriggy
class AstTester < Test::Unit::TestCase
test 'reification' do
p = lambda do |a, b=3, *rest, c, d, key:, key2: 5, **krest, &body|
a + b
end
ast = Yadriggy.reify(p)
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/algebra_test.rb | Ruby | mit | 91 | master | 3,151 | require 'test_helper'
require 'yadriggy/ast'
require 'yadriggy/algebra'
require 'yadriggy/eval_test'
require 'yadriggy/ast_test2.rb'
module Yadriggy
class ConcreteAlgebra < Algebra
def nil_value() nil end
def name(name, line_no, column) name end
def super_method() :super_method end
def number(valu... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/c_test.rb | Ruby | mit | 91 | master | 17,746 | require 'test_helper'
require 'yadriggy/c'
class C_Tester < Test::Unit::TestCase
include Yadriggy::C
syn = Yadriggy::C::syntax
tchecker = ClangTypeChecker.new
class Foo
include Yadriggy::C::CType
def fooo(a, b) - Int
typedecl a: Int, b: Int
return a + b
end
def fooo2(a, b)
... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/py/import_test.rb | Ruby | mit | 91 | master | 1,531 | require 'test_helper'
require 'yadriggy/py/import'
module Yadriggy
class PyImportTester < Test::Unit::TestCase
include Yadriggy::Py::PyImport
def source_code
Yadriggy::Py::Import.source
end
test 'get source and clear' do
pyimport('foo.bar')
assert_equal("\nimport foo.bar", source_... |
github | csg-tokyo/yadriggy | https://github.com/csg-tokyo/yadriggy | test/yadriggy/py/py_typechecker_test.rb | Ruby | mit | 91 | master | 555 | require 'test_helper'
require 'yadriggy/py/py_typechecker.rb'
module Yadriggy
class PyTypecheckTester < Test::Unit::TestCase
typechecker = Py::PyTypeChecker.new
Val3 = [3, 4]
Val4 = [5, 7]
test 'references' do
ast = Yadriggy::reify { a = Val3 }.tree.body
assert(typechecker.typecheck(ast... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.