Move all packages to a types directory

This commit is contained in:
Andy Hanson
2017-03-24 14:27:52 -07:00
parent f9869dc191
commit 354cec620d
13846 changed files with 0 additions and 0 deletions

39
types/python-shell/index.d.ts vendored Normal file
View File

@@ -0,0 +1,39 @@
// Type definitions for python-shell 0.4
// Project: https://github.com/extrabacon/python-shell
// Definitions by: Dolan Miu <https://github.com/dolanmiu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export class PythonShell {
on(message: string, callback: (message: string) => void): void;
end(callback: (message: string) => void): void;
send(message: any | string): void;
constructor(scriptName: string, options?: InstanceOptions);
defaultOptions: RunOptions;
}
export interface RunOptions {
mode?: string;
formatter?: string;
parser?: string;
encoding?: string;
pythonPath?: string;
pythonOptions?: string[];
scriptPath?: string;
args?: string[];
}
export interface InstanceOptions {
script?: string;
command?: string;
stdin?: any;
stdout?: any;
stderr?: any;
childProcess?: string;
terminated?: any;
exitCode?: any;
args?: any[];
}
export function run(scriptName: string, RunOptions: RunOptions, callback: (err: Error, results?: any) => void): void;
export function run(scriptName: string, callback: (err: Error, results?: any) => void): void;

View File

@@ -0,0 +1,38 @@
import * as ps from 'python-shell';
const PythonShell = ps.PythonShell;
ps.run('my_script.py', err => {
if (err) throw err;
console.log('finished');
});
var options = {
mode: 'text',
pythonPath: 'path/to/python',
pythonOptions: ['-u'],
scriptPath: 'path/to/my/scripts',
args: ['value1', 'value2', 'value3']
};
ps.run('my_script.py', options, (err, results) => {
if (err) throw err;
// results is an array consisting of messages collected during execution
console.log('results: %j', results);
});
var pyshell = new PythonShell('my_script.py');
// sends a message to the Python script via stdin
pyshell.send('hello');
pyshell.on('message', message => {
// received a message sent from the Python script (a simple "print" statement)
console.log(message);
});
// end the input stream and allow the process to exit
pyshell.end(err => {
if (err) throw err;
console.log('finished');
});

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"python-shell-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }