Skip to content

Commit

Permalink
Merge pull request #2074 from nteract/devDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Apr 13, 2021
2 parents 13953be + cb17fa4 commit 2abe9e2
Show file tree
Hide file tree
Showing 15 changed files with 150 additions and 122 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto

# don't diff machine generated files
dist/ -diff
package-lock.json -diff
14 changes: 6 additions & 8 deletions lib/components/result-view/markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Adapted from https://github.com/nteract/nteract/blob/master/packages/outputs/src/components/media/markdown.tsx
* Copyright (c) 2016 - present, nteract contributors
* All rights reserved.
* Adapted from
* https://github.com/nteract/nteract/blob/master/packages/outputs/src/components/media/markdown.tsx
* Copyright (c) 2016 - present, nteract contributors All rights reserved.
*
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
Expand All @@ -12,14 +12,12 @@
import MarkdownComponent from "@nteract/markdown";
import React from "react";
interface Props {
/**
* Markdown text.
*/
/** Markdown text. */
data: string;

/**
* Media type. Defaults to `text/markdown`.
* For more on media types, see: https://www.w3.org/TR/CSS21/media.html%23media-types.
* Media type. Defaults to `text/markdown`. For more on media types, see:
* https://www.w3.org/TR/CSS21/media.html%23media-types.
*/
mediaType: "text/markdown";
}
Expand Down
6 changes: 3 additions & 3 deletions lib/components/result-view/plotly.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Adapted from https://github.com/nteract/nteract/blob/master/packages/transform-plotly/src/index.tsx
* Copyright (c) 2016 - present, nteract contributors
* All rights reserved.
* Adapted from
* https://github.com/nteract/nteract/blob/master/packages/transform-plotly/src/index.tsx
* Copyright (c) 2016 - present, nteract contributors All rights reserved.
*
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
Expand Down
32 changes: 15 additions & 17 deletions lib/import-notebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { importResult, convertMarkdownToOutput } from "./result";
const linesep = process.platform === "win32" ? "\r\n" : "\n";

/**
* Determines if the provided uri is a valid file for Hydrogen to import.
* Then it loads the notebook.
* Determines if the provided uri is a valid file for Hydrogen to import. Then
* it loads the notebook.
*
* @param {String} uri - Uri of the file to open.
*/
Expand All @@ -34,11 +34,9 @@ export function ipynbOpener(uri: string) {
}

