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
it’s basically the same as a function that is like this: ``` def any(iter): for item in iter: if item: return True return False ```
2017-12-26T07:26:14.000042
Junita
pythondev_help_Junita_2017-12-26T07:26:14.000042
1,514,273,174.000042
105,803
pythondev
help
It would be nice if you can explain me the output of above code
2017-12-26T07:27:13.000014
Bette
pythondev_help_Bette_2017-12-26T07:27:13.000014
1,514,273,233.000014
105,804
pythondev
help
the reason is python has a concept of “truthiness” - essentially values like 0, None and False all are roughly equivalent in boolean comparison
2017-12-26T07:27:31.000026
Junita
pythondev_help_Junita_2017-12-26T07:27:31.000026
1,514,273,251.000026
105,805
pythondev
help
Like how it was true or false
2017-12-26T07:27:31.000135
Bette
pythondev_help_Bette_2017-12-26T07:27:31.000135
1,514,273,251.000135
105,806
pythondev
help
and non-zero integers, non-empty strings, etc. and of course True are all True
2017-12-26T07:28:01.000009
Junita
pythondev_help_Junita_2017-12-26T07:28:01.000009
1,514,273,281.000009
105,807
pythondev
help
But in case 1 and 3 0 is there and still return true ?
2017-12-26T07:29:41.000052
Bette
pythondev_help_Bette_2017-12-26T07:29:41.000052
1,514,273,381.000052
105,808
pythondev
help
Because we need atleast one true ?
2017-12-26T07:29:54.000014
Bette
pythondev_help_Bette_2017-12-26T07:29:54.000014
1,514,273,394.000014
105,809
pythondev
help
Am I right ?
2017-12-26T07:29:58.000029
Bette
pythondev_help_Bette_2017-12-26T07:29:58.000029
1,514,273,398.000029
105,810
pythondev
help
exactly
2017-12-26T07:29:58.000076
Junita
pythondev_help_Junita_2017-12-26T07:29:58.000076
1,514,273,398.000076
105,811
pythondev
help
if *any* value is true, then it returns true
2017-12-26T07:30:11.000150
Junita
pythondev_help_Junita_2017-12-26T07:30:11.000150
1,514,273,411.00015
105,812
pythondev
help
Got it mate :grin:
2017-12-26T07:30:23.000066
Bette
pythondev_help_Bette_2017-12-26T07:30:23.000066
1,514,273,423.000066
105,813
pythondev
help
Thanks for explaining
2017-12-26T07:30:30.000144
Bette
pythondev_help_Bette_2017-12-26T07:30:30.000144
1,514,273,430.000144
105,814
pythondev
help
No problem
2017-12-26T07:30:34.000074
Junita
pythondev_help_Junita_2017-12-26T07:30:34.000074
1,514,273,434.000074
105,815
pythondev
help
at least for me, it’s not something I use often, except when writing tests
2017-12-26T07:30:44.000177
Junita
pythondev_help_Junita_2017-12-26T07:30:44.000177
1,514,273,444.000177
105,816
pythondev
help
Hehe I have been learning Python so making notes of these methods with examples:wink:
2017-12-26T07:36:49.000030
Bette
pythondev_help_Bette_2017-12-26T07:36:49.000030
1,514,273,809.00003
105,817
pythondev
help
that’s always a good idea. are you by chance going through the list here? <https://docs.python.org/3/library/functions.html>
2017-12-26T07:38:32.000034
Junita
pythondev_help_Junita_2017-12-26T07:38:32.000034
1,514,273,912.000034
105,818
pythondev
help
No mate
2017-12-26T07:52:19.000175
Bette
pythondev_help_Bette_2017-12-26T07:52:19.000175
1,514,274,739.000175
105,819
pythondev
help
There is a site called <http://programiz.com|programiz.com> which is containing all most all methods for string tuple set dictionary list in a plain and simple manner
2017-12-26T07:53:20.000040
Bette
pythondev_help_Bette_2017-12-26T07:53:20.000040
1,514,274,800.00004
105,820
pythondev
help
How would I write a unit test for this decorator function? ```def validate_response(json_key, expected_value): def decorator(func): @wraps(func) def wrapper(*args, **kwargs): data = json.loads(request.form['payload'])[json_key] if data is not expected_value: r...
2017-12-26T10:10:50.000005
Glinda
pythondev_help_Glinda_2017-12-26T10:10:50.000005
1,514,283,050.000005
105,821
pythondev
help
I'd have to mock both `redirect` and `json.loads`
2017-12-26T10:12:14.000090
Glinda
pythondev_help_Glinda_2017-12-26T10:12:14.000090
1,514,283,134.00009
105,822
pythondev
help
Why mock redirect?
2017-12-26T10:15:53.000127
Suellen
pythondev_help_Suellen_2017-12-26T10:15:53.000127
1,514,283,353.000127
105,823
pythondev
help
You could check a return value, which is probably a response object with a correct status code and `location`
2017-12-26T10:16:13.000189
Suellen
pythondev_help_Suellen_2017-12-26T10:16:13.000189
1,514,283,373.000189
105,824
pythondev
help
hey guys! wondering if someone could help me out with performing a regex replace
2017-12-26T10:35:47.000261
Glenda
pythondev_help_Glenda_2017-12-26T10:35:47.000261
1,514,284,547.000261
105,825
pythondev
help
I am trying to do a case insensitive search and insert &lt;b&gt; html tag before and &lt;/b&gt; html tag after every match
2017-12-26T10:36:22.000002
Glenda
pythondev_help_Glenda_2017-12-26T10:36:22.000002
1,514,284,582.000002
105,826
pythondev
help
right now I have code which does that but the problem is it replaces the actual word with the case of the search word instead of keeping the case in each scenario
2017-12-26T10:37:18.000197
Glenda
pythondev_help_Glenda_2017-12-26T10:37:18.000197
1,514,284,638.000197
105,827
pythondev
help
content = "Test tEst TEsT" pattern = re.compile("test", re.IGNORECASE) content = pattern.sub("&lt;b&gt;{0}&lt;/b&gt;".format(word), content) #returns "&lt;b&gt;test&lt;/b&gt; &lt;b&gt;test&lt;/b&gt; &lt;b&gt;test&lt;/b&gt;" #want "&lt;b&gt;Test&lt;/b&gt; &lt;b&gt;tEst&lt;/b&gt; &lt;b&gt;TEsT&lt;/b&gt;"
2017-12-26T10:39:10.000084
Glenda
pythondev_help_Glenda_2017-12-26T10:39:10.000084
1,514,284,750.000084
105,828
pythondev
help
<https://regexr.com/>
2017-12-26T10:40:49.000013
Glinda
pythondev_help_Glinda_2017-12-26T10:40:49.000013
1,514,284,849.000013
105,829
pythondev
help
Have you used this before?
2017-12-26T10:40:52.000108
Glinda
pythondev_help_Glinda_2017-12-26T10:40:52.000108
1,514,284,852.000108
105,830
pythondev
help
Actually this one is better
2017-12-26T10:41:09.000054
Glinda
pythondev_help_Glinda_2017-12-26T10:41:09.000054
1,514,284,869.000054
105,831
pythondev
help
<https://regex101.com/>
2017-12-26T10:41:10.000079
Glinda
pythondev_help_Glinda_2017-12-26T10:41:10.000079
1,514,284,870.000079
105,832
pythondev
help
hahaha yes i've gotten a lot of use out of those regex builders :slightly_smiling_face:
2017-12-26T10:41:27.000181
Glenda
pythondev_help_Glenda_2017-12-26T10:41:27.000181
1,514,284,887.000181
105,833
pythondev
help
So your problem
2017-12-26T10:41:50.000047
Glinda
pythondev_help_Glinda_2017-12-26T10:41:50.000047
1,514,284,910.000047
105,834
pythondev
help
there's a cerrtain word you want that is case insensitive
2017-12-26T10:41:59.000235
Glinda
pythondev_help_Glinda_2017-12-26T10:41:59.000235
1,514,284,919.000235
105,835
pythondev
help
if you find such pattern `.....{pattern}...`
2017-12-26T10:42:24.000147
Glinda
pythondev_help_Glinda_2017-12-26T10:42:24.000147
1,514,284,944.000147
105,836
pythondev
help
you want to replace with
2017-12-26T10:42:27.000240
Glinda
pythondev_help_Glinda_2017-12-26T10:42:27.000240
1,514,284,947.00024
105,837
pythondev
help
`.....&lt;b&gt;{pattern}&lt;/b&gt;...`
2017-12-26T10:42:39.000199
Glinda
pythondev_help_Glinda_2017-12-26T10:42:39.000199
1,514,284,959.000199
105,838
pythondev
help
right
2017-12-26T10:42:57.000134
Glenda
pythondev_help_Glenda_2017-12-26T10:42:57.000134
1,514,284,977.000134
105,839
pythondev
help
but I don't want to replace {pattern}
2017-12-26T10:43:08.000041
Glenda
pythondev_help_Glenda_2017-12-26T10:43:08.000041
1,514,284,988.000041
105,840
pythondev
help
which is what my code does right now
2017-12-26T10:43:16.000004
Glenda
pythondev_help_Glenda_2017-12-26T10:43:16.000004
1,514,284,996.000004
105,841
pythondev
help
regex is fine
2017-12-26T10:43:29.000058
Glinda
pythondev_help_Glinda_2017-12-26T10:43:29.000058
1,514,285,009.000058
105,842
pythondev
help
if you want an easy way
2017-12-26T10:43:49.000077
Glinda
pythondev_help_Glinda_2017-12-26T10:43:49.000077
1,514,285,029.000077
105,843
pythondev
help
```def string_match(input, compare): lower_case = input.lower() compare_lower = compare.lower()```
2017-12-26T10:45:06.000220
Glinda
pythondev_help_Glinda_2017-12-26T10:45:06.000220
1,514,285,106.00022
105,844
pythondev
help
First conver to lowercase for both
2017-12-26T10:45:13.000087
Glinda
pythondev_help_Glinda_2017-12-26T10:45:13.000087
1,514,285,113.000087
105,845
pythondev
help
Then use string methods to find all matches.
2017-12-26T10:45:46.000115
Glinda
pythondev_help_Glinda_2017-12-26T10:45:46.000115
1,514,285,146.000115
105,846
pythondev
help
Use the found location indices
2017-12-26T10:46:19.000023
Glinda
pythondev_help_Glinda_2017-12-26T10:46:19.000023
1,514,285,179.000023
105,847
pythondev
help
right I was thinking that...
2017-12-26T10:46:29.000120
Glenda
pythondev_help_Glenda_2017-12-26T10:46:29.000120
1,514,285,189.00012
105,848
pythondev
help
would regex be cleaner though?
2017-12-26T10:46:39.000112
Glenda
pythondev_help_Glenda_2017-12-26T10:46:39.000112
1,514,285,199.000112
105,849
pythondev
help
Now you might ask, well isn't it slow to remake a string?
2017-12-26T10:46:40.000190
Glinda
pythondev_help_Glinda_2017-12-26T10:46:40.000190
1,514,285,200.00019
105,850
pythondev
help
It really depends
2017-12-26T10:47:00.000252
Glinda
pythondev_help_Glinda_2017-12-26T10:47:00.000252
1,514,285,220.000252
105,851
pythondev
help
So if you know of that solution. Let's work on the regex one.
2017-12-26T10:47:46.000227
Glinda
pythondev_help_Glinda_2017-12-26T10:47:46.000227
1,514,285,266.000227
105,852
pythondev
help
```content = "Test tEst TEsT" pattern = re.compile("test", re.IGNORECASE) content = pattern.sub("&lt;b&gt;{0}&lt;/b&gt;".format(word), content) #returns "&lt;b&gt;test&lt;/b&gt; &lt;b&gt;test&lt;/b&gt; &lt;b&gt;test&lt;/b&gt;" #want "&lt;b&gt;Test&lt;/b&gt; &lt;b&gt;tEst&lt;/b&gt; &lt;b&gt;TEsT&lt;/b&gt;"```
2017-12-26T10:48:22.000228
Glinda
pythondev_help_Glinda_2017-12-26T10:48:22.000228
1,514,285,302.000228
105,853
pythondev
help
You should probably use
2017-12-26T10:49:12.000021
Glinda
pythondev_help_Glinda_2017-12-26T10:49:12.000021
1,514,285,352.000021
105,854
pythondev
help
groups instead of string formatting
2017-12-26T10:49:18.000167
Glinda
pythondev_help_Glinda_2017-12-26T10:49:18.000167
1,514,285,358.000167
105,855
pythondev
help
```method = 'images/:id/huge' re.sub(r'(:[a-z]+)', r'&lt;span&gt;\1&lt;/span&gt;', method) 'images/&lt;span&gt;:id&lt;/span&gt;/huge'```
2017-12-26T10:49:58.000180
Glinda
pythondev_help_Glinda_2017-12-26T10:49:58.000180
1,514,285,398.00018
105,856
pythondev
help
ahhhh
2017-12-26T10:50:42.000035
Glenda
pythondev_help_Glenda_2017-12-26T10:50:42.000035
1,514,285,442.000035
105,857
pythondev
help
yes that's what I am looking for :slightly_smiling_face:
2017-12-26T10:50:53.000132
Glenda
pythondev_help_Glenda_2017-12-26T10:50:53.000132
1,514,285,453.000132
105,858
pythondev
help
btw
2017-12-26T10:51:16.000036
Glinda
pythondev_help_Glinda_2017-12-26T10:51:16.000036
1,514,285,476.000036
105,859
pythondev
help
I recently found out about python named group regex matching
2017-12-26T10:51:29.000085
Glinda
pythondev_help_Glinda_2017-12-26T10:51:29.000085
1,514,285,489.000085
105,860
pythondev
help
and it's amazing.
2017-12-26T10:51:32.000017
Glinda
pythondev_help_Glinda_2017-12-26T10:51:32.000017
1,514,285,492.000017
105,861
pythondev
help
```'(?P&lt;name&gt;.*) (?P&lt;phone&gt;.*)'```
2017-12-26T10:52:07.000088
Glinda
pythondev_help_Glinda_2017-12-26T10:52:07.000088
1,514,285,527.000088
105,862
pythondev
help
<https://regex101.com/r/xfWIfL/1>
2017-12-26T10:55:46.000064
Glinda
pythondev_help_Glinda_2017-12-26T10:55:46.000064
1,514,285,746.000064
105,863
pythondev
help
I used both flags `/ig` for ingore case and global.
2017-12-26T10:56:19.000235
Glinda
pythondev_help_Glinda_2017-12-26T10:56:19.000235
1,514,285,779.000235
105,864
pythondev
help
hmm
2017-12-26T10:57:13.000256
Glenda
pythondev_help_Glenda_2017-12-26T10:57:13.000256
1,514,285,833.000256
105,865
pythondev
help
so that creates a group test_word which contains every case-insensitive instance of "test"?
2017-12-26T10:57:43.000022
Glenda
pythondev_help_Glenda_2017-12-26T10:57:43.000022
1,514,285,863.000022
105,866
pythondev
help
Lastly here is another way that might be helpful
2017-12-26T10:57:45.000219
Glinda
pythondev_help_Glinda_2017-12-26T10:57:45.000219
1,514,285,865.000219
105,867
pythondev
help
<https://stackoverflow.com/a/16720705>
2017-12-26T10:57:47.000013
Glinda
pythondev_help_Glinda_2017-12-26T10:57:47.000013
1,514,285,867.000013
105,868
pythondev
help
using `(?P&lt;name&gt;pattern)` creates a named group where you can reference with `name` and searches for the word `pattern`
2017-12-26T10:58:32.000193
Glinda
pythondev_help_Glinda_2017-12-26T10:58:32.000193
1,514,285,912.000193
105,869
pythondev
help
Another thing that's helpful
2017-12-26T10:58:53.000040
Glinda
pythondev_help_Glinda_2017-12-26T10:58:53.000040
1,514,285,933.00004
105,870
pythondev
help
is regex matches in python are objects
2017-12-26T10:58:58.000116
Glinda
pythondev_help_Glinda_2017-12-26T10:58:58.000116
1,514,285,938.000116
105,871
pythondev
help
which contain some useful attributes
2017-12-26T10:59:03.000123
Glinda
pythondev_help_Glinda_2017-12-26T10:59:03.000123
1,514,285,943.000123
105,872
pythondev
help
<https://docs.python.org/3/library/re.html#match-objects>
2017-12-26T10:59:54.000013
Glinda
pythondev_help_Glinda_2017-12-26T10:59:54.000013
1,514,285,994.000013
105,873
pythondev
help
specifically ```&gt;&gt;&gt; m = re.match(r"(?P&lt;first_name&gt;\w+) (?P&lt;last_name&gt;\w+)", "Malcolm Reynolds") &gt;&gt;&gt; m.groupdict() {'first_name': 'Malcolm', 'last_name': 'Reynolds'}```
2017-12-26T11:00:15.000390
Glinda
pythondev_help_Glinda_2017-12-26T11:00:15.000390
1,514,286,015.00039
105,874
pythondev
help
wow that's pretty cool!
2017-12-26T11:00:53.000292
Glenda
pythondev_help_Glenda_2017-12-26T11:00:53.000292
1,514,286,053.000292
105,875
pythondev
help
I'm getting an error when trying to implement the second option. says invalid group reference
2017-12-26T11:02:14.000081
Glenda
pythondev_help_Glenda_2017-12-26T11:02:14.000081
1,514,286,134.000081
105,876
pythondev
help
Which one?
2017-12-26T11:02:24.000283
Glinda
pythondev_help_Glinda_2017-12-26T11:02:24.000283
1,514,286,144.000283
105,877
pythondev
help
Uhh
2017-12-26T11:02:48.000200
Glinda
pythondev_help_Glinda_2017-12-26T11:02:48.000200
1,514,286,168.0002
105,878
pythondev
help
might be you're referencing `\1` all times?
2017-12-26T11:02:58.000127
Glinda
pythondev_help_Glinda_2017-12-26T11:02:58.000127
1,514,286,178.000127
105,879
pythondev
help
you mean it would be \2 for the second match, \3 for the third, etc.?
2017-12-26T11:03:41.000209
Glenda
pythondev_help_Glenda_2017-12-26T11:03:41.000209
1,514,286,221.000209
105,880
pythondev
help
```content = "Test TeST TEsT" words = ["test"] for index, word in enumerate(words): pattern = re.compile(word, re.IGNORECASE) content = re.sub(pattern, f'&lt;b&gt;\{index+1}&lt;/b&gt;', content)```
2017-12-26T11:03:51.000012
Glinda
pythondev_help_Glinda_2017-12-26T11:03:51.000012
1,514,286,231.000012
105,881
pythondev
help
maybe something like this
2017-12-26T11:03:53.000152
Glinda
pythondev_help_Glinda_2017-12-26T11:03:53.000152
1,514,286,233.000152
105,882
pythondev
help
one sec
2017-12-26T11:05:26.000043
Glinda
pythondev_help_Glinda_2017-12-26T11:05:26.000043
1,514,286,326.000043
105,883
pythondev
help
Hey all! I start learning python three months ago. Now, i’m working with Keras and Tensorflow framework, my question is: Is there a function that evaluate FROC curve?
2017-12-26T11:11:10.000260
Harry
pythondev_help_Harry_2017-12-26T11:11:10.000260
1,514,286,670.00026
105,884
pythondev
help
<@Glenda> this is why: `Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.`
2017-12-26T11:14:49.000261
Glinda
pythondev_help_Glinda_2017-12-26T11:14:49.000261
1,514,286,889.000261
105,885
pythondev
help
It's only getting the first value.
2017-12-26T11:14:53.000235
Glinda
pythondev_help_Glinda_2017-12-26T11:14:53.000235
1,514,286,893.000235
105,886
pythondev
help
```import re content = "Test TeST TEsT" words = ["test"] match_pattern = r'(?i)(test)' result_match = re.findall(match_pattern, content) result = re.sub(match_pattern, r'&lt;b&gt;\1&lt;/b&gt;', content) print(result)```
2017-12-26T11:18:20.000107
Glinda
pythondev_help_Glinda_2017-12-26T11:18:20.000107
1,514,287,100.000107
105,887
pythondev
help
cool!
2017-12-26T11:19:39.000143
Glenda
pythondev_help_Glenda_2017-12-26T11:19:39.000143
1,514,287,179.000143
105,888
pythondev
help
is result_match necessary?
2017-12-26T11:19:51.000170
Glenda
pythondev_help_Glenda_2017-12-26T11:19:51.000170
1,514,287,191.00017
105,889
pythondev
help
```import re def add_tag(pattern, content, tag): return re.sub(pattern, f'&lt;{tag}&gt;\\1&lt;/{tag}&gt;', content) if __name__ == '__main__': pattern = r'(?i)(test)' content = "Test TeST TEsT" print(add_tag(pattern, content, 'b'))```
2017-12-26T11:22:16.000263
Glinda
pythondev_help_Glinda_2017-12-26T11:22:16.000263
1,514,287,336.000263
105,890
pythondev
help
<@Harry> you want the area under free response curve? Or you wish to create a free response curve?
2017-12-26T11:23:34.000223
Glinda
pythondev_help_Glinda_2017-12-26T11:23:34.000223
1,514,287,414.000223
105,891
pythondev
help
Good luck bud
2017-12-26T11:23:38.000293
Glinda
pythondev_help_Glinda_2017-12-26T11:23:38.000293
1,514,287,418.000293
105,892
pythondev
help
Also, here's a great read since you're doing regex with html
2017-12-26T11:24:02.000272
Glinda
pythondev_help_Glinda_2017-12-26T11:24:02.000272
1,514,287,442.000272
105,893
pythondev
help
<https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags>
2017-12-26T11:24:03.000102
Glinda
pythondev_help_Glinda_2017-12-26T11:24:03.000102
1,514,287,443.000102
105,894
pythondev
help
<@Harry> here's a script I found that evalutes it <https://github.com/gakarak/Camelyon2016Code/blob/master/Python-Caffe/Check_Evaluation/Evaluation_FROC.py>
2017-12-26T11:25:02.000239
Glinda
pythondev_help_Glinda_2017-12-26T11:25:02.000239
1,514,287,502.000239
105,895
pythondev
help
Thanks for help! I'm working with microaneurysm detection, I also found this script, I was wondering if there's more :relaxed: cause It's little bit different using keras. I'm going to improve my skills
2017-12-26T11:28:29.000027
Harry
pythondev_help_Harry_2017-12-26T11:28:29.000027
1,514,287,709.000027
105,896
pythondev
help
My background is in chemical engineering, but I'm a software developer. Perhaps we could figure out together how to change this script.
2017-12-26T11:30:03.000253
Glinda
pythondev_help_Glinda_2017-12-26T11:30:03.000253
1,514,287,803.000253
105,897
pythondev
help
Well chemE and years ago I was a med lab tech who worked alongside a pathologist.
2017-12-26T11:30:40.000073
Glinda
pythondev_help_Glinda_2017-12-26T11:30:40.000073
1,514,287,840.000073
105,898
pythondev
help
Cool! I'll be in touch soon
2017-12-26T11:32:05.000192
Harry
pythondev_help_Harry_2017-12-26T11:32:05.000192
1,514,287,925.000192
105,899
pythondev
help
Let me know if you have any further questions since I'm not directly helpful.
2017-12-26T11:32:46.000103
Glinda
pythondev_help_Glinda_2017-12-26T11:32:46.000103
1,514,287,966.000103
105,900
pythondev
help
I will. Many thanks
2017-12-26T11:40:35.000147
Harry
pythondev_help_Harry_2017-12-26T11:40:35.000147
1,514,288,435.000147
105,901
pythondev
help
<@Suellen> I gave that a shot and I'm trying to get a flask test harness setup, but I'm running into other issues.
2017-12-26T12:38:10.000172
Glinda
pythondev_help_Glinda_2017-12-26T12:38:10.000172
1,514,291,890.000172
105,902