yasnippet-snippets icon indicating copy to clipboard operation
yasnippet-snippets copied to clipboard

Merge elpy snippets

Open sten0 opened this issue 7 years ago • 17 comments
trafficstars

Hi @AndreaCrotti and @galaunay!

This PR supersedes #259. Please refer to #259 for the full history and discussion. Also, please do not squash or rebase, because I took extra care to maximally preserve committer history ;-)

If there is anything left to do for this PR it would be resolving the duplicate functionality noted in https://github.com/AndreaCrotti/yasnippet-snippets/pull/259#issuecomment-386952376

...but that can be left for another day!

Cheers, Nicholas

sten0 avatar Jun 17 '18 21:06 sten0

 Change elpy prefixes to yas-snips

Thanks to @AndreaCrotti for the review and suggestion.

I suggest not to put @user into commit messages. Some people track packages directly from git, and if they happen to push their forks to a GitHub repo, then this will send a notification.

npostavs avatar Jun 17 '18 22:06 npostavs

Change elpy prefixes to yas-snips

Thanks to @AndreaCrotti for the review and suggestion.

I suggest not to put @user into commit messages. Some people track packages directly from git, and if they happen to push their forks to a GitHub repo, then this will send a notification.

Oh my, I wish someone had mentioned this back in April... So to fix this, I can use:

  1. The sledgehammer reword commit which rewrites all subsequent commits. The only upsides are that I can re-sign all GPG signed commits would, that it's easy, and that the Elpy history remains untouched.

  2. Do #1 only up until the point of @galaunay's commits, and then asking him to rebase...again. @galaunay, do you think this be too OCD? haha Please let me know if you're ok with #1, and I'll go ahead and do it asap.

Cheers, Nicholas

sten0 avatar Jun 17 '18 22:06 sten0

@sten0 no problem for me with 1). While you are at it, squashing my commits into one may be a good idea as well. I realise I was a bit messy.

galaunay avatar Jun 18 '18 17:06 galaunay

@galaunay thanks, that was much easier :-) Personally I'm a fan of more granular commits, especially when they reveal multiple issued I missed! I'll leave it up to you to find the squashed commit; that one was avoidable, with a worst-case scenario of using magit to ediff the unstaged file (conflict) during rebase...I didn't need to ediff, so its existence seemed strange ;-)

@npostavs, By the way, thank you for explaining why @user in commit messages is a bad idea. I thought it would be a nice way to say "Hey, thank you!", but I agree that it would annoy @user if other people push their forks to github. Upon further reflection I've decided non-elpy users of yasnippet-snippets on PEP 394-compliant systems would probably also appreciate documentation of the python-interpreter variable... It should be trivial to copy&paste my block comment to a more visible document--I can add it to the Various Notes section of README.md if you'd like. Other than that, I think it's finally good to merge!

sten0 avatar Jun 19 '18 00:06 sten0

By the way, thank you for explaining why @user in commit messages is a bad idea. I thought it would be a nice way to say "Hey, thank you!", but I agree that it would annoy @user if other people push their forks to github.

Yeah, speaking as someone who's been on the receiving end of this, it was kind of annoying, although there weren't that many notifications in the end. I could imagine on some more popular repo it has the potential to be a real pain.

(it might not be every time someone pushes, maybe only if they rebase and hence produce a "new" commit with the same message)

npostavs avatar Jun 19 '18 00:06 npostavs

By the way, thank you for explaining why @user in commit messages is a bad idea. I thought it would be a nice way to say "Hey, thank you!", but I agree that it would annoy @user if other people push their forks to github.

Yeah, speaking as someone who's been on the receiving end of this, it was kind of annoying, although there weren't that many notifications in the end. I could imagine on some more popular repo it has the potential to be a real pain.

(it might not be every time someone pushes, maybe only if they rebase and hence produce a "new" commit with the same message)

That makes sense, and I fixed it. Is there any chance this PR could be merged before August?

sten0 avatar Jul 03 '18 19:07 sten0

Yes sure I'm back from holidays now and I'll have another look in the next few days @sten0

AndreaCrotti avatar Jul 10 '18 07:07 AndreaCrotti

@AndreaCrotti Hope you wonderful holidays :-)

Does the seen label mean it will be merged soon?

sten0 avatar Jul 23 '18 23:07 sten0

Well @sten0 it's just something I made up to check if there is something new, not necessarily that I'll merge soon, but sure I'd like to get this merged ASAP. I'll test it for a few days to see if everything is fine and then we should be good to go, thanks!

