\batchmode
\makeatletter
\def\input@path{{/dev/shm/}}
\makeatother
\documentclass[10pt,american,ngerman]{article}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=1.5cm,rmargin=1.5cm}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{babel}
\usepackage{float}
\usepackage[unicode=true,
 bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2,
 breaklinks=true,pdfborder={0 0 0},pdfborderstyle={},backref=page,colorlinks=false]
 {hyperref}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\floatstyle{ruled}
\newfloat{algorithm}{tbp}{loa}
\providecommand{\algorithmname}{Algorithmus}
\floatname{algorithm}{\protect\algorithmname}

\makeatother

\usepackage{listings}
\addto\captionsamerican{\renewcommand{\algorithmname}{Algorithm}}
\addto\captionsamerican{\renewcommand{\lstlistingname}{Listing}}
\addto\captionsngerman{\renewcommand{\algorithmname}{Algorithmus}}
\addto\captionsngerman{\renewcommand{\lstlistingname}{Listing}}
\renewcommand{\lstlistingname}{Listing}

\begin{document}
Minimal example 

\selectlanguage{american}%
\begin{algorithm}[h]
\begin{lstlisting}%
[language=Python]
@my_decorator(foo, bar=baz)
def dummy(arg):
	arr = arg
	out = pack.method(arr)
	return out
\end{lstlisting}
\end{algorithm}
\selectlanguage{ngerman}%

\end{document}
