Skip to content

Commit

Permalink
Remove docstrings from C function definitions (#2058)
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jan 16, 2022
1 parent 98b4948 commit 6173da2
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 360 deletions.
63 changes: 21 additions & 42 deletions psutil/_psutil_aix.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,58 +989,37 @@ static PyMethodDef
PsutilMethods[] =
{
// --- process-related functions
{"proc_basic_info", psutil_proc_basic_info, METH_VARARGS,
"Return process ppid, rss, vms, ctime, nice, nthreads, status and tty"},
{"proc_name", psutil_proc_name, METH_VARARGS,
"Return process name."},
{"proc_args", psutil_proc_args, METH_VARARGS,
"Return process command line arguments."},
{"proc_environ", psutil_proc_environ, METH_VARARGS,
"Return process environment variables."},
{"proc_cpu_times", psutil_proc_cpu_times, METH_VARARGS,
"Return process user and system CPU times."},
{"proc_cred", psutil_proc_cred, METH_VARARGS,
"Return process uids/gids."},
{"proc_args", psutil_proc_args, METH_VARARGS},
{"proc_basic_info", psutil_proc_basic_info, METH_VARARGS},
{"proc_cpu_times", psutil_proc_cpu_times, METH_VARARGS},
{"proc_cred", psutil_proc_cred, METH_VARARGS},
{"proc_environ", psutil_proc_environ, METH_VARARGS},
{"proc_name", psutil_proc_name, METH_VARARGS},
#ifdef CURR_VERSION_THREAD
{"proc_threads", psutil_proc_threads, METH_VARARGS,
"Return process threads"},
{"proc_threads", psutil_proc_threads, METH_VARARGS},
#endif
#ifdef CURR_VERSION_PROCESS
{"proc_io_counters", psutil_proc_io_counters, METH_VARARGS,
"Get process I/O counters."},
{"proc_io_counters", psutil_proc_io_counters, METH_VARARGS},
#endif
{"proc_num_ctx_switches", psutil_proc_num_ctx_switches, METH_VARARGS,
"Get process I/O counters."},
{"proc_num_ctx_switches", psutil_proc_num_ctx_switches, METH_VARARGS},

// --- system-related functions
{"users", psutil_users, METH_VARARGS,
"Return currently connected users."},
{"disk_partitions", psutil_disk_partitions, METH_VARARGS,
"Return disk partitions."},
{"boot_time", psutil_boot_time, METH_VARARGS,
"Return system boot time in seconds since the EPOCH."},
{"per_cpu_times", psutil_per_cpu_times, METH_VARARGS,
"Return system per-cpu times as a list of tuples"},
{"disk_io_counters", psutil_disk_io_counters, METH_VARARGS,
"Return a Python dict of tuples for disk I/O statistics."},
{"virtual_mem", psutil_virtual_mem, METH_VARARGS,
"Return system virtual memory usage statistics"},
{"swap_mem", psutil_swap_mem, METH_VARARGS,
"Return stats about swap memory, in bytes"},
{"boot_time", psutil_boot_time, METH_VARARGS},
{"disk_io_counters", psutil_disk_io_counters, METH_VARARGS},
{"disk_partitions", psutil_disk_partitions, METH_VARARGS},
{"per_cpu_times", psutil_per_cpu_times, METH_VARARGS},
{"swap_mem", psutil_swap_mem, METH_VARARGS},
{"users", psutil_users, METH_VARARGS},
{"virtual_mem", psutil_virtual_mem, METH_VARARGS},
#if defined(CURR_VERSION_NETINTERFACE) && CURR_VERSION_NETINTERFACE >= 3
{"net_io_counters", psutil_net_io_counters, METH_VARARGS,
"Return a Python dict of tuples for network I/O statistics."},
{"net_io_counters", psutil_net_io_counters, METH_VARARGS},
#endif
{"net_connections", psutil_net_connections, METH_VARARGS,
"Return system-wide connections"},
{"net_if_stats", psutil_net_if_stats, METH_VARARGS,
"Return NIC stats (isup, mtu)"},
{"cpu_stats", psutil_cpu_stats, METH_VARARGS,
"Return CPU statistics"},
{"cpu_stats", psutil_cpu_stats, METH_VARARGS},
{"net_connections", psutil_net_connections, METH_VARARGS},
{"net_if_stats", psutil_net_if_stats, METH_VARARGS},

// --- others
{"set_debug", psutil_set_debug, METH_VARARGS,
"Enable or disable PSUTIL_DEBUG messages"},
{"set_debug", psutil_set_debug, METH_VARARGS},

{NULL, NULL, 0, NULL}
};
Expand Down
104 changes: 34 additions & 70 deletions psutil/_psutil_bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1063,93 +1063,57 @@ psutil_users(PyObject *self, PyObject *args) {
static PyMethodDef mod_methods[] = {
// --- per-process functions

{"proc_oneshot_info", psutil_proc_oneshot_info, METH_VARARGS,
"Return multiple info about a process"},
{"proc_name", psutil_proc_name, METH_VARARGS,
"Return process name"},
{"proc_cmdline", psutil_proc_cmdline, METH_VARARGS,
"Return process cmdline as a list of cmdline arguments"},
{"proc_threads", psutil_proc_threads, METH_VARARGS,
"Return process threads"},
{"proc_cmdline", psutil_proc_cmdline, METH_VARARGS},
{"proc_name", psutil_proc_name, METH_VARARGS},
{"proc_oneshot_info", psutil_proc_oneshot_info, METH_VARARGS},
{"proc_threads", psutil_proc_threads, METH_VARARGS},
#if defined(PSUTIL_FREEBSD) || defined(PSUTIL_OPENBSD)
{"proc_connections", psutil_proc_connections, METH_VARARGS,
"Return connections opened by process"},
{"proc_connections", psutil_proc_connections, METH_VARARGS},
#endif
{"proc_cwd", psutil_proc_cwd, METH_VARARGS,
"Return process current working directory."},
{"proc_cwd", psutil_proc_cwd, METH_VARARGS},
#if defined(__FreeBSD_version) && __FreeBSD_version >= 800000 || PSUTIL_OPENBSD || defined(PSUTIL_NETBSD)
{"proc_num_fds", psutil_proc_num_fds, METH_VARARGS,
"Return the number of file descriptors opened by this process"},
{"proc_open_files", psutil_proc_open_files, METH_VARARGS,
"Return files opened by process as a list of (path, fd) tuples"},
{"proc_num_fds", psutil_proc_num_fds, METH_VARARGS},
{"proc_open_files", psutil_proc_open_files, METH_VARARGS},
#endif
#if defined(PSUTIL_FREEBSD) || defined(PSUTIL_NETBSD)
{"proc_num_threads", psutil_proc_num_threads, METH_VARARGS,
"Return number of threads used by process"},
{"proc_num_threads", psutil_proc_num_threads, METH_VARARGS},
#endif
#if defined(PSUTIL_FREEBSD)
{"proc_exe", psutil_proc_exe, METH_VARARGS,
"Return process pathname executable"},
{"proc_memory_maps", psutil_proc_memory_maps, METH_VARARGS,
"Return a list of tuples for every process's memory map"},
{"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS,
"Return process CPU affinity."},
{"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS,
"Set process CPU affinity."},
{"proc_getrlimit", psutil_proc_getrlimit, METH_VARARGS,
"Get process resource limits."},
{"proc_setrlimit", psutil_proc_setrlimit, METH_VARARGS,
"Set process resource limits."},
{"cpu_topology", psutil_cpu_topology, METH_VARARGS,
"Return CPU topology as an XML string."},
{"cpu_topology", psutil_cpu_topology, METH_VARARGS},
{"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS},
{"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS},
{"proc_exe", psutil_proc_exe, METH_VARARGS},
{"proc_getrlimit", psutil_proc_getrlimit, METH_VARARGS},
{"proc_memory_maps", psutil_proc_memory_maps, METH_VARARGS},
{"proc_setrlimit", psutil_proc_setrlimit, METH_VARARGS},
#endif
{"proc_environ", psutil_proc_environ, METH_VARARGS,
"Return process environment"},
{"proc_environ", psutil_proc_environ, METH_VARARGS},

// --- system-related functions

{"pids", psutil_pids, METH_VARARGS,
"Returns a list of PIDs currently running on the system"},
{"cpu_count_logical", psutil_cpu_count_logical, METH_VARARGS,
"Return number of logical CPUs on the system"},
{"virtual_mem", psutil_virtual_mem, METH_VARARGS,
"Return system virtual memory usage statistics"},
{"swap_mem", psutil_swap_mem, METH_VARARGS,
"Return swap mem stats"},
{"cpu_times", psutil_cpu_times, METH_VARARGS,
"Return system cpu times as a tuple (user, system, nice, idle, irc)"},
{"per_cpu_times", psutil_per_cpu_times, METH_VARARGS,
"Return system per-cpu times as a list of tuples"},
{"boot_time", psutil_boot_time, METH_VARARGS,
"Return the system boot time expressed in seconds since the epoch."},
{"disk_partitions", psutil_disk_partitions, METH_VARARGS,
"Return a list of tuples including device, mount point and "
"fs type for all partitions mounted on the system."},
{"net_io_counters", psutil_net_io_counters, METH_VARARGS,
"Return dict of tuples of networks I/O information."},
{"disk_io_counters", psutil_disk_io_counters, METH_VARARGS,
"Return a Python dict of tuples for disk I/O information"},
{"users", psutil_users, METH_VARARGS,
"Return currently connected users as a list of tuples"},
{"cpu_stats", psutil_cpu_stats, METH_VARARGS,
"Return CPU statistics"},
{"boot_time", psutil_boot_time, METH_VARARGS},
{"cpu_count_logical", psutil_cpu_count_logical, METH_VARARGS},
{"cpu_stats", psutil_cpu_stats, METH_VARARGS},
{"cpu_times", psutil_cpu_times, METH_VARARGS},
{"disk_io_counters", psutil_disk_io_counters, METH_VARARGS},
{"disk_partitions", psutil_disk_partitions, METH_VARARGS},
{"net_io_counters", psutil_net_io_counters, METH_VARARGS},
{"per_cpu_times", psutil_per_cpu_times, METH_VARARGS},
{"pids", psutil_pids, METH_VARARGS},
{"swap_mem", psutil_swap_mem, METH_VARARGS},
{"users", psutil_users, METH_VARARGS},
{"virtual_mem", psutil_virtual_mem, METH_VARARGS},
#if defined(PSUTIL_FREEBSD) || defined(PSUTIL_OPENBSD)
{"cpu_freq", psutil_cpu_freq, METH_VARARGS,
"Return CPU frequency"},
{"cpu_freq", psutil_cpu_freq, METH_VARARGS},
#endif
#if defined(PSUTIL_FREEBSD) || defined(PSUTIL_NETBSD)
{"net_connections", psutil_net_connections, METH_VARARGS,
"Return system-wide open connections."},
{"net_connections", psutil_net_connections, METH_VARARGS},
#endif
#if defined(PSUTIL_FREEBSD)
{"sensors_battery", psutil_sensors_battery, METH_VARARGS,
"Return battery information."},
{"sensors_cpu_temperature", psutil_sensors_cpu_temperature, METH_VARARGS,
"Return temperature information for a given CPU core number."},
{"sensors_battery", psutil_sensors_battery, METH_VARARGS},
{"sensors_cpu_temperature", psutil_sensors_cpu_temperature, METH_VARARGS},
#endif
// --- others
{"set_debug", psutil_set_debug, METH_VARARGS,
"Enable or disable PSUTIL_DEBUG messages"},
{"set_debug", psutil_set_debug, METH_VARARGS},

{NULL, NULL, 0, NULL}
};
Expand Down
31 changes: 9 additions & 22 deletions psutil/_psutil_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,35 +476,22 @@ static PyMethodDef mod_methods[] = {
// --- per-process functions

#if PSUTIL_HAVE_IOPRIO
{"proc_ioprio_get", psutil_proc_ioprio_get, METH_VARARGS,
"Get process I/O priority"},
{"proc_ioprio_set", psutil_proc_ioprio_set, METH_VARARGS,
"Set process I/O priority"},
{"proc_ioprio_get", psutil_proc_ioprio_get, METH_VARARGS},
{"proc_ioprio_set", psutil_proc_ioprio_set, METH_VARARGS},
#endif
#ifdef PSUTIL_HAVE_CPU_AFFINITY
{"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS,
"Return process CPU affinity as a Python long (the bitmask)."},
{"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS,
"Set process CPU affinity; expects a bitmask."},
{"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS},
{"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS},
#endif

// --- system related functions

{"disk_partitions", psutil_disk_partitions, METH_VARARGS,
"Return disk mounted partitions as a list of tuples including "
"device, mount point and filesystem type"},
{"users", psutil_users, METH_VARARGS,
"Return currently connected users as a list of tuples"},
{"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS,
"Return duplex and speed info about a NIC"},
{"disk_partitions", psutil_disk_partitions, METH_VARARGS},
{"users", psutil_users, METH_VARARGS},
{"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS},

// --- linux specific

{"linux_sysinfo", psutil_linux_sysinfo, METH_VARARGS,
"A wrapper around sysinfo(), return system memory usage statistics"},
{"linux_sysinfo", psutil_linux_sysinfo, METH_VARARGS},
// --- others
{"set_debug", psutil_set_debug, METH_VARARGS,
"Enable or disable PSUTIL_DEBUG messages"},
{"set_debug", psutil_set_debug, METH_VARARGS},

{NULL, NULL, 0, NULL}
};
Expand Down
87 changes: 28 additions & 59 deletions psutil/_psutil_osx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1645,69 +1645,38 @@ psutil_sensors_battery(PyObject *self, PyObject *args) {
*/
static PyMethodDef mod_methods[] = {
// --- per-process functions

{"proc_kinfo_oneshot", psutil_proc_kinfo_oneshot, METH_VARARGS,
"Return multiple process info."},
{"proc_pidtaskinfo_oneshot", psutil_proc_pidtaskinfo_oneshot, METH_VARARGS,
"Return multiple process info."},
{"proc_name", psutil_proc_name, METH_VARARGS,
"Return process name"},
{"proc_cmdline", psutil_proc_cmdline, METH_VARARGS,
"Return process cmdline as a list of cmdline arguments"},
{"proc_environ", psutil_proc_environ, METH_VARARGS,
"Return process environment data"},
{"proc_exe", psutil_proc_exe, METH_VARARGS,
"Return path of the process executable"},
{"proc_cwd", psutil_proc_cwd, METH_VARARGS,
"Return process current working directory."},
{"proc_memory_uss", psutil_proc_memory_uss, METH_VARARGS,
"Return process USS memory"},
{"proc_threads", psutil_proc_threads, METH_VARARGS,
"Return process threads as a list of tuples"},
{"proc_open_files", psutil_proc_open_files, METH_VARARGS,
"Return files opened by process as a list of tuples"},
{"proc_num_fds", psutil_proc_num_fds, METH_VARARGS,
"Return the number of fds opened by process."},
{"proc_connections", psutil_proc_connections, METH_VARARGS,
"Get process TCP and UDP connections as a list of tuples"},
{"proc_cmdline", psutil_proc_cmdline, METH_VARARGS},
{"proc_connections", psutil_proc_connections, METH_VARARGS},
{"proc_cwd", psutil_proc_cwd, METH_VARARGS},
{"proc_environ", psutil_proc_environ, METH_VARARGS},
{"proc_exe", psutil_proc_exe, METH_VARARGS},
{"proc_kinfo_oneshot", psutil_proc_kinfo_oneshot, METH_VARARGS},
{"proc_memory_uss", psutil_proc_memory_uss, METH_VARARGS},
{"proc_name", psutil_proc_name, METH_VARARGS},
{"proc_num_fds", psutil_proc_num_fds, METH_VARARGS},
{"proc_open_files", psutil_proc_open_files, METH_VARARGS},
{"proc_pidtaskinfo_oneshot", psutil_proc_pidtaskinfo_oneshot, METH_VARARGS},
{"proc_threads", psutil_proc_threads, METH_VARARGS},

// --- system-related functions

{"pids", psutil_pids, METH_VARARGS,
"Returns a list of PIDs currently running on the system"},
{"cpu_count_logical", psutil_cpu_count_logical, METH_VARARGS,
"Return number of logical CPUs on the system"},
{"cpu_count_cores", psutil_cpu_count_cores, METH_VARARGS,
"Return number of CPU cores on the system"},
{"virtual_mem", psutil_virtual_mem, METH_VARARGS,
"Return system virtual memory stats"},
{"swap_mem", psutil_swap_mem, METH_VARARGS,
"Return stats about swap memory, in bytes"},
{"cpu_times", psutil_cpu_times, METH_VARARGS,
"Return system cpu times as a tuple (user, system, nice, idle, irc)"},
{"per_cpu_times", psutil_per_cpu_times, METH_VARARGS,
"Return system per-cpu times as a list of tuples"},
{"cpu_freq", psutil_cpu_freq, METH_VARARGS,
"Return cpu current frequency"},
{"boot_time", psutil_boot_time, METH_VARARGS,
"Return the system boot time expressed in seconds since the epoch."},
{"disk_partitions", psutil_disk_partitions, METH_VARARGS,
"Return a list of tuples including device, mount point and "
"fs type for all partitions mounted on the system."},
{"net_io_counters", psutil_net_io_counters, METH_VARARGS,
"Return dict of tuples of networks I/O information."},
{"disk_io_counters", psutil_disk_io_counters, METH_VARARGS,
"Return dict of tuples of disks I/O information."},
{"users", psutil_users, METH_VARARGS,
"Return currently connected users as a list of tuples"},
{"cpu_stats", psutil_cpu_stats, METH_VARARGS,
"Return CPU statistics"},
{"sensors_battery", psutil_sensors_battery, METH_VARARGS,
"Return battery information."},
{"boot_time", psutil_boot_time, METH_VARARGS},
{"cpu_count_cores", psutil_cpu_count_cores, METH_VARARGS},
{"cpu_count_logical", psutil_cpu_count_logical, METH_VARARGS},
{"cpu_freq", psutil_cpu_freq, METH_VARARGS},
{"cpu_stats", psutil_cpu_stats, METH_VARARGS},
{"cpu_times", psutil_cpu_times, METH_VARARGS},
{"disk_io_counters", psutil_disk_io_counters, METH_VARARGS},
{"disk_partitions", psutil_disk_partitions, METH_VARARGS},
{"net_io_counters", psutil_net_io_counters, METH_VARARGS},
{"per_cpu_times", psutil_per_cpu_times, METH_VARARGS},
{"pids", psutil_pids, METH_VARARGS},
{"sensors_battery", psutil_sensors_battery, METH_VARARGS},
{"swap_mem", psutil_swap_mem, METH_VARARGS},
{"users", psutil_users, METH_VARARGS},
{"virtual_mem", psutil_virtual_mem, METH_VARARGS},

// --- others
{"set_debug", psutil_set_debug, METH_VARARGS,
"Enable or disable PSUTIL_DEBUG messages"},
{"set_debug", psutil_set_debug, METH_VARARGS},

{NULL, NULL, 0, NULL}
};
Expand Down
21 changes: 7 additions & 14 deletions psutil/_psutil_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,21 +664,14 @@ extern "C" {
* define the psutil C module methods and initialize the module.
*/
static PyMethodDef mod_methods[] = {
{"getpriority", psutil_posix_getpriority, METH_VARARGS,
"Return process priority"},
{"setpriority", psutil_posix_setpriority, METH_VARARGS,
"Set process priority"},
{"net_if_addrs", psutil_net_if_addrs, METH_VARARGS,
"Retrieve NICs information"},
{"net_if_mtu", psutil_net_if_mtu, METH_VARARGS,
"Retrieve NIC MTU"},
{"net_if_is_running", psutil_net_if_is_running, METH_VARARGS,
"Return True if the NIC is running."},
{"getpagesize", psutil_getpagesize_pywrapper, METH_VARARGS,
"Return memory page size."},
{"getpagesize", psutil_getpagesize_pywrapper, METH_VARARGS},
{"getpriority", psutil_posix_getpriority, METH_VARARGS},
{"net_if_addrs", psutil_net_if_addrs, METH_VARARGS},
{"net_if_is_running", psutil_net_if_is_running, METH_VARARGS},
{"net_if_mtu", psutil_net_if_mtu, METH_VARARGS},
{"setpriority", psutil_posix_setpriority, METH_VARARGS},
#if defined(PSUTIL_BSD) || defined(PSUTIL_OSX)
{"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS,
"Return NIC stats."},
{"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS},
#endif
{NULL, NULL, 0, NULL}
};
Expand Down
Loading

0 comments on commit 6173da2

Please sign in to comment.