body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def push(self, variables, interactive=True):
"Inject a group of variables into the IPython user namespace.\n\n Parameters\n ----------\n variables : dict, str or list/tuple of str\n The variables to inject into the user's namespace. If a dict, a\n simple update is done. ... | -5,859,677,587,196,510,000 | Inject a group of variables into the IPython user namespace.
Parameters
----------
variables : dict, str or list/tuple of str
The variables to inject into the user's namespace. If a dict, a
simple update is done. If a str, the string is assumed to have
variable names separated by spaces. A list/tuple of... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | push | CMU-IDS-2022/final-project-the-evaluators | python | def push(self, variables, interactive=True):
"Inject a group of variables into the IPython user namespace.\n\n Parameters\n ----------\n variables : dict, str or list/tuple of str\n The variables to inject into the user's namespace. If a dict, a\n simple update is done. ... |
def drop_by_id(self, variables):
"Remove a dict of variables from the user namespace, if they are the\n same as the values in the dictionary.\n\n This is intended for use by extensions: variables that they've added can\n be taken back out if they are unloaded, without removing any that the\n ... | -4,733,108,409,772,464,000 | Remove a dict of variables from the user namespace, if they are the
same as the values in the dictionary.
This is intended for use by extensions: variables that they've added can
be taken back out if they are unloaded, without removing any that the
user has overwritten.
Parameters
----------
variables : dict
A di... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | drop_by_id | CMU-IDS-2022/final-project-the-evaluators | python | def drop_by_id(self, variables):
"Remove a dict of variables from the user namespace, if they are the\n same as the values in the dictionary.\n\n This is intended for use by extensions: variables that they've added can\n be taken back out if they are unloaded, without removing any that the\n ... |
def _ofind(self, oname, namespaces=None):
'Find an object in the available namespaces.\n\n self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic\n\n Has special code to detect magic functions.\n '
oname = oname.strip()
if ((not oname.startswith(ESC_MAGIC)) and (not oname.starts... | 2,287,905,833,163,156,000 | Find an object in the available namespaces.
self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
Has special code to detect magic functions. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _ofind | CMU-IDS-2022/final-project-the-evaluators | python | def _ofind(self, oname, namespaces=None):
'Find an object in the available namespaces.\n\n self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic\n\n Has special code to detect magic functions.\n '
oname = oname.strip()
if ((not oname.startswith(ESC_MAGIC)) and (not oname.starts... |
@staticmethod
def _getattr_property(obj, attrname):
'Property-aware getattr to use in object finding.\n\n If attrname represents a property, return it unevaluated (in case it has\n side effects or raises an error.\n\n '
if (not isinstance(obj, type)):
try:
attr = getattr... | 2,330,575,836,765,874,700 | Property-aware getattr to use in object finding.
If attrname represents a property, return it unevaluated (in case it has
side effects or raises an error. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _getattr_property | CMU-IDS-2022/final-project-the-evaluators | python | @staticmethod
def _getattr_property(obj, attrname):
'Property-aware getattr to use in object finding.\n\n If attrname represents a property, return it unevaluated (in case it has\n side effects or raises an error.\n\n '
if (not isinstance(obj, type)):
try:
attr = getattr... |
def _object_find(self, oname, namespaces=None):
'Find an object and return a struct with info about it.'
return Struct(self._ofind(oname, namespaces)) | 4,210,069,206,462,534,700 | Find an object and return a struct with info about it. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _object_find | CMU-IDS-2022/final-project-the-evaluators | python | def _object_find(self, oname, namespaces=None):
return Struct(self._ofind(oname, namespaces)) |
def _inspect(self, meth, oname, namespaces=None, **kw):
'Generic interface to the inspector system.\n\n This function is meant to be called by pdef, pdoc & friends.\n '
info = self._object_find(oname, namespaces)
docformat = (sphinxify(self.object_inspect(oname)) if self.sphinxify_docstring el... | -3,827,416,137,922,348,500 | Generic interface to the inspector system.
This function is meant to be called by pdef, pdoc & friends. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _inspect | CMU-IDS-2022/final-project-the-evaluators | python | def _inspect(self, meth, oname, namespaces=None, **kw):
'Generic interface to the inspector system.\n\n This function is meant to be called by pdef, pdoc & friends.\n '
info = self._object_find(oname, namespaces)
docformat = (sphinxify(self.object_inspect(oname)) if self.sphinxify_docstring el... |
def object_inspect(self, oname, detail_level=0):
'Get object info about oname'
with self.builtin_trap:
info = self._object_find(oname)
if info.found:
return self.inspector.info(info.obj, oname, info=info, detail_level=detail_level)
else:
return oinspect.object_inf... | 2,894,528,283,749,319,000 | Get object info about oname | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | object_inspect | CMU-IDS-2022/final-project-the-evaluators | python | def object_inspect(self, oname, detail_level=0):
with self.builtin_trap:
info = self._object_find(oname)
if info.found:
return self.inspector.info(info.obj, oname, info=info, detail_level=detail_level)
else:
return oinspect.object_info(name=oname, found=False) |
def object_inspect_text(self, oname, detail_level=0):
'Get object info as formatted text'
return self.object_inspect_mime(oname, detail_level)['text/plain'] | 1,974,518,146,682,276,600 | Get object info as formatted text | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | object_inspect_text | CMU-IDS-2022/final-project-the-evaluators | python | def object_inspect_text(self, oname, detail_level=0):
return self.object_inspect_mime(oname, detail_level)['text/plain'] |
def object_inspect_mime(self, oname, detail_level=0, omit_sections=()):
"Get object info as a mimebundle of formatted representations.\n\n A mimebundle is a dictionary, keyed by mime-type.\n It must always have the key `'text/plain'`.\n "
with self.builtin_trap:
info = self._object_... | 82,545,009,748,315,410 | Get object info as a mimebundle of formatted representations.
A mimebundle is a dictionary, keyed by mime-type.
It must always have the key `'text/plain'`. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | object_inspect_mime | CMU-IDS-2022/final-project-the-evaluators | python | def object_inspect_mime(self, oname, detail_level=0, omit_sections=()):
"Get object info as a mimebundle of formatted representations.\n\n A mimebundle is a dictionary, keyed by mime-type.\n It must always have the key `'text/plain'`.\n "
with self.builtin_trap:
info = self._object_... |
def init_history(self):
'Sets up the command history, and starts regular autosaves.'
self.history_manager = HistoryManager(shell=self, parent=self)
self.configurables.append(self.history_manager) | -4,752,207,031,469,613,000 | Sets up the command history, and starts regular autosaves. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | init_history | CMU-IDS-2022/final-project-the-evaluators | python | def init_history(self):
self.history_manager = HistoryManager(shell=self, parent=self)
self.configurables.append(self.history_manager) |
def set_custom_exc(self, exc_tuple, handler):
"set_custom_exc(exc_tuple, handler)\n\n Set a custom exception handler, which will be called if any of the\n exceptions in exc_tuple occur in the mainloop (specifically, in the\n run_code() method).\n\n Parameters\n ----------\n ... | 1,156,029,581,014,879,000 | set_custom_exc(exc_tuple, handler)
Set a custom exception handler, which will be called if any of the
exceptions in exc_tuple occur in the mainloop (specifically, in the
run_code() method).
Parameters
----------
exc_tuple : tuple of exception classes
A *tuple* of exception classes, for which to call the defined
... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | set_custom_exc | CMU-IDS-2022/final-project-the-evaluators | python | def set_custom_exc(self, exc_tuple, handler):
"set_custom_exc(exc_tuple, handler)\n\n Set a custom exception handler, which will be called if any of the\n exceptions in exc_tuple occur in the mainloop (specifically, in the\n run_code() method).\n\n Parameters\n ----------\n ... |
def excepthook(self, etype, value, tb):
'One more defense for GUI apps that call sys.excepthook.\n\n GUI frameworks like wxPython trap exceptions and call\n sys.excepthook themselves. I guess this is a feature that\n enables them to keep running after exceptions that would\n otherwise k... | -2,784,476,946,396,066,300 | One more defense for GUI apps that call sys.excepthook.
GUI frameworks like wxPython trap exceptions and call
sys.excepthook themselves. I guess this is a feature that
enables them to keep running after exceptions that would
otherwise kill their mainloop. This is a bother for IPython
which expects to catch all of the... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | excepthook | CMU-IDS-2022/final-project-the-evaluators | python | def excepthook(self, etype, value, tb):
'One more defense for GUI apps that call sys.excepthook.\n\n GUI frameworks like wxPython trap exceptions and call\n sys.excepthook themselves. I guess this is a feature that\n enables them to keep running after exceptions that would\n otherwise k... |
def _get_exc_info(self, exc_tuple=None):
'get exc_info from a given tuple, sys.exc_info() or sys.last_type etc.\n\n Ensures sys.last_type,value,traceback hold the exc_info we found,\n from whichever source.\n\n raises ValueError if none of these contain any information\n '
if (exc_tu... | -1,581,550,018,166,260,500 | get exc_info from a given tuple, sys.exc_info() or sys.last_type etc.
Ensures sys.last_type,value,traceback hold the exc_info we found,
from whichever source.
raises ValueError if none of these contain any information | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _get_exc_info | CMU-IDS-2022/final-project-the-evaluators | python | def _get_exc_info(self, exc_tuple=None):
'get exc_info from a given tuple, sys.exc_info() or sys.last_type etc.\n\n Ensures sys.last_type,value,traceback hold the exc_info we found,\n from whichever source.\n\n raises ValueError if none of these contain any information\n '
if (exc_tu... |
def show_usage_error(self, exc):
"Show a short message for UsageErrors\n\n These are special exceptions that shouldn't show a traceback.\n "
print(('UsageError: %s' % exc), file=sys.stderr) | -1,353,149,073,228,894,000 | Show a short message for UsageErrors
These are special exceptions that shouldn't show a traceback. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | show_usage_error | CMU-IDS-2022/final-project-the-evaluators | python | def show_usage_error(self, exc):
"Show a short message for UsageErrors\n\n These are special exceptions that shouldn't show a traceback.\n "
print(('UsageError: %s' % exc), file=sys.stderr) |
def get_exception_only(self, exc_tuple=None):
'\n Return as a string (ending with a newline) the exception that\n just occurred, without any traceback.\n '
(etype, value, tb) = self._get_exc_info(exc_tuple)
msg = traceback.format_exception_only(etype, value)
return ''.join(msg) | 8,831,226,790,187,812,000 | Return as a string (ending with a newline) the exception that
just occurred, without any traceback. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | get_exception_only | CMU-IDS-2022/final-project-the-evaluators | python | def get_exception_only(self, exc_tuple=None):
'\n Return as a string (ending with a newline) the exception that\n just occurred, without any traceback.\n '
(etype, value, tb) = self._get_exc_info(exc_tuple)
msg = traceback.format_exception_only(etype, value)
return .join(msg) |
def showtraceback(self, exc_tuple=None, filename=None, tb_offset=None, exception_only=False, running_compiled_code=False):
"Display the exception that just occurred.\n\n If nothing is known about the exception, this is the method which\n should be used throughout the code for presenting user traceback... | 6,559,754,494,067,826,000 | Display the exception that just occurred.
If nothing is known about the exception, this is the method which
should be used throughout the code for presenting user tracebacks,
rather than directly invoking the InteractiveTB object.
A specific showsyntaxerror() also exists, but this method can take
care of calling it i... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | showtraceback | CMU-IDS-2022/final-project-the-evaluators | python | def showtraceback(self, exc_tuple=None, filename=None, tb_offset=None, exception_only=False, running_compiled_code=False):
"Display the exception that just occurred.\n\n If nothing is known about the exception, this is the method which\n should be used throughout the code for presenting user traceback... |
def _showtraceback(self, etype, evalue, stb: str):
'Actually show a traceback.\n\n Subclasses may override this method to put the traceback on a different\n place, like a side channel.\n '
val = self.InteractiveTB.stb2text(stb)
try:
print(val)
except UnicodeEncodeError:
... | 7,881,107,553,504,608,000 | Actually show a traceback.
Subclasses may override this method to put the traceback on a different
place, like a side channel. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _showtraceback | CMU-IDS-2022/final-project-the-evaluators | python | def _showtraceback(self, etype, evalue, stb: str):
'Actually show a traceback.\n\n Subclasses may override this method to put the traceback on a different\n place, like a side channel.\n '
val = self.InteractiveTB.stb2text(stb)
try:
print(val)
except UnicodeEncodeError:
... |
def showsyntaxerror(self, filename=None, running_compiled_code=False):
'Display the syntax error that just occurred.\n\n This doesn\'t display a stack trace because there isn\'t one.\n\n If a filename is given, it is stuffed in the exception instead\n of what was there before (because Python\'s... | -400,972,847,223,385,660 | Display the syntax error that just occurred.
This doesn't display a stack trace because there isn't one.
If a filename is given, it is stuffed in the exception instead
of what was there before (because Python's parser always uses
"<string>" when reading from a string).
If the syntax error occurred when running a com... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | showsyntaxerror | CMU-IDS-2022/final-project-the-evaluators | python | def showsyntaxerror(self, filename=None, running_compiled_code=False):
'Display the syntax error that just occurred.\n\n This doesn\'t display a stack trace because there isn\'t one.\n\n If a filename is given, it is stuffed in the exception instead\n of what was there before (because Python\'s... |
def showindentationerror(self):
"Called by _run_cell when there's an IndentationError in code entered\n at the prompt.\n\n This is overridden in TerminalInteractiveShell to show a message about\n the %paste magic."
self.showsyntaxerror() | -2,445,171,455,265,809,000 | Called by _run_cell when there's an IndentationError in code entered
at the prompt.
This is overridden in TerminalInteractiveShell to show a message about
the %paste magic. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | showindentationerror | CMU-IDS-2022/final-project-the-evaluators | python | def showindentationerror(self):
"Called by _run_cell when there's an IndentationError in code entered\n at the prompt.\n\n This is overridden in TerminalInteractiveShell to show a message about\n the %paste magic."
self.showsyntaxerror() |
@skip_doctest
def set_next_input(self, s, replace=False):
' Sets the \'default\' input string for the next command line.\n\n Example::\n\n In [1]: _ip.set_next_input("Hello Word")\n In [2]: Hello Word_ # cursor is here\n '
self.rl_next_input = s | -5,104,023,393,772,409,000 | Sets the 'default' input string for the next command line.
Example::
In [1]: _ip.set_next_input("Hello Word")
In [2]: Hello Word_ # cursor is here | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | set_next_input | CMU-IDS-2022/final-project-the-evaluators | python | @skip_doctest
def set_next_input(self, s, replace=False):
' Sets the \'default\' input string for the next command line.\n\n Example::\n\n In [1]: _ip.set_next_input("Hello Word")\n In [2]: Hello Word_ # cursor is here\n '
self.rl_next_input = s |
def _indent_current_str(self):
'return the current level of indentation as a string'
return (self.input_splitter.get_indent_spaces() * ' ') | -2,322,617,927,592,505,300 | return the current level of indentation as a string | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _indent_current_str | CMU-IDS-2022/final-project-the-evaluators | python | def _indent_current_str(self):
return (self.input_splitter.get_indent_spaces() * ' ') |
def init_completer(self):
'Initialize the completion machinery.\n\n This creates completion machinery that can be used by client code,\n either interactively in-process (typically triggered by the readline\n library), programmatically (such as in test suites) or out-of-process\n (typical... | -7,401,544,314,293,828,000 | Initialize the completion machinery.
This creates completion machinery that can be used by client code,
either interactively in-process (typically triggered by the readline
library), programmatically (such as in test suites) or out-of-process
(typically over the network by remote frontends). | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | init_completer | CMU-IDS-2022/final-project-the-evaluators | python | def init_completer(self):
'Initialize the completion machinery.\n\n This creates completion machinery that can be used by client code,\n either interactively in-process (typically triggered by the readline\n library), programmatically (such as in test suites) or out-of-process\n (typical... |
@skip_doctest
def complete(self, text, line=None, cursor_pos=None):
"Return the completed text and a list of completions.\n\n Parameters\n ----------\n text : string\n A string of text to be completed on. It can be given as empty and\n instead a line/position pair are giv... | 7,560,008,023,491,622,000 | Return the completed text and a list of completions.
Parameters
----------
text : string
A string of text to be completed on. It can be given as empty and
instead a line/position pair are given. In this case, the
completer itself will split the line like readline does.
line : string, optional
The com... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | complete | CMU-IDS-2022/final-project-the-evaluators | python | @skip_doctest
def complete(self, text, line=None, cursor_pos=None):
"Return the completed text and a list of completions.\n\n Parameters\n ----------\n text : string\n A string of text to be completed on. It can be given as empty and\n instead a line/position pair are giv... |
def set_custom_completer(self, completer, pos=0) -> None:
'Adds a new custom completer function.\n\n The position argument (defaults to 0) is the index in the completers\n list where you want the completer to be inserted.\n\n `completer` should have the following signature::\n\n def ... | 1,712,199,540,969,657,000 | Adds a new custom completer function.
The position argument (defaults to 0) is the index in the completers
list where you want the completer to be inserted.
`completer` should have the following signature::
def completion(self: Completer, text: string) -> List[str]:
raise NotImplementedError
It will be ... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | set_custom_completer | CMU-IDS-2022/final-project-the-evaluators | python | def set_custom_completer(self, completer, pos=0) -> None:
'Adds a new custom completer function.\n\n The position argument (defaults to 0) is the index in the completers\n list where you want the completer to be inserted.\n\n `completer` should have the following signature::\n\n def ... |
def set_completer_frame(self, frame=None):
'Set the frame of the completer.'
if frame:
self.Completer.namespace = frame.f_locals
self.Completer.global_namespace = frame.f_globals
else:
self.Completer.namespace = self.user_ns
self.Completer.global_namespace = self.user_global_... | 8,642,129,015,974,338,000 | Set the frame of the completer. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | set_completer_frame | CMU-IDS-2022/final-project-the-evaluators | python | def set_completer_frame(self, frame=None):
if frame:
self.Completer.namespace = frame.f_locals
self.Completer.global_namespace = frame.f_globals
else:
self.Completer.namespace = self.user_ns
self.Completer.global_namespace = self.user_global_ns |
def _find_with_lazy_load(self, /, type_, magic_name: str):
'\n Try to find a magic potentially lazy-loading it.\n\n Parameters\n ----------\n\n type_: "line"|"cell"\n the type of magics we are trying to find/lazy load.\n magic_name: str\n The name of the magi... | 8,904,485,724,808,844,000 | Try to find a magic potentially lazy-loading it.
Parameters
----------
type_: "line"|"cell"
the type of magics we are trying to find/lazy load.
magic_name: str
The name of the magic we are trying to find/lazy load
Note that this may have any side effects | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _find_with_lazy_load | CMU-IDS-2022/final-project-the-evaluators | python | def _find_with_lazy_load(self, /, type_, magic_name: str):
'\n Try to find a magic potentially lazy-loading it.\n\n Parameters\n ----------\n\n type_: "line"|"cell"\n the type of magics we are trying to find/lazy load.\n magic_name: str\n The name of the magi... |
def run_line_magic(self, magic_name: str, line, _stack_depth=1):
"Execute the given line magic.\n\n Parameters\n ----------\n magic_name : str\n Name of the desired magic function, without '%' prefix.\n line : str\n The rest of the input line as a single string.\n ... | -1,421,345,955,084,087,300 | Execute the given line magic.
Parameters
----------
magic_name : str
Name of the desired magic function, without '%' prefix.
line : str
The rest of the input line as a single string.
_stack_depth : int
If run_line_magic() is called from magic() then _stack_depth=2.
This is added to ensure backward comp... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | run_line_magic | CMU-IDS-2022/final-project-the-evaluators | python | def run_line_magic(self, magic_name: str, line, _stack_depth=1):
"Execute the given line magic.\n\n Parameters\n ----------\n magic_name : str\n Name of the desired magic function, without '%' prefix.\n line : str\n The rest of the input line as a single string.\n ... |
def get_local_scope(self, stack_depth):
'Get local scope at given stack depth.\n\n Parameters\n ----------\n stack_depth : int\n Depth relative to calling frame\n '
return sys._getframe((stack_depth + 1)).f_locals | -7,622,405,648,547,966,000 | Get local scope at given stack depth.
Parameters
----------
stack_depth : int
Depth relative to calling frame | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | get_local_scope | CMU-IDS-2022/final-project-the-evaluators | python | def get_local_scope(self, stack_depth):
'Get local scope at given stack depth.\n\n Parameters\n ----------\n stack_depth : int\n Depth relative to calling frame\n '
return sys._getframe((stack_depth + 1)).f_locals |
def run_cell_magic(self, magic_name, line, cell):
"Execute the given cell magic.\n\n Parameters\n ----------\n magic_name : str\n Name of the desired magic function, without '%' prefix.\n line : str\n The rest of the first input line as a single string.\n cel... | -2,436,769,280,446,700,500 | Execute the given cell magic.
Parameters
----------
magic_name : str
Name of the desired magic function, without '%' prefix.
line : str
The rest of the first input line as a single string.
cell : str
The body of the cell as a (possibly multiline) string. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | run_cell_magic | CMU-IDS-2022/final-project-the-evaluators | python | def run_cell_magic(self, magic_name, line, cell):
"Execute the given cell magic.\n\n Parameters\n ----------\n magic_name : str\n Name of the desired magic function, without '%' prefix.\n line : str\n The rest of the first input line as a single string.\n cel... |
def find_line_magic(self, magic_name):
"Find and return a line magic by name.\n\n Returns None if the magic isn't found."
return self.magics_manager.magics['line'].get(magic_name) | -1,560,656,864,380,957,700 | Find and return a line magic by name.
Returns None if the magic isn't found. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | find_line_magic | CMU-IDS-2022/final-project-the-evaluators | python | def find_line_magic(self, magic_name):
"Find and return a line magic by name.\n\n Returns None if the magic isn't found."
return self.magics_manager.magics['line'].get(magic_name) |
def find_cell_magic(self, magic_name):
"Find and return a cell magic by name.\n\n Returns None if the magic isn't found."
return self.magics_manager.magics['cell'].get(magic_name) | -8,217,593,389,607,089,000 | Find and return a cell magic by name.
Returns None if the magic isn't found. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | find_cell_magic | CMU-IDS-2022/final-project-the-evaluators | python | def find_cell_magic(self, magic_name):
"Find and return a cell magic by name.\n\n Returns None if the magic isn't found."
return self.magics_manager.magics['cell'].get(magic_name) |
def find_magic(self, magic_name, magic_kind='line'):
"Find and return a magic of the given type by name.\n\n Returns None if the magic isn't found."
return self.magics_manager.magics[magic_kind].get(magic_name) | -6,144,807,989,137,011,000 | Find and return a magic of the given type by name.
Returns None if the magic isn't found. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | find_magic | CMU-IDS-2022/final-project-the-evaluators | python | def find_magic(self, magic_name, magic_kind='line'):
"Find and return a magic of the given type by name.\n\n Returns None if the magic isn't found."
return self.magics_manager.magics[magic_kind].get(magic_name) |
def magic(self, arg_s):
"\n DEPRECATED\n\n Deprecated since IPython 0.13 (warning added in\n 8.1), use run_line_magic(magic_name, parameter_s).\n\n Call a magic function by name.\n\n Input: a string containing the name of the magic function to call and\n any additional argu... | -2,321,915,023,604,814,000 | DEPRECATED
Deprecated since IPython 0.13 (warning added in
8.1), use run_line_magic(magic_name, parameter_s).
Call a magic function by name.
Input: a string containing the name of the magic function to call and
any additional arguments to be passed to the magic.
magic('name -opt foo bar') is equivalent to typing at... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | magic | CMU-IDS-2022/final-project-the-evaluators | python | def magic(self, arg_s):
"\n DEPRECATED\n\n Deprecated since IPython 0.13 (warning added in\n 8.1), use run_line_magic(magic_name, parameter_s).\n\n Call a magic function by name.\n\n Input: a string containing the name of the magic function to call and\n any additional argu... |
def define_macro(self, name, themacro):
'Define a new macro\n\n Parameters\n ----------\n name : str\n The name of the macro.\n themacro : str or Macro\n The action to do upon invoking the macro. If a string, a new\n Macro object is created by passing th... | 2,617,882,264,026,802,700 | Define a new macro
Parameters
----------
name : str
The name of the macro.
themacro : str or Macro
The action to do upon invoking the macro. If a string, a new
Macro object is created by passing the string to it. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | define_macro | CMU-IDS-2022/final-project-the-evaluators | python | def define_macro(self, name, themacro):
'Define a new macro\n\n Parameters\n ----------\n name : str\n The name of the macro.\n themacro : str or Macro\n The action to do upon invoking the macro. If a string, a new\n Macro object is created by passing th... |
def system_piped(self, cmd):
"Call the given cmd in a subprocess, piping stdout/err\n\n Parameters\n ----------\n cmd : str\n Command to execute (can not end in '&', as background processes are\n not supported. Should not be a command that expects input\n other... | 5,190,823,872,524,154,000 | Call the given cmd in a subprocess, piping stdout/err
Parameters
----------
cmd : str
Command to execute (can not end in '&', as background processes are
not supported. Should not be a command that expects input
other than simple text. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | system_piped | CMU-IDS-2022/final-project-the-evaluators | python | def system_piped(self, cmd):
"Call the given cmd in a subprocess, piping stdout/err\n\n Parameters\n ----------\n cmd : str\n Command to execute (can not end in '&', as background processes are\n not supported. Should not be a command that expects input\n other... |
def system_raw(self, cmd):
'Call the given cmd in a subprocess using os.system on Windows or\n subprocess.call using the system shell on other platforms.\n\n Parameters\n ----------\n cmd : str\n Command to execute.\n '
cmd = self.var_expand(cmd, depth=1)
main_c... | -315,671,862,176,692,400 | Call the given cmd in a subprocess using os.system on Windows or
subprocess.call using the system shell on other platforms.
Parameters
----------
cmd : str
Command to execute. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | system_raw | CMU-IDS-2022/final-project-the-evaluators | python | def system_raw(self, cmd):
'Call the given cmd in a subprocess using os.system on Windows or\n subprocess.call using the system shell on other platforms.\n\n Parameters\n ----------\n cmd : str\n Command to execute.\n '
cmd = self.var_expand(cmd, depth=1)
main_c... |
def getoutput(self, cmd, split=True, depth=0):
"Get output (possibly including stderr) from a subprocess.\n\n Parameters\n ----------\n cmd : str\n Command to execute (can not end in '&', as background processes are\n not supported.\n split : bool, optional\n ... | 4,511,267,334,332,850,700 | Get output (possibly including stderr) from a subprocess.
Parameters
----------
cmd : str
Command to execute (can not end in '&', as background processes are
not supported.
split : bool, optional
If True, split the output into an IPython SList. Otherwise, an
IPython LSString is returned. These are ob... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | getoutput | CMU-IDS-2022/final-project-the-evaluators | python | def getoutput(self, cmd, split=True, depth=0):
"Get output (possibly including stderr) from a subprocess.\n\n Parameters\n ----------\n cmd : str\n Command to execute (can not end in '&', as background processes are\n not supported.\n split : bool, optional\n ... |
def auto_rewrite_input(self, cmd):
"Print to the screen the rewritten form of the user's command.\n\n This shows visual feedback by rewriting input lines that cause\n automatic calling to kick in, like::\n\n /f x\n\n into::\n\n ------> f(x)\n\n after the user's input pr... | -1,554,820,592,618,844,000 | Print to the screen the rewritten form of the user's command.
This shows visual feedback by rewriting input lines that cause
automatic calling to kick in, like::
/f x
into::
------> f(x)
after the user's input prompt. This helps the user understand that the
input line was transformed automatically by IPython. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | auto_rewrite_input | CMU-IDS-2022/final-project-the-evaluators | python | def auto_rewrite_input(self, cmd):
"Print to the screen the rewritten form of the user's command.\n\n This shows visual feedback by rewriting input lines that cause\n automatic calling to kick in, like::\n\n /f x\n\n into::\n\n ------> f(x)\n\n after the user's input pr... |
def _user_obj_error(self):
'return simple exception dict\n\n for use in user_expressions\n '
(etype, evalue, tb) = self._get_exc_info()
stb = self.InteractiveTB.get_exception_only(etype, evalue)
exc_info = {'status': 'error', 'traceback': stb, 'ename': etype.__name__, 'evalue': py3compat.s... | 2,699,344,948,278,257,700 | return simple exception dict
for use in user_expressions | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _user_obj_error | CMU-IDS-2022/final-project-the-evaluators | python | def _user_obj_error(self):
'return simple exception dict\n\n for use in user_expressions\n '
(etype, evalue, tb) = self._get_exc_info()
stb = self.InteractiveTB.get_exception_only(etype, evalue)
exc_info = {'status': 'error', 'traceback': stb, 'ename': etype.__name__, 'evalue': py3compat.s... |
def _format_user_obj(self, obj):
'format a user object to display dict\n\n for use in user_expressions\n '
(data, md) = self.display_formatter.format(obj)
value = {'status': 'ok', 'data': data, 'metadata': md}
return value | 3,523,793,102,233,199,600 | format a user object to display dict
for use in user_expressions | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _format_user_obj | CMU-IDS-2022/final-project-the-evaluators | python | def _format_user_obj(self, obj):
'format a user object to display dict\n\n for use in user_expressions\n '
(data, md) = self.display_formatter.format(obj)
value = {'status': 'ok', 'data': data, 'metadata': md}
return value |
def user_expressions(self, expressions):
"Evaluate a dict of expressions in the user's namespace.\n\n Parameters\n ----------\n expressions : dict\n A dict with string keys and string values. The expression values\n should be valid Python expressions, each of which will b... | 7,821,608,805,693,288,000 | Evaluate a dict of expressions in the user's namespace.
Parameters
----------
expressions : dict
A dict with string keys and string values. The expression values
should be valid Python expressions, each of which will be evaluated
in the user namespace.
Returns
-------
A dict, keyed like the input express... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | user_expressions | CMU-IDS-2022/final-project-the-evaluators | python | def user_expressions(self, expressions):
"Evaluate a dict of expressions in the user's namespace.\n\n Parameters\n ----------\n expressions : dict\n A dict with string keys and string values. The expression values\n should be valid Python expressions, each of which will b... |
def ex(self, cmd):
'Execute a normal python statement in user namespace.'
with self.builtin_trap:
exec(cmd, self.user_global_ns, self.user_ns) | -8,521,159,763,174,122,000 | Execute a normal python statement in user namespace. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | ex | CMU-IDS-2022/final-project-the-evaluators | python | def ex(self, cmd):
with self.builtin_trap:
exec(cmd, self.user_global_ns, self.user_ns) |
def ev(self, expr):
'Evaluate python expression expr in user namespace.\n\n Returns the result of evaluation\n '
with self.builtin_trap:
return eval(expr, self.user_global_ns, self.user_ns) | 1,279,435,246,166,427,000 | Evaluate python expression expr in user namespace.
Returns the result of evaluation | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | ev | CMU-IDS-2022/final-project-the-evaluators | python | def ev(self, expr):
'Evaluate python expression expr in user namespace.\n\n Returns the result of evaluation\n '
with self.builtin_trap:
return eval(expr, self.user_global_ns, self.user_ns) |
def safe_execfile(self, fname, *where, exit_ignore=False, raise_exceptions=False, shell_futures=False):
'A safe version of the builtin execfile().\n\n This version will never throw an exception, but instead print\n helpful error messages to the screen. This only works on pure\n Python files wi... | -7,730,719,002,565,649,000 | A safe version of the builtin execfile().
This version will never throw an exception, but instead print
helpful error messages to the screen. This only works on pure
Python files with the .py extension.
Parameters
----------
fname : string
The name of the file to be executed.
*where : tuple
One or two namesp... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | safe_execfile | CMU-IDS-2022/final-project-the-evaluators | python | def safe_execfile(self, fname, *where, exit_ignore=False, raise_exceptions=False, shell_futures=False):
'A safe version of the builtin execfile().\n\n This version will never throw an exception, but instead print\n helpful error messages to the screen. This only works on pure\n Python files wi... |
def safe_execfile_ipy(self, fname, shell_futures=False, raise_exceptions=False):
'Like safe_execfile, but for .ipy or .ipynb files with IPython syntax.\n\n Parameters\n ----------\n fname : str\n The name of the file to execute. The filename must have a\n .ipy or .ipynb e... | 3,980,181,048,136,969,000 | Like safe_execfile, but for .ipy or .ipynb files with IPython syntax.
Parameters
----------
fname : str
The name of the file to execute. The filename must have a
.ipy or .ipynb extension.
shell_futures : bool (False)
If True, the code will share future statements with the interactive
shell. It will bo... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | safe_execfile_ipy | CMU-IDS-2022/final-project-the-evaluators | python | def safe_execfile_ipy(self, fname, shell_futures=False, raise_exceptions=False):
'Like safe_execfile, but for .ipy or .ipynb files with IPython syntax.\n\n Parameters\n ----------\n fname : str\n The name of the file to execute. The filename must have a\n .ipy or .ipynb e... |
def safe_run_module(self, mod_name, where):
'A safe version of runpy.run_module().\n\n This version will never throw an exception, but instead print\n helpful error messages to the screen.\n\n `SystemExit` exceptions with status code 0 or None are ignored.\n\n Parameters\n -------... | -3,417,527,296,892,662,300 | A safe version of runpy.run_module().
This version will never throw an exception, but instead print
helpful error messages to the screen.
`SystemExit` exceptions with status code 0 or None are ignored.
Parameters
----------
mod_name : string
The name of the module to be executed.
where : dict
The globals nam... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | safe_run_module | CMU-IDS-2022/final-project-the-evaluators | python | def safe_run_module(self, mod_name, where):
'A safe version of runpy.run_module().\n\n This version will never throw an exception, but instead print\n helpful error messages to the screen.\n\n `SystemExit` exceptions with status code 0 or None are ignored.\n\n Parameters\n -------... |
def run_cell(self, raw_cell, store_history=False, silent=False, shell_futures=True):
"Run a complete IPython cell.\n\n Parameters\n ----------\n raw_cell : str\n The code (including IPython code such as %magic functions) to run.\n store_history : bool\n If True, the... | 2,433,717,764,190,113,300 | Run a complete IPython cell.
Parameters
----------
raw_cell : str
The code (including IPython code such as %magic functions) to run.
store_history : bool
If True, the raw and translated cell will be stored in IPython's
history. For user code calling back into IPython's machinery, this
should be set to ... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | run_cell | CMU-IDS-2022/final-project-the-evaluators | python | def run_cell(self, raw_cell, store_history=False, silent=False, shell_futures=True):
"Run a complete IPython cell.\n\n Parameters\n ----------\n raw_cell : str\n The code (including IPython code such as %magic functions) to run.\n store_history : bool\n If True, the... |
def _run_cell(self, raw_cell: str, store_history: bool, silent: bool, shell_futures: bool) -> ExecutionResult:
'Internal method to run a complete IPython cell.'
preprocessing_exc_tuple = None
try:
transformed_cell = self.transform_cell(raw_cell)
except Exception:
transformed_cell = raw_c... | -2,686,586,060,926,013,000 | Internal method to run a complete IPython cell. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _run_cell | CMU-IDS-2022/final-project-the-evaluators | python | def _run_cell(self, raw_cell: str, store_history: bool, silent: bool, shell_futures: bool) -> ExecutionResult:
preprocessing_exc_tuple = None
try:
transformed_cell = self.transform_cell(raw_cell)
except Exception:
transformed_cell = raw_cell
preprocessing_exc_tuple = sys.exc_inf... |
def should_run_async(self, raw_cell: str, *, transformed_cell=None, preprocessing_exc_tuple=None) -> bool:
'Return whether a cell should be run asynchronously via a coroutine runner\n\n Parameters\n ----------\n raw_cell : str\n The code to be executed\n\n Returns\n ---... | 6,896,903,336,297,241,000 | Return whether a cell should be run asynchronously via a coroutine runner
Parameters
----------
raw_cell : str
The code to be executed
Returns
-------
result: bool
Whether the code needs to be run with a coroutine runner or not
.. versionadded:: 7.0 | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | should_run_async | CMU-IDS-2022/final-project-the-evaluators | python | def should_run_async(self, raw_cell: str, *, transformed_cell=None, preprocessing_exc_tuple=None) -> bool:
'Return whether a cell should be run asynchronously via a coroutine runner\n\n Parameters\n ----------\n raw_cell : str\n The code to be executed\n\n Returns\n ---... |
async def run_cell_async(self, raw_cell: str, store_history=False, silent=False, shell_futures=True, *, transformed_cell: Optional[str]=None, preprocessing_exc_tuple: Optional[Any]=None) -> ExecutionResult:
"Run a complete IPython cell asynchronously.\n\n Parameters\n ----------\n raw_cell : st... | 5,430,472,186,216,697,000 | Run a complete IPython cell asynchronously.
Parameters
----------
raw_cell : str
The code (including IPython code such as %magic functions) to run.
store_history : bool
If True, the raw and translated cell will be stored in IPython's
history. For user code calling back into IPython's machinery, this
should be ... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | run_cell_async | CMU-IDS-2022/final-project-the-evaluators | python | async def run_cell_async(self, raw_cell: str, store_history=False, silent=False, shell_futures=True, *, transformed_cell: Optional[str]=None, preprocessing_exc_tuple: Optional[Any]=None) -> ExecutionResult:
"Run a complete IPython cell asynchronously.\n\n Parameters\n ----------\n raw_cell : st... |
def transform_cell(self, raw_cell):
'Transform an input cell before parsing it.\n\n Static transformations, implemented in IPython.core.inputtransformer2,\n deal with things like ``%magic`` and ``!system`` commands.\n These run on all input.\n Dynamic transformations, for things like une... | -6,800,214,030,907,054,000 | Transform an input cell before parsing it.
Static transformations, implemented in IPython.core.inputtransformer2,
deal with things like ``%magic`` and ``!system`` commands.
These run on all input.
Dynamic transformations, for things like unescaped magics and the exit
autocall, depend on the state of the interpreter.
T... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | transform_cell | CMU-IDS-2022/final-project-the-evaluators | python | def transform_cell(self, raw_cell):
'Transform an input cell before parsing it.\n\n Static transformations, implemented in IPython.core.inputtransformer2,\n deal with things like ``%magic`` and ``!system`` commands.\n These run on all input.\n Dynamic transformations, for things like une... |
def transform_ast(self, node):
"Apply the AST transformations from self.ast_transformers\n\n Parameters\n ----------\n node : ast.Node\n The root node to be transformed. Typically called with the ast.Module\n produced by parsing user input.\n\n Returns\n ----... | -477,017,728,517,736,260 | Apply the AST transformations from self.ast_transformers
Parameters
----------
node : ast.Node
The root node to be transformed. Typically called with the ast.Module
produced by parsing user input.
Returns
-------
An ast.Node corresponding to the node it was called with. Note that it
may also modify the passed... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | transform_ast | CMU-IDS-2022/final-project-the-evaluators | python | def transform_ast(self, node):
"Apply the AST transformations from self.ast_transformers\n\n Parameters\n ----------\n node : ast.Node\n The root node to be transformed. Typically called with the ast.Module\n produced by parsing user input.\n\n Returns\n ----... |
def _update_code_co_name(self, code):
"Python 3.10 changed the behaviour so that whenever a code object\n is assembled in the compile(ast) the co_firstlineno would be == 1.\n\n This makes pydevd/debugpy think that all cells invoked are the same\n since it caches information based on (co_firstli... | -621,209,993,117,818,800 | Python 3.10 changed the behaviour so that whenever a code object
is assembled in the compile(ast) the co_firstlineno would be == 1.
This makes pydevd/debugpy think that all cells invoked are the same
since it caches information based on (co_firstlineno, co_name, co_filename).
Given that, this function changes the cod... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _update_code_co_name | CMU-IDS-2022/final-project-the-evaluators | python | def _update_code_co_name(self, code):
"Python 3.10 changed the behaviour so that whenever a code object\n is assembled in the compile(ast) the co_firstlineno would be == 1.\n\n This makes pydevd/debugpy think that all cells invoked are the same\n since it caches information based on (co_firstli... |
async def run_ast_nodes(self, nodelist: ListType[stmt], cell_name: str, interactivity='last_expr', compiler=compile, result=None):
"Run a sequence of AST nodes. The execution mode depends on the\n interactivity parameter.\n\n Parameters\n ----------\n nodelist : list\n A sequenc... | -5,708,423,101,167,578,000 | Run a sequence of AST nodes. The execution mode depends on the
interactivity parameter.
Parameters
----------
nodelist : list
A sequence of AST nodes to run.
cell_name : str
Will be passed to the compiler as the filename of the cell. Typically
the value returned by ip.compile.cache(cell).
interactivity : str
'... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | run_ast_nodes | CMU-IDS-2022/final-project-the-evaluators | python | async def run_ast_nodes(self, nodelist: ListType[stmt], cell_name: str, interactivity='last_expr', compiler=compile, result=None):
"Run a sequence of AST nodes. The execution mode depends on the\n interactivity parameter.\n\n Parameters\n ----------\n nodelist : list\n A sequenc... |
async def run_code(self, code_obj, result=None, *, async_=False):
'Execute a code object.\n\n When an exception occurs, self.showtraceback() is called to display a\n traceback.\n\n Parameters\n ----------\n code_obj : code object\n A compiled code object, to be executed\n... | -3,119,642,127,492,501,500 | Execute a code object.
When an exception occurs, self.showtraceback() is called to display a
traceback.
Parameters
----------
code_obj : code object
A compiled code object, to be executed
result : ExecutionResult, optional
An object to store exceptions that occur during execution.
async_ : Bool (Experimental)
... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | run_code | CMU-IDS-2022/final-project-the-evaluators | python | async def run_code(self, code_obj, result=None, *, async_=False):
'Execute a code object.\n\n When an exception occurs, self.showtraceback() is called to display a\n traceback.\n\n Parameters\n ----------\n code_obj : code object\n A compiled code object, to be executed\n... |
def check_complete(self, code: str) -> Tuple[(str, str)]:
"Return whether a block of code is ready to execute, or should be continued\n\n Parameters\n ----------\n code : string\n Python input code, which can be multiline.\n\n Returns\n -------\n status : str\n ... | 5,624,002,090,772,154,000 | Return whether a block of code is ready to execute, or should be continued
Parameters
----------
code : string
Python input code, which can be multiline.
Returns
-------
status : str
One of 'complete', 'incomplete', or 'invalid' if source is not a
prefix of valid code.
indent : str
When status is 'inc... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | check_complete | CMU-IDS-2022/final-project-the-evaluators | python | def check_complete(self, code: str) -> Tuple[(str, str)]:
"Return whether a block of code is ready to execute, or should be continued\n\n Parameters\n ----------\n code : string\n Python input code, which can be multiline.\n\n Returns\n -------\n status : str\n ... |
def enable_matplotlib(self, gui=None):
"Enable interactive matplotlib and inline figure support.\n\n This takes the following steps:\n\n 1. select the appropriate eventloop and matplotlib backend\n 2. set up matplotlib for interactive use with that backend\n 3. configure formatters for i... | -6,350,230,283,851,679,000 | Enable interactive matplotlib and inline figure support.
This takes the following steps:
1. select the appropriate eventloop and matplotlib backend
2. set up matplotlib for interactive use with that backend
3. configure formatters for inline figure display
4. enable the selected gui eventloop
Parameters
----------
g... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | enable_matplotlib | CMU-IDS-2022/final-project-the-evaluators | python | def enable_matplotlib(self, gui=None):
"Enable interactive matplotlib and inline figure support.\n\n This takes the following steps:\n\n 1. select the appropriate eventloop and matplotlib backend\n 2. set up matplotlib for interactive use with that backend\n 3. configure formatters for i... |
def enable_pylab(self, gui=None, import_all=True, welcome_message=False):
"Activate pylab support at runtime.\n\n This turns on support for matplotlib, preloads into the interactive\n namespace all of numpy and pylab, and configures IPython to correctly\n interact with the GUI event loop. The ... | -5,059,836,458,887,207,000 | Activate pylab support at runtime.
This turns on support for matplotlib, preloads into the interactive
namespace all of numpy and pylab, and configures IPython to correctly
interact with the GUI event loop. The GUI backend to be used can be
optionally selected with the optional ``gui`` argument.
This method only add... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | enable_pylab | CMU-IDS-2022/final-project-the-evaluators | python | def enable_pylab(self, gui=None, import_all=True, welcome_message=False):
"Activate pylab support at runtime.\n\n This turns on support for matplotlib, preloads into the interactive\n namespace all of numpy and pylab, and configures IPython to correctly\n interact with the GUI event loop. The ... |
def var_expand(self, cmd, depth=0, formatter=DollarFormatter()):
"Expand python variables in a string.\n\n The depth argument indicates how many frames above the caller should\n be walked to look for the local namespace where to expand variables.\n\n The global namespace for expansion is always... | 1,565,111,268,002,081,500 | Expand python variables in a string.
The depth argument indicates how many frames above the caller should
be walked to look for the local namespace where to expand variables.
The global namespace for expansion is always the user's interactive
namespace. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | var_expand | CMU-IDS-2022/final-project-the-evaluators | python | def var_expand(self, cmd, depth=0, formatter=DollarFormatter()):
"Expand python variables in a string.\n\n The depth argument indicates how many frames above the caller should\n be walked to look for the local namespace where to expand variables.\n\n The global namespace for expansion is always... |
def mktempfile(self, data=None, prefix='ipython_edit_'):
'Make a new tempfile and return its filename.\n\n This makes a call to tempfile.mkstemp (created in a tempfile.mkdtemp),\n but it registers the created filename internally so ipython cleans it up\n at exit time.\n\n Optional inputs... | -2,235,922,384,923,393,000 | Make a new tempfile and return its filename.
This makes a call to tempfile.mkstemp (created in a tempfile.mkdtemp),
but it registers the created filename internally so ipython cleans it up
at exit time.
Optional inputs:
- data(None): if data is given, it gets written out to the temp file
immediately, and the f... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | mktempfile | CMU-IDS-2022/final-project-the-evaluators | python | def mktempfile(self, data=None, prefix='ipython_edit_'):
'Make a new tempfile and return its filename.\n\n This makes a call to tempfile.mkstemp (created in a tempfile.mkdtemp),\n but it registers the created filename internally so ipython cleans it up\n at exit time.\n\n Optional inputs... |
def show_usage(self):
'Show a usage message'
page.page(IPython.core.usage.interactive_usage) | -3,046,370,155,828,512,000 | Show a usage message | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | show_usage | CMU-IDS-2022/final-project-the-evaluators | python | def show_usage(self):
page.page(IPython.core.usage.interactive_usage) |
def extract_input_lines(self, range_str, raw=False):
'Return as a string a set of input history slices.\n\n Parameters\n ----------\n range_str : str\n The set of slices is given as a string, like "~5/6-~4/2 4:8 9",\n since this function is for use by magic functions which... | -6,934,557,352,905,842,000 | Return as a string a set of input history slices.
Parameters
----------
range_str : str
The set of slices is given as a string, like "~5/6-~4/2 4:8 9",
since this function is for use by magic functions which get their
arguments as strings. The number before the / is the session
number: ~n goes n back f... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | extract_input_lines | CMU-IDS-2022/final-project-the-evaluators | python | def extract_input_lines(self, range_str, raw=False):
'Return as a string a set of input history slices.\n\n Parameters\n ----------\n range_str : str\n The set of slices is given as a string, like "~5/6-~4/2 4:8 9",\n since this function is for use by magic functions which... |
def find_user_code(self, target, raw=True, py_only=False, skip_encoding_cookie=True, search_ns=False):
'Get a code string from history, file, url, or a string or macro.\n\n This is mainly used by magic functions.\n\n Parameters\n ----------\n target : str\n A string specifying... | 3,588,001,781,120,213,500 | Get a code string from history, file, url, or a string or macro.
This is mainly used by magic functions.
Parameters
----------
target : str
A string specifying code to retrieve. This will be tried respectively
as: ranges of input history (see %history for syntax), url,
corresponding .py file, filename, or... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | find_user_code | CMU-IDS-2022/final-project-the-evaluators | python | def find_user_code(self, target, raw=True, py_only=False, skip_encoding_cookie=True, search_ns=False):
'Get a code string from history, file, url, or a string or macro.\n\n This is mainly used by magic functions.\n\n Parameters\n ----------\n target : str\n A string specifying... |
def _atexit_once(self):
'\n At exist operation that need to be called at most once.\n Second call to this function per instance will do nothing.\n '
if (not getattr(self, '_atexit_once_called', False)):
self._atexit_once_called = True
self.reset(new_session=False)
se... | -8,122,510,988,338,416,000 | At exist operation that need to be called at most once.
Second call to this function per instance will do nothing. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | _atexit_once | CMU-IDS-2022/final-project-the-evaluators | python | def _atexit_once(self):
'\n At exist operation that need to be called at most once.\n Second call to this function per instance will do nothing.\n '
if (not getattr(self, '_atexit_once_called', False)):
self._atexit_once_called = True
self.reset(new_session=False)
se... |
def atexit_operations(self):
'This will be executed at the time of exit.\n\n Cleanup operations and saving of persistent data that is done\n unconditionally by IPython should be performed here.\n\n For things that may depend on startup flags or platform specifics (such\n as having readli... | -6,097,225,120,271,981,000 | This will be executed at the time of exit.
Cleanup operations and saving of persistent data that is done
unconditionally by IPython should be performed here.
For things that may depend on startup flags or platform specifics (such
as having readline or not), register a separate atexit function in the
code that has the... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | atexit_operations | CMU-IDS-2022/final-project-the-evaluators | python | def atexit_operations(self):
'This will be executed at the time of exit.\n\n Cleanup operations and saving of persistent data that is done\n unconditionally by IPython should be performed here.\n\n For things that may depend on startup flags or platform specifics (such\n as having readli... |
def validate_stb(stb):
'validate structured traceback return type\n\n return type of CustomTB *should* be a list of strings, but allow\n single strings or None, which are harmless.\n\n This function will *always* return a list of strings,\n and will raise a TypeError if s... | 486,469,157,839,067,000 | validate structured traceback return type
return type of CustomTB *should* be a list of strings, but allow
single strings or None, which are harmless.
This function will *always* return a list of strings,
and will raise a TypeError if stb is inappropriate. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | validate_stb | CMU-IDS-2022/final-project-the-evaluators | python | def validate_stb(stb):
'validate structured traceback return type\n\n return type of CustomTB *should* be a list of strings, but allow\n single strings or None, which are harmless.\n\n This function will *always* return a list of strings,\n and will raise a TypeError if s... |
def get_cells():
'generator for sequence of code blocks to run'
if (fname.suffix == '.ipynb'):
from nbformat import read
nb = read(fname, as_version=4)
if (not nb.cells):
return
for cell in nb.cells:
if (cell.cell_type == 'code'):
(yield ce... | -549,812,894,118,021,060 | generator for sequence of code blocks to run | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | get_cells | CMU-IDS-2022/final-project-the-evaluators | python | def get_cells():
if (fname.suffix == '.ipynb'):
from nbformat import read
nb = read(fname, as_version=4)
if (not nb.cells):
return
for cell in nb.cells:
if (cell.cell_type == 'code'):
(yield cell.source)
else:
(yield fname.read... |
def wrapped(self, etype, value, tb, tb_offset=None):
'wrap CustomTB handler, to protect IPython from user code\n\n This makes it harder (but not impossible) for custom exception\n handlers to crash IPython.\n '
try:
stb = handler(self, etype, value, tb, tb_of... | -5,198,393,339,466,821,000 | wrap CustomTB handler, to protect IPython from user code
This makes it harder (but not impossible) for custom exception
handlers to crash IPython. | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | wrapped | CMU-IDS-2022/final-project-the-evaluators | python | def wrapped(self, etype, value, tb, tb_offset=None):
'wrap CustomTB handler, to protect IPython from user code\n\n This makes it harder (but not impossible) for custom exception\n handlers to crash IPython.\n '
try:
stb = handler(self, etype, value, tb, tb_of... |
def __init__(self, **kwargs):
'\n Initializes a new CreateDeploymentDetails object with values from keyword arguments. This class has the following subclasses and if you are using this class as input\n to a service operations then you should favor using a subclass over the base class:\n\n * :cl... | -309,434,075,974,912,200 | Initializes a new CreateDeploymentDetails object with values from keyword arguments. This class has the following subclasses and if you are using this class as input
to a service operations then you should favor using a subclass over the base class:
* :class:`~oci.devops.models.CreateDeployPipelineRedeploymentDetails`... | src/oci/devops/models/create_deployment_details.py | __init__ | LaudateCorpus1/oci-python-sdk | python | def __init__(self, **kwargs):
'\n Initializes a new CreateDeploymentDetails object with values from keyword arguments. This class has the following subclasses and if you are using this class as input\n to a service operations then you should favor using a subclass over the base class:\n\n * :cl... |
@staticmethod
def get_subtype(object_dictionary):
'\n Given the hash representation of a subtype of this class,\n use the info in the hash to return the class of the subtype.\n '
type = object_dictionary['deploymentType']
if (type == 'PIPELINE_REDEPLOYMENT'):
return 'CreateDeplo... | -6,539,959,657,786,444,000 | Given the hash representation of a subtype of this class,
use the info in the hash to return the class of the subtype. | src/oci/devops/models/create_deployment_details.py | get_subtype | LaudateCorpus1/oci-python-sdk | python | @staticmethod
def get_subtype(object_dictionary):
'\n Given the hash representation of a subtype of this class,\n use the info in the hash to return the class of the subtype.\n '
type = object_dictionary['deploymentType']
if (type == 'PIPELINE_REDEPLOYMENT'):
return 'CreateDeplo... |
@property
def deploy_pipeline_id(self):
'\n **[Required]** Gets the deploy_pipeline_id of this CreateDeploymentDetails.\n The OCID of a pipeline.\n\n\n :return: The deploy_pipeline_id of this CreateDeploymentDetails.\n :rtype: str\n '
return self._deploy_pipeline_id | 2,970,132,885,694,584,300 | **[Required]** Gets the deploy_pipeline_id of this CreateDeploymentDetails.
The OCID of a pipeline.
:return: The deploy_pipeline_id of this CreateDeploymentDetails.
:rtype: str | src/oci/devops/models/create_deployment_details.py | deploy_pipeline_id | LaudateCorpus1/oci-python-sdk | python | @property
def deploy_pipeline_id(self):
'\n **[Required]** Gets the deploy_pipeline_id of this CreateDeploymentDetails.\n The OCID of a pipeline.\n\n\n :return: The deploy_pipeline_id of this CreateDeploymentDetails.\n :rtype: str\n '
return self._deploy_pipeline_id |
@deploy_pipeline_id.setter
def deploy_pipeline_id(self, deploy_pipeline_id):
'\n Sets the deploy_pipeline_id of this CreateDeploymentDetails.\n The OCID of a pipeline.\n\n\n :param deploy_pipeline_id: The deploy_pipeline_id of this CreateDeploymentDetails.\n :type: str\n '
sel... | 4,832,613,191,838,614,000 | Sets the deploy_pipeline_id of this CreateDeploymentDetails.
The OCID of a pipeline.
:param deploy_pipeline_id: The deploy_pipeline_id of this CreateDeploymentDetails.
:type: str | src/oci/devops/models/create_deployment_details.py | deploy_pipeline_id | LaudateCorpus1/oci-python-sdk | python | @deploy_pipeline_id.setter
def deploy_pipeline_id(self, deploy_pipeline_id):
'\n Sets the deploy_pipeline_id of this CreateDeploymentDetails.\n The OCID of a pipeline.\n\n\n :param deploy_pipeline_id: The deploy_pipeline_id of this CreateDeploymentDetails.\n :type: str\n '
sel... |
@property
def deployment_type(self):
'\n **[Required]** Gets the deployment_type of this CreateDeploymentDetails.\n Specifies type for this deployment.\n\n\n :return: The deployment_type of this CreateDeploymentDetails.\n :rtype: str\n '
return self._deployment_type | -6,515,815,640,178,701,000 | **[Required]** Gets the deployment_type of this CreateDeploymentDetails.
Specifies type for this deployment.
:return: The deployment_type of this CreateDeploymentDetails.
:rtype: str | src/oci/devops/models/create_deployment_details.py | deployment_type | LaudateCorpus1/oci-python-sdk | python | @property
def deployment_type(self):
'\n **[Required]** Gets the deployment_type of this CreateDeploymentDetails.\n Specifies type for this deployment.\n\n\n :return: The deployment_type of this CreateDeploymentDetails.\n :rtype: str\n '
return self._deployment_type |
@deployment_type.setter
def deployment_type(self, deployment_type):
'\n Sets the deployment_type of this CreateDeploymentDetails.\n Specifies type for this deployment.\n\n\n :param deployment_type: The deployment_type of this CreateDeploymentDetails.\n :type: str\n '
self._dep... | -7,926,560,362,652,776,000 | Sets the deployment_type of this CreateDeploymentDetails.
Specifies type for this deployment.
:param deployment_type: The deployment_type of this CreateDeploymentDetails.
:type: str | src/oci/devops/models/create_deployment_details.py | deployment_type | LaudateCorpus1/oci-python-sdk | python | @deployment_type.setter
def deployment_type(self, deployment_type):
'\n Sets the deployment_type of this CreateDeploymentDetails.\n Specifies type for this deployment.\n\n\n :param deployment_type: The deployment_type of this CreateDeploymentDetails.\n :type: str\n '
self._dep... |
@property
def display_name(self):
'\n Gets the display_name of this CreateDeploymentDetails.\n Deployment display name. Avoid entering confidential information.\n\n\n :return: The display_name of this CreateDeploymentDetails.\n :rtype: str\n '
return self._display_name | 7,800,112,571,215,726,000 | Gets the display_name of this CreateDeploymentDetails.
Deployment display name. Avoid entering confidential information.
:return: The display_name of this CreateDeploymentDetails.
:rtype: str | src/oci/devops/models/create_deployment_details.py | display_name | LaudateCorpus1/oci-python-sdk | python | @property
def display_name(self):
'\n Gets the display_name of this CreateDeploymentDetails.\n Deployment display name. Avoid entering confidential information.\n\n\n :return: The display_name of this CreateDeploymentDetails.\n :rtype: str\n '
return self._display_name |
@display_name.setter
def display_name(self, display_name):
'\n Sets the display_name of this CreateDeploymentDetails.\n Deployment display name. Avoid entering confidential information.\n\n\n :param display_name: The display_name of this CreateDeploymentDetails.\n :type: str\n '
... | -526,943,438,164,516,160 | Sets the display_name of this CreateDeploymentDetails.
Deployment display name. Avoid entering confidential information.
:param display_name: The display_name of this CreateDeploymentDetails.
:type: str | src/oci/devops/models/create_deployment_details.py | display_name | LaudateCorpus1/oci-python-sdk | python | @display_name.setter
def display_name(self, display_name):
'\n Sets the display_name of this CreateDeploymentDetails.\n Deployment display name. Avoid entering confidential information.\n\n\n :param display_name: The display_name of this CreateDeploymentDetails.\n :type: str\n '
... |
@property
def freeform_tags(self):
'\n Gets the freeform_tags of this CreateDeploymentDetails.\n Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. See `Resource Tags`__. Example: `{"bar-key": "value"}`\n\n __ https://docs.clo... | -8,385,194,850,335,849,000 | Gets the freeform_tags of this CreateDeploymentDetails.
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. See `Resource Tags`__. Example: `{"bar-key": "value"}`
__ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
:return: Th... | src/oci/devops/models/create_deployment_details.py | freeform_tags | LaudateCorpus1/oci-python-sdk | python | @property
def freeform_tags(self):
'\n Gets the freeform_tags of this CreateDeploymentDetails.\n Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. See `Resource Tags`__. Example: `{"bar-key": "value"}`\n\n __ https://docs.clo... |
@freeform_tags.setter
def freeform_tags(self, freeform_tags):
'\n Sets the freeform_tags of this CreateDeploymentDetails.\n Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. See `Resource Tags`__. Example: `{"bar-key": "value"}`\n\n... | 2,248,745,989,496,237,000 | Sets the freeform_tags of this CreateDeploymentDetails.
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. See `Resource Tags`__. Example: `{"bar-key": "value"}`
__ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
:param free... | src/oci/devops/models/create_deployment_details.py | freeform_tags | LaudateCorpus1/oci-python-sdk | python | @freeform_tags.setter
def freeform_tags(self, freeform_tags):
'\n Sets the freeform_tags of this CreateDeploymentDetails.\n Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. See `Resource Tags`__. Example: `{"bar-key": "value"}`\n\n... |
@property
def defined_tags(self):
'\n Gets the defined_tags of this CreateDeploymentDetails.\n Defined tags for this resource. Each key is predefined and scoped to a namespace. See `Resource Tags`__. Example: `{"foo-namespace": {"bar-key": "value"}}`\n\n __ https://docs.cloud.oracle.com/Content... | -6,455,408,403,173,762,000 | Gets the defined_tags of this CreateDeploymentDetails.
Defined tags for this resource. Each key is predefined and scoped to a namespace. See `Resource Tags`__. Example: `{"foo-namespace": {"bar-key": "value"}}`
__ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
:return: The defined_tags of th... | src/oci/devops/models/create_deployment_details.py | defined_tags | LaudateCorpus1/oci-python-sdk | python | @property
def defined_tags(self):
'\n Gets the defined_tags of this CreateDeploymentDetails.\n Defined tags for this resource. Each key is predefined and scoped to a namespace. See `Resource Tags`__. Example: `{"foo-namespace": {"bar-key": "value"}}`\n\n __ https://docs.cloud.oracle.com/Content... |
@defined_tags.setter
def defined_tags(self, defined_tags):
'\n Sets the defined_tags of this CreateDeploymentDetails.\n Defined tags for this resource. Each key is predefined and scoped to a namespace. See `Resource Tags`__. Example: `{"foo-namespace": {"bar-key": "value"}}`\n\n __ https://docs... | 4,476,609,121,983,142,400 | Sets the defined_tags of this CreateDeploymentDetails.
Defined tags for this resource. Each key is predefined and scoped to a namespace. See `Resource Tags`__. Example: `{"foo-namespace": {"bar-key": "value"}}`
__ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
:param defined_tags: The define... | src/oci/devops/models/create_deployment_details.py | defined_tags | LaudateCorpus1/oci-python-sdk | python | @defined_tags.setter
def defined_tags(self, defined_tags):
'\n Sets the defined_tags of this CreateDeploymentDetails.\n Defined tags for this resource. Each key is predefined and scoped to a namespace. See `Resource Tags`__. Example: `{"foo-namespace": {"bar-key": "value"}}`\n\n __ https://docs... |
def run(self):
'\n This function will the operator\n :return:\n '
try:
self.train()
except KeyboardInterrupt:
self.logger.info('You have entered CTRL+C.. Wait to finalize') | 7,356,136,057,099,459,000 | This function will the operator
:return: | agents/dqn.py | run | Cheng-XJTU/Pytorch-Project-Template | python | def run(self):
'\n This function will the operator\n :return:\n '
try:
self.train()
except KeyboardInterrupt:
self.logger.info('You have entered CTRL+C.. Wait to finalize') |
def select_action(self, state):
'\n The action selection function, it either uses the model to choose an action or samples one uniformly.\n :param state: current state of the model\n :return:\n '
if self.cuda:
state = state.cuda()
sample = random.random()
eps_threshol... | 7,905,057,826,998,764,000 | The action selection function, it either uses the model to choose an action or samples one uniformly.
:param state: current state of the model
:return: | agents/dqn.py | select_action | Cheng-XJTU/Pytorch-Project-Template | python | def select_action(self, state):
'\n The action selection function, it either uses the model to choose an action or samples one uniformly.\n :param state: current state of the model\n :return:\n '
if self.cuda:
state = state.cuda()
sample = random.random()
eps_threshol... |
def optimize_policy_model(self):
'\n performs a single step of optimization for the policy model\n :return:\n '
if (self.memory.length() < self.config.batch_size):
return
transitions = self.memory.sample_batch(self.config.batch_size)
one_batch = Transition(*zip(*transitions)... | -4,843,540,720,220,526,000 | performs a single step of optimization for the policy model
:return: | agents/dqn.py | optimize_policy_model | Cheng-XJTU/Pytorch-Project-Template | python | def optimize_policy_model(self):
'\n performs a single step of optimization for the policy model\n :return:\n '
if (self.memory.length() < self.config.batch_size):
return
transitions = self.memory.sample_batch(self.config.batch_size)
one_batch = Transition(*zip(*transitions)... |
def train(self):
'\n Training loop based on the number of episodes\n :return:\n '
for episode in tqdm(range(self.current_episode, self.config.num_episodes)):
self.current_episode = episode
self.env.reset()
self.train_one_epoch()
if ((self.current_episode % se... | 2,446,242,519,018,561,500 | Training loop based on the number of episodes
:return: | agents/dqn.py | train | Cheng-XJTU/Pytorch-Project-Template | python | def train(self):
'\n Training loop based on the number of episodes\n :return:\n '
for episode in tqdm(range(self.current_episode, self.config.num_episodes)):
self.current_episode = episode
self.env.reset()
self.train_one_epoch()
if ((self.current_episode % se... |
def train_one_epoch(self):
'\n One episode of training; it samples an action, observe next screen and optimize the model once\n :return:\n '
episode_duration = 0
prev_frame = self.cartpole.get_screen(self.env)
curr_frame = self.cartpole.get_screen(self.env)
curr_state = (curr_fr... | -4,751,008,977,623,283,000 | One episode of training; it samples an action, observe next screen and optimize the model once
:return: | agents/dqn.py | train_one_epoch | Cheng-XJTU/Pytorch-Project-Template | python | def train_one_epoch(self):
'\n One episode of training; it samples an action, observe next screen and optimize the model once\n :return:\n '
episode_duration = 0
prev_frame = self.cartpole.get_screen(self.env)
curr_frame = self.cartpole.get_screen(self.env)
curr_state = (curr_fr... |
def finalize(self):
'\n Finalize all the operations of the 2 Main classes of the process the operator and the data loader\n :return:\n '
self.logger.info('Please wait while finalizing the operation.. Thank you')
self.save_checkpoint()
self.summary_writer.export_scalars_to_json('{}al... | -6,417,006,202,863,603,000 | Finalize all the operations of the 2 Main classes of the process the operator and the data loader
:return: | agents/dqn.py | finalize | Cheng-XJTU/Pytorch-Project-Template | python | def finalize(self):
'\n Finalize all the operations of the 2 Main classes of the process the operator and the data loader\n :return:\n '
self.logger.info('Please wait while finalizing the operation.. Thank you')
self.save_checkpoint()
self.summary_writer.export_scalars_to_json('{}al... |
def yaml_format(obj, indent=0):
'\n Pretty formats the given object as a YAML string which is returned.\n (based on TLObject.pretty_format)\n '
result = []
if isinstance(obj, TLObject):
obj = obj.to_dict()
if isinstance(obj, dict):
result.append((obj.get('_', 'dict') + ':'))
... | -3,753,146,974,282,035,000 | Pretty formats the given object as a YAML string which is returned.
(based on TLObject.pretty_format) | userbot/plugins/new.py | yaml_format | Abhiramabr/weaponx | python | def yaml_format(obj, indent=0):
'\n Pretty formats the given object as a YAML string which is returned.\n (based on TLObject.pretty_format)\n '
result = []
if isinstance(obj, TLObject):
obj = obj.to_dict()
if isinstance(obj, dict):
result.append((obj.get('_', 'dict') + ':'))
... |
def __init__(self, client=None, **kwargs):
'\n Initialize new LabelBinarizer instance\n\n Parameters\n ----------\n client : dask.Client optional client to use\n kwargs : dict of arguments to proxy to underlying single-process\n LabelBinarizer\n '
self.c... | -5,744,651,490,407,949,000 | Initialize new LabelBinarizer instance
Parameters
----------
client : dask.Client optional client to use
kwargs : dict of arguments to proxy to underlying single-process
LabelBinarizer | python/cuml/dask/preprocessing/label.py | __init__ | Chetank99/cuml | python | def __init__(self, client=None, **kwargs):
'\n Initialize new LabelBinarizer instance\n\n Parameters\n ----------\n client : dask.Client optional client to use\n kwargs : dict of arguments to proxy to underlying single-process\n LabelBinarizer\n '
self.c... |
def fit(self, y):
'Fit label binarizer\n\n Parameters\n ----------\n y : Dask.Array of shape [n_samples,] or [n_samples, n_classes]\n chunked by row.\n Target values. The 2-d matrix should only contain 0 and 1,\n represents multilabel classification.\n\n ... | 4,554,579,472,936,627,700 | Fit label binarizer
Parameters
----------
y : Dask.Array of shape [n_samples,] or [n_samples, n_classes]
chunked by row.
Target values. The 2-d matrix should only contain 0 and 1,
represents multilabel classification.
Returns
-------
self : returns an instance of self. | python/cuml/dask/preprocessing/label.py | fit | Chetank99/cuml | python | def fit(self, y):
'Fit label binarizer\n\n Parameters\n ----------\n y : Dask.Array of shape [n_samples,] or [n_samples, n_classes]\n chunked by row.\n Target values. The 2-d matrix should only contain 0 and 1,\n represents multilabel classification.\n\n ... |
def fit_transform(self, y):
'\n Fit the label encoder and return transformed labels\n\n Parameters\n ----------\n y : Dask.Array of shape [n_samples,] or [n_samples, n_classes]\n target values. The 2-d matrix should only contain 0 and 1,\n represents multilabel clas... | 3,604,221,344,484,529,000 | Fit the label encoder and return transformed labels
Parameters
----------
y : Dask.Array of shape [n_samples,] or [n_samples, n_classes]
target values. The 2-d matrix should only contain 0 and 1,
represents multilabel classification.
Returns
-------
arr : Dask.Array backed by CuPy arrays containing encoded l... | python/cuml/dask/preprocessing/label.py | fit_transform | Chetank99/cuml | python | def fit_transform(self, y):
'\n Fit the label encoder and return transformed labels\n\n Parameters\n ----------\n y : Dask.Array of shape [n_samples,] or [n_samples, n_classes]\n target values. The 2-d matrix should only contain 0 and 1,\n represents multilabel clas... |
def transform(self, y):
'\n Transform and return encoded labels\n\n Parameters\n ----------\n y : Dask.Array of shape [n_samples,] or [n_samples, n_classes]\n\n Returns\n -------\n\n arr : Dask.Array backed by CuPy arrays containing encoded labels\n '
part... | -3,579,742,699,241,133,000 | Transform and return encoded labels
Parameters
----------
y : Dask.Array of shape [n_samples,] or [n_samples, n_classes]
Returns
-------
arr : Dask.Array backed by CuPy arrays containing encoded labels | python/cuml/dask/preprocessing/label.py | transform | Chetank99/cuml | python | def transform(self, y):
'\n Transform and return encoded labels\n\n Parameters\n ----------\n y : Dask.Array of shape [n_samples,] or [n_samples, n_classes]\n\n Returns\n -------\n\n arr : Dask.Array backed by CuPy arrays containing encoded labels\n '
part... |
def inverse_transform(self, y, threshold=None):
'\n Invert a set of encoded labels back to original labels\n\n Parameters\n ----------\n\n y : Dask.Array of shape [n_samples, n_classes] containing encoded\n labels\n\n threshold : float This value is currently ignored\n\... | 1,216,885,461,147,947,500 | Invert a set of encoded labels back to original labels
Parameters
----------
y : Dask.Array of shape [n_samples, n_classes] containing encoded
labels
threshold : float This value is currently ignored
Returns
-------
arr : Dask.Array backed by CuPy arrays containing original labels | python/cuml/dask/preprocessing/label.py | inverse_transform | Chetank99/cuml | python | def inverse_transform(self, y, threshold=None):
'\n Invert a set of encoded labels back to original labels\n\n Parameters\n ----------\n\n y : Dask.Array of shape [n_samples, n_classes] containing encoded\n labels\n\n threshold : float This value is currently ignored\n\... |
def CheckVintfFromExtractedTargetFiles(input_tmp, info_dict=None):
'\n Checks VINTF metadata of an extracted target files directory.\n\n Args:\n inp: path to the directory that contains the extracted target files archive.\n info_dict: The build-time info dict. If None, it will be loaded from inp.\n\n Retur... | 4,769,477,838,048,067,000 | Checks VINTF metadata of an extracted target files directory.
Args:
inp: path to the directory that contains the extracted target files archive.
info_dict: The build-time info dict. If None, it will be loaded from inp.
Returns:
True if VINTF check is skipped or compatible, False if incompatible. Raise
a Runti... | tools/check_target_files_vintf.py | CheckVintfFromExtractedTargetFiles | FabriSC/Alioth-SC | python | def CheckVintfFromExtractedTargetFiles(input_tmp, info_dict=None):
'\n Checks VINTF metadata of an extracted target files directory.\n\n Args:\n inp: path to the directory that contains the extracted target files archive.\n info_dict: The build-time info dict. If None, it will be loaded from inp.\n\n Retur... |
def GetVintfFileList():
'\n Returns a list of VINTF metadata files that should be read from a target files\n package before executing checkvintf.\n '
def PathToPatterns(path):
if (path[(- 1)] == '/'):
path += '*'
for (device_path, target_files_rel_paths) in DIR_SEARCH_PATHS.items... | -5,216,986,879,498,238,000 | Returns a list of VINTF metadata files that should be read from a target files
package before executing checkvintf. | tools/check_target_files_vintf.py | GetVintfFileList | FabriSC/Alioth-SC | python | def GetVintfFileList():
'\n Returns a list of VINTF metadata files that should be read from a target files\n package before executing checkvintf.\n '
def PathToPatterns(path):
if (path[(- 1)] == '/'):
path += '*'
for (device_path, target_files_rel_paths) in DIR_SEARCH_PATHS.items... |
def CheckVintfFromTargetFiles(inp, info_dict=None):
'\n Checks VINTF metadata of a target files zip.\n\n Args:\n inp: path to the target files archive.\n info_dict: The build-time info dict. If None, it will be loaded from inp.\n\n Returns:\n True if VINTF check is skipped or compatible, False if incomp... | -2,080,881,480,362,148,600 | Checks VINTF metadata of a target files zip.
Args:
inp: path to the target files archive.
info_dict: The build-time info dict. If None, it will be loaded from inp.
Returns:
True if VINTF check is skipped or compatible, False if incompatible. Raise
a RuntimeError if any error occurs. | tools/check_target_files_vintf.py | CheckVintfFromTargetFiles | FabriSC/Alioth-SC | python | def CheckVintfFromTargetFiles(inp, info_dict=None):
'\n Checks VINTF metadata of a target files zip.\n\n Args:\n inp: path to the target files archive.\n info_dict: The build-time info dict. If None, it will be loaded from inp.\n\n Returns:\n True if VINTF check is skipped or compatible, False if incomp... |
def CheckVintf(inp, info_dict=None):
'\n Checks VINTF metadata of a target files zip or extracted target files\n directory.\n\n Args:\n inp: path to the (possibly extracted) target files archive.\n info_dict: The build-time info dict. If None, it will be loaded from inp.\n\n Returns:\n True if VINTF ch... | -9,148,898,699,179,064,000 | Checks VINTF metadata of a target files zip or extracted target files
directory.
Args:
inp: path to the (possibly extracted) target files archive.
info_dict: The build-time info dict. If None, it will be loaded from inp.
Returns:
True if VINTF check is skipped or compatible, False if incompatible. Raise
a Run... | tools/check_target_files_vintf.py | CheckVintf | FabriSC/Alioth-SC | python | def CheckVintf(inp, info_dict=None):
'\n Checks VINTF metadata of a target files zip or extracted target files\n directory.\n\n Args:\n inp: path to the (possibly extracted) target files archive.\n info_dict: The build-time info dict. If None, it will be loaded from inp.\n\n Returns:\n True if VINTF ch... |
def test_default_reflection(self):
'Test reflection of column defaults.'
from sqlalchemy.dialects.mysql import VARCHAR
def_table = Table('mysql_def', MetaData(testing.db), Column('c1', VARCHAR(10, collation='utf8_unicode_ci'), DefaultClause(''), nullable=False), Column('c2', String(10), DefaultClause('0')),... | -936,220,668,374,197,800 | Test reflection of column defaults. | test/dialect/mysql/test_reflection.py | test_default_reflection | AngelLiang/hacking-sqlalchemy | python | def test_default_reflection(self):
from sqlalchemy.dialects.mysql import VARCHAR
def_table = Table('mysql_def', MetaData(testing.db), Column('c1', VARCHAR(10, collation='utf8_unicode_ci'), DefaultClause(), nullable=False), Column('c2', String(10), DefaultClause('0')), Column('c3', String(10), DefaultClause... |
def test_reflection_on_include_columns(self):
'Test reflection of include_columns to be sure they respect case.'
case_table = Table('mysql_case', MetaData(testing.db), Column('c1', String(10)), Column('C2', String(10)), Column('C3', String(10)))
try:
case_table.create()
reflected = Table('my... | -1,292,383,123,117,734,400 | Test reflection of include_columns to be sure they respect case. | test/dialect/mysql/test_reflection.py | test_reflection_on_include_columns | AngelLiang/hacking-sqlalchemy | python | def test_reflection_on_include_columns(self):
case_table = Table('mysql_case', MetaData(testing.db), Column('c1', String(10)), Column('C2', String(10)), Column('C3', String(10)))
try:
case_table.create()
reflected = Table('mysql_case', MetaData(testing.db), autoload=True, include_columns=['... |
@testing.provide_metadata
def test_nullable_reflection(self):
'test reflection of NULL/NOT NULL, in particular with TIMESTAMP\n defaults where MySQL is inconsistent in how it reports CREATE TABLE.\n\n '
meta = self.metadata
row = testing.db.execute("show variables like '%%explicit_defaults_for... | -7,641,466,202,760,821,000 | test reflection of NULL/NOT NULL, in particular with TIMESTAMP
defaults where MySQL is inconsistent in how it reports CREATE TABLE. | test/dialect/mysql/test_reflection.py | test_nullable_reflection | AngelLiang/hacking-sqlalchemy | python | @testing.provide_metadata
def test_nullable_reflection(self):
'test reflection of NULL/NOT NULL, in particular with TIMESTAMP\n defaults where MySQL is inconsistent in how it reports CREATE TABLE.\n\n '
meta = self.metadata
row = testing.db.execute("show variables like '%%explicit_defaults_for... |
def register(linter: PyLinter) -> None:
'Register the plugin'
register_checkers(linter)
suppress_warnings(linter) | -1,476,581,473,740,617,000 | Register the plugin | pylint_django_translations/plugin.py | register | troyjfarrell/pylint_django_translations | python | def register(linter: PyLinter) -> None:
register_checkers(linter)
suppress_warnings(linter) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.