repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
z2n-periodogram
z2n-periodogram-master/z2n/stats.py
#! /usr/bin/python # -*- coding: utf-8 -*- # Other libraries import click import numpy as np from numba import jit from tqdm import trange from scipy import optimize from scipy.stats import norm import matplotlib.pyplot as plt @jit(forceobj=True, parallel=True, fastmath=True) def exposure(series) -> None: """ ...
9,648
22.824691
76
py
z2n-periodogram
z2n-periodogram-master/z2n/prompt.py
#! /usr/bin/python # -*- coding: utf-8 -*- # Generic/Built-in import psutil import shelve import pathlib import threading # Other Libraries import click import numpy as np from click_shell import shell import matplotlib.pyplot as mplt # Owned Libraries from z2n import file from z2n import stats from z2n import __doc...
11,094
34.790323
88
py
z2n-periodogram
z2n-periodogram-master/z2n/file.py
#! /usr/bin/python # -*- coding: utf-8 -*- # Generic/Built-in import pathlib # Other Libraries import click import numpy as np from astropy.io import fits from astropy.table import Table def load_file(series, ext) -> int: """ Open file and store time series. Parameters ---------- series : Serie...
17,730
34.820202
86
py
z2n-periodogram
z2n-periodogram-master/z2n/plot.py
#! /usr/bin/python # -*- coding: utf-8 -*- # Generic/Built-in import psutil import pathlib # Other Libraries import click import numpy as np import matplotlib.pyplot as plt # Owned Libraries from z2n import stats from z2n.series import Series class Plot: """ A class to represent the plot of a time series. ...
15,571
39.978947
88
py
z2n-periodogram
z2n-periodogram-master/z2n/__init__.py
#! /usr/bin/python # -*- coding: utf-8 -*- __version__ = '2.0.6' __license__ = 'MIT' __author__ = 'Yohan Alexander' __copyright__ = 'Copyright (C) 2020, Z2n Software, by Yohan Alexander.' __description__ = 'A package for interative periodograms analysis.' __maintainer__ = 'Yohan Alexander' __email__ = 'yohanfranca@gma...
501
32.466667
71
py
z2n-periodogram
z2n-periodogram-master/z2n/series.py
#! /usr/bin/python # -*- coding: utf-8 -*- # Generic/Built-in import sys import copy import psutil import pathlib import tempfile # Other Libraries import h5py import click import termtables import numpy as np import matplotlib.pyplot as plt # Owned Libraries from z2n import file from z2n import stats class Series...
17,816
34.281188
84
py
bmm
bmm-master/setup.py
import setuptools NAME = 'bmm' DESCRIPTION = 'Bayesian Map-matching' with open('README.md') as f: long_description = f.read() with open('requirements.txt') as f: install_requires = f.read().splitlines() METADATA = dict( name="bmm", version='1.3', url='http://github.com/SamDuffield/bmm', aut...
742
22.21875
50
py
bmm
bmm-master/bmm/__init__.py
"""bmm: Bayesian Map-matching""" from bmm.src.inference.smc import initiate_particles from bmm.src.inference.smc import update_particles from bmm.src.inference.smc import offline_map_match from bmm.src.inference.smc import _offline_map_match_fl from bmm.src.inference.smc import updates from bmm.src.inference.sample...
1,060
28.472222
63
py
bmm
bmm-master/bmm/src/tools/edges.py
######################################################################################################################## # Module: edges.py # Description: Some tools including interpolation along a proportion of a given edge, selecting edges within a distance # of a point and discretisation of an edge for ...
13,894
38.251412
121
py
bmm
bmm-master/bmm/src/tools/plot.py
######################################################################################################################## # Module: plot.py # Description: Plot cam_graph, inferred route and/or polyline. # # Web: https://github.com/SamDuffield/bmm ##########################################################################...
5,372
35.55102
120
py
bmm
bmm-master/bmm/src/inference/sample.py
######################################################################################################################## # Module: inference/sample.py # Description: Generate route and polyline from map-matching model. # # Web: https://github.com/SamDuffield/bmm #########################################################...
6,711
45.937063
120
py
bmm
bmm-master/bmm/src/inference/model.py
######################################################################################################################## # Module: inference/model.py # Description: Objects and functions relating to the map-matching state-space model. # # Web: https://github.com/SamDuffield/bmm #########################################...
16,786
46.420904
124
py
bmm
bmm-master/bmm/src/inference/resampling.py
######################################################################################################################## # Module: inference/resampling.py # Description: Resampling schemes for converting weighted particles (series of positions/edges/distances) to # unweighted. Notably multinomial resamplin...
22,840
46.192149
120
py
bmm
bmm-master/bmm/src/inference/backward.py
######################################################################################################################## # Module: inference/backward.py # Description: Implementation of backward simulation for particle smoothing. # # Web: https://github.com/SamDuffield/bmm ##############################################...
18,714
47.86423
120
py
bmm
bmm-master/bmm/src/inference/parameters.py
######################################################################################################################## # Module: inference/parameters.py # Description: Expectation maximisation to infer maximum likelihood hyperparameters. # # Web: https://github.com/SamDuffield/bmm ####################################...
13,538
45.208191
120
py
bmm
bmm-master/bmm/src/inference/proposal.py
######################################################################################################################## # Module: inference/proposal.py # Description: Proposal mechanisms to extend particles (series of positions/edges/distances) and re-weight # in light of a newly received observation. # #...
18,595
44.802956
120
py
bmm
bmm-master/bmm/src/inference/particles.py
######################################################################################################################## # Module: inference/particles.py # Description: Class to store map-matching particles. # # Web: https://github.com/SamDuffield/bmm ####################################################################...
5,927
35.592593
120
py
bmm
bmm-master/bmm/src/inference/smc.py
######################################################################################################################## # Module: inference/smc.py # Description: Implementation of sequential Monte Carlo map-matching. Both offline and online. # # Web: https://github.com/SamDuffield/bmm #################################...
28,889
45.97561
120
py
bmm
bmm-master/tests/test_smc.py
######################################################################################################################## # Module: tests/test_smc.py # Description: Tests for SMC implementation. # # Web: https://github.com/SamDuffield/bayesian-traffic #####################################################################...
6,752
46.893617
120
py
bmm
bmm-master/tests/test_resampling.py
######################################################################################################################## # Module: tests/test_resampling.py # Description: Tests for resampling schemes. # # Web: https://github.com/SamDuffield/bayesian-traffic ##############################################################...
2,864
40.521739
120
py
bmm
bmm-master/tests/test_MMParticles.py
######################################################################################################################## # Module: tests/test_MMParticles.py # Description: Tests for MMParticles class. # # Web: https://github.com/SamDuffield/bayesian-traffic ##############################################################...
2,205
30.070423
120
py
bmm
bmm-master/simulations/sanity_check.py
import numpy as np import pandas as pd import osmnx as ox import json import bmm # Download and project graph graph = ox.graph_from_place('London, UK') graph = ox.project_graph(graph) # Generate synthetic route and polyline generated_route, generated_polyline = bmm.sample_route(graph, timestamps=15, num_obs=20) # ...
609
24.416667
96
py
bmm
bmm-master/simulations/porto/max_rejections_compare.py
import os import json import numpy as np import osmnx as ox import pandas as pd import matplotlib.pyplot as plt import bmm from . import utils seed = 0 np.random.seed(seed) timestamps = 15 n_samps = np.array([50, 100, 150, 200]) lag = 3 mr_max = 20 # max_rejections = np.arange(0, mr_max + 1, step=int(mr_max/5)) ma...
6,552
36.878613
115
py
bmm
bmm-master/simulations/porto/bulk_map_match.py
import os import json import numpy as np import osmnx as ox import pandas as pd import bmm porto_sim_dir = os.getcwd() graph_path = porto_sim_dir + '/portotaxi_graph_portugal-140101.osm._simple.graphml' graph = ox.load_graphml(graph_path) test_route_data_path = '' # Download from https://archive.ics.uci.edu/ml/dat...
1,851
28.870968
146
py
bmm
bmm-master/simulations/porto/utils.py
import functools import gc import json import numpy as np import matplotlib.pyplot as plt import pandas as pd import bmm def read_data(path, chunksize=None): data_reader = pd.read_csv(path, chunksize=10) data_columns = data_reader.get_chunk().columns polyline_converters = {col_name: json.loads for col_n...
5,822
31.171271
109
py
bmm
bmm-master/simulations/porto/parameter_training.py
######################################################################################################################## # Module: parameter_inference.py # Description: Tune hyperparameters using some Porto taxi data. # # Web: https://github.com/SamDuffield/bmm ##########################################################...
1,652
33.4375
120
py
bmm
bmm-master/simulations/porto/total_variation_compare.py
import os import json import numpy as np import osmnx as ox import pandas as pd import bmm from . import utils seed = 0 np.random.seed(seed) timestamps = 15 ffbsi_n_samps = int(1e3) fl_n_samps = np.array([50, 100, 150, 200]) lags = np.array([0, 3, 10]) max_rejections = 30 initial_truncation = None num_repeats = 20...
8,082
41.319372
117
py
bmm
bmm-master/simulations/cambridge/utils.py
import functools import gc import numpy as np import osmnx as ox from networkx import write_gpickle, read_gpickle import bmm def download_cambridge_graph(save_path): cambridge_ll_bbox = [52.245, 52.150, 0.220, 0.025] raw_graph = ox.graph_from_bbox(*cambridge_ll_bbox, trun...
933
21.238095
57
py
bmm
bmm-master/simulations/cambridge/simulated_parameter_training.py
import numpy as np import os from .utils import sample_route, download_cambridge_graph, load_graph import bmm np.random.seed(0) # Load cam_graph graph_path = os.getcwd() + '/cambridge_projected_simple.graphml' if not os.path.exists(graph_path): download_cambridge_graph(graph_path) # Load networkx cam_graph ca...
3,048
36.641975
114
py
bmm
bmm-master/simulations/cambridge/single_route_ffbsi.py
import json import numpy as np import matplotlib.pyplot as plt import os from utils import download_cambridge_graph, load_graph import bmm # Setup seed = 0 np.random.seed(seed) # Model parameters time_interval = 100 route_length = 4 gps_sd = 10 num_inter_cut_off = 10 # Inference parameters n_samps = 1000 max_re...
3,504
31.155963
114
py
bmm
bmm-master/docs/conf.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
2,323
34.753846
79
py
STEP
STEP-master/src/utils.py
import numpy as np def get_neighbor_finder(data, uniform, max_node_idx=None): max_node_idx = max(data.sources.max(), data.destinations.max()) if max_node_idx is None else max_node_idx adj_list = [[] for _ in range(max_node_idx + 1)] for source, destination, edge_idx, timestamp in zip(data.sources, data.de...
7,050
44.490323
163
py
STEP
STEP-master/src/train_gnn.py
import pytorch_lightning as pyl import torch import torch.nn.functional as F import numpy as np import datasets as dataset import torch.utils.data import sklearn from option import args from model.tgat import TGAT class ModelLightning(pyl.LightningModule): def __init__(self, config, backbone): super().__...
3,844
28.128788
122
py
STEP
STEP-master/src/option.py
import argparse parser = argparse.ArgumentParser(description='Denoise') parser.add_argument('--dir_data', type=str, default='../dataset') parser.add_argument('--data_set', type=str, default='wikipedia') parser.add_argument('--output_edge_txt', type=str, default='./result/edge_pred.txt') parser.add_argument('--mask_e...
1,480
45.28125
108
py
STEP
STEP-master/src/datasets_edge.py
import torch import torch.utils.data import os import numpy as np import random import pandas as pd class Data: def __init__(self, sources, destinations, timestamps, edge_idxs, labels): self.sources = sources self.destinations = destinations self.timestamps = timestamps self.edge_i...
3,073
26.693694
92
py
STEP
STEP-master/src/datasets.py
import torch import torch.utils.data import os import numpy as np from option import args import random import pandas as pd from utils import get_neighbor_finder, masked_get_neighbor_finder from operator import itemgetter class Data: def __init__(self, sources, destinations, timestamps, edge_idxs, labels): ...
9,798
39.159836
130
py
STEP
STEP-master/src/build_dataset_graph.py
from option import args import pandas as pd import numpy as np def preprocess(data_name): u_list, i_list, ts_list, label_list = [], [], [], [] feat_l = [] idx_list = [] with open(data_name) as f: s = next(f) for idx, line in enumerate(f): e = line.strip().split(',') u = int(e[0]) i ...
1,891
23.894737
76
py
STEP
STEP-master/src/eval_gnn.py
import pytorch_lightning as pyl import torch import torch.nn.functional as F import numpy as np import datasets as dataset import torch.utils.data import sklearn from option import args from model.tgat import TGAT class ModelLightning(pyl.LightningModule): def __init__(self, config, backbone): super().__...
4,116
29.272059
122
py
STEP
STEP-master/src/edge_pruning.py
import pytorch_lightning as pyl import torch import torch.nn.functional as F import numpy as np import datasets_edge as dataset import torch.utils.data import sklearn from option import args from model.precom_model import Precom_Model class ModelLightning(pyl.LightningModule): def __init__(self, config, backbone):...
4,096
29.125
122
py
STEP
STEP-master/src/train_gsn.py
import pytorch_lightning as pyl import torch import datasets as dataset import torch.utils.data from option import args from model.tgat import TGAT class ModelLightning(pyl.LightningModule): def __init__(self, config, backbone): super().__init__() self.config = config self.backbone = backb...
4,863
31.426667
95
py
STEP
STEP-master/src/modules/time_encoding.py
import torch import numpy as np class TimeEncode(torch.nn.Module): # Time Encoding proposed by TGAT def __init__(self, dimension): super(TimeEncode, self).__init__() self.dimension = dimension self.w = torch.nn.Linear(1, dimension) self.w.weight = torch.nn.Parameter((torch.from_numpy(1 / 10 ** n...
802
28.740741
99
py
STEP
STEP-master/src/modules/utils.py
import numpy as np import torch from sklearn.metrics import roc_auc_score import math import time class MergeLayer(torch.nn.Module): def __init__(self, dim1, dim2, dim3, dim4): super().__init__() self.layer_norm = torch.nn.LayerNorm(dim1 + dim2) self.fc1 = torch.nn.Linear(dim1 + dim2, dim3) self.fc2 ...
1,731
26.935484
67
py
STEP
STEP-master/src/modules/temporal_attention.py
import torch import torch_scatter as scatter from torch import nn from modules.utils import MergeLayer class TemporalAttentionLayer2(torch.nn.Module): """ Temporal attention layer. Return the temporal embedding of a node given the node itself, its neighbors and the edge timestamps. """ def __init__(self, ...
6,626
43.47651
161
py
STEP
STEP-master/src/modules/embedding_module.py
import torch from torch import nn import numpy as np import math from modules.temporal_attention import TemporalAttentionLayer2 class EmbeddingModule(nn.Module): def __init__(self, time_encoder, n_layers, node_features_dims, edge_features_dims, time_features_dim, hidden_dim, dropout): super(Embed...
7,015
42.57764
113
py
STEP
STEP-master/src/model/tgat.py
import torch import torch.nn as nn import torch.nn.functional as F import torch_scatter as scatter from modules.utils import MergeLayer_output, Feat_Process_Layer from modules.embedding_module import get_embedding_module from modules.time_encoding import TimeEncode from model.gsn import Graph_sampling_network from mode...
5,947
48.983193
125
py
STEP
STEP-master/src/model/gsn.py
import torch import torch.nn.functional as F import torch_scatter as scatter class Graph_sampling_network(torch.nn.Module): def __init__(self, dim, batch_size, mask_ratio=0.5): super(Graph_sampling_network, self).__init__() self.mask_act = 'sigmoid' self.mask_ratio = mask_ratio sel...
4,736
37.201613
136
py
STEP
STEP-master/src/model/gpn.py
import torch from modules.utils import MergeLayer_output, Feat_Process_Layer class Graph_pruning_network(torch.nn.Module): def __init__(self, input_dim, hidden_dim, drop_out): super(Graph_pruning_network, self).__init__() self.edge_dim = input_dim self.dims = hidden_dim self.dropou...
1,839
34.384615
128
py
SIT
SIT-master/tree_util.py
import numpy as np import math import matplotlib.pyplot as plt import ipdb import torch def rotation_matrix(thea): return np.array([ [np.cos(thea), -1 * np.sin(thea)], [np.sin(thea), np.cos(thea)] ]) def generating_tree(seq, dir_list, split_interval=4, degree=3): # seq [N n seq_len 2] ...
6,747
33.080808
109
py
SIT
SIT-master/dataset.py
import pickle import numpy as np from torch.utils import data from util import get_train_test_data, data_augmentation from tree_util import tree_build, tree_label class DatasetETHUCY(data.Dataset): def __init__(self, data_path, dataset_name, batch_size, is_test, end_centered=True, data_flip=Fals...
1,893
34.074074
140
py
SIT
SIT-master/run.py
import argparse from dataset import DatasetETHUCY import util import logging import torch from model.trajectory_model import TrajectoryModel from torch.optim import Adam, lr_scheduler import os logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H...
6,964
36.446237
115
py
SIT
SIT-master/util.py
from typing import Dict import os import subprocess import random import pickle import torch import numpy as np import argparse class Args: dataset = None epoch = None lr = None lr_scheduler = None lr_milestones = None lr_gamma = None obs_len = None pred_len = None train_batch_size...
6,257
29.231884
125
py
SIT
SIT-master/model/component.py
import math import torch import torch.nn as nn import torch.nn.functional as F class Activation_Fun(nn.Module): def __init__(self, act_name): super(Activation_Fun, self).__init__() if act_name == 'relu': self.act = nn.ReLU() if act_name == 'prelu': self.act = nn.P...
2,946
31.384615
118
py
SIT
SIT-master/model/trajectory_model.py
import torch import torch.nn as nn from model.component import MLP from model.component import SelfAttention from util import ModelArgs class TrajectoryModel(nn.Module): def __init__(self, args: ModelArgs): super(TrajectoryModel, self).__init__() in_dim = args.in_dim obs_len = args.obs...
6,157
33.022099
111
py
MCEq
MCEq-master/setup.py
import sys from os.path import join, dirname, abspath from setuptools import setup, Extension from distutils.command import build_ext def get_export_symbols(self, ext): """From https://bugs.python.org/issue35893""" parts = ext.name.split(".") # print('parts', parts) if parts[-1] == "__init__": ...
3,622
31.936364
118
py
MCEq
MCEq-master/mceq_config.py
from __future__ import print_function import sys import platform import os.path as path import warnings base_path = path.dirname(path.abspath(__file__)) #: Debug flag for verbose printing, 0 silences MCEq entirely debug_level = 1 #: Override debug prinput for functions listed here (just give the name, #: "get_solution...
14,601
33.601896
99
py
MCEq
MCEq-master/docs/conf.py
# -*- coding: utf-8 -*- # # Matrix Cascade Equation (MCEq) documentation build configuration file, created by # sphinx-quickstart on Fri Nov 21 10:13:38 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # au...
9,553
31.386441
83
py
MCEq
MCEq-master/MCEq/core.py
import os import six from time import time import numpy as np import mceq_config as config from MCEq.misc import normalize_hadronic_model_name, info from MCEq.particlemanager import ParticleManager import MCEq.data class MCEqRun(object): """Main class for handling the calculation. This class is the main user...
54,114
40.626923
104
py
MCEq
MCEq-master/MCEq/particlemanager.py
import six from math import copysign import numpy as np import mceq_config as config from MCEq.misc import info, print_in_rows, getAZN from particletools.tables import PYTHIAParticleData info(5, 'Initialization of PYTHIAParticleData object') _pdata = PYTHIAParticleData() backward_compatible_namestr = { 'nu_mu': ...
45,993
38.244027
91
py
MCEq
MCEq-master/MCEq/misc.py
from __future__ import print_function from collections import namedtuple import numpy as np import mceq_config as config #: Energy grid (centers, bind widths, dimension) energy_grid = namedtuple("energy_grid", ("c", "b", "w", "d")) #: Matrix with x_lab=E_child/E_parent values _xmat = None def normalize_hadronic_mod...
6,702
27.402542
79
py
MCEq
MCEq-master/MCEq/data.py
import six import numpy as np import h5py from collections import defaultdict import mceq_config as config from os.path import join, isfile from .misc import normalize_hadronic_model_name, info # TODO: Convert this to some functional generic class. Very erro prone to # enter stuff by hand equivalences = { 'SIBYLL...
35,586
35.954309
89
py
MCEq
MCEq-master/MCEq/charm_models.py
# -*- coding: utf-8 -*- """ :mod:`MCEq.charm_models` --- charmed particle production ======================================================== This module includes classes for custom charmed particle production. Currently only the MRS model is implemented as the class :class:`MRS_charm`. The abstract class :class:`Char...
11,491
32.602339
81
py
MCEq
MCEq-master/MCEq/version.py
__version__ = '1.2.6'
22
10.5
21
py
MCEq
MCEq-master/MCEq/__init__.py
0
0
0
py
MCEq
MCEq-master/MCEq/solvers.py
import numpy as np import mceq_config as config from MCEq.misc import info def solv_numpy(nsteps, dX, rho_inv, int_m, dec_m, phi, grid_idcs): """:mod:`numpy` implementation of forward-euler integration. Args: nsteps (int): number of integration steps dX (numpy.array[nsteps]): vector of step-size...
12,678
34.317549
96
py
MCEq
MCEq-master/MCEq/tests/test_densities.py
import numpy as np def test_corsika_atm(): from MCEq.geometry.density_profiles import CorsikaAtmosphere # Depth at surface and density at X=100 g/cm2 cka_surf_100 = [ (1036.099233683902, 0.00015623258808300557), (1033.8094962133184, 0.00015782685585891685), (1055.861981113731, 0.0...
2,689
37.985507
99
py
MCEq
MCEq-master/MCEq/tests/test_msis.py
from __future__ import print_function result_expected = \ """6.665177E+05 1.138806E+08 1.998211E+07 4.022764E+05 3.557465E+03 4.074714E-15 3.475312E+04 4.095913E+06 2.667273E+04 1.250540E+03 1.241416E+03 3.407293E+06 1.586333E+08 1.391117E+07 3.262560E+05 1.559618E+03 5.001846E-15 4.854208E+04 4.380967E+06 6.956682E+...
11,398
49.438053
146
py
MCEq
MCEq-master/MCEq/tests/test_mceq.py
from __future__ import print_function import mceq_config as config from MCEq.core import MCEqRun import crflux.models as pm import numpy as np import pytest import sys if sys.platform.startswith("win") and sys.maxsize <= 2**32: pytest.skip("Skip model test on 32-bit Windows.", allow_module_level=True) def forma...
2,845
29.276596
109
py
MCEq
MCEq-master/MCEq/geometry/density_profiles.py
from abc import ABCMeta, abstractmethod from six import with_metaclass from os.path import join import numpy as np from MCEq.misc import theta_rad from MCEq.misc import info import mceq_config as config class EarthsAtmosphere(with_metaclass(ABCMeta)): """ Abstract class containing common methods on atmospher...
50,633
33.562457
115
py
MCEq
MCEq-master/MCEq/geometry/nrlmsise00_mceq.py
from MCEq.misc import info import six import MCEq.geometry.nrlmsise00.nrlmsise00 as cmsis class NRLMSISE00Base(object): def __init__(self): # Cache altitude value of last call self.last_alt = None self.inp = cmsis.nrlmsise_input() self.output = cmsis.nrlmsise_output() self...
6,859
34
79
py
MCEq
MCEq-master/MCEq/geometry/geometry.py
import sys import numpy as np from MCEq.misc import theta_rad import mceq_config as config class EarthGeometry(object): r"""A model of the Earth's geometry, approximating it by a sphere. The figure below illustrates the meaning of the parameters. .. figure:: graphics/geometry.* :scale: 30 % ...
7,994
33.61039
82
py
MCEq
MCEq-master/MCEq/geometry/__init__.py
0
0
0
py
MCEq
MCEq-master/MCEq/geometry/corsikaatm/corsikaatm.py
from ctypes import (cdll, Structure, c_int, c_double, POINTER) import os import sysconfig base = os.path.dirname(os.path.abspath(__file__)) suffix = sysconfig.get_config_var('EXT_SUFFIX') # Some Python 2.7 versions don't define EXT_SUFFIX if suffix is None and 'SO' in sysconfig.get_config_vars(): suffix = syscon...
1,406
32.5
74
py
MCEq
MCEq-master/MCEq/geometry/corsikaatm/__init__.py
0
0
0
py
MCEq
MCEq-master/MCEq/geometry/nrlmsise00/nrlmsise00.py
''' Ctypes interface for struct-based interface to the C-version of NRLMSISE-00. This C version of NRLMSISE-00 is written by Dominik Brodowski ''' from ctypes import (cdll, Structure, c_int, c_double, pointer, byref, POINTER) import os import sysconfig base = os.path.dirname(os.path.abspath(__file__)) suffix = sysc...
1,581
33.391304
78
py
MCEq
MCEq-master/MCEq/geometry/nrlmsise00/__init__.py
0
0
0
py
qemu
qemu-master/python/setup.py
#!/usr/bin/env python3 """ QEMU tooling installer script Copyright (c) 2020-2021 John Snow for Red Hat, Inc. """ import setuptools from setuptools.command import bdist_egg import sys import pkg_resources class bdist_egg_guard(bdist_egg.bdist_egg): """ Protect against bdist_egg from being executed This p...
989
23.146341
86
py
qemu
qemu-master/python/qemu/qmp/error.py
""" QMP Error Classes This package seeks to provide semantic error classes that are intended to be used directly by clients when they would like to handle particular semantic failures (e.g. "failed to connect") without needing to know the enumeration of possible reasons for that failure. QMPError serves as the ancest...
1,701
32.372549
76
py
qemu
qemu-master/python/qemu/qmp/legacy.py
""" (Legacy) Sync QMP Wrapper This module provides the `QEMUMonitorProtocol` class, which is a synchronous wrapper around `QMPClient`. Its design closely resembles that of the original QEMUMonitorProtocol class, originally written by Luiz Capitulino. It is provided here for compatibility with scripts inside the QEMU ...
10,193
30.079268
79
py
qemu
qemu-master/python/qemu/qmp/events.py
""" QMP Events and EventListeners Asynchronous QMP uses `EventListener` objects to listen for events. An `EventListener` is a FIFO event queue that can be pre-filtered to listen for only specific events. Each `EventListener` instance receives its own copy of events that it hears, so events may be consumed without fear...
22,625
30.512535
78
py
qemu
qemu-master/python/qemu/qmp/message.py
""" QMP Message Format This module provides the `Message` class, which represents a single QMP message sent to or from the server. """ import json from json import JSONDecodeError from typing import ( Dict, Iterator, Mapping, MutableMapping, Optional, Union, ) from .error import ProtocolError...
6,355
29.266667
91
py
qemu
qemu-master/python/qemu/qmp/qmp_tui.py
# Copyright (c) 2021 # # Authors: # Niteesh Babu G S <niteesh.gs@gmail.com> # # This work is licensed under the terms of the GNU LGPL, version 2 or # later. See the COPYING file in the top-level directory. """ QMP TUI QMP TUI is an asynchronous interface built on top the of the QMP library. It is the successor of QM...
22,153
32.926493
79
py
qemu
qemu-master/python/qemu/qmp/qmp_client.py
""" QMP Protocol Implementation This module provides the `QMPClient` class, which can be used to connect and send commands to a QMP server such as QEMU. The QMP class can be used to either connect to a listening server, or used to listen and accept an incoming connection from that server. """ import asyncio import lo...
22,564
33.397866
78
py
qemu
qemu-master/python/qemu/qmp/util.py
""" Miscellaneous Utilities This module provides asyncio utilities and compatibility wrappers for Python 3.6 to provide some features that otherwise become available in Python 3.7+. Various logging and debugging utilities are also provided, such as `exception_summary()` and `pretty_traceback()`, used primarily for ad...
6,229
27.318182
78
py
qemu
qemu-master/python/qemu/qmp/protocol.py
""" Generic Asynchronous Message-based Protocol Support This module provides a generic framework for sending and receiving messages over an asyncio stream. `AsyncProtocol` is an abstract class that implements the core mechanisms of a simple send/receive protocol, and is designed to be extended. In this package, it is...
38,478
35.164474
79
py
qemu
qemu-master/python/qemu/qmp/models.py
""" QMP Data Models This module provides simplistic data classes that represent the few structures that the QMP spec mandates; they are used to verify incoming data to make sure it conforms to spec. """ # pylint: disable=too-few-public-methods from collections import abc import copy from typing import ( Any, ...
4,442
29.22449
76
py
qemu
qemu-master/python/qemu/qmp/__init__.py
""" QEMU Monitor Protocol (QMP) development library & tooling. This package provides a fairly low-level class for communicating asynchronously with QMP protocol servers, as implemented by QEMU, the QEMU Guest Agent, and the QEMU Storage Daemon. `QMPClient` provides the main functionality of this package. All errors r...
1,545
24.766667
71
py
qemu
qemu-master/python/qemu/qmp/qmp_shell.py
# # Copyright (C) 2009-2022 Red Hat Inc. # # Authors: # Luiz Capitulino <lcapitulino@redhat.com> # John Snow <jsnow@redhat.com> # # This work is licensed under the terms of the GNU LGPL, version 2 or # later. See the COPYING file in the top-level directory. # """ Low-level QEMU shell on top of QMP. usage: qmp-shell...
19,800
31.407529
79
py
qemu
qemu-master/python/qemu/utils/qom_common.py
""" QOM Command abstractions. """ ## # Copyright John Snow 2020, for Red Hat, Inc. # Copyright IBM, Corp. 2011 # # Authors: # John Snow <jsnow@redhat.com> # Anthony Liguori <aliguori@amazon.com> # # This work is licensed under the terms of the GNU GPL, version 2 or later. # See the COPYING file in the top-level direc...
4,995
27.386364
79
py
qemu
qemu-master/python/qemu/utils/qemu_ga_client.py
""" QEMU Guest Agent Client Usage: Start QEMU with: # qemu [...] -chardev socket,path=/tmp/qga.sock,server=on,wait=off,id=qga0 \ -device virtio-serial \ -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 Run the script: $ qemu-ga-client --address=/tmp/qga.sock <command> [args...] or $ export QGA...
9,490
28.29321
77
py
qemu
qemu-master/python/qemu/utils/qom.py
""" QEMU Object Model testing tools. usage: qom [-h] {set,get,list,tree,fuse} ... Query and manipulate QOM data optional arguments: -h, --help show this help message and exit QOM commands: {set,get,list,tree,fuse} set Set a QOM property value get Get a QOM propert...
7,580
26.667883
79
py
qemu
qemu-master/python/qemu/utils/accel.py
""" QEMU accel module: This module provides utilities for discover and check the availability of accelerators. """ # Copyright (C) 2015-2016 Red Hat Inc. # Copyright (C) 2012 IBM Corp. # # Authors: # Fam Zheng <famz@redhat.com> # # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING fi...
2,348
26.635294
75
py
qemu
qemu-master/python/qemu/utils/qom_fuse.py
""" QEMU Object Model FUSE filesystem tool This script offers a simple FUSE filesystem within which the QOM tree may be browsed, queried and edited using traditional shell tooling. This script requires the 'fusepy' python package. usage: qom-fuse [-h] [--socket SOCKET] <mount> Mount a QOM tree as a FUSE filesystem...
5,978
27.745192
78
py
qemu
qemu-master/python/qemu/utils/__init__.py
""" QEMU development and testing utilities This package provides a small handful of utilities for performing various tasks not directly related to the launching of a VM. """ # Copyright (C) 2021 Red Hat Inc. # # Authors: # John Snow <jsnow@redhat.com> # Cleber Rosa <crosa@redhat.com> # # This work is licensed under...
5,382
32.02454
78
py
qemu
qemu-master/python/qemu/machine/machine.py
""" QEMU machine module: The machine module primarily provides the QEMUMachine class, which provides facilities for managing the lifetime of a QEMU VM. """ # Copyright (C) 2015-2016 Red Hat Inc. # Copyright (C) 2012 IBM Corp. # # Authors: # Fam Zheng <famz@redhat.com> # # This work is licensed under the terms of the...
31,109
33.29989
79
py
qemu
qemu-master/python/qemu/machine/qtest.py
""" QEMU qtest library qtest offers the QEMUQtestProtocol and QEMUQTestMachine classes, which offer a connection to QEMU's qtest protocol socket, and a qtest-enabled subclass of QEMUMachine, respectively. """ # Copyright (C) 2015 Red Hat Inc. # # Authors: # Fam Zheng <famz@redhat.com> # # This work is licensed under...
4,696
27.640244
75
py
qemu
qemu-master/python/qemu/machine/console_socket.py
""" QEMU Console Socket Module: This python module implements a ConsoleSocket object, which can drain a socket and optionally dump the bytes to file. """ # Copyright 2020 Linaro # # Authors: # Robert Foley <robert.foley@linaro.org> # # This code is licensed under the GPL version 2 or later. See # the COPYING file in...
4,685
35.046154
72
py
qemu
qemu-master/python/qemu/machine/__init__.py
""" QEMU development and testing library. This library provides a few high-level classes for driving QEMU from a test suite, not intended for production use. | QEMUQtestProtocol: send/receive qtest messages. | QEMUMachine: Configure and Boot a QEMU VM | +-- QEMUQtestMachine: VM class, with a qtest socket. """ # ...
945
24.567568
71
py
qemu
qemu-master/python/tests/protocol.py
import asyncio from contextlib import contextmanager import os import socket from tempfile import TemporaryDirectory import avocado from qemu.qmp import ConnectError, Runstate from qemu.qmp.protocol import AsyncProtocol, StateError from qemu.qmp.util import asyncio_run, create_task class NullProtocol(AsyncProtocol[...
18,678
30.288107
80
py
qemu
qemu-master/target/hexagon/gen_analyze_funcs.py
#!/usr/bin/env python3 ## ## Copyright(c) 2022-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the Licen...
9,792
37.70751
80
py
qemu
qemu-master/target/hexagon/gen_helper_funcs.py
#!/usr/bin/env python3 ## ## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the Licen...
12,876
35.68661
80
py