body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def all_characters_without_spaces(self, text):
' count the total of characters without any space char '
return (len(text) - self.number_spaces(text)) | -7,804,322,849,488,053,000 | count the total of characters without any space char | words.py | all_characters_without_spaces | Layto888/Words-Analysis | python | def all_characters_without_spaces(self, text):
' '
return (len(text) - self.number_spaces(text)) |
def differents_words_list(self, text):
" select only the total of different words,\n it's a set, return the set.\n "
return set(self.words_list(text)) | 89,076,078,975,208,600 | select only the total of different words,
it's a set, return the set. | words.py | differents_words_list | Layto888/Words-Analysis | python | def differents_words_list(self, text):
" select only the total of different words,\n it's a set, return the set.\n "
return set(self.words_list(text)) |
def average_sentence_length(self, text):
' count the average length of sentences\n avg = words / sentences\n '
if (len(self.words_list(text)) == 0):
return 0
else:
return (len(self.words_list(text)) / len(self.sentence_split(text))) | -7,883,651,800,705,555,000 | count the average length of sentences
avg = words / sentences | words.py | average_sentence_length | Layto888/Words-Analysis | python | def average_sentence_length(self, text):
' count the average length of sentences\n avg = words / sentences\n '
if (len(self.words_list(text)) == 0):
return 0
else:
return (len(self.words_list(text)) / len(self.sentence_split(text))) |
def max_sentence_length(self, text):
' count and return the maximum length\n of sentences list '
all_senteces = self.sentence_split(text)
try:
return max(list(map(len, all_senteces)))
except Exception as e:
print(e)
return 0 | -224,361,079,335,925,060 | count and return the maximum length
of sentences list | words.py | max_sentence_length | Layto888/Words-Analysis | python | def max_sentence_length(self, text):
' count and return the maximum length\n of sentences list '
all_senteces = self.sentence_split(text)
try:
return max(list(map(len, all_senteces)))
except Exception as e:
print(e)
return 0 |
def min_sentence_length(self, text):
' count and return the minimum length\n of sentences list '
all_senteces = self.sentence_split(text)
try:
return min(list(map(len, all_senteces)))
except Exception as e:
print(e)
return 0 | -2,005,733,370,709,845,200 | count and return the minimum length
of sentences list | words.py | min_sentence_length | Layto888/Words-Analysis | python | def min_sentence_length(self, text):
' count and return the minimum length\n of sentences list '
all_senteces = self.sentence_split(text)
try:
return min(list(map(len, all_senteces)))
except Exception as e:
print(e)
return 0 |
@staticmethod
def normalize_text(normal_text):
' remove extra spaces if any in the text\n and put it in lowercase, to normalize the input text.\n '
normalized_text = re.sub(' +', ' ', normal_text)
normalized_text = normalized_text.lower()
return normalized_text | -7,855,099,181,739,662,000 | remove extra spaces if any in the text
and put it in lowercase, to normalize the input text. | words.py | normalize_text | Layto888/Words-Analysis | python | @staticmethod
def normalize_text(normal_text):
' remove extra spaces if any in the text\n and put it in lowercase, to normalize the input text.\n '
normalized_text = re.sub(' +', ' ', normal_text)
normalized_text = normalized_text.lower()
return normalized_text |
@staticmethod
def number_spaces(text):
' count the number of spaces in the text '
return text.count(' ') | -3,373,104,589,458,795,000 | count the number of spaces in the text | words.py | number_spaces | Layto888/Words-Analysis | python | @staticmethod
def number_spaces(text):
' '
return text.count(' ') |
@staticmethod
def words_list(text):
' get all words in a list\n return the list of words [a-zA-Z_].\n '
return re.findall('[a-zA-Z]+', text) | -6,780,613,056,861,164,000 | get all words in a list
return the list of words [a-zA-Z_]. | words.py | words_list | Layto888/Words-Analysis | python | @staticmethod
def words_list(text):
' get all words in a list\n return the list of words [a-zA-Z_].\n '
return re.findall('[a-zA-Z]+', text) |
@staticmethod
def sentence_split(text):
' split sentences into list of sentences.\n return len(sentence_split(text)) to get the number of sentences.\n '
sentences = re.split('[.!?]', text)
sentences = [sentence.strip() for sentence in sentences if (len(sentence) > 1)]
return sentences | 796,200,292,554,774,800 | split sentences into list of sentences.
return len(sentence_split(text)) to get the number of sentences. | words.py | sentence_split | Layto888/Words-Analysis | python | @staticmethod
def sentence_split(text):
' split sentences into list of sentences.\n return len(sentence_split(text)) to get the number of sentences.\n '
sentences = re.split('[.!?]', text)
sentences = [sentence.strip() for sentence in sentences if (len(sentence) > 1)]
return sentences |
def __init__(self):
'Init discovery.'
self.server_socket = _get_socket()
self.log = logging.getLogger(__name__) | 2,154,616,157,608,050,700 | Init discovery. | roombapy/discovery.py | __init__ | Erelen-Laiquendi/roombapy | python | def __init__(self):
self.server_socket = _get_socket()
self.log = logging.getLogger(__name__) |
def main():
'\n Cancels all bitcoin orders.\n '
client = gdax.AuthenticatedClient(API_KEY, API_SECRET, API_PASS)
r = client.cancel_all(product='LTC-USD')
print(json.dumps(r)) | 140,713,330,605,226,910 | Cancels all bitcoin orders. | cancel.py | main | griswaldbrooks/gdax-tools | python | def main():
'\n \n '
client = gdax.AuthenticatedClient(API_KEY, API_SECRET, API_PASS)
r = client.cancel_all(product='LTC-USD')
print(json.dumps(r)) |
def calc_profit_score(rage_score=0, prev_profit_rate=0, current_profit_rate=0):
'\n ๋งค๋ ํ ํ์ด๋ฐ์ ์ค์ฝ์ด๊ฐ 5์ ์ด์์ธ ๊ฒฝ์ฐ๋ก ํ๋ค.\n 1. ์ ๋ ์์ต๋ฅ ์ด 100% ๋ณด๋ค ๋์ ๊ฒฝ์ฐ\n - ์ง์ ์์ต๋ฅ ๋ณด๋ค ๋จ์ด์ก์ ๋(+)\n rage_score = rage_score + minus_change_rate * 2\n - ์ง์ ์์ต๋ฅ ๋ณด๋ค ์ฌ๋ผ๊ฐ์ ๋(-)\n rage_score = rage_score + minus_change_rate /... | 4,407,924,379,584,943,000 | ๋งค๋ ํ ํ์ด๋ฐ์ ์ค์ฝ์ด๊ฐ 5์ ์ด์์ธ ๊ฒฝ์ฐ๋ก ํ๋ค.
1. ์ ๋ ์์ต๋ฅ ์ด 100% ๋ณด๋ค ๋์ ๊ฒฝ์ฐ
- ์ง์ ์์ต๋ฅ ๋ณด๋ค ๋จ์ด์ก์ ๋(+)
rage_score = rage_score + minus_change_rate * 2
- ์ง์ ์์ต๋ฅ ๋ณด๋ค ์ฌ๋ผ๊ฐ์ ๋(-)
rage_score = rage_score + minus_change_rate / 2
2. ์ ๋ ์์ต๋ฅ ์ด 100% ๋ณด๋ค ๋ฎ์ ๊ฒฝ์ฐ๋ ๊ทธ๋ฅ 97% ๋ฏธ๋ง์ผ ๋ ๋งค๋ ์ฒ๋ฆฌ(๋นก์นจ ์ค์ฝ์ด๋ ๊ณ์ฐ)
- ์ง์ ์์ต๋ฅ ๋ณด๋ค ๋จ์ด์ก์ ๋(+)
rage_score = rage_score + mi... | pyupbit/strategy.py | calc_profit_score | snj830526/py_autoinvestment | python | def calc_profit_score(rage_score=0, prev_profit_rate=0, current_profit_rate=0):
'\n ๋งค๋ ํ ํ์ด๋ฐ์ ์ค์ฝ์ด๊ฐ 5์ ์ด์์ธ ๊ฒฝ์ฐ๋ก ํ๋ค.\n 1. ์ ๋ ์์ต๋ฅ ์ด 100% ๋ณด๋ค ๋์ ๊ฒฝ์ฐ\n - ์ง์ ์์ต๋ฅ ๋ณด๋ค ๋จ์ด์ก์ ๋(+)\n rage_score = rage_score + minus_change_rate * 2\n - ์ง์ ์์ต๋ฅ ๋ณด๋ค ์ฌ๋ผ๊ฐ์ ๋(-)\n rage_score = rage_score + minus_change_rate /... |
def prepare_product_state(state: BitString) -> QCircuit:
'Small convenience function\n\n Parameters\n ----------\n state :\n product state encoded into a bitstring\n state: BitString :\n\n\n Returns\n -------\n type\n unitary circuit which prepares the product state\n\n '
r... | 5,049,321,781,134,345,000 | Small convenience function
Parameters
----------
state :
product state encoded into a bitstring
state: BitString :
Returns
-------
type
unitary circuit which prepares the product state | src/tequila/quantumchemistry/qc_base.py | prepare_product_state | CopperHu/tequila | python | def prepare_product_state(state: BitString) -> QCircuit:
'Small convenience function\n\n Parameters\n ----------\n state :\n product state encoded into a bitstring\n state: BitString :\n\n\n Returns\n -------\n type\n unitary circuit which prepares the product state\n\n '
r... |
@property
def molecular_data_param(self) -> dict:
':return: Give back all parameters for the MolecularData format from openfermion as dictionary'
return {'basis': self.basis_set, 'geometry': self.get_geometry(), 'description': self.description, 'charge': self.charge, 'multiplicity': self.multiplicity, 'filename... | -3,557,471,394,562,385,400 | :return: Give back all parameters for the MolecularData format from openfermion as dictionary | src/tequila/quantumchemistry/qc_base.py | molecular_data_param | CopperHu/tequila | python | @property
def molecular_data_param(self) -> dict:
return {'basis': self.basis_set, 'geometry': self.get_geometry(), 'description': self.description, 'charge': self.charge, 'multiplicity': self.multiplicity, 'filename': self.filename} |
@staticmethod
def format_element_name(string):
"OpenFermion uses case sensitive hash tables for chemical elements\n I.e. you need to name Lithium: 'Li' and 'li' or 'LI' will not work\n this convenience function does the naming\n :return: first letter converted to upper rest to lower\n\n ... | -2,788,771,041,327,360,000 | OpenFermion uses case sensitive hash tables for chemical elements
I.e. you need to name Lithium: 'Li' and 'li' or 'LI' will not work
this convenience function does the naming
:return: first letter converted to upper rest to lower
Parameters
----------
string :
Returns
------- | src/tequila/quantumchemistry/qc_base.py | format_element_name | CopperHu/tequila | python | @staticmethod
def format_element_name(string):
"OpenFermion uses case sensitive hash tables for chemical elements\n I.e. you need to name Lithium: 'Li' and 'li' or 'LI' will not work\n this convenience function does the naming\n :return: first letter converted to upper rest to lower\n\n ... |
@staticmethod
def convert_to_list(geometry):
'Convert a molecular structure given as a string into a list suitable for openfermion\n\n Parameters\n ----------\n geometry :\n a string specifying a mol. structure. E.g. geometry="h 0.0 0.0 0.0\n h 0.0 0.0 1.0"\n\n Returns\n ... | 577,410,896,616,177,700 | Convert a molecular structure given as a string into a list suitable for openfermion
Parameters
----------
geometry :
a string specifying a mol. structure. E.g. geometry="h 0.0 0.0 0.0
h 0.0 0.0 1.0"
Returns
-------
type
A list with the correct format fo... | src/tequila/quantumchemistry/qc_base.py | convert_to_list | CopperHu/tequila | python | @staticmethod
def convert_to_list(geometry):
'Convert a molecular structure given as a string into a list suitable for openfermion\n\n Parameters\n ----------\n geometry :\n a string specifying a mol. structure. E.g. geometry="h 0.0 0.0 0.0\n h 0.0 0.0 1.0"\n\n Returns\n ... |
def get_geometry_string(self) -> str:
'returns the geometry as a string\n :return: geometry string\n\n Parameters\n ----------\n\n Returns\n -------\n\n '
if (self.geometry.split('.')[(- 1)] == 'xyz'):
(geomstring, comment) = self.read_xyz_from_file(self.geometr... | -444,497,867,409,335,100 | returns the geometry as a string
:return: geometry string
Parameters
----------
Returns
------- | src/tequila/quantumchemistry/qc_base.py | get_geometry_string | CopperHu/tequila | python | def get_geometry_string(self) -> str:
'returns the geometry as a string\n :return: geometry string\n\n Parameters\n ----------\n\n Returns\n -------\n\n '
if (self.geometry.split('.')[(- 1)] == 'xyz'):
(geomstring, comment) = self.read_xyz_from_file(self.geometr... |
def get_geometry(self):
'Returns the geometry\n If a xyz filename was given the file is read out\n otherwise it is assumed that the geometry was given as string\n which is then reformatted as a list usable as input for openfermion\n :return: geometry as list\n e.g. [(h,(0.0,0.0,0.... | -1,481,264,362,287,455,700 | Returns the geometry
If a xyz filename was given the file is read out
otherwise it is assumed that the geometry was given as string
which is then reformatted as a list usable as input for openfermion
:return: geometry as list
e.g. [(h,(0.0,0.0,0.35)),(h,(0.0,0.0,-0.35))]
Units: Angstrom!
Parameters
----------
Returns... | src/tequila/quantumchemistry/qc_base.py | get_geometry | CopperHu/tequila | python | def get_geometry(self):
'Returns the geometry\n If a xyz filename was given the file is read out\n otherwise it is assumed that the geometry was given as string\n which is then reformatted as a list usable as input for openfermion\n :return: geometry as list\n e.g. [(h,(0.0,0.0,0.... |
@staticmethod
def read_xyz_from_file(filename):
'Read XYZ filetype for molecular structures\n https://en.wikipedia.org/wiki/XYZ_file_format\n Units: Angstrom!\n\n Parameters\n ----------\n filename :\n return:\n\n Returns\n -------\n\n '
with op... | 6,780,003,109,991,882,000 | Read XYZ filetype for molecular structures
https://en.wikipedia.org/wiki/XYZ_file_format
Units: Angstrom!
Parameters
----------
filename :
return:
Returns
------- | src/tequila/quantumchemistry/qc_base.py | read_xyz_from_file | CopperHu/tequila | python | @staticmethod
def read_xyz_from_file(filename):
'Read XYZ filetype for molecular structures\n https://en.wikipedia.org/wiki/XYZ_file_format\n Units: Angstrom!\n\n Parameters\n ----------\n filename :\n return:\n\n Returns\n -------\n\n '
with op... |
def make_parameter_dictionary(self, threshold=1e-08):
'\n\n Parameters\n ----------\n threshold :\n (Default value = 1.e-8)\n\n Returns\n -------\n\n '
variables = {}
if (self.tIjAb is not None):
nvirt = self.tIjAb.shape[2]
nocc = self.tI... | -6,719,897,537,732,402,000 | Parameters
----------
threshold :
(Default value = 1.e-8)
Returns
------- | src/tequila/quantumchemistry/qc_base.py | make_parameter_dictionary | CopperHu/tequila | python | def make_parameter_dictionary(self, threshold=1e-08):
'\n\n Parameters\n ----------\n threshold :\n (Default value = 1.e-8)\n\n Returns\n -------\n\n '
variables = {}
if (self.tIjAb is not None):
nvirt = self.tIjAb.shape[2]
nocc = self.tI... |
@classmethod
def from_closed_shell(cls, cs: ClosedShellAmplitudes):
'\n Initialize from closed-shell Amplitude structure\n\n Parameters\n ----------\n cs: ClosedShellAmplitudes :\n\n\n Returns\n -------\n\n '
tijab = (cs.tIjAb - numpy.einsum('ijab -> ijba', cs.tI... | -4,469,272,883,012,262,400 | Initialize from closed-shell Amplitude structure
Parameters
----------
cs: ClosedShellAmplitudes :
Returns
------- | src/tequila/quantumchemistry/qc_base.py | from_closed_shell | CopperHu/tequila | python | @classmethod
def from_closed_shell(cls, cs: ClosedShellAmplitudes):
'\n Initialize from closed-shell Amplitude structure\n\n Parameters\n ----------\n cs: ClosedShellAmplitudes :\n\n\n Returns\n -------\n\n '
tijab = (cs.tIjAb - numpy.einsum('ijab -> ijba', cs.tI... |
def make_parameter_dictionary(self, threshold=1e-08):
'\n\n Parameters\n ----------\n threshold :\n (Default value = 1.e-8)\n Neglect amplitudes below the threshold\n\n Returns\n -------\n Dictionary of tequila variables (hash is in the style of (a,i... | -6,105,695,800,096,477,000 | Parameters
----------
threshold :
(Default value = 1.e-8)
Neglect amplitudes below the threshold
Returns
-------
Dictionary of tequila variables (hash is in the style of (a,i,b,j)) | src/tequila/quantumchemistry/qc_base.py | make_parameter_dictionary | CopperHu/tequila | python | def make_parameter_dictionary(self, threshold=1e-08):
'\n\n Parameters\n ----------\n threshold :\n (Default value = 1.e-8)\n Neglect amplitudes below the threshold\n\n Returns\n -------\n Dictionary of tequila variables (hash is in the style of (a,i... |
def __init__(self, elems: numpy.ndarray=None, active_indices: list=None, ordering: str=None, size_full: int=None):
'\n Parameters\n ----------\n elems: Tensor data as numpy array\n active_indices: List of active indices in total ordering\n ordering: Ordering scheme for two body te... | -2,529,443,688,893,883,400 | Parameters
----------
elems: Tensor data as numpy array
active_indices: List of active indices in total ordering
ordering: Ordering scheme for two body tensors
"dirac" or "phys": <12|g|12>
.. math::
g_{pqrs} = \int d1 d2 p(1)q(2) g(1,2) r(1)s(2)
"mulliken" or "chem": (11|g|22)
.. math::
g_{pqrs}... | src/tequila/quantumchemistry/qc_base.py | __init__ | CopperHu/tequila | python | def __init__(self, elems: numpy.ndarray=None, active_indices: list=None, ordering: str=None, size_full: int=None):
'\n Parameters\n ----------\n elems: Tensor data as numpy array\n active_indices: List of active indices in total ordering\n ordering: Ordering scheme for two body te... |
def sub_lists(self, idx_lists: list=None) -> numpy.ndarray:
'\n Get subspace of tensor by a set of index lists\n according to hPQ.sub_lists(idx_lists=[p, q]) = [hPQ for P in p and Q in q]\n\n This essentially is an implementation of a non-contiguous slicing using numpy.take\n\n Parameter... | 8,856,364,918,677,615,000 | Get subspace of tensor by a set of index lists
according to hPQ.sub_lists(idx_lists=[p, q]) = [hPQ for P in p and Q in q]
This essentially is an implementation of a non-contiguous slicing using numpy.take
Parameters
----------
idx_lists :
List of lists, each defining the desired subspace per axis
... | src/tequila/quantumchemistry/qc_base.py | sub_lists | CopperHu/tequila | python | def sub_lists(self, idx_lists: list=None) -> numpy.ndarray:
'\n Get subspace of tensor by a set of index lists\n according to hPQ.sub_lists(idx_lists=[p, q]) = [hPQ for P in p and Q in q]\n\n This essentially is an implementation of a non-contiguous slicing using numpy.take\n\n Parameter... |
def set_index_lists(self):
' Set passive and full index lists based on class inputs '
tmp_size = self._size_full
if (self._size_full is None):
tmp_size = self.elems.shape[0]
self._passive_indices = [i for i in range(tmp_size) if (i not in self.active_indices)]
self._full_indices = [i for i i... | 2,603,122,348,096,272,000 | Set passive and full index lists based on class inputs | src/tequila/quantumchemistry/qc_base.py | set_index_lists | CopperHu/tequila | python | def set_index_lists(self):
' '
tmp_size = self._size_full
if (self._size_full is None):
tmp_size = self.elems.shape[0]
self._passive_indices = [i for i in range(tmp_size) if (i not in self.active_indices)]
self._full_indices = [i for i in range(tmp_size)] |
def sub_str(self, name: str) -> numpy.ndarray:
"\n Get subspace of tensor by a string\n Currently is able to resolve an active space, named 'a', full space 'f', and the complement 'p' = 'f' - 'a'.\n Full space in this context may also be smaller than actual tensor dimension.\n\n The spec... | 4,548,037,151,362,943,000 | Get subspace of tensor by a string
Currently is able to resolve an active space, named 'a', full space 'f', and the complement 'p' = 'f' - 'a'.
Full space in this context may also be smaller than actual tensor dimension.
The specification of active space in this context only allows to pick a set from a list of orbital... | src/tequila/quantumchemistry/qc_base.py | sub_str | CopperHu/tequila | python | def sub_str(self, name: str) -> numpy.ndarray:
"\n Get subspace of tensor by a string\n Currently is able to resolve an active space, named 'a', full space 'f', and the complement 'p' = 'f' - 'a'.\n Full space in this context may also be smaller than actual tensor dimension.\n\n The spec... |
def reorder(self, to: str='of'):
"\n Function to reorder tensors according to some convention.\n\n Parameters\n ----------\n to :\n Ordering scheme of choice.\n 'openfermion', 'of' (default) :\n openfermion - ordering, corresponds to integrals of the ... | -4,108,216,377,736,539,600 | Function to reorder tensors according to some convention.
Parameters
----------
to :
Ordering scheme of choice.
'openfermion', 'of' (default) :
openfermion - ordering, corresponds to integrals of the type
h^pq_rs = int p(1)* q(2)* O(1,2) r(2) s(1) (O(1,2)
with operators a^pq_rs = a^p a^... | src/tequila/quantumchemistry/qc_base.py | reorder | CopperHu/tequila | python | def reorder(self, to: str='of'):
"\n Function to reorder tensors according to some convention.\n\n Parameters\n ----------\n to :\n Ordering scheme of choice.\n 'openfermion', 'of' (default) :\n openfermion - ordering, corresponds to integrals of the ... |
def _make_active_space_data(self, active_orbitals, reference=None):
'\n Small helper function\n Internal use only\n Parameters\n ----------\n active_orbitals: dictionary :\n list: Give a list of spatial orbital indices\n i.e. occ = [0,1,3] means that spatial ... | -1,637,839,840,288,407,000 | Small helper function
Internal use only
Parameters
----------
active_orbitals: dictionary :
list: Give a list of spatial orbital indices
i.e. occ = [0,1,3] means that spatial orbital 0, 1 and 3 are used
reference: (Default value=None)
List of orbitals which form the reference
Can be given in the same fo... | src/tequila/quantumchemistry/qc_base.py | _make_active_space_data | CopperHu/tequila | python | def _make_active_space_data(self, active_orbitals, reference=None):
'\n Small helper function\n Internal use only\n Parameters\n ----------\n active_orbitals: dictionary :\n list: Give a list of spatial orbital indices\n i.e. occ = [0,1,3] means that spatial ... |
@classmethod
def from_openfermion(cls, molecule: openfermion.MolecularData, transformation: typing.Union[(str, typing.Callable)]=None, *args, **kwargs):
'\n Initialize direclty from openfermion MolecularData object\n\n Parameters\n ----------\n molecule\n The openfermion molec... | -5,664,757,410,306,859,000 | Initialize direclty from openfermion MolecularData object
Parameters
----------
molecule
The openfermion molecule
Returns
-------
The Tequila molecule | src/tequila/quantumchemistry/qc_base.py | from_openfermion | CopperHu/tequila | python | @classmethod
def from_openfermion(cls, molecule: openfermion.MolecularData, transformation: typing.Union[(str, typing.Callable)]=None, *args, **kwargs):
'\n Initialize direclty from openfermion MolecularData object\n\n Parameters\n ----------\n molecule\n The openfermion molec... |
def make_excitation_generator(self, indices: typing.Iterable[typing.Tuple[(int, int)]], form: str=None, remove_constant_term: bool=True) -> QubitHamiltonian:
"\n Notes\n ----------\n Creates the transformed hermitian generator of UCC type unitaries:\n M(a^\\dagger_{a_0} a_{i_0} a^\... | -7,399,805,011,970,150,000 | Notes
----------
Creates the transformed hermitian generator of UCC type unitaries:
M(a^\dagger_{a_0} a_{i_0} a^\dagger{a_1}a_{i_1} ... - h.c.)
where the qubit map M depends is self.transformation
Parameters
----------
indices : typing.Iterable[typing.Tuple[int, int]] :
List of tuples [(a_0, i_0), (a_1... | src/tequila/quantumchemistry/qc_base.py | make_excitation_generator | CopperHu/tequila | python | def make_excitation_generator(self, indices: typing.Iterable[typing.Tuple[(int, int)]], form: str=None, remove_constant_term: bool=True) -> QubitHamiltonian:
"\n Notes\n ----------\n Creates the transformed hermitian generator of UCC type unitaries:\n M(a^\\dagger_{a_0} a_{i_0} a^\... |
def make_excitation_gate(self, indices, angle, control=None, assume_real=True, **kwargs):
'\n Initialize a fermionic excitation gate defined as\n\n .. math::\n e^{-i\\frac{a}{2} G}\n with generator defines by the indices [(p0,q0),(p1,q1),...]\n .. math::\n G = i(\\p... | -3,067,702,008,567,042,000 | Initialize a fermionic excitation gate defined as
.. math::
e^{-i\frac{a}{2} G}
with generator defines by the indices [(p0,q0),(p1,q1),...]
.. math::
G = i(\prod_{k} a_{p_k}^\dagger a_{q_k} - h.c.)
Parameters
----------
indices:
List of tuples that define the generator
angle:
Numeric o... | src/tequila/quantumchemistry/qc_base.py | make_excitation_gate | CopperHu/tequila | python | def make_excitation_gate(self, indices, angle, control=None, assume_real=True, **kwargs):
'\n Initialize a fermionic excitation gate defined as\n\n .. math::\n e^{-i\\frac{a}{2} G}\n with generator defines by the indices [(p0,q0),(p1,q1),...]\n .. math::\n G = i(\\p... |
def make_molecule(self, *args, **kwargs) -> MolecularData:
'Creates a molecule in openfermion format by running psi4 and extracting the data\n Will check for previous outputfiles before running\n Will not recompute if a file was found\n\n Parameters\n ----------\n parameters :\n ... | -7,852,943,889,117,617,000 | Creates a molecule in openfermion format by running psi4 and extracting the data
Will check for previous outputfiles before running
Will not recompute if a file was found
Parameters
----------
parameters :
An instance of ParametersQC, which also holds an instance of ParametersPsi4 via parameters.psi4
The molec... | src/tequila/quantumchemistry/qc_base.py | make_molecule | CopperHu/tequila | python | def make_molecule(self, *args, **kwargs) -> MolecularData:
'Creates a molecule in openfermion format by running psi4 and extracting the data\n Will check for previous outputfiles before running\n Will not recompute if a file was found\n\n Parameters\n ----------\n parameters :\n ... |
def do_make_molecule(self, *args, **kwargs):
'\n\n Parameters\n ----------\n args\n kwargs\n\n Returns\n -------\n\n '
assert ('one_body_integrals' in kwargs)
assert ('two_body_integrals' in kwargs)
one_body_integrals = kwargs['one_body_integrals']
tw... | 6,532,914,810,767,347,000 | Parameters
----------
args
kwargs
Returns
------- | src/tequila/quantumchemistry/qc_base.py | do_make_molecule | CopperHu/tequila | python | def do_make_molecule(self, *args, **kwargs):
'\n\n Parameters\n ----------\n args\n kwargs\n\n Returns\n -------\n\n '
assert ('one_body_integrals' in kwargs)
assert ('two_body_integrals' in kwargs)
one_body_integrals = kwargs['one_body_integrals']
tw... |
def get_integrals(self, two_body_ordering='openfermion'):
'\n Returns\n -------\n Tuple with:\n constant part (nuclear_repulsion + possible integrated parts from active-spaces)\n one_body_integrals\n two_body_integrals\n\n '
if ((self.active_space is not None) an... | -5,854,853,126,287,164,000 | Returns
-------
Tuple with:
constant part (nuclear_repulsion + possible integrated parts from active-spaces)
one_body_integrals
two_body_integrals | src/tequila/quantumchemistry/qc_base.py | get_integrals | CopperHu/tequila | python | def get_integrals(self, two_body_ordering='openfermion'):
'\n Returns\n -------\n Tuple with:\n constant part (nuclear_repulsion + possible integrated parts from active-spaces)\n one_body_integrals\n two_body_integrals\n\n '
if ((self.active_space is not None) an... |
def compute_one_body_integrals(self):
' convenience function '
(c, h1, h2) = self.get_integrals()
return h1 | 5,644,753,562,055,852,000 | convenience function | src/tequila/quantumchemistry/qc_base.py | compute_one_body_integrals | CopperHu/tequila | python | def compute_one_body_integrals(self):
' '
(c, h1, h2) = self.get_integrals()
return h1 |
def prepare_reference(self, state=None, *args, **kwargs):
'\n\n Returns\n -------\n A tequila circuit object which prepares the reference of this molecule in the chosen transformation\n '
if (state is None):
assert ((self.n_electrons % 2) == 0)
state = ([0] * (self.n_... | 5,496,528,263,329,094,000 | Returns
-------
A tequila circuit object which prepares the reference of this molecule in the chosen transformation | src/tequila/quantumchemistry/qc_base.py | prepare_reference | CopperHu/tequila | python | def prepare_reference(self, state=None, *args, **kwargs):
'\n\n Returns\n -------\n A tequila circuit object which prepares the reference of this molecule in the chosen transformation\n '
if (state is None):
assert ((self.n_electrons % 2) == 0)
state = ([0] * (self.n_... |
def hcb_to_me(self, U=None):
'\n Transform a circuit in the hardcore-boson encoding (HCB)\n to the encoding of this molecule\n HCB is supposed to be encoded on the first n_orbitals qubits\n Parameters\n ----------\n U: HCB circuit (using the alpha qubits)\n Returns\n... | 2,084,151,665,806,439,200 | Transform a circuit in the hardcore-boson encoding (HCB)
to the encoding of this molecule
HCB is supposed to be encoded on the first n_orbitals qubits
Parameters
----------
U: HCB circuit (using the alpha qubits)
Returns
------- | src/tequila/quantumchemistry/qc_base.py | hcb_to_me | CopperHu/tequila | python | def hcb_to_me(self, U=None):
'\n Transform a circuit in the hardcore-boson encoding (HCB)\n to the encoding of this molecule\n HCB is supposed to be encoded on the first n_orbitals qubits\n Parameters\n ----------\n U: HCB circuit (using the alpha qubits)\n Returns\n... |
def get_pair_specific_indices(self, pair_info: str=None, include_singles: bool=True, general_excitations: bool=True) -> list:
'\n Assuming a pair-specific model, create a pair-specific index list\n to be used in make_upccgsd_ansatz(indices = ... )\n Excite from a set of references (i) to any pa... | 2,206,921,487,730,500,600 | Assuming a pair-specific model, create a pair-specific index list
to be used in make_upccgsd_ansatz(indices = ... )
Excite from a set of references (i) to any pair coming from (i),
i.e. any (i,j)/(j,i). If general excitations are allowed, also
allow excitations from pairs to appendant pairs and reference.
Paramet... | src/tequila/quantumchemistry/qc_base.py | get_pair_specific_indices | CopperHu/tequila | python | def get_pair_specific_indices(self, pair_info: str=None, include_singles: bool=True, general_excitations: bool=True) -> list:
'\n Assuming a pair-specific model, create a pair-specific index list\n to be used in make_upccgsd_ansatz(indices = ... )\n Excite from a set of references (i) to any pa... |
def format_excitation_indices(self, idx):
'\n Consistent formatting of excitation indices\n idx = [(p0,q0),(p1,q1),...,(pn,qn)]\n sorted as: p0<p1<pn and pi<qi\n :param idx: list of index tuples describing a single(!) fermionic excitation\n :return: tuple-list of index tuples\n ... | -1,336,722,734,530,659,300 | Consistent formatting of excitation indices
idx = [(p0,q0),(p1,q1),...,(pn,qn)]
sorted as: p0<p1<pn and pi<qi
:param idx: list of index tuples describing a single(!) fermionic excitation
:return: tuple-list of index tuples | src/tequila/quantumchemistry/qc_base.py | format_excitation_indices | CopperHu/tequila | python | def format_excitation_indices(self, idx):
'\n Consistent formatting of excitation indices\n idx = [(p0,q0),(p1,q1),...,(pn,qn)]\n sorted as: p0<p1<pn and pi<qi\n :param idx: list of index tuples describing a single(!) fermionic excitation\n :return: tuple-list of index tuples\n ... |
def make_upccgsd_ansatz(self, include_reference: bool=True, name: str='UpCCGSD', label: str=None, order: int=None, assume_real: bool=True, hcb_optimization: bool=None, spin_adapt_singles: bool=True, neglect_z=False, *args, **kwargs):
'\n UpGCCSD Ansatz similar as described by Lee et. al.\n\n Parameter... | 337,962,731,013,371,260 | UpGCCSD Ansatz similar as described by Lee et. al.
Parameters
----------
include_singles
include singles excitations. Is overwritten if indices are a string (i.e. indices=UpCCGSD will always include singles, UpCCGD will not)
include_reference
include the HF reference state as initial state
indices
pass cus... | src/tequila/quantumchemistry/qc_base.py | make_upccgsd_ansatz | CopperHu/tequila | python | def make_upccgsd_ansatz(self, include_reference: bool=True, name: str='UpCCGSD', label: str=None, order: int=None, assume_real: bool=True, hcb_optimization: bool=None, spin_adapt_singles: bool=True, neglect_z=False, *args, **kwargs):
'\n UpGCCSD Ansatz similar as described by Lee et. al.\n\n Parameter... |
def make_uccsd_ansatz(self, trotter_steps: int=1, initial_amplitudes: typing.Union[(str, Amplitudes, ClosedShellAmplitudes)]='mp2', include_reference_ansatz=True, parametrized=True, threshold=1e-08, add_singles=None, *args, **kwargs) -> QCircuit:
'\n\n Parameters\n ----------\n initial_amplitud... | -7,721,244,416,695,871,000 | Parameters
----------
initial_amplitudes :
initial amplitudes given as ManyBodyAmplitudes structure or as string
where 'mp2', 'cc2' or 'ccsd' are possible initializations
include_reference_ansatz :
Also do the reference ansatz (prepare closed-shell Hartree-Fock) (Default value = True)
parametrized :
Ini... | src/tequila/quantumchemistry/qc_base.py | make_uccsd_ansatz | CopperHu/tequila | python | def make_uccsd_ansatz(self, trotter_steps: int=1, initial_amplitudes: typing.Union[(str, Amplitudes, ClosedShellAmplitudes)]='mp2', include_reference_ansatz=True, parametrized=True, threshold=1e-08, add_singles=None, *args, **kwargs) -> QCircuit:
'\n\n Parameters\n ----------\n initial_amplitud... |
def compute_amplitudes(self, method: str, *args, **kwargs):
'\n Compute closed-shell CC amplitudes\n\n Parameters\n ----------\n method :\n coupled-cluster methods like cc2, ccsd, cc3, ccsd(t)\n Success might depend on backend\n got an extra function for ... | 6,440,667,878,847,520,000 | Compute closed-shell CC amplitudes
Parameters
----------
method :
coupled-cluster methods like cc2, ccsd, cc3, ccsd(t)
Success might depend on backend
got an extra function for MP2
*args :
**kwargs :
Returns
------- | src/tequila/quantumchemistry/qc_base.py | compute_amplitudes | CopperHu/tequila | python | def compute_amplitudes(self, method: str, *args, **kwargs):
'\n Compute closed-shell CC amplitudes\n\n Parameters\n ----------\n method :\n coupled-cluster methods like cc2, ccsd, cc3, ccsd(t)\n Success might depend on backend\n got an extra function for ... |
def compute_mp2_amplitudes(self) -> ClosedShellAmplitudes:
'\n\n Compute closed-shell mp2 amplitudes\n\n .. math::\n t(a,i,b,j) = 0.25 * g(a,i,b,j)/(e(i) + e(j) -a(i) - b(j) )\n\n :return:\n\n Parameters\n ----------\n\n Returns\n -------\n\n '
... | 8,495,409,407,238,118,000 | Compute closed-shell mp2 amplitudes
.. math::
t(a,i,b,j) = 0.25 * g(a,i,b,j)/(e(i) + e(j) -a(i) - b(j) )
:return:
Parameters
----------
Returns
------- | src/tequila/quantumchemistry/qc_base.py | compute_mp2_amplitudes | CopperHu/tequila | python | def compute_mp2_amplitudes(self) -> ClosedShellAmplitudes:
'\n\n Compute closed-shell mp2 amplitudes\n\n .. math::\n t(a,i,b,j) = 0.25 * g(a,i,b,j)/(e(i) + e(j) -a(i) - b(j) )\n\n :return:\n\n Parameters\n ----------\n\n Returns\n -------\n\n '
... |
def compute_cis_amplitudes(self):
'\n Compute the CIS amplitudes of the molecule\n '
@dataclass
class ResultCIS():
' '
omegas: typing.List[numbers.Real]
amplitudes: typing.List[ClosedShellAmplitudes]
def __getitem__(self, item):
return (self.omegas... | 5,713,333,365,143,049,000 | Compute the CIS amplitudes of the molecule | src/tequila/quantumchemistry/qc_base.py | compute_cis_amplitudes | CopperHu/tequila | python | def compute_cis_amplitudes(self):
'\n \n '
@dataclass
class ResultCIS():
' '
omegas: typing.List[numbers.Real]
amplitudes: typing.List[ClosedShellAmplitudes]
def __getitem__(self, item):
return (self.omegas[item], self.amplitudes[item])
de... |
@property
def rdm1(self):
' \n Returns RMD1 if computed with compute_rdms function before\n '
if (self._rdm1 is not None):
return self._rdm1
else:
print('1-RDM has not been computed. Return None for 1-RDM.')
return None | 1,835,887,568,436,279,300 | Returns RMD1 if computed with compute_rdms function before | src/tequila/quantumchemistry/qc_base.py | rdm1 | CopperHu/tequila | python | @property
def rdm1(self):
' \n \n '
if (self._rdm1 is not None):
return self._rdm1
else:
print('1-RDM has not been computed. Return None for 1-RDM.')
return None |
@property
def rdm2(self):
'\n Returns RMD2 if computed with compute_rdms function before\n This is returned in Dirac (physics) notation by default (can be changed in compute_rdms with keyword)!\n '
if (self._rdm2 is not None):
return self._rdm2
else:
print('2-RDM has not... | 830,593,727,456,388,500 | Returns RMD2 if computed with compute_rdms function before
This is returned in Dirac (physics) notation by default (can be changed in compute_rdms with keyword)! | src/tequila/quantumchemistry/qc_base.py | rdm2 | CopperHu/tequila | python | @property
def rdm2(self):
'\n Returns RMD2 if computed with compute_rdms function before\n This is returned in Dirac (physics) notation by default (can be changed in compute_rdms with keyword)!\n '
if (self._rdm2 is not None):
return self._rdm2
else:
print('2-RDM has not... |
def compute_rdms(self, U: QCircuit=None, variables: Variables=None, spin_free: bool=True, get_rdm1: bool=True, get_rdm2: bool=True, ordering='dirac'):
"\n Computes the one- and two-particle reduced density matrices (rdm1 and rdm2) given\n a unitary U. This method uses the standard ordering in physics ... | -8,130,753,551,880,289,000 | Computes the one- and two-particle reduced density matrices (rdm1 and rdm2) given
a unitary U. This method uses the standard ordering in physics as denoted below.
Note, that the representation of the density matrices depends on the qubit transformation
used. The Jordan-Wigner encoding corresponds to 'classical' second ... | src/tequila/quantumchemistry/qc_base.py | compute_rdms | CopperHu/tequila | python | def compute_rdms(self, U: QCircuit=None, variables: Variables=None, spin_free: bool=True, get_rdm1: bool=True, get_rdm2: bool=True, ordering='dirac'):
"\n Computes the one- and two-particle reduced density matrices (rdm1 and rdm2) given\n a unitary U. This method uses the standard ordering in physics ... |
def rdm_spinsum(self, sum_rdm1: bool=True, sum_rdm2: bool=True) -> tuple:
'\n Given the spin-ful 1- and 2-particle reduced density matrices, compute the spin-free RDMs by spin summation.\n\n Parameters\n ----------\n sum_rdm1, sum_rdm2 :\n If set to true, perform spin s... | 4,684,720,809,100,469,000 | Given the spin-ful 1- and 2-particle reduced density matrices, compute the spin-free RDMs by spin summation.
Parameters
----------
sum_rdm1, sum_rdm2 :
If set to true, perform spin summation on rdm1, rdm2
Returns
-------
rdm1_spinsum, rdm2_spinsum :
The desired spin-free matrices | src/tequila/quantumchemistry/qc_base.py | rdm_spinsum | CopperHu/tequila | python | def rdm_spinsum(self, sum_rdm1: bool=True, sum_rdm2: bool=True) -> tuple:
'\n Given the spin-ful 1- and 2-particle reduced density matrices, compute the spin-free RDMs by spin summation.\n\n Parameters\n ----------\n sum_rdm1, sum_rdm2 :\n If set to true, perform spin s... |
def perturbative_f12_correction(self, rdm1: numpy.ndarray=None, rdm2: numpy.ndarray=None, gamma: float=1.4, n_ri: int=None, external_info: dict=None, **kwargs) -> float:
'\n Computes the spin-free [2]_R12 correction, needing only the 1- and 2-RDM of a reference method\n Requires either 1-RDM, 2-RDM or... | 4,553,724,334,393,502,700 | Computes the spin-free [2]_R12 correction, needing only the 1- and 2-RDM of a reference method
Requires either 1-RDM, 2-RDM or information to compute them in kwargs
Parameters
----------
rdm1 :
1-electron reduced density matrix
rdm2 :
2-electron reduced density matrix
gamma :
f12-exponent, for a correlatio... | src/tequila/quantumchemistry/qc_base.py | perturbative_f12_correction | CopperHu/tequila | python | def perturbative_f12_correction(self, rdm1: numpy.ndarray=None, rdm2: numpy.ndarray=None, gamma: float=1.4, n_ri: int=None, external_info: dict=None, **kwargs) -> float:
'\n Computes the spin-free [2]_R12 correction, needing only the 1- and 2-RDM of a reference method\n Requires either 1-RDM, 2-RDM or... |
def _get_of_op(operator_tuple):
' Returns operator given by a operator tuple as OpenFermion - Fermion operator '
op = openfermion.FermionOperator(operator_tuple)
return op | 7,108,399,562,124,627,000 | Returns operator given by a operator tuple as OpenFermion - Fermion operator | src/tequila/quantumchemistry/qc_base.py | _get_of_op | CopperHu/tequila | python | def _get_of_op(operator_tuple):
' '
op = openfermion.FermionOperator(operator_tuple)
return op |
def _get_qop_hermitian(of_operator) -> QubitHamiltonian:
' Returns Hermitian part of Fermion operator as QubitHamiltonian '
qop = self.transformation(of_operator)
(real, imag) = qop.split(hermitian=True)
if real:
return real
elif (not real):
raise TequilaException('Qubit Hamiltonian ... | 6,357,291,144,305,196,000 | Returns Hermitian part of Fermion operator as QubitHamiltonian | src/tequila/quantumchemistry/qc_base.py | _get_qop_hermitian | CopperHu/tequila | python | def _get_qop_hermitian(of_operator) -> QubitHamiltonian:
' '
qop = self.transformation(of_operator)
(real, imag) = qop.split(hermitian=True)
if real:
return real
elif (not real):
raise TequilaException('Qubit Hamiltonian does not have a Hermitian part. Operator ={}'.format(of_operat... |
def _build_1bdy_operators_spinful() -> list:
' Returns spinful one-body operators as a symmetry-reduced list of QubitHamiltonians '
ops = []
for p in range(n_SOs):
for q in range((p + 1)):
op_tuple = ((p, 1), (q, 0))
op = _get_of_op(op_tuple)
ops += [op]
retur... | -4,835,705,876,241,681,000 | Returns spinful one-body operators as a symmetry-reduced list of QubitHamiltonians | src/tequila/quantumchemistry/qc_base.py | _build_1bdy_operators_spinful | CopperHu/tequila | python | def _build_1bdy_operators_spinful() -> list:
' '
ops = []
for p in range(n_SOs):
for q in range((p + 1)):
op_tuple = ((p, 1), (q, 0))
op = _get_of_op(op_tuple)
ops += [op]
return ops |
def _build_2bdy_operators_spinful() -> list:
' Returns spinful two-body operators as a symmetry-reduced list of QubitHamiltonians '
ops = []
for p in range(n_SOs):
for q in range(p):
for r in range(n_SOs):
for s in range(r):
if (((p * n_SOs) + q) >= ((... | -8,522,812,896,792,188,000 | Returns spinful two-body operators as a symmetry-reduced list of QubitHamiltonians | src/tequila/quantumchemistry/qc_base.py | _build_2bdy_operators_spinful | CopperHu/tequila | python | def _build_2bdy_operators_spinful() -> list:
' '
ops = []
for p in range(n_SOs):
for q in range(p):
for r in range(n_SOs):
for s in range(r):
if (((p * n_SOs) + q) >= ((r * n_SOs) + s)):
op_tuple = ((p, 1), (q, 1), (s, 0), (r, ... |
def _build_1bdy_operators_spinfree() -> list:
' Returns spinfree one-body operators as a symmetry-reduced list of QubitHamiltonians '
ops = []
for p in range(n_MOs):
for q in range((p + 1)):
op_tuple = (((2 * p), 1), ((2 * q), 0))
op = _get_of_op(op_tuple)
op_tupl... | 6,888,716,078,207,520,000 | Returns spinfree one-body operators as a symmetry-reduced list of QubitHamiltonians | src/tequila/quantumchemistry/qc_base.py | _build_1bdy_operators_spinfree | CopperHu/tequila | python | def _build_1bdy_operators_spinfree() -> list:
' '
ops = []
for p in range(n_MOs):
for q in range((p + 1)):
op_tuple = (((2 * p), 1), ((2 * q), 0))
op = _get_of_op(op_tuple)
op_tuple = ((((2 * p) + 1), 1), (((2 * q) + 1), 0))
op += _get_of_op(op_tuple)... |
def _build_2bdy_operators_spinfree() -> list:
' Returns spinfree two-body operators as a symmetry-reduced list of QubitHamiltonians '
ops = []
for (p, q, r, s) in product(range(n_MOs), repeat=4):
if ((((p * n_MOs) + q) >= ((r * n_MOs) + s)) and ((p >= q) or (r >= s))):
op_tuple = ((((2 *... | 796,220,979,856,340,700 | Returns spinfree two-body operators as a symmetry-reduced list of QubitHamiltonians | src/tequila/quantumchemistry/qc_base.py | _build_2bdy_operators_spinfree | CopperHu/tequila | python | def _build_2bdy_operators_spinfree() -> list:
' '
ops = []
for (p, q, r, s) in product(range(n_MOs), repeat=4):
if ((((p * n_MOs) + q) >= ((r * n_MOs) + s)) and ((p >= q) or (r >= s))):
op_tuple = ((((2 * p), 1), ((2 * q), 1), ((2 * s), 0), ((2 * r), 0)) if ((p != q) and (r != s)) else ... |
def _assemble_rdm1(evals) -> numpy.ndarray:
'\n Returns spin-ful or spin-free one-particle RDM built by symmetry conditions\n Same symmetry with or without spin, so we can use the same function\n '
N = (n_MOs if spin_free else n_SOs)
rdm1 = numpy.zeros([N, N])
ctr: int =... | 1,946,228,857,425,452,300 | Returns spin-ful or spin-free one-particle RDM built by symmetry conditions
Same symmetry with or without spin, so we can use the same function | src/tequila/quantumchemistry/qc_base.py | _assemble_rdm1 | CopperHu/tequila | python | def _assemble_rdm1(evals) -> numpy.ndarray:
'\n Returns spin-ful or spin-free one-particle RDM built by symmetry conditions\n Same symmetry with or without spin, so we can use the same function\n '
N = (n_MOs if spin_free else n_SOs)
rdm1 = numpy.zeros([N, N])
ctr: int =... |
def _assemble_rdm2_spinful(evals) -> numpy.ndarray:
' Returns spin-ful two-particle RDM built by symmetry conditions '
ctr: int = 0
rdm2 = numpy.zeros([n_SOs, n_SOs, n_SOs, n_SOs])
for p in range(n_SOs):
for q in range(p):
for r in range(n_SOs):
for s in range(r):
... | -6,612,111,771,052,758,000 | Returns spin-ful two-particle RDM built by symmetry conditions | src/tequila/quantumchemistry/qc_base.py | _assemble_rdm2_spinful | CopperHu/tequila | python | def _assemble_rdm2_spinful(evals) -> numpy.ndarray:
' '
ctr: int = 0
rdm2 = numpy.zeros([n_SOs, n_SOs, n_SOs, n_SOs])
for p in range(n_SOs):
for q in range(p):
for r in range(n_SOs):
for s in range(r):
if (((p * n_SOs) + q) >= ((r * n_SOs) + s)):
... |
def _assemble_rdm2_spinfree(evals) -> numpy.ndarray:
' Returns spin-free two-particle RDM built by symmetry conditions '
ctr: int = 0
rdm2 = numpy.zeros([n_MOs, n_MOs, n_MOs, n_MOs])
for (p, q, r, s) in product(range(n_MOs), repeat=4):
if ((((p * n_MOs) + q) >= ((r * n_MOs) + s)) and ((p >= q) o... | 1,758,414,257,986,475,300 | Returns spin-free two-particle RDM built by symmetry conditions | src/tequila/quantumchemistry/qc_base.py | _assemble_rdm2_spinfree | CopperHu/tequila | python | def _assemble_rdm2_spinfree(evals) -> numpy.ndarray:
' '
ctr: int = 0
rdm2 = numpy.zeros([n_MOs, n_MOs, n_MOs, n_MOs])
for (p, q, r, s) in product(range(n_MOs), repeat=4):
if ((((p * n_MOs) + q) >= ((r * n_MOs) + s)) and ((p >= q) or (r >= s))):
rdm2[(p, q, r, s)] = evals[ctr]
... |
def read_rep_cache(repo_dir):
'Return the rep-cache contents as a dict {hash: (rev, index, ...)}.\n '
db_path = os.path.join(repo_dir, 'db', 'rep-cache.db')
db1 = svntest.sqlite3.connect(db_path)
schema1 = db1.execute('pragma user_version').fetchone()[0]
if ((schema1 >= 2) and (svntest.sqlite3.sqli... | -2,334,762,321,693,497,300 | Return the rep-cache contents as a dict {hash: (rev, index, ...)}. | subversion/tests/cmdline/svnadmin_tests.py | read_rep_cache | auycro/subversion | python | def read_rep_cache(repo_dir):
'\n '
db_path = os.path.join(repo_dir, 'db', 'rep-cache.db')
db1 = svntest.sqlite3.connect(db_path)
schema1 = db1.execute('pragma user_version').fetchone()[0]
if ((schema1 >= 2) and (svntest.sqlite3.sqlite_version_info < (3, 8, 2))):
raise svntest.Failure(("Can... |
def check_hotcopy_bdb(src, dst):
'Verify that the SRC BDB repository has been correctly copied to DST.'
(exit_code, origout, origerr) = svntest.main.run_svnadmin('dump', src, '--quiet')
(exit_code, backout, backerr) = svntest.main.run_svnadmin('dump', dst, '--quiet')
if (origerr or backerr or (origout !... | 4,106,209,870,099,410,400 | Verify that the SRC BDB repository has been correctly copied to DST. | subversion/tests/cmdline/svnadmin_tests.py | check_hotcopy_bdb | auycro/subversion | python | def check_hotcopy_bdb(src, dst):
(exit_code, origout, origerr) = svntest.main.run_svnadmin('dump', src, '--quiet')
(exit_code, backout, backerr) = svntest.main.run_svnadmin('dump', dst, '--quiet')
if (origerr or backerr or (origout != backout)):
raise svntest.Failure |
def check_hotcopy_fsfs(src, dst):
'Verify that the SRC FSFS repository has been correctly copied to DST.'
check_hotcopy_fsfs_fsx(src, dst) | 7,227,668,457,595,708,000 | Verify that the SRC FSFS repository has been correctly copied to DST. | subversion/tests/cmdline/svnadmin_tests.py | check_hotcopy_fsfs | auycro/subversion | python | def check_hotcopy_fsfs(src, dst):
check_hotcopy_fsfs_fsx(src, dst) |
def check_hotcopy_fsx(src, dst):
'Verify that the SRC FSX repository has been correctly copied to DST.'
check_hotcopy_fsfs_fsx(src, dst) | -8,596,705,677,317,241,000 | Verify that the SRC FSX repository has been correctly copied to DST. | subversion/tests/cmdline/svnadmin_tests.py | check_hotcopy_fsx | auycro/subversion | python | def check_hotcopy_fsx(src, dst):
check_hotcopy_fsfs_fsx(src, dst) |
def get_txns(repo_dir):
"Get the txn names using 'svnadmin lstxns'."
(exit_code, output_lines, error_lines) = svntest.main.run_svnadmin('lstxns', repo_dir)
txns = sorted([output_lines.strip(x) for x in output_lines])
return txns | -3,156,529,327,218,749,400 | Get the txn names using 'svnadmin lstxns'. | subversion/tests/cmdline/svnadmin_tests.py | get_txns | auycro/subversion | python | def get_txns(repo_dir):
(exit_code, output_lines, error_lines) = svntest.main.run_svnadmin('lstxns', repo_dir)
txns = sorted([output_lines.strip(x) for x in output_lines])
return txns |
def patch_format(repo_dir, shard_size):
'Rewrite the format of the FSFS or FSX repository REPO_DIR so\n that it would use sharding with SHARDS revisions per shard.'
format_path = os.path.join(repo_dir, 'db', 'format')
contents = open(format_path, 'rb').read()
processed_lines = []
for line in conten... | -8,632,408,334,853,087,000 | Rewrite the format of the FSFS or FSX repository REPO_DIR so
that it would use sharding with SHARDS revisions per shard. | subversion/tests/cmdline/svnadmin_tests.py | patch_format | auycro/subversion | python | def patch_format(repo_dir, shard_size):
'Rewrite the format of the FSFS or FSX repository REPO_DIR so\n that it would use sharding with SHARDS revisions per shard.'
format_path = os.path.join(repo_dir, 'db', 'format')
contents = open(format_path, 'rb').read()
processed_lines = []
for line in conten... |
def is_sharded(repo_dir):
'Return whether the FSFS repository REPO_DIR is sharded.'
format_path = os.path.join(repo_dir, 'db', 'format')
contents = open(format_path, 'rb').read()
for line in contents.split(b'\n'):
if line.startswith(b'layout sharded'):
return True
return False | 2,815,214,373,564,014,000 | Return whether the FSFS repository REPO_DIR is sharded. | subversion/tests/cmdline/svnadmin_tests.py | is_sharded | auycro/subversion | python | def is_sharded(repo_dir):
format_path = os.path.join(repo_dir, 'db', 'format')
contents = open(format_path, 'rb').read()
for line in contents.split(b'\n'):
if line.startswith(b'layout sharded'):
return True
return False |
def load_and_verify_dumpstream(sbox, expected_stdout, expected_stderr, revs, check_props, dump, *varargs):
"Load the array of lines passed in DUMP into the current tests'\n repository and verify the repository content using the array of\n wc.States passed in REVS. If CHECK_PROPS is True, check properties\n of e... | 3,705,490,436,728,118,300 | Load the array of lines passed in DUMP into the current tests'
repository and verify the repository content using the array of
wc.States passed in REVS. If CHECK_PROPS is True, check properties
of each rev's items. VARARGS are optional arguments passed to the
'load' command. | subversion/tests/cmdline/svnadmin_tests.py | load_and_verify_dumpstream | auycro/subversion | python | def load_and_verify_dumpstream(sbox, expected_stdout, expected_stderr, revs, check_props, dump, *varargs):
"Load the array of lines passed in DUMP into the current tests'\n repository and verify the repository content using the array of\n wc.States passed in REVS. If CHECK_PROPS is True, check properties\n of e... |
def load_dumpstream(sbox, dump, *varargs):
'Load dump text without verification.'
return load_and_verify_dumpstream(sbox, None, None, None, False, dump, *varargs) | 1,622,666,709,462,919,000 | Load dump text without verification. | subversion/tests/cmdline/svnadmin_tests.py | load_dumpstream | auycro/subversion | python | def load_dumpstream(sbox, dump, *varargs):
return load_and_verify_dumpstream(sbox, None, None, None, False, dump, *varargs) |
def repo_format(sbox):
' Return the repository format number for SBOX.'
format_file = open(os.path.join(sbox.repo_dir, 'db', 'format'))
format = int(format_file.read()[:1])
format_file.close()
return format | 7,572,120,876,088,850,000 | Return the repository format number for SBOX. | subversion/tests/cmdline/svnadmin_tests.py | repo_format | auycro/subversion | python | def repo_format(sbox):
' '
format_file = open(os.path.join(sbox.repo_dir, 'db', 'format'))
format = int(format_file.read()[:1])
format_file.close()
return format |
def set_changed_path_list(sbox, revision, changes):
' Replace the changed paths list in the revision file REVISION in SBOX\n with the text CHANGES.'
idx = None
fp = open(fsfs_file(sbox.repo_dir, 'revs', str(revision)), 'r+b')
contents = fp.read()
length = len(contents)
if (repo_format(sbox)... | 2,415,788,640,255,247,000 | Replace the changed paths list in the revision file REVISION in SBOX
with the text CHANGES. | subversion/tests/cmdline/svnadmin_tests.py | set_changed_path_list | auycro/subversion | python | def set_changed_path_list(sbox, revision, changes):
' Replace the changed paths list in the revision file REVISION in SBOX\n with the text CHANGES.'
idx = None
fp = open(fsfs_file(sbox.repo_dir, 'revs', str(revision)), 'r+b')
contents = fp.read()
length = len(contents)
if (repo_format(sbox)... |
def extra_headers(sbox):
'loading of dumpstream with extra headers'
sbox.build(empty=True)
dumpfile = clean_dumpfile()
dumpfile[3:3] = [b'X-Comment-Header: Ignored header normally not in dump stream\n']
load_and_verify_dumpstream(sbox, [], [], dumpfile_revisions, False, dumpfile, '--ignore-uuid') | -3,325,078,735,295,992,000 | loading of dumpstream with extra headers | subversion/tests/cmdline/svnadmin_tests.py | extra_headers | auycro/subversion | python | def extra_headers(sbox):
sbox.build(empty=True)
dumpfile = clean_dumpfile()
dumpfile[3:3] = [b'X-Comment-Header: Ignored header normally not in dump stream\n']
load_and_verify_dumpstream(sbox, [], [], dumpfile_revisions, False, dumpfile, '--ignore-uuid') |
def extra_blockcontent(sbox):
'load success on oversized Content-length'
sbox.build(empty=True)
dumpfile = clean_dumpfile()
dumpfile[8:9] = [b'Extra-content-length: 10\n', b'Content-length: 108\n\n']
dumpfile[11] = (dumpfile[11][:(- 2)] + b'extra text\n\n\n')
load_and_verify_dumpstream(sbox, [],... | 7,144,138,861,667,878,000 | load success on oversized Content-length | subversion/tests/cmdline/svnadmin_tests.py | extra_blockcontent | auycro/subversion | python | def extra_blockcontent(sbox):
sbox.build(empty=True)
dumpfile = clean_dumpfile()
dumpfile[8:9] = [b'Extra-content-length: 10\n', b'Content-length: 108\n\n']
dumpfile[11] = (dumpfile[11][:(- 2)] + b'extra text\n\n\n')
load_and_verify_dumpstream(sbox, [], [], dumpfile_revisions, False, dumpfile, ... |
def inconsistent_headers(sbox):
'load failure on undersized Content-length'
sbox.build(empty=True)
dumpfile = clean_dumpfile()
dumpfile[(- 2)] = b'Content-length: 30\n\n'
load_and_verify_dumpstream(sbox, [], svntest.verify.AnyOutput, dumpfile_revisions, False, dumpfile) | 3,605,560,593,957,324,000 | load failure on undersized Content-length | subversion/tests/cmdline/svnadmin_tests.py | inconsistent_headers | auycro/subversion | python | def inconsistent_headers(sbox):
sbox.build(empty=True)
dumpfile = clean_dumpfile()
dumpfile[(- 2)] = b'Content-length: 30\n\n'
load_and_verify_dumpstream(sbox, [], svntest.verify.AnyOutput, dumpfile_revisions, False, dumpfile) |
@Issue(2729)
def empty_date(sbox):
'preserve date-less revisions in load'
sbox.build(empty=True)
dumpfile = clean_dumpfile()
dumpfile[7:11] = [b'Prop-content-length: 52\n', b'Content-length: 52\n\n', b'K 7\nsvn:log\nV 0\n\nK 10\nsvn:author\nV 4\nerik\nPROPS-END\n\n\n']
load_and_verify_dumpstream(sbo... | 7,059,030,812,455,790,000 | preserve date-less revisions in load | subversion/tests/cmdline/svnadmin_tests.py | empty_date | auycro/subversion | python | @Issue(2729)
def empty_date(sbox):
sbox.build(empty=True)
dumpfile = clean_dumpfile()
dumpfile[7:11] = [b'Prop-content-length: 52\n', b'Content-length: 52\n\n', b'K 7\nsvn:log\nV 0\n\nK 10\nsvn:author\nV 4\nerik\nPROPS-END\n\n\n']
load_and_verify_dumpstream(sbox, [], [], dumpfile_revisions, False, ... |
def dump_copied_dir(sbox):
"'svnadmin dump' on copied directory"
sbox.build()
wc_dir = sbox.wc_dir
repo_dir = sbox.repo_dir
old_C_path = os.path.join(wc_dir, 'A', 'C')
new_C_path = os.path.join(wc_dir, 'A', 'B', 'C')
svntest.main.run_svn(None, 'cp', old_C_path, new_C_path)
sbox.simple_co... | -1,576,102,342,841,974,500 | 'svnadmin dump' on copied directory | subversion/tests/cmdline/svnadmin_tests.py | dump_copied_dir | auycro/subversion | python | def dump_copied_dir(sbox):
sbox.build()
wc_dir = sbox.wc_dir
repo_dir = sbox.repo_dir
old_C_path = os.path.join(wc_dir, 'A', 'C')
new_C_path = os.path.join(wc_dir, 'A', 'B', 'C')
svntest.main.run_svn(None, 'cp', old_C_path, new_C_path)
sbox.simple_commit(message='log msg')
(exit_cod... |
def dump_move_dir_modify_child(sbox):
"'svnadmin dump' on modified child of copied dir"
sbox.build()
wc_dir = sbox.wc_dir
repo_dir = sbox.repo_dir
B_path = os.path.join(wc_dir, 'A', 'B')
Q_path = os.path.join(wc_dir, 'A', 'Q')
svntest.main.run_svn(None, 'cp', B_path, Q_path)
svntest.main... | 5,954,414,562,551,596,000 | 'svnadmin dump' on modified child of copied dir | subversion/tests/cmdline/svnadmin_tests.py | dump_move_dir_modify_child | auycro/subversion | python | def dump_move_dir_modify_child(sbox):
sbox.build()
wc_dir = sbox.wc_dir
repo_dir = sbox.repo_dir
B_path = os.path.join(wc_dir, 'A', 'B')
Q_path = os.path.join(wc_dir, 'A', 'Q')
svntest.main.run_svn(None, 'cp', B_path, Q_path)
svntest.main.file_append(os.path.join(Q_path, 'lambda'), 'hel... |
def dump_quiet(sbox):
"'svnadmin dump --quiet'"
sbox.build(create_wc=False)
(exit_code, dump, errput) = svntest.main.run_svnadmin('dump', sbox.repo_dir, '--quiet')
svntest.verify.compare_and_display_lines("Output of 'svnadmin dump --quiet' is unexpected.", 'STDERR', [], errput) | 4,848,593,199,810,735,000 | 'svnadmin dump --quiet' | subversion/tests/cmdline/svnadmin_tests.py | dump_quiet | auycro/subversion | python | def dump_quiet(sbox):
sbox.build(create_wc=False)
(exit_code, dump, errput) = svntest.main.run_svnadmin('dump', sbox.repo_dir, '--quiet')
svntest.verify.compare_and_display_lines("Output of is unexpected.", 'STDERR', [], errput) |
def hotcopy_dot(sbox):
"'svnadmin hotcopy PATH .'"
sbox.build()
(backup_dir, backup_url) = sbox.add_repo_path('backup')
os.mkdir(backup_dir)
cwd = os.getcwd()
os.chdir(backup_dir)
svntest.actions.run_and_verify_svnadmin(None, [], 'hotcopy', os.path.join(cwd, sbox.repo_dir), '.')
os.chdir... | -1,891,189,981,001,249,000 | 'svnadmin hotcopy PATH .' | subversion/tests/cmdline/svnadmin_tests.py | hotcopy_dot | auycro/subversion | python | def hotcopy_dot(sbox):
sbox.build()
(backup_dir, backup_url) = sbox.add_repo_path('backup')
os.mkdir(backup_dir)
cwd = os.getcwd()
os.chdir(backup_dir)
svntest.actions.run_and_verify_svnadmin(None, [], 'hotcopy', os.path.join(cwd, sbox.repo_dir), '.')
os.chdir(cwd)
if svntest.main.i... |
@SkipUnless(svntest.main.is_fs_type_bdb)
def hotcopy_format(sbox):
"'svnadmin hotcopy' checking db/format file"
sbox.build()
(backup_dir, backup_url) = sbox.add_repo_path('backup')
(exit_code, output, errput) = svntest.main.run_svnadmin('hotcopy', sbox.repo_dir, backup_dir)
if errput:
logger... | -7,783,969,956,639,117,000 | 'svnadmin hotcopy' checking db/format file | subversion/tests/cmdline/svnadmin_tests.py | hotcopy_format | auycro/subversion | python | @SkipUnless(svntest.main.is_fs_type_bdb)
def hotcopy_format(sbox):
sbox.build()
(backup_dir, backup_url) = sbox.add_repo_path('backup')
(exit_code, output, errput) = svntest.main.run_svnadmin('hotcopy', sbox.repo_dir, backup_dir)
if errput:
logger.warn('Error: hotcopy failed')
raise... |
def setrevprop(sbox):
'setlog, setrevprop, delrevprop; bypass hooks'
sbox.build()
iota_path = os.path.join(sbox.wc_dir, 'iota')
mu_path = sbox.ospath('A/mu')
svntest.actions.run_and_verify_svnadmin([], [], 'setlog', sbox.repo_dir, '-r0', '--bypass-hooks', iota_path)
svntest.actions.run_and_verif... | -2,575,452,230,689,988,600 | setlog, setrevprop, delrevprop; bypass hooks | subversion/tests/cmdline/svnadmin_tests.py | setrevprop | auycro/subversion | python | def setrevprop(sbox):
sbox.build()
iota_path = os.path.join(sbox.wc_dir, 'iota')
mu_path = sbox.ospath('A/mu')
svntest.actions.run_and_verify_svnadmin([], [], 'setlog', sbox.repo_dir, '-r0', '--bypass-hooks', iota_path)
svntest.actions.run_and_verify_svnadmin([], svntest.verify.AnyOutput, 'setl... |
def verify_windows_paths_in_repos(sbox):
"verify a repository containing paths like 'c:hi'"
sbox.build(create_wc=False)
repo_url = sbox.repo_url
chi_url = (sbox.repo_url + '/c:hi')
svntest.actions.run_and_verify_svn(None, [], 'mkdir', '-m', 'log_msg', chi_url)
(exit_code, output, errput) = svnte... | 2,949,465,227,462,650,400 | verify a repository containing paths like 'c:hi' | subversion/tests/cmdline/svnadmin_tests.py | verify_windows_paths_in_repos | auycro/subversion | python | def verify_windows_paths_in_repos(sbox):
sbox.build(create_wc=False)
repo_url = sbox.repo_url
chi_url = (sbox.repo_url + '/c:hi')
svntest.actions.run_and_verify_svn(None, [], 'mkdir', '-m', 'log_msg', chi_url)
(exit_code, output, errput) = svntest.main.run_svnadmin('verify', sbox.repo_dir)
... |
@SkipUnless(svntest.main.is_fs_type_fsfs)
def verify_incremental_fsfs(sbox):
"svnadmin verify detects corruption dump can't"
if ((svntest.main.options.fsfs_version is not None) and (svntest.main.options.fsfs_version not in [4, 6])):
raise svntest.Skip('Unsupported prepackaged repository version')
sb... | -5,360,502,733,076,162,000 | svnadmin verify detects corruption dump can't | subversion/tests/cmdline/svnadmin_tests.py | verify_incremental_fsfs | auycro/subversion | python | @SkipUnless(svntest.main.is_fs_type_fsfs)
def verify_incremental_fsfs(sbox):
if ((svntest.main.options.fsfs_version is not None) and (svntest.main.options.fsfs_version not in [4, 6])):
raise svntest.Skip('Unsupported prepackaged repository version')
sbox.build(create_wc=False, minor_version=min(svn... |
def corrupt_and_recover_db_current(sbox, minor_version=None):
'Build up a MINOR_VERSION sandbox and test different recovery scenarios\n with missing, out-of-date or even corrupt db/current files. Recovery should\n behave the same way with all values of MINOR_VERSION, hence this helper\n containing the common co... | -5,489,307,536,718,855,000 | Build up a MINOR_VERSION sandbox and test different recovery scenarios
with missing, out-of-date or even corrupt db/current files. Recovery should
behave the same way with all values of MINOR_VERSION, hence this helper
containing the common code that allows us to check it. | subversion/tests/cmdline/svnadmin_tests.py | corrupt_and_recover_db_current | auycro/subversion | python | def corrupt_and_recover_db_current(sbox, minor_version=None):
'Build up a MINOR_VERSION sandbox and test different recovery scenarios\n with missing, out-of-date or even corrupt db/current files. Recovery should\n behave the same way with all values of MINOR_VERSION, hence this helper\n containing the common co... |
@SkipUnless(svntest.main.is_fs_type_fsfs)
def fsfs_recover_db_current(sbox):
'fsfs recover db/current'
corrupt_and_recover_db_current(sbox) | 6,653,498,663,699,317,000 | fsfs recover db/current | subversion/tests/cmdline/svnadmin_tests.py | fsfs_recover_db_current | auycro/subversion | python | @SkipUnless(svntest.main.is_fs_type_fsfs)
def fsfs_recover_db_current(sbox):
corrupt_and_recover_db_current(sbox) |
@SkipUnless(svntest.main.is_fs_type_fsfs)
def fsfs_recover_old_db_current(sbox):
'fsfs recover db/current --compatible-version=1.3'
corrupt_and_recover_db_current(sbox, minor_version=3) | -916,117,988,128,732,800 | fsfs recover db/current --compatible-version=1.3 | subversion/tests/cmdline/svnadmin_tests.py | fsfs_recover_old_db_current | auycro/subversion | python | @SkipUnless(svntest.main.is_fs_type_fsfs)
def fsfs_recover_old_db_current(sbox):
corrupt_and_recover_db_current(sbox, minor_version=3) |
@Issue(2983)
def load_with_parent_dir(sbox):
"'svnadmin load --parent-dir' reparents mergeinfo"
sbox.build(empty=True)
dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]), 'svnadmin_tests_data', 'mergeinfo_included.dump')
dumpfile = svntest.actions.load_dumpfile(dumpfile_location)
svntest.... | 4,298,635,654,713,536,500 | 'svnadmin load --parent-dir' reparents mergeinfo | subversion/tests/cmdline/svnadmin_tests.py | load_with_parent_dir | auycro/subversion | python | @Issue(2983)
def load_with_parent_dir(sbox):
sbox.build(empty=True)
dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]), 'svnadmin_tests_data', 'mergeinfo_included.dump')
dumpfile = svntest.actions.load_dumpfile(dumpfile_location)
svntest.actions.run_and_verify_svn(['Committing transactio... |
def set_uuid(sbox):
"test 'svnadmin setuuid'"
sbox.build(create_wc=False)
(exit_code, output, errput) = svntest.main.run_svnlook('uuid', sbox.repo_dir)
if errput:
raise SVNUnexpectedStderr(errput)
orig_uuid = output[0].rstrip()
svntest.actions.run_and_verify_svnadmin(None, '^.*Malformed ... | -8,573,023,354,052,229,000 | test 'svnadmin setuuid' | subversion/tests/cmdline/svnadmin_tests.py | set_uuid | auycro/subversion | python | def set_uuid(sbox):
sbox.build(create_wc=False)
(exit_code, output, errput) = svntest.main.run_svnlook('uuid', sbox.repo_dir)
if errput:
raise SVNUnexpectedStderr(errput)
orig_uuid = output[0].rstrip()
svntest.actions.run_and_verify_svnadmin(None, '^.*Malformed UUID.*$', 'setuuid', sbox... |
@Issue(3020)
def reflect_dropped_renumbered_revs(sbox):
'reflect dropped renumbered revs in svn:mergeinfo'
sbox.build(empty=True)
dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]), 'svndumpfilter_tests_data', 'with_merges.dump')
dumpfile = svntest.actions.load_dumpfile(dumpfile_location)
... | -3,383,642,271,943,255,600 | reflect dropped renumbered revs in svn:mergeinfo | subversion/tests/cmdline/svnadmin_tests.py | reflect_dropped_renumbered_revs | auycro/subversion | python | @Issue(3020)
def reflect_dropped_renumbered_revs(sbox):
sbox.build(empty=True)
dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]), 'svndumpfilter_tests_data', 'with_merges.dump')
dumpfile = svntest.actions.load_dumpfile(dumpfile_location)
svntest.actions.run_and_verify_svn(['Committing t... |
@SkipUnless(svntest.main.is_fs_type_fsfs)
@Issue(2992)
def fsfs_recover_handle_missing_revs_or_revprops_file(sbox):
'fsfs recovery checks missing revs / revprops files'
sbox.build()
svntest.main.file_append(os.path.join(sbox.wc_dir, 'iota'), 'newer line\n')
sbox.simple_commit(message='log msg')
svnt... | -6,091,200,778,968,647,000 | fsfs recovery checks missing revs / revprops files | subversion/tests/cmdline/svnadmin_tests.py | fsfs_recover_handle_missing_revs_or_revprops_file | auycro/subversion | python | @SkipUnless(svntest.main.is_fs_type_fsfs)
@Issue(2992)
def fsfs_recover_handle_missing_revs_or_revprops_file(sbox):
sbox.build()
svntest.main.file_append(os.path.join(sbox.wc_dir, 'iota'), 'newer line\n')
sbox.simple_commit(message='log msg')
svntest.main.file_append(os.path.join(sbox.wc_dir, 'iota... |
@Skip(svntest.main.tests_use_prepackaged_repository)
def create_in_repo_subdir(sbox):
"'svnadmin create /path/to/repo/subdir'"
sbox.build(create_wc=False, empty=True)
repo_dir = sbox.repo_dir
success = False
try:
subdir = os.path.join(repo_dir, 'Z')
svntest.main.create_repos(subdir)
... | -2,152,694,088,011,055,000 | 'svnadmin create /path/to/repo/subdir' | subversion/tests/cmdline/svnadmin_tests.py | create_in_repo_subdir | auycro/subversion | python | @Skip(svntest.main.tests_use_prepackaged_repository)
def create_in_repo_subdir(sbox):
sbox.build(create_wc=False, empty=True)
repo_dir = sbox.repo_dir
success = False
try:
subdir = os.path.join(repo_dir, 'Z')
svntest.main.create_repos(subdir)
except svntest.main.SVNRepositoryCre... |
@SkipUnless(svntest.main.is_fs_type_fsfs)
@SkipDumpLoadCrossCheck()
def verify_with_invalid_revprops(sbox):
'svnadmin verify detects invalid revprops file'
sbox.build(create_wc=False, empty=True)
repo_dir = sbox.repo_dir
(exit_code, output, errput) = svntest.main.run_svnadmin('verify', sbox.repo_dir)
... | -2,633,141,459,617,310,000 | svnadmin verify detects invalid revprops file | subversion/tests/cmdline/svnadmin_tests.py | verify_with_invalid_revprops | auycro/subversion | python | @SkipUnless(svntest.main.is_fs_type_fsfs)
@SkipDumpLoadCrossCheck()
def verify_with_invalid_revprops(sbox):
sbox.build(create_wc=False, empty=True)
repo_dir = sbox.repo_dir
(exit_code, output, errput) = svntest.main.run_svnadmin('verify', sbox.repo_dir)
if errput:
raise SVNUnexpectedStderr(... |
@Issue(3020)
def dont_drop_valid_mergeinfo_during_incremental_loads(sbox):
"don't filter mergeinfo revs from incremental dump"
sbox.build(empty=True)
dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]), 'svnadmin_tests_data', 'mergeinfo_included_full.dump')
dumpfile_full = svntest.actions.load... | 2,561,060,232,985,434,600 | don't filter mergeinfo revs from incremental dump | subversion/tests/cmdline/svnadmin_tests.py | dont_drop_valid_mergeinfo_during_incremental_loads | auycro/subversion | python | @Issue(3020)
def dont_drop_valid_mergeinfo_during_incremental_loads(sbox):
sbox.build(empty=True)
dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]), 'svnadmin_tests_data', 'mergeinfo_included_full.dump')
dumpfile_full = svntest.actions.load_dumpfile(dumpfile_location)
load_dumpstream(sb... |
@SkipUnless(svntest.main.is_posix_os)
@Issue(2591)
def hotcopy_symlink(sbox):
"'svnadmin hotcopy' replicates symlink"
sbox.build(create_wc=False, empty=True)
original_repo = sbox.repo_dir
(hotcopy_repo, hotcopy_url) = sbox.add_repo_path('hotcopy')
svntest.main.safe_rmtree(sbox.wc_dir, 1)
os.mkdi... | -5,019,803,570,664,701,000 | 'svnadmin hotcopy' replicates symlink | subversion/tests/cmdline/svnadmin_tests.py | hotcopy_symlink | auycro/subversion | python | @SkipUnless(svntest.main.is_posix_os)
@Issue(2591)
def hotcopy_symlink(sbox):
sbox.build(create_wc=False, empty=True)
original_repo = sbox.repo_dir
(hotcopy_repo, hotcopy_url) = sbox.add_repo_path('hotcopy')
svntest.main.safe_rmtree(sbox.wc_dir, 1)
os.mkdir(sbox.wc_dir)
external_file_path =... |
def load_bad_props(sbox):
'svnadmin load with invalid svn: props'
dump_str = b'SVN-fs-dump-format-version: 2\n\nUUID: dc40867b-38f6-0310-9f5f-f81aa277e06f\n\nRevision-number: 0\nProp-content-length: 56\nContent-length: 56\n\nK 8\nsvn:date\nV 27\n2005-05-03T19:09:41.129900Z\nPROPS-END\n\nRevision-number: 1\nProp... | 8,739,384,545,327,073,000 | svnadmin load with invalid svn: props | subversion/tests/cmdline/svnadmin_tests.py | load_bad_props | auycro/subversion | python | def load_bad_props(sbox):
dump_str = b'SVN-fs-dump-format-version: 2\n\nUUID: dc40867b-38f6-0310-9f5f-f81aa277e06f\n\nRevision-number: 0\nProp-content-length: 56\nContent-length: 56\n\nK 8\nsvn:date\nV 27\n2005-05-03T19:09:41.129900Z\nPROPS-END\n\nRevision-number: 1\nProp-content-length: 99\nContent-length: 99... |
@SkipUnless(svntest.main.is_fs_type_fsfs)
@SkipUnless(svntest.main.server_enforces_UTF8_fspaths_in_verify)
def verify_non_utf8_paths(sbox):
'svnadmin verify with non-UTF-8 paths'
if ((svntest.main.options.fsfs_version is not None) and (svntest.main.options.fsfs_version not in [4, 6])):
raise svntest.Ski... | 560,368,390,026,721,660 | svnadmin verify with non-UTF-8 paths | subversion/tests/cmdline/svnadmin_tests.py | verify_non_utf8_paths | auycro/subversion | python | @SkipUnless(svntest.main.is_fs_type_fsfs)
@SkipUnless(svntest.main.server_enforces_UTF8_fspaths_in_verify)
def verify_non_utf8_paths(sbox):
if ((svntest.main.options.fsfs_version is not None) and (svntest.main.options.fsfs_version not in [4, 6])):
raise svntest.Skip('Unsupported prepackaged repository ... |
def test_lslocks_and_rmlocks(sbox):
"test 'svnadmin lslocks' and 'svnadmin rmlocks'"
sbox.build(create_wc=False)
iota_url = (sbox.repo_url + '/iota')
lambda_url = (sbox.repo_url + '/A/B/lambda')
(exit_code, output, errput) = svntest.main.run_svnadmin('lslocks', sbox.repo_dir)
if (exit_code or er... | 3,027,762,593,277,957,600 | test 'svnadmin lslocks' and 'svnadmin rmlocks' | subversion/tests/cmdline/svnadmin_tests.py | test_lslocks_and_rmlocks | auycro/subversion | python | def test_lslocks_and_rmlocks(sbox):
sbox.build(create_wc=False)
iota_url = (sbox.repo_url + '/iota')
lambda_url = (sbox.repo_url + '/A/B/lambda')
(exit_code, output, errput) = svntest.main.run_svnadmin('lslocks', sbox.repo_dir)
if (exit_code or errput or output):
raise svntest.Failure("... |
@Issue(3734)
def load_ranges(sbox):
"'svnadmin load --revision X:Y'"
sbox.build(empty=True)
dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]), 'svnadmin_tests_data', 'skeleton_repos.dump')
dumplines = svntest.actions.load_dumpfile(dumpfile_location)
load_dumpstream(sbox, dumplines, '-r0:... | -3,604,528,348,858,793,000 | 'svnadmin load --revision X:Y' | subversion/tests/cmdline/svnadmin_tests.py | load_ranges | auycro/subversion | python | @Issue(3734)
def load_ranges(sbox):
sbox.build(empty=True)
dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]), 'svnadmin_tests_data', 'skeleton_repos.dump')
dumplines = svntest.actions.load_dumpfile(dumpfile_location)
load_dumpstream(sbox, dumplines, '-r0:2')
svntest.actions.run_and_... |
@SkipUnless(svntest.main.is_fs_type_fsfs)
def hotcopy_incremental(sbox):
"'svnadmin hotcopy --incremental PATH .'"
sbox.build()
(backup_dir, backup_url) = sbox.add_repo_path('backup')
os.mkdir(backup_dir)
cwd = os.getcwd()
for i in [1, 2, 3]:
os.chdir(backup_dir)
svntest.actions.... | 3,619,880,128,181,488,000 | 'svnadmin hotcopy --incremental PATH .' | subversion/tests/cmdline/svnadmin_tests.py | hotcopy_incremental | auycro/subversion | python | @SkipUnless(svntest.main.is_fs_type_fsfs)
def hotcopy_incremental(sbox):
sbox.build()
(backup_dir, backup_url) = sbox.add_repo_path('backup')
os.mkdir(backup_dir)
cwd = os.getcwd()
for i in [1, 2, 3]:
os.chdir(backup_dir)
svntest.actions.run_and_verify_svnadmin(None, [], 'hotcop... |
@SkipUnless(svntest.main.is_fs_type_fsfs)
@SkipUnless(svntest.main.fs_has_pack)
def hotcopy_incremental_packed(sbox):
"'svnadmin hotcopy --incremental' with packing"
sbox.build()
patch_format(sbox.repo_dir, shard_size=2)
(backup_dir, backup_url) = sbox.add_repo_path('backup')
os.mkdir(backup_dir)
... | -2,590,107,834,751,945,000 | 'svnadmin hotcopy --incremental' with packing | subversion/tests/cmdline/svnadmin_tests.py | hotcopy_incremental_packed | auycro/subversion | python | @SkipUnless(svntest.main.is_fs_type_fsfs)
@SkipUnless(svntest.main.fs_has_pack)
def hotcopy_incremental_packed(sbox):
sbox.build()
patch_format(sbox.repo_dir, shard_size=2)
(backup_dir, backup_url) = sbox.add_repo_path('backup')
os.mkdir(backup_dir)
cwd = os.getcwd()
if (not (svntest.main.i... |
def locking(sbox):
'svnadmin lock tests'
sbox.build(create_wc=False)
comment_path = os.path.join(svntest.main.temp_dir, 'comment')
svntest.main.file_write(comment_path, 'dummy comment')
invalid_comment_path = os.path.join(svntest.main.temp_dir, 'invalid_comment')
svntest.main.file_write(invalid_... | -5,838,575,192,461,374,000 | svnadmin lock tests | subversion/tests/cmdline/svnadmin_tests.py | locking | auycro/subversion | python | def locking(sbox):
sbox.build(create_wc=False)
comment_path = os.path.join(svntest.main.temp_dir, 'comment')
svntest.main.file_write(comment_path, 'dummy comment')
invalid_comment_path = os.path.join(svntest.main.temp_dir, 'invalid_comment')
svntest.main.file_write(invalid_comment_path, 'charac... |
@SkipUnless(svntest.main.is_threaded_python)
@Issue(4129)
def mergeinfo_race(sbox):
'concurrent mergeinfo commits invalidate pred-count'
sbox.build()
wc_dir = sbox.wc_dir
wc2_dir = sbox.add_wc_path('2')
svntest.main.run_svn(None, 'checkout', '-q', sbox.repo_url, wc2_dir)
svntest.main.run_svn(Non... | 5,069,601,437,167,270,000 | concurrent mergeinfo commits invalidate pred-count | subversion/tests/cmdline/svnadmin_tests.py | mergeinfo_race | auycro/subversion | python | @SkipUnless(svntest.main.is_threaded_python)
@Issue(4129)
def mergeinfo_race(sbox):
sbox.build()
wc_dir = sbox.wc_dir
wc2_dir = sbox.add_wc_path('2')
svntest.main.run_svn(None, 'checkout', '-q', sbox.repo_url, wc2_dir)
svntest.main.run_svn(None, 'mkdir', sbox.ospath('d1', wc_dir))
svntest.m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.