Skip to content

Commit 86b2220

Browse files
author
Anders Wallenquist
committed
Merge branch '18.0' of github.com:vertelab/odoo-ai into 18.0
2 parents 2e93f20 + 03717e9 commit 86b2220

12,243 files changed

Lines changed: 4767671 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

IPython/__init__.py

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# PYTHON_ARGCOMPLETE_OK
2+
"""
3+
IPython: tools for interactive and parallel computing in Python.
4+
5+
https://ipython.org
6+
"""
7+
#-----------------------------------------------------------------------------
8+
# Copyright (c) 2008-2011, IPython Development Team.
9+
# Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
10+
# Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
11+
# Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
12+
#
13+
# Distributed under the terms of the Modified BSD License.
14+
#
15+
# The full license is in the file COPYING.txt, distributed with this software.
16+
#-----------------------------------------------------------------------------
17+
18+
#-----------------------------------------------------------------------------
19+
# Imports
20+
#-----------------------------------------------------------------------------
21+
22+
import sys
23+
import warnings
24+
25+
#-----------------------------------------------------------------------------
26+
# Setup everything
27+
#-----------------------------------------------------------------------------
28+
29+
# Don't forget to also update setup.py when this changes!
30+
if sys.version_info < (3, 11):
31+
raise ImportError(
32+
"""
33+
IPython 9.x supports Python 3.11 and above, following SPEC0
34+
IPython 8.19+ supports Python 3.10 and above, following SPEC0.
35+
IPython 8.13+ supports Python 3.9 and above, following NEP 29.
36+
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
37+
Python 3.3 and 3.4 were supported up to IPython 6.x.
38+
Python 3.5 was supported with IPython 7.0 to 7.9.
39+
Python 3.6 was supported with IPython up to 7.16.
40+
Python 3.7 was still supported with the 7.x branch.
41+
42+
See IPython `README.rst` file for more information:
43+
44+
https://github.com/ipython/ipython/blob/main/README.rst
45+
46+
"""
47+
)
48+
49+
#-----------------------------------------------------------------------------
50+
# Setup the top level names
51+
#-----------------------------------------------------------------------------
52+
53+
from .core.getipython import get_ipython
54+
from .core import release
55+
from .core.application import Application
56+
from .terminal.embed import embed
57+
58+
from .core.interactiveshell import InteractiveShell
59+
from .utils.sysinfo import sys_info
60+
from .utils.frame import extract_module_locals
61+
62+
__all__ = ["start_ipython", "embed", "embed_kernel"]
63+
64+
# Release data
65+
__author__ = '%s <%s>' % (release.author, release.author_email)
66+
__license__ = release.license
67+
__version__ = release.version
68+
version_info = release.version_info
69+
# list of CVEs that should have been patched in this release.
70+
# this is informational and should not be relied upon.
71+
__patched_cves__ = {"CVE-2022-21699", "CVE-2023-24816"}
72+
73+
74+
def embed_kernel(module=None, local_ns=None, **kwargs):
75+
"""Embed and start an IPython kernel in a given scope.
76+
77+
If you don't want the kernel to initialize the namespace
78+
from the scope of the surrounding function,
79+
and/or you want to load full IPython configuration,
80+
you probably want `IPython.start_kernel()` instead.
81+
82+
This is a deprecated alias for `ipykernel.embed.embed_kernel()`,
83+
to be removed in the future.
84+
You should import directly from `ipykernel.embed`; this wrapper
85+
fails anyway if you don't have `ipykernel` package installed.
86+
87+
Parameters
88+
----------
89+
module : types.ModuleType, optional
90+
The module to load into IPython globals (default: caller)
91+
local_ns : dict, optional
92+
The namespace to load into IPython user namespace (default: caller)
93+
**kwargs : various, optional
94+
Further keyword args are relayed to the IPKernelApp constructor,
95+
such as `config`, a traitlets :class:`Config` object (see :ref:`configure_start_ipython`),
96+
allowing configuration of the kernel. Will only have an effect
97+
on the first embed_kernel call for a given process.
98+
"""
99+
100+
warnings.warn(
101+
"import embed_kernel from ipykernel.embed directly (since 2013)."
102+
" Importing from IPython will be removed in the future",
103+
DeprecationWarning,
104+
stacklevel=2,
105+
)
106+
107+
(caller_module, caller_locals) = extract_module_locals(1)
108+
if module is None:
109+
module = caller_module
110+
if local_ns is None:
111+
local_ns = dict(**caller_locals)
112+
113+
# Only import .zmq when we really need it
114+
from ipykernel.embed import embed_kernel as real_embed_kernel
115+
real_embed_kernel(module=module, local_ns=local_ns, **kwargs)
116+
117+
def start_ipython(argv=None, **kwargs):
118+
"""Launch a normal IPython instance (as opposed to embedded)
119+
120+
`IPython.embed()` puts a shell in a particular calling scope,
121+
such as a function or method for debugging purposes,
122+
which is often not desirable.
123+
124+
`start_ipython()` does full, regular IPython initialization,
125+
including loading startup files, configuration, etc.
126+
much of which is skipped by `embed()`.
127+
128+
This is a public API method, and will survive implementation changes.
129+
130+
Parameters
131+
----------
132+
argv : list or None, optional
133+
If unspecified or None, IPython will parse command-line options from sys.argv.
134+
To prevent any command-line parsing, pass an empty list: `argv=[]`.
135+
user_ns : dict, optional
136+
specify this dictionary to initialize the IPython user namespace with particular values.
137+
**kwargs : various, optional
138+
Any other kwargs will be passed to the Application constructor,
139+
such as `config`, a traitlets :class:`Config` object (see :ref:`configure_start_ipython`),
140+
allowing configuration of the instance (see :ref:`terminal_options`).
141+
"""
142+
from IPython.terminal.ipapp import launch_new_instance
143+
return launch_new_instance(argv=argv, **kwargs)

IPython/__main__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# PYTHON_ARGCOMPLETE_OK
2+
# encoding: utf-8
3+
"""Terminal-based IPython entry point."""
4+
# -----------------------------------------------------------------------------
5+
# Copyright (c) 2012, IPython Development Team.
6+
#
7+
# Distributed under the terms of the Modified BSD License.
8+
#
9+
# The full license is in the file COPYING.txt, distributed with this software.
10+
# -----------------------------------------------------------------------------
11+
12+
from IPython import start_ipython
13+
14+
start_ipython()

IPython/core/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)