|
OK, it's only been a few week since 0.4, but for those interested, we released Bokeh 0.4.1. For a point release it has some pretty awesome additions: improved matplotlib compat layer, categorical axes and plots, flexible hover tool, and preliminary Scala bindings. Not bad for a point release. Lot's of great new kinds of plots you can make. These are all from a really huge tutorial I just made to present at PyData London. They aren't in the docs yet but they will be very soon! Coming in the next release is some abstract rendering and dynamic downsampling. There's a branch that can currently interactively explore GBs of data and it should scale easily to hundreds of GBs. As always anyone interested in finding a project to contribute to, we are always interested in new contributors. Check out https://github.com/ContinuumIO/bokeh
|
# ? Feb 21, 2014 11:05 |
|
|
# ? May 31, 2024 01:31 |
|
^ Bokeh is looking pretty awesome, and may find great use at work for me. We have some ancient java servlet that renders some horrific graphs, and I'd love to replace it. Does anyone have any experience with Python LDAP? I'm looking for a way to send the password already encrypted. I know LDAPS can use LDAP over SSL, and that's great, but what I want is the ability to accept user credentials without my application ever seeing someone's password in plaintext. Even using LDAPS would allow my application to see a password in plaintext before it's sent out over SSL.
|
# ? Feb 21, 2014 20:20 |
|
I'm trying to implement a linked list, and I'm running into a problem. I had an issue where taking the next node, then trying to find the previous of that node would give me a NoneType error, and I tried to fix that. Unfortunately, I can't tell if it works because Python hangs for (as far as I can tell) forever if I add the fix in. Why does my attempted fix cause this, and what's even going on? I commented out the lines I added. Python code:
|
# ? Feb 21, 2014 23:24 |
|
Pollyanna posted:I'm trying to implement a linked list, and I'm running into a problem. I had an issue where taking the next node, then trying to find the previous of that node would give me a NoneType error, and I tried to fix that. Unfortunately, I can't tell if it works because Python hangs for (as far as I can tell) forever if I add the fix in. Why does my attempted fix cause this, and what's even going on? The problem is because you aren't forming bi-directional connections. Python code:
I haven't fully tested this, but it seems like it is working. Let me know if you have any questions. Python code:
accipter fucked around with this message at 00:15 on Feb 22, 2014 |
# ? Feb 21, 2014 23:47 |
|
BigRedDot posted:OK, it's only been a few week since 0.4, but for those interested, we released Bokeh 0.4.1. For a point release it has some pretty awesome additions: improved matplotlib compat layer, categorical axes and plots, flexible hover tool, and preliminary Scala bindings. Not bad for a point release. Lot's of great new kinds of plots you can make. Please tell Ilan that the 64-bit Linux Anaconda installer fails like 10-15% of the time (RHEL-like, different machines). This is for 1.8 and 1.9. There will be a random decompression error during extraction of any of the packages. IMO if it fails it should clean up the directory it created.
|
# ? Feb 22, 2014 00:47 |
|
kraftwerk singles posted:Please tell Ilan that the 64-bit Linux Anaconda installer fails like 10-15% of the time (RHEL-like, different machines). This is for 1.8 and 1.9. There will be a random decompression error during extraction of any of the packages. IMO if it fails it should clean up the directory it created. I can certainly pass this on but if you send it to anaconda@continuum.io then you could be kept in the discussion, and also provide any additional diagnostic info.
|
# ? Feb 22, 2014 03:17 |
|
How can I get timezone-aware time objects? Per the docs, they exist: "For applications requiring aware objects, datetime and time objects have an optional time zone information attribute, tzinfo" However, I can find fuckall about them. Everything's about datetime objects. pytz.timezone('Europe/Athens').localize(dt.time(9,30)) results in TypeError: unsupported operand type(s) for +: 'datetime.time' and 'datetime.timedelta' I'm trying to create time objects that are the UTC time when a stock market opens and closes. Their local time zones are fixed, but flex with DST. Ie I set a local timezone object of 0930, localized to EST. I then find and use its UTC time. This appears to get the proper time, but as a naieve time object: Python code:
Dominoes fucked around with this message at 00:14 on Feb 23, 2014 |
# ? Feb 22, 2014 23:55 |
|
Try arrow.
|
# ? Feb 23, 2014 05:28 |
|
Python's built-in support for timezone-aware time objects sucks. Use arrow instead.
|
# ? Feb 23, 2014 08:34 |
|
So there's this module for generating random fake test data that I really like using in test automation, called faker (though on pypi it's fake-factory). Anyway, I'm transitioning all of the test automation at my work to Robot Framework, and RF has a keyword-based test DSL you use to write tests, but you can import Python as keywords. I wanted to import faker, but it wouldn't work because faker is like a few layers of generators, and RF does introspection to find keywords within files and classes. So, I decided to write a wrapper, but it turned out a little trickier than I thought. My solution works really, really well (RF's auto-documentation generator actually finds all the "keywords" I've pulled out of faker, including their docstrings and args). I normally hate doing tricky magical poo poo involving hacking the internals of classes, but in this case I think it's warranted and fairly well encapsulated. If anyone wants to tell me how I could have done this better, take a look: Python code:
Also this is my first time packaging Python and actually uploading it to pypi. It didn't go very smoothly at first. Also, if anyone is still reading this, I feel like this is a fairly generic solution, and therefore might be worth either trying to turn into a generic package for helping people wrap stuff for Robot Framework, or maybe even a patch for the Robot Framework core for quick and dirty imports of arbitrary modules. BeefofAges fucked around with this message at 16:53 on Feb 23, 2014 |
# ? Feb 23, 2014 09:06 |
|
BeefofAges posted:Try arrow. Luigi Thirty posted:Python's built-in support for timezone-aware time objects sucks. Use arrow instead. Per the arrow docs, Arrow is a "Fully implemented, drop-in replacement for datetime" that aims to fix problems including "Too many types: date, time, datetime, tzinfo, timedelta, relativedelta, etc." That said, I can't figure out how to replace this code with arrow, as it doesn't have a timedelta eqivolent I've found: Python code:
|
# ? Feb 23, 2014 15:28 |
|
The equivalent to that appears to be this.Python code:
|
# ? Feb 23, 2014 16:53 |
|
Crosscontaminant posted:The equivalent to that appears to be this. code:
|
# ? Feb 23, 2014 17:15 |
|
Oh, I guess I completely misunderstood what you were doing. What manner of beast is raw_time when using the datetime module?
|
# ? Feb 23, 2014 18:09 |
|
Crosscontaminant posted:Oh, I guess I completely misunderstood what you were doing.
|
# ? Feb 23, 2014 18:14 |
|
I recently split a single script into separate files with grouped related functions so the project would be easier to manage. After I split the script, there were some global constants defined in the parent script that the imported scripts could no longer see. I was able to move the constants to the appropriate files, or just add them as passed function parameters -- so Python may be helping enforce good coding practices -- but it got me curious to understand the scope of variables across imported files better. As an example, if I wanted a "parent" script to set global constants or config that imported scripts might use, like the path to a master directory, is there an appropriate way to access those parent variables from an imported script? Is that what __init__.py is for, or is the idea bad practice in general, and an indication that they should be passed parameters?
|
# ? Feb 23, 2014 21:32 |
|
For constant parameters used in more than one place I create a py file that just defines those values, and then whenever I need those constants they're just an import away.
|
# ? Feb 23, 2014 22:40 |
|
QuarkJets posted:For constant parameters used in more than one place I create a py file that just defines those values, and then whenever I need those constants they're just an import away.
|
# ? Feb 23, 2014 23:12 |
|
QuarkJets posted:For constant parameters used in more than one place I create a py file that just defines those values, and then whenever I need those constants they're just an import away. Dominoes fucked around with this message at 07:22 on Feb 24, 2014 |
# ? Feb 24, 2014 06:53 |
|
Question: where is a good, scrape-able database of things like stock values, shorts as a % of float, etc?
|
# ? Feb 24, 2014 19:53 |
|
semicolonsrock posted:Question: where is a good, scrape-able database of things like stock values, shorts as a % of float, etc?
|
# ? Feb 24, 2014 20:13 |
|
PyCharm (CE): changing "from package.module import Class" to "from package import module" and changing all references to "Class" to "module.Class" -- I figured they had a thing for this but I'm not seeing it under Refactor. There's a context-sensitive lightbulb that offers to change it to "import package.module" and handle references accordingly but not the exact intermediate step I want.
|
# ? Feb 24, 2014 20:20 |
Is there an easy way to see which packages are depending on package <x> in a virtualenv?
|
|
# ? Feb 24, 2014 22:23 |
|
fletcher posted:Is there an easy way to see which packages are depending on package <x> in a virtualenv? You could try this: code:
|
# ? Feb 24, 2014 23:37 |
accipter posted:You could try this: That seems to work but only going the other direction: code:
code:
|
|
# ? Feb 25, 2014 00:04 |
|
KICK BAMA KICK posted:PyCharm (CE): changing "from package.module import Class" to "from package import module" and changing all references to "Class" to "module.Class" -- I figured they had a thing for this but I'm not seeing it under Refactor. There's a context-sensitive lightbulb that offers to change it to "import package.module" and handle references accordingly but not the exact intermediate step I want. why not just do something like sed 's/from package\.module import .*/from package import module/g' file.py | sed 's/Class/module\.Class/g' there's probably some fancier way but i'm no sed expert and i would just do that Pie Colony fucked around with this message at 03:36 on Feb 25, 2014 |
# ? Feb 25, 2014 03:30 |
|
Pie Colony posted:why not just do something like sed 's/from package\.module import .*/from package import module/g' file.py | sed 's/Class/module\.Class/g'
|
# ? Feb 25, 2014 03:44 |
|
I'm annoyed by Pycharm's inspection of example code in docstrings (detected by >>>). For example, I have this docstring segment:Python code:
So- am I doing it wrong? If so, any suggestions? If not, is there a way to turn this inspection off? I can't find it. It wasn't a big deal until I made a change and wanted to check that it didn't produce any extra warnings. Since my file is littered with these warnings I can't tell quickly.
|
# ? Feb 25, 2014 18:04 |
SurgicalOntologist posted:I'm annoyed by Pycharm's inspection of example code in docstrings (detected by >>>). For example, I have this docstring segment: Is that using the latest version of PyCharm? I do see several bug reports that sound like what you are describing. This one was closed as a wontfix - is your docstring the first statement in the function?
|
|
# ? Feb 25, 2014 18:15 |
|
Yes, my docstring really is the docstring, it's completely different from that guy's mistake (thinking triple-quoted strings in any arbitrary place are comments). And what I'm talking about is not really a bug in any case--that is, Pycharm is correct to note that exp is an unresolved reference. I would just prefer it not to check for that particular warning in docstrings. I can turn off that warning globally, but that would be overkill.
|
# ? Feb 25, 2014 18:57 |
|
Anyone know if there is a way to "explain" an object? Basically, an easy to way to see what functions and attributes are callable for a particular object? Without having documentation?
|
# ? Feb 25, 2014 20:44 |
|
There's dir().
|
# ? Feb 25, 2014 20:48 |
|
qntm posted:There's dir(). And help()
|
# ? Feb 26, 2014 01:12 |
|
SurgicalOntologist posted:Yes, my docstring really is the docstring, it's completely different from that guy's mistake (thinking triple-quoted strings in any arbitrary place are comments). It's probably assuming you put the >>> in for a doctest.
|
# ? Feb 26, 2014 05:59 |
|
BeefofAges posted:It's probably assuming you put the >>> in for a doctest. yeah, this is why. Removing the >>> or marking "plain" docstrings in integrated tools seems to get you to where you want to go. For what it's worth, if there was a global thing named "exp" in scope of the function this is for, it'd also work
|
# ? Feb 26, 2014 06:10 |
|
Yes, I understand why Pycharm is doing this. I'd get rid of the prompt but I'm using Sphinx so I do want it formatted as a code example even though I'm not using doctest. Interesting idea about the global scope. Probably not worth it but good to know for temporarily getting rid of the warnings in order to scan for other ones.
|
# ? Feb 26, 2014 06:26 |
|
I think you can disable it under Settings | Project Settings | Inspections
|
# ? Feb 26, 2014 07:17 |
|
I can't find it there. I can disable the "unresolved reference" inspection entirely, but I don't see a way to disable doctest inspections.
|
# ? Feb 26, 2014 08:59 |
|
How many lines would it be for an example with no unresolved references? Maybe you should write a full, functional example.
|
# ? Feb 26, 2014 16:22 |
|
|
# ? May 31, 2024 01:31 |
|
Yeah I probably should. In this case I can cram it onto 2-3 lines, but in some other cases three lines could fix the unresolved reference, but the example wouldn't make sense. For example, a resume method only makes sense if you've previously started running. But running is accomplished from a shell command. And you can't run without setting a callback, that's like 4 more lines just to define an empty function and pass it. That's just one example. For the case I posted maybe I should write a full doctest, but I don't think I can do that across the board.
|
# ? Feb 26, 2014 16:40 |