Re: Python for System Verilog testbench
Bobby ezt írta (időpont: 2018. szept. 14., P 0:16): > > I have a very simple System Verilog (SV) adder as my DUT (device under > test). I would like to generate a test bench for this DUT based on the > 'requirements'. I wrote its (DUT) functions in simple text as > 'requirements' while following a particular syntax. Now through the help > of grammar, I would like to give the requirement input to the grammar. > > Questions: > > (1) Considering my end goal, i.e. to generate some particular parts > of > SV testbench from requirements, any good python parser available > ? > > (2) If I use python parser, will any kind of python scripting will > help me to generate the testbench in SV for my DUT ? My confusion at this > point is that most of all the literature I am reading suggests linguistic > techniques. Any non-linguistic technique ? > > > -- > https://mail.python.org/mailman/listinfo/python-list Hi, Perhaps you should check articles about BDD, and you can use PyTest test framework with pytest-bdd plugin __george__ > > -- https://mail.python.org/mailman/listinfo/python-list
Re: Looking for a Scrapy cheatsheet
The one that sans provides seems pretty decent. Did you not like it? On Thu, Sep 13, 2018 at 4:05 PM Jim wrote: > I'm in the process of learning Scrapy. I've read through the docs and a > couple of tutorials, but I am getting bogged down because I can't find a > page/table/chart that gives a nice concise overview of the available > commands and methods. > > Googling hasn't found anything usable. So does anyone know of a > cheatsheet I can download. > > Thanks, Jim > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
[no subject]
>From vigan Hi i wold like to join in this list because i want to start programing with python pls acept this -- https://mail.python.org/mailman/listinfo/python-list
Python for System Verilog testbench
I have a very simple System Verilog (SV) adder as my DUT (device under test). I would like to generate a test bench for this DUT based on the 'requirements'. I wrote its (DUT) functions in simple text as 'requirements' while following a particular syntax. Now through the help of grammar, I would like to give the requirement input to the grammar. Questions: (1) Considering my end goal, i.e. to generate some particular parts of SV testbench from requirements, any good python parser available ? (2) If I use python parser, will any kind of python scripting will help me to generate the testbench in SV for my DUT ? My confusion at this point is that most of all the literature I am reading suggests linguistic techniques. Any non-linguistic technique ? -- https://mail.python.org/mailman/listinfo/python-list
Re: Help on PyList 3.7.0
On 2018-09-13 21:50, Jason Qian via Python-list wrote: Hey, Need some help on PyList. #get path PyObject *path = PyObject_GetAttrString(sys, "path"); #new user path PyObject* newPath = PyUnicode_DecodeUTF8(userPath, strlen( userPath ), errors); #append newPath to path PyList_Append(path, newPath); How to check if the newPath is already in the path ? So, If the path contains the newPath, I will not append the newpath. Thanks for help A list is a sequence. Use PySequence_Contains. -- https://mail.python.org/mailman/listinfo/python-list
Help on PyList 3.7.0
Hey, Need some help on PyList. #get path PyObject *path = PyObject_GetAttrString(sys, "path"); #new user path PyObject* newPath = PyUnicode_DecodeUTF8(userPath, strlen( userPath ), errors); #append newPath to path PyList_Append(path, newPath); How to check if the newPath is already in the path ? So, If the path contains the newPath, I will not append the newpath. Thanks for help -- https://mail.python.org/mailman/listinfo/python-list
Looking for a Scrapy cheatsheet
I'm in the process of learning Scrapy. I've read through the docs and a couple of tutorials, but I am getting bogged down because I can't find a page/table/chart that gives a nice concise overview of the available commands and methods. Googling hasn't found anything usable. So does anyone know of a cheatsheet I can download. Thanks, Jim -- https://mail.python.org/mailman/listinfo/python-list
Re: Fumbling with emacs + elpy + flake8
Hi Martin, I have messed around alot with the myriad emacs configurations out there. I found spacemacs and threw out my crappy but beloved .emacs config. I have looked back, but will stay put. http://spacemacs.org/ Fumbling is a nice word. Spacemacs caters to lots of programmers. I can honestly recommend giving it a serious look. It's a well conceived emacs configuration. ** Features - Auto-completion using [[https://github.com/proofit404/anaconda-mode][anaconda-mode]] - Code Navigation using [[https://github.com/proofit404/anaconda-mode][anaconda-mode]] - Documentation Lookup using [[https://github.com/proofit404/anaconda-mode][anaconda-mode]] and [[https://github.com/tsgates/pylookup][pylookup]] - Test Runners using [[https://github.com/syl20bnr/nose.el][nose.el]] or [[https://github.com/ionrock/pytest-el][pytest]] - Virtual Environment using [[https://github.com/jorgenschaefer/pyvenv][pyvenv]] and [[https://github.com/yyuu/pyenv][pyenv]] - semantic mode is enabled - PEP8 compliant formatting via [[https://github.com/google/yapf][YAPF]] - PEP8 checks with [[https://pypi.python.org/pypi/flake8][flake8]] or [[https://pypi.python.org/pypi/pylint/1.6.4][pylint]] - Suppression of unused import with [[https://github.com/myint/autoflake][autoflake]] - Use the ~%~ key to jump between blocks with [[https://github.com/redguardtoo/evil-matchit][evil-matchit]] - Sort imports with [[https://pypi.python.org/pypi/isort][isort]] For more see: ~/.emacs.d/layers/+lang/python/README.org Here's what I ask you to consider: pip install flake8 pip install --upgrade "jedi>=0.9.0" "json-rpc>=1.8.1" "service_factory>=0.1.5" if [ -d ~/.emacs.d ]; then \rm -rf ~/.emacs.d/; fi git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d emacs It may be a rabbit hole, but that adventure belongs to emacs, somehow. Cheers Brian -- https://mail.python.org/mailman/listinfo/python-list
Fumbling with emacs + elpy + flake8
I am trying to set up emacs for Python coding on my secondary computer. I follow these instructions but fail to make flake8 play with elpy: https://realpython.com/emacs-the-best-python-editor/#elpy-python-development I have done this some time in the past on my main computer and there it works just fine. I have compared the set-up of this on the two computers and fail to figure out why it works on one and not the other. There are a couple of things that are not the same on the computers: 1) The secondary computer has a later version of emacs installed. 2) I used pip3 install --user flake8 on the secondary computer but on the primary computer I think I left out the --user flag (not knowing about it at the time) but I have added the path to .local/bin and M-x elpy-config finds flake8 on both computers. Yet it does not work on my secondary computer... Any leads are greatly appreciated. /Martin PS Debian on both computers. -- https://mail.python.org/mailman/listinfo/python-list
Re: Trying to use threading.local()
On Fri, Sep 14, 2018 at 1:07 AM, Peter Otten <__pete...@web.de> wrote: > However, the trouble begins with > > a/b # magically determine context > > which has no way to smuggle in a third argument. The workaround while not > pretty is at least straightforward: > > context.divide(a, b) Exactly. You can pass a context to a function or method, but not to an operator. And if you demand that functions/methods be used for absolutely everything, just so you can pass a context around, you require that absolutely everyone write Decimal-exclusive APIs, which are then unable to handle other types of number. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Trying to use threading.local()
Chris Angelico wrote: > On Thu, Sep 13, 2018 at 10:22 PM, Peter Otten <__pete...@web.de> wrote: >> Antoon Pardon wrote: >> >>> On 12-09-18 22:14, Peter Otten wrote: As I understand it you need one local() instance that is shared by all workers. Every thead will then see thread-specific values. >>> >>> It has always puzzled me how this is useful. The times I work with >>> threads, I just put thread specific values in the local variables of the >>> thread function. >> >> That would be my preferred approach, too. Passing around variables >> through multiple levels of function calls may be inconvenient, but global >> variables tend to cause more trouble in the long run. > > "Preferred" doesn't exclude the possibility that alternatives are > needed, though. For example, good luck making decimal.Decimal contexts > work correctly without the help of thread-locals - there MIGHT be a > way to do it, but even if there is, it sure won't be pretty. I'm outside my comfort zone with both threads and decimal, but it appears that you can pass the context explicitly. So getcontext().prec = 10 a = Decimal(1) # magically determine context b = Decimal(3) might become context = Context(prec=10) a = Decimal(1, context=context) b = Decimal(3, context=context) However, the trouble begins with a/b # magically determine context which has no way to smuggle in a third argument. The workaround while not pretty is at least straightforward: context.divide(a, b) -- https://mail.python.org/mailman/listinfo/python-list
Re: Trying to use threading.local()
On Thu, Sep 13, 2018 at 10:22 PM, Peter Otten <__pete...@web.de> wrote: > Antoon Pardon wrote: > >> On 12-09-18 22:14, Peter Otten wrote: >>> As I understand it you need one local() instance that is shared by all >>> workers. Every thead will then see thread-specific values. >> >> It has always puzzled me how this is useful. The times I work with >> threads, I just put thread specific values in the local variables of the >> thread function. > > That would be my preferred approach, too. Passing around variables through > multiple levels of function calls may be inconvenient, but global variables > tend to cause more trouble in the long run. "Preferred" doesn't exclude the possibility that alternatives are needed, though. For example, good luck making decimal.Decimal contexts work correctly without the help of thread-locals - there MIGHT be a way to do it, but even if there is, it sure won't be pretty. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Trying to use threading.local()
Antoon Pardon wrote: > On 12-09-18 22:14, Peter Otten wrote: >> As I understand it you need one local() instance that is shared by all >> workers. Every thead will then see thread-specific values. > > It has always puzzled me how this is useful. The times I work with > threads, I just put thread specific values in the local variables of the > thread function. That would be my preferred approach, too. Passing around variables through multiple levels of function calls may be inconvenient, but global variables tend to cause more trouble in the long run. > What is gained by using threading.local instances? It's magic; it confuses the uninitiated ;) -- https://mail.python.org/mailman/listinfo/python-list
Re: Trying to use threading.local()
On 13Sep2018 12:21, Antoon Pardon wrote: On 12-09-18 22:14, Peter Otten wrote: As I understand it you need one local() instance that is shared by all workers. Every thead will then see thread-specific values. It has always puzzled me how this is useful. The times I work with threads, I just put thread specific values in the local variables of the thread function. That works if your thread function is self contained (only that function needs access to the thread specific values) or you can easily pass the thread specific values on to subsidiary functions if they're needed. What is gained by using threading.local instances? Supposing you've got some longer lived objects which existed before your thread started and survive after it completes, which want to maintain some state for client threads, by which I mean your subsequent threads which may make use of these objects. For this purpose the long lived object wants to keep some distinct state for each client thread, because they may use it concurrently. Consider an object looking after a database, which automatically opens a database connection to serve each client thread when it is accessed. You'd make a threading.local instance to manage this connection, and each thread would see its own distinct connection by accessing that threading.local instance. There's any number of other examples, but they probably all exist around objects essentially external to your thread function which need to provide thread specific state which isn't constructed by the thread function itself but instead as a consequence of the function accessing the long lived object. I've got an example here where I maintain a stack of data source contexts for some data access. Calling code looks like this: with S: ... call functions which make use of "S" implicitly ... with S2: ... here we use "S2" implicitly ... ... back to using "S" ... ... back to whatever was in use previously ... The "S" context manager pushes itself onto a stack, and the access code makes use of whatever is on the top of that stack. This supports generic code which doesn't have to pass "S" to every single function call, including _through_ functions which never use "S" but themselve call other functions which do. So the current "S" is effectively a piece of global context, like the UNIX working directory (it is implicitly used when you open a file with a relative pathname). Now imagine that I have multiple threads working this way. I now need thread specific context stacks. I do this with a threading.local instance, with the stack an attribute of the threading.local. Multiple threads can now freely push and pop from the context stack without interfering with each other. Hoping this clarifies the use case. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: Trying to use threading.local()
On 12-09-18 22:14, Peter Otten wrote: > As I understand it you need one local() instance that is shared by all > workers. Every thead will then see thread-specific values. It has always puzzled me how this is useful. The times I work with threads, I just put thread specific values in the local variables of the thread function. What is gained by using threading.local instances? -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list
Re: trying to connect the setarrange and blendshape input target weight while running the script am getting error in the 8th line. (for each in lip_val_list: )
Your indentation of that line is incorrect. You also have indentation errors on lines 14 and 21. (Possibly more, that's all the further I checked.) Do you understand Python's indentation rules? In the future, you can do a lot better to help us help you. First, tell us the error you got instead of just saying you got an error. (Copy and paste the full error message.) Also tell us what version of Python (2 or 3), and what platform, in case any of that matters. Your subject line contains lots of meaningless distractions: What's a setarrange, what's a blendshape, what's an input target weight, what does it mean to connect them? Either none of that is important (as is the case in this simple indentation error), so don't include such distractions, or it does matter, so take the time to define those terms. Gary Herron On 09/13/2018 12:11 AM, christyso...@gmail.com wrote: lf_main_attr = "head_icon.Lf_Sticky_Lips" rt_main_attr = "head_icon.Rt_Sticky_Lips" lip_val_list = [18, 14] lip_name_list = ['upperLip', 'lowerLip'] name_counter = 0 for each in lip_val_list: half_val = (each / 2) + 1 total_val = each + 1 div_val = 10.0 / half_val counter = 0 while(counter -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list
trying to connect the setarrange and blendshape input target weight while running the script am getting error in the 8th line. (for each in lip_val_list: )
lf_main_attr = "head_icon.Lf_Sticky_Lips" rt_main_attr = "head_icon.Rt_Sticky_Lips" lip_val_list = [18, 14] lip_name_list = ['upperLip', 'lowerLip'] name_counter = 0 for each in lip_val_list: half_val = (each / 2) + 1 total_val = each + 1 div_val = 10.0 / half_val counter = 0 while(counterhttps://mail.python.org/mailman/listinfo/python-list