3 final class DiffusionPythonExternalSymbolsSource
4 extends DiffusionExternalSymbolsSource
{
6 public function executeQuery(DiffusionExternalSymbolQuery
$query) {
8 if (!$query->matchesAnyLanguage(array('py', 'python'))) {
12 if (!$query->matchesAnyType(array('builtin', 'function'))) {
16 $names = $query->getNames();
18 foreach ($names as $name) {
19 if (idx(self
::$python2Builtins, $name)) {
20 $symbols[] = $this->buildExternalSymbol()
21 ->setSymbolName($name)
22 ->setSymbolType('function')
23 ->setSource(pht('Standard Library'))
24 ->setLocation(pht('The Python 2 Standard Library'))
25 ->setSymbolLanguage('py')
27 'https://docs.python.org/2/library/functions.html#'.$name);
29 if (idx(self
::$python3Builtins, $name)) {
30 $symbols[] = $this->buildExternalSymbol()
31 ->setSymbolName($name)
32 ->setSymbolType('function')
33 ->setSource(pht('Standard Library'))
34 ->setLocation(pht('The Python 3 Standard Library'))
35 ->setSymbolLanguage('py')
37 'https://docs.python.org/3/library/functions.html#'.$name);
43 private static $python2Builtins = array(
54 'classmethod' => true,
109 'staticmethod' => true,
122 // This list only contains functions that are new or changed between the
124 private static $python3Builtins = array(