workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
<@Felicita> Don't convert it to a string to do any sort of math, you do that with the datetime/date struct
2017-09-14T12:58:38.000428
Mallie
pythondev_help_Mallie_2017-09-14T12:58:38.000428
1,505,393,918.000428
93,803
pythondev
help
Convert it to string just for presentation
2017-09-14T12:58:44.000507
Mallie
pythondev_help_Mallie_2017-09-14T12:58:44.000507
1,505,393,924.000507
93,804
pythondev
help
timedelta and datetime.strptime(‘Jun 1 2005 1:33PM’, ‘%b %d %Y %I:%M%p’)
2017-09-14T12:58:45.000283
Johana
pythondev_help_Johana_2017-09-14T12:58:45.000283
1,505,393,925.000283
93,805
pythondev
help
i think he’s going from string to datetime obj
2017-09-14T12:59:17.000079
Johana
pythondev_help_Johana_2017-09-14T12:59:17.000079
1,505,393,957.000079
93,806
pythondev
help
Oh woops I had it backwards, you're right
2017-09-14T12:59:27.000398
Mallie
pythondev_help_Mallie_2017-09-14T12:59:27.000398
1,505,393,967.000398
93,807
pythondev
help
i’ve provided some tips. try those out and come back with what you have tried :wink:.
2017-09-14T13:00:08.000218
Johana
pythondev_help_Johana_2017-09-14T13:00:08.000218
1,505,394,008.000218
93,808
pythondev
help
<@Mallie> <@Johana> Yea I needed to convert it to date because I'm getting the date from the front end as strings
2017-09-14T13:00:25.000525
Felicita
pythondev_help_Felicita_2017-09-14T13:00:25.000525
1,505,394,025.000525
93,809
pythondev
help
<@Johana> yup will give it a shot thanks
2017-09-14T13:01:16.000250
Felicita
pythondev_help_Felicita_2017-09-14T13:01:16.000250
1,505,394,076.00025
93,810
pythondev
help
end_date = datetime.strptime(‘Jun 1 2005 1:33PM’, ‘%b %d %Y %I:%M%p’) ^ SyntaxError: invalid character in identifier
2017-09-14T13:02:19.000123
Felicita
pythondev_help_Felicita_2017-09-14T13:02:19.000123
1,505,394,139.000123
93,811
pythondev
help
Are there supposed to be spaces?
2017-09-14T13:02:37.000372
Felicita
pythondev_help_Felicita_2017-09-14T13:02:37.000372
1,505,394,157.000372
93,812
pythondev
help
you may need to adjust your import statement of datetime.
2017-09-14T13:02:50.000396
Johana
pythondev_help_Johana_2017-09-14T13:02:50.000396
1,505,394,170.000396
93,813
pythondev
help
`from datetime import datetime`
2017-09-14T13:03:06.000350
Johana
pythondev_help_Johana_2017-09-14T13:03:06.000350
1,505,394,186.00035
93,814
pythondev
help
something like that
2017-09-14T13:03:09.000399
Johana
pythondev_help_Johana_2017-09-14T13:03:09.000399
1,505,394,189.000399
93,815
pythondev
help
Invalid character in identifier... did you copy and paste that line, perhaps?
2017-09-14T13:03:33.000460
Gabriele
pythondev_help_Gabriele_2017-09-14T13:03:33.000460
1,505,394,213.00046
93,816
pythondev
help
actually you don’t need timedelta either. i have some code here where i compare dates. i’m not formatting from a string but it shows the general idea: <https://github.com/openstax/research-p3-experiment-4/blob/master/digital_logic/experiment/service.py#L298-L311>
2017-09-14T13:04:11.000063
Johana
pythondev_help_Johana_2017-09-14T13:04:11.000063
1,505,394,251.000063
93,817
pythondev
help
yea I imported it <@Johana>
2017-09-14T13:04:15.000579
Felicita
pythondev_help_Felicita_2017-09-14T13:04:15.000579
1,505,394,255.000579
93,818
pythondev
help
<@Gabriele> yea I copied it straight. But then I tried typing it
2017-09-14T13:04:48.000181
Felicita
pythondev_help_Felicita_2017-09-14T13:04:48.000181
1,505,394,288.000181
93,819
pythondev
help
The error just looks like maybe you copied a character that doesn't work in Python, that's all
2017-09-14T13:05:08.000443
Gabriele
pythondev_help_Gabriele_2017-09-14T13:05:08.000443
1,505,394,308.000443
93,820
pythondev
help
yea, i got an error on the quotes.
2017-09-14T13:05:34.000499
Johana
pythondev_help_Johana_2017-09-14T13:05:34.000499
1,505,394,334.000499
93,821
pythondev
help
i’ll adjust it
2017-09-14T13:05:38.000720
Johana
pythondev_help_Johana_2017-09-14T13:05:38.000720
1,505,394,338.00072
93,822
pythondev
help
<@Johana> Are those date types?
2017-09-14T13:05:45.000041
Felicita
pythondev_help_Felicita_2017-09-14T13:05:45.000041
1,505,394,345.000041
93,823
pythondev
help
<@Gabriele> Yea probably, let me try type it manually
2017-09-14T13:06:12.000274
Felicita
pythondev_help_Felicita_2017-09-14T13:06:12.000274
1,505,394,372.000274
93,824
pythondev
help
it’s the quotes for some reason they are jacked up.
2017-09-14T13:06:56.000711
Johana
pythondev_help_Johana_2017-09-14T13:06:56.000711
1,505,394,416.000711
93,825
pythondev
help
just your right it was the quotes just as I finished typing it out too lol <@Johana>
2017-09-14T13:07:52.000121
Felicita
pythondev_help_Felicita_2017-09-14T13:07:52.000121
1,505,394,472.000121
93,826
pythondev
help
and yes those are datetimes.
2017-09-14T13:07:59.000343
Johana
pythondev_help_Johana_2017-09-14T13:07:59.000343
1,505,394,479.000343
93,827
pythondev
help
sqlalchemy takes the datetime field from the database and converts it to a python datetime obj.
2017-09-14T13:08:16.000723
Johana
pythondev_help_Johana_2017-09-14T13:08:16.000723
1,505,394,496.000723
93,828
pythondev
help
the dates actually subtract without any conversions. I just need to convert the result into a readable date now
2017-09-14T13:09:48.000236
Felicita
pythondev_help_Felicita_2017-09-14T13:09:48.000236
1,505,394,588.000236
93,829
pythondev
help
i just discovered groupby from itertools, how can someone know about these functions if they are not usually covered in courses?
2017-09-14T13:52:01.000103
Del
pythondev_help_Del_2017-09-14T13:52:01.000103
1,505,397,121.000103
93,830
pythondev
help
what led you to finding it?
2017-09-14T13:53:00.000429
Frieda
pythondev_help_Frieda_2017-09-14T13:53:00.000429
1,505,397,180.000429
93,831
pythondev
help
there are some books out there that try to cover the standard lib.
2017-09-14T13:54:29.000562
Johana
pythondev_help_Johana_2017-09-14T13:54:29.000562
1,505,397,269.000562
93,832
pythondev
help
i think there is one called standard lib by example or something like that.
2017-09-14T13:54:38.000328
Johana
pythondev_help_Johana_2017-09-14T13:54:38.000328
1,505,397,278.000328
93,833
pythondev
help
reading source code from many projects helps you learn those things too.
2017-09-14T13:55:08.000246
Johana
pythondev_help_Johana_2017-09-14T13:55:08.000246
1,505,397,308.000246
93,834
pythondev
help
the standard lib is _huge_ so it's really hard to cover the whole thing
2017-09-14T13:55:25.000296
Frieda
pythondev_help_Frieda_2017-09-14T13:55:25.000296
1,505,397,325.000296
93,835
pythondev
help
yea that’s why they hit the mostly used ones like collections.
2017-09-14T13:55:41.000178
Johana
pythondev_help_Johana_2017-09-14T13:55:41.000178
1,505,397,341.000178
93,836
pythondev
help
and itertools
2017-09-14T13:55:45.000503
Johana
pythondev_help_Johana_2017-09-14T13:55:45.000503
1,505,397,345.000503
93,837
pythondev
help
<https://www.amazon.com/Python-Standard-Library-Example/dp/0321767349>
2017-09-14T13:56:02.000155
Johana
pythondev_help_Johana_2017-09-14T13:56:02.000155
1,505,397,362.000155
93,838
pythondev
help
found it while doing this - <http://exercism.io/exercises/python/run-length-encoding/readme>
2017-09-14T14:03:33.000347
Del
pythondev_help_Del_2017-09-14T14:03:33.000347
1,505,397,813.000347
93,839
pythondev
help
googled a bit cause i was gonna brute force do for/if and wanted a pythonic way
2017-09-14T14:04:01.000273
Del
pythondev_help_Del_2017-09-14T14:04:01.000273
1,505,397,841.000273
93,840
pythondev
help
ran into a solution and used it, then i read up on it on the official docs
2017-09-14T14:04:17.000683
Del
pythondev_help_Del_2017-09-14T14:04:17.000683
1,505,397,857.000683
93,841
pythondev
help
so its stuff like this that makes me love the language but damn its hard to know all of these things exist already
2017-09-14T14:05:52.000304
Del
pythondev_help_Del_2017-09-14T14:05:52.000304
1,505,397,952.000304
93,842
pythondev
help
so wondering if theres a better way - but im guessing googling the crap out of everything
2017-09-14T14:06:10.000504
Del
pythondev_help_Del_2017-09-14T14:06:10.000504
1,505,397,970.000504
93,843
pythondev
help
most people find these things by needing them, just like you did :slightly_smiling_face:
2017-09-14T14:06:45.000363
Frieda
pythondev_help_Frieda_2017-09-14T14:06:45.000363
1,505,398,005.000363
93,844
pythondev
help
that said, yeah, it'd be good to have content out there about handy tools
2017-09-14T14:07:00.000211
Frieda
pythondev_help_Frieda_2017-09-14T14:07:00.000211
1,505,398,020.000211
93,845
pythondev
help
uhh. chrome full screen. havent used it in a while. doesnt it usually show the tabs when you mouse to the top of the screen?
2017-09-14T14:07:55.000445
Bruno
pythondev_help_Bruno_2017-09-14T14:07:55.000445
1,505,398,075.000445
93,846
pythondev
help
Does anyone has a good series of python tutorial.?
2017-09-15T02:30:38.000259
Arnetta
pythondev_help_Arnetta_2017-09-15T02:30:38.000259
1,505,442,638.000259
93,847
pythondev
help
<@Arnetta> <https://docs.python.org/3/tutorial/>
2017-09-15T02:34:00.000120
Collette
pythondev_help_Collette_2017-09-15T02:34:00.000120
1,505,442,840.00012
93,848
pythondev
help
<@Arnetta> refer documentation , docs. are the best reference and tutorials you can get out in internet . Good luck
2017-09-15T02:53:08.000178
Alfreda
pythondev_help_Alfreda_2017-09-15T02:53:08.000178
1,505,443,988.000178
93,849
pythondev
help
if you are just starting `Automate the boring stuff` is pretty good too
2017-09-15T02:56:24.000095
Ciera
pythondev_help_Ciera_2017-09-15T02:56:24.000095
1,505,444,184.000095
93,850
pythondev
help
thanks <@Collette> <@Alfreda>
2017-09-15T03:03:28.000208
Arnetta
pythondev_help_Arnetta_2017-09-15T03:03:28.000208
1,505,444,608.000208
93,851
pythondev
help
Hello! I'd love some help with a mock.patch issue I am having. I am using Django/DRF to run some integration tests. My test is using the http client to make a request to the DRF API. I use service classes inside my API viewset functions to do the bulk of the logic, e.g. I might have a test method that uses `mock.patch('internalapi.views.users.UserService', autospec=True)` to mock the UserService class used by the API and this works great. What I am unable to do however is mock the `SMSService` that the `UserService` uses internally. I cannot come up with a `mock.patch` target string that mocks that class. I've tried `mock.patch('internalapi.views.users.UserService.SMSService', autospec=True)` but of course `UserService` is a class not a module. I've also tried `mock.patch('internalapi.views.users.UserService.login.SMSService', autospec=True)` to target a class function but that also is not doing it. Is this possible - I want the `UserService` code to run during my test but not the `SMSService`.
2017-09-15T05:31:00.000238
Colene
pythondev_help_Colene_2017-09-15T05:31:00.000238
1,505,453,460.000238
93,852
pythondev
help
OK, so actually I was able to do this with a direct patch to `mock.patch('core.services.user_service.SMSService', autospec=True)`
2017-09-15T05:39:57.000382
Colene
pythondev_help_Colene_2017-09-15T05:39:57.000382
1,505,453,997.000382
93,853
pythondev
help
Hi folks, which youtube session will be good to know abt python for beginner
2017-09-15T07:08:24.000228
Bell
pythondev_help_Bell_2017-09-15T07:08:24.000228
1,505,459,304.000228
93,854
pythondev
help
<@Bell> I would look for Raymond Hettinger's videos on YouTube. It may not be beginner enough, but they are invaluable.
2017-09-15T10:08:14.000442
Meghan
pythondev_help_Meghan_2017-09-15T10:08:14.000442
1,505,470,094.000442
93,855
pythondev
help
<@Bell> SentDex has some beginner videos. He's good at explaining things. The only thing is sometimes he lacks why to do things.
2017-09-15T10:10:08.000551
Meghan
pythondev_help_Meghan_2017-09-15T10:10:08.000551
1,505,470,208.000551
93,856
pythondev
help
<https://github.com/pyslackers/learning-resources/blob/master/topics/essentials.md>
2017-09-15T10:38:33.000160
Johana
pythondev_help_Johana_2017-09-15T10:38:33.000160
1,505,471,913.00016
93,857
pythondev
help
Do you know any way to generate documentation from a django project (From docstring, etc.), standard tools like pydoc don’t work because many things in the code expect to be run from django directly (So it fails with AppRegistryNotReady: Apps aren’t loaded yet.)
2017-09-15T12:10:44.000582
Belva
pythondev_help_Belva_2017-09-15T12:10:44.000582
1,505,477,444.000582
93,858
pythondev
help
Never used it but doesn't Sphinx:<http://www.sphinx-doc.org/en/stable/> do that? Not sure if it relies on pydoc...
2017-09-15T12:34:28.000147
Mallie
pythondev_help_Mallie_2017-09-15T12:34:28.000147
1,505,478,868.000147
93,859
pythondev
help
I mean, it does more, but I think it does that too
2017-09-15T12:34:51.000040
Mallie
pythondev_help_Mallie_2017-09-15T12:34:51.000040
1,505,478,891.00004
93,860
pythondev
help
when you do:
2017-09-15T12:59:19.000498
Winnifred
pythondev_help_Winnifred_2017-09-15T12:59:19.000498
1,505,480,359.000498
93,861
pythondev
help
does the context manager properly close?
2017-09-15T12:59:45.000423
Winnifred
pythondev_help_Winnifred_2017-09-15T12:59:45.000423
1,505,480,385.000423
93,862
pythondev
help
yes
2017-09-15T13:01:37.000296
Mallie
pythondev_help_Mallie_2017-09-15T13:01:37.000296
1,505,480,497.000296
93,863
pythondev
help
thanks, <@Mallie>, so on `return`, `context_manager.__exit__()` is called still ?
2017-09-15T13:03:22.000016
Winnifred
pythondev_help_Winnifred_2017-09-15T13:03:22.000016
1,505,480,602.000016
93,864
pythondev
help
Pretty sure but I'll check for confirmation...
2017-09-15T13:03:59.000054
Mallie
pythondev_help_Mallie_2017-09-15T13:03:59.000054
1,505,480,639.000054
93,865
pythondev
help
<https://www.python.org/dev/peps/pep-0343/>
2017-09-15T13:04:49.000296
Mallie
pythondev_help_Mallie_2017-09-15T13:04:49.000296
1,505,480,689.000296
93,866
pythondev
help
```with locked(myLock): # Code here executes with myLock held. The lock is # guaranteed to be released when the block is left (even # if via return or by an uncaught exception).```
2017-09-15T13:05:05.000262
Mallie
pythondev_help_Mallie_2017-09-15T13:05:05.000262
1,505,480,705.000262
93,867
pythondev
help
<@Mallie> :taco:
2017-09-15T13:05:41.000107
Winnifred
pythondev_help_Winnifred_2017-09-15T13:05:41.000107
1,505,480,741.000107
93,868
pythondev
help
Nice :slightly_smiling_face:
2017-09-15T13:05:46.000208
Winnifred
pythondev_help_Winnifred_2017-09-15T13:05:46.000208
1,505,480,746.000208
93,869
pythondev
help
Ah so read the PEP a little more and this comparison is actually a little more informative to the point even
2017-09-15T13:07:42.000122
Mallie
pythondev_help_Mallie_2017-09-15T13:07:42.000122
1,505,480,862.000122
93,870
pythondev
help
```with EXPR as VAR: BLOCK```
2017-09-15T13:07:52.000560
Mallie
pythondev_help_Mallie_2017-09-15T13:07:52.000560
1,505,480,872.00056
93,871
pythondev
help
is equivalent to
2017-09-15T13:07:56.000511
Mallie
pythondev_help_Mallie_2017-09-15T13:07:56.000511
1,505,480,876.000511
93,872
pythondev
help
```mgr = (EXPR) exit = type(mgr).__exit__ # Not calling it yet value = type(mgr).__enter__(mgr) exc = True try: try: VAR = value # Only if "as VAR" is present BLOCK except: # The exceptional case is handled here exc = False if not exit(mgr, *sys.exc_info()): raise # The exception is swallowed if exit() returns true finally: # The normal and non-local-goto cases are handled here if exc: exit(mgr, None, None, None)```
2017-09-15T13:08:05.000360
Mallie
pythondev_help_Mallie_2017-09-15T13:08:05.000360
1,505,480,885.00036
93,873
pythondev
help
So the cleanup is basically a `finally`
2017-09-15T13:08:16.000583
Mallie
pythondev_help_Mallie_2017-09-15T13:08:16.000583
1,505,480,896.000583
93,874
pythondev
help
This is amazing.
2017-09-15T13:11:08.000529
Winnifred
pythondev_help_Winnifred_2017-09-15T13:11:08.000529
1,505,481,068.000529
93,875
pythondev
help
Hi everyone, any stripe experts in here?
2017-09-15T15:06:25.000327
Huey
pythondev_help_Huey_2017-09-15T15:06:25.000327
1,505,487,985.000327
93,876
pythondev
help
i know a bit
2017-09-15T15:21:06.000256
Orpha
pythondev_help_Orpha_2017-09-15T15:21:06.000256
1,505,488,866.000256
93,877
pythondev
help
whats up?
2017-09-15T15:21:10.000027
Orpha
pythondev_help_Orpha_2017-09-15T15:21:10.000027
1,505,488,870.000027
93,878
pythondev
help
Sorry, just noticed your response, I'm also in the Stripe IRC chat lol
2017-09-15T15:29:28.000185
Huey
pythondev_help_Huey_2017-09-15T15:29:28.000185
1,505,489,368.000185
93,879
pythondev
help
I think I've got it worked out, I'm just trying to figure out how to tie up the loose ends in my payment system. I'm not sure if there are things I should be keeping in my database that I'm not
2017-09-15T15:35:32.000076
Huey
pythondev_help_Huey_2017-09-15T15:35:32.000076
1,505,489,732.000076
93,880
pythondev
help
ah ok
2017-09-15T15:38:21.000034
Orpha
pythondev_help_Orpha_2017-09-15T15:38:21.000034
1,505,489,901.000034
93,881
pythondev
help
yea, that just really depends on how you are using it, the stripe IRC can probably help you a lot more
2017-09-15T15:38:58.000041
Orpha
pythondev_help_Orpha_2017-09-15T15:38:58.000041
1,505,489,938.000041
93,882
pythondev
help
yeah I'm talking to a guy in there right now. He seems to think what I've got now is good enough. I mean, it works, I'm just nervous about releasing it to the wild because, you know, it's peoples' credit cards lol
2017-09-15T15:39:39.000330
Huey
pythondev_help_Huey_2017-09-15T15:39:39.000330
1,505,489,979.00033
93,883
pythondev
help
I'm afraid I'm gonna zig where I should have zagged and accidentally charge all my customers $1000 LOL
2017-09-15T15:39:56.000052
Huey
pythondev_help_Huey_2017-09-15T15:39:56.000052
1,505,489,996.000052
93,884
pythondev
help
yea, you for sure dont want to store credit cards
2017-09-15T15:42:18.000238
Orpha
pythondev_help_Orpha_2017-09-15T15:42:18.000238
1,505,490,138.000238
93,885
pythondev
help
stripe can tokenize payment methods, thats probably what you want to use if you can
2017-09-15T15:42:42.000255
Orpha
pythondev_help_Orpha_2017-09-15T15:42:42.000255
1,505,490,162.000255
93,886
pythondev
help
oh I am, I'm way past that point lol
2017-09-15T15:43:03.000232
Huey
pythondev_help_Huey_2017-09-15T15:43:03.000232
1,505,490,183.000232
93,887
pythondev
help
I'm not worried about releasing credit card info, it's never touching my servers. I'm only concerned I'm not using stripe properly and am going to accidentally double bill someone, provide a refund wrong, or something along those lines
2017-09-15T15:43:47.000032
Huey
pythondev_help_Huey_2017-09-15T15:43:47.000032
1,505,490,227.000032
93,888
pythondev
help
or not handle an error properly and Charge a customer without giving them access to stuff via my database, etc
2017-09-15T15:44:04.000245
Huey
pythondev_help_Huey_2017-09-15T15:44:04.000245
1,505,490,244.000245
93,889
pythondev
help
just trying to consider all the possible ways this could go wrong, haha
2017-09-15T15:44:16.000045
Huey
pythondev_help_Huey_2017-09-15T15:44:16.000045
1,505,490,256.000045
93,890
pythondev
help
ah gotcha, thats more your app code then… just gotta test it over and over and over and make sure you only call things when they need to be called
2017-09-15T15:44:34.000067
Orpha
pythondev_help_Orpha_2017-09-15T15:44:34.000067
1,505,490,274.000067
93,891
pythondev
help
yeah
2017-09-15T15:51:37.000380
Huey
pythondev_help_Huey_2017-09-15T15:51:37.000380
1,505,490,697.00038
93,892
pythondev
help
it's my app code and also my DB design
2017-09-15T15:51:53.000366
Huey
pythondev_help_Huey_2017-09-15T15:51:53.000366
1,505,490,713.000366
93,893
pythondev
help
I just feel like I should be keeping some sort of a history in my database in terms of charges, invoices, etc
2017-09-15T15:52:38.000584
Huey
pythondev_help_Huey_2017-09-15T15:52:38.000584
1,505,490,758.000584
93,894
pythondev
help
currently I'm not, and it works fine, but I feel like there might be a time down the road when this design will shaft me lol
2017-09-15T15:53:00.000354
Huey
pythondev_help_Huey_2017-09-15T15:53:00.000354
1,505,490,780.000354
93,895
pythondev
help
yea, you should keep track of transactions
2017-09-15T15:53:34.000639
Orpha
pythondev_help_Orpha_2017-09-15T15:53:34.000639
1,505,490,814.000639
93,896
pythondev
help
who paid what when
2017-09-15T15:53:45.000028
Orpha
pythondev_help_Orpha_2017-09-15T15:53:45.000028
1,505,490,825.000028
93,897
pythondev
help
or who was paid what when
2017-09-15T15:54:22.000288
Orpha
pythondev_help_Orpha_2017-09-15T15:54:22.000288
1,505,490,862.000288
93,898
pythondev
help
depending on the direction of money flow
2017-09-15T15:54:30.000214
Orpha
pythondev_help_Orpha_2017-09-15T15:54:30.000214
1,505,490,870.000214
93,899
pythondev
help
there are many ways to do that too… basically, it’s a log of what you need or want to track… with any log, the more information you log, the better, because who knows when you need xyz
2017-09-15T15:55:52.000289
Orpha
pythondev_help_Orpha_2017-09-15T15:55:52.000289
1,505,490,952.000289
93,900
pythondev
help
true true!
2017-09-15T15:56:24.000091
Huey
pythondev_help_Huey_2017-09-15T15:56:24.000091
1,505,490,984.000091
93,901
pythondev
help
I mean it's logged within Stripe
2017-09-15T15:56:29.000592
Huey
pythondev_help_Huey_2017-09-15T15:56:29.000592
1,505,490,989.000592
93,902