[python] Eliminate nested resource roots in helpers

Merge-request: IJ-MR-174869
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>

GitOrigin-RevId: 0bf11bb8fe739c9a72615dc5f3de794235d0e589
This commit is contained in:
Egor Eliseev
2025-09-16 08:51:23 +00:00
committed by intellij-monorepo-bot
parent 0210559627
commit f88aaf937f
436 changed files with 14 additions and 33 deletions
-9
View File
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
@@ -1,5 +0,0 @@
# In these files persistent line endings are crucial
# as we use their binary content for hashes.
data/generator3/**/*.py text eol=lf
data/generator3/**/*.so -text
data/remote_sync/**/* text eol=lf
-48
View File
@@ -1,48 +0,0 @@
import os
import sys
import unittest
_tests_dir = os.path.dirname(os.path.abspath(__file__))
_helpers_dir = os.path.dirname(_tests_dir)
def run_specified_tests():
runner = get_test_runner()
unittest.main(module=None, testRunner=runner, argv=sys.argv, exit=True)
def discover_and_run_all_tests():
runner = get_test_runner()
suite = unittest.TestLoader().discover(_tests_dir)
sys.exit(not runner.run(suite).wasSuccessful())
def get_test_runner():
try:
import teamcity
if teamcity.is_running_under_teamcity():
from teamcity.unittestpy import TeamcityTestRunner, TeamcityTestResult
class PythonVersionAwareTestResultClass(TeamcityTestResult):
@staticmethod
def get_test_id(test):
major, minor = sys.version_info[:2]
interpreter_id = 'py{}{}'.format(major, minor)
return '{}.{}'.format(interpreter_id, TeamcityTestResult.get_test_id(test))
class PythonVersionAwareTeamcityTestRunner(TeamcityTestRunner):
resultclass = PythonVersionAwareTestResultClass
return PythonVersionAwareTeamcityTestRunner(buffer=True)
except ImportError:
pass
return unittest.TextTestRunner()
if __name__ == '__main__':
sys.path.append(_helpers_dir)
if len(sys.argv) > 1:
run_specified_tests()
else:
discover_and_run_all_tests()
@@ -1,42 +0,0 @@
Feature: Gherkin v6 Example -- with Rules
Feature description line 1.
Background: Feature.Background
Given feature background step_1
Rule: R1 (with Rule.Background)
Rule R1 description line 1.
Background: R1.Background
Given rule R1 background step_1
When rule R1 background step_2
Example: R1.Scenario_1
When rule R1 scenario_1 step_1
Then rule R1 scenario_1 step_2
Example: R1.Scenario_2
Given rule R1 scenario_2 step_1
Then rule R1 scenario_2 step_2
Rule: R2 (without Rule.Background)
Rule R2 description line 1.
Example: R2.Scenario_1
When rule R2 scenario_1 step_1
Then rule R2 scenario_1 step_2
Rule: R3 (with empty Rule.Background)
Rule R3 description line 1.
Rule R3 description line 2.
Background: R3.EmptyBackground
Scenario Template: R3.Scenario
Given a person named "<name>"
Examples:
| name |
| Alice |
| Bob |
@@ -1,16 +0,0 @@
from behave import step
@step('feature background step_{step_id:d}')
def step_feature_background(ctx, step_id):
print("feature background step_{0}".format(step_id))
@step('rule {rule_id:w} background step_{step_id:d}')
def step_rule_background(ctx, rule_id, step_id):
print("rule {0} background step_{1}".format(rule_id, step_id))
@step('rule {rule_id:w} scenario_{scenario_id:d} step_{step_id:d}')
def step_rule_scenario(ctx, rule_id, scenario_id, step_id):
print("rule {0} scenario_{1} step_{2}".format(rule_id, scenario_id, step_id))
@@ -1,6 +0,0 @@
from behave import given
@given('a person named "{name}"')
def step_given_person_with_name(ctx, name):
pass
@@ -1,44 +0,0 @@
import org.apache.tools.ant.taskdefs.condition.Os
import java.net.URL
import java.nio.file.Path
import kotlin.io.path.div
plugins {
id("com.jetbrains.python.envs") version "0.0.31"
}
val pythonsDirectory: Path = layout.buildDirectory.file("pythons").get().asFile.toPath()
val defaultArchiveWindows = "https://packages.jetbrains.team/files/p/py/python-archives-windows/"
val isWindows = Os.isFamily(Os.FAMILY_WINDOWS)
val pythonExecutableName = if (isWindows) "python.exe" else "bin/python"
val defaultPackages = listOf("teamcity-messages")
envs {
bootstrapDirectory = pythonsDirectory.toFile()
zipRepository = URL(System.getenv().getOrDefault("PYCHARM_ZIP_REPOSITORY", defaultArchiveWindows))
shouldUseZipsFromRepository = isWindows
fun testHelpers(pythonName: String, pythonVersion: String) {
python(pythonName, pythonVersion, defaultPackages)
val pythonExecutable = pythonsDirectory / pythonName / pythonExecutableName
tasks.register<Exec>("Tests for Python ${pythonVersion}") {
mustRunAfter("build_envs")
environment("PYTHONPATH" to ".:..")
commandLine(pythonExecutable, "__main__.py")
}
}
testHelpers("py27_64", "2.7.18")
testHelpers("py38_64", if (isWindows) "3.8.10" else "3.8.19")
testHelpers("py39_64", if (isWindows) "3.9.13" else "3.9.19")
testHelpers("py310_64", if (isWindows) "3.10.11" else "3.10.14")
testHelpers("py311_64", "3.11.9")
testHelpers("py312_64", "3.12.4")
testHelpers("py313_64", "3.13.0")
}
tasks.register("all_tests") {
dependsOn("build_envs", tasks.matching { it.name.startsWith("Tests for Python") })
}
@@ -1 +0,0 @@
<p><span class="rst-formula"><i>F</i>(<span class="sqrt"><span class="radical">√</span><span class="ignored">(</span><span class="root"><i>b</i><sup>2</sup></span><span class="ignored">)</span></span>)</span></p>
@@ -1 +0,0 @@
{"body":":math:`F(\\sqrt{b^2})`\n\nAttributes:\n a1: :math:`F(\\sqrt{b^2})`","fragments":[{"myName":"a1","myDescription":":math:`F(\\sqrt{b^2})`","myFragmentType":"ATTRIBUTE"}]}
@@ -1 +0,0 @@
[{"myDescription":"<span class=\"rst-formula\"><i>F</i>(<span class=\"sqrt\"><span class=\"radical\">√</span><span class=\"ignored\">(</span><span class=\"root\"><i>b</i><sup>2</sup></span><span class=\"ignored\">)</span></span>)</span>","myFragmentType":"ATTRIBUTE","myName":"a1"}]
@@ -1 +0,0 @@
{"body":"Returns: \n bool: True if successful, False otherwise.\n\n The return type is optional and may be specified at the beginning of\n the Returns section followed by a colon.\n\n The Returns section may span multiple lines and paragraphs.\n Following lines should be indented to match the first line.","fragments":[{"myName":"return","myDescription":"True if successful, False otherwise.\n\nThe return type is optional and may be specified at the beginning of\nthe Returns section followed by a colon.\n\nThe Returns section may span multiple lines and paragraphs.\nFollowing lines should be indented to match the first line.","myFragmentType":"RETURN"}]}
@@ -1 +0,0 @@
[{"myDescription":"True if successful, False otherwise.</p>\n<p>The return type is optional and may be specified at the beginning of\nthe Returns section followed by a colon.</p>\n<p>The Returns section may span multiple lines and paragraphs.\nFollowing lines should be indented to match the first line.","myFragmentType":"RETURN","myName":"return"}]
@@ -1 +0,0 @@
<p>Class docstring</p>
@@ -1 +0,0 @@
{"body":"Class docstring\n\nAttributes:\n a1: **bold** `italic1` *italic2* ``code``\n a2: **bold** `italic1` *italic2* ``code``","fragments":[{"myName":"a1","myDescription":"**bold** `italic1` *italic2* ``code``","myFragmentType":"ATTRIBUTE"},{"myName":"a2","myDescription":"**bold** `italic1` *italic2* ``code``","myFragmentType":"ATTRIBUTE"}]}
@@ -1 +0,0 @@
[{"myDescription":"<strong>bold</strong> <cite>italic1</cite> <em>italic2</em> <tt class=\"rst-docutils literal\"><code>code</code></tt>","myFragmentType":"ATTRIBUTE","myName":"a1"},{"myDescription":"<strong>bold</strong> <cite>italic1</cite> <em>italic2</em> <tt class=\"rst-docutils literal\"><code>code</code></tt>","myFragmentType":"ATTRIBUTE","myName":"a2"}]
@@ -1,2 +0,0 @@
<p>Summary</p>
<p>Description</p>
@@ -1,12 +0,0 @@
Summary
Description
.. attribute:: attr1
attr1 description
:type: int
.. attribute:: attr2
attr2 description
@@ -1,6 +0,0 @@
Summary
Description
Attributes:
attr1 (int): attr1 description
attr2: attr2 description
@@ -1,5 +0,0 @@
<p>Summary</p>
<p>Description</p>
<h4 class="heading">See Also</h4>
Some text
Some text
@@ -1,7 +0,0 @@
Summary
Description
.. seealso::
Some text
Some text
@@ -1,6 +0,0 @@
Summary
Description
See also:
Some text
Some text
@@ -1,5 +0,0 @@
def func():
"""
Return:
Long description containing colon: foo
"""
@@ -1,2 +0,0 @@
:returns: Nothing
@@ -1,7 +0,0 @@
<h4 class="heading">See Also</h4>
Nothing
napoleon_use_admonition_for_examples
napoleon_use_admonition_for_examples<h4 class="heading">Example</h4>
<p>Some example follows.</p>
<h4 class="heading">Note</h4>
Some unexceptional note.
@@ -1,11 +0,0 @@
.. seealso::
Nothing
:attr:`napoleon_use_admonition_for_examples`
:attr:`napoleon_use_admonition_for_examples`
.. rubric:: Example
Some example follows.
.. note:: Some unexceptional note.
@@ -1,10 +0,0 @@
See also:
Nothing
:attr:`napoleon_use_admonition_for_examples`
:attr:`napoleon_use_admonition_for_examples`
Example:
Some example follows.
Note:
Some unexceptional note.
@@ -1,46 +0,0 @@
<p>array(object, dtype=None, copy=True, order=None, subok=False, ndmin=0)</p>
<p>Create an array.</p>
<h4 class="heading">See Also</h4>
empty, empty_like, zeros, zeros_like, ones, ones_like, fill<h4 class="heading">Examples</h4>
<pre class="rst-doctest-block">
&gt;&gt;&gt; np.array([1, 2, 3])
array([1, 2, 3])
</pre>
<p>Upcasting:</p>
<pre class="rst-doctest-block">
&gt;&gt;&gt; np.array([1, 2, 3.0])
array([ 1., 2., 3.])
</pre>
<p>More than one dimension:</p>
<pre class="rst-doctest-block">
&gt;&gt;&gt; np.array([[1, 2], [3, 4]])
array([[1, 2],
[3, 4]])
</pre>
<p>Minimum dimensions 2:</p>
<pre class="rst-doctest-block">
&gt;&gt;&gt; np.array([1, 2, 3], ndmin=2)
array([[1, 2, 3]])
</pre>
<p>Type provided:</p>
<pre class="rst-doctest-block">
&gt;&gt;&gt; np.array([1, 2, 3], dtype=complex)
array([ 1.+0.j, 2.+0.j, 3.+0.j])
</pre>
<p>Data-type consisting of more than one element:</p>
<pre class="rst-doctest-block">
&gt;&gt;&gt; x = np.array([(1,2),(3,4)],dtype=[('a','&lt;i4'),('b','&lt;i4')])
&gt;&gt;&gt; x['a']
array([1, 3])
</pre>
<p>Creating an array from sub-classes:</p>
<pre class="rst-doctest-block">
&gt;&gt;&gt; np.array(np.mat('1 2; 3 4'))
array([[1, 2],
[3, 4]])
</pre>
<pre class="rst-doctest-block">
&gt;&gt;&gt; np.array(np.mat('1 2; 3 4'), subok=True)
matrix([[1, 2],
[3, 4]])
</pre>
@@ -1,81 +0,0 @@
array(object, dtype=None, copy=True, order=None, subok=False, ndmin=0)
Create an array.
:param object: An array, any object exposing the array interface, an
object whose __array__ method returns an array, or any
(nested) sequence.
:type object: array_like
:param dtype: The desired data-type for the array. If not given, then
the type will be determined as the minimum type required
to hold the objects in the sequence. This argument can only
be used to 'upcast' the array. For downcasting, use the
.astype(t) method.
:type dtype: data-type, optional
:param copy: If true (default), then the object is copied. Otherwise, a copy
will only be made if __array__ returns a copy, if obj is a
nested sequence, or if a copy is needed to satisfy any of the other
requirements (`dtype`, `order`, etc.).
:type copy: bool, optional
:param order: Specify the order of the array. If order is 'C', then the array
will be in C-contiguous order (last-index varies the fastest).
If order is 'F', then the returned array will be in
Fortran-contiguous order (first-index varies the fastest).
If order is 'A' (default), then the returned array may be
in any order (either C-, Fortran-contiguous, or even discontiguous),
unless a copy is required, in which case it will be C-contiguous.
:type order: {'C', 'F', 'A'}, optional
:param subok: If True, then sub-classes will be passed-through, otherwise
the returned array will be forced to be a base-class array (default).
:type subok: bool, optional
:param ndmin: Specifies the minimum number of dimensions that the resulting
array should have. Ones will be pre-pended to the shape as
needed to meet this requirement.
:type ndmin: int, optional
:returns: **out** -- An array object satisfying the specified requirements.
:rtype: ndarray
.. seealso:: :obj:`empty`, :obj:`empty_like`, :obj:`zeros`, :obj:`zeros_like`, :obj:`ones`, :obj:`ones_like`, :obj:`fill`
.. rubric:: Examples
>>> np.array([1, 2, 3])
array([1, 2, 3])
Upcasting:
>>> np.array([1, 2, 3.0])
array([ 1., 2., 3.])
More than one dimension:
>>> np.array([[1, 2], [3, 4]])
array([[1, 2],
[3, 4]])
Minimum dimensions 2:
>>> np.array([1, 2, 3], ndmin=2)
array([[1, 2, 3]])
Type provided:
>>> np.array([1, 2, 3], dtype=complex)
array([ 1.+0.j, 2.+0.j, 3.+0.j])
Data-type consisting of more than one element:
>>> x = np.array([(1,2),(3,4)],dtype=[('a','<i4'),('b','<i4')])
>>> x['a']
array([1, 3])
Creating an array from sub-classes:
>>> np.array(np.mat('1 2; 3 4'))
array([[1, 2],
[3, 4]])
>>> np.array(np.mat('1 2; 3 4'), subok=True)
matrix([[1, 2],
[3, 4]])
@@ -1,87 +0,0 @@
array(object, dtype=None, copy=True, order=None, subok=False, ndmin=0)
Create an array.
Parameters
----------
object : array_like
An array, any object exposing the array interface, an
object whose __array__ method returns an array, or any
(nested) sequence.
dtype : data-type, optional
The desired data-type for the array. If not given, then
the type will be determined as the minimum type required
to hold the objects in the sequence. This argument can only
be used to 'upcast' the array. For downcasting, use the
.astype(t) method.
copy : bool, optional
If true (default), then the object is copied. Otherwise, a copy
will only be made if __array__ returns a copy, if obj is a
nested sequence, or if a copy is needed to satisfy any of the other
requirements (`dtype`, `order`, etc.).
order : {'C', 'F', 'A'}, optional
Specify the order of the array. If order is 'C', then the array
will be in C-contiguous order (last-index varies the fastest).
If order is 'F', then the returned array will be in
Fortran-contiguous order (first-index varies the fastest).
If order is 'A' (default), then the returned array may be
in any order (either C-, Fortran-contiguous, or even discontiguous),
unless a copy is required, in which case it will be C-contiguous.
subok : bool, optional
If True, then sub-classes will be passed-through, otherwise
the returned array will be forced to be a base-class array (default).
ndmin : int, optional
Specifies the minimum number of dimensions that the resulting
array should have. Ones will be pre-pended to the shape as
needed to meet this requirement.
Returns
-------
out : ndarray
An array object satisfying the specified requirements.
See Also
--------
empty, empty_like, zeros, zeros_like, ones, ones_like, fill
Examples
--------
>>> np.array([1, 2, 3])
array([1, 2, 3])
Upcasting:
>>> np.array([1, 2, 3.0])
array([ 1., 2., 3.])
More than one dimension:
>>> np.array([[1, 2], [3, 4]])
array([[1, 2],
[3, 4]])
Minimum dimensions 2:
>>> np.array([1, 2, 3], ndmin=2)
array([[1, 2, 3]])
Type provided:
>>> np.array([1, 2, 3], dtype=complex)
array([ 1.+0.j, 2.+0.j, 3.+0.j])
Data-type consisting of more than one element:
>>> x = np.array([(1,2),(3,4)],dtype=[('a','<i4'),('b','<i4')])
>>> x['a']
array([1, 3])
Creating an array from sub-classes:
>>> np.array(np.mat('1 2; 3 4'))
array([[1, 2],
[3, 4]])
>>> np.array(np.mat('1 2; 3 4'), subok=True)
matrix([[1, 2],
[3, 4]])
@@ -1 +0,0 @@
<p>Calculate the distance between two points.</p>
@@ -1 +0,0 @@
{"body":"Calculate the distance between two points.\n\nParameters\n----------\nx : `float`\n **балалайка** 哈哈","fragments":[{"myName":"x","myDescription":"**балалайка** 哈哈","myFragmentType":"PARAMETER"}]}
@@ -1 +0,0 @@
[{"myDescription":"<strong>балалайка</strong> 哈哈","myFragmentType":"PARAMETER","myName":"x"}]
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
[{"myDescription":"<p>A DataFrame that contains the metadata for signals, conditions, scalars, or assets. If <cite>metadata</cite> is supplied,\nin conjunction with a <cite>data</cite> DataFrame, it has specific requirements depending on the kind of data supplied.</p>\n<p>Metadata for each object type includes</p>\n<p>Type Key: Si = Signal, Sc = Scalar, C = Condition, A = Asset</p>\n<table border=\"1\" class=\"rst-docutils\">\n<colgroup>\n<col width=\"23%\" />\n<col width=\"57%\" />\n<col width=\"20%\" />\n</colgroup>\n<thead valign=\"bottom\">\n<tr><th class=\"rst-head\">Metadata Term</th>\n<th class=\"rst-head\">Definition</th>\n<th class=\"rst-head\">Applicable Types</th>\n</tr>\n</thead>\n<tbody valign=\"top\">\n<tr><td>Name</td>\n<td>The name of the signal</td>\n<td>Si, Sc, C, A</td>\n</tr>\n<tr><td>Description</td>\n<td>The description of the signal</td>\n<td>Si, Sc, C, A</td>\n</tr>\n<tr><td>Maximum Interpolation</td>\n<td>The maximum interpolation between samples</td>\n<td>Si</td>\n</tr>\n<tr><td>Unit of Measure</td>\n<td>The unit of measure of the values, or keys for conditions</td>\n<td>Si, Sc, C</td>\n</tr>\n<tr><td>Formula</td>\n<td>The formula for a calculated item</td>\n<td>Si, Sc, C</td>\n</tr>\n<tr><td>Formula Parameters</td>\n<td>The parameters for a formula</td>\n<td>Si, Sc, C</td>\n</tr>\n<tr><td>Interpolation Method</td>\n<td>The interpolation method between points options are\n(Linear, Step, PILinear)</td>\n<td>Si</td>\n</tr>\n<tr><td>Maximum Duration</td>\n<td>The maximum expected duration for a capsule</td>\n<td>C</td>\n</tr>\n<tr><td>Number Format</td>\n<td>The formatting string for number, following ECMA-376</td>\n<td>Si, Sc</td>\n</tr>\n<tr><td>Path</td>\n<td>The asset tree path where the item's parent asset resides</td>\n<td>Si, Sc, C, A</td>\n</tr>\n<tr><td>Asset</td>\n<td>The asset that the item is to be a child of. The asset\nmust be in the tree at the specified path, or listed in\n<cite>metadata</cite> for creation.</td>\n<td>Si, Sc, C, A</td>\n</tr>\n</tbody>\n</table>\n","myFragmentType":"PARAMETER","myName":"metadata"}]
@@ -1,2 +0,0 @@
<p>Summary</p>
<p>This is an example of a module level function.</p>
@@ -1,7 +0,0 @@
Summary
This is an example of a module level function.
:param param1: The first parameter.
:type param1: int
:param param2: The second parameter.
:type param2: Optional[str]
@@ -1,9 +0,0 @@
Summary
This is an example of a module level function.
Parameters
----------
param1 : int
The first parameter.
param2 : Optional[str]
The second parameter.
@@ -1,6 +0,0 @@
:param param1: The first parameter.
:type param1: int
:param param2: The second parameter.
:type param2: Optional[str]
:param \*args: Variable length argument list.
:param \*\*kwargs: Arbitrary keyword arguments.
@@ -1,10 +0,0 @@
Parameters
----------
param1 : int
The first parameter.
param2 : Optional[str]
The second parameter.
*args
Variable length argument list.
**kwargs
Arbitrary keyword arguments.
@@ -1 +0,0 @@
<p>This is an example of a module level function.</p>
@@ -1,9 +0,0 @@
This is an example of a module level function.
:param param1: The first parameter.
:type param1: int
:param param2: The second parameter.
:type param2: Optional[str]
:param \*args: Variable length argument list.
:param \*\*kwargs: Arbitrary keyword arguments.
@@ -1,13 +0,0 @@
This is an example of a module level function.
Parameters
----------
param1 : int
The first parameter.
param2 : Optional[str]
The second parameter.
*args
Variable length argument list.
**kwargs
Arbitrary keyword arguments.
@@ -1 +0,0 @@
:rtype dict[str|Reference]:
@@ -1 +0,0 @@
{"body":"**Class** `docstring`\n\n:ivar a: ``a`` **attr** `description`","fragments":[{"myName":"a","myDescription":"``a`` **attr** `description`","myFragmentType":"ATTRIBUTE"}]}
@@ -1 +0,0 @@
{"body":"<p><strong>Class</strong> <cite>docstring</cite></p>\n","fragments":[{"myDescription":"<tt class=\"rst-docutils literal\"><code>a</code></tt> <strong>attr</strong> <cite>description</cite>","myFragmentType":"ATTRIBUTE","myName":"a"}]}
@@ -1 +0,0 @@
<p><strong>Class docstring</strong></p>
@@ -1 +0,0 @@
{"body":"**Class docstring**","fragments":[]}
@@ -1 +0,0 @@
<p>Class docstring</p>
@@ -1 +0,0 @@
{"body":"Class docstring\n\n:ivar attr1: Ελπίζω αυτά τα ``ελληνικά`` γράμματα να μην ανακατέψουν την **τεκμηρίωση**.\n:ivar attr2: **我希望這些信件不會破壞文**","fragments":[{"myName":"attr1","myDescription":"Ελπίζω αυτά τα ``ελληνικά`` γράμματα να μην ανακατέψουν την **τεκμηρίωση**.","myFragmentType":"ATTRIBUTE"},{"myName":"attr2","myDescription":"**我希望這些信件不會破壞文**","myFragmentType":"ATTRIBUTE"}]}
@@ -1 +0,0 @@
[{"myDescription":"Ελπίζω αυτά τα <tt class=\"rst-docutils literal\"><code>ελληνικά</code></tt> γράμματα να μην ανακατέψουν την <strong>τεκμηρίωση</strong>.","myFragmentType":"ATTRIBUTE","myName":"attr1"},{"myDescription":"<strong>我希望這些信件不會破壞文</strong>","myFragmentType":"ATTRIBUTE","myName":"attr2"}]
@@ -1,51 +0,0 @@
<p>Simple interface to writing GIMP plug-ins in Python.</p>
<p>Instead of worrying about all the user interaction, saving last used values
and everything, the gimpfu module can take care of it for you. It provides
a simple register() function that will register your plug-in if needed, and
cause your plug-in function to be called when needed.</p>
<p>Gimpfu will also handle showing a user interface for editing plug-in parameters
if the plug-in is called interactively, and will also save the last used
parameters, so the RUN_WITH_LAST_VALUES run_type will work correctly. It
will also make sure that the displays are flushed on completion if the plug-in
was run interactively.</p>
<p>When registering the plug-in, you do not need to worry about specifying
the run_type parameter.</p>
<dl class="rst-docutils">
<dt>A typical gimpfu plug-in would look like this:</dt>
<dd><p class="rst-first">from gimpfu import *</p>
<dl class="rst-docutils">
<dt>def plugin_func(image, drawable, args):</dt>
<dd>#do what plugins do best</dd>
<dt>register(</dt>
<dd><p class="rst-first">&quot;plugin_func&quot;,
&quot;blurb&quot;,
&quot;help message&quot;,
&quot;author&quot;,
&quot;copyright&quot;,
&quot;year&quot;,
&quot;My plug-in&quot;,
&quot;*&quot;,
[</p>
<br />
(PF_IMAGE, &quot;image&quot;, &quot;Input image&quot;),
(PF_DRAWABLE, &quot;drawable&quot;, &quot;Input drawable&quot;),
(PF_STRING, &quot;arg&quot;, &quot;The argument&quot;, &quot;default-value&quot;)<p class="rst-last">],
[],
plugin_func, menu=&quot;&lt;Image&gt;/Somewhere&quot;)</p>
</dd>
</dl>
<p class="rst-last">main()</p>
</dd>
</dl>
<p>The call to &quot;from gimpfu import *&quot; will import all the gimp constants into
the plug-in namespace, and also import the symbols gimp, pdb, register and
main. This should be just about all any plug-in needs.</p>
<p>You can use any of the PF_* constants below as parameter types, and an
appropriate user interface element will be displayed when the plug-in is
run in interactive mode. Note that the the PF_SPINNER and PF_SLIDER types
expect a fifth element in their description tuple &ndash; a 3-tuple of the form
(lower,upper,step), which defines the limits for the slider or spinner.</p>
<p>If want to localize your plug-in, add an optional domain parameter to the
register call. It can be the name of the translation domain or a tuple that
consists of the translation domain and the directory where the translations
are installed.</p>
@@ -1,53 +0,0 @@
Simple interface to writing GIMP plug-ins in Python.
Instead of worrying about all the user interaction, saving last used values
and everything, the gimpfu module can take care of it for you. It provides
a simple register() function that will register your plug-in if needed, and
cause your plug-in function to be called when needed.
Gimpfu will also handle showing a user interface for editing plug-in parameters
if the plug-in is called interactively, and will also save the last used
parameters, so the RUN_WITH_LAST_VALUES run_type will work correctly. It
will also make sure that the displays are flushed on completion if the plug-in
was run interactively.
When registering the plug-in, you do not need to worry about specifying
the run_type parameter.
A typical gimpfu plug-in would look like this:
from gimpfu import *
def plugin_func(image, drawable, args):
#do what plugins do best
register(
"plugin_func",
"blurb",
"help message",
"author",
"copyright",
"year",
"My plug-in",
"*",
[
(PF_IMAGE, "image", "Input image"),
(PF_DRAWABLE, "drawable", "Input drawable"),
(PF_STRING, "arg", "The argument", "default-value")
],
[],
plugin_func, menu="<Image>/Somewhere")
main()
The call to "from gimpfu import *" will import all the gimp constants into
the plug-in namespace, and also import the symbols gimp, pdb, register and
main. This should be just about all any plug-in needs.
You can use any of the PF_* constants below as parameter types, and an
appropriate user interface element will be displayed when the plug-in is
run in interactive mode. Note that the the PF_SPINNER and PF_SLIDER types
expect a fifth element in their description tuple -- a 3-tuple of the form
(lower,upper,step), which defines the limits for the slider or spinner.
If want to localize your plug-in, add an optional domain parameter to the
register call. It can be the name of the translation domain or a tuple that
consists of the translation domain and the directory where the translations
are installed.
@@ -1,2 +0,0 @@
<p>Function evaluating
<span class="rst-formula"><i>F</i>(<i>a</i>)</span></p>
@@ -1,4 +0,0 @@
Function evaluating
:math:`F(a)`
:param param1: the first parameter
:type param1: `MyClass`
@@ -1 +0,0 @@
<p>Some description</p>
@@ -1,3 +0,0 @@
Some description
:param param1: the first parameter
:type param1: `MyClass`
@@ -1,2 +0,0 @@
:returns: description
:rtype: int
@@ -1,7 +0,0 @@
:param foo: something
:type foo: int
:param int bar: something
:type baz: int
:rtype: str
@@ -1,2 +0,0 @@
<p>Summary.</p>
<p>Main docstring content.</p>
@@ -1,12 +0,0 @@
def func(param, *args, **kwargs):
"""
Summary.
Main docstring content.
:param param:
:param args:
:param kwargs:
:return:
"""
pass
@@ -1,6 +0,0 @@
:type param1: `MyClass`
:param param1: the first parameter
:type param2: :class:`MyClass`
:param param2: the second parameter
:type param3: :py:class:`MyClass`
:param param3: the third parameter

Some files were not shown because too many files have changed in this diff Show More