Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit a49af4b

Browse files
authored
Fix an issue with scaledlabel and update dependency (#36)
1 parent fb9bd43 commit a49af4b

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

Project.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ version = "0.3.3"
66
[deps]
77
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
88
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
9-
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
109
DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
1110
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
1211
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
13-
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
1412
Missings = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
1513
PooledArrays = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
1614
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
@@ -25,10 +23,8 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
2523
[compat]
2624
CSV = "0.8"
2725
CodecZlib = "0.7"
28-
Combinatorics = "1"
2926
DataAPI = "1.6"
3027
DataFrames = "1"
31-
MacroTools = "0.5"
3228
Missings = "0.4, 1"
3329
PooledArrays = "1.2"
3430
PrettyTables = "1"

src/DiffinDiffsBase.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ module DiffinDiffsBase
33
using Base: @propagate_inbounds
44
using CSV
55
using CodecZlib: GzipDecompressorStream
6-
using Combinatorics: combinations
76
using DataAPI
87
using DataAPI: refarray, refpool, invrefpool
98
using Dates: Period, TimeType
109
using LinearAlgebra: Diagonal
11-
using MacroTools: @capture, isexpr, postwalk
1210
using Missings: allowmissing, disallowmissing
1311
using PooledArrays: _label
1412
using PrettyTables: pretty_table
@@ -24,7 +22,7 @@ using Tables
2422
using Tables: AbstractColumns, istable, columnnames, getcolumn
2523

2624
import Base: ==, +, -, *, isless, show, parent, view, diff
27-
import Base: eltype, firstindex, lastindex, getindex, iterate, length, sym_in
25+
import Base: eltype, firstindex, lastindex, getindex, iterate, length
2826
import Missings: allowmissing, disallowmissing
2927
import StatsBase: coef, vcov, confint, nobs, dof_residual, responsename, coefnames, weights,
3028
coeftable

src/ScaledArrays.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ end
8989

9090
function _scaledlabel!(labels::AbstractArray, invpool::Dict, xs::AbstractArray, start, step)
9191
z = zero(valtype(invpool))
92-
@inbounds for i in eachindex(labels)
93-
x = xs[i]
92+
@inbounds for (i, x) in zip(eachindex(labels), xs)
9493
lbl = get(invpool, x, z)
9594
if lbl !== z
9695
labels[i] = lbl
@@ -118,7 +117,8 @@ function scaledlabel(xs::AbstractArray, stepsize,
118117
R = widen(R)
119118
end
120119
end
121-
labels = similar(xs, R)
120+
# Array types with customized indexing could cause problems
121+
labels = similar(Array{R}, axes(xs))
122122
invpool = Dict{T,R}()
123123
_scaledlabel!(labels, invpool, xs, start, stepsize)
124124
return labels, pool, invpool

src/did.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,9 @@ macro did(args...)
156156
noproceed = false
157157
didargs = ()
158158
if nargs > 0
159-
if isexpr(args[1], :vect, :hcat, :vcat)
160-
noproceed = _parse!(options, args[1].args)
159+
op = args[1]
160+
if op isa Expr && op.head in (:vect, :hcat, :vcat)
161+
noproceed = _parse!(options, op.args)
161162
nargs > 1 && (didargs = args[2:end])
162163
else
163164
didargs = args

0 commit comments

Comments
 (0)