AndreaCrotti avatar Jul 25 '18 12:07 AndreaCrotti

@AndreaCrotti, that makes sense.

I'm looking forward to the merge, so I can wrap up the Elpy side of this transfer of snippets :-)

sten0 avatar Aug 02 '18 23:08 sten0

Hm, I just noticed Elpy uses python-shell-interpreter rather than python-interpreter and it would be nice to inherit that. Not worth blocking this PR though... If you'd like, feel free to add this.

[15 Aug edit: Looked into it some more. Elpy's python-shell-interpreter is supposed to be an interactive shell. From what I remember yasnippet-snippets expects a non-interactive.]

sten0 avatar Aug 06 '18 14:08 sten0

Hi @AndreaCrotti! How did the testing go?

sten0 avatar Aug 15 '18 15:08 sten0

Hi @sten0 I did some testing and one problem I found so far is with the class snippet.

Debugger entered--Lisp error: (wrong-type-argument stringp (yas-snips-snippet-split-args))
  yas--mirror-update-display(#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0) #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)))
  yas--update-mirrors(#s(yas--snippet :expand-env nil :fields (#s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)) #s(yas--field :number 3 :start #<marker at 184 in *myclj*> :end #<marker at 211 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 202 in *myclj*> :end #<marker at 211 in *myclj*> :transform nil :parent-field #3 :next #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)) :depth 1)) #s(yas--field :number 2 :start #<marker at 168 in *myclj*> :end #<marker at 174 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--field :number 3 :start #<marker at 184 in *myclj*> :end #<marker at 211 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 202 in *myclj*> :end #<marker at 211 in *myclj*> :transform nil :parent-field #4 :next #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)) :depth 1))) #s(yas--field :number 1 :start #<marker at 158 in *myclj*> :end #<marker at 167 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0) #s(yas--mirror :start #<marker at 202 in *myclj*> :end #<marker at 211 in *myclj*> :transform nil :parent-field #s(yas--field :number 3 :start #<marker at 184 in *myclj*> :end #<marker at 211 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #5) :next #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)) :depth 1)) :transform nil :modified-p nil :next #s(yas--field :number 2 :start #<marker at 168 in *myclj*> :end #<marker at 174 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--field :number 3 :start #<marker at 184 in *myclj*> :end #<marker at 211 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 202 in *myclj*> :end #<marker at 211 in *myclj*> :transform nil :parent-field #5 :next #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)) :depth 1))))) :exit #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :id 34 :control-overlay nil :active-field nil :previous-active-field nil :force-exit nil))
  yas--snippet-parse-create(#s(yas--snippet :expand-env nil :fields (#s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)) #s(yas--field :number 3 :start #<marker at 184 in *myclj*> :end #<marker at 211 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 202 in *myclj*> :end #<marker at 211 in *myclj*> :transform nil :parent-field #3 :next #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)) :depth 1)) #s(yas--field :number 2 :start #<marker at 168 in *myclj*> :end #<marker at 174 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--field :number 3 :start #<marker at 184 in *myclj*> :end #<marker at 211 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 202 in *myclj*> :end #<marker at 211 in *myclj*> :transform nil :parent-field #4 :next #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)) :depth 1))) #s(yas--field :number 1 :start #<marker at 158 in *myclj*> :end #<marker at 167 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0) #s(yas--mirror :start #<marker at 202 in *myclj*> :end #<marker at 211 in *myclj*> :transform nil :parent-field #s(yas--field :number 3 :start #<marker at 184 in *myclj*> :end #<marker at 211 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #5) :next #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)) :depth 1)) :transform nil :modified-p nil :next #s(yas--field :number 2 :start #<marker at 168 in *myclj*> :end #<marker at 174 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--field :number 3 :start #<marker at 184 in *myclj*> :end #<marker at 211 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 202 in *myclj*> :end #<marker at 211 in *myclj*> :transform nil :parent-field #5 :next #s(yas--field :number 4 :start #<marker at 242 in *myclj*> :end #<marker at 248 in *myclj*> :parent-field nil :mirrors (#s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 265 in *myclj*> :end #<marker at 265 in *myclj*> :transform nil :parent-field nil :next #s(yas--field :number 5 :start #<marker at 282 in *myclj*> :end #<marker at 282 in *myclj*> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--mirror :start #<marker at 292 in *myclj*> :end #<marker at 292 in *myclj*> :transform (yas-snips-snippet-init-assignments yas-text) :parent-field nil :next #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :depth 0)) :depth 0)) :depth 1))))) :exit #s(yas--exit :marker #<marker at 301 in *myclj*> :next nil) :id 34 :control-overlay nil :active-field nil :previous-active-field nil :force-exit nil))
  #f(compiled-function () #<bytecode 0x43ee0a85>)()
  funcall(#f(compiled-function () #<bytecode 0x43ee0a85>))
  (let nil (funcall '#f(compiled-function () #<bytecode 0x43ee0a85>)))
  eval((let nil (funcall '#f(compiled-function () #<bytecode 0x43ee0a85>))))
  yas--snippet-create("class ${1:ClassName}(${2:object}):\n    \"\"\"${3:Documentation for $1}\n\n    \"\"\"\n    def __init__(self${4:, args}):\n        super($1, self).__init__($5)\n        ${4:$(yas-snips-snippet-init-assignments yas-text)}\n        $0\n" nil 152 152)
  yas-expand-snippet("class ${1:ClassName}(${2:object}):\n    \"\"\"${3:Documentation for $1}\n\n    \"\"\"\n    def __init__(self${4:, args}):\n        super($1, self).__init__($5)\n        ${4:$(yas-snips-snippet-init-assignments yas-text)}\n        $0\n" 152 157 nil)
  yas--expand-or-prompt-for-template((("class(parent): ..." . #s(yas--template :key "class" :content "class ${1:ClassName}(${2:object}):\n    \"\"\"${3:Documentation for $1}\n\n    \"\"\"\n    def __init__(self${4:, args}):\n        super($1, self).__init__($5)\n        ${4:$(yas-snips-snippet-init-assignments yas-text)}\n        $0\n" :name "class(parent): ..." :condition nil :expand-env nil :load-file "/Users/acrotti/projects/personal/yasnippet-snippets/snippets/python-mode/class" :save-file nil :keybinding nil :uuid "class(parent): ..." :menu-binding-pair ((menu-item "class(parent): ..." (lambda nil (interactive) (yas--expand-or-visit-from-menu 'python-mode "class(parent): ...")) :keys "class =>")) :group ("Definitions") :perm-group nil :table #s(yas--table :name "python-mode" :hash #<hash-table equal 165/217 0x47c51c4d> :uuidhash #<hash-table equal 169/217 0x465cef55> :parents nil :direct-keymap (keymap))))) 152 157)
  yas-expand()
  funcall-interactively(yas-expand)
  call-interactively(yas-expand nil nil)
  command-execute(yas-expand)

Even though it's weird the changes you've done should not have made it stop working, can you maybe check if you get the same error on that snippet please? Thanks

AndreaCrotti avatar Aug 16 '18 09:08 AndreaCrotti

It's definitively time to get this merged 👍 I'll test it again in the next few days and see if I can get it all working, @sten0 any other blockers I should be careful of?

AndreaCrotti avatar Oct 23 '18 10:10 AndreaCrotti

Thanks @AndreaCrotti ! You noted https://github.com/AndreaCrotti/yasnippet-snippets/pull/278#issuecomment-413476871, and I think this table of duplicate (possibly conflicting?) functionality might be an outstanding issue: https://github.com/AndreaCrotti/yasnippet-snippets/pull/259#issuecomment-386952376 <- probably not a contributing factor to that class [snippet] error, but it seems like it could be a "requires maintainer action" kind of thing.

https://github.com/AndreaCrotti/yasnippet-snippets/pull/278#discussion_r210542665 <- doubtful, but maybe that overwrite/deletion contributes to the class snippet error?

That's everything I'm aware of at the moment. Sorry I'm not able to do more at this time (insane work schedule).

sten0 avatar Oct 23 '18 19:10 sten0

Ok then I'm getting a lot of conflicts now in this PR now and it's a bit hard to merge it all at once.

I think what I'm going to to do is that I'll pick all the snippets that have no Elisp dependencies first (which are quite a lot anyway) and merge them. Then we can think about all the ones that require some changes in the Lisp or existing code in general.

Would that be ok @sten0 ?

AndreaCrotti avatar Feb 02 '19 21:02 AndreaCrotti

@AndreaCrotti, yes, that's fine, please go ahead; it sounds like the best way forward. Once again, sorry I can't yet help out more at this point in time (any free time for this kind of work is going towards Debian bugfix/project deadlines/freeze stuff).

Post-March, I can diff master against https://github.com/sten0/yasnippet-snippets/tree/elpy-snippets to check for missing/conflicting functionality. Of course anyone else is welcome to do so in the meantime...

sten0 avatar Feb 04 '19 07:02 sten0

This PR needs love. How could I help? I hardly read elisp, and never contributed snippets, but if help is needed Python side, I'd gladly help.

From what I see:

  • There's a few simple quotes, while the concensus seems to shift to double quotes (+ black users) (see git grep "'")
  • py3 could be removed, it's only usefull in Python 2 code, which has less and less users (see https://git.afpy.org/mdk/python-versions), same for unicode_literals and with_statement.
  • it misses set_name, maybe a few others but again it could be added in future PRs, I don't want to see this one blocked for this.
  • class could get an **kwargs passed to super for better collaboration (see https://rhettinger.wordpress.com/2011/05/26/super-considered-super/).
  • __coerce__, __long__, __unicode__, __nonzero__, __oct__, __metaclass__ and __hex__ can be removed (were removed in Python 3.0).
  • the key for doctest (being doc) is misleading.
  • enc may be removed, UTF-8 is the default file encoding since Python 3.
  • There's two eq, one in group dunder methods and one in group Special methods.
  • __get__ should have owner=None even if in CPython it's never the case (as far as I know), anyway it's documented as is, let's just stick to the doc.
  • There's a conflict between __getattribute__ and __getattr__: they both have the same key.
  • the pdb can generate breakpoint() instead of import pdb; pdb.set_trace(), samefor tr, I think one could be removed.
  • There's _repr and repr, let's only keep _repr for consistency, same for __str__.
  • There's two try keys.

Some may need to be fixed, some may just wait for another PR.

I think what I'm going to to do is that I'll pick all the snippets that have no Elisp dependencies first (which are quite a lot anyway) and merge them.

looks like a good strategy to me, would you like me to prepare such a PR with my comments applied?

JulienPalard avatar Mar 20 '23 09:03 JulienPalard

Hi Julien,

Julien Palard @.***> writes:

This PR needs love. How could I help? I hardly read elisp, and never contributed snippets, but if help is needed Python side, I'd gladly help.

Please feel free to take over this PR. I'm sure your work will be accepted when you balance the principle of least surprise (established users) with new user expectations and the increasingly urgent need to reflect updates to Python well as current conventions.

[I've ranked your work according to my possibly subjective priorities]

  • py3 could be removed, it's only usefull in Python 2 code, which has less and less users (see https://git.afpy.org/mdk/python-versions), same for unicode_literals and with_statement.
  • enc may be removed, UTF-8 is the default file encoding since Python 3.
  • __coerce__, __long__, __unicode__, __nonzero__, __oct__, __metaclass__ and __hex__ can be removed (were removed in Python 3.0).

+1 It's been three years since Python 2 was sunset!

  • There's two eq, one in group dunder methods and one in group Special methods.
  • __get__ should have owner=None even if in CPython it's never the case (as far as I know), anyway it's documented as is, let's just stick to the doc.

+1 and feel free to choose whichever one seems more consistent to your plan.

  • There's a conflict between __getattribute__ and __getattr__: they both have the same key.
  • the pdb can generate breakpoint() instead of import pdb; pdb.set_trace(), samefor tr, I think one could be removed.
  • There's _repr and repr, let's only keep _repr for consistency, same for __str__.
  • There's two try keys.

Oh yeah, the required deduplication!

  • the key for doctest (being doc) is misleading.

+1

  • it misses set_name, maybe a few others but again it could be added in future PRs, I don't want to see this one blocked for this.

Good call, yes, I agree that a second PR would be the best approach.

  • class could get an **kwargs passed to super for better collaboration (see https://rhettinger.wordpress.com/2011/05/26/super-considered-super/).

I'd put this in the second PR.

  • There's a few simple quotes, while the concensus seems to shift to double quotes (+ black users) (see git grep "'")

I'd also put this in the second PR.

Some may need to be fixed, some may just wait for another PR.

I think what I'm going to to do is that I'll pick all the snippets that have no Elisp dependencies first (which are quite a lot anyway) and merge them.

looks like a good strategy to me, would you like me to prepare such a PR with my comments applied?

When you submit the PR, would you please reference this one (#278)? Andrea did want to merge my PR, but then I ran out of time and motivation.

Cheers, Nicholas

sten0 avatar Mar 22 '23 23:03 sten0

Ah yes @JulienPalard if you want to take care of this it would be great, I'm not using Python anymore so I'm probably not the best person to judge every single snippet, but if everyone is happy I'll be happy to merge

AndreaCrotti avatar Mar 23 '23 17:03 AndreaCrotti