id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
39,000
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
_GetRealImagArray
def _GetRealImagArray(Array): """ Returns the real and imaginary components of each element in an array and returns them in 2 resulting arrays. Parameters ---------- Array : ndarray Input array Returns ------- RealArray : ndarray The real components of the input array ...
python
def _GetRealImagArray(Array): """ Returns the real and imaginary components of each element in an array and returns them in 2 resulting arrays. Parameters ---------- Array : ndarray Input array Returns ------- RealArray : ndarray The real components of the input array ...
[ "def", "_GetRealImagArray", "(", "Array", ")", ":", "ImagArray", "=", "_np", ".", "array", "(", "[", "num", ".", "imag", "for", "num", "in", "Array", "]", ")", "RealArray", "=", "_np", ".", "array", "(", "[", "num", ".", "real", "for", "num", "in",...
Returns the real and imaginary components of each element in an array and returns them in 2 resulting arrays. Parameters ---------- Array : ndarray Input array Returns ------- RealArray : ndarray The real components of the input array ImagArray : ndarray The imagina...
[ "Returns", "the", "real", "and", "imaginary", "components", "of", "each", "element", "in", "an", "array", "and", "returns", "them", "in", "2", "resulting", "arrays", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3311-L3329
39,001
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
_GetComplexConjugateArray
def _GetComplexConjugateArray(Array): """ Calculates the complex conjugate of each element in an array and returns the resulting array. Parameters ---------- Array : ndarray Input array Returns ------- ConjArray : ndarray The complex conjugate of the input array. ""...
python
def _GetComplexConjugateArray(Array): """ Calculates the complex conjugate of each element in an array and returns the resulting array. Parameters ---------- Array : ndarray Input array Returns ------- ConjArray : ndarray The complex conjugate of the input array. ""...
[ "def", "_GetComplexConjugateArray", "(", "Array", ")", ":", "ConjArray", "=", "_np", ".", "array", "(", "[", "num", ".", "conj", "(", ")", "for", "num", "in", "Array", "]", ")", "return", "ConjArray" ]
Calculates the complex conjugate of each element in an array and returns the resulting array. Parameters ---------- Array : ndarray Input array Returns ------- ConjArray : ndarray The complex conjugate of the input array.
[ "Calculates", "the", "complex", "conjugate", "of", "each", "element", "in", "an", "array", "and", "returns", "the", "resulting", "array", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3332-L3347
39,002
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
fm_discriminator
def fm_discriminator(Signal): """ Calculates the digital FM discriminator from a real-valued time signal. Parameters ---------- Signal : array-like A real-valued time signal Returns ------- fmDiscriminator : array-like The digital FM discriminator of the argument signal...
python
def fm_discriminator(Signal): """ Calculates the digital FM discriminator from a real-valued time signal. Parameters ---------- Signal : array-like A real-valued time signal Returns ------- fmDiscriminator : array-like The digital FM discriminator of the argument signal...
[ "def", "fm_discriminator", "(", "Signal", ")", ":", "S_analytic", "=", "_hilbert", "(", "Signal", ")", "S_analytic_star", "=", "_GetComplexConjugateArray", "(", "S_analytic", ")", "S_analytic_hat", "=", "S_analytic", "[", "1", ":", "]", "*", "S_analytic_star", "...
Calculates the digital FM discriminator from a real-valued time signal. Parameters ---------- Signal : array-like A real-valued time signal Returns ------- fmDiscriminator : array-like The digital FM discriminator of the argument signal
[ "Calculates", "the", "digital", "FM", "discriminator", "from", "a", "real", "-", "valued", "time", "signal", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3350-L3369
39,003
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
find_collisions
def find_collisions(Signal, tolerance=50): """ Finds collision events in the signal from the shift in phase of the signal. Parameters ---------- Signal : array_like Array containing the values of the signal of interest containing a single frequency. tolerance : float Percentage ...
python
def find_collisions(Signal, tolerance=50): """ Finds collision events in the signal from the shift in phase of the signal. Parameters ---------- Signal : array_like Array containing the values of the signal of interest containing a single frequency. tolerance : float Percentage ...
[ "def", "find_collisions", "(", "Signal", ",", "tolerance", "=", "50", ")", ":", "fmd", "=", "fm_discriminator", "(", "Signal", ")", "mean_fmd", "=", "_np", ".", "mean", "(", "fmd", ")", "Collisions", "=", "[", "_is_this_a_collision", "(", "[", "value", "...
Finds collision events in the signal from the shift in phase of the signal. Parameters ---------- Signal : array_like Array containing the values of the signal of interest containing a single frequency. tolerance : float Percentage tolerance, if the value of the FM Discriminator varies ...
[ "Finds", "collision", "events", "in", "the", "signal", "from", "the", "shift", "in", "phase", "of", "the", "signal", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3416-L3439
39,004
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
count_collisions
def count_collisions(Collisions): """ Counts the number of unique collisions and gets the collision index. Parameters ---------- Collisions : array_like Array of booleans, containing true if during a collision event, false otherwise. Returns ------- CollisionCount : int ...
python
def count_collisions(Collisions): """ Counts the number of unique collisions and gets the collision index. Parameters ---------- Collisions : array_like Array of booleans, containing true if during a collision event, false otherwise. Returns ------- CollisionCount : int ...
[ "def", "count_collisions", "(", "Collisions", ")", ":", "CollisionCount", "=", "0", "CollisionIndicies", "=", "[", "]", "lastval", "=", "True", "for", "i", ",", "val", "in", "enumerate", "(", "Collisions", ")", ":", "if", "val", "==", "True", "and", "las...
Counts the number of unique collisions and gets the collision index. Parameters ---------- Collisions : array_like Array of booleans, containing true if during a collision event, false otherwise. Returns ------- CollisionCount : int Number of unique collisions CollisionIndi...
[ "Counts", "the", "number", "of", "unique", "collisions", "and", "gets", "the", "collision", "index", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3442-L3466
39,005
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
steady_state_potential
def steady_state_potential(xdata,HistBins=100): """ Calculates the steady state potential. Used in fit_radius_from_potentials. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. N...
python
def steady_state_potential(xdata,HistBins=100): """ Calculates the steady state potential. Used in fit_radius_from_potentials. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. N...
[ "def", "steady_state_potential", "(", "xdata", ",", "HistBins", "=", "100", ")", ":", "import", "numpy", "as", "_np", "pops", "=", "_np", ".", "histogram", "(", "xdata", ",", "HistBins", ")", "[", "0", "]", "bins", "=", "_np", ".", "histogram", "(", ...
Calculates the steady state potential. Used in fit_radius_from_potentials. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. Number of position points at which the potential is ca...
[ "Calculates", "the", "steady", "state", "potential", ".", "Used", "in", "fit_radius_from_potentials", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3693-L3726
39,006
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_z0_and_conv_factor_from_ratio_of_harmonics
def calc_z0_and_conv_factor_from_ratio_of_harmonics(z, z2, NA=0.999): """ Calculates the Conversion Factor and physical amplitude of motion in nms by comparison of the ratio of the heights of the z signal and second harmonic of z. Parameters ---------- z : ndarray array containing...
python
def calc_z0_and_conv_factor_from_ratio_of_harmonics(z, z2, NA=0.999): """ Calculates the Conversion Factor and physical amplitude of motion in nms by comparison of the ratio of the heights of the z signal and second harmonic of z. Parameters ---------- z : ndarray array containing...
[ "def", "calc_z0_and_conv_factor_from_ratio_of_harmonics", "(", "z", ",", "z2", ",", "NA", "=", "0.999", ")", ":", "V1", "=", "calc_mean_amp", "(", "z", ")", "V2", "=", "calc_mean_amp", "(", "z2", ")", "ratio", "=", "V2", "/", "V1", "beta", "=", "4", "*...
Calculates the Conversion Factor and physical amplitude of motion in nms by comparison of the ratio of the heights of the z signal and second harmonic of z. Parameters ---------- z : ndarray array containing z signal in volts z2 : ndarray array containing second harmonic of z ...
[ "Calculates", "the", "Conversion", "Factor", "and", "physical", "amplitude", "of", "motion", "in", "nms", "by", "comparison", "of", "the", "ratio", "of", "the", "heights", "of", "the", "z", "signal", "and", "second", "harmonic", "of", "z", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3909-L3942
39,007
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_mass_from_z0
def calc_mass_from_z0(z0, w0): """ Calculates the mass of the particle using the equipartition from the angular frequency of the z signal and the average amplitude of the z signal in nms. Parameters ---------- z0 : float Physical average amplitude of motion in nms w0 : float ...
python
def calc_mass_from_z0(z0, w0): """ Calculates the mass of the particle using the equipartition from the angular frequency of the z signal and the average amplitude of the z signal in nms. Parameters ---------- z0 : float Physical average amplitude of motion in nms w0 : float ...
[ "def", "calc_mass_from_z0", "(", "z0", ",", "w0", ")", ":", "T0", "=", "300", "mFromEquipartition", "=", "Boltzmann", "*", "T0", "/", "(", "w0", "**", "2", "*", "z0", "**", "2", ")", "return", "mFromEquipartition" ]
Calculates the mass of the particle using the equipartition from the angular frequency of the z signal and the average amplitude of the z signal in nms. Parameters ---------- z0 : float Physical average amplitude of motion in nms w0 : float Angular Frequency of z motion Ret...
[ "Calculates", "the", "mass", "of", "the", "particle", "using", "the", "equipartition", "from", "the", "angular", "frequency", "of", "the", "z", "signal", "and", "the", "average", "amplitude", "of", "the", "z", "signal", "in", "nms", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3944-L3964
39,008
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_mass_from_fit_and_conv_factor
def calc_mass_from_fit_and_conv_factor(A, Damping, ConvFactor): """ Calculates mass from the A parameter from fitting, the damping from fitting in angular units and the Conversion factor calculated from comparing the ratio of the z signal and first harmonic of z. Parameters ---------- A :...
python
def calc_mass_from_fit_and_conv_factor(A, Damping, ConvFactor): """ Calculates mass from the A parameter from fitting, the damping from fitting in angular units and the Conversion factor calculated from comparing the ratio of the z signal and first harmonic of z. Parameters ---------- A :...
[ "def", "calc_mass_from_fit_and_conv_factor", "(", "A", ",", "Damping", ",", "ConvFactor", ")", ":", "T0", "=", "300", "mFromA", "=", "2", "*", "Boltzmann", "*", "T0", "/", "(", "pi", "*", "A", ")", "*", "ConvFactor", "**", "2", "*", "Damping", "return"...
Calculates mass from the A parameter from fitting, the damping from fitting in angular units and the Conversion factor calculated from comparing the ratio of the z signal and first harmonic of z. Parameters ---------- A : float A factor calculated from fitting Damping : float ...
[ "Calculates", "mass", "from", "the", "A", "parameter", "from", "fitting", "the", "damping", "from", "fitting", "in", "angular", "units", "and", "the", "Conversion", "factor", "calculated", "from", "comparing", "the", "ratio", "of", "the", "z", "signal", "and",...
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3966-L3988
39,009
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
unit_conversion
def unit_conversion(array, unit_prefix, current_prefix=""): """ Converts an array or value to of a certain unit scale to another unit scale. Accepted units are: E - exa - 1e18 P - peta - 1e15 T - tera - 1e12 G - giga - 1e9 M - mega - 1e6 k - kilo - 1e3 m - milli - 1e-3 ...
python
def unit_conversion(array, unit_prefix, current_prefix=""): """ Converts an array or value to of a certain unit scale to another unit scale. Accepted units are: E - exa - 1e18 P - peta - 1e15 T - tera - 1e12 G - giga - 1e9 M - mega - 1e6 k - kilo - 1e3 m - milli - 1e-3 ...
[ "def", "unit_conversion", "(", "array", ",", "unit_prefix", ",", "current_prefix", "=", "\"\"", ")", ":", "UnitDict", "=", "{", "'E'", ":", "1e18", ",", "'P'", ":", "1e15", ",", "'T'", ":", "1e12", ",", "'G'", ":", "1e9", ",", "'M'", ":", "1e6", ",...
Converts an array or value to of a certain unit scale to another unit scale. Accepted units are: E - exa - 1e18 P - peta - 1e15 T - tera - 1e12 G - giga - 1e9 M - mega - 1e6 k - kilo - 1e3 m - milli - 1e-3 u - micro - 1e-6 n - nano - 1e-9 p - pico - 1e-12 f - femto ...
[ "Converts", "an", "array", "or", "value", "to", "of", "a", "certain", "unit", "scale", "to", "another", "unit", "scale", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L4062-L4121
39,010
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
get_wigner
def get_wigner(z, freq, sample_freq, histbins=200, show_plot=False): """ Calculates an approximation to the wigner quasi-probability distribution by splitting the z position array into slices of the length of one period of the motion. This slice is then associated with phase from -180 to 180 degrees...
python
def get_wigner(z, freq, sample_freq, histbins=200, show_plot=False): """ Calculates an approximation to the wigner quasi-probability distribution by splitting the z position array into slices of the length of one period of the motion. This slice is then associated with phase from -180 to 180 degrees...
[ "def", "get_wigner", "(", "z", ",", "freq", ",", "sample_freq", ",", "histbins", "=", "200", ",", "show_plot", "=", "False", ")", ":", "phase", ",", "phase_slices", "=", "extract_slices", "(", "z", ",", "freq", ",", "sample_freq", ",", "show_plot", "=", ...
Calculates an approximation to the wigner quasi-probability distribution by splitting the z position array into slices of the length of one period of the motion. This slice is then associated with phase from -180 to 180 degrees. These slices are then histogramed in order to get a distribution of counts ...
[ "Calculates", "an", "approximation", "to", "the", "wigner", "quasi", "-", "probability", "distribution", "by", "splitting", "the", "z", "position", "array", "into", "slices", "of", "the", "length", "of", "one", "period", "of", "the", "motion", ".", "This", "...
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L4233-L4278
39,011
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
plot_wigner3d
def plot_wigner3d(iradon_output, bin_centres, bin_centre_units="", cmap=_cm.cubehelix_r, view=(10, -45), figsize=(10, 10)): """ Plots the wigner space representation as a 3D surface plot. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ...
python
def plot_wigner3d(iradon_output, bin_centres, bin_centre_units="", cmap=_cm.cubehelix_r, view=(10, -45), figsize=(10, 10)): """ Plots the wigner space representation as a 3D surface plot. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ...
[ "def", "plot_wigner3d", "(", "iradon_output", ",", "bin_centres", ",", "bin_centre_units", "=", "\"\"", ",", "cmap", "=", "_cm", ".", "cubehelix_r", ",", "view", "=", "(", "10", ",", "-", "45", ")", ",", "figsize", "=", "(", "10", ",", "10", ")", ")"...
Plots the wigner space representation as a 3D surface plot. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ndarray positions of the bin centres bin_centre_units : string, optional (default="") Units in which the bin_centres...
[ "Plots", "the", "wigner", "space", "representation", "as", "a", "3D", "surface", "plot", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L4280-L4340
39,012
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
plot_wigner2d
def plot_wigner2d(iradon_output, bin_centres, cmap=_cm.cubehelix_r, figsize=(6, 6)): """ Plots the wigner space representation as a 2D heatmap. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ndarray positions of the bin centres...
python
def plot_wigner2d(iradon_output, bin_centres, cmap=_cm.cubehelix_r, figsize=(6, 6)): """ Plots the wigner space representation as a 2D heatmap. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ndarray positions of the bin centres...
[ "def", "plot_wigner2d", "(", "iradon_output", ",", "bin_centres", ",", "cmap", "=", "_cm", ".", "cubehelix_r", ",", "figsize", "=", "(", "6", ",", "6", ")", ")", ":", "xx", ",", "yy", "=", "_np", ".", "meshgrid", "(", "bin_centres", ",", "bin_centres",...
Plots the wigner space representation as a 2D heatmap. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ndarray positions of the bin centres cmap : matplotlib.cm.cmap, optional (default=cm.cubehelix_r) color map to use for Wi...
[ "Plots", "the", "wigner", "space", "representation", "as", "a", "2D", "heatmap", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L4343-L4412
39,013
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.get_time_data
def get_time_data(self, timeStart=None, timeEnd=None): """ Gets the time and voltage data. Parameters ---------- timeStart : float, optional The time get data from. By default it uses the first time point timeEnd : float, optional The ...
python
def get_time_data(self, timeStart=None, timeEnd=None): """ Gets the time and voltage data. Parameters ---------- timeStart : float, optional The time get data from. By default it uses the first time point timeEnd : float, optional The ...
[ "def", "get_time_data", "(", "self", ",", "timeStart", "=", "None", ",", "timeEnd", "=", "None", ")", ":", "if", "timeStart", "==", "None", ":", "timeStart", "=", "self", ".", "timeStart", "if", "timeEnd", "==", "None", ":", "timeEnd", "=", "self", "."...
Gets the time and voltage data. Parameters ---------- timeStart : float, optional The time get data from. By default it uses the first time point timeEnd : float, optional The time to finish getting data from. By default it uses the last t...
[ "Gets", "the", "time", "and", "voltage", "data", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L248-L283
39,014
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.plot_time_data
def plot_time_data(self, timeStart=None, timeEnd=None, units='s', show_fig=True): """ plot time data against voltage data. Parameters ---------- timeStart : float, optional The time to start plotting from. By default it uses the first time point t...
python
def plot_time_data(self, timeStart=None, timeEnd=None, units='s', show_fig=True): """ plot time data against voltage data. Parameters ---------- timeStart : float, optional The time to start plotting from. By default it uses the first time point t...
[ "def", "plot_time_data", "(", "self", ",", "timeStart", "=", "None", ",", "timeEnd", "=", "None", ",", "units", "=", "'s'", ",", "show_fig", "=", "True", ")", ":", "unit_prefix", "=", "units", "[", ":", "-", "1", "]", "# removed the last char", "if", "...
plot time data against voltage data. Parameters ---------- timeStart : float, optional The time to start plotting from. By default it uses the first time point timeEnd : float, optional The time to finish plotting at. By default it uses th...
[ "plot", "time", "data", "against", "voltage", "data", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L285-L331
39,015
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.plot_PSD
def plot_PSD(self, xlim=None, units="kHz", show_fig=True, timeStart=None, timeEnd=None, *args, **kwargs): """ plot the pulse spectral density. Parameters ---------- xlim : array_like, optional The x limits of the plotted PSD [LowerLimit, UpperLimit] Defau...
python
def plot_PSD(self, xlim=None, units="kHz", show_fig=True, timeStart=None, timeEnd=None, *args, **kwargs): """ plot the pulse spectral density. Parameters ---------- xlim : array_like, optional The x limits of the plotted PSD [LowerLimit, UpperLimit] Defau...
[ "def", "plot_PSD", "(", "self", ",", "xlim", "=", "None", ",", "units", "=", "\"kHz\"", ",", "show_fig", "=", "True", ",", "timeStart", "=", "None", ",", "timeEnd", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# self.get_...
plot the pulse spectral density. Parameters ---------- xlim : array_like, optional The x limits of the plotted PSD [LowerLimit, UpperLimit] Default value is [0, SampleFreq/2] units : string, optional Units of frequency to plot on the x axis - defaults...
[ "plot", "the", "pulse", "spectral", "density", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L383-L425
39,016
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.calc_area_under_PSD
def calc_area_under_PSD(self, lowerFreq, upperFreq): """ Sums the area under the PSD from lowerFreq to upperFreq. Parameters ---------- lowerFreq : float The lower limit of frequency to sum from upperFreq : float The upper limit of frequency to su...
python
def calc_area_under_PSD(self, lowerFreq, upperFreq): """ Sums the area under the PSD from lowerFreq to upperFreq. Parameters ---------- lowerFreq : float The lower limit of frequency to sum from upperFreq : float The upper limit of frequency to su...
[ "def", "calc_area_under_PSD", "(", "self", ",", "lowerFreq", ",", "upperFreq", ")", ":", "Freq_startAreaPSD", "=", "take_closest", "(", "self", ".", "freqs", ",", "lowerFreq", ")", "index_startAreaPSD", "=", "int", "(", "_np", ".", "where", "(", "self", ".",...
Sums the area under the PSD from lowerFreq to upperFreq. Parameters ---------- lowerFreq : float The lower limit of frequency to sum from upperFreq : float The upper limit of frequency to sum to Returns ------- AreaUnderPSD : float ...
[ "Sums", "the", "area", "under", "the", "PSD", "from", "lowerFreq", "to", "upperFreq", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L427-L448
39,017
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.get_fit_auto
def get_fit_auto(self, CentralFreq, MaxWidth=15000, MinWidth=500, WidthIntervals=500, MakeFig=True, show_fig=True, silent=False): """ Tries a range of regions to search for peaks and runs the one with the least error and returns the parameters with the least errors. Parameters -...
python
def get_fit_auto(self, CentralFreq, MaxWidth=15000, MinWidth=500, WidthIntervals=500, MakeFig=True, show_fig=True, silent=False): """ Tries a range of regions to search for peaks and runs the one with the least error and returns the parameters with the least errors. Parameters -...
[ "def", "get_fit_auto", "(", "self", ",", "CentralFreq", ",", "MaxWidth", "=", "15000", ",", "MinWidth", "=", "500", ",", "WidthIntervals", "=", "500", ",", "MakeFig", "=", "True", ",", "show_fig", "=", "True", ",", "silent", "=", "False", ")", ":", "Mi...
Tries a range of regions to search for peaks and runs the one with the least error and returns the parameters with the least errors. Parameters ---------- CentralFreq : float The central frequency to use for the fittings. MaxWidth : float, optional The ma...
[ "Tries", "a", "range", "of", "regions", "to", "search", "for", "peaks", "and", "runs", "the", "one", "with", "the", "least", "error", "and", "returns", "the", "parameters", "with", "the", "least", "errors", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L627-L699
39,018
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.calc_gamma_from_variance_autocorrelation_fit
def calc_gamma_from_variance_autocorrelation_fit(self, NumberOfOscillations, GammaGuess=None, silent=False, MakeFig=True, show_fig=True): """ Calculates the total damping, i.e. Gamma, by splitting the time trace into chunks of NumberOfOscillations oscillations and calculated the variance...
python
def calc_gamma_from_variance_autocorrelation_fit(self, NumberOfOscillations, GammaGuess=None, silent=False, MakeFig=True, show_fig=True): """ Calculates the total damping, i.e. Gamma, by splitting the time trace into chunks of NumberOfOscillations oscillations and calculated the variance...
[ "def", "calc_gamma_from_variance_autocorrelation_fit", "(", "self", ",", "NumberOfOscillations", ",", "GammaGuess", "=", "None", ",", "silent", "=", "False", ",", "MakeFig", "=", "True", ",", "show_fig", "=", "True", ")", ":", "try", ":", "SplittedArraySize", "=...
Calculates the total damping, i.e. Gamma, by splitting the time trace into chunks of NumberOfOscillations oscillations and calculated the variance of each of these chunks. This array of varainces is then used for the autocorrleation. The autocorrelation is fitted with an exponential rel...
[ "Calculates", "the", "total", "damping", "i", ".", "e", ".", "Gamma", "by", "splitting", "the", "time", "trace", "into", "chunks", "of", "NumberOfOscillations", "oscillations", "and", "calculated", "the", "variance", "of", "each", "of", "these", "chunks", ".",...
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L701-L768
39,019
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.calc_gamma_from_energy_autocorrelation_fit
def calc_gamma_from_energy_autocorrelation_fit(self, GammaGuess=None, silent=False, MakeFig=True, show_fig=True): """ Calculates the total damping, i.e. Gamma, by calculating the energy each point in time. This energy array is then used for the autocorrleation. The autocorrelation is f...
python
def calc_gamma_from_energy_autocorrelation_fit(self, GammaGuess=None, silent=False, MakeFig=True, show_fig=True): """ Calculates the total damping, i.e. Gamma, by calculating the energy each point in time. This energy array is then used for the autocorrleation. The autocorrelation is f...
[ "def", "calc_gamma_from_energy_autocorrelation_fit", "(", "self", ",", "GammaGuess", "=", "None", ",", "silent", "=", "False", ",", "MakeFig", "=", "True", ",", "show_fig", "=", "True", ")", ":", "autocorrelation", "=", "calc_autocorrelation", "(", "self", ".", ...
Calculates the total damping, i.e. Gamma, by calculating the energy each point in time. This energy array is then used for the autocorrleation. The autocorrelation is fitted with an exponential relaxation function and the function returns the parameters with errors. Parameters ...
[ "Calculates", "the", "total", "damping", "i", ".", "e", ".", "Gamma", "by", "calculating", "the", "energy", "each", "point", "in", "time", ".", "This", "energy", "array", "is", "then", "used", "for", "the", "autocorrleation", ".", "The", "autocorrelation", ...
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L770-L827
39,020
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.extract_parameters
def extract_parameters(self, P_mbar, P_Error, method="chang"): """ Extracts the Radius, mass and Conversion factor for a particle. Parameters ---------- P_mbar : float The pressure in mbar when the data was taken. P_Error : float The error in the...
python
def extract_parameters(self, P_mbar, P_Error, method="chang"): """ Extracts the Radius, mass and Conversion factor for a particle. Parameters ---------- P_mbar : float The pressure in mbar when the data was taken. P_Error : float The error in the...
[ "def", "extract_parameters", "(", "self", ",", "P_mbar", ",", "P_Error", ",", "method", "=", "\"chang\"", ")", ":", "[", "R", ",", "M", ",", "ConvFactor", "]", ",", "[", "RErr", ",", "MErr", ",", "ConvFactorErr", "]", "=", "extract_parameters", "(", "P...
Extracts the Radius, mass and Conversion factor for a particle. Parameters ---------- P_mbar : float The pressure in mbar when the data was taken. P_Error : float The error in the pressure value (as a decimal e.g. 15% = 0.15) Returns ---...
[ "Extracts", "the", "Radius", "mass", "and", "Conversion", "factor", "for", "a", "particle", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L900-L931
39,021
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
ORGTableData.get_value
def get_value(self, ColumnName, RunNo): """ Retreives the value of the collumn named ColumnName associated with a particular run number. Parameters ---------- ColumnName : string The name of the desired org-mode table's collumn RunNo : int ...
python
def get_value(self, ColumnName, RunNo): """ Retreives the value of the collumn named ColumnName associated with a particular run number. Parameters ---------- ColumnName : string The name of the desired org-mode table's collumn RunNo : int ...
[ "def", "get_value", "(", "self", ",", "ColumnName", ",", "RunNo", ")", ":", "Value", "=", "float", "(", "self", ".", "ORGTableData", "[", "self", ".", "ORGTableData", ".", "RunNo", "==", "'{}'", ".", "format", "(", "RunNo", ")", "]", "[", "ColumnName",...
Retreives the value of the collumn named ColumnName associated with a particular run number. Parameters ---------- ColumnName : string The name of the desired org-mode table's collumn RunNo : int The run number for which to retreive the pressure value ...
[ "Retreives", "the", "value", "of", "the", "collumn", "named", "ColumnName", "associated", "with", "a", "particular", "run", "number", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1327-L1348
39,022
AshleySetter/optoanalysis
PotentialComparisonMass.py
steady_state_potential
def steady_state_potential(xdata,HistBins=100): """ Calculates the steady state potential. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. Number of position points at which...
python
def steady_state_potential(xdata,HistBins=100): """ Calculates the steady state potential. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. Number of position points at which...
[ "def", "steady_state_potential", "(", "xdata", ",", "HistBins", "=", "100", ")", ":", "import", "numpy", "as", "np", "pops", "=", "np", ".", "histogram", "(", "xdata", ",", "HistBins", ")", "[", "0", "]", "bins", "=", "np", ".", "histogram", "(", "xd...
Calculates the steady state potential. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. Number of position points at which the potential is calculated. Returns ------- po...
[ "Calculates", "the", "steady", "state", "potential", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/PotentialComparisonMass.py#L5-L37
39,023
MacHu-GWU/crawlib-project
crawlib/pipeline/mongodb/query_builder.py
finished
def finished(finished_status, update_interval, status_key, edit_at_key): """ Create dict query for pymongo that getting all finished task. :param finished_status: int, status code that greater or equal than this will be considered as finished. :param updat...
python
def finished(finished_status, update_interval, status_key, edit_at_key): """ Create dict query for pymongo that getting all finished task. :param finished_status: int, status code that greater or equal than this will be considered as finished. :param updat...
[ "def", "finished", "(", "finished_status", ",", "update_interval", ",", "status_key", ",", "edit_at_key", ")", ":", "return", "{", "status_key", ":", "{", "\"$gte\"", ":", "finished_status", "}", ",", "edit_at_key", ":", "{", "\"$gte\"", ":", "x_seconds_before_n...
Create dict query for pymongo that getting all finished task. :param finished_status: int, status code that greater or equal than this will be considered as finished. :param update_interval: int, the record will be updated every x seconds. :param status_key: status code field key, support dot notat...
[ "Create", "dict", "query", "for", "pymongo", "that", "getting", "all", "finished", "task", "." ]
241516f2a7a0a32c692f7af35a1f44064e8ce1ab
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/pipeline/mongodb/query_builder.py#L18-L42
39,024
MacHu-GWU/crawlib-project
crawlib/pipeline/mongodb/query_builder.py
unfinished
def unfinished(finished_status, update_interval, status_key, edit_at_key): """ Create dict query for pymongo that getting all unfinished task. :param finished_status: int, status code that less than this will be considered as unfinished. :param updat...
python
def unfinished(finished_status, update_interval, status_key, edit_at_key): """ Create dict query for pymongo that getting all unfinished task. :param finished_status: int, status code that less than this will be considered as unfinished. :param updat...
[ "def", "unfinished", "(", "finished_status", ",", "update_interval", ",", "status_key", ",", "edit_at_key", ")", ":", "return", "{", "\"$or\"", ":", "[", "{", "status_key", ":", "{", "\"$lt\"", ":", "finished_status", "}", "}", ",", "{", "edit_at_key", ":", ...
Create dict query for pymongo that getting all unfinished task. :param finished_status: int, status code that less than this will be considered as unfinished. :param update_interval: int, the record will be updated every x seconds. :param status_key: status code field key, support dot notation. ...
[ "Create", "dict", "query", "for", "pymongo", "that", "getting", "all", "unfinished", "task", "." ]
241516f2a7a0a32c692f7af35a1f44064e8ce1ab
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/pipeline/mongodb/query_builder.py#L52-L77
39,025
sporsh/carnifex
carnifex/ssh/command.py
SSHCommand.getCommandLine
def getCommandLine(self): """Insert the precursor and change directory commands """ commandLine = self.precursor + self.sep if self.precursor else '' commandLine += self.cd + ' ' + self.path + self.sep if self.path else '' commandLine += PosixCommand.getCommandLine(self) ...
python
def getCommandLine(self): """Insert the precursor and change directory commands """ commandLine = self.precursor + self.sep if self.precursor else '' commandLine += self.cd + ' ' + self.path + self.sep if self.path else '' commandLine += PosixCommand.getCommandLine(self) ...
[ "def", "getCommandLine", "(", "self", ")", ":", "commandLine", "=", "self", ".", "precursor", "+", "self", ".", "sep", "if", "self", ".", "precursor", "else", "''", "commandLine", "+=", "self", ".", "cd", "+", "' '", "+", "self", ".", "path", "+", "s...
Insert the precursor and change directory commands
[ "Insert", "the", "precursor", "and", "change", "directory", "commands" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/command.py#L28-L34
39,026
Cadasta/django-tutelary
tutelary/models.py
_policy_psets
def _policy_psets(policy_instances): """Find all permission sets making use of all of a list of policy_instances. The input is an array of policy instances. """ if len(policy_instances) == 0: # Special case: find any permission sets that don't have # associated policy instances. ...
python
def _policy_psets(policy_instances): """Find all permission sets making use of all of a list of policy_instances. The input is an array of policy instances. """ if len(policy_instances) == 0: # Special case: find any permission sets that don't have # associated policy instances. ...
[ "def", "_policy_psets", "(", "policy_instances", ")", ":", "if", "len", "(", "policy_instances", ")", "==", "0", ":", "# Special case: find any permission sets that don't have", "# associated policy instances.", "return", "PermissionSet", ".", "objects", ".", "filter", "(...
Find all permission sets making use of all of a list of policy_instances. The input is an array of policy instances.
[ "Find", "all", "permission", "sets", "making", "use", "of", "all", "of", "a", "list", "of", "policy_instances", ".", "The", "input", "is", "an", "array", "of", "policy", "instances", "." ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/models.py#L151-L162
39,027
Cadasta/django-tutelary
tutelary/models.py
_get_permission_set_tree
def _get_permission_set_tree(user): """ Helper to return cached permission set tree from user instance if set, else generates and returns analyzed permission set tree. Does not cache set automatically, that must be done explicitely. """ if hasattr(user, CACHED_PSET_PROPERTY_KEY): return ...
python
def _get_permission_set_tree(user): """ Helper to return cached permission set tree from user instance if set, else generates and returns analyzed permission set tree. Does not cache set automatically, that must be done explicitely. """ if hasattr(user, CACHED_PSET_PROPERTY_KEY): return ...
[ "def", "_get_permission_set_tree", "(", "user", ")", ":", "if", "hasattr", "(", "user", ",", "CACHED_PSET_PROPERTY_KEY", ")", ":", "return", "getattr", "(", "user", ",", "CACHED_PSET_PROPERTY_KEY", ")", "if", "user", ".", "is_authenticated", "(", ")", ":", "tr...
Helper to return cached permission set tree from user instance if set, else generates and returns analyzed permission set tree. Does not cache set automatically, that must be done explicitely.
[ "Helper", "to", "return", "cached", "permission", "set", "tree", "from", "user", "instance", "if", "set", "else", "generates", "and", "returns", "analyzed", "permission", "set", "tree", ".", "Does", "not", "cache", "set", "automatically", "that", "must", "be",...
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/models.py#L296-L309
39,028
Cadasta/django-tutelary
tutelary/models.py
ensure_permission_set_tree_cached
def ensure_permission_set_tree_cached(user): """ Helper to cache permission set tree on user instance """ if hasattr(user, CACHED_PSET_PROPERTY_KEY): return try: setattr( user, CACHED_PSET_PROPERTY_KEY, _get_permission_set_tree(user)) except ObjectDoesNotExist: # No permissi...
python
def ensure_permission_set_tree_cached(user): """ Helper to cache permission set tree on user instance """ if hasattr(user, CACHED_PSET_PROPERTY_KEY): return try: setattr( user, CACHED_PSET_PROPERTY_KEY, _get_permission_set_tree(user)) except ObjectDoesNotExist: # No permissi...
[ "def", "ensure_permission_set_tree_cached", "(", "user", ")", ":", "if", "hasattr", "(", "user", ",", "CACHED_PSET_PROPERTY_KEY", ")", ":", "return", "try", ":", "setattr", "(", "user", ",", "CACHED_PSET_PROPERTY_KEY", ",", "_get_permission_set_tree", "(", "user", ...
Helper to cache permission set tree on user instance
[ "Helper", "to", "cache", "permission", "set", "tree", "on", "user", "instance" ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/models.py#L326-L334
39,029
kevinconway/confpy
confpy/loaders/json.py
JsonFile.parsed
def parsed(self): """Get the JSON dictionary object which represents the content. This property is cached and only parses the content once. """ if not self._parsed: self._parsed = json.loads(self.content) return self._parsed
python
def parsed(self): """Get the JSON dictionary object which represents the content. This property is cached and only parses the content once. """ if not self._parsed: self._parsed = json.loads(self.content) return self._parsed
[ "def", "parsed", "(", "self", ")", ":", "if", "not", "self", ".", "_parsed", ":", "self", ".", "_parsed", "=", "json", ".", "loads", "(", "self", ".", "content", ")", "return", "self", ".", "_parsed" ]
Get the JSON dictionary object which represents the content. This property is cached and only parses the content once.
[ "Get", "the", "JSON", "dictionary", "object", "which", "represents", "the", "content", "." ]
1ee8afcab46ac6915a5ff4184180434ac7b84a60
https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/loaders/json.py#L22-L31
39,030
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.cleanup_logger
def cleanup_logger(self): """Clean up logger to close out file handles. After this is called, writing to self.log will get logs ending up getting discarded. """ self.log_handler.close() self.log.removeHandler(self.log_handler)
python
def cleanup_logger(self): """Clean up logger to close out file handles. After this is called, writing to self.log will get logs ending up getting discarded. """ self.log_handler.close() self.log.removeHandler(self.log_handler)
[ "def", "cleanup_logger", "(", "self", ")", ":", "self", ".", "log_handler", ".", "close", "(", ")", "self", ".", "log", ".", "removeHandler", "(", "self", ".", "log_handler", ")" ]
Clean up logger to close out file handles. After this is called, writing to self.log will get logs ending up getting discarded.
[ "Clean", "up", "logger", "to", "close", "out", "file", "handles", "." ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L92-L99
39,031
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.update_configs
def update_configs(self, release): """ Update the fedora-atomic.git repositories for a given release """ git_repo = release['git_repo'] git_cache = release['git_cache'] if not os.path.isdir(git_cache): self.call(['git', 'clone', '--mirror', git_repo, git_cache]) else:...
python
def update_configs(self, release): """ Update the fedora-atomic.git repositories for a given release """ git_repo = release['git_repo'] git_cache = release['git_cache'] if not os.path.isdir(git_cache): self.call(['git', 'clone', '--mirror', git_repo, git_cache]) else:...
[ "def", "update_configs", "(", "self", ",", "release", ")", ":", "git_repo", "=", "release", "[", "'git_repo'", "]", "git_cache", "=", "release", "[", "'git_cache'", "]", "if", "not", "os", ".", "path", ".", "isdir", "(", "git_cache", ")", ":", "self", ...
Update the fedora-atomic.git repositories for a given release
[ "Update", "the", "fedora", "-", "atomic", ".", "git", "repositories", "for", "a", "given", "release" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L101-L117
39,032
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.mock_cmd
def mock_cmd(self, release, *cmd, **kwargs): """Run a mock command in the chroot for a given release""" fmt = '{mock_cmd}' if kwargs.get('new_chroot') is True: fmt +=' --new-chroot' fmt += ' --configdir={mock_dir}' return self.call(fmt.format(**release).split() ...
python
def mock_cmd(self, release, *cmd, **kwargs): """Run a mock command in the chroot for a given release""" fmt = '{mock_cmd}' if kwargs.get('new_chroot') is True: fmt +=' --new-chroot' fmt += ' --configdir={mock_dir}' return self.call(fmt.format(**release).split() ...
[ "def", "mock_cmd", "(", "self", ",", "release", ",", "*", "cmd", ",", "*", "*", "kwargs", ")", ":", "fmt", "=", "'{mock_cmd}'", "if", "kwargs", ".", "get", "(", "'new_chroot'", ")", "is", "True", ":", "fmt", "+=", "' --new-chroot'", "fmt", "+=", "' -...
Run a mock command in the chroot for a given release
[ "Run", "a", "mock", "command", "in", "the", "chroot", "for", "a", "given", "release" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L119-L126
39,033
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.generate_mock_config
def generate_mock_config(self, release): """Dynamically generate our mock configuration""" mock_tmpl = pkg_resources.resource_string(__name__, 'templates/mock.mako') mock_dir = release['mock_dir'] = os.path.join(release['tmp_dir'], 'mock') mock_cfg = os.path.join(release['mock_dir'], rel...
python
def generate_mock_config(self, release): """Dynamically generate our mock configuration""" mock_tmpl = pkg_resources.resource_string(__name__, 'templates/mock.mako') mock_dir = release['mock_dir'] = os.path.join(release['tmp_dir'], 'mock') mock_cfg = os.path.join(release['mock_dir'], rel...
[ "def", "generate_mock_config", "(", "self", ",", "release", ")", ":", "mock_tmpl", "=", "pkg_resources", ".", "resource_string", "(", "__name__", ",", "'templates/mock.mako'", ")", "mock_dir", "=", "release", "[", "'mock_dir'", "]", "=", "os", ".", "path", "."...
Dynamically generate our mock configuration
[ "Dynamically", "generate", "our", "mock", "configuration" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L143-L154
39,034
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.mock_chroot
def mock_chroot(self, release, cmd, **kwargs): """Run a commend in the mock container for a release""" return self.mock_cmd(release, '--chroot', cmd, **kwargs)
python
def mock_chroot(self, release, cmd, **kwargs): """Run a commend in the mock container for a release""" return self.mock_cmd(release, '--chroot', cmd, **kwargs)
[ "def", "mock_chroot", "(", "self", ",", "release", ",", "cmd", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "mock_cmd", "(", "release", ",", "'--chroot'", ",", "cmd", ",", "*", "*", "kwargs", ")" ]
Run a commend in the mock container for a release
[ "Run", "a", "commend", "in", "the", "mock", "container", "for", "a", "release" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L156-L158
39,035
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.generate_repo_files
def generate_repo_files(self, release): """Dynamically generate our yum repo configuration""" repo_tmpl = pkg_resources.resource_string(__name__, 'templates/repo.mako') repo_file = os.path.join(release['git_dir'], '%s.repo' % release['repo']) with file(repo_file, 'w') as repo: ...
python
def generate_repo_files(self, release): """Dynamically generate our yum repo configuration""" repo_tmpl = pkg_resources.resource_string(__name__, 'templates/repo.mako') repo_file = os.path.join(release['git_dir'], '%s.repo' % release['repo']) with file(repo_file, 'w') as repo: ...
[ "def", "generate_repo_files", "(", "self", ",", "release", ")", ":", "repo_tmpl", "=", "pkg_resources", ".", "resource_string", "(", "__name__", ",", "'templates/repo.mako'", ")", "repo_file", "=", "os", ".", "path", ".", "join", "(", "release", "[", "'git_dir...
Dynamically generate our yum repo configuration
[ "Dynamically", "generate", "our", "yum", "repo", "configuration" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L160-L168
39,036
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.ostree_init
def ostree_init(self, release): """Initialize the OSTree for a release""" out = release['output_dir'].rstrip('/') base = os.path.dirname(out) if not os.path.isdir(base): self.log.info('Creating %s', base) os.makedirs(base, mode=0755) if not os.path.isdir(o...
python
def ostree_init(self, release): """Initialize the OSTree for a release""" out = release['output_dir'].rstrip('/') base = os.path.dirname(out) if not os.path.isdir(base): self.log.info('Creating %s', base) os.makedirs(base, mode=0755) if not os.path.isdir(o...
[ "def", "ostree_init", "(", "self", ",", "release", ")", ":", "out", "=", "release", "[", "'output_dir'", "]", ".", "rstrip", "(", "'/'", ")", "base", "=", "os", ".", "path", ".", "dirname", "(", "out", ")", "if", "not", "os", ".", "path", ".", "i...
Initialize the OSTree for a release
[ "Initialize", "the", "OSTree", "for", "a", "release" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L170-L178
39,037
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.ostree_compose
def ostree_compose(self, release): """Compose the OSTree in the mock container""" start = datetime.utcnow() treefile = os.path.join(release['git_dir'], 'treefile.json') cmd = release['ostree_compose'] % treefile with file(treefile, 'w') as tree: json.dump(release['tre...
python
def ostree_compose(self, release): """Compose the OSTree in the mock container""" start = datetime.utcnow() treefile = os.path.join(release['git_dir'], 'treefile.json') cmd = release['ostree_compose'] % treefile with file(treefile, 'w') as tree: json.dump(release['tre...
[ "def", "ostree_compose", "(", "self", ",", "release", ")", ":", "start", "=", "datetime", ".", "utcnow", "(", ")", "treefile", "=", "os", ".", "path", ".", "join", "(", "release", "[", "'git_dir'", "]", ",", "'treefile.json'", ")", "cmd", "=", "release...
Compose the OSTree in the mock container
[ "Compose", "the", "OSTree", "in", "the", "mock", "container" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L180-L198
39,038
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.update_ostree_summary
def update_ostree_summary(self, release): """Update the ostree summary file and return a path to it""" self.log.info('Updating the ostree summary for %s', release['name']) self.mock_chroot(release, release['ostree_summary']) return os.path.join(release['output_dir'], 'summary')
python
def update_ostree_summary(self, release): """Update the ostree summary file and return a path to it""" self.log.info('Updating the ostree summary for %s', release['name']) self.mock_chroot(release, release['ostree_summary']) return os.path.join(release['output_dir'], 'summary')
[ "def", "update_ostree_summary", "(", "self", ",", "release", ")", ":", "self", ".", "log", ".", "info", "(", "'Updating the ostree summary for %s'", ",", "release", "[", "'name'", "]", ")", "self", ".", "mock_chroot", "(", "release", ",", "release", "[", "'o...
Update the ostree summary file and return a path to it
[ "Update", "the", "ostree", "summary", "file", "and", "return", "a", "path", "to", "it" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L200-L204
39,039
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.sync_in
def sync_in(self, release): """Sync the canonical repo to our local working directory""" tree = release['canonical_dir'] if os.path.exists(tree) and release.get('rsync_in_objs'): out = release['output_dir'] if not os.path.isdir(out): self.log.info('Creatin...
python
def sync_in(self, release): """Sync the canonical repo to our local working directory""" tree = release['canonical_dir'] if os.path.exists(tree) and release.get('rsync_in_objs'): out = release['output_dir'] if not os.path.isdir(out): self.log.info('Creatin...
[ "def", "sync_in", "(", "self", ",", "release", ")", ":", "tree", "=", "release", "[", "'canonical_dir'", "]", "if", "os", ".", "path", ".", "exists", "(", "tree", ")", "and", "release", ".", "get", "(", "'rsync_in_objs'", ")", ":", "out", "=", "relea...
Sync the canonical repo to our local working directory
[ "Sync", "the", "canonical", "repo", "to", "our", "local", "working", "directory" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L206-L215
39,040
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.sync_out
def sync_out(self, release): """Sync our tree to the canonical location""" if release.get('rsync_out_objs'): tree = release['canonical_dir'] if not os.path.isdir(tree): self.log.info('Creating %s', tree) os.makedirs(tree) self.call(rele...
python
def sync_out(self, release): """Sync our tree to the canonical location""" if release.get('rsync_out_objs'): tree = release['canonical_dir'] if not os.path.isdir(tree): self.log.info('Creating %s', tree) os.makedirs(tree) self.call(rele...
[ "def", "sync_out", "(", "self", ",", "release", ")", ":", "if", "release", ".", "get", "(", "'rsync_out_objs'", ")", ":", "tree", "=", "release", "[", "'canonical_dir'", "]", "if", "not", "os", ".", "path", ".", "isdir", "(", "tree", ")", ":", "self"...
Sync our tree to the canonical location
[ "Sync", "our", "tree", "to", "the", "canonical", "location" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L217-L225
39,041
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.call
def call(self, cmd, **kwargs): """A simple subprocess wrapper""" if isinstance(cmd, basestring): cmd = cmd.split() self.log.info('Running %s', cmd) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs) out, er...
python
def call(self, cmd, **kwargs): """A simple subprocess wrapper""" if isinstance(cmd, basestring): cmd = cmd.split() self.log.info('Running %s', cmd) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs) out, er...
[ "def", "call", "(", "self", ",", "cmd", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "cmd", ",", "basestring", ")", ":", "cmd", "=", "cmd", ".", "split", "(", ")", "self", ".", "log", ".", "info", "(", "'Running %s'", ",", "cmd", ...
A simple subprocess wrapper
[ "A", "simple", "subprocess", "wrapper" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L227-L245
39,042
standage/tag
tag/range.py
Range.intersect
def intersect(self, other): """ Determine the interval of overlap between this range and another. :returns: a new Range object representing the overlapping interval, or `None` if the ranges do not overlap. """ if not self.overlap(other): return None...
python
def intersect(self, other): """ Determine the interval of overlap between this range and another. :returns: a new Range object representing the overlapping interval, or `None` if the ranges do not overlap. """ if not self.overlap(other): return None...
[ "def", "intersect", "(", "self", ",", "other", ")", ":", "if", "not", "self", ".", "overlap", "(", "other", ")", ":", "return", "None", "newstart", "=", "max", "(", "self", ".", "_start", ",", "other", ".", "start", ")", "newend", "=", "min", "(", ...
Determine the interval of overlap between this range and another. :returns: a new Range object representing the overlapping interval, or `None` if the ranges do not overlap.
[ "Determine", "the", "interval", "of", "overlap", "between", "this", "range", "and", "another", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/range.py#L121-L133
39,043
standage/tag
tag/range.py
Range.overlap
def overlap(self, other): """Determine whether this range overlaps with another.""" if self._start < other.end and self._end > other.start: return True return False
python
def overlap(self, other): """Determine whether this range overlaps with another.""" if self._start < other.end and self._end > other.start: return True return False
[ "def", "overlap", "(", "self", ",", "other", ")", ":", "if", "self", ".", "_start", "<", "other", ".", "end", "and", "self", ".", "_end", ">", "other", ".", "start", ":", "return", "True", "return", "False" ]
Determine whether this range overlaps with another.
[ "Determine", "whether", "this", "range", "overlaps", "with", "another", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/range.py#L135-L139
39,044
standage/tag
tag/range.py
Range.contains
def contains(self, other): """Determine whether this range contains another.""" return self._start <= other.start and self._end >= other.end
python
def contains(self, other): """Determine whether this range contains another.""" return self._start <= other.start and self._end >= other.end
[ "def", "contains", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_start", "<=", "other", ".", "start", "and", "self", ".", "_end", ">=", "other", ".", "end" ]
Determine whether this range contains another.
[ "Determine", "whether", "this", "range", "contains", "another", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/range.py#L141-L143
39,045
standage/tag
tag/range.py
Range.transform
def transform(self, offset): """ Shift this range by the specified offset. Note: the resulting range must be a valid interval. """ assert self._start + offset > 0, \ ('offset {} invalid; resulting range [{}, {}) is ' 'undefined'.format(offset, self._star...
python
def transform(self, offset): """ Shift this range by the specified offset. Note: the resulting range must be a valid interval. """ assert self._start + offset > 0, \ ('offset {} invalid; resulting range [{}, {}) is ' 'undefined'.format(offset, self._star...
[ "def", "transform", "(", "self", ",", "offset", ")", ":", "assert", "self", ".", "_start", "+", "offset", ">", "0", ",", "(", "'offset {} invalid; resulting range [{}, {}) is '", "'undefined'", ".", "format", "(", "offset", ",", "self", ".", "_start", "+", "...
Shift this range by the specified offset. Note: the resulting range must be a valid interval.
[ "Shift", "this", "range", "by", "the", "specified", "offset", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/range.py#L153-L163
39,046
e7dal/bubble3
behave4cmd0/command_shell.py
Command.run
def run(cls, command, cwd=".", **kwargs): """ Make a subprocess call, collect its output and returncode. Returns CommandResult instance as ValueObject. """ assert isinstance(command, six.string_types) command_result = CommandResult() command_result.command = comma...
python
def run(cls, command, cwd=".", **kwargs): """ Make a subprocess call, collect its output and returncode. Returns CommandResult instance as ValueObject. """ assert isinstance(command, six.string_types) command_result = CommandResult() command_result.command = comma...
[ "def", "run", "(", "cls", ",", "command", ",", "cwd", "=", "\".\"", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "command", ",", "six", ".", "string_types", ")", "command_result", "=", "CommandResult", "(", ")", "command_result", ".", ...
Make a subprocess call, collect its output and returncode. Returns CommandResult instance as ValueObject.
[ "Make", "a", "subprocess", "call", "collect", "its", "output", "and", "returncode", ".", "Returns", "CommandResult", "instance", "as", "ValueObject", "." ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_shell.py#L100-L161
39,047
stephrdev/django-tapeforms
tapeforms/contrib/foundation.py
FoundationTapeformMixin.get_field_template
def get_field_template(self, bound_field, template_name=None): """ Uses a special field template for widget with multiple inputs. It only applies if no other template than the default one has been defined. """ template_name = super().get_field_template(bound_field, template_name)...
python
def get_field_template(self, bound_field, template_name=None): """ Uses a special field template for widget with multiple inputs. It only applies if no other template than the default one has been defined. """ template_name = super().get_field_template(bound_field, template_name)...
[ "def", "get_field_template", "(", "self", ",", "bound_field", ",", "template_name", "=", "None", ")", ":", "template_name", "=", "super", "(", ")", ".", "get_field_template", "(", "bound_field", ",", "template_name", ")", "if", "(", "template_name", "==", "sel...
Uses a special field template for widget with multiple inputs. It only applies if no other template than the default one has been defined.
[ "Uses", "a", "special", "field", "template", "for", "widget", "with", "multiple", "inputs", ".", "It", "only", "applies", "if", "no", "other", "template", "than", "the", "default", "one", "has", "been", "defined", "." ]
255602de43777141f18afaf30669d7bdd4f7c323
https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/contrib/foundation.py#L27-L39
39,048
GeorgeArgyros/symautomata
symautomata/pythonpda.py
PDAState.printer
def printer(self): """Prints PDA state attributes""" print " ID " + repr(self.id) if self.type == 0: print " Tag: - " print " Start State - " elif self.type == 1: print " Push " + repr(self.sym) elif self.type == 2: print " Pop Stat...
python
def printer(self): """Prints PDA state attributes""" print " ID " + repr(self.id) if self.type == 0: print " Tag: - " print " Start State - " elif self.type == 1: print " Push " + repr(self.sym) elif self.type == 2: print " Pop Stat...
[ "def", "printer", "(", "self", ")", ":", "print", "\" ID \"", "+", "repr", "(", "self", ".", "id", ")", "if", "self", ".", "type", "==", "0", ":", "print", "\" Tag: - \"", "print", "\" Start State - \"", "elif", "self", ".", "type", "==", "1", ":", "...
Prints PDA state attributes
[ "Prints", "PDA", "state", "attributes" ]
f5d66533573b27e155bec3f36b8c00b8e3937cb3
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pythonpda.py#L14-L31
39,049
GeorgeArgyros/symautomata
symautomata/pythonpda.py
PythonPDA.printer
def printer(self): """Prints PDA states and their attributes""" i = 0 while i < self.n + 1: print "--------- State No --------" + repr(i) self.s[i].printer() i = i + 1
python
def printer(self): """Prints PDA states and their attributes""" i = 0 while i < self.n + 1: print "--------- State No --------" + repr(i) self.s[i].printer() i = i + 1
[ "def", "printer", "(", "self", ")", ":", "i", "=", "0", "while", "i", "<", "self", ".", "n", "+", "1", ":", "print", "\"--------- State No --------\"", "+", "repr", "(", "i", ")", "self", ".", "s", "[", "i", "]", ".", "printer", "(", ")", "i", ...
Prints PDA states and their attributes
[ "Prints", "PDA", "states", "and", "their", "attributes" ]
f5d66533573b27e155bec3f36b8c00b8e3937cb3
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pythonpda.py#L96-L102
39,050
davgeo/clear
clear/database.py
RenamerDB._ActionDatabase
def _ActionDatabase(self, cmd, args = None, commit = True, error = True): """ Do action on database. Parameters ---------- cmd : string SQL command. args : tuple [optional : default = None] Arguments to be passed along with the SQL command. e.g. cmd="SELECT Value FR...
python
def _ActionDatabase(self, cmd, args = None, commit = True, error = True): """ Do action on database. Parameters ---------- cmd : string SQL command. args : tuple [optional : default = None] Arguments to be passed along with the SQL command. e.g. cmd="SELECT Value FR...
[ "def", "_ActionDatabase", "(", "self", ",", "cmd", ",", "args", "=", "None", ",", "commit", "=", "True", ",", "error", "=", "True", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Database Command: {0} {1}\"", ".", "format", "(",...
Do action on database. Parameters ---------- cmd : string SQL command. args : tuple [optional : default = None] Arguments to be passed along with the SQL command. e.g. cmd="SELECT Value FROM Config WHERE Name=?" args=(fieldName, ) commit : boolean [optional : default...
[ "Do", "action", "on", "database", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L139-L179
39,051
davgeo/clear
clear/database.py
RenamerDB._PurgeTable
def _PurgeTable(self, tableName): """ Deletes all rows from given table without dropping table. Parameters ---------- tableName : string Name of table. """ goodlogging.Log.Info("DB", "Deleting all entries from table {0}".format(tableName), verbosity=self.logVerbosity) self._Ac...
python
def _PurgeTable(self, tableName): """ Deletes all rows from given table without dropping table. Parameters ---------- tableName : string Name of table. """ goodlogging.Log.Info("DB", "Deleting all entries from table {0}".format(tableName), verbosity=self.logVerbosity) self._Ac...
[ "def", "_PurgeTable", "(", "self", ",", "tableName", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Deleting all entries from table {0}\"", ".", "format", "(", "tableName", ")", ",", "verbosity", "=", "self", ".", "logVerbosity", ")",...
Deletes all rows from given table without dropping table. Parameters ---------- tableName : string Name of table.
[ "Deletes", "all", "rows", "from", "given", "table", "without", "dropping", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L184-L194
39,052
davgeo/clear
clear/database.py
RenamerDB.GetConfigValue
def GetConfigValue(self, fieldName): """ Match given field name in Config table and return corresponding value. Parameters ---------- fieldName : string String matching Name column in Config table. Returns ---------- string or None If a match is found the correspond...
python
def GetConfigValue(self, fieldName): """ Match given field name in Config table and return corresponding value. Parameters ---------- fieldName : string String matching Name column in Config table. Returns ---------- string or None If a match is found the correspond...
[ "def", "GetConfigValue", "(", "self", ",", "fieldName", ")", ":", "result", "=", "self", ".", "_ActionDatabase", "(", "\"SELECT Value FROM Config WHERE Name=?\"", ",", "(", "fieldName", ",", ")", ")", "if", "result", "is", "None", ":", "return", "None", "elif"...
Match given field name in Config table and return corresponding value. Parameters ---------- fieldName : string String matching Name column in Config table. Returns ---------- string or None If a match is found the corresponding entry in the Value column of the data...
[ "Match", "given", "field", "name", "in", "Config", "table", "and", "return", "corresponding", "value", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L199-L225
39,053
davgeo/clear
clear/database.py
RenamerDB.SetConfigValue
def SetConfigValue(self, fieldName, value): """ Set value in Config table. If a entry already exists this is updated with the new value, otherwise a new entry is added. Parameters ---------- fieldName : string String to be inserted or matched against Name column in Config table. ...
python
def SetConfigValue(self, fieldName, value): """ Set value in Config table. If a entry already exists this is updated with the new value, otherwise a new entry is added. Parameters ---------- fieldName : string String to be inserted or matched against Name column in Config table. ...
[ "def", "SetConfigValue", "(", "self", ",", "fieldName", ",", "value", ")", ":", "currentConfigValue", "=", "self", ".", "GetConfigValue", "(", "fieldName", ")", "if", "currentConfigValue", "is", "None", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB...
Set value in Config table. If a entry already exists this is updated with the new value, otherwise a new entry is added. Parameters ---------- fieldName : string String to be inserted or matched against Name column in Config table. value : string Entry to be inserted or up...
[ "Set", "value", "in", "Config", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L230-L252
39,054
davgeo/clear
clear/database.py
RenamerDB._AddToSingleColumnTable
def _AddToSingleColumnTable(self, tableName, columnHeading, newValue): """ Add an entry to a table containing a single column. Checks existing table entries to avoid duplicate entries if the given value already exists in the table. Parameters ---------- tableName : string Name of ...
python
def _AddToSingleColumnTable(self, tableName, columnHeading, newValue): """ Add an entry to a table containing a single column. Checks existing table entries to avoid duplicate entries if the given value already exists in the table. Parameters ---------- tableName : string Name of ...
[ "def", "_AddToSingleColumnTable", "(", "self", ",", "tableName", ",", "columnHeading", ",", "newValue", ")", ":", "match", "=", "None", "currentTable", "=", "self", ".", "_GetFromSingleColumnTable", "(", "tableName", ")", "if", "currentTable", "is", "not", "None...
Add an entry to a table containing a single column. Checks existing table entries to avoid duplicate entries if the given value already exists in the table. Parameters ---------- tableName : string Name of table to add entry to. columnHeading : string Name of column heading...
[ "Add", "an", "entry", "to", "a", "table", "containing", "a", "single", "column", ".", "Checks", "existing", "table", "entries", "to", "avoid", "duplicate", "entries", "if", "the", "given", "value", "already", "exists", "in", "the", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L257-L304
39,055
davgeo/clear
clear/database.py
RenamerDB.AddShowToTVLibrary
def AddShowToTVLibrary(self, showName): """ Add show to TVLibrary table. If the show already exists in the table a fatal error is raised. Parameters ---------- showName : string Show name to add to TV library table. Returns ---------- int Unique show id generate...
python
def AddShowToTVLibrary(self, showName): """ Add show to TVLibrary table. If the show already exists in the table a fatal error is raised. Parameters ---------- showName : string Show name to add to TV library table. Returns ---------- int Unique show id generate...
[ "def", "AddShowToTVLibrary", "(", "self", ",", "showName", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Adding {0} to TV library\"", ".", "format", "(", "showName", ")", ",", "verbosity", "=", "self", ".", "logVerbosity", ")", "cu...
Add show to TVLibrary table. If the show already exists in the table a fatal error is raised. Parameters ---------- showName : string Show name to add to TV library table. Returns ---------- int Unique show id generated for show when it is added to the table. Used ...
[ "Add", "show", "to", "TVLibrary", "table", ".", "If", "the", "show", "already", "exists", "in", "the", "table", "a", "fatal", "error", "is", "raised", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L392-L417
39,056
davgeo/clear
clear/database.py
RenamerDB.UpdateShowDirInTVLibrary
def UpdateShowDirInTVLibrary(self, showID, showDir): """ Update show directory entry for given show id in TVLibrary table. Parameters ---------- showID : int Show id value. showDir : string Show directory name. """ goodlogging.Log.Info("DB", "Updating TV library for...
python
def UpdateShowDirInTVLibrary(self, showID, showDir): """ Update show directory entry for given show id in TVLibrary table. Parameters ---------- showID : int Show id value. showDir : string Show directory name. """ goodlogging.Log.Info("DB", "Updating TV library for...
[ "def", "UpdateShowDirInTVLibrary", "(", "self", ",", "showID", ",", "showDir", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Updating TV library for ShowID={0}: ShowDir={1}\"", ".", "format", "(", "showID", ",", "showDir", ")", ")", "s...
Update show directory entry for given show id in TVLibrary table. Parameters ---------- showID : int Show id value. showDir : string Show directory name.
[ "Update", "show", "directory", "entry", "for", "given", "show", "id", "in", "TVLibrary", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L422-L435
39,057
davgeo/clear
clear/database.py
RenamerDB.SearchTVLibrary
def SearchTVLibrary(self, showName = None, showID = None, showDir = None): """ Search TVLibrary table. If none of the optonal arguments are given it looks up all entries of the table, otherwise it will look up entries which match the given arguments. Note that it only looks up based on one argumen...
python
def SearchTVLibrary(self, showName = None, showID = None, showDir = None): """ Search TVLibrary table. If none of the optonal arguments are given it looks up all entries of the table, otherwise it will look up entries which match the given arguments. Note that it only looks up based on one argumen...
[ "def", "SearchTVLibrary", "(", "self", ",", "showName", "=", "None", ",", "showID", "=", "None", ",", "showDir", "=", "None", ")", ":", "unique", "=", "True", "if", "showName", "is", "None", "and", "showID", "is", "None", "and", "showDir", "is", "None"...
Search TVLibrary table. If none of the optonal arguments are given it looks up all entries of the table, otherwise it will look up entries which match the given arguments. Note that it only looks up based on one argument - if show directory is given this will be used, otherwise show id will be used if...
[ "Search", "TVLibrary", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L440-L502
39,058
davgeo/clear
clear/database.py
RenamerDB.SearchFileNameTable
def SearchFileNameTable(self, fileName): """ Search FileName table. Find the show id for a given file name. Parameters ---------- fileName : string File name to look up in table. Returns ---------- int or None If a match is found in the database table the show ...
python
def SearchFileNameTable(self, fileName): """ Search FileName table. Find the show id for a given file name. Parameters ---------- fileName : string File name to look up in table. Returns ---------- int or None If a match is found in the database table the show ...
[ "def", "SearchFileNameTable", "(", "self", ",", "fileName", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Looking up filename string '{0}' in database\"", ".", "format", "(", "fileName", ")", ",", "verbosity", "=", "self", ".", "logVer...
Search FileName table. Find the show id for a given file name. Parameters ---------- fileName : string File name to look up in table. Returns ---------- int or None If a match is found in the database table the show id for this entry is returned, otherwise this...
[ "Search", "FileName", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L507-L540
39,059
davgeo/clear
clear/database.py
RenamerDB.AddToFileNameTable
def AddToFileNameTable(self, fileName, showID): """ Add entry to FileName table. If the file name and show id combination already exists in the table a fatal error is raised. Parameters ---------- fileName : string File name. showID : int Show id. """ goodloggin...
python
def AddToFileNameTable(self, fileName, showID): """ Add entry to FileName table. If the file name and show id combination already exists in the table a fatal error is raised. Parameters ---------- fileName : string File name. showID : int Show id. """ goodloggin...
[ "def", "AddToFileNameTable", "(", "self", ",", "fileName", ",", "showID", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Adding filename string match '{0}'={1} to database\"", ".", "format", "(", "fileName", ",", "showID", ")", ",", "ve...
Add entry to FileName table. If the file name and show id combination already exists in the table a fatal error is raised. Parameters ---------- fileName : string File name. showID : int Show id.
[ "Add", "entry", "to", "FileName", "table", ".", "If", "the", "file", "name", "and", "show", "id", "combination", "already", "exists", "in", "the", "table", "a", "fatal", "error", "is", "raised", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L545-L565
39,060
davgeo/clear
clear/database.py
RenamerDB.SearchSeasonDirTable
def SearchSeasonDirTable(self, showID, seasonNum): """ Search SeasonDir table. Find the season directory for a given show id and season combination. Parameters ---------- showID : int Show id for given show. seasonNum : int Season number. Returns ---------- ...
python
def SearchSeasonDirTable(self, showID, seasonNum): """ Search SeasonDir table. Find the season directory for a given show id and season combination. Parameters ---------- showID : int Show id for given show. seasonNum : int Season number. Returns ---------- ...
[ "def", "SearchSeasonDirTable", "(", "self", ",", "showID", ",", "seasonNum", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Looking up directory for ShowID={0} Season={1} in database\"", ".", "format", "(", "showID", ",", "seasonNum", ")", ...
Search SeasonDir table. Find the season directory for a given show id and season combination. Parameters ---------- showID : int Show id for given show. seasonNum : int Season number. Returns ---------- string or None If no match is found this returns No...
[ "Search", "SeasonDir", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L570-L607
39,061
davgeo/clear
clear/database.py
RenamerDB.AddSeasonDirTable
def AddSeasonDirTable(self, showID, seasonNum, seasonDir): """ Add entry to SeasonDir table. If a different entry for season directory is found for the given show id and season number combination this raises a fatal error. Parameters ---------- showID : int Show id. seasonN...
python
def AddSeasonDirTable(self, showID, seasonNum, seasonDir): """ Add entry to SeasonDir table. If a different entry for season directory is found for the given show id and season number combination this raises a fatal error. Parameters ---------- showID : int Show id. seasonN...
[ "def", "AddSeasonDirTable", "(", "self", ",", "showID", ",", "seasonNum", ",", "seasonDir", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Adding season directory ({0}) to database for ShowID={1}, Season={2}\"", ".", "format", "(", "seasonDir...
Add entry to SeasonDir table. If a different entry for season directory is found for the given show id and season number combination this raises a fatal error. Parameters ---------- showID : int Show id. seasonNum : int Season number. seasonDir : string Seaso...
[ "Add", "entry", "to", "SeasonDir", "table", ".", "If", "a", "different", "entry", "for", "season", "directory", "is", "found", "for", "the", "given", "show", "id", "and", "season", "number", "combination", "this", "raises", "a", "fatal", "error", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L612-L639
39,062
davgeo/clear
clear/database.py
RenamerDB.PrintAllTables
def PrintAllTables(self): """ Prints contents of every table. """ goodlogging.Log.Info("DB", "Database contents:\n") for table in self._tableDict.keys(): self._PrintDatabaseTable(table)
python
def PrintAllTables(self): """ Prints contents of every table. """ goodlogging.Log.Info("DB", "Database contents:\n") for table in self._tableDict.keys(): self._PrintDatabaseTable(table)
[ "def", "PrintAllTables", "(", "self", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Database contents:\\n\"", ")", "for", "table", "in", "self", ".", "_tableDict", ".", "keys", "(", ")", ":", "self", ".", "_PrintDatabaseTable", "...
Prints contents of every table.
[ "Prints", "contents", "of", "every", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L711-L715
39,063
ttroy50/pyirishrail
pyirishrail/pyirishrail.py
_parse
def _parse(data, obj_name, attr_map): """parse xml data into a python map""" parsed_xml = minidom.parseString(data) parsed_objects = [] for obj in parsed_xml.getElementsByTagName(obj_name): parsed_obj = {} for (py_name, xml_name) in attr_map.items(): parsed_obj[py_name] = _ge...
python
def _parse(data, obj_name, attr_map): """parse xml data into a python map""" parsed_xml = minidom.parseString(data) parsed_objects = [] for obj in parsed_xml.getElementsByTagName(obj_name): parsed_obj = {} for (py_name, xml_name) in attr_map.items(): parsed_obj[py_name] = _ge...
[ "def", "_parse", "(", "data", ",", "obj_name", ",", "attr_map", ")", ":", "parsed_xml", "=", "minidom", ".", "parseString", "(", "data", ")", "parsed_objects", "=", "[", "]", "for", "obj", "in", "parsed_xml", ".", "getElementsByTagName", "(", "obj_name", "...
parse xml data into a python map
[ "parse", "xml", "data", "into", "a", "python", "map" ]
83232a65a53317fbcc2a41938165912c51b23515
https://github.com/ttroy50/pyirishrail/blob/83232a65a53317fbcc2a41938165912c51b23515/pyirishrail/pyirishrail.py#L32-L41
39,064
ttroy50/pyirishrail
pyirishrail/pyirishrail.py
IrishRailRTPI.get_all_stations
def get_all_stations(self, station_type=None): """Returns information of all stations. @param<optional> station_type: ['mainline', 'suburban', 'dart'] """ params = None if station_type and station_type in STATION_TYPE_TO_CODE_DICT: url = self.api_base_url + 'getAllSta...
python
def get_all_stations(self, station_type=None): """Returns information of all stations. @param<optional> station_type: ['mainline', 'suburban', 'dart'] """ params = None if station_type and station_type in STATION_TYPE_TO_CODE_DICT: url = self.api_base_url + 'getAllSta...
[ "def", "get_all_stations", "(", "self", ",", "station_type", "=", "None", ")", ":", "params", "=", "None", "if", "station_type", "and", "station_type", "in", "STATION_TYPE_TO_CODE_DICT", ":", "url", "=", "self", ".", "api_base_url", "+", "'getAllStationsXML_WithSt...
Returns information of all stations. @param<optional> station_type: ['mainline', 'suburban', 'dart']
[ "Returns", "information", "of", "all", "stations", "." ]
83232a65a53317fbcc2a41938165912c51b23515
https://github.com/ttroy50/pyirishrail/blob/83232a65a53317fbcc2a41938165912c51b23515/pyirishrail/pyirishrail.py#L112-L131
39,065
ttroy50/pyirishrail
pyirishrail/pyirishrail.py
IrishRailRTPI.get_all_current_trains
def get_all_current_trains(self, train_type=None, direction=None): """Returns all trains that are due to start in the next 10 minutes @param train_type: ['mainline', 'suburban', 'dart'] """ params = None if train_type: url = self.api_base_url + 'getCurrentTrainsXML_Wi...
python
def get_all_current_trains(self, train_type=None, direction=None): """Returns all trains that are due to start in the next 10 minutes @param train_type: ['mainline', 'suburban', 'dart'] """ params = None if train_type: url = self.api_base_url + 'getCurrentTrainsXML_Wi...
[ "def", "get_all_current_trains", "(", "self", ",", "train_type", "=", "None", ",", "direction", "=", "None", ")", ":", "params", "=", "None", "if", "train_type", ":", "url", "=", "self", ".", "api_base_url", "+", "'getCurrentTrainsXML_WithTrainType'", "params", ...
Returns all trains that are due to start in the next 10 minutes @param train_type: ['mainline', 'suburban', 'dart']
[ "Returns", "all", "trains", "that", "are", "due", "to", "start", "in", "the", "next", "10", "minutes" ]
83232a65a53317fbcc2a41938165912c51b23515
https://github.com/ttroy50/pyirishrail/blob/83232a65a53317fbcc2a41938165912c51b23515/pyirishrail/pyirishrail.py#L133-L157
39,066
ttroy50/pyirishrail
pyirishrail/pyirishrail.py
IrishRailRTPI.get_station_by_name
def get_station_by_name(self, station_name, num_minutes=None, direction=None, destination=None, stops_at=None): """Returns all trains due to serve station `station_name`. ...
python
def get_station_by_name(self, station_name, num_minutes=None, direction=None, destination=None, stops_at=None): """Returns all trains due to serve station `station_name`. ...
[ "def", "get_station_by_name", "(", "self", ",", "station_name", ",", "num_minutes", "=", "None", ",", "direction", "=", "None", ",", "destination", "=", "None", ",", "stops_at", "=", "None", ")", ":", "url", "=", "self", ".", "api_base_url", "+", "'getStat...
Returns all trains due to serve station `station_name`. @param station_code @param num_minutes. Only trains within this time. Between 5 and 90 @param direction Filter by direction. Northbound or Southbound @param destination Filter by name of the destination stations @param stops...
[ "Returns", "all", "trains", "due", "to", "serve", "station", "station_name", "." ]
83232a65a53317fbcc2a41938165912c51b23515
https://github.com/ttroy50/pyirishrail/blob/83232a65a53317fbcc2a41938165912c51b23515/pyirishrail/pyirishrail.py#L159-L193
39,067
ttroy50/pyirishrail
pyirishrail/pyirishrail.py
IrishRailRTPI.get_train_stops
def get_train_stops(self, train_code, date=None): """Get details for a train. @param train_code code for the trian @param date Date in format "15 oct 2017". If none use today """ if date is None: date = datetime.date.today().strftime("%d %B %Y") url = self.ap...
python
def get_train_stops(self, train_code, date=None): """Get details for a train. @param train_code code for the trian @param date Date in format "15 oct 2017". If none use today """ if date is None: date = datetime.date.today().strftime("%d %B %Y") url = self.ap...
[ "def", "get_train_stops", "(", "self", ",", "train_code", ",", "date", "=", "None", ")", ":", "if", "date", "is", "None", ":", "date", "=", "datetime", ".", "date", ".", "today", "(", ")", ".", "strftime", "(", "\"%d %B %Y\"", ")", "url", "=", "self"...
Get details for a train. @param train_code code for the trian @param date Date in format "15 oct 2017". If none use today
[ "Get", "details", "for", "a", "train", "." ]
83232a65a53317fbcc2a41938165912c51b23515
https://github.com/ttroy50/pyirishrail/blob/83232a65a53317fbcc2a41938165912c51b23515/pyirishrail/pyirishrail.py#L263-L283
39,068
marcrosis/selenium-sunbro
sunbro.py
BasePage.fill_fields
def fill_fields(self, **kwargs): """Fills the fields referenced by kwargs keys and fill them with the value""" for name, value in kwargs.items(): field = getattr(self, name) field.send_keys(value)
python
def fill_fields(self, **kwargs): """Fills the fields referenced by kwargs keys and fill them with the value""" for name, value in kwargs.items(): field = getattr(self, name) field.send_keys(value)
[ "def", "fill_fields", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "name", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "field", "=", "getattr", "(", "self", ",", "name", ")", "field", ".", "send_keys", "(", "value", ")" ]
Fills the fields referenced by kwargs keys and fill them with the value
[ "Fills", "the", "fields", "referenced", "by", "kwargs", "keys", "and", "fill", "them", "with", "the", "value" ]
f3d964817dc48c6755062a66b0bd46354e81f356
https://github.com/marcrosis/selenium-sunbro/blob/f3d964817dc48c6755062a66b0bd46354e81f356/sunbro.py#L139-L144
39,069
jingming/spotify
spotify/auth/user.py
authorize_url
def authorize_url(client_id=None, redirect_uri=None, state=None, scopes=None, show_dialog=False, http_client=None): """ Trigger authorization dialog :param str client_id: Client ID :param str redirect_uri: Application Redirect URI :param str state: Application State :param List[str] scopes: Sco...
python
def authorize_url(client_id=None, redirect_uri=None, state=None, scopes=None, show_dialog=False, http_client=None): """ Trigger authorization dialog :param str client_id: Client ID :param str redirect_uri: Application Redirect URI :param str state: Application State :param List[str] scopes: Sco...
[ "def", "authorize_url", "(", "client_id", "=", "None", ",", "redirect_uri", "=", "None", ",", "state", "=", "None", ",", "scopes", "=", "None", ",", "show_dialog", "=", "False", ",", "http_client", "=", "None", ")", ":", "params", "=", "{", "'client_id'"...
Trigger authorization dialog :param str client_id: Client ID :param str redirect_uri: Application Redirect URI :param str state: Application State :param List[str] scopes: Scopes to request :param bool show_dialog: Show the dialog :param http_client: HTTP Client for requests :return str Aut...
[ "Trigger", "authorization", "dialog" ]
d92c71073b2515f3c850604114133a7d2022d1a4
https://github.com/jingming/spotify/blob/d92c71073b2515f3c850604114133a7d2022d1a4/spotify/auth/user.py#L7-L29
39,070
jingming/spotify
spotify/auth/user.py
User.refresh
def refresh(self): """ Refresh the access token """ data = { 'grant_type': 'refresh_token', 'refresh_token': self._token.refresh_token } response = self.http_client.post(self.URL, data=data, auth=(self.client_id, self.client_secret)) respo...
python
def refresh(self): """ Refresh the access token """ data = { 'grant_type': 'refresh_token', 'refresh_token': self._token.refresh_token } response = self.http_client.post(self.URL, data=data, auth=(self.client_id, self.client_secret)) respo...
[ "def", "refresh", "(", "self", ")", ":", "data", "=", "{", "'grant_type'", ":", "'refresh_token'", ",", "'refresh_token'", ":", "self", ".", "_token", ".", "refresh_token", "}", "response", "=", "self", ".", "http_client", ".", "post", "(", "self", ".", ...
Refresh the access token
[ "Refresh", "the", "access", "token" ]
d92c71073b2515f3c850604114133a7d2022d1a4
https://github.com/jingming/spotify/blob/d92c71073b2515f3c850604114133a7d2022d1a4/spotify/auth/user.py#L77-L88
39,071
LeastAuthority/txkube
src/txkube/_invariants.py
instance_of
def instance_of(cls): """ Create an invariant requiring the value is an instance of ``cls``. """ def check(value): return ( isinstance(value, cls), u"{value!r} is instance of {actual!s}, required {required!s}".format( value=value, actual=fu...
python
def instance_of(cls): """ Create an invariant requiring the value is an instance of ``cls``. """ def check(value): return ( isinstance(value, cls), u"{value!r} is instance of {actual!s}, required {required!s}".format( value=value, actual=fu...
[ "def", "instance_of", "(", "cls", ")", ":", "def", "check", "(", "value", ")", ":", "return", "(", "isinstance", "(", "value", ",", "cls", ")", ",", "u\"{value!r} is instance of {actual!s}, required {required!s}\"", ".", "format", "(", "value", "=", "value", "...
Create an invariant requiring the value is an instance of ``cls``.
[ "Create", "an", "invariant", "requiring", "the", "value", "is", "an", "instance", "of", "cls", "." ]
a7e555d00535ff787d4b1204c264780da40cf736
https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_invariants.py#L10-L23
39,072
LeastAuthority/txkube
src/txkube/_invariants.py
provider_of
def provider_of(iface): """ Create an invariant requiring the value provides the zope.interface ``iface``. """ def check(value): return ( iface.providedBy(value), u"{value!r} does not provide {interface!s}".format( value=value, interfac...
python
def provider_of(iface): """ Create an invariant requiring the value provides the zope.interface ``iface``. """ def check(value): return ( iface.providedBy(value), u"{value!r} does not provide {interface!s}".format( value=value, interfac...
[ "def", "provider_of", "(", "iface", ")", ":", "def", "check", "(", "value", ")", ":", "return", "(", "iface", ".", "providedBy", "(", "value", ")", ",", "u\"{value!r} does not provide {interface!s}\"", ".", "format", "(", "value", "=", "value", ",", "interfa...
Create an invariant requiring the value provides the zope.interface ``iface``.
[ "Create", "an", "invariant", "requiring", "the", "value", "provides", "the", "zope", ".", "interface", "iface", "." ]
a7e555d00535ff787d4b1204c264780da40cf736
https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_invariants.py#L26-L39
39,073
themattrix/python-temporary
temporary/directories.py
temp_dir
def temp_dir(suffix='', prefix='tmp', parent_dir=None, make_cwd=False): """ Create a temporary directory and optionally change the current working directory to it. The directory is deleted when the context exits. The temporary directory is created when entering the context manager, and deleted ...
python
def temp_dir(suffix='', prefix='tmp', parent_dir=None, make_cwd=False): """ Create a temporary directory and optionally change the current working directory to it. The directory is deleted when the context exits. The temporary directory is created when entering the context manager, and deleted ...
[ "def", "temp_dir", "(", "suffix", "=", "''", ",", "prefix", "=", "'tmp'", ",", "parent_dir", "=", "None", ",", "make_cwd", "=", "False", ")", ":", "prev_cwd", "=", "os", ".", "getcwd", "(", ")", "parent_dir", "=", "parent_dir", "if", "parent_dir", "is"...
Create a temporary directory and optionally change the current working directory to it. The directory is deleted when the context exits. The temporary directory is created when entering the context manager, and deleted when exiting it: >>> import temporary >>> with temporary.temp_dir() as temp_...
[ "Create", "a", "temporary", "directory", "and", "optionally", "change", "the", "current", "working", "directory", "to", "it", ".", "The", "directory", "is", "deleted", "when", "the", "context", "exits", "." ]
5af1a393e57e71c2d4728e2c8e228edfd020e847
https://github.com/themattrix/python-temporary/blob/5af1a393e57e71c2d4728e2c8e228edfd020e847/temporary/directories.py#L13-L62
39,074
hollenstein/maspy
maspy/auxiliary.py
openSafeReplace
def openSafeReplace(filepath, mode='w+b'): """Context manager to open a temporary file and replace the original file on closing. """ tempfileName = None #Check if the filepath can be accessed and is writable before creating the #tempfile if not _isFileAccessible(filepath): raise IOEr...
python
def openSafeReplace(filepath, mode='w+b'): """Context manager to open a temporary file and replace the original file on closing. """ tempfileName = None #Check if the filepath can be accessed and is writable before creating the #tempfile if not _isFileAccessible(filepath): raise IOEr...
[ "def", "openSafeReplace", "(", "filepath", ",", "mode", "=", "'w+b'", ")", ":", "tempfileName", "=", "None", "#Check if the filepath can be accessed and is writable before creating the", "#tempfile", "if", "not", "_isFileAccessible", "(", "filepath", ")", ":", "raise", ...
Context manager to open a temporary file and replace the original file on closing.
[ "Context", "manager", "to", "open", "a", "temporary", "file", "and", "replace", "the", "original", "file", "on", "closing", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L115-L133
39,075
hollenstein/maspy
maspy/auxiliary.py
_isFileAccessible
def _isFileAccessible(filepath): """Returns True if the specified filepath is writable.""" directory = os.path.dirname(filepath) if not os.access(directory, os.W_OK): #Return False if directory does not exist or is not writable return False if os.path.exists(filepath): if not os....
python
def _isFileAccessible(filepath): """Returns True if the specified filepath is writable.""" directory = os.path.dirname(filepath) if not os.access(directory, os.W_OK): #Return False if directory does not exist or is not writable return False if os.path.exists(filepath): if not os....
[ "def", "_isFileAccessible", "(", "filepath", ")", ":", "directory", "=", "os", ".", "path", ".", "dirname", "(", "filepath", ")", "if", "not", "os", ".", "access", "(", "directory", ",", "os", ".", "W_OK", ")", ":", "#Return False if directory does not exist...
Returns True if the specified filepath is writable.
[ "Returns", "True", "if", "the", "specified", "filepath", "is", "writable", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L136-L153
39,076
hollenstein/maspy
maspy/auxiliary.py
writeJsonZipfile
def writeJsonZipfile(filelike, data, compress=True, mode='w', name='data'): """Serializes the objects contained in data to a JSON formated string and writes it to a zipfile. :param filelike: path to a file (str) or a file-like object :param data: object that should be converted to a JSON formated strin...
python
def writeJsonZipfile(filelike, data, compress=True, mode='w', name='data'): """Serializes the objects contained in data to a JSON formated string and writes it to a zipfile. :param filelike: path to a file (str) or a file-like object :param data: object that should be converted to a JSON formated strin...
[ "def", "writeJsonZipfile", "(", "filelike", ",", "data", ",", "compress", "=", "True", ",", "mode", "=", "'w'", ",", "name", "=", "'data'", ")", ":", "zipcomp", "=", "zipfile", ".", "ZIP_DEFLATED", "if", "compress", "else", "zipfile", ".", "ZIP_STORED", ...
Serializes the objects contained in data to a JSON formated string and writes it to a zipfile. :param filelike: path to a file (str) or a file-like object :param data: object that should be converted to a JSON formated string. Objects and types in data must be supported by the json.JSONEncoder or ...
[ "Serializes", "the", "objects", "contained", "in", "data", "to", "a", "JSON", "formated", "string", "and", "writes", "it", "to", "a", "zipfile", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L175-L193
39,077
hollenstein/maspy
maspy/auxiliary.py
writeBinaryItemContainer
def writeBinaryItemContainer(filelike, binaryItemContainer, compress=True): """Serializes the binaryItems contained in binaryItemContainer and writes them into a zipfile archive. Examples of binaryItem classes are :class:`maspy.core.Ci` and :class:`maspy.core.Sai`. A binaryItem class has to define the ...
python
def writeBinaryItemContainer(filelike, binaryItemContainer, compress=True): """Serializes the binaryItems contained in binaryItemContainer and writes them into a zipfile archive. Examples of binaryItem classes are :class:`maspy.core.Ci` and :class:`maspy.core.Sai`. A binaryItem class has to define the ...
[ "def", "writeBinaryItemContainer", "(", "filelike", ",", "binaryItemContainer", ",", "compress", "=", "True", ")", ":", "allMetadata", "=", "dict", "(", ")", "binarydatafile", "=", "io", ".", "BytesIO", "(", ")", "#Note: It would be possible to sort the items here", ...
Serializes the binaryItems contained in binaryItemContainer and writes them into a zipfile archive. Examples of binaryItem classes are :class:`maspy.core.Ci` and :class:`maspy.core.Sai`. A binaryItem class has to define the function ``_reprJSON()`` which returns a JSON formated string representation of...
[ "Serializes", "the", "binaryItems", "contained", "in", "binaryItemContainer", "and", "writes", "them", "into", "a", "zipfile", "archive", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L196-L236
39,078
hollenstein/maspy
maspy/auxiliary.py
_dumpArrayToFile
def _dumpArrayToFile(filelike, array): """Serializes a 1-dimensional ``numpy.array`` to bytes, writes the bytes to the filelike object and returns a dictionary with metadata, necessary to restore the ``numpy.array`` from the file. :param filelike: can be a file or a file-like object that provides the ...
python
def _dumpArrayToFile(filelike, array): """Serializes a 1-dimensional ``numpy.array`` to bytes, writes the bytes to the filelike object and returns a dictionary with metadata, necessary to restore the ``numpy.array`` from the file. :param filelike: can be a file or a file-like object that provides the ...
[ "def", "_dumpArrayToFile", "(", "filelike", ",", "array", ")", ":", "bytedata", "=", "array", ".", "tobytes", "(", "'C'", ")", "start", "=", "filelike", ".", "tell", "(", ")", "end", "=", "start", "+", "len", "(", "bytedata", ")", "metadata", "=", "{...
Serializes a 1-dimensional ``numpy.array`` to bytes, writes the bytes to the filelike object and returns a dictionary with metadata, necessary to restore the ``numpy.array`` from the file. :param filelike: can be a file or a file-like object that provides the methods ``.write()`` and ``.tell()``. ...
[ "Serializes", "a", "1", "-", "dimensional", "numpy", ".", "array", "to", "bytes", "writes", "the", "bytes", "to", "the", "filelike", "object", "and", "returns", "a", "dictionary", "with", "metadata", "necessary", "to", "restore", "the", "numpy", ".", "array"...
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L266-L287
39,079
hollenstein/maspy
maspy/auxiliary.py
_dumpNdarrayToFile
def _dumpNdarrayToFile(filelike, ndarray): """Serializes an N-dimensional ``numpy.array`` to bytes, writes the bytes to the filelike object and returns a dictionary with metadata, necessary to restore the ``numpy.array`` from the file. :param filelike: can be a file or a file-like object that provides ...
python
def _dumpNdarrayToFile(filelike, ndarray): """Serializes an N-dimensional ``numpy.array`` to bytes, writes the bytes to the filelike object and returns a dictionary with metadata, necessary to restore the ``numpy.array`` from the file. :param filelike: can be a file or a file-like object that provides ...
[ "def", "_dumpNdarrayToFile", "(", "filelike", ",", "ndarray", ")", ":", "bytedata", "=", "ndarray", ".", "tobytes", "(", "'C'", ")", "start", "=", "filelike", ".", "tell", "(", ")", "end", "=", "start", "+", "len", "(", "bytedata", ")", "metadata", "="...
Serializes an N-dimensional ``numpy.array`` to bytes, writes the bytes to the filelike object and returns a dictionary with metadata, necessary to restore the ``numpy.array`` from the file. :param filelike: can be a file or a file-like object that provides the methods ``.write()`` and ``.tell()``. ...
[ "Serializes", "an", "N", "-", "dimensional", "numpy", ".", "array", "to", "bytes", "writes", "the", "bytes", "to", "the", "filelike", "object", "and", "returns", "a", "dictionary", "with", "metadata", "necessary", "to", "restore", "the", "numpy", ".", "array...
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L290-L312
39,080
hollenstein/maspy
maspy/auxiliary.py
_arrayFromBytes
def _arrayFromBytes(dataBytes, metadata): """Generates and returns a numpy array from raw data bytes. :param bytes: raw data bytes as generated by ``numpy.ndarray.tobytes()`` :param metadata: a dictionary containing the data type and optionally the shape parameter to reconstruct a ``numpy.array`` f...
python
def _arrayFromBytes(dataBytes, metadata): """Generates and returns a numpy array from raw data bytes. :param bytes: raw data bytes as generated by ``numpy.ndarray.tobytes()`` :param metadata: a dictionary containing the data type and optionally the shape parameter to reconstruct a ``numpy.array`` f...
[ "def", "_arrayFromBytes", "(", "dataBytes", ",", "metadata", ")", ":", "array", "=", "numpy", ".", "fromstring", "(", "dataBytes", ",", "dtype", "=", "numpy", ".", "typeDict", "[", "metadata", "[", "'dtype'", "]", "]", ")", "if", "'shape'", "in", "metada...
Generates and returns a numpy array from raw data bytes. :param bytes: raw data bytes as generated by ``numpy.ndarray.tobytes()`` :param metadata: a dictionary containing the data type and optionally the shape parameter to reconstruct a ``numpy.array`` from the raw data bytes. ``{"dtype": "floa...
[ "Generates", "and", "returns", "a", "numpy", "array", "from", "raw", "data", "bytes", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L353-L366
39,081
hollenstein/maspy
maspy/auxiliary.py
searchFileLocation
def searchFileLocation(targetFileName, targetFileExtension, rootDirectory, recursive=True): """Search for a filename with a specified file extension in all subfolders of specified rootDirectory, returns first matching instance. :param targetFileName: #TODO: docstring :type target...
python
def searchFileLocation(targetFileName, targetFileExtension, rootDirectory, recursive=True): """Search for a filename with a specified file extension in all subfolders of specified rootDirectory, returns first matching instance. :param targetFileName: #TODO: docstring :type target...
[ "def", "searchFileLocation", "(", "targetFileName", ",", "targetFileExtension", ",", "rootDirectory", ",", "recursive", "=", "True", ")", ":", "expectedFileName", "=", "targetFileName", ".", "split", "(", "'.'", ")", "[", "0", "]", "+", "'.'", "+", "targetFile...
Search for a filename with a specified file extension in all subfolders of specified rootDirectory, returns first matching instance. :param targetFileName: #TODO: docstring :type targetFileName: str :param rootDirectory: #TODO: docstring :type rootDirectory: str :param targetFileExtension: #TOD...
[ "Search", "for", "a", "filename", "with", "a", "specified", "file", "extension", "in", "all", "subfolders", "of", "specified", "rootDirectory", "returns", "first", "matching", "instance", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L370-L405
39,082
hollenstein/maspy
maspy/auxiliary.py
matchingFilePaths
def matchingFilePaths(targetfilename, directory, targetFileExtension=None, selector=None): """Search for files in all subfolders of specified directory, return filepaths of all matching instances. :param targetfilename: filename to search for, only the string before the last "...
python
def matchingFilePaths(targetfilename, directory, targetFileExtension=None, selector=None): """Search for files in all subfolders of specified directory, return filepaths of all matching instances. :param targetfilename: filename to search for, only the string before the last "...
[ "def", "matchingFilePaths", "(", "targetfilename", ",", "directory", ",", "targetFileExtension", "=", "None", ",", "selector", "=", "None", ")", ":", "targetFilePaths", "=", "list", "(", ")", "targetfilename", "=", "os", ".", "path", ".", "splitext", "(", "t...
Search for files in all subfolders of specified directory, return filepaths of all matching instances. :param targetfilename: filename to search for, only the string before the last "." is used for filename matching. Ignored if a selector function is specified. :param directory: search dire...
[ "Search", "for", "files", "in", "all", "subfolders", "of", "specified", "directory", "return", "filepaths", "of", "all", "matching", "instances", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L408-L443
39,083
hollenstein/maspy
maspy/auxiliary.py
listFiletypes
def listFiletypes(targetfilename, directory): """Looks for all occurences of a specified filename in a directory and returns a list of all present file extensions of this filename. In this cas everything after the first dot is considered to be the file extension: ``"filename.txt" -> "txt"``, ``"filenam...
python
def listFiletypes(targetfilename, directory): """Looks for all occurences of a specified filename in a directory and returns a list of all present file extensions of this filename. In this cas everything after the first dot is considered to be the file extension: ``"filename.txt" -> "txt"``, ``"filenam...
[ "def", "listFiletypes", "(", "targetfilename", ",", "directory", ")", ":", "targetextensions", "=", "list", "(", ")", "for", "filename", "in", "os", ".", "listdir", "(", "directory", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "joinpath...
Looks for all occurences of a specified filename in a directory and returns a list of all present file extensions of this filename. In this cas everything after the first dot is considered to be the file extension: ``"filename.txt" -> "txt"``, ``"filename.txt.zip" -> "txt.zip"`` :param targetfilename:...
[ "Looks", "for", "all", "occurences", "of", "a", "specified", "filename", "in", "a", "directory", "and", "returns", "a", "list", "of", "all", "present", "file", "extensions", "of", "this", "filename", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L446-L468
39,084
hollenstein/maspy
maspy/auxiliary.py
findAllSubstrings
def findAllSubstrings(string, substring): """ Returns a list of all substring starting positions in string or an empty list if substring is not present in string. :param string: a template string :param substring: a string, which is looked for in the ``string`` parameter. :returns: a list of subst...
python
def findAllSubstrings(string, substring): """ Returns a list of all substring starting positions in string or an empty list if substring is not present in string. :param string: a template string :param substring: a string, which is looked for in the ``string`` parameter. :returns: a list of subst...
[ "def", "findAllSubstrings", "(", "string", ",", "substring", ")", ":", "#TODO: solve with regex? what about '.':", "#return [m.start() for m in re.finditer('(?='+substring+')', string)]", "start", "=", "0", "positions", "=", "[", "]", "while", "True", ":", "start", "=", "...
Returns a list of all substring starting positions in string or an empty list if substring is not present in string. :param string: a template string :param substring: a string, which is looked for in the ``string`` parameter. :returns: a list of substring starting positions in the template string
[ "Returns", "a", "list", "of", "all", "substring", "starting", "positions", "in", "string", "or", "an", "empty", "list", "if", "substring", "is", "not", "present", "in", "string", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L471-L491
39,085
hollenstein/maspy
maspy/auxiliary.py
toList
def toList(variable, types=(basestring, int, float, )): """Converts a variable of type string, int, float to a list, containing the variable as the only element. :param variable: any python object :type variable: (str, int, float, others) :returns: [variable] or variable """ if isinstance(...
python
def toList(variable, types=(basestring, int, float, )): """Converts a variable of type string, int, float to a list, containing the variable as the only element. :param variable: any python object :type variable: (str, int, float, others) :returns: [variable] or variable """ if isinstance(...
[ "def", "toList", "(", "variable", ",", "types", "=", "(", "basestring", ",", "int", ",", "float", ",", ")", ")", ":", "if", "isinstance", "(", "variable", ",", "types", ")", ":", "return", "[", "variable", "]", "else", ":", "return", "variable" ]
Converts a variable of type string, int, float to a list, containing the variable as the only element. :param variable: any python object :type variable: (str, int, float, others) :returns: [variable] or variable
[ "Converts", "a", "variable", "of", "type", "string", "int", "float", "to", "a", "list", "containing", "the", "variable", "as", "the", "only", "element", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L494-L506
39,086
hollenstein/maspy
maspy/auxiliary.py
calcDeviationLimits
def calcDeviationLimits(value, tolerance, mode): """Returns the upper and lower deviation limits for a value and a given tolerance, either as relative or a absolute difference. :param value: can be a single value or a list of values if a list of values is given, the minimal value will be used to ca...
python
def calcDeviationLimits(value, tolerance, mode): """Returns the upper and lower deviation limits for a value and a given tolerance, either as relative or a absolute difference. :param value: can be a single value or a list of values if a list of values is given, the minimal value will be used to ca...
[ "def", "calcDeviationLimits", "(", "value", ",", "tolerance", ",", "mode", ")", ":", "values", "=", "toList", "(", "value", ")", "if", "mode", "==", "'relative'", ":", "lowerLimit", "=", "min", "(", "values", ")", "*", "(", "1", "-", "tolerance", ")", ...
Returns the upper and lower deviation limits for a value and a given tolerance, either as relative or a absolute difference. :param value: can be a single value or a list of values if a list of values is given, the minimal value will be used to calculate the lower limit and the maximum value to...
[ "Returns", "the", "upper", "and", "lower", "deviation", "limits", "for", "a", "value", "and", "a", "given", "tolerance", "either", "as", "relative", "or", "a", "absolute", "difference", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L556-L576
39,087
hollenstein/maspy
maspy/auxiliary.py
PartiallySafeReplace.open
def open(self, filepath, mode='w+b'): """Opens a file - will actually return a temporary file but replace the original file when the context is closed. """ #Check if the filepath can be accessed and is writable before creating #the tempfile if not _isFileAccessible(filepa...
python
def open(self, filepath, mode='w+b'): """Opens a file - will actually return a temporary file but replace the original file when the context is closed. """ #Check if the filepath can be accessed and is writable before creating #the tempfile if not _isFileAccessible(filepa...
[ "def", "open", "(", "self", ",", "filepath", ",", "mode", "=", "'w+b'", ")", ":", "#Check if the filepath can be accessed and is writable before creating", "#the tempfile", "if", "not", "_isFileAccessible", "(", "filepath", ")", ":", "raise", "IOError", "(", "'File %s...
Opens a file - will actually return a temporary file but replace the original file when the context is closed.
[ "Opens", "a", "file", "-", "will", "actually", "return", "a", "temporary", "file", "but", "replace", "the", "original", "file", "when", "the", "context", "is", "closed", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L83-L100
39,088
GeorgeArgyros/symautomata
symautomata/sfa.py
SFA.add_state
def add_state(self): """This function adds a new state""" sid = len(self.states) self.states.append(SFAState(sid))
python
def add_state(self): """This function adds a new state""" sid = len(self.states) self.states.append(SFAState(sid))
[ "def", "add_state", "(", "self", ")", ":", "sid", "=", "len", "(", "self", ".", "states", ")", "self", ".", "states", ".", "append", "(", "SFAState", "(", "sid", ")", ")" ]
This function adds a new state
[ "This", "function", "adds", "a", "new", "state" ]
f5d66533573b27e155bec3f36b8c00b8e3937cb3
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/sfa.py#L168-L171
39,089
bitesofcode/projex
projex/addon.py
AddonMixin._initAddons
def _initAddons(cls, recurse=True): """ Initializes the addons for this manager. """ for addon_module in cls.addonModules(recurse): projex.importmodules(addon_module)
python
def _initAddons(cls, recurse=True): """ Initializes the addons for this manager. """ for addon_module in cls.addonModules(recurse): projex.importmodules(addon_module)
[ "def", "_initAddons", "(", "cls", ",", "recurse", "=", "True", ")", ":", "for", "addon_module", "in", "cls", ".", "addonModules", "(", "recurse", ")", ":", "projex", ".", "importmodules", "(", "addon_module", ")" ]
Initializes the addons for this manager.
[ "Initializes", "the", "addons", "for", "this", "manager", "." ]
d31743ec456a41428709968ab11a2cf6c6c76247
https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/addon.py#L9-L14
39,090
stephrdev/django-tapeforms
tapeforms/contrib/bootstrap.py
BootstrapTapeformMixin.get_field_label_css_class
def get_field_label_css_class(self, bound_field): """ Returns 'form-check-label' if widget is CheckboxInput. For all other fields, no css class is added. """ # If we render CheckboxInputs, Bootstrap requires a different # field label css class for checkboxes. if i...
python
def get_field_label_css_class(self, bound_field): """ Returns 'form-check-label' if widget is CheckboxInput. For all other fields, no css class is added. """ # If we render CheckboxInputs, Bootstrap requires a different # field label css class for checkboxes. if i...
[ "def", "get_field_label_css_class", "(", "self", ",", "bound_field", ")", ":", "# If we render CheckboxInputs, Bootstrap requires a different", "# field label css class for checkboxes.", "if", "isinstance", "(", "bound_field", ".", "field", ".", "widget", ",", "forms", ".", ...
Returns 'form-check-label' if widget is CheckboxInput. For all other fields, no css class is added.
[ "Returns", "form", "-", "check", "-", "label", "if", "widget", "is", "CheckboxInput", ".", "For", "all", "other", "fields", "no", "css", "class", "is", "added", "." ]
255602de43777141f18afaf30669d7bdd4f7c323
https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/contrib/bootstrap.py#L43-L53
39,091
e7dal/bubble3
behave4cmd0/pathutil.py
create_textfile_with_contents
def create_textfile_with_contents(filename, contents, encoding='utf-8'): """ Creates a textual file with the provided contents in the workdir. Overwrites an existing file. """ ensure_directory_exists(os.path.dirname(filename)) if os.path.exists(filename): os.remove(filename) outstrea...
python
def create_textfile_with_contents(filename, contents, encoding='utf-8'): """ Creates a textual file with the provided contents in the workdir. Overwrites an existing file. """ ensure_directory_exists(os.path.dirname(filename)) if os.path.exists(filename): os.remove(filename) outstrea...
[ "def", "create_textfile_with_contents", "(", "filename", ",", "contents", ",", "encoding", "=", "'utf-8'", ")", ":", "ensure_directory_exists", "(", "os", ".", "path", ".", "dirname", "(", "filename", ")", ")", "if", "os", ".", "path", ".", "exists", "(", ...
Creates a textual file with the provided contents in the workdir. Overwrites an existing file.
[ "Creates", "a", "textual", "file", "with", "the", "provided", "contents", "in", "the", "workdir", ".", "Overwrites", "an", "existing", "file", "." ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/pathutil.py#L69-L83
39,092
e7dal/bubble3
behave4cmd0/pathutil.py
ensure_directory_exists
def ensure_directory_exists(dirname, context=None): """ Ensures that a directory exits. If it does not exist, it is automatically created. """ real_dirname = dirname if context: real_dirname = realpath_with_context(dirname, context) if not os.path.exists(real_dirname): os.mak...
python
def ensure_directory_exists(dirname, context=None): """ Ensures that a directory exits. If it does not exist, it is automatically created. """ real_dirname = dirname if context: real_dirname = realpath_with_context(dirname, context) if not os.path.exists(real_dirname): os.mak...
[ "def", "ensure_directory_exists", "(", "dirname", ",", "context", "=", "None", ")", ":", "real_dirname", "=", "dirname", "if", "context", ":", "real_dirname", "=", "realpath_with_context", "(", "dirname", ",", "context", ")", "if", "not", "os", ".", "path", ...
Ensures that a directory exits. If it does not exist, it is automatically created.
[ "Ensures", "that", "a", "directory", "exits", ".", "If", "it", "does", "not", "exist", "it", "is", "automatically", "created", "." ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/pathutil.py#L94-L105
39,093
BrianHicks/emit
emit/multilang.py
ShellNode.deserialize
def deserialize(self, msg): 'deserialize output to a Python object' self.logger.debug('deserializing %s', msg) return json.loads(msg)
python
def deserialize(self, msg): 'deserialize output to a Python object' self.logger.debug('deserializing %s', msg) return json.loads(msg)
[ "def", "deserialize", "(", "self", ",", "msg", ")", ":", "self", ".", "logger", ".", "debug", "(", "'deserializing %s'", ",", "msg", ")", "return", "json", ".", "loads", "(", "msg", ")" ]
deserialize output to a Python object
[ "deserialize", "output", "to", "a", "Python", "object" ]
19a86c2392b136c9e857000798ccaa525aa0ed84
https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/multilang.py#L65-L68
39,094
HPCC-Cloud-Computing/CAL
calplus/utils.py
append_request_id
def append_request_id(req, resp, resource, params): """Append request id which got from response header to resource.req_ids list. """ def get_headers(resp): if hasattr(resp, 'headers'): return resp.headers if hasattr(resp, '_headers'): return resp._headers ...
python
def append_request_id(req, resp, resource, params): """Append request id which got from response header to resource.req_ids list. """ def get_headers(resp): if hasattr(resp, 'headers'): return resp.headers if hasattr(resp, '_headers'): return resp._headers ...
[ "def", "append_request_id", "(", "req", ",", "resp", ",", "resource", ",", "params", ")", ":", "def", "get_headers", "(", "resp", ")", ":", "if", "hasattr", "(", "resp", ",", "'headers'", ")", ":", "return", "resp", ".", "headers", "if", "hasattr", "("...
Append request id which got from response header to resource.req_ids list.
[ "Append", "request", "id", "which", "got", "from", "response", "header", "to", "resource", ".", "req_ids", "list", "." ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/utils.py#L66-L90
39,095
HPCC-Cloud-Computing/CAL
calplus/utils.py
JSONResponseSerializer._sanitizer
def _sanitizer(self, obj): """Sanitizer method that will be passed to json.dumps.""" if isinstance(obj, datetime.datetime): return obj.isoformat() if hasattr(obj, "to_dict"): return obj.to_dict() return obj
python
def _sanitizer(self, obj): """Sanitizer method that will be passed to json.dumps.""" if isinstance(obj, datetime.datetime): return obj.isoformat() if hasattr(obj, "to_dict"): return obj.to_dict() return obj
[ "def", "_sanitizer", "(", "self", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "datetime", ".", "datetime", ")", ":", "return", "obj", ".", "isoformat", "(", ")", "if", "hasattr", "(", "obj", ",", "\"to_dict\"", ")", ":", "return", "obj...
Sanitizer method that will be passed to json.dumps.
[ "Sanitizer", "method", "that", "will", "be", "passed", "to", "json", ".", "dumps", "." ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/utils.py#L50-L56
39,096
e7dal/bubble3
bubble3/util/cli_misc.py
make_uniq_for_step
def make_uniq_for_step(ctx, ukeys, step, stage, full_data, clean_missing_after_seconds, to_uniq): """initially just a copy from UNIQ_PULL""" # TODO: # this still seems to work ok for Storage types json/bubble, # for DS we need to reload de dumped step to uniqify if not ukeys: return to_uni...
python
def make_uniq_for_step(ctx, ukeys, step, stage, full_data, clean_missing_after_seconds, to_uniq): """initially just a copy from UNIQ_PULL""" # TODO: # this still seems to work ok for Storage types json/bubble, # for DS we need to reload de dumped step to uniqify if not ukeys: return to_uni...
[ "def", "make_uniq_for_step", "(", "ctx", ",", "ukeys", ",", "step", ",", "stage", ",", "full_data", ",", "clean_missing_after_seconds", ",", "to_uniq", ")", ":", "# TODO:", "# this still seems to work ok for Storage types json/bubble,", "# for DS we need to reload de dumped s...
initially just a copy from UNIQ_PULL
[ "initially", "just", "a", "copy", "from", "UNIQ_PULL" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/util/cli_misc.py#L217-L264
39,097
HPCC-Cloud-Computing/CAL
calplus/v1/compute/drivers/amazon.py
AmazonDriver.list_ip
def list_ip(self, instance_id): """Add all IPs""" output = self.client.describe_instances(InstanceIds=[instance_id]) output = output.get("Reservations")[0].get("Instances")[0] ips = {} ips['PrivateIp'] = output.get("PrivateIpAddress") ips['PublicIp'] = output.get("PublicI...
python
def list_ip(self, instance_id): """Add all IPs""" output = self.client.describe_instances(InstanceIds=[instance_id]) output = output.get("Reservations")[0].get("Instances")[0] ips = {} ips['PrivateIp'] = output.get("PrivateIpAddress") ips['PublicIp'] = output.get("PublicI...
[ "def", "list_ip", "(", "self", ",", "instance_id", ")", ":", "output", "=", "self", ".", "client", ".", "describe_instances", "(", "InstanceIds", "=", "[", "instance_id", "]", ")", "output", "=", "output", ".", "get", "(", "\"Reservations\"", ")", "[", "...
Add all IPs
[ "Add", "all", "IPs" ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/compute/drivers/amazon.py#L131-L138
39,098
GeorgeArgyros/symautomata
symautomata/flex2fst.py
main
def main(): """ Testing function for Flex Regular Expressions to FST DFA """ if len(argv) < 2: print 'Usage: %s fst_file [optional: save_file]' % argv[0] return flex_a = Flexparser() mma = flex_a.yyparse(argv[1]) mma.minimize() print mma if len(argv) == 3: mma...
python
def main(): """ Testing function for Flex Regular Expressions to FST DFA """ if len(argv) < 2: print 'Usage: %s fst_file [optional: save_file]' % argv[0] return flex_a = Flexparser() mma = flex_a.yyparse(argv[1]) mma.minimize() print mma if len(argv) == 3: mma...
[ "def", "main", "(", ")", ":", "if", "len", "(", "argv", ")", "<", "2", ":", "print", "'Usage: %s fst_file [optional: save_file]'", "%", "argv", "[", "0", "]", "return", "flex_a", "=", "Flexparser", "(", ")", "mma", "=", "flex_a", ".", "yyparse", "(", "...
Testing function for Flex Regular Expressions to FST DFA
[ "Testing", "function", "for", "Flex", "Regular", "Expressions", "to", "FST", "DFA" ]
f5d66533573b27e155bec3f36b8c00b8e3937cb3
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/flex2fst.py#L297-L309
39,099
Cadasta/django-tutelary
tutelary/mixins.py
PermissionRequiredMixin.has_permission
def has_permission(self): """Permission checking for "normal" Django.""" objs = [None] if hasattr(self, 'get_perms_objects'): objs = self.get_perms_objects() else: if hasattr(self, 'get_object'): try: objs = [self.get_object()] ...
python
def has_permission(self): """Permission checking for "normal" Django.""" objs = [None] if hasattr(self, 'get_perms_objects'): objs = self.get_perms_objects() else: if hasattr(self, 'get_object'): try: objs = [self.get_object()] ...
[ "def", "has_permission", "(", "self", ")", ":", "objs", "=", "[", "None", "]", "if", "hasattr", "(", "self", ",", "'get_perms_objects'", ")", ":", "objs", "=", "self", ".", "get_perms_objects", "(", ")", "else", ":", "if", "hasattr", "(", "self", ",", ...
Permission checking for "normal" Django.
[ "Permission", "checking", "for", "normal", "Django", "." ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/mixins.py#L72-L97