Commit Graph

10 Commits (master)

Author SHA1 Message Date
Stephen Finucane e2dd407c76 Migrate from testr to stestr
Signed-off-by: Stephen Finucane <>
Change-Id: I9dd3a3db55fdd01d46cb7a204be46f7c5f260c4e
2021-02-11 12:33:45 +00:00
Ghanshyam Mann bfc3c48685 Fix hacking min version to 3.0.1
flake8 new release 3.8.0 added new checks and gate pep8
job start failing. hacking 3.0.1 fix the pinning of flake8 to
avoid bringing in a new version with new checks.

Though it is fixed in latest hacking but 2.0 and 3.0 has cap for
flake8 as <4.0.0 which mean flake8 new version 3.9.0 can also
break the pep8 job if new check are added.

To avoid similar gate break in future, we need to bump the hacking min


Change-Id: Icf9fa58f9c9ae9e1bbe436638fe915974543dddb
2020-05-12 19:33:36 -05:00
Zuul 730b701d79 Merge "Update hacking for Python3" 2020-03-31 02:36:45 +00:00
Andreas Jaeger 1f35cce0e7 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

Change-Id: Idffc923ac339978714001be22e3c9ef285e907f5
2020-03-30 12:00:00 +02:00
zhurong 2edd0086fc Fix docs gate
Change-Id: Ibcb463c03e60886baf2ec70728b3ac1087345c7f
2020-03-30 00:29:34 -07:00
Tony Breeds fe128f0672 Use modern PBR and hacking packages
The 2.0.0 is breaking in that it removes the use of warnerrors in

YAQL isn't using that feature, so it shoudln't break.

The cap on pbr is preventing other OpenStack projects that would like to
use pbr 2.0.0 (and sphinx 1.5.1) from doing so as it breaks
co-installability with yaql

Also hacking <0.11 had a similar issue so use a newer version of that also

Change-Id: I23e1d7aa715003250131bf5c88a438f278e4d4da
Related-Bug: 1668848
2017-03-01 16:33:56 +11:00
Swapnil Kulkarni (coolsvap) 76b67a6fbe Remove discover from test-requirements
It's only needed for python < 2.7 which is not supported

Change-Id: I2f630c7e163036bfe29d3a36abbd4d6c5db6b4f4
2016-07-21 07:40:18 +00:00
Kirill Zaitsev 2e8d6d931e Use reno for releasenotes
Change-Id: I6dbb1f5f29afe10c19d05c314602ba6205fecded
2016-07-11 16:46:44 +03:00
Stan Lagun 1d1f187c5c Small improvements to yaql
* context module was renamed to contexts
* convention property is now part of ContextBase class.
* Standard Context implementation automatically uses convention
  from parent context
* Context interface was enhanced to add capability to check key presence,
   get data with different default or not try to access parent context
* MultiContext to virtually merge several contexts without of making them related.
  All merged contexts may have parents of their own which are also merged.
  Source contexts are not modified. This is sort of context mix-in

* keyword arguments (name => value) now require name to be keyword token.
   So f('abc' => value) will not work. This doesnt affect dict() and similar functions
   as they use different argument format.
* tokens that start with two underscores (__) are no more valid. This is done so that it
  would be possible to have auto-injected Python arguments like "__context" without
  affecting possible kwargs of the same function

* Added ability to call delegate (callable) passed as a context value.
  The syntax is $var(args) (or even $(args)).
* Delegate doesn't have to be a context value but also can be result of expression:
  func(args1)(args2), (f() op g())() and so on
* Delegates are disabled by default for security reasons. "allow_delegates" parameter
  was added to both YaqlFactory classes to enable them
* (expr)(args) will be translated to #call(expr, args). So for this to work #call function
  must be present in context. Standard context doesn't provide this function by default.
  Use delegates=True parameter of create_context method (including legacy mode version)
  to register #call() and lambda() functions
* additional lambda(expression) method that returns delegate to passed expression thus
  making it 2nd order lambda. This delegate may be stored in context using let() method
  (or alternatives) or be called as usual. lambda(expression)(args) is equal to expression(args)

Function specs:
* FunctionDefinition now has "meta" dictionary to store arbitrary extended metadata for the
   function (for example version etc.)
* use @specs.meta('key', 'value') decorator to assign meta value to the function. Several
  decorators may be applied to single function
* Context.__call__() / now accept optional function_filter parameter that is a
  predicate (functionDefinition, context -> boolean) to additionally filter function candidates
  based on context values, function metadata and so on.
* returns_context decorator and functionality was removed because it was shawn to be useless
* "__context" and "__engine" parameters where not explicitly declared treated the
  same way as  "context" and "engine"
* added ability to control what type be assigned to parameters without explicit specification
  based on parameter name
* added ability to get function definition with stripped hidden parameters for function wrappers
* refactoring of ParameterDefinition creation code. Code from decorator was moved to a more
  generic set_parameter method of FunctionDefinition to support wider range of scenarios
  (for example to overwrite auto-generated parameter specs)
* FunctionDefinition.__call__ was changed:
  a) order of parameter was changed so the sender could have default value
  b) args now automatically prefixed with sender when provided.
       There is no need to provide it twice anymore
* a helper functions was added to utils to get yaql 0.2 style extension methods specs
  for functions that already registered in context as pure functions or methods

Smart types:
* "context" argument was added to each check() method so that it would be possible to do
  checks using context values. Non of standard smart-types use it, however custom types may do.
* return_context flag was removed from Lambda/Delegate/Super types for the same reasons as in FD
* GenericType helper class was added as a base class for custom non-lazy smart-types simplifying
  their development
* added ability to pass received Lambda (Delegate etc) to another method (or base method version)
  when the later expects it in another format (for example sender had Lambda() while the receiver
  had Lambda(with_context=True))

Standard library:
* "#operator_." method for obj.method() now expects first argument (sender expression) to be object
   (pre-evaluated) rather than Lambda. This doesn't brake anything but allows to override this function
   in child contexts for some more specific types of sender without getting resolution error because of
   several versions of the same function being differ by parameter laziness
* collection.flatten() method was added
* string.matches(regexpString) method was added to complement
   regexp.matches(string) that was before
* string.join(collection) method was added to complement collection.join(string)
   that was before. Also now both functions apply str() function to each element
   of collection
* now int(null) = 0 and float(null) = 0.0

Also bumps requirements to latest OpenStack global-requirements and removes version
number from setup.cfg to use git tag-driven versioning of pbr

Change-Id: I0dd06bf1fb70296157ebb0e9831d2b70d93ca137
2015-07-24 02:54:04 +03:00
Ruslan Kamaldinov c96200fb24 Toxify project
Use tox to test and build the project:
* configuration files are generated from:
* things to be done in later commits:
  - fix failing pep8 checks
  - fix py26 compatibility
  - fix py3.x compatibility
  - add more documentation
2014-07-03 18:01:24 +04:00