/**
* Determines if the provided event is trying to open
* a valid file for Hydrogen to import.
* Otherwise it will ask the user to chose
* a valid file for Hydrogen to import.
* Then it loads the notebook.
* Determines if the provided event is trying to open a valid file for Hydrogen
* to import. Otherwise it will ask the user to chose a valid file for Hydrogen
* to import. Then it loads the notebook.
*
* @param {Event} event - Atom Event from clicking in a treeview.
*/
Expand Down Expand Up @@ -161,7 +159,7 @@ export async function _loadNotebook(
* Tries to determine the Atom Grammar of a notebook. Default is Python.
*
* @param {Notebook} nb - The Notebook to determine the Atom Grammar of.
* @return {Grammar} - The grammar of the notebook.
* @returns {Grammar} - The grammar of the notebook.
*/
function getGrammarForNotebook(nb: Notebook) {
const metaData = nb.metadata;
Expand Down Expand Up @@ -232,7 +230,7 @@ function getGrammarForNotebook(nb: Notebook) {
* Tries to find a matching Atom Grammar from a language name
*
* @param {String} name - The language name to find a grammar for.
* @return {Grammar} - The matching Atom Grammar.
* @returns {Grammar} - The matching Atom Grammar.
*/
function getGrammarForLanguageName(name: string) {
if (!name) {
Expand All @@ -259,7 +257,7 @@ function getGrammarForLanguageName(name: string) {
* Tries to find a matching Atom Grammar from a file extensions
*
* @param {String} ext - The file extension to find a grammar for.
* @return {Grammar} - The matching Atom Grammar.
* @returns {Grammar} - The matching Atom Grammar.
*/
function getGrammarForFileExtension(ext: string): Grammar | null | undefined {
if (!ext) {
Expand All @@ -276,7 +274,7 @@ function getGrammarForFileExtension(ext: string): Grammar | null | undefined {
* Tries to find a matching Atom Grammar from KernelspecMetadata name
*
* @param {String} name - The KernelspecMetadata name to find a grammar for.
* @return {Grammar} - The matching Atom Grammar.
* @returns {Grammar} - The matching Atom Grammar.
*/
function getGrammarForKernelspecName(name: string): Grammar | null | undefined {
// Check if there exists an Atom grammar named source.${name}
Expand All @@ -303,7 +301,7 @@ function getGrammarForKernelspecName(name: string): Grammar | null | undefined {
*
* @param {Cell} cell - Notebook cell to convert
* @param {String} commentStartString - The comment syntax of the code language.
* @return {Object} - A Hydrogen Code Block.
* @returns {Object} - A Hydrogen Code Block.
*/
function toHydrogenCodeBlock(
cell: Cell,
Expand Down Expand Up @@ -339,7 +337,7 @@ function toHydrogenCodeBlock(
*
* @param {String} commentStartString - The comment syntax of the code language.
* @param {String} keyword - The keyword relating to the cell type.
* @return {String} - A Hydrogen Cell Header.
* @returns {String} - A Hydrogen Cell Header.
*/
function getCellHeader(
commentStartString: string,
Expand All @@ -350,12 +348,12 @@ function getCellHeader(
}

/**
* Displays previous cell results inline of the provided editor.
* nbCells and resultRows should be the same length.
* Displays previous cell results inline of the provided editor. nbCells and
* resultRows should be the same length.
*
* @param {TextEditor} editor - The editor to display the results in.
* @param {Array<Cell>} nbCells - The original notebook cells.
* @param {Array<Number>} resultRows - The rows to display the results on.
* @param {Cell[]} nbCells - The original notebook cells.
* @param {Number[]} resultRows - The rows to display the results on.
*/
function importNotebookResults(
editor: TextEditor,
Expand Down
23 changes: 14 additions & 9 deletions lib/module_types/jupyter-paths/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ export declare function askJupyter(): Promise<JupyterPaths>;
interface Options {
/** Ask Jupyter where the paths are */
askJupyter: boolean;
/** Include the sys.prefix paths When {options.withSysPrefix} is set, `dataDirs` returns a promise of directories */
/**
* Include the sys.prefix paths When {options.withSysPrefix} is set,
* `dataDirs` returns a promise of directories
*/
withSysPrefix: boolean;
}

/**
* DataDirs returns all the expected static directories for this OS. The user of this function should make sure to make
* sure the directories exist.
* DataDirs returns all the expected static directories for this OS. The user of
* this function should make sure to make sure the directories exist.
*
* @example
*
Expand All @@ -34,18 +37,19 @@ interface Options {
*
* When {options.withSysPrefix} is set, this returns a promise of directories
*
* If you want the paths to include the `sys.prefix` paths (for Anaconda installs), an optional `opts` parameter is
* accepted with key `withSysPrefix`. This changes the return to a promise for you instead.
* If you want the paths to include the `sys.prefix` paths (for Anaconda
* installs), an optional `opts` parameter is accepted with key `withSysPrefix`.
* This changes the return to a promise for you instead.
*
* @example
*
* ```js
* jp.dataDirs({ withSysPrefix: true }).then(console.log)
* jp.dataDirs({ withSysPrefix: true }).then(console.log);
* ```
*
* Promise { <pending> } [ '/Users/rgbkrk/Library/Jupyter',
* '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/share/jupyter', '/usr/share/jupyter',
* '/usr/local/share/jupyter' ]
* '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/share/jupyter',
* '/usr/share/jupyter', '/usr/local/share/jupyter' ]
*
* @returns All the Jupyter Data Dirs
*/
Expand All @@ -59,7 +63,8 @@ export declare function dataDirs(options?: Options): Promise<Array<string>>;
export declare function runtimeDir(): string;

/**
* Like `dataDirs`, an optional `options` parameter is accepted with key `withSysPrefix` as an argument.
* Like `dataDirs`, an optional `options` parameter is accepted with key
* `withSysPrefix` as an argument.
*
* ```JavaScript
* > jp.configDirs({ withSysPrefix: true }).then(console.log)
Expand Down
39 changes: 22 additions & 17 deletions lib/module_types/kernelspecs/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { KernelspecMetadata } from "@nteract/types";

export interface KernelResources {
/** name of the kernel */
/** Name of the kernel */
name: string;

files: string[];

/** kernel's resources directory */
/** Kernel's resources directory */
resourceDir: string;

spec: KernelspecMetadata;
Expand All @@ -17,39 +17,42 @@ export type KernelResourcesRecord = Record<
KernelResources
>;

/** description of a kernel */
/** Description of a kernel */
export interface KernelInfo {
/** name of the kernel */
/** Name of the kernel */
name: string;

/** kernel's resources directory */
/** Kernel's resources directory */
resourceDir: string;
}

/**
* Get a kernel resources object
* @param {Object} kernelInfo description of a kernel
* @param {string} kernelInfo.name name of the kernel
* @param {string} kernelInfo.resourceDir kernel's resources directory
* @return {Promise<KernelResources>} Promise for a kernelResources object
*
* @param {Object} kernelInfo Description of a kernel
* @param {string} kernelInfo.name Name of the kernel
* @param {string} kernelInfo.resourceDir Kernel's resources directory
* @returns {Promise<KernelResources>} Promise for a kernelResources object
*/
export declare function getKernelResources(
kernelInfo: KernelInfo
): Promise<KernelResources>;

/**
* Gets a list of kernelInfo objects for a given directory of kernels
* @param {string} directory path to a directory full of kernels
* @return {Promise<KernelInfo[]>} Promise for an array of kernelInfo objects
*
* @param {string} directory Path to a directory full of kernels
* @returns {Promise<KernelInfo[]>} Promise for an array of kernelInfo objects
*/
export declare function getKernelInfos(
directory: string
): Promise<KernelInfo[]>;

/**
* find a kernel by name
* @param {string} kernelName the kernel to locate
* @return {Promise<KernelResources>} a promise for the kernelResource object
* Find a kernel by name
*
* @param {string} kernelName The kernel to locate
* @returns {Promise<KernelResources>} A promise for the kernelResource object
*/
export declare function find(kernelName: string): Promise<KernelResources>;

Expand All @@ -58,8 +61,10 @@ declare function extractKernelResources(
): Promise<KernelResourcesRecord>;

/**
* Get a record of kernelResources objects for the host environment
* This matches the Jupyter notebook API for kernelspecs exactly
* @return {Promise<KernelResourcesRecord>} Promise for a record of {KernelResources} objects that are indexable by their name
* Get a record of kernelResources objects for the host environment This matches
* the Jupyter notebook API for kernelspecs exactly
*
* @returns {Promise<KernelResourcesRecord>} Promise for a record of
* {KernelResources} objects that are indexable by their name
*/
export declare function findAll(): Promise<KernelResourcesRecord>;
17 changes: 7 additions & 10 deletions lib/plugin-api/hydrogen-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ import type Kernel from "../kernel";
import type ZMQKernel from "../zmq-kernel";
import { getCurrentCell } from "../code-manager";
/**
* @version 1.0.0
*
*
* The Plugin API allows you to make Hydrogen awesome.
* You will be able to interact with this class in your Hydrogen Plugin using
* Atom's [Service API](http://blog.atom.io/2015/03/25/new-services-API.html).
*
* Take a look at our [Example Plugin](https://github.com/lgeiger/hydrogen-example-plugin)
* and the [Atom Flight Manual](http://flight-manual.atom.io/hacking-atom/) for
* learning how to interact with Hydrogen in your own plugin.
* @version 1.0.0 The Plugin API allows you to make Hydrogen awesome. You will
* be able to interact with this class in your Hydrogen Plugin using Atom's
* [Service API](http://blog.atom.io/2015/03/25/new-services-API.html).
*
* Take a look at our [Example
* Plugin](https://github.com/lgeiger/hydrogen-example-plugin) and the [Atom
* Flight Manual](http://flight-manual.atom.io/hacking-atom/) for learning how
* to interact with Hydrogen in your own plugin.
* @class HydrogenProvider
*/

Expand Down
27 changes: 13 additions & 14 deletions lib/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function createResult(
* @param {TextEditor} store.editor - The editor to display the results in.
* @param {MarkerStore} store.markers - Should almost always be the editor's `MarkerStore`
* @param {Object} bundle - The bundle to display.
* @param {Array<Object>} bundle.outputs - The Kernel Responses to display.
* @param {Object[]} bundle.outputs - The Kernel Responses to display.
* @param {Number} bundle.row - The editor row to display the results on.
*/
export function importResult(
Expand Down Expand Up @@ -138,16 +138,16 @@ export function importResult(
}

/**
* Clears a ResultView or selection of ResultViews.
* To select a result to clear, put your cursor on the row on the ResultView.
* To select multiple ResultViews, select text starting on the row of
* the first ResultView to remove all the way to text on the row of the
* last ResultView to remove. *This must be one selection and
* the last selection made*
* Clears a ResultView or selection of ResultViews. To select a result to clear,
* put your cursor on the row on the ResultView. To select multiple ResultViews,
* select text starting on the row of the first ResultView to remove all the way
* to text on the row of the last ResultView to remove. *This must be one
* selection and the last selection made*
*
* @param {Object} store - Global Hydrogen Store
* @param {TextEditor} store.editor - TextEditor associated with the ResultView.
* @param {MarkerStore} store.markers - MarkerStore that belongs to `store.editor` and the ResultView.
* @param {MarkerStore} store.markers - MarkerStore that belongs to
* `store.editor` and the ResultView.
*/
export function clearResult({
editor,
Expand All @@ -167,8 +167,7 @@ export function clearResult({
}

/**
* Clears all ResultViews of a MarkerStore.
* It also clears the currect kernel results.
* Clears all ResultViews of a MarkerStore. It also clears the currect kernel results.
*
* @param {Object} store - Global Hydrogen Store
* @param {Kernel} store.kernel - Kernel to clear outputs.
Expand All @@ -191,12 +190,12 @@ export function clearResults({
}

/**
* Converts a string of raw markdown to a display_data Kernel Response.
* This allows for hydrogen to display markdown text as if is was any normal
* result that came back from the kernel.
* Converts a string of raw markdown to a display_data Kernel Response. This
* allows for hydrogen to display markdown text as if is was any normal result
* that came back from the kernel.
*
* @param {String} markdownString - A string of raw markdown code.
* @return {Object} A fake display_data Kernel Response.
* @returns {Object} A fake display_data Kernel Response.
*/
export function convertMarkdownToOutput(markdownString: string) {
return {
Expand Down
Loading

0 comments on commit 2abe9e2

Please sign in to comment.