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 | I'm about to write a method that turns objects of a class I wrote, into dicts. Are there any conventions about the naming of such method? should dict(my_object) work? | 2019-05-28T08:01:04.304200 | Dominique | pythondev_help_Dominique_2019-05-28T08:01:04.304200 | 1,559,030,464.3042 | 25,521 |
pythondev | help | into a dict or into json? | 2019-05-28T08:01:48.304400 | Christina | pythondev_help_Christina_2019-05-28T08:01:48.304400 | 1,559,030,508.3044 | 25,522 |
pythondev | help | this question is really meta but what do you people do when your stack overflow question hasn't been answered? i asked it a couple of days ago and it kindof blocks development in our system. Do i pay people? pray to Linus?
I have two different issues with django 2.2.1 combined with Heroku CI:
*one* being that the `DATABASES` in the settings file for some reason is defined recursively. so the `default` value holds a key `TEST`which includes the content of default as well as a key `TEST` (etc). this is mainly a problem as django tries to sanitize the settings file, which hangs indefinitely, upon trying to show a stack trace
the *second* being that the CI throws the following exception when tearing down the test run `django.db.utils.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CASCADE;\n CREATE SCHEMA public;\n GRANT ALL' at line 1")`. utilizing JawsDB with (maybe? not sure how to verify) mysql 8.0.
I also asked sunday but got no result. if anyone has a clue as to how to fix it or (even better) how to find the solution myself. | 2019-05-28T08:04:12.306400 | Christina | pythondev_help_Christina_2019-05-28T08:04:12.306400 | 1,559,030,652.3064 | 25,523 |
pythondev | help | better define it in the class itself… MyClass(data).to_dict() | 2019-05-28T08:04:58.306500 | Lolita | pythondev_help_Lolita_2019-05-28T08:04:58.306500 | 1,559,030,698.3065 | 25,524 |
pythondev | help | Because I guess the conversion logic is specific to the class. | 2019-05-28T08:06:58.306800 | Lolita | pythondev_help_Lolita_2019-05-28T08:06:58.306800 | 1,559,030,818.3068 | 25,525 |
pythondev | help | you could utilize __dict__ (or override it, but that might cause weird behaviour) - but i don't think there is a specific naming convention for that concern. not AFAIK atleast. but i would also say it should be a method on the instance | 2019-05-28T08:08:51.307400 | Christina | pythondev_help_Christina_2019-05-28T08:08:51.307400 | 1,559,030,931.3074 | 25,526 |
pythondev | help | I’m sure Django and Heroku both has active slack or other IRL communities where they are most active. You may find your answers in those channels sooner. | 2019-05-28T08:11:10.307600 | Lolita | pythondev_help_Lolita_2019-05-28T08:11:10.307600 | 1,559,031,070.3076 | 25,527 |
pythondev | help | There’s a separate channel for Django even in this comminity | 2019-05-28T08:12:02.307800 | Lolita | pythondev_help_Lolita_2019-05-28T08:12:02.307800 | 1,559,031,122.3078 | 25,528 |
pythondev | help | I don’t think we should ever mess with __dict__. | 2019-05-28T08:13:31.308000 | Lolita | pythondev_help_Lolita_2019-05-28T08:13:31.308000 | 1,559,031,211.308 | 25,529 |
pythondev | help | BTW __dict__ is a dict instance not a method. It holds all the state of the object in it. | 2019-05-28T08:18:07.308400 | Lolita | pythondev_help_Lolita_2019-05-28T08:18:07.308400 | 1,559,031,487.3084 | 25,530 |
pythondev | help | i asked sunday in <#C0LMFRMB5|django> :wink: but never really got an answer. i mean it's rather specific. overlap. where the issues seem to be with mysql and and the heroku integration with django. the django_heroku git rep doesn't really seem that active. it has a whole lot of unanswered issues. | 2019-05-28T08:19:58.308700 | Christina | pythondev_help_Christina_2019-05-28T08:19:58.308700 | 1,559,031,598.3087 | 25,531 |
pythondev | help | I think you can try redefining the questions better with code examples and ways to reproduce the issue. If you feel it’s a bug, you can create an issue to the respective repos (search for already closed issues before creating one). There will be issue templates guiding you to define the exact problem better so that others don’t have to spend much effort understanding it. | 2019-05-28T08:26:00.308900 | Lolita | pythondev_help_Lolita_2019-05-28T08:26:00.308900 | 1,559,031,960.3089 | 25,532 |
pythondev | help | yeah true. I should probably just have created a minimalistic example where i would hopefully get the same problem. i tried changing from mysql to postgres for the tests and now everything works | 2019-05-28T08:32:53.309100 | Christina | pythondev_help_Christina_2019-05-28T08:32:53.309100 | 1,559,032,373.3091 | 25,533 |
pythondev | help | so i got that going for me which is nice | 2019-05-28T08:33:01.309300 | Christina | pythondev_help_Christina_2019-05-28T08:33:01.309300 | 1,559,032,381.3093 | 25,534 |
pythondev | help | I'd suggest to take a look at <http://attrs.org|attrs.org> | 2019-05-28T08:41:56.309500 | Chester | pythondev_help_Chester_2019-05-28T08:41:56.309500 | 1,559,032,916.3095 | 25,535 |
pythondev | help | Specifically, <http://www.attrs.org/en/stable/api.html#attr.asdict> | 2019-05-28T08:42:01.309700 | Chester | pythondev_help_Chester_2019-05-28T08:42:01.309700 | 1,559,032,921.3097 | 25,536 |
pythondev | help | Trying to create a minimal example is a great approach, and can often lead you to better understand both the question(s) you actually need to ask, and the tool you're working with | 2019-05-28T09:16:01.310500 | Ashley | pythondev_help_Ashley_2019-05-28T09:16:01.310500 | 1,559,034,961.3105 | 25,537 |
pythondev | help | It sounds like you have a super complex means of getting those settings in place and it's having unexpected behavior. I would try to rework that system so it's much simpler and straightforward, and hopefully that will clear up that problem. You can also have multiple settings files and point at specific ones for the environment you want to run in, if you aren't doing that already | 2019-05-28T09:20:08.310700 | Ashley | pythondev_help_Ashley_2019-05-28T09:20:08.310700 | 1,559,035,208.3107 | 25,538 |
pythondev | help | Regarding the syntax error, I'm not an sql guy, but I would guess you either need a semicolon at the end, or maybe the new line stuff is messing with it | 2019-05-28T09:21:01.310900 | Ashley | pythondev_help_Ashley_2019-05-28T09:21:01.310900 | 1,559,035,261.3109 | 25,539 |
pythondev | help | I'm thinking they might not be actual new line characters | 2019-05-28T09:22:40.311100 | Ashley | pythondev_help_Ashley_2019-05-28T09:22:40.311100 | 1,559,035,360.3111 | 25,540 |
pythondev | help | Hello everyone, how would you do the following in python:
• `ParentClass`: no methods, only attributes, would be better if immutable. Attributes should be visible and accessible.
• `ChildClass`: no methods, only attributes, inherit all the attributes from `ParentClass` can override parent class attributes, could have additional attributes.
At first I tried to implement this extending Enum but then I got this error ```Cannot extend enumerations``` | 2019-05-28T10:29:54.316000 | Alicia | pythondev_help_Alicia_2019-05-28T10:29:54.316000 | 1,559,039,394.316 | 25,541 |
pythondev | help | I probably don't understand what you are trying to...
Can I get a bit more context?
What's wrong with doing something like:
```
class Parent:
def __init__(self):
self.x = 'px'
self.y = 'py'
class Child(Parent):
def __init__(self):
super().__init__()
self.y = 'cy'
self.z = 'cz'
p = Parent()
c = Child()
print(vars(p)) # {'x': 'px', 'y': 'py'}
print(vars(c)) # {'x': 'px', 'y': 'cy', 'z': 'cz'}
``` | 2019-05-28T10:52:04.316300 | Guillermina | pythondev_help_Guillermina_2019-05-28T10:52:04.316300 | 1,559,040,724.3163 | 25,542 |
pythondev | help | (apart from having mutable attributes) | 2019-05-28T10:53:40.316500 | Guillermina | pythondev_help_Guillermina_2019-05-28T10:53:40.316500 | 1,559,040,820.3165 | 25,543 |
pythondev | help | HI <@Guillermina>, yeah in the end I did this way, so I am only missing the immutable part…
I was giving a look at attrs and “FrozenClass”
do you have some suggestion? | 2019-05-28T10:55:48.316700 | Alicia | pythondev_help_Alicia_2019-05-28T10:55:48.316700 | 1,559,040,948.3167 | 25,544 |
pythondev | help | what are you trying to "freeze", and how immutable does it have to be?
I mean... it's Python, real immutability for attributes is hard to get... | 2019-05-28T10:57:19.316900 | Guillermina | pythondev_help_Guillermina_2019-05-28T10:57:19.316900 | 1,559,041,039.3169 | 25,545 |
pythondev | help | you could fiddle with `__setattr__` and `__delattr__` I guess... | 2019-05-28T10:58:22.317100 | Guillermina | pythondev_help_Guillermina_2019-05-28T10:58:22.317100 | 1,559,041,102.3171 | 25,546 |
pythondev | help | Ok I got what I wanted using `attrs` package.
```
import attr
@attr.s(frozen=True)
class ParentClass(object):
attr = "value"
``` | 2019-05-28T11:01:20.317300 | Alicia | pythondev_help_Alicia_2019-05-28T11:01:20.317300 | 1,559,041,280.3173 | 25,547 |
pythondev | help | It’s really good because the behaviour is also inherited by child classes | 2019-05-28T11:02:11.317500 | Alicia | pythondev_help_Alicia_2019-05-28T11:02:11.317500 | 1,559,041,331.3175 | 25,548 |
pythondev | help | well, in that case: say thanks to <@Chester> :taco: | 2019-05-28T11:07:17.317700 | Guillermina | pythondev_help_Guillermina_2019-05-28T11:07:17.317700 | 1,559,041,637.3177 | 25,549 |
pythondev | help | (iirc he's contributing to `attrs`, dunno if there are other contributers active here) | 2019-05-28T11:14:28.317900 | Guillermina | pythondev_help_Guillermina_2019-05-28T11:14:28.317900 | 1,559,042,068.3179 | 25,550 |
pythondev | help | Error messages: C:\Users\rajat\PycharmProjects\TwitterBot\venv\Scripts\python.exe C:\Users\rajat\PycharmProjects\TwitterBot\model.py
Traceback (most recent call last):
File "C:\Users\rajat\PycharmProjects\TwitterBot\model.py", line 24, in <module>
api.update_with_media(model_image)
File "C:\Users\rajat\PycharmProjects\TwitterBot\venv\lib\site-packages\tweepy\api.py", line 233, in update_with_media
)(*args, **kwargs)
File "C:\Users\rajat\PycharmProjects\TwitterBot\venv\lib\site-packages\tweepy\binder.py", line 250, in _call
return method.execute()
File "C:\Users\rajat\PycharmProjects\TwitterBot\venv\lib\site-packages\tweepy\binder.py", line 234, in execute
raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: [{'code': 189, 'message': 'Error creating status.'}]
Process finished with exit code 1 | 2019-05-28T11:23:59.318100 | Scot | pythondev_help_Scot_2019-05-28T11:23:59.318100 | 1,559,042,639.3181 | 25,551 |
pythondev | help | Guys, some help with regex. I have the follwoing syntax, STRING:(.*)(CONDITION 1|CONDITION 2| CONDITION 3) | 2019-05-28T14:03:37.320700 | Jolanda | pythondev_help_Jolanda_2019-05-28T14:03:37.320700 | 1,559,052,217.3207 | 25,552 |
pythondev | help | How can I get only the first match | 2019-05-28T14:04:03.321100 | Jolanda | pythondev_help_Jolanda_2019-05-28T14:04:03.321100 | 1,559,052,243.3211 | 25,553 |
pythondev | help | <https://regex101.com/r/Zwm2j6/1> | 2019-05-28T14:04:07.321300 | Jolanda | pythondev_help_Jolanda_2019-05-28T14:04:07.321300 | 1,559,052,247.3213 | 25,554 |
pythondev | help | I'm not quite sure what you mean. Are you looking for `(.*?)` to get a minimal-length wildcard? | 2019-05-28T14:05:30.322000 | Sasha | pythondev_help_Sasha_2019-05-28T14:05:30.322000 | 1,559,052,330.322 | 25,555 |
pythondev | help | or are you looking to reference the first capture group? | 2019-05-28T14:06:04.322800 | Ashley | pythondev_help_Ashley_2019-05-28T14:06:04.322800 | 1,559,052,364.3228 | 25,556 |
pythondev | help | I'm looking for all between STRING and the first found condition | 2019-05-28T14:06:07.322900 | Jolanda | pythondev_help_Jolanda_2019-05-28T14:06:07.322900 | 1,559,052,367.3229 | 25,557 |
pythondev | help | just reference your first capture group | 2019-05-28T14:06:19.323300 | Claudine | pythondev_help_Claudine_2019-05-28T14:06:19.323300 | 1,559,052,379.3233 | 25,558 |
pythondev | help | capture groups are determined by parenthesis | 2019-05-28T14:06:38.323600 | Ashley | pythondev_help_Ashley_2019-05-28T14:06:38.323600 | 1,559,052,398.3236 | 25,559 |
pythondev | help | that site provides a breakdown of your capture groups on the right | 2019-05-28T14:07:04.323900 | Ashley | pythondev_help_Ashley_2019-05-28T14:07:04.323900 | 1,559,052,424.3239 | 25,560 |
pythondev | help | Got it! I was using groups in wrong way, now worked. Thanks guys | 2019-05-28T14:08:41.324600 | Jolanda | pythondev_help_Jolanda_2019-05-28T14:08:41.324600 | 1,559,052,521.3246 | 25,561 |
pythondev | help | I have a question about this | 2019-05-28T14:08:49.324900 | Jolanda | pythondev_help_Jolanda_2019-05-28T14:08:49.324900 | 1,559,052,529.3249 | 25,562 |
pythondev | help | the order of the CONDITION will change, so I will be create this regex for all condition, recommend some better way to do this? | 2019-05-28T14:09:53.326100 | Jolanda | pythondev_help_Jolanda_2019-05-28T14:09:53.326100 | 1,559,052,593.3261 | 25,563 |
pythondev | help | Named capture groups. They're not standard in all regex implementations, but they're available in most of the common ones. | 2019-05-28T14:12:23.327000 | Carmen | pythondev_help_Carmen_2019-05-28T14:12:23.327000 | 1,559,052,743.327 | 25,564 |
pythondev | help | <@Ashley> the code isn't written by me - it's written by django, so i woud assume that it doesn't contain any syntax errors, but what do i know. in that case i should report a bug. but as it worked with postgres, I've just accepted using that instead :stuck_out_tongue:
regarding the settings, i am simply utilizing the features of the framework. The recursiveness is not a result of an action i have taken, but rather something done by the django_heroku module. `django_heroku.settings(locals())` which automatically sets the database stuff. i haven't seen the action before, and afaik it only happens in CI.
I could probably deal with a minimal example. i still get the recursive thing. that bug wasn't fixed by changing to postgres. if i don't get any leads on the heroku support nor stack overflow i'll try an isolated test and the report it to the module and whereever else (or hopefully just solve it on my lonesome) | 2019-05-28T14:42:28.327100 | Christina | pythondev_help_Christina_2019-05-28T14:42:28.327100 | 1,559,054,548.3271 | 25,565 |
pythondev | help | <@Lolita> true! :slightly_smiling_face: | 2019-05-28T14:42:49.327300 | Christina | pythondev_help_Christina_2019-05-28T14:42:49.327300 | 1,559,054,569.3273 | 25,566 |
pythondev | help | <https://regex101.com/r/UblkLC/1> Isnt working when I try to select this condition | 2019-05-28T15:02:50.328000 | Jolanda | pythondev_help_Jolanda_2019-05-28T15:02:50.328000 | 1,559,055,770.328 | 25,567 |
pythondev | help | the first one " CONTRATANTE" works well, the rest don't | 2019-05-28T15:03:16.328700 | Jolanda | pythondev_help_Jolanda_2019-05-28T15:03:16.328700 | 1,559,055,796.3287 | 25,568 |
pythondev | help | what are you trying to get there? | 2019-05-28T15:20:20.331200 | Claudine | pythondev_help_Claudine_2019-05-28T15:20:20.331200 | 1,559,056,820.3312 | 25,569 |
pythondev | help | The content between CONTRATADA: and FORO: | 2019-05-28T15:21:04.331600 | Jolanda | pythondev_help_Jolanda_2019-05-28T15:21:04.331600 | 1,559,056,864.3316 | 25,570 |
pythondev | help | in this case, however in some cases might be another field, I would like to let this more or less dynamic | 2019-05-28T15:21:57.332400 | Jolanda | pythondev_help_Jolanda_2019-05-28T15:21:57.332400 | 1,559,056,917.3324 | 25,571 |
pythondev | help | it's because the `(.*)` is eating FORO | 2019-05-28T15:22:40.333100 | Claudine | pythondev_help_Claudine_2019-05-28T15:22:40.333100 | 1,559,056,960.3331 | 25,572 |
pythondev | help | you need `(.*?)` to make it not greedy, the `?` makes it match as few as it can instead of everything | 2019-05-28T15:23:11.333900 | Claudine | pythondev_help_Claudine_2019-05-28T15:23:11.333900 | 1,559,056,991.3339 | 25,573 |
pythondev | help | try
```
CONTRATADA(.*?)((OBJETO)|(FUNDAMENTAÇÃO LEGAL)|(FORO)|(VIGÊNCIA)|(VALOR GLOBAL)|(DOTAÇÃO ORÇAMENTÁRIA)|(DATA DA A
... SSINATURA)|(SIGNATÁRIOS)):
``` | 2019-05-28T15:23:13.334100 | Claudine | pythondev_help_Claudine_2019-05-28T15:23:13.334100 | 1,559,056,993.3341 | 25,574 |
pythondev | help | also you were using `|` between `CONTRATADA(.*?)|(OBJETO)`, so it was matching one or the other | 2019-05-28T15:24:12.334800 | Claudine | pythondev_help_Claudine_2019-05-28T15:24:12.334800 | 1,559,057,052.3348 | 25,575 |
pythondev | help | my update will match `CONTRADATA(.*?)` followed by any of the choices you provided | 2019-05-28T15:24:40.335500 | Claudine | pythondev_help_Claudine_2019-05-28T15:24:40.335500 | 1,559,057,080.3355 | 25,576 |
pythondev | help | Yes, I did this approach but was wrong, I tried CONTRATADA(.*)?((...)) | 2019-05-28T15:27:27.336500 | Jolanda | pythondev_help_Jolanda_2019-05-28T15:27:27.336500 | 1,559,057,247.3365 | 25,577 |
pythondev | help | Now is working, thank you <@Claudine> | 2019-05-28T15:27:43.337000 | Jolanda | pythondev_help_Jolanda_2019-05-28T15:27:43.337000 | 1,559,057,263.337 | 25,578 |
pythondev | help | `?` outside the `()` makes them optional | 2019-05-28T15:27:51.337200 | Claudine | pythondev_help_Claudine_2019-05-28T15:27:51.337200 | 1,559,057,271.3372 | 25,579 |
pythondev | help | `?` immediately after `*` makes it non-greedy | 2019-05-28T15:28:01.337500 | Claudine | pythondev_help_Claudine_2019-05-28T15:28:01.337500 | 1,559,057,281.3375 | 25,580 |
pythondev | help | no problem, i love regexes | 2019-05-28T15:28:08.337800 | Claudine | pythondev_help_Claudine_2019-05-28T15:28:08.337800 | 1,559,057,288.3378 | 25,581 |
pythondev | help | Hey everyone, Im now building a passion project in PYTHON/Django for the end of my coding bootcamp, I want the user/account to create a dream team using the list from the nfl api Im am using. Im looking for guidance on a Fetch to display the json data and allow users to add player to their team | 2019-05-28T15:28:19.338000 | Marica | pythondev_help_Marica_2019-05-28T15:28:19.338000 | 1,559,057,299.338 | 25,582 |
pythondev | help | easy peasy, just pull in everyone from the Pats, there's your dream team | 2019-05-28T15:30:45.338500 | Claudine | pythondev_help_Claudine_2019-05-28T15:30:45.338500 | 1,559,057,445.3385 | 25,583 |
pythondev | help | Hi, I built my project on top of a BSD licensed project. Does anyone know how to include its copyright notice to my license? | 2019-05-28T17:21:55.339100 | Latesha | pythondev_help_Latesha_2019-05-28T17:21:55.339100 | 1,559,064,115.3391 | 25,584 |
pythondev | help | Has anyone used sockets and pyaudio with Windows 10? I'm having a really weird time with it. | 2019-05-28T17:37:54.339900 | Manda | pythondev_help_Manda_2019-05-28T17:37:54.339900 | 1,559,065,074.3399 | 25,585 |
pythondev | help | I wrote it up here: <https://stackoverflow.com/questions/56349576/pyaudio-combined-with-sockets-causes-winerror-10093> | 2019-05-28T17:38:34.340100 | Manda | pythondev_help_Manda_2019-05-28T17:38:34.340100 | 1,559,065,114.3401 | 25,586 |
pythondev | help | Hello... I tried to connect to a couchbase cluster with the code below but it displayed an error message : "invalid identifier in code" pointing to the line " ('<couchbase://localhost>') "
```
from couchbase.cluster import Cluster
fromcouchbase.cluster import PasswordAuthenticator
cluster = Cluster('<couchbase://localhost>')
authenticator = PasswordAuthenticator('username', 'password')
cluster.authenticate(authenticator)
bucket = cluster.open_bucket('usersdata')
``` | 2019-05-28T18:05:58.341700 | Elmira | pythondev_help_Elmira_2019-05-28T18:05:58.341700 | 1,559,066,758.3417 | 25,587 |
pythondev | help | Could you post the traceback? It looks like the error message doesn't really match the code. | 2019-05-28T18:32:59.342700 | Sasha | pythondev_help_Sasha_2019-05-28T18:32:59.342700 | 1,559,068,379.3427 | 25,588 |
pythondev | help | My guess: it should have been `userdata` not `usersdata`, but he will probably have figured that out by now... | 2019-05-29T01:23:10.345000 | Guillermina | pythondev_help_Guillermina_2019-05-29T01:23:10.345000 | 1,559,092,990.345 | 25,589 |
pythondev | help | I need to store a piece of ID that is passed through Google Cloud Functions (Stateless). Any advice on how to approach that? | 2019-05-29T02:24:37.349600 | Conchita | pythondev_help_Conchita_2019-05-29T02:24:37.349600 | 1,559,096,677.3496 | 25,590 |
pythondev | help | Simple and easy approach | 2019-05-29T02:24:54.349900 | Conchita | pythondev_help_Conchita_2019-05-29T02:24:54.349900 | 1,559,096,694.3499 | 25,591 |
pythondev | help | Hi all,
So i have to cache method response but the cache_key should be generated from the arguments of method. args may be positional or optional or both.
I need a decorator that can cache. | 2019-05-29T02:58:05.354100 | Laurena | pythondev_help_Laurena_2019-05-29T02:58:05.354100 | 1,559,098,685.3541 | 25,592 |
pythondev | help | What testing framework I should look into when I am starting as a beginner? unittest or pytest? | 2019-05-29T03:19:47.355000 | Cordell | pythondev_help_Cordell_2019-05-29T03:19:47.355000 | 1,559,099,987.355 | 25,593 |
pythondev | help | that's a bit vague...
for persistence there is `pickle` or `shelve` or you could just write to a file yourself...
There is also `sqllite` if you need/want to put into a db... | 2019-05-29T03:20:28.355100 | Guillermina | pythondev_help_Guillermina_2019-05-29T03:20:28.355100 | 1,559,100,028.3551 | 25,594 |
pythondev | help | I prefer pytest. | 2019-05-29T03:22:12.355300 | Guillermina | pythondev_help_Guillermina_2019-05-29T03:22:12.355300 | 1,559,100,132.3553 | 25,595 |
pythondev | help | Definitely pytest | 2019-05-29T03:25:48.355500 | Chester | pythondev_help_Chester_2019-05-29T03:25:48.355500 | 1,559,100,348.3555 | 25,596 |
pythondev | help | so, what's holding you up?
give your class a cache dict, transform the args/kwargs into something hashable and do a dict lookup. If the key's not there, calculate and put the result into the dict... | 2019-05-29T03:26:10.355700 | Guillermina | pythondev_help_Guillermina_2019-05-29T03:26:10.355700 | 1,559,100,370.3557 | 25,597 |
pythondev | help | Sorry about the vagueness! Researching how I can implement `sqllite` into this now | 2019-05-29T03:26:37.355900 | Conchita | pythondev_help_Conchita_2019-05-29T03:26:37.355900 | 1,559,100,397.3559 | 25,598 |
pythondev | help | I'm using regex to parse strings in order to find specific words. I have figured out how to find one specific word regardless of where in the passed string it is located with
```msg = "status go cluster staging"
if re.match(r'(?=.*\bcluster\b)', msg):
print('found')
```
What if I wanted it to match both cluster and staging in the same line? | 2019-05-29T03:29:17.358100 | Conchita | pythondev_help_Conchita_2019-05-29T03:29:17.358100 | 1,559,100,557.3581 | 25,599 |
pythondev | help | How do I add a second string in my regex? | 2019-05-29T03:30:05.358800 | Conchita | pythondev_help_Conchita_2019-05-29T03:30:05.358800 | 1,559,100,605.3588 | 25,600 |
pythondev | help | Figured it out! | 2019-05-29T03:32:32.359100 | Conchita | pythondev_help_Conchita_2019-05-29T03:32:32.359100 | 1,559,100,752.3591 | 25,601 |
pythondev | help | This is how if anyone is interested ```msg = "status go cluster staging"
r = re.compile(r'\bstatus\b | \bcluster\b', flags=re.I | re.X)
print(r.findall(msg))
``` | 2019-05-29T03:33:53.359400 | Conchita | pythondev_help_Conchita_2019-05-29T03:33:53.359400 | 1,559,100,833.3594 | 25,602 |
pythondev | help | why re? a simpler solution would be:
```
if all(word in msg for word in ('cluster', 'staging')):
print('found all')
if any(word in msg for word in ('cluster', 'staging')):
print('found at least one')
```
if you want to make sure to have it at boundaries, you could do a `msg = msg.split()` first... | 2019-05-29T03:34:42.359500 | Guillermina | pythondev_help_Guillermina_2019-05-29T03:34:42.359500 | 1,559,100,882.3595 | 25,603 |
pythondev | help | <@Conchita> if you don't know it <http://regex101.com|regex101.com> is pretty cool for testing regex | 2019-05-29T03:36:05.360200 | Jimmy | pythondev_help_Jimmy_2019-05-29T03:36:05.360200 | 1,559,100,965.3602 | 25,604 |
pythondev | help | I prefer <http://regexr.com|regexr.com> | 2019-05-29T03:36:49.360500 | Chester | pythondev_help_Chester_2019-05-29T03:36:49.360500 | 1,559,101,009.3605 | 25,605 |
pythondev | help | Nice, that is more easy to read too! Can you pls elaborate on what you mean by boundaries? | 2019-05-29T03:37:52.360700 | Conchita | pythondev_help_Conchita_2019-05-29T03:37:52.360700 | 1,559,101,072.3607 | 25,606 |
pythondev | help | Didn't know either, bookmarked! thanks | 2019-05-29T03:38:01.361100 | Conchita | pythondev_help_Conchita_2019-05-29T03:38:01.361100 | 1,559,101,081.3611 | 25,607 |
pythondev | help | well, you wanted something "simple and easy"...
not sure if I should have mentioned `sqlite`, sorry... :wink: | 2019-05-29T03:38:53.361200 | Guillermina | pythondev_help_Guillermina_2019-05-29T03:38:53.361200 | 1,559,101,133.3612 | 25,608 |
pythondev | help | the regex makes sure to have the words within "word boundaries" by using `\b`.
So it would match ` cluster ` but not ` clusters `.
`"cluster" in "some clusters do things"` would return True though.
If you want to make sure to match the word exactly, you should listify the string by splitting it up at whitespace.
`"cluster" in ["some", "clusters", "do", "things"]` would return False | 2019-05-29T03:42:55.361500 | Guillermina | pythondev_help_Guillermina_2019-05-29T03:42:55.361500 | 1,559,101,375.3615 | 25,609 |
pythondev | help | Aha got it! Thanks for the explanation | 2019-05-29T03:43:53.361700 | Conchita | pythondev_help_Conchita_2019-05-29T03:43:53.361700 | 1,559,101,433.3617 | 25,610 |
pythondev | help | hi, is there a common library to obfuse code and put it into a binary for unix system | 2019-05-29T04:47:13.363000 | Marcia | pythondev_help_Marcia_2019-05-29T04:47:13.363000 | 1,559,105,233.363 | 25,611 |
pythondev | help | <@Marcia> Why not create pyc file and just run it? `python ./my_code.pyc` | 2019-05-29T05:00:35.363600 | Rikki | pythondev_help_Rikki_2019-05-29T05:00:35.363600 | 1,559,106,035.3636 | 25,612 |
pythondev | help | Why do you need obfuscate your code, are you doing something nasty? | 2019-05-29T05:01:27.364200 | Rikki | pythondev_help_Rikki_2019-05-29T05:01:27.364200 | 1,559,106,087.3642 | 25,613 |
pythondev | help | probably wrote an implementation that rivals the blockchain protocol, JK | 2019-05-29T05:07:25.365400 | Tam | pythondev_help_Tam_2019-05-29T05:07:25.365400 | 1,559,106,445.3654 | 25,614 |
pythondev | help | <@Rikki> i didn’t want that my customer can ready the code in plain text | 2019-05-29T05:22:36.366600 | Marcia | pythondev_help_Marcia_2019-05-29T05:22:36.366600 | 1,559,107,356.3666 | 25,615 |
pythondev | help | Well sounds like pyc is good enough for your needs | 2019-05-29T05:23:20.367000 | Rikki | pythondev_help_Rikki_2019-05-29T05:23:20.367000 | 1,559,107,400.367 | 25,616 |
pythondev | help | is it easy to decompile? | 2019-05-29T05:24:01.367300 | Marcia | pythondev_help_Marcia_2019-05-29T05:24:01.367300 | 1,559,107,441.3673 | 25,617 |
pythondev | help | It's not really possible with python. | 2019-05-29T05:27:48.367600 | Chester | pythondev_help_Chester_2019-05-29T05:27:48.367600 | 1,559,107,668.3676 | 25,618 |
pythondev | help | in php i rewrite class names and variables to make it hard to read | 2019-05-29T05:28:46.368800 | Marcia | pythondev_help_Marcia_2019-05-29T05:28:46.368800 | 1,559,107,726.3688 | 25,619 |
pythondev | help | Why? | 2019-05-29T05:30:12.369000 | Chester | pythondev_help_Chester_2019-05-29T05:30:12.369000 | 1,559,107,812.369 | 25,620 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.