Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

io module #688

Closed
wants to merge 3 commits into from
Closed

io module #688

wants to merge 3 commits into from

Conversation

lschumm
Copy link
Contributor

@lschumm lschumm commented Nov 13, 2017

In this PR, I add the io module to Batavia.

Although one may naively implement the open() call as a standalone entity, a lot of Python depends on IO buffers–meaning that the io module is important for a lot more than files. Emulating a filesystem is very useful in porting system scripts to the browser, allowing for easy data storage (by allowing pickle or similar to write to what it wants to see, a writable file object).

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

NOTE: this is in progress! Please don't merge yet :)

@lschumm
Copy link
Contributor Author

lschumm commented Nov 13, 2017

Also, another note: this depends on the localstorage-fs module, which I've forked under my account because it's not very actively maintained by the original creator. I've added a direct GitHub url in the package.json to my version-I'd suggest forking that version under the pybee organization to centralize things.

io.IOBase = function(args, kwargs) {
var types = require('../types')

PyObject.call(this)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

create_pyclass(io.IOBase, 'IOBase')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_pyclass(io.IOBase, 'IOBase')

io.IOBase.__repr__ = function() {
return '<IOBase object at 0x99999999>'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


io.IOBase.prototype.__ne__ = function(other) {
return this === other
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


io.IOBase.prototype.__ne__ = function(other) {
return this === other
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


io.IOBase.prototype.__ne__ = function(other) {
return this === other
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return this === other
}

io.IOBase.prototype.close = function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return this === other
}

io.IOBase.prototype.close = function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.closed = true
}
else {
// only the first call will have an effect; multiple close()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.closed = true
}
else {
// only the first call will have an effect; multiple close()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

io.IOBase.prototype.closed = false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

io.IOBase.prototype.closed = false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

io.IOBase.prototype.fileno = function() {
throw new exceptions.UnsupportedOperation.$pyclass(
'fileno'
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

io.IOBase.prototype.fileno = function() {
throw new exceptions.UnsupportedOperation.$pyclass(
'fileno'
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

io.IOBase.prototype.flush = function() {
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

io.IOBase.prototype.flush = function() {
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


io.IOBase.prototype.flush = function() {
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


io.IOBase.prototype.flush = function() {
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

io.IOBase.prototype.flush = function() {
}

// since we're in Javascript, we're not in a TTY

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

io.IOBase.prototype.flush = function() {
}

// since we're in Javascript, we're not in a TTY

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

// since we're in Javascript, we're not in a TTY
io.IOBase.prototype.isatty = function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

// since we're in Javascript, we're not in a TTY
io.IOBase.prototype.isatty = function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

// since we're in Javascript, we're not in a TTY
io.IOBase.prototype.isatty = function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// since we're in Javascript, we're not in a TTY
io.IOBase.prototype.isatty = function() {
return false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// since we're in Javascript, we're not in a TTY
io.IOBase.prototype.isatty = function() {
return false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// since we're in Javascript, we're not in a TTY
io.IOBase.prototype.isatty = function() {
return false
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// since we're in Javascript, we're not in a TTY
io.IOBase.prototype.isatty = function() {
return false
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

io.IOBase.prototype.isatty = function() {
return false
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

io.IOBase.prototype.isatty = function() {
return false
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return false
}

io.IOBase.prototype.readable = function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return false
}

io.IOBase.prototype.readable = function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw new exceptions.UnsupportedOperation.$pyclass(
'seek'
)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw new exceptions.UnsupportedOperation.$pyclass(
'seek'
)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


io.IOBase.prototype.seekable = function() {
return false;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


io.IOBase.prototype.seekable = function() {
return false;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


io.IOBase.prototype.tell = function() {
throw new exceptions.UnsupportedOperation.$pyclass(
'seek'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phildini
Copy link
Member

Hi there! It looks like this PR might be dead, so we're closing it for now. Feel free to re-open it if you'd like to continue, or think about directing your efforts to https://github.com/beeware/briefcase or https://github.com/beeware/toga. Both of these have more active development right now. 😄

@phildini phildini closed this Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants