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
<@Avis> I think understand what you’re saying. A simple solution would be to split the string on the hyphen and take the second element of that result. ``` s = 'logs-2019.01.10' d = s.split('-')[1] ``` A more robust solution would be to use a regular expression
2019-04-17T15:51:19.160500
Patrica
pythondev_help_Patrica_2019-04-17T15:51:19.160500
1,555,516,279.1605
19,121
pythondev
help
regular expressions are heavy
2019-04-17T15:52:11.161100
Monika
pythondev_help_Monika_2019-04-17T15:52:11.161100
1,555,516,331.1611
19,122
pythondev
help
yes that's idea but then i would have the time datetime module read the element the make a decision based on the results
2019-04-17T15:52:39.162100
Avis
pythondev_help_Avis_2019-04-17T15:52:39.162100
1,555,516,359.1621
19,123
pythondev
help
<@Monika> heavy?
2019-04-17T15:55:05.164800
Patrica
pythondev_help_Patrica_2019-04-17T15:55:05.164800
1,555,516,505.1648
19,124
pythondev
help
I think you have all that you need. I would organize your steps, write and test them!
2019-04-17T15:55:06.164900
Gemma
pythondev_help_Gemma_2019-04-17T15:55:06.164900
1,555,516,506.1649
19,125
pythondev
help
<@Gemma> Thanks again I'll give it another go
2019-04-17T15:56:35.165500
Avis
pythondev_help_Avis_2019-04-17T15:56:35.165500
1,555,516,595.1655
19,126
pythondev
help
just add `datetime.strptime(d, '%Y.%m.%d').date()` to the <@Patrica> solution
2019-04-17T16:01:18.166400
Monika
pythondev_help_Monika_2019-04-17T16:01:18.166400
1,555,516,878.1664
19,127
pythondev
help
<@Patrica> Depends of the use case regular expressions may be not the right choice
2019-04-17T16:03:51.168900
Monika
pythondev_help_Monika_2019-04-17T16:03:51.168900
1,555,517,031.1689
19,128
pythondev
help
Presumably, then, one could do `datetime.strptime(s, 'logs-%Y.%m.%d').date()`?
2019-04-17T16:04:24.170400
Mora
pythondev_help_Mora_2019-04-17T16:04:24.170400
1,555,517,064.1704
19,129
pythondev
help
Does anyone know where I can find good resources on working with files containing streaming data? I'm discovering the hard way that using for loops for-example kills any realtime parsing
2019-04-17T16:04:43.170600
Granville
pythondev_help_Granville_2019-04-17T16:04:43.170600
1,555,517,083.1706
19,130
pythondev
help
<@Granville> Have you looked into `asyncio` and the use of the `yield` keyword? Without knowing more about your specific situation it’s hard to say what the right solution would look like. Potentially, <#C7PFU2B2Q|rxpy> might have some good insights.
2019-04-17T16:05:41.171500
Patrica
pythondev_help_Patrica_2019-04-17T16:05:41.171500
1,555,517,141.1715
19,131
pythondev
help
mmm, not yet. I'm stuck on trying to parse a streaming file or essentially either getting the next four lines from a matched line or finding all the lines in the stream file matching a keyword
2019-04-17T16:07:50.173300
Granville
pythondev_help_Granville_2019-04-17T16:07:50.173300
1,555,517,270.1733
19,132
pythondev
help
If you are parsing large volumes of data you may want to consider a 3rd party application such as Apache Kafka or IBM Streams Studio and then call your Python from inside the stream parser. Parsing high volumes of streaming data is difficult to do well.
2019-04-17T16:31:16.175000
Pasquale
pythondev_help_Pasquale_2019-04-17T16:31:16.175000
1,555,518,676.175
19,133
pythondev
help
By streaming data/file, do you mean a file containing data from e.g. a video stream a'la Twitch, or are you meaning a realtime appended file, a'la a logfile?
2019-04-17T16:48:14.176100
Carmen
pythondev_help_Carmen_2019-04-17T16:48:14.176100
1,555,519,694.1761
19,134
pythondev
help
I'm assuming the latter, in which case you honestly need to be using infinite loops to regularly pull data from the end of the file and apply your parsing to that.
2019-04-17T16:49:36.177100
Carmen
pythondev_help_Carmen_2019-04-17T16:49:36.177100
1,555,519,776.1771
19,135
pythondev
help
And of course, depending on the processing that needs to be done vs the amount of data being added to the file, you might need to apply some parallel processing and task queues to the mix to get your results done in real-time.
2019-04-17T16:50:43.178300
Carmen
pythondev_help_Carmen_2019-04-17T16:50:43.178300
1,555,519,843.1783
19,136
pythondev
help
Looks like <@Granville> has some googling to do to narrow down the scope of his question!
2019-04-17T16:58:43.179300
Gemma
pythondev_help_Gemma_2019-04-17T16:58:43.179300
1,555,520,323.1793
19,137
pythondev
help
It's something like this: <https://stackoverflow.com/questions/5832856/how-to-read-file-n-lines-at-a-time-in-python>
2019-04-17T17:05:38.179500
Granville
pythondev_help_Granville_2019-04-17T17:05:38.179500
1,555,520,738.1795
19,138
pythondev
help
It's parsing a simple log file that never has an EOF because information is constantly being written to it
2019-04-17T17:06:17.180100
Granville
pythondev_help_Granville_2019-04-17T17:06:17.180100
1,555,520,777.1801
19,139
pythondev
help
<@Carmen> yep, that would be more like it. I don't see anything on Real Python for this kind of stuff
2019-04-17T17:07:21.180800
Granville
pythondev_help_Granville_2019-04-17T17:07:21.180800
1,555,520,841.1808
19,140
pythondev
help
<https://stackoverflow.com/questions/5419888/reading-from-a-frequently-updated-file>
2019-04-17T17:12:35.181000
Carmen
pythondev_help_Carmen_2019-04-17T17:12:35.181000
1,555,521,155.181
19,141
pythondev
help
Hello Every body, I'm new in Python Developing.. Any Advises for the new guy?
2019-04-17T22:03:04.184000
Brigida
pythondev_help_Brigida_2019-04-17T22:03:04.184000
1,555,538,584.184
19,142
pythondev
help
thank
2019-04-17T22:03:25.184100
Brigida
pythondev_help_Brigida_2019-04-17T22:03:25.184100
1,555,538,605.1841
19,143
pythondev
help
1. Enjoy
2019-04-17T22:58:35.184500
Conchita
pythondev_help_Conchita_2019-04-17T22:58:35.184500
1,555,541,915.1845
19,144
pythondev
help
2. Don't give up
2019-04-17T22:58:43.184800
Conchita
pythondev_help_Conchita_2019-04-17T22:58:43.184800
1,555,541,923.1848
19,145
pythondev
help
3. Make cool stuff
2019-04-17T22:58:46.185000
Conchita
pythondev_help_Conchita_2019-04-17T22:58:46.185000
1,555,541,926.185
19,146
pythondev
help
I think thats about it!
2019-04-17T22:58:53.185200
Conchita
pythondev_help_Conchita_2019-04-17T22:58:53.185200
1,555,541,933.1852
19,147
pythondev
help
Which channel is appropriate for pyQt discussion?
2019-04-17T23:02:09.185900
Pasquale
pythondev_help_Pasquale_2019-04-17T23:02:09.185900
1,555,542,129.1859
19,148
pythondev
help
<@Lourdes> If the definition of "big" is not too crazy you can open a file and slurp it into a list/array and then iterate of that data structure.
2019-04-17T23:05:12.187600
Pasquale
pythondev_help_Pasquale_2019-04-17T23:05:12.187600
1,555,542,312.1876
19,149
pythondev
help
Struggling a bit with grasping how to work with webhooks. Any good way to build dummy webhooks locally, using POST, then GET?
2019-04-17T23:21:36.189100
Conchita
pythondev_help_Conchita_2019-04-17T23:21:36.189100
1,555,543,296.1891
19,150
pythondev
help
most useful recommend
2019-04-17T23:22:29.189400
Cinda
pythondev_help_Cinda_2019-04-17T23:22:29.189400
1,555,543,349.1894
19,151
pythondev
help
<@Conchita> Are you using a framework (i.e. thorn or PyWebHooks)? There is a site you can use to test your webhooks which works well. Let me check my bookmarks...
2019-04-17T23:32:06.191300
Pasquale
pythondev_help_Pasquale_2019-04-17T23:32:06.191300
1,555,543,926.1913
19,152
pythondev
help
<https://webhook.site>
2019-04-17T23:32:53.191600
Pasquale
pythondev_help_Pasquale_2019-04-17T23:32:53.191600
1,555,543,973.1916
19,153
pythondev
help
The site will create a unique URL to which you can POST and see if your payload posts correctly.
2019-04-17T23:33:59.192800
Pasquale
pythondev_help_Pasquale_2019-04-17T23:33:59.192800
1,555,544,039.1928
19,154
pythondev
help
Oh so coooool
2019-04-17T23:34:06.193000
Conchita
pythondev_help_Conchita_2019-04-17T23:34:06.193000
1,555,544,046.193
19,155
pythondev
help
Yeah, it saved my life a few times - and not just with Python.
2019-04-17T23:34:21.193600
Pasquale
pythondev_help_Pasquale_2019-04-17T23:34:21.193600
1,555,544,061.1936
19,156
pythondev
help
Let me know if it helps.
2019-04-17T23:34:45.194300
Pasquale
pythondev_help_Pasquale_2019-04-17T23:34:45.194300
1,555,544,085.1943
19,157
pythondev
help
This deserves a :taco: Thanks <@Pasquale>
2019-04-17T23:34:53.194500
Conchita
pythondev_help_Conchita_2019-04-17T23:34:53.194500
1,555,544,093.1945
19,158
pythondev
help
<@Conchita> YW!
2019-04-17T23:35:54.194900
Pasquale
pythondev_help_Pasquale_2019-04-17T23:35:54.194900
1,555,544,154.1949
19,159
pythondev
help
What I'm trying to figure out now is how read a parameter which I pass to <http://webhook.site/> like ` <http://webhook.site/?source=pluto>`
2019-04-17T23:39:43.195000
Conchita
pythondev_help_Conchita_2019-04-17T23:39:43.195000
1,555,544,383.195
19,160
pythondev
help
How can I get `pluto` when handling the request? do you know?
2019-04-17T23:40:17.195500
Conchita
pythondev_help_Conchita_2019-04-17T23:40:17.195500
1,555,544,417.1955
19,161
pythondev
help
<http://webhook.site|webhook.site> is cool! But can't see it has this option
2019-04-17T23:41:44.195700
Conchita
pythondev_help_Conchita_2019-04-17T23:41:44.195700
1,555,544,504.1957
19,162
pythondev
help
Hey guys, what am I doing wrong here?
2019-04-18T00:40:11.196900
Kam
pythondev_help_Kam_2019-04-18T00:40:11.196900
1,555,548,011.1969
19,163
pythondev
help
<https://gist.github.com/danamer/be6c88313d8d4e0f8e72e3e23598ffa0>
2019-04-18T00:40:19.197100
Kam
pythondev_help_Kam_2019-04-18T00:40:19.197100
1,555,548,019.1971
19,164
pythondev
help
what are you trying to achieve, and what exactly is the error?
2019-04-18T00:41:35.197500
Mildred
pythondev_help_Mildred_2019-04-18T00:41:35.197500
1,555,548,095.1975
19,165
pythondev
help
it prints nothing in second case.
2019-04-18T00:42:09.197800
Kam
pythondev_help_Kam_2019-04-18T00:42:09.197800
1,555,548,129.1978
19,166
pythondev
help
i want to be able to assign those return values in other function.
2019-04-18T00:42:48.198500
Kam
pythondev_help_Kam_2019-04-18T00:42:48.198500
1,555,548,168.1985
19,167
pythondev
help
no errors in second case but no result on stdout.
2019-04-18T00:43:28.199200
Kam
pythondev_help_Kam_2019-04-18T00:43:28.199200
1,555,548,208.1992
19,168
pythondev
help
when i return and don't do print explicitly from within the function.
2019-04-18T00:44:08.200000
Kam
pythondev_help_Kam_2019-04-18T00:44:08.200000
1,555,548,248.2
19,169
pythondev
help
sorry, not ignoring, looking into it. Not something ive come up against, and not something im incredibly familiar with, but i will try anyway
2019-04-18T00:52:11.200800
Mildred
pythondev_help_Mildred_2019-04-18T00:52:11.200800
1,555,548,731.2008
19,170
pythondev
help
It's no problem.
2019-04-18T00:53:25.201000
Kam
pythondev_help_Kam_2019-04-18T00:53:25.201000
1,555,548,805.201
19,171
pythondev
help
it's something i don't understand, maybe it's an issue with decorator
2019-04-18T00:53:53.201400
Kam
pythondev_help_Kam_2019-04-18T00:53:53.201400
1,555,548,833.2014
19,172
pythondev
help
printing from inside the main is fine. I would suggest its more about the fact that you are trying to print the main() function.
2019-04-18T00:58:31.202100
Mildred
pythondev_help_Mildred_2019-04-18T00:58:31.202100
1,555,549,111.2021
19,173
pythondev
help
well i mean even if I do an assignment like `result=main() print(result)`
2019-04-18T00:59:51.203200
Kam
pythondev_help_Kam_2019-04-18T00:59:51.203200
1,555,549,191.2032
19,174
pythondev
help
that doesn't work either.
2019-04-18T01:00:00.203500
Kam
pythondev_help_Kam_2019-04-18T01:00:00.203500
1,555,549,200.2035
19,175
pythondev
help
shouldn't it assign returned values from main function to `result`?
2019-04-18T01:00:29.204500
Kam
pythondev_help_Kam_2019-04-18T01:00:29.204500
1,555,549,229.2045
19,176
pythondev
help
It looks like there are some code paths where invoking `main()` could lead to an error case where Click just calls `sys.exit()`. So it may be aborting the program instead of just not printing anything. Could you try to disambiguate that case by printing something before and after the `print(main())` call?
2019-04-18T01:01:24.205900
Sasha
pythondev_help_Sasha_2019-04-18T01:01:24.205900
1,555,549,284.2059
19,177
pythondev
help
$? is 0 though
2019-04-18T01:02:16.206200
Kam
pythondev_help_Kam_2019-04-18T01:02:16.206200
1,555,549,336.2062
19,178
pythondev
help
I can.
2019-04-18T01:02:23.206400
Kam
pythondev_help_Kam_2019-04-18T01:02:23.206400
1,555,549,343.2064
19,179
pythondev
help
That's probably not it, then, if you get a good exit code.
2019-04-18T01:02:51.207200
Sasha
pythondev_help_Sasha_2019-04-18T01:02:51.207200
1,555,549,371.2072
19,180
pythondev
help
<@Sasha> i think its the way its returning the values, even by commiting main() to a variable, theres nothing there
2019-04-18T01:03:17.208100
Mildred
pythondev_help_Mildred_2019-04-18T01:03:17.208100
1,555,549,397.2081
19,181
pythondev
help
i can print them inside the main, i just cant get them out
2019-04-18T01:03:36.208600
Mildred
pythondev_help_Mildred_2019-04-18T01:03:36.208600
1,555,549,416.2086
19,182
pythondev
help
(As an aside, Click is weird. I've seen it come up in these channels before and the behavior is always odd in convoluted ways...)
2019-04-18T01:03:39.208900
Sasha
pythondev_help_Sasha_2019-04-18T01:03:39.208900
1,555,549,419.2089
19,183
pythondev
help
ok so I am trying this
2019-04-18T01:03:53.209200
Kam
pythondev_help_Kam_2019-04-18T01:03:53.209200
1,555,549,433.2092
19,184
pythondev
help
```if __name__ == '__main__': print('test 1') l=main() print(l) print('test 2')```
2019-04-18T01:03:57.209400
Kam
pythondev_help_Kam_2019-04-18T01:03:57.209400
1,555,549,437.2094
19,185
pythondev
help
test 2 doesnt print does it
2019-04-18T01:04:32.209700
Mildred
pythondev_help_Mildred_2019-04-18T01:04:32.209700
1,555,549,472.2097
19,186
pythondev
help
only 'test 1' got printed.
2019-04-18T01:04:49.210200
Kam
pythondev_help_Kam_2019-04-18T01:04:49.210200
1,555,549,489.2102
19,187
pythondev
help
yeah.
2019-04-18T01:04:55.210400
Kam
pythondev_help_Kam_2019-04-18T01:04:55.210400
1,555,549,495.2104
19,188
pythondev
help
def main(date, instrument): print("inside main: ",date, instrument) return date, instrument if __name__ == '__main__': print("test") items = main() print(items) print("test2")
2019-04-18T01:05:03.210800
Mildred
pythondev_help_Mildred_2019-04-18T01:05:03.210800
1,555,549,503.2108
19,189
pythondev
help
i get the inside and test 1 to print
2019-04-18T01:05:10.211100
Mildred
pythondev_help_Mildred_2019-04-18T01:05:10.211100
1,555,549,510.2111
19,190
pythondev
help
The thing is i could do all my logic in one function, i just wanted to nest the logic to different functions
2019-04-18T01:05:23.211500
Kam
pythondev_help_Kam_2019-04-18T01:05:23.211500
1,555,549,523.2115
19,191
pythondev
help
But since I can't use return values it makes it impossible.
2019-04-18T01:05:40.211900
Kam
pythondev_help_Kam_2019-04-18T01:05:40.211900
1,555,549,540.2119
19,192
pythondev
help
yeah, same here.
2019-04-18T01:06:02.212100
Kam
pythondev_help_Kam_2019-04-18T01:06:02.212100
1,555,549,562.2121
19,193
pythondev
help
I can just use argparse, it's fine. I've spent too much time already.
2019-04-18T01:06:34.212700
Kam
pythondev_help_Kam_2019-04-18T01:06:34.212700
1,555,549,594.2127
19,194
pythondev
help
Don't think it's worth it. But there are numerous people using click library.
2019-04-18T01:07:02.213400
Kam
pythondev_help_Kam_2019-04-18T01:07:02.213400
1,555,549,622.2134
19,195
pythondev
help
It would of been noticed by now.
2019-04-18T01:07:16.213800
Kam
pythondev_help_Kam_2019-04-18T01:07:16.213800
1,555,549,636.2138
19,196
pythondev
help
and if i change the name from main to any other name i get same result as well.
2019-04-18T01:07:44.214400
Kam
pythondev_help_Kam_2019-04-18T01:07:44.214400
1,555,549,664.2144
19,197
pythondev
help
<@Sasha> <@Mildred> i just straced and it seem that @click.command() decorator makes a function as a command
2019-04-18T01:31:42.215800
Kam
pythondev_help_Kam_2019-04-18T01:31:42.215800
1,555,551,102.2158
19,198
pythondev
help
so i see after `test 1` rt_sigaction(SIGINT being called by click
2019-04-18T01:32:15.216300
Kam
pythondev_help_Kam_2019-04-18T01:32:15.216300
1,555,551,135.2163
19,199
pythondev
help
which makes sense since click is trying to make the function into a good command-line citizen, so when it exit the function, it calls sys.exit() with the appropriate exit number
2019-04-18T01:33:21.217100
Kam
pythondev_help_Kam_2019-04-18T01:33:21.217100
1,555,551,201.2171
19,200
pythondev
help
just FYI
2019-04-18T01:33:26.217300
Kam
pythondev_help_Kam_2019-04-18T01:33:26.217300
1,555,551,206.2173
19,201
pythondev
help
Thank you for help.
2019-04-18T01:33:34.217600
Kam
pythondev_help_Kam_2019-04-18T01:33:34.217600
1,555,551,214.2176
19,202
pythondev
help
Ah, thank you for unraveling that.
2019-04-18T01:34:23.217900
Sasha
pythondev_help_Sasha_2019-04-18T01:34:23.217900
1,555,551,263.2179
19,203
pythondev
help
Do we have an official paste or anything to share larger amounts of code? How do you all prefer we go about this?
2019-04-18T02:22:00.219400
Terrilyn
pythondev_help_Terrilyn_2019-04-18T02:22:00.219400
1,555,554,120.2194
19,204
pythondev
help
I think using the Slack code dump is the prefered method
2019-04-18T02:28:53.219900
Conchita
pythondev_help_Conchita_2019-04-18T02:28:53.219900
1,555,554,533.2199
19,205
pythondev
help
Hello, so I'm trying to add dynamic actions to my djando admin, based on another model values. While this code snippet works exactly like I need, it does 3 duplicate queries to db which's my problem. I believe there's method how to retrieve "Pages" model values, without duplicate querying DB, from admin queryset, but have no idea how to approach this. Maybe anyone could point me to right direction?
2019-04-18T03:49:36.220900
Faustina
pythondev_help_Faustina_2019-04-18T03:49:36.220900
1,555,559,376.2209
19,206
pythondev
help
<@Terrilyn> How about <https://gist.github.com/>?
2019-04-18T04:41:06.221800
Valeri
pythondev_help_Valeri_2019-04-18T04:41:06.221800
1,555,562,466.2218
19,207
pythondev
help
Or <https://codepen.io/>
2019-04-18T04:41:40.222000
Valeri
pythondev_help_Valeri_2019-04-18T04:41:40.222000
1,555,562,500.222
19,208
pythondev
help
<@Faustina> what are the three queries that are duplicates? Also, I believe you can get more help from <#C0LMFRMB5|django>
2019-04-18T04:44:50.222500
Cindy
pythondev_help_Cindy_2019-04-18T04:44:50.222500
1,555,562,690.2225
19,209
pythondev
help
there's also <http://repl.it>
2019-04-18T04:45:01.222700
Mica
pythondev_help_Mica_2019-04-18T04:45:01.222700
1,555,562,701.2227
19,210
pythondev
help
<@Cindy> it duplicates this query 3 times, I tried to prefetch related models, tried to save queryset to list, to cache it, but that didn't helped.
2019-04-18T04:56:27.223300
Faustina
pythondev_help_Faustina_2019-04-18T04:56:27.223300
1,555,563,387.2233
19,211
pythondev
help
I think, but might be wrong, this is what's going on: Query 1: `for pages in Pages.objects.all().order_by('created'):` Query 2: `pages_model.language` Query 3: `pages_model.id` Maybe passing `pages.language` and `pages.id` in function will reduce queries.
2019-04-18T05:08:09.226700
Russ
pythondev_help_Russ_2019-04-18T05:08:09.226700
1,555,564,089.2267
19,212
pythondev
help
nop
2019-04-18T05:11:22.227300
Faustina
pythondev_help_Faustina_2019-04-18T05:11:22.227300
1,555,564,282.2273
19,213
pythondev
help
problem is in pages.language supposedly since it's a foreign key. Did select_related not work for you ?
2019-04-18T05:11:44.227800
Cindy
pythondev_help_Cindy_2019-04-18T05:11:44.227800
1,555,564,304.2278
19,214
pythondev
help
tried select_related, on Pages.object
2019-04-18T05:12:07.228500
Faustina
pythondev_help_Faustina_2019-04-18T05:12:07.228500
1,555,564,327.2285
19,215
pythondev
help
but that didn't helped
2019-04-18T05:12:10.228700
Faustina
pythondev_help_Faustina_2019-04-18T05:12:10.228700
1,555,564,330.2287
19,216
pythondev
help
Pages.objects.select_related('language').all().order_by('created')
2019-04-18T05:12:11.228900
Cindy
pythondev_help_Cindy_2019-04-18T05:12:11.228900
1,555,564,331.2289
19,217
pythondev
help
None of that works, already tried, tried to put object into list to cache it and use without querying db
2019-04-18T05:15:22.229700
Faustina
pythondev_help_Faustina_2019-04-18T05:15:22.229700
1,555,564,522.2297
19,218
pythondev
help
Then I'd put a debugger and log queries to console, then make request and see when exactly it hits db
2019-04-18T05:18:57.231100
Russ
pythondev_help_Russ_2019-04-18T05:18:57.231100
1,555,564,737.2311
19,219
pythondev
help
so looks like I had to move Pages.object out of get_actions() method, put it in list, and then duplicate queries is gone, weird
2019-04-18T05:23:32.231900
Faustina
pythondev_help_Faustina_2019-04-18T05:23:32.231900
1,555,565,012.2319
19,220