Creating ticket in Bug Tracking system from Klocwork - python

I know that there is possibility to create a python script to send the data to the Bug Tracking System to create new ticket.
However the problem on my side is that there are fields in the ticket that are mandatory while creating it. For these fields there are more options to choose from. These values should be chose by the user. The problem here is that with the script from the tutorial on Klocwork official pages I can't really choose specific option for the field.
Is there some way to create the ticket with python scripts in more steps (retrieving values for fields, choosing options for fields and only then creating the ticket itself) instead of only clicking on the button which does all the work in one step?
Thank you a lot,
Jakub

I work in Klocwork Support and I answered a similar question on the Klocwork support forums as well, which may have also been from you.
The integration method uses a python script run on the Klocwork server side to push the issue to the Bug Tracking system when the user clicks a button. Currently, there is no way to display additional dialogs or UI to the user when they push an issue to the Bug tracker.
One possible workaround is to have the user specify this information in a comment on the defect, which can then be read by the python script and used when submitting the issue to the Bug Tracking system. issue.history is an array of StatusHistoryEvent objects that represent each citing status change and/or comment. So you can easily parse the comments by looping through the events:
for event in issue.history
text = event.comment
# parse out the values depending on how you saved them in the comment

Related

How to programmatically sync anki flashcard database with local file?

I would like to have a script ran by cron or an anki background job that will automatically read in a file (e.g. csv, tsv) containing all my flashcards and update the flashcard database in anki automatically so that i don't have to manually import my flashcards 1000 times a week.
any have any ideas how this can be achieved ?
Some interesting links I've came across, including from answers, that might provide a lead towards solutions:
https://github.com/langfield/ki
https://github.com/patarapolw/ankisync
https://github.com/towercity/anki-cli
The most robust approach there is so far is to have your collection under git, and use Ki to make Anki behave like a remote repository, so it's very easy to synchronise. The only constraint is the format of your collection. Each card is kept as a single file, and there is no real way around this.
I'm the maintainer of ki, one of the tools you linked! I really appreciate the shout-out #BlackBeans.
It's hard to give you perfect advice without more details about your workflow, but it sounds to me like you've got the source-of-truth for your notes in tabular files, and you import these files into Anki when you've made edits or added new notes.
If this is the case, ki may be what you're looking for. As #BlackBeans mentioned, this tool allows you to convert Anki notes into markdown files, and more generally, handles moving your data from your collection to a git repository, and back.
Basically, if the reason why you've got stuff in tabular files is (1) because you want to version it, (2) because you want to use an external editor, or (3) because your content is generated programmatically, then you might gain some use from using ki.
Feel free to open an issue describing your use case in detail. I'd love to give you some support in figuring out a good workflow if you think it would be helpful. I am in need of more user feedback at the moment, so you'd be helping me out, too!

How do I generate the Minecraft launch command for versions 1.8+ in Python?

I am currently working on a little Python project that will function as a custom and highly-configurable launcher for the popular game Minecraft to practice new skills I have been learning recently! However, I am having one problem really throwing me for a loop, and it's just how Minecraft goes about launching the actual game. From my extensive searching, I have learned that the new Minecraft login system sends the user's username and password to authserver.mojang.com/authenticate (the endpoint changing depending on just what is being done) and is returned with an access token, which can be used to log into the game.
(Edit:) What I am asking of you guys is how I would transform the data about where the game is installed and the data received from the POST request into a command that launches the game, alike how it is done in the default launcher. Overnight, I considered looked into the source of the FTB launcher and found this. This is the class for creating this launch command. How could I recreate this in Python?
Note, this question is not a duplicate, the potential duplicates in question are here and here. Both of these questions are relevant to the old launcher, but the new launcher uses a much different process.
Additionally, I have tried the strategy found here. This does not appear to work correctly on later versions, however. Edit: There was a small detail regarding the natives folder I missed. Basically, if I rename the folder to make a static copy, I can then change the natives directory in the command. However, the command still cannot be generated this way for various users.
If anyone has any ideas about this, feedback is much appreciated! Thanks!

How can I retrieve Proxmox node notes?

I am using proxmoxer to manipulate machines on ProxMox (create, delete etc).
Every time I am creating a machine, I provide a description which is being written in ProxMox UI in section "Notes".
I am wondering how can I retrieve that information?
Best would be if it can be done with ProxMox, but if there is not a way to do it with that Python module, I will also be satisfied to do it with plain ProxMox API call.
The description parameter is only a message to show in proxmox UI, and it's not related to any function
You could use https://github.com/baseblack/Proxmoxia to get started, I asked this very same question on the forum as I need to generate some reports from a legacy system with dozens of VMs (and descriptions).
Let me know if you still need this, perhaps we can collaborate on it.

Disable warning message in scribus

When importing a svg file to the DTP programme "Scribus" it shows a warning message (with just one OK-button), that has to be confirmed to go on. This stops my Python Script from working.
So I need a possibility to either confirm the message or - even better - to stop Scribus from showing this message. (something like the "Application.DisplayAlerts = False" in Excel VBA)
A possible solution would be to send an "Enter" command using sendkeys, but I don't like that because the command could miss the target.
Have a look here:
https://pypi.python.org/pypi/pywinauto/0.5.1
and here:
http://pywinauto.github.io/
It might not be a ready solution to your challenge within Scribus, but it might point you in the right direction. Or the developers could help you.
Check the Scribus website too, there is a very helpful mailing list running, which has helped me several times.
And could some veteran please create a "Scribus" tag here?
contributors are working on refactoring those parts of code where scribus blocks the scripts with popups.
patches have already been applied to the 1.5svn development version to better manage them.
my hint to you:
use the stable version for creating your documents
but -- as long as the new stable 1.6 is not out -- use scribus 1.5 for running your scripts unattended, using the documents you created with 1.4
and if you then hit further stoppers report them to the scribus issues tracker (or make a patch and submit it there!)

How can I use readline to enable the user to "scroll" to previously entered lines?

I have a command-line application that works similarly to a shell in that is continuously asks the user for a command and performs a certain action based on the command given. I'd like to implement the "scroll-back" or "history" feature to allow users to use the up and down arrow keys to navigate to and from previously entered lines. I have previously browsed the docs but can't figure it out. Any pointers?
Wow. I didn't think it'd be answered in the docs but it is. Another reason why I love Python. http://docs.python.org/py3k/library/readline.html

Categories