prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  WIP: JuliaRequirement: Add installation methods
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `coalib/bears/requirements/JuliaRequirement.py`
  Content:
  ```
  1 from coalib.bears.requirements.PackageRequirement import PackageRequirement
  2 
  3 
  4 class JuliaRequirement(PackageRequirement):
  5     """
  6     This class is a subclass of ``PackageRequirement``, and helps specifying
  7     requirements from ``julia``, without using the manager name.
  8     """
  9 
  10     def __init__(self, package, version=""):
  11         """
  12         Constructs a new ``JuliaRequirement``, using the ``PackageRequirement``
  13         constructor.
  14 
  15         >>> pr = JuliaRequirement('Lint', '19.2')
  16         >>> pr.manager
  17         'julia'
  18         >>> pr.package
  19         'Lint'
  20         >>> pr.version
  21         '19.2'
  22 
  23         :param package: A string with the name of the package to be installed.
  24         :param version: A version string. Leave empty to specify latest version.
  25         """
  26         PackageRequirement.__init__(self, 'julia', package, version)
  27
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/coalib/bears/requirements/JuliaRequirement.py b/coalib/bears/requirements/JuliaRequirement.py
  --- a/coalib/bears/requirements/JuliaRequirement.py
  +++ b/coalib/bears/requirements/JuliaRequirement.py
  @@ -1,4 +1,9 @@
  +import shlex
  +
   from coalib.bears.requirements.PackageRequirement import PackageRequirement
  +from coalib.misc.Shell import call_without_output
  +
  +from coala_utils.string_processing import escape
   
   
   class JuliaRequirement(PackageRequirement):
  @@ -24,3 +29,31 @@
           :param version: A version string. Leave empty to specify latest version.
           """
           PackageRequirement.__init__(self, 'julia', package, version)
  +
  +    def install_command(self):
  +        """
  +        Creates the installation command for the instance of the class.
  +
  +        >>> JuliaRequirement('Lint').install_command()
  +        'julia -e \\'Pkg.add("Lint")\\''
  +
  +        :return: A string with the installation command.
  +        """
  +        code = 'Pkg.add("{}")'.format(escape(self.package, '\\"'))
  +        args = ('julia', '-e', shlex.quote(code))
  +        return ' '.join(args)
  +
  +    def is_installed(self):
  +        """
  +        Checks if the dependency is installed.
  +
  +        :return: ``True`` if dependency is installed, ``False`` otherwise.
  +        """
  +        # We need to check explicitly if `nothing` is returned, as this happens
  +        # when the package is *registered*, but *not installed*. If it's not
  +        # even registered, julia will throw an exception which lets julia exit
  +        # with an error code different from 0.
  +        code = 'Pkg.installed("{}")==nothing?exit(1):exit(0)'.format(
  +            escape(self.package, '\\"'))
  +        args = ('julia', '-e', code)
  +        return not call_without_output(args)
  
verification_info: {"golden_diff": "diff --git a/coalib/bears/requirements/JuliaRequirement.py b/coalib/bears/requirements/JuliaRequirement.py\n--- a/coalib/bears/requirements/JuliaRequirement.py\n+++ b/coalib/bears/requirements/JuliaRequirement.py\n@@ -1,4 +1,9 @@\n+import shlex\n+\n from coalib.bears.requirements.PackageRequirement import PackageRequirement\n+from coalib.misc.Shell import call_without_output\n+\n+from coala_utils.string_processing import escape\n \n \n class JuliaRequirement(PackageRequirement):\n@@ -24,3 +29,31 @@\n         :param version: A version string. Leave empty to specify latest version.\n         \"\"\"\n         PackageRequirement.__init__(self, 'julia', package, version)\n+\n+    def install_command(self):\n+        \"\"\"\n+        Creates the installation command for the instance of the class.\n+\n+        >>> JuliaRequirement('Lint').install_command()\n+        'julia -e \\\\'Pkg.add(\"Lint\")\\\\''\n+\n+        :return: A string with the installation command.\n+        \"\"\"\n+        code = 'Pkg.add(\"{}\")'.format(escape(self.package, '\\\\\"'))\n+        args = ('julia', '-e', shlex.quote(code))\n+        return ' '.join(args)\n+\n+    def is_installed(self):\n+        \"\"\"\n+        Checks if the dependency is installed.\n+\n+        :return: ``True`` if dependency is installed, ``False`` otherwise.\n+        \"\"\"\n+        # We need to check explicitly if `nothing` is returned, as this happens\n+        # when the package is *registered*, but *not installed*. If it's not\n+        # even registered, julia will throw an exception which lets julia exit\n+        # with an error code different from 0.\n+        code = 'Pkg.installed(\"{}\")==nothing?exit(1):exit(0)'.format(\n+            escape(self.package, '\\\\\"'))\n+        args = ('julia', '-e', code)\n+        return not call_without_output(args)\n", "issue": "WIP: JuliaRequirement: Add installation methods\n\n", "before_files": [{"content": "from coalib.bears.requirements.PackageRequirement import PackageRequirement\n\n\nclass JuliaRequirement(PackageRequirement):\n    \"\"\"\n    This class is a subclass of ``PackageRequirement``, and helps specifying\n    requirements from ``julia``, without using the manager name.\n    \"\"\"\n\n    def __init__(self, package, version=\"\"):\n        \"\"\"\n        Constructs a new ``JuliaRequirement``, using the ``PackageRequirement``\n        constructor.\n\n        >>> pr = JuliaRequirement('Lint', '19.2')\n        >>> pr.manager\n        'julia'\n        >>> pr.package\n        'Lint'\n        >>> pr.version\n        '19.2'\n\n        :param package: A string with the name of the package to be installed.\n        :param version: A version string. Leave empty to specify latest version.\n        \"\"\"\n        PackageRequirement.__init__(self, 'julia', package, version)\n", "path": "coalib/bears/requirements/JuliaRequirement.py"}], "after_files": [{"content": "import shlex\n\nfrom coalib.bears.requirements.PackageRequirement import PackageRequirement\nfrom coalib.misc.Shell import call_without_output\n\nfrom coala_utils.string_processing import escape\n\n\nclass JuliaRequirement(PackageRequirement):\n    \"\"\"\n    This class is a subclass of ``PackageRequirement``, and helps specifying\n    requirements from ``julia``, without using the manager name.\n    \"\"\"\n\n    def __init__(self, package, version=\"\"):\n        \"\"\"\n        Constructs a new ``JuliaRequirement``, using the ``PackageRequirement``\n        constructor.\n\n        >>> pr = JuliaRequirement('Lint', '19.2')\n        >>> pr.manager\n        'julia'\n        >>> pr.package\n        'Lint'\n        >>> pr.version\n        '19.2'\n\n        :param package: A string with the name of the package to be installed.\n        :param version: A version string. Leave empty to specify latest version.\n        \"\"\"\n        PackageRequirement.__init__(self, 'julia', package, version)\n\n    def install_command(self):\n        \"\"\"\n        Creates the installation command for the instance of the class.\n\n        >>> JuliaRequirement('Lint').install_command()\n        'julia -e \\\\'Pkg.add(\"Lint\")\\\\''\n\n        :return: A string with the installation command.\n        \"\"\"\n        code = 'Pkg.add(\"{}\")'.format(escape(self.package, '\\\\\"'))\n        args = ('julia', '-e', shlex.quote(code))\n        return ' '.join(args)\n\n    def is_installed(self):\n        \"\"\"\n        Checks if the dependency is installed.\n\n        :return: ``True`` if dependency is installed, ``False`` otherwise.\n        \"\"\"\n        # We need to check explicitly if `nothing` is returned, as this happens\n        # when the package is *registered*, but *not installed*. If it's not\n        # even registered, julia will throw an exception which lets julia exit\n        # with an error code different from 0.\n        code = 'Pkg.installed(\"{}\")==nothing?exit(1):exit(0)'.format(\n            escape(self.package, '\\\\\"'))\n        args = ('julia', '-e', code)\n        return not call_without_output(args)\n", "path": "coalib/bears/requirements/JuliaRequirement.py"}]}