{"action":"created","issue":{"url":"https://api.github.com/repos/EntilZha/PyFunctional/issues/70","repository_url":"https://api.github.com/repos/EntilZha/PyFunctional","labels_url":"https://api.github.com/repos/EntilZha/PyFunctional/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/EntilZha/PyFunctional/issues/70/comments","events_url":"https://api.github.com/repos/EntilZha/PyFunctional/issues/70/events","html_url":"https://github.com/EntilZha/PyFunctional/issues/70","id":153714936,"number":70,"title":"to_json/to_jsonl does not have encoding options when exporting file?","user":{"login":"chslink","id":3823493,"avatar_url":"https://avatars.githubusercontent.com/u/3823493?v=3","gravatar_id":"","url":"https://api.github.com/users/chslink","html_url":"https://github.com/chslink","followers_url":"https://api.github.com/users/chslink/followers","following_url":"https://api.github.com/users/chslink/following{/other_user}","gists_url":"https://api.github.com/users/chslink/gists{/gist_id}","starred_url":"https://api.github.com/users/chslink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chslink/subscriptions","organizations_url":"https://api.github.com/users/chslink/orgs","repos_url":"https://api.github.com/users/chslink/repos","events_url":"https://api.github.com/users/chslink/events{/privacy}","received_events_url":"https://api.github.com/users/chslink/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/EntilZha/PyFunctional/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"EntilZha","id":1382460,"avatar_url":"https://avatars.githubusercontent.com/u/1382460?v=3","gravatar_id":"","url":"https://api.github.com/users/EntilZha","html_url":"https://github.com/EntilZha","followers_url":"https://api.github.com/users/EntilZha/followers","following_url":"https://api.github.com/users/EntilZha/following{/other_user}","gists_url":"https://api.github.com/users/EntilZha/gists{/gist_id}","starred_url":"https://api.github.com/users/EntilZha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntilZha/subscriptions","organizations_url":"https://api.github.com/users/EntilZha/orgs","repos_url":"https://api.github.com/users/EntilZha/repos","events_url":"https://api.github.com/users/EntilZha/events{/privacy}","received_events_url":"https://api.github.com/users/EntilZha/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/EntilZha/PyFunctional/milestones/7","html_url":"https://github.com/EntilZha/PyFunctional/milestones/0.7.0","labels_url":"https://api.github.com/repos/EntilZha/PyFunctional/milestones/7/labels","id":1546912,"number":7,"title":"0.7.0","description":"Future release to pin potential features to.\r\n\r\nCopied from prior release:\r\nMilestone for the `0.6.0` release. Focus of this release is not decided for certain yet.\r\n\r\nThe first possibility is to abstract the execution engine away so that `ScalaFunctional` can use either a sequential or parallel execution engine. This would need to be done through a combination of `multiprocessing` and determining where it could be used without creating massive code duplication. Additionally, this would require writing completely new tests and infrastructure since order is not guaranteed, but expected in the current sequential tests.\r\n\r\nAnother idea is to implement the `_` operator from `fn.py`. It is quite useful, but its overkill to require the library as a dependency and gimmicky to check if it exists just to import. This might open doors to integrate it more deeply as well.\r\n\r\nWhat would you like to see?","creator":{"login":"EntilZha","id":1382460,"avatar_url":"https://avatars.githubusercontent.com/u/1382460?v=3","gravatar_id":"","url":"https://api.github.com/users/EntilZha","html_url":"https://github.com/EntilZha","followers_url":"https://api.github.com/users/EntilZha/followers","following_url":"https://api.github.com/users/EntilZha/following{/other_user}","gists_url":"https://api.github.com/users/EntilZha/gists{/gist_id}","starred_url":"https://api.github.com/users/EntilZha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntilZha/subscriptions","organizations_url":"https://api.github.com/users/EntilZha/orgs","repos_url":"https://api.github.com/users/EntilZha/repos","events_url":"https://api.github.com/users/EntilZha/events{/privacy}","received_events_url":"https://api.github.com/users/EntilZha/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":3,"state":"open","created_at":"2016-01-27T18:36:35Z","updated_at":"2016-05-09T15:39:53Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2016-05-09T07:05:04Z","updated_at":"2016-05-11T09:42:26Z","closed_at":null,"body":"when using to_json/to_jsonl to export files.I found the methon no encoding option.I read the code,and both functions using json.dump and utf-8 charset.\r\nAnd thanks for your awesome work,I really love this functional toolkits."},"comment":{"url":"https://api.github.com/repos/EntilZha/PyFunctional/issues/comments/218411283","html_url":"https://github.com/EntilZha/PyFunctional/issues/70#issuecomment-218411283","issue_url":"https://api.github.com/repos/EntilZha/PyFunctional/issues/70","id":218411283,"user":{"login":"EntilZha","id":1382460,"avatar_url":"https://avatars.githubusercontent.com/u/1382460?v=3","gravatar_id":"","url":"https://api.github.com/users/EntilZha","html_url":"https://github.com/EntilZha","followers_url":"https://api.github.com/users/EntilZha/followers","following_url":"https://api.github.com/users/EntilZha/following{/other_user}","gists_url":"https://api.github.com/users/EntilZha/gists{/gist_id}","starred_url":"https://api.github.com/users/EntilZha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntilZha/subscriptions","organizations_url":"https://api.github.com/users/EntilZha/orgs","repos_url":"https://api.github.com/users/EntilZha/repos","events_url":"https://api.github.com/users/EntilZha/events{/privacy}","received_events_url":"https://api.github.com/users/EntilZha/received_events","type":"User","site_admin":false},"created_at":"2016-05-11T09:42:25Z","updated_at":"2016-05-11T09:42:25Z","body":"The behavior you describe is actually exactly the intended behavior. Once a `seq` is initialized it is for most purposes an immutable stream.\r\n\r\nIt would be better to think about the function calls as a declarative sequence of transformations rather than procedural directives. For example, I would interpret your example as:\r\n1. `data.drop(1)`: Give me data after one element has been dropped\r\n2. `data`: Give me data\r\n\r\nThis can be seen a little more clearly by doing this:\r\n```python\r\nprint(data.drop(1)._lineage)\r\n# Lineage: sequence -> drop(1)\r\nprint(data._lineage)\r\n# Lineage: sequence\r\n```\r\n\r\nIn other words, any mutations to a sequence are not in place, but instead describe a pipeline of transformations to apply to the original sequence.\r\n\r\nOn the bug, I just pushed a fix in https://github.com/EntilZha/PyFunctional/commit/4a3735be6d6752c266047d8d173e7aa9bb874b42\r\n\r\nHere is the code output now:\r\n```\r\n$ python\r\nPython 2.7.11 (default, Jan 19 2016, 14:37:25)\r\n[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> from functional import seq\r\n>>> testlist = [\r\n...         {\"id\": 1, \"key\": u\"some unicode 哈哈哈 1\"},\r\n...         {\"id\": 2, \"key\": u\"some unicode 哈哈哈 2\"}\r\n...     ]\r\n>>>\r\n>>> data = seq(testlist)\r\n>>> data.to_json(\"r.json\")\r\n>>> data.to_jsonl(\"r.jsonl\")\r\n>>> exit()\r\n$ cat r.json\r\n[{\"id\": 1, \"key\": \"some unicode \\u54c8\\u54c8\\u54c8 1\"}, {\"id\": 2, \"key\": \"some unicode \\u54c8\\u54c8\\u54c8 2\"}]\r\n$ cat r.jsonl\r\n{\"id\": 1, \"key\": \"some unicode \\u54c8\\u54c8\\u54c8 1\"}\r\n{\"id\": 2, \"key\": \"some unicode \\u54c8\\u54c8\\u54c8 2\"}\r\n```\r\n\r\nIt looks like it works, but could you verify on your end to be sure? The best way to do this would be to do one of these inside a `virtualenv`:\r\n1. `git+git://github.com/EntilZha/PyFunctional.git`\r\n2. clone the github repo and do `python setup.py install`\r\n"}}