-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KDocs start using Doc Preprocessor Gradle plugin #214
Merged
Merged
Changes from 53 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
e935502
added jcp support
Jolanrensen fcbbf8e
added sample/test for reusable comments in add.kt
Jolanrensen 1c1fefe
jcp now only gets parsed for building the jar!
Jolanrensen 12af079
updated examples
Jolanrensen e4442fe
now using kdocIncludeGradlePlugin
Jolanrensen da0be85
now using kdocIncludeGradlePlugin
Jolanrensen d7dd6bc
upgraded to docProcessor
Jolanrensen 1db3e55
Merge branch 'master' into jpc-kdoc-reuse
Jolanrensen c017319
removed add again, fixed some small thing
Jolanrensen 63ccc29
started on example doc structure using doc processor
Jolanrensen 9708732
starting with update operation as template to figure out where to go …
Jolanrensen fdda5ba
renamed Column to AnyColumnReference, similar to AnyFrame.
Jolanrensen 9ec93b4
continuing with kdocs with updated processor
Jolanrensen 09da9b6
continuing with kdocs
Jolanrensen f87819e
gather.where now uses RowValueFilter instead of Predicate, similar to…
Jolanrensen 005e11d
wip update documentation
Jolanrensen 1db9d70
working on docs, found bug in kdoc highlighting
Jolanrensen a7a4b1b
row expressions and updating docs
Jolanrensen 394a795
refactored examples separate from docs, working on update overloads docs
Jolanrensen 83cfa31
final update overloads, fillNA and NA/NaN info
Jolanrensen 28b1df9
slight refactoring and updated gradle plugin
Jolanrensen f70f0bc
added ColumnExpression typealias and uses across the api.
Jolanrensen 428cff3
created stubs for columnExpression and dataframeexpression
Jolanrensen 6ff4176
small refactorings and renaming
Jolanrensen fd1e545
notNull, dataframe expression, refactoring
Jolanrensen a795a9d
refactoring
Jolanrensen e9f7fd0
fixed some rendering issues
Jolanrensen d6c5f1b
refactoring
Jolanrensen 2c2a610
updated doc processor plugin
Jolanrensen eeb36c0
updating doc processor plugin
Jolanrensen aa311a4
reverted Column -> AnyColumnReference to not clog up the PR
Jolanrensen 341da80
refactored and renamed some of the general docs
Jolanrensen 87710c1
docs and examples for ColumnExpression, links for SelectingColumns, d…
Jolanrensen 03c398f
per row col. update.kt finished!
Jolanrensen 15026b7
updated doc processor gradle plugin
Jolanrensen 91e9754
cleaning PR a bit and added new target folder with generated sources
Jolanrensen 91c9e8e
added generated sources with docs. Do we want to do it like this?
Jolanrensen 265c587
removed commented-out code
Jolanrensen 8ed0907
updated plugin
Jolanrensen 61e01c8
updated plugin, fixes newlines and links in @include
Jolanrensen f40a021
Merge branch 'master' into jpc-kdoc-reuse
Jolanrensen 0849309
updating docs plugin
Jolanrensen fb22326
ExpressionsGivenRowAndColumn
Jolanrensen d289e86
updating doc processor plugin and fixing linter
Jolanrensen 490ecdd
docs for dropNulls
Jolanrensen b87085d
Merge branch 'master' into jpc-kdoc-reuse
Jolanrensen cfa9b4a
remaining docs for Nulls.kt
Jolanrensen 70d167d
Merge branch 'master' into jpc-kdoc-reuse
Jolanrensen 5d79b45
post master merge, small update and rendering docs
Jolanrensen 1a467b9
updated settings.gradle.kts to master version
Jolanrensen f0e8c13
fixing linting
Jolanrensen e6ab95b
fixing some review issues
Jolanrensen 2a1b305
including test sources to doc processor to enable cross-references
Jolanrensen 234be05
Merge branch 'master' into jpc-kdoc-reuse
Jolanrensen 3aa5f22
final update from master
Jolanrensen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,36 +11,27 @@ import org.jetbrains.kotlinx.dataframe.DataColumn | |
import org.jetbrains.kotlinx.dataframe.DataFrame | ||
import org.jetbrains.kotlinx.dataframe.DataRow | ||
import org.jetbrains.kotlinx.dataframe.Predicate | ||
import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor | ||
import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup | ||
import org.jetbrains.kotlinx.dataframe.columns.ColumnPath | ||
import org.jetbrains.kotlinx.dataframe.columns.ColumnReference | ||
import org.jetbrains.kotlinx.dataframe.columns.ColumnResolutionContext | ||
import org.jetbrains.kotlinx.dataframe.columns.ColumnSet | ||
import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath | ||
import org.jetbrains.kotlinx.dataframe.columns.FrameColumn | ||
import org.jetbrains.kotlinx.dataframe.columns.SingleColumn | ||
import org.jetbrains.kotlinx.dataframe.columns.renamedReference | ||
import org.jetbrains.kotlinx.dataframe.columns.* | ||
import org.jetbrains.kotlinx.dataframe.documentation.AccessApi | ||
import org.jetbrains.kotlinx.dataframe.hasNulls | ||
import org.jetbrains.kotlinx.dataframe.impl.columnName | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnsList | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.DistinctColumnSet | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.addPath | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.allColumnsExcept | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.changePath | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnSet | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.getAt | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.getChildrenAt | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.single | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.toColumns | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.top | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.transform | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.* | ||
import org.jetbrains.kotlinx.dataframe.impl.columns.tree.dfs | ||
import kotlin.reflect.KProperty | ||
import kotlin.reflect.KType | ||
import kotlin.reflect.typeOf | ||
|
||
/** | ||
* Referring to a column in the selection DSL can be done in several ways corresponding to all | ||
* [Access APIs][AccessApi]: | ||
* TODO: [Issue #286](https://github.com/Kotlin/dataframe/issues/286) | ||
*/ | ||
private interface CommonColumnSelectionExamples | ||
|
||
/** [Column Selection DSL][ColumnSelectionDsl] */ | ||
internal interface ColumnSelectionDslLink | ||
|
||
/** TODO: [Issue #286](https://github.com/Kotlin/dataframe/issues/286) */ | ||
public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> { | ||
|
||
public operator fun <C> ColumnReference<C>.invoke(): DataColumn<C> = get(this) | ||
|
@@ -56,6 +47,10 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> { | |
public operator fun String.get(column: String): ColumnPath = pathOf(this, column) | ||
} | ||
|
||
/** [Columns Selection DSL][ColumnsSelectionDsl] */ | ||
internal interface ColumnsSelectionDslLink | ||
|
||
/** TODO: [Issue #286](https://github.com/Kotlin/dataframe/issues/286) */ | ||
public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColumn<DataRow<T>> { | ||
|
||
public fun <C> ColumnSet<C>.first(condition: ColumnFilter<C>): SingleColumn<C> = | ||
|
@@ -70,24 +65,26 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum | |
|
||
public fun ColumnsContainer<*>.group(name: String): ColumnGroupReference = name.toColumnOf() | ||
|
||
public operator fun String.rangeTo(endInclusive: String): ColumnSet<*> = toColumnAccessor().rangeTo(endInclusive.toColumnAccessor()) | ||
|
||
public operator fun AnyColumnReference.rangeTo(endInclusive: AnyColumnReference): ColumnSet<*> = object : ColumnSet<Any?> { | ||
override fun resolve(context: ColumnResolutionContext): List<ColumnWithPath<Any?>> { | ||
val startPath = [email protected](context)!!.path | ||
val endPath = endInclusive.resolveSingle(context)!!.path | ||
val parentPath = startPath.parent()!! | ||
require(parentPath == endPath.parent()) { "Start and end columns have different parent column paths" } | ||
val parentCol = context.df.getColumnGroup(parentPath) | ||
val startIndex = parentCol.getColumnIndex(startPath.name) | ||
val endIndex = parentCol.getColumnIndex(endPath.name) | ||
return (startIndex..endIndex).map { | ||
parentCol.getColumn(it).let { | ||
it.addPath(parentPath + it.name) | ||
public operator fun String.rangeTo(endInclusive: String): ColumnSet<*> = | ||
toColumnAccessor().rangeTo(endInclusive.toColumnAccessor()) | ||
|
||
public operator fun AnyColumnReference.rangeTo(endInclusive: AnyColumnReference): ColumnSet<*> = | ||
object : ColumnSet<Any?> { | ||
override fun resolve(context: ColumnResolutionContext): List<ColumnWithPath<Any?>> { | ||
val startPath = [email protected](context)!!.path | ||
val endPath = endInclusive.resolveSingle(context)!!.path | ||
val parentPath = startPath.parent()!! | ||
require(parentPath == endPath.parent()) { "Start and end columns have different parent column paths" } | ||
val parentCol = context.df.getColumnGroup(parentPath) | ||
val startIndex = parentCol.getColumnIndex(startPath.name) | ||
val endIndex = parentCol.getColumnIndex(endPath.name) | ||
return (startIndex..endIndex).map { | ||
parentCol.getColumn(it).let { | ||
it.addPath(parentPath + it.name) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
public fun none(): ColumnSet<*> = ColumnsList<Any?>(emptyList()) | ||
|
||
|
@@ -115,7 +112,8 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum | |
|
||
public fun <C> ColumnSet<DataRow<C>>.select(vararg columns: String): ColumnSet<*> = select { columns.toColumns() } | ||
|
||
public fun <C, R> ColumnSet<DataRow<C>>.select(vararg columns: KProperty<R>): ColumnSet<R> = select { columns.toColumns() } | ||
public fun <C, R> ColumnSet<DataRow<C>>.select(vararg columns: KProperty<R>): ColumnSet<R> = | ||
select { columns.toColumns() } | ||
|
||
public fun <C, R> ColumnSet<DataRow<C>>.select(selector: ColumnsSelector<C, R>): ColumnSet<R> = createColumnSet { | ||
[email protected](it).flatMap { group -> | ||
|
@@ -145,7 +143,8 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum | |
|
||
// region allDfs | ||
|
||
public fun ColumnSet<*>.allDfs(includeGroups: Boolean = false): ColumnSet<Any?> = if (includeGroups) dfs { true } else dfs { !it.isColumnGroup() } | ||
public fun ColumnSet<*>.allDfs(includeGroups: Boolean = false): ColumnSet<Any?> = | ||
if (includeGroups) dfs { true } else dfs { !it.isColumnGroup() } | ||
|
||
public fun String.allDfs(includeGroups: Boolean = false): ColumnSet<Any?> = toColumnAccessor().allDfs(includeGroups) | ||
|
||
|
@@ -242,7 +241,9 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum | |
|
||
public fun <C> col(property: KProperty<C>): ColumnAccessor<C> = property.toColumnAccessor() | ||
|
||
public operator fun ColumnSet<*>.get(colName: String): ColumnSet<Any?> = transform { it.mapNotNull { it.getChild(colName) } } | ||
public operator fun ColumnSet<*>.get(colName: String): ColumnSet<Any?> = | ||
transform { it.mapNotNull { it.getChild(colName) } } | ||
|
||
public operator fun <C> ColumnSet<*>.get(column: ColumnReference<C>): ColumnSet<C> = cols(column) | ||
|
||
public fun SingleColumn<AnyRow>.take(n: Int): ColumnSet<*> = transformSingle { it.children().take(n) } | ||
|
@@ -288,8 +289,11 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum | |
public infix fun <C> ColumnReference<C>.into(column: KProperty<*>): ColumnReference<C> = named(column.columnName) | ||
|
||
public infix fun String.into(newName: String): ColumnReference<Any?> = toColumnAccessor().into(newName) | ||
public infix fun String.into(column: ColumnAccessor<*>): ColumnReference<Any?> = toColumnAccessor().into(column.name()) | ||
public infix fun String.into(column: KProperty<*>): ColumnReference<Any?> = toColumnAccessor().into(column.columnName) | ||
public infix fun String.into(column: ColumnAccessor<*>): ColumnReference<Any?> = | ||
toColumnAccessor().into(column.name()) | ||
|
||
public infix fun String.into(column: KProperty<*>): ColumnReference<Any?> = | ||
toColumnAccessor().into(column.columnName) | ||
|
||
public infix fun <C> ColumnReference<C>.named(newName: String): ColumnReference<C> = renamedReference(newName) | ||
public infix fun <C> ColumnReference<C>.named(name: KProperty<*>): ColumnReference<C> = named(name.columnName) | ||
|
@@ -311,6 +315,7 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum | |
public infix fun <C> KProperty<C>.and(other: String): ColumnSet<Any?> = toColumnAccessor() and other | ||
public infix fun <C> KProperty<C>.and(other: KProperty<C>): ColumnSet<C> = | ||
toColumnAccessor() and other.toColumnAccessor() | ||
|
||
public infix fun <C> KProperty<C>.and(other: ColumnsSelector<T, C>): ColumnSet<C> = toColumnAccessor() and other() | ||
|
||
// endregion | ||
|
@@ -339,7 +344,7 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum | |
public inline fun <T, reified R> ColumnsSelectionDsl<T>.expr( | ||
name: String = "", | ||
infer: Infer = Infer.Nulls, | ||
noinline expression: AddExpression<T, R> | ||
noinline expression: AddExpression<T, R>, | ||
): DataColumn<R> = mapToColumn(name, infer, expression) | ||
|
||
internal fun <T, C> ColumnsSelector<T, C>.filter(predicate: (ColumnWithPath<C>) -> Boolean): ColumnsSelector<T, C> = | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file I just started with, will probably work on docs after this PR is merged in a separate branch