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
No
2019-04-23T20:47:35.428600
Gemma
pythondev_help_Gemma_2019-04-23T20:47:35.428600
1,556,052,455.4286
20,221
pythondev
help
Well, at this point if im gonna use spacy, itll be on my macbook.
2019-04-23T20:53:08.429400
Clayton
pythondev_help_Clayton_2019-04-23T20:53:08.429400
1,556,052,788.4294
20,222
pythondev
help
I am working on Spacy too
2019-04-23T21:49:47.429800
Antone
pythondev_help_Antone_2019-04-23T21:49:47.429800
1,556,056,187.4298
20,223
pythondev
help
are there any moderators online in here?
2019-04-23T21:50:12.430200
Antone
pythondev_help_Antone_2019-04-23T21:50:12.430200
1,556,056,212.4302
20,224
pythondev
help
I’m trying to clean up some output for a file. Can someone tell me if there is a better way to write this - Reduce the number of .replace calls? my_item = item[-1].replace(β€˜}’, β€˜β€™).replace(β€˜]’, β€˜β€™).replace(β€˜\n’, β€˜β€™).replace(β€˜β€œβ€™, β€˜β€™)
2019-04-23T21:59:00.430400
Oda
pythondev_help_Oda_2019-04-23T21:59:00.430400
1,556,056,740.4304
20,225
pythondev
help
You can create a dictionary for replacements.
2019-04-23T22:13:14.430600
Raguel
pythondev_help_Raguel_2019-04-23T22:13:14.430600
1,556,057,594.4306
20,226
pythondev
help
What is item here? a string?
2019-04-23T22:13:27.430800
Raguel
pythondev_help_Raguel_2019-04-23T22:13:27.430800
1,556,057,607.4308
20,227
pythondev
help
You can ask your question, and moderators/admin/anyone will reply whenever they can
2019-04-23T22:15:02.431000
Raguel
pythondev_help_Raguel_2019-04-23T22:15:02.431000
1,556,057,702.431
20,228
pythondev
help
Yes it’s a string
2019-04-23T22:16:18.431200
Oda
pythondev_help_Oda_2019-04-23T22:16:18.431200
1,556,057,778.4312
20,229
pythondev
help
Here’s my code block
2019-04-23T22:17:31.431400
Oda
pythondev_help_Oda_2019-04-23T22:17:31.431400
1,556,057,851.4314
20,230
pythondev
help
for line in file_content: if β€œ\”PROCESS_THIS\β€œβ€ in line: item = line.split(β€œ,”) time = item[0] internal_thing = item[-1].replace(β€˜}’, β€˜β€™).replace(β€˜]’, β€˜β€™).replace(β€˜\n’, β€˜β€™).replace(β€˜β€œβ€™, β€˜β€™) print(type(internal_thing)) external_thing = item[12].replace(β€˜β€œβ€™, β€˜β€™) log.write(β€œ%s, %s, %s, %s\n” % (yesterdays_date, time, internal_thing, external_thing)) f.close() log.close()
2019-04-23T22:17:34.431600
Oda
pythondev_help_Oda_2019-04-23T22:17:34.431600
1,556,057,854.4316
20,231
pythondev
help
β€œitem” is this long nasty log file line.
2019-04-23T22:18:45.431800
Oda
pythondev_help_Oda_2019-04-23T22:18:45.431800
1,556,057,925.4318
20,232
pythondev
help
you can try something like this: ``` rep = {'}':'',']':'','\n':'','"':''} item = '}{123"]' for k,v in rep.items(): item = item.replace(k,v) ```
2019-04-23T22:26:07.432100
Raguel
pythondev_help_Raguel_2019-04-23T22:26:07.432100
1,556,058,367.4321
20,233
pythondev
help
I am sure you could use the re library
2019-04-23T22:28:52.432400
Estefana
pythondev_help_Estefana_2019-04-23T22:28:52.432400
1,556,058,532.4324
20,234
pythondev
help
re.sub
2019-04-23T22:29:18.432600
Estefana
pythondev_help_Estefana_2019-04-23T22:29:18.432600
1,556,058,558.4326
20,235
pythondev
help
maybe
2019-04-23T22:29:21.432800
Estefana
pythondev_help_Estefana_2019-04-23T22:29:21.432800
1,556,058,561.4328
20,236
pythondev
help
if you are cleaning text its good to know re
2019-04-23T22:29:28.433000
Estefana
pythondev_help_Estefana_2019-04-23T22:29:28.433000
1,556,058,568.433
20,237
pythondev
help
YAS
2019-04-23T22:29:57.433200
Estefana
pythondev_help_Estefana_2019-04-23T22:29:57.433200
1,556,058,597.4332
20,238
pythondev
help
<https://stackoverflow.com/questions/3939361/remove-specific-characters-from-a-string-in-python>
2019-04-23T22:29:59.433400
Estefana
pythondev_help_Estefana_2019-04-23T22:29:59.433400
1,556,058,599.4334
20,239
pythondev
help
yup, you can always use regex, but I keep that as my last resort :stuck_out_tongue:
2019-04-23T22:32:40.433700
Raguel
pythondev_help_Raguel_2019-04-23T22:32:40.433700
1,556,058,760.4337
20,240
pythondev
help
imo thats a mistake
2019-04-23T23:36:30.434100
Estefana
pythondev_help_Estefana_2019-04-23T23:36:30.434100
1,556,062,590.4341
20,241
pythondev
help
no need to reinvent the wheel just because you can
2019-04-23T23:36:47.434300
Estefana
pythondev_help_Estefana_2019-04-23T23:36:47.434300
1,556,062,607.4343
20,242
pythondev
help
True β€” since everything is being replaced with β€˜β€™, it is better to use regex here
2019-04-23T23:44:07.434500
Raguel
pythondev_help_Raguel_2019-04-23T23:44:07.434500
1,556,063,047.4345
20,243
pythondev
help
If you have a question specifically for the admins, the <#CD60CDU7K|community> channel is the right place, I think.
2019-04-24T00:34:19.435700
Sasha
pythondev_help_Sasha_2019-04-24T00:34:19.435700
1,556,066,059.4357
20,244
pythondev
help
With this flow I'm running into an error: - `main.py` runs a function in `foo.py`. - this function in `foo.py` runs a function in `/components/rock.py` ```/main.py /requirements.txt --/venv --/components --/rock.py --/lib --/foo.py --/bar.by``` This is how I import other scripts ```sys.path.append('/components') from components import rock```
2019-04-24T00:36:23.437100
Conchita
pythondev_help_Conchita_2019-04-24T00:36:23.437100
1,556,066,183.4371
20,245
pythondev
help
My error: ``` File "foo.py", line 12, in &lt;module&gt; from components import rock ModuleNotFoundError: No module named 'components'```
2019-04-24T00:37:16.437600
Conchita
pythondev_help_Conchita_2019-04-24T00:37:16.437600
1,556,066,236.4376
20,246
pythondev
help
<http://bit.ly/pypackages|bit.ly/pypackages>
2019-04-24T00:37:56.438100
Chester
pythondev_help_Chester_2019-04-24T00:37:56.438100
1,556,066,276.4381
20,247
pythondev
help
Thanks, taking a look
2019-04-24T00:38:22.438300
Conchita
pythondev_help_Conchita_2019-04-24T00:38:22.438300
1,556,066,302.4383
20,248
pythondev
help
Nice guide. I changed from ```sys.path.append('/components') from components import rock``` to ```from components.rock import stone ```
2019-04-24T01:02:47.439300
Conchita
pythondev_help_Conchita_2019-04-24T01:02:47.439300
1,556,067,767.4393
20,249
pythondev
help
Still getting ```File "foo.py", line 12, in &lt;module&gt; from components import rock ModuleNotFoundError: No module named 'components'```
2019-04-24T01:03:02.439700
Conchita
pythondev_help_Conchita_2019-04-24T01:03:02.439700
1,556,067,782.4397
20,250
pythondev
help
You need to have `setup.py`/`setup.cfg` and do `pip install -e .` beforehand. These are basically the proper way to append to `sys.path`
2019-04-24T01:03:50.440700
Chester
pythondev_help_Chester_2019-04-24T01:03:50.440700
1,556,067,830.4407
20,251
pythondev
help
Aha
2019-04-24T01:04:06.441000
Conchita
pythondev_help_Conchita_2019-04-24T01:04:06.441000
1,556,067,846.441
20,252
pythondev
help
Never touched setup.py before. Will take a look at that
2019-04-24T01:04:27.441700
Conchita
pythondev_help_Conchita_2019-04-24T01:04:27.441700
1,556,067,867.4417
20,253
pythondev
help
Although it's not very common to have multiple top-level packages, why do you have them?
2019-04-24T01:04:31.441900
Chester
pythondev_help_Chester_2019-04-24T01:04:31.441900
1,556,067,871.4419
20,254
pythondev
help
If you move all your code in a single package, your relative imports will work
2019-04-24T01:04:45.442800
Chester
pythondev_help_Chester_2019-04-24T01:04:45.442800
1,556,067,885.4428
20,255
pythondev
help
You may be missing an `__init__.py` file?
2019-04-24T01:05:04.443300
Sasha
pythondev_help_Sasha_2019-04-24T01:05:04.443300
1,556,067,904.4433
20,256
pythondev
help
Maybe I'll do that instead. Just wanted to seperate different scripts based on their utility
2019-04-24T01:05:41.444100
Conchita
pythondev_help_Conchita_2019-04-24T01:05:41.444100
1,556,067,941.4441
20,257
pythondev
help
Never user either of `__init__.py` or `setup.py`
2019-04-24T01:06:05.444600
Conchita
pythondev_help_Conchita_2019-04-24T01:06:05.444600
1,556,067,965.4446
20,258
pythondev
help
Do you recommend I: a) place all code into a single package b) Setup `setup.py` c) Setup `__init__.py`
2019-04-24T01:07:20.445900
Conchita
pythondev_help_Conchita_2019-04-24T01:07:20.445900
1,556,068,040.4459
20,259
pythondev
help
I'm ms confused right now lol
2019-04-24T01:07:36.446400
Conchita
pythondev_help_Conchita_2019-04-24T01:07:36.446400
1,556,068,056.4464
20,260
pythondev
help
Never mind about `__init__.py`... that seems to be optional in Py3 now.
2019-04-24T01:07:41.446600
Sasha
pythondev_help_Sasha_2019-04-24T01:07:41.446600
1,556,068,061.4466
20,261
pythondev
help
No, it's not
2019-04-24T01:08:01.447000
Chester
pythondev_help_Chester_2019-04-24T01:08:01.447000
1,556,068,081.447
20,262
pythondev
help
I think option a) would be easiest and wont have any negative implications?
2019-04-24T01:08:23.447800
Conchita
pythondev_help_Conchita_2019-04-24T01:08:23.447800
1,556,068,103.4478
20,263
pythondev
help
`__init__.py` is still mandatory. When this file is missing, python3 will still work, but it will do a slightly different thing
2019-04-24T01:08:40.448300
Chester
pythondev_help_Chester_2019-04-24T01:08:40.448300
1,556,068,120.4483
20,264
pythondev
help
rather than a regular import
2019-04-24T01:08:47.448600
Chester
pythondev_help_Chester_2019-04-24T01:08:47.448600
1,556,068,127.4486
20,265
pythondev
help
<@Conchita> if you want to have a package, `__init__.py` is mandatory. You can't go without creating it, really
2019-04-24T01:09:18.449200
Chester
pythondev_help_Chester_2019-04-24T01:09:18.449200
1,556,068,158.4492
20,266
pythondev
help
I think reading <https://setuptools.readthedocs.io/en/latest/setuptools.html> is a must for every python developer at some point
2019-04-24T01:09:46.449600
Chester
pythondev_help_Chester_2019-04-24T01:09:46.449600
1,556,068,186.4496
20,267
pythondev
help
Especially the part about using `setup.cfg` <https://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files>
2019-04-24T01:10:03.450100
Chester
pythondev_help_Chester_2019-04-24T01:10:03.450100
1,556,068,203.4501
20,268
pythondev
help
Ok will do thanks :taco: <@Chester>
2019-04-24T01:10:18.450400
Conchita
pythondev_help_Conchita_2019-04-24T01:10:18.450400
1,556,068,218.4504
20,269
pythondev
help
Alternatively, you can use `poetry` <https://github.com/sdispater/poetry/> that hides all that `setup.py`/`setup.cfg` related complexity from you
2019-04-24T01:10:55.451000
Chester
pythondev_help_Chester_2019-04-24T01:10:55.451000
1,556,068,255.451
20,270
pythondev
help
Hi guys, How do I prevent celery from running the same task on multiple workers? I'm using sqs as a message broker
2019-04-24T02:12:15.452600
Valeri
pythondev_help_Valeri_2019-04-24T02:12:15.452600
1,556,071,935.4526
20,271
pythondev
help
I've got a single EC2 instance with 4 workers
2019-04-24T02:12:40.453100
Valeri
pythondev_help_Valeri_2019-04-24T02:12:40.453100
1,556,071,960.4531
20,272
pythondev
help
You can't by design. Make your tasks idempotent, and the problem disappears. Of course, you can always implement your own distributed locking mechanism.
2019-04-24T02:24:30.454300
Chester
pythondev_help_Chester_2019-04-24T02:24:30.454300
1,556,072,670.4543
20,273
pythondev
help
<@Chester> Can you please elaborate a little on the idempotent part?
2019-04-24T02:30:26.455100
Valeri
pythondev_help_Valeri_2019-04-24T02:30:26.455100
1,556,073,026.4551
20,274
pythondev
help
Idempotent means that multiple invocations of the same execution request result in only one and only outcome.
2019-04-24T02:31:47.456000
Chester
pythondev_help_Chester_2019-04-24T02:31:47.456000
1,556,073,107.456
20,275
pythondev
help
E.g. an idempotent task that updates a value in a database may check first if the value is already updated, and do nothing
2019-04-24T02:32:21.456900
Chester
pythondev_help_Chester_2019-04-24T02:32:21.456900
1,556,073,141.4569
20,276
pythondev
help
Aah! I get that
2019-04-24T02:37:53.457300
Valeri
pythondev_help_Valeri_2019-04-24T02:37:53.457300
1,556,073,473.4573
20,277
pythondev
help
I was thinking along the same lines
2019-04-24T02:38:01.457600
Valeri
pythondev_help_Valeri_2019-04-24T02:38:01.457600
1,556,073,481.4576
20,278
pythondev
help
Wouldn’t an if statement do that? Lol.
2019-04-24T06:24:59.458500
Nieves
pythondev_help_Nieves_2019-04-24T06:24:59.458500
1,556,087,099.4585
20,279
pythondev
help
I don’t speak terminology
2019-04-24T06:25:16.458800
Nieves
pythondev_help_Nieves_2019-04-24T06:25:16.458800
1,556,087,116.4588
20,280
pythondev
help
if you want to contact an admin privately you can use the `/admin` command
2019-04-24T07:04:37.459100
Faith
pythondev_help_Faith_2019-04-24T07:04:37.459100
1,556,089,477.4591
20,281
pythondev
help
Any cool tricks to generate something like "1, 2, 3, and 4" from a list [1,2,3,4]? `", ".join([1,2,3,4])` doesn't help me with the lastcase
2019-04-24T08:16:14.460400
Christina
pythondev_help_Christina_2019-04-24T08:16:14.460400
1,556,093,774.4604
20,282
pythondev
help
I guess something like this could solve it: ``` l = ["1", "2", "3", "4"] ", and ".join([", ".join(l[:-1]), l[-1]]) ```
2019-04-24T08:18:23.462100
Christina
pythondev_help_Christina_2019-04-24T08:18:23.462100
1,556,093,903.4621
20,283
pythondev
help
`", ".join(a[:-1]) + " and " + a[-1]`
2019-04-24T08:20:38.462500
Jimmy
pythondev_help_Jimmy_2019-04-24T08:20:38.462500
1,556,094,038.4625
20,284
pythondev
help
or this if you have a longer string `"{} and {}".format(", ".join(a[:-1]), a[-1])`
2019-04-24T08:22:04.463000
Jimmy
pythondev_help_Jimmy_2019-04-24T08:22:04.463000
1,556,094,124.463
20,285
pythondev
help
now make it work for any iterable besides the list :p
2019-04-24T08:22:44.463300
Jettie
pythondev_help_Jettie_2019-04-24T08:22:44.463300
1,556,094,164.4633
20,286
pythondev
help
`/gif` doens't work anymore :disappointed:
2019-04-24T08:24:08.463600
Jimmy
pythondev_help_Jimmy_2019-04-24T08:24:08.463600
1,556,094,248.4636
20,287
pythondev
help
anyways I have some work to do but feel free to show me how it's done <@Jettie>:wink:
2019-04-24T08:24:39.464000
Jimmy
pythondev_help_Jimmy_2019-04-24T08:24:39.464000
1,556,094,279.464
20,288
pythondev
help
nice one :)
2019-04-24T08:24:57.464300
Jettie
pythondev_help_Jettie_2019-04-24T08:24:57.464300
1,556,094,297.4643
20,289
pythondev
help
it won't be a one-liner anymore
2019-04-24T08:25:20.465100
Jettie
pythondev_help_Jettie_2019-04-24T08:25:20.465100
1,556,094,320.4651
20,290
pythondev
help
or a very ugly one
2019-04-24T08:25:24.465400
Jettie
pythondev_help_Jettie_2019-04-24T08:25:24.465400
1,556,094,324.4654
20,291
pythondev
help
iterator as in forinstance a generator, where you cant take the index?
2019-04-24T08:26:12.466700
Christina
pythondev_help_Christina_2019-04-24T08:26:12.466700
1,556,094,372.4667
20,292
pythondev
help
i like the one-liner <@Jimmy>:smile:
2019-04-24T08:26:29.467200
Christina
pythondev_help_Christina_2019-04-24T08:26:29.467200
1,556,094,389.4672
20,293
pythondev
help
or a set, can't index a set
2019-04-24T08:26:29.467300
Jettie
pythondev_help_Jettie_2019-04-24T08:26:29.467300
1,556,094,389.4673
20,294
pythondev
help
oh right
2019-04-24T08:26:35.467500
Christina
pythondev_help_Christina_2019-04-24T08:26:35.467500
1,556,094,395.4675
20,295
pythondev
help
it's a good exercise probably
2019-04-24T08:26:39.467900
Jettie
pythondev_help_Jettie_2019-04-24T08:26:39.467900
1,556,094,399.4679
20,296
pythondev
help
i mean you can do a recursive function
2019-04-24T08:26:50.468200
Christina
pythondev_help_Christina_2019-04-24T08:26:50.468200
1,556,094,410.4682
20,297
pythondev
help
even better this should use f-string
2019-04-24T08:27:06.468300
Jimmy
pythondev_help_Jimmy_2019-04-24T08:27:06.468300
1,556,094,426.4683
20,298
pythondev
help
yeah. but isn't there some issues with join inside a string-interpolated string?
2019-04-24T08:27:45.469100
Christina
pythondev_help_Christina_2019-04-24T08:27:45.469100
1,556,094,465.4691
20,299
pythondev
help
nah it should be good, just don't use the same type of quotes for join as you do for the full string
2019-04-24T08:28:30.469900
Mica
pythondev_help_Mica_2019-04-24T08:28:30.469900
1,556,094,510.4699
20,300
pythondev
help
i was wrong
2019-04-24T08:28:34.470100
Christina
pythondev_help_Christina_2019-04-24T08:28:34.470100
1,556,094,514.4701
20,301
pythondev
help
`f"{','.join(l[:-1])} and {l[-1]}"` works
2019-04-24T08:28:39.470400
Christina
pythondev_help_Christina_2019-04-24T08:28:39.470400
1,556,094,519.4704
20,302
pythondev
help
ye if you do `","` it'll break
2019-04-24T08:28:59.471000
Mica
pythondev_help_Mica_2019-04-24T08:28:59.471000
1,556,094,539.471
20,303
pythondev
help
yep
2019-04-24T08:29:25.471300
Christina
pythondev_help_Christina_2019-04-24T08:29:25.471300
1,556,094,565.4713
20,304
pythondev
help
should use `"""` with f string to be on the safe side
2019-04-24T08:29:36.471800
Jimmy
pythondev_help_Jimmy_2019-04-24T08:29:36.471800
1,556,094,576.4718
20,305
pythondev
help
oic. Is it aways recommend? seems excessive in some cases.
2019-04-24T08:29:59.472400
Christina
pythondev_help_Christina_2019-04-24T08:29:59.472400
1,556,094,599.4724
20,306
pythondev
help
I don't think pep8 says anything regarding that. I now use black for new projects and it does that. I like it
2019-04-24T08:30:57.473100
Jimmy
pythondev_help_Jimmy_2019-04-24T08:30:57.473100
1,556,094,657.4731
20,307
pythondev
help
PEP8 was also written before interpolation was proposed :stuck_out_tongue: but pep-0498 doesn't seem to include anything regarding style guidelines
2019-04-24T08:34:59.473900
Christina
pythondev_help_Christina_2019-04-24T08:34:59.473900
1,556,094,899.4739
20,308
pythondev
help
black?
2019-04-24T08:35:23.474100
Christina
pythondev_help_Christina_2019-04-24T08:35:23.474100
1,556,094,923.4741
20,309
pythondev
help
g#ambv/black
2019-04-24T08:36:05.474300
Jimmy
pythondev_help_Jimmy_2019-04-24T08:36:05.474300
1,556,094,965.4743
20,310
pythondev
help
<https://github.com/ambv/black>
2019-04-24T08:36:06.474400
Leana
pythondev_help_Leana_2019-04-24T08:36:06.474400
1,556,094,966.4744
20,311
pythondev
help
oh cool! :smile: I'll definitely start using that
2019-04-24T08:45:44.474900
Christina
pythondev_help_Christina_2019-04-24T08:45:44.474900
1,556,095,544.4749
20,312
pythondev
help
i dont fully understand what it is...
2019-04-24T08:54:01.475400
Leida
pythondev_help_Leida_2019-04-24T08:54:01.475400
1,556,096,041.4754
20,313
pythondev
help
some autoformater?
2019-04-24T08:54:13.475700
Leida
pythondev_help_Leida_2019-04-24T08:54:13.475700
1,556,096,053.4757
20,314
pythondev
help
yeah strict autoformatter. minimizes merge conflicts etc afaik
2019-04-24T08:55:59.476300
Christina
pythondev_help_Christina_2019-04-24T08:55:59.476300
1,556,096,159.4763
20,315
pythondev
help
yes exactly
2019-04-24T08:57:41.476500
Jimmy
pythondev_help_Jimmy_2019-04-24T08:57:41.476500
1,556,096,261.4765
20,316
pythondev
help
USe this <https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.CtrlClickGoToDefinition>
2019-04-24T09:01:55.476600
Jerrie
pythondev_help_Jerrie_2019-04-24T09:01:55.476600
1,556,096,515.4766
20,317
pythondev
help
should basically be part of the pipeline or atleast verified in a linting step
2019-04-24T09:03:21.477600
Christina
pythondev_help_Christina_2019-04-24T09:03:21.477600
1,556,096,601.4776
20,318
pythondev
help
Thanks guys! re.sub did the trick.
2019-04-24T09:04:36.477700
Oda
pythondev_help_Oda_2019-04-24T09:04:36.477700
1,556,096,676.4777
20,319
pythondev
help
ah and seems to be faster than yapf
2019-04-24T09:05:00.478100
Leida
pythondev_help_Leida_2019-04-24T09:05:00.478100
1,556,096,700.4781
20,320