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 collect(self): '\n collectors only function called collect. and it collects data\n ' downstream = GaugeMetricFamily('node_bw_wan_bps', 'last tested wan downstream mb/s', labels=['nodeid']) for node in GLOBAL_NODES['nodes']: if ('downstream_mbps_wan' in node): downstream...
8,762,798,445,223,603,000
collectors only function called collect. and it collects data
roles/ffbsee-robin-exporter/files/robin_prometheus.py
collect
ffbsee/ffbsee-ansible
python
def collect(self): '\n \n ' downstream = GaugeMetricFamily('node_bw_wan_bps', 'last tested wan downstream mb/s', labels=['nodeid']) for node in GLOBAL_NODES['nodes']: if ('downstream_mbps_wan' in node): downstream.add_metric([node['id']], node['downstream_mbps_wan']) (y...
@staticmethod def _parse_string(parse_it): '\n Strip an escaped string which is enclosed in double quotes and\n unescape.\n ' if ((parse_it[0] != '"') or (parse_it[(- 1)] != '"')): raise ValueError('malformatted string: {0:r}'.format(parse_it)) return bytes(parse_it[1:(- 1)], 'a...
941,041,326,645,701,900
Strip an escaped string which is enclosed in double quotes and unescape.
roles/ffbsee-robin-exporter/files/robin_prometheus.py
_parse_string
ffbsee/ffbsee-ansible
python
@staticmethod def _parse_string(parse_it): '\n Strip an escaped string which is enclosed in double quotes and\n unescape.\n ' if ((parse_it[0] != '"') or (parse_it[(- 1)] != '"')): raise ValueError('malformatted string: {0:r}'.format(parse_it)) return bytes(parse_it[1:(- 1)], 'a...
@staticmethod def parse_line(item, nodes=None): '\n Parse and validate a line as returned by alfred.\n\n Such lines consist of a nodes MAC address and an escaped string of JSON\n encoded data. Note that most missing fields are populated with\n reasonable defaults.\n ' if (node...
-6,734,838,248,712,039,000
Parse and validate a line as returned by alfred. Such lines consist of a nodes MAC address and an escaped string of JSON encoded data. Note that most missing fields are populated with reasonable defaults.
roles/ffbsee-robin-exporter/files/robin_prometheus.py
parse_line
ffbsee/ffbsee-ansible
python
@staticmethod def parse_line(item, nodes=None): '\n Parse and validate a line as returned by alfred.\n\n Such lines consist of a nodes MAC address and an escaped string of JSON\n encoded data. Note that most missing fields are populated with\n reasonable defaults.\n ' if (node...
def update_properties(self, properties, force=True): '\n Replace any properties with their respective values in ``properties``.\n ' if force: self.properties = dict(properties) if ('force' in self.properties): del self.properties['force'] else: for (key, val...
-4,697,277,235,184,264,000
Replace any properties with their respective values in ``properties``.
roles/ffbsee-robin-exporter/files/robin_prometheus.py
update_properties
ffbsee/ffbsee-ansible
python
def update_properties(self, properties, force=True): '\n \n ' if force: self.properties = dict(properties) if ('force' in self.properties): del self.properties['force'] else: for (key, value) in properties.items(): if (key not in self.properties)...
def nodelist(self): '\n define/load the nodelist and the properties each single node has\n ' if ('downstream_mbps_wan' not in self.properties): self.properties['downstream_mbps_wan'] = 0 if ('downstream_mbps_ff' not in self.properties): self.properties['downstream_mbps_ff'] = 0...
3,570,031,973,661,641,000
define/load the nodelist and the properties each single node has
roles/ffbsee-robin-exporter/files/robin_prometheus.py
nodelist
ffbsee/ffbsee-ansible
python
def nodelist(self): '\n \n ' if ('downstream_mbps_wan' not in self.properties): self.properties['downstream_mbps_wan'] = 0 if ('downstream_mbps_ff' not in self.properties): self.properties['downstream_mbps_ff'] = 0 obj = {'id': re.sub('[:]', , self.mac), 'status': {'online'...
def test_mytest(): "\n When Dr. Tarplee run's py.test on the assignment this py file will run and insert my entry into the grade book.\n\n " me = 'Aaron Harkrider,19\n' path = 'Trojan_Horse_Lab/home/kmtarplee2/grades.csv' complete = True with open(path, 'r') as reading_grades: if (me n...
8,213,622,881,662,345,000
When Dr. Tarplee run's py.test on the assignment this py file will run and insert my entry into the grade book.
Trojan_Horse_Lab/awharkrider_test.py
test_mytest
awharkrider/CPSC_3320_Cybersecurity_Lab
python
def test_mytest(): "\n \n\n " me = 'Aaron Harkrider,19\n' path = 'Trojan_Horse_Lab/home/kmtarplee2/grades.csv' complete = True with open(path, 'r') as reading_grades: if (me not in reading_grades.read()): complete = False if (not complete): with open(path, 'a+')...
@pytest.mark.parametrize(('cls', 'data'), test_data) def test_constructor(cls, data): 'Check object is constructed properly.' do_constructor_test(cls, data)
-5,567,582,254,893,325,000
Check object is constructed properly.
tests/test_list.py
test_constructor
bluecheetah/pybind11_generics_tests
python
@pytest.mark.parametrize(('cls', 'data'), test_data) def test_constructor(cls, data): do_constructor_test(cls, data)
@pytest.mark.parametrize(('cls', 'err', 'data'), fail_data) def test_error(cls, err, data): 'Check object errors when input has wrong data type.' do_error_test(cls, err, data)
7,260,642,509,675,521,000
Check object errors when input has wrong data type.
tests/test_list.py
test_error
bluecheetah/pybind11_generics_tests
python
@pytest.mark.parametrize(('cls', 'err', 'data'), fail_data) def test_error(cls, err, data): do_error_test(cls, err, data)
@pytest.mark.parametrize(('cls', 'type_str'), doc_data) def test_doc(cls, type_str): 'Check object has correct doc string.' do_doc_test(cls, type_str)
-3,132,498,427,762,837,000
Check object has correct doc string.
tests/test_list.py
test_doc
bluecheetah/pybind11_generics_tests
python
@pytest.mark.parametrize(('cls', 'type_str'), doc_data) def test_doc(cls, type_str): do_doc_test(cls, type_str)
def test_inheritance(): 'Test inheritance behavior.' vec1 = [1, 2, 3, 4] vec2 = [5, 6, 7] obj = ChildList(vec1, vec2) assert (obj.get_data() == vec2) assert (obj.get_data_base() == vec1) assert (get_list(obj) == vec1) holder = ListHolder(obj) obj_ref = holder.get_obj_ref() obj_pt...
-819,040,092,586,877,000
Test inheritance behavior.
tests/test_list.py
test_inheritance
bluecheetah/pybind11_generics_tests
python
def test_inheritance(): vec1 = [1, 2, 3, 4] vec2 = [5, 6, 7] obj = ChildList(vec1, vec2) assert (obj.get_data() == vec2) assert (obj.get_data_base() == vec1) assert (get_list(obj) == vec1) holder = ListHolder(obj) obj_ref = holder.get_obj_ref() obj_ptr = holder.get_obj_ptr() ...
def test_virtual(): 'Test overriding virtual methods from python.' prime = Animal('Prime') dog = Dog('Doggo') lily = Husky('Lily') assert (prime.go(1) == '') assert (lily.go(2) == 'woof woof ') assert (prime.command(2) == 'Prime: ') assert (lily.command(3) == 'Lily: woof woof woof ') ...
-3,570,542,796,772,994,000
Test overriding virtual methods from python.
tests/test_list.py
test_virtual
bluecheetah/pybind11_generics_tests
python
def test_virtual(): prime = Animal('Prime') dog = Dog('Doggo') lily = Husky('Lily') assert (prime.go(1) == ) assert (lily.go(2) == 'woof woof ') assert (prime.command(2) == 'Prime: ') assert (lily.command(3) == 'Lily: woof woof woof ') with pytest.raises(NotImplementedError): ...
def getOwnProcessMemoryUsage(): 'Memory usage of own process in bytes.' if isWin32Windows(): import ctypes.wintypes class PROCESS_MEMORY_COUNTERS_EX(ctypes.Structure): _fields_ = [('cb', ctypes.wintypes.DWORD), ('PageFaultCount', ctypes.wintypes.DWORD), ('PeakWorkingSetSize', ctypes...
-7,523,994,337,364,238,000
Memory usage of own process in bytes.
nuitka/utils/MemoryUsage.py
getOwnProcessMemoryUsage
sthagen/Nuitka-Nuitka
python
def getOwnProcessMemoryUsage(): if isWin32Windows(): import ctypes.wintypes class PROCESS_MEMORY_COUNTERS_EX(ctypes.Structure): _fields_ = [('cb', ctypes.wintypes.DWORD), ('PageFaultCount', ctypes.wintypes.DWORD), ('PeakWorkingSetSize', ctypes.c_size_t), ('WorkingSetSize', ctypes.c...
def __init__(self, mat_type=(- 1), type_magnetization=0, Lmag=0.95, init_dict=None, init_str=None): 'Constructor of the class. Can be use in three ways :\n - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values\n for pyleecan type, -1 will call the default constructor\n ...
-8,390,208,800,719,323,000
Constructor of the class. Can be use in three ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for pyleecan type, -1 will call the default constructor - __init__ (init_dict = d) d must be a dictionary with property names as keys - __init__ (init_str = s) s must be a string s is t...
pyleecan/Classes/Magnet.py
__init__
mjfwest/pyleecan
python
def __init__(self, mat_type=(- 1), type_magnetization=0, Lmag=0.95, init_dict=None, init_str=None): 'Constructor of the class. Can be use in three ways :\n - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values\n for pyleecan type, -1 will call the default constructor\n ...
def __str__(self): 'Convert this object in a readeable string (for print)' Magnet_str = '' if (self.parent is None): Magnet_str += ('parent = None ' + linesep) else: Magnet_str += ((('parent = ' + str(type(self.parent))) + ' object') + linesep) if (self.mat_type is not None): ...
-7,885,808,530,900,830,000
Convert this object in a readeable string (for print)
pyleecan/Classes/Magnet.py
__str__
mjfwest/pyleecan
python
def __str__(self): Magnet_str = if (self.parent is None): Magnet_str += ('parent = None ' + linesep) else: Magnet_str += ((('parent = ' + str(type(self.parent))) + ' object') + linesep) if (self.mat_type is not None): tmp = self.mat_type.__str__().replace(linesep, (linesep ...
def __eq__(self, other): 'Compare two objects (skip parent)' if (type(other) != type(self)): return False if (other.mat_type != self.mat_type): return False if (other.type_magnetization != self.type_magnetization): return False if (other.Lmag != self.Lmag): return Fal...
-2,510,894,535,415,678,500
Compare two objects (skip parent)
pyleecan/Classes/Magnet.py
__eq__
mjfwest/pyleecan
python
def __eq__(self, other): if (type(other) != type(self)): return False if (other.mat_type != self.mat_type): return False if (other.type_magnetization != self.type_magnetization): return False if (other.Lmag != self.Lmag): return False return True
def compare(self, other, name='self', ignore_list=None): 'Compare two objects and return list of differences' if (ignore_list is None): ignore_list = list() if (type(other) != type(self)): return [(('type(' + name) + ')')] diff_list = list() if (((other.mat_type is None) and (self.ma...
-96,953,113,529,747,900
Compare two objects and return list of differences
pyleecan/Classes/Magnet.py
compare
mjfwest/pyleecan
python
def compare(self, other, name='self', ignore_list=None): if (ignore_list is None): ignore_list = list() if (type(other) != type(self)): return [(('type(' + name) + ')')] diff_list = list() if (((other.mat_type is None) and (self.mat_type is not None)) or ((other.mat_type is not None...
def __sizeof__(self): 'Return the size in memory of the object (including all subobject)' S = 0 S += getsizeof(self.mat_type) S += getsizeof(self.type_magnetization) S += getsizeof(self.Lmag) return S
-2,631,208,657,804,407,300
Return the size in memory of the object (including all subobject)
pyleecan/Classes/Magnet.py
__sizeof__
mjfwest/pyleecan
python
def __sizeof__(self): S = 0 S += getsizeof(self.mat_type) S += getsizeof(self.type_magnetization) S += getsizeof(self.Lmag) return S
def as_dict(self, **kwargs): '\n Convert this object in a json serializable dict (can be use in __init__).\n Optional keyword input parameter is for internal use only\n and may prevent json serializability.\n ' Magnet_dict = dict() if (self.mat_type is None): Magnet_dict[...
-822,414,935,667,717,000
Convert this object in a json serializable dict (can be use in __init__). Optional keyword input parameter is for internal use only and may prevent json serializability.
pyleecan/Classes/Magnet.py
as_dict
mjfwest/pyleecan
python
def as_dict(self, **kwargs): '\n Convert this object in a json serializable dict (can be use in __init__).\n Optional keyword input parameter is for internal use only\n and may prevent json serializability.\n ' Magnet_dict = dict() if (self.mat_type is None): Magnet_dict[...
def _set_None(self): 'Set all the properties to None (except pyleecan object)' if (self.mat_type is not None): self.mat_type._set_None() self.type_magnetization = None self.Lmag = None
3,608,660,313,894,750,700
Set all the properties to None (except pyleecan object)
pyleecan/Classes/Magnet.py
_set_None
mjfwest/pyleecan
python
def _set_None(self): if (self.mat_type is not None): self.mat_type._set_None() self.type_magnetization = None self.Lmag = None
def _get_mat_type(self): 'getter of mat_type' return self._mat_type
2,183,571,891,254,908,200
getter of mat_type
pyleecan/Classes/Magnet.py
_get_mat_type
mjfwest/pyleecan
python
def _get_mat_type(self): return self._mat_type
def _set_mat_type(self, value): 'setter of mat_type' if isinstance(value, str): value = load_init_dict(value)[1] if (isinstance(value, dict) and ('__class__' in value)): class_obj = import_class('pyleecan.Classes', value.get('__class__'), 'mat_type') value = class_obj(init_dict=value...
4,547,464,526,573,674,000
setter of mat_type
pyleecan/Classes/Magnet.py
_set_mat_type
mjfwest/pyleecan
python
def _set_mat_type(self, value): if isinstance(value, str): value = load_init_dict(value)[1] if (isinstance(value, dict) and ('__class__' in value)): class_obj = import_class('pyleecan.Classes', value.get('__class__'), 'mat_type') value = class_obj(init_dict=value) elif ((type(va...
def _get_type_magnetization(self): 'getter of type_magnetization' return self._type_magnetization
1,321,980,254,792,127,500
getter of type_magnetization
pyleecan/Classes/Magnet.py
_get_type_magnetization
mjfwest/pyleecan
python
def _get_type_magnetization(self): return self._type_magnetization
def _set_type_magnetization(self, value): 'setter of type_magnetization' check_var('type_magnetization', value, 'int', Vmin=0, Vmax=3) self._type_magnetization = value
1,873,314,925,272,558,000
setter of type_magnetization
pyleecan/Classes/Magnet.py
_set_type_magnetization
mjfwest/pyleecan
python
def _set_type_magnetization(self, value): check_var('type_magnetization', value, 'int', Vmin=0, Vmax=3) self._type_magnetization = value
def _get_Lmag(self): 'getter of Lmag' return self._Lmag
3,794,826,699,326,874,600
getter of Lmag
pyleecan/Classes/Magnet.py
_get_Lmag
mjfwest/pyleecan
python
def _get_Lmag(self): return self._Lmag
def _set_Lmag(self, value): 'setter of Lmag' check_var('Lmag', value, 'float', Vmin=0) self._Lmag = value
3,312,477,849,261,295,600
setter of Lmag
pyleecan/Classes/Magnet.py
_set_Lmag
mjfwest/pyleecan
python
def _set_Lmag(self, value): check_var('Lmag', value, 'float', Vmin=0) self._Lmag = value
def preprocess_cell(self, cell, resources, cell_index): '\n Apply a transformation on each code cell. See base.py for details.\n ' if (cell.cell_type != 'code'): return (cell, resources) outputs = self.run_cell(cell) cell.outputs = outputs if (not self.allow_errors): fo...
479,647,567,493,538,800
Apply a transformation on each code cell. See base.py for details.
env/lib/python2.7/site-packages/nbconvert/preprocessors/execute.py
preprocess_cell
wagnermarkd/stationary-hud
python
def preprocess_cell(self, cell, resources, cell_index): '\n \n ' if (cell.cell_type != 'code'): return (cell, resources) outputs = self.run_cell(cell) cell.outputs = outputs if (not self.allow_errors): for out in outputs: if (out.output_type == 'error'): ...
@execute_task @peer_required @api_request async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSChiaConnection) -> Optional[Message]: "\n A peer notifies us that they have added a new peak to their blockchain. If we don't have it,\n we can ask for it.\n " waiter_count = l...
-8,344,034,864,797,308,000
A peer notifies us that they have added a new peak to their blockchain. If we don't have it, we can ask for it.
chia/full_node/full_node_api.py
new_peak
AppleOfEnlightenment/chia-blockchain
python
@execute_task @peer_required @api_request async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSChiaConnection) -> Optional[Message]: "\n A peer notifies us that they have added a new peak to their blockchain. If we don't have it,\n we can ask for it.\n " waiter_count = l...
@peer_required @api_request async def new_transaction(self, transaction: full_node_protocol.NewTransaction, peer: ws.WSChiaConnection) -> Optional[Message]: "\n A peer notifies us of a new transaction.\n Requests a full transaction if we haven't seen it previously, and if the fees are enough.\n ...
-2,010,941,212,933,659,400
A peer notifies us of a new transaction. Requests a full transaction if we haven't seen it previously, and if the fees are enough.
chia/full_node/full_node_api.py
new_transaction
AppleOfEnlightenment/chia-blockchain
python
@peer_required @api_request async def new_transaction(self, transaction: full_node_protocol.NewTransaction, peer: ws.WSChiaConnection) -> Optional[Message]: "\n A peer notifies us of a new transaction.\n Requests a full transaction if we haven't seen it previously, and if the fees are enough.\n ...
@api_request @reply_type([ProtocolMessageTypes.respond_transaction]) async def request_transaction(self, request: full_node_protocol.RequestTransaction) -> Optional[Message]: 'Peer has requested a full transaction from us.' if self.full_node.sync_store.get_sync_mode(): return None spend_bundle = sel...
-5,092,523,849,763,150,000
Peer has requested a full transaction from us.
chia/full_node/full_node_api.py
request_transaction
AppleOfEnlightenment/chia-blockchain
python
@api_request @reply_type([ProtocolMessageTypes.respond_transaction]) async def request_transaction(self, request: full_node_protocol.RequestTransaction) -> Optional[Message]: if self.full_node.sync_store.get_sync_mode(): return None spend_bundle = self.full_node.mempool_manager.get_spendbundle(requ...
@peer_required @api_request @bytes_required async def respond_transaction(self, tx: full_node_protocol.RespondTransaction, peer: ws.WSChiaConnection, tx_bytes: bytes=b'', test: bool=False) -> Optional[Message]: '\n Receives a full transaction from peer.\n If tx is added to mempool, send tx_id to other...
1,532,958,289,492,728,600
Receives a full transaction from peer. If tx is added to mempool, send tx_id to others. (new_transaction)
chia/full_node/full_node_api.py
respond_transaction
AppleOfEnlightenment/chia-blockchain
python
@peer_required @api_request @bytes_required async def respond_transaction(self, tx: full_node_protocol.RespondTransaction, peer: ws.WSChiaConnection, tx_bytes: bytes=b, test: bool=False) -> Optional[Message]: '\n Receives a full transaction from peer.\n If tx is added to mempool, send tx_id to others....
@api_request @peer_required async def respond_block(self, respond_block: full_node_protocol.RespondBlock, peer: ws.WSChiaConnection) -> Optional[Message]: '\n Receive a full block from a peer full node (or ourselves).\n ' self.log.warning(f'Received unsolicited/late block from peer {peer.get_peer_...
4,048,487,825,627,302,000
Receive a full block from a peer full node (or ourselves).
chia/full_node/full_node_api.py
respond_block
AppleOfEnlightenment/chia-blockchain
python
@api_request @peer_required async def respond_block(self, respond_block: full_node_protocol.RespondBlock, peer: ws.WSChiaConnection) -> Optional[Message]: '\n \n ' self.log.warning(f'Received unsolicited/late block from peer {peer.get_peer_logging()}') return None
@api_request @peer_required async def declare_proof_of_space(self, request: farmer_protocol.DeclareProofOfSpace, peer: ws.WSChiaConnection) -> Optional[Message]: '\n Creates a block body and header, with the proof of space, coinbase, and fee targets provided\n by the farmer, and sends the hash of the ...
-8,531,630,444,906,639,000
Creates a block body and header, with the proof of space, coinbase, and fee targets provided by the farmer, and sends the hash of the header data back to the farmer.
chia/full_node/full_node_api.py
declare_proof_of_space
AppleOfEnlightenment/chia-blockchain
python
@api_request @peer_required async def declare_proof_of_space(self, request: farmer_protocol.DeclareProofOfSpace, peer: ws.WSChiaConnection) -> Optional[Message]: '\n Creates a block body and header, with the proof of space, coinbase, and fee targets provided\n by the farmer, and sends the hash of the ...
@api_request @peer_required async def signed_values(self, farmer_request: farmer_protocol.SignedValues, peer: ws.WSChiaConnection) -> Optional[Message]: '\n Signature of header hash, by the harvester. This is enough to create an unfinished\n block, which only needs a Proof of Time to be finished. If t...
-1,211,370,363,037,242,000
Signature of header hash, by the harvester. This is enough to create an unfinished block, which only needs a Proof of Time to be finished. If the signature is valid, we call the unfinished_block routine.
chia/full_node/full_node_api.py
signed_values
AppleOfEnlightenment/chia-blockchain
python
@api_request @peer_required async def signed_values(self, farmer_request: farmer_protocol.SignedValues, peer: ws.WSChiaConnection) -> Optional[Message]: '\n Signature of header hash, by the harvester. This is enough to create an unfinished\n block, which only needs a Proof of Time to be finished. If t...
@api_request async def request_ses_hashes(self, request: wallet_protocol.RequestSESInfo): 'Returns the start and end height of a sub-epoch for the height specified in request' ses_height = self.full_node.blockchain.get_ses_heights() start_height = request.start_height end_height = request.end_height ...
-5,567,190,610,942,839,000
Returns the start and end height of a sub-epoch for the height specified in request
chia/full_node/full_node_api.py
request_ses_hashes
AppleOfEnlightenment/chia-blockchain
python
@api_request async def request_ses_hashes(self, request: wallet_protocol.RequestSESInfo): ses_height = self.full_node.blockchain.get_ses_heights() start_height = request.start_height end_height = request.end_height ses_hash_heights = [] ses_reward_hashes = [] for (idx, ses_start_height) in ...
def init(empty=False): 'Initialize the platform with devices.' global DEVICES DEVICES = ([] if empty else [MockToggleDevice('AC', STATE_ON), MockToggleDevice('AC', STATE_OFF), MockToggleDevice(None, STATE_OFF)])
-2,477,909,103,883,586,000
Initialize the platform with devices.
tests/testing_config/custom_components/switch/test.py
init
DevRGT/home-assistant
python
def init(empty=False): global DEVICES DEVICES = ([] if empty else [MockToggleDevice('AC', STATE_ON), MockToggleDevice('AC', STATE_OFF), MockToggleDevice(None, STATE_OFF)])
async def async_setup_platform(hass, config, async_add_devices_callback, discovery_info=None): 'Find and return test switches.' async_add_devices_callback(DEVICES)
-690,868,948,060,746,100
Find and return test switches.
tests/testing_config/custom_components/switch/test.py
async_setup_platform
DevRGT/home-assistant
python
async def async_setup_platform(hass, config, async_add_devices_callback, discovery_info=None): async_add_devices_callback(DEVICES)
def __init__(self, title=None, first_name=None, other_names=None, last_name=None): 'Name2 - a model defined in OpenAPI' self._title = None self._first_name = None self._other_names = None self._last_name = None self.discriminator = None if (title is not None): self.title = title ...
-8,844,696,543,339,215,000
Name2 - a model defined in OpenAPI
velo_payments/models/name2.py
__init__
velopaymentsapi/velo-python
python
def __init__(self, title=None, first_name=None, other_names=None, last_name=None): self._title = None self._first_name = None self._other_names = None self._last_name = None self.discriminator = None if (title is not None): self.title = title if (first_name is not None): ...
@property def title(self): 'Gets the title of this Name2. # noqa: E501\n\n\n :return: The title of this Name2. # noqa: E501\n :rtype: str\n ' return self._title
333,266,289,626,321,800
Gets the title of this Name2. # noqa: E501 :return: The title of this Name2. # noqa: E501 :rtype: str
velo_payments/models/name2.py
title
velopaymentsapi/velo-python
python
@property def title(self): 'Gets the title of this Name2. # noqa: E501\n\n\n :return: The title of this Name2. # noqa: E501\n :rtype: str\n ' return self._title
@title.setter def title(self, title): 'Sets the title of this Name2.\n\n\n :param title: The title of this Name2. # noqa: E501\n :type: str\n ' if ((title is not None) and (len(title) > 10)): raise ValueError('Invalid value for `title`, length must be less than or equal to `10`') ...
-7,108,323,074,611,974,000
Sets the title of this Name2. :param title: The title of this Name2. # noqa: E501 :type: str
velo_payments/models/name2.py
title
velopaymentsapi/velo-python
python
@title.setter def title(self, title): 'Sets the title of this Name2.\n\n\n :param title: The title of this Name2. # noqa: E501\n :type: str\n ' if ((title is not None) and (len(title) > 10)): raise ValueError('Invalid value for `title`, length must be less than or equal to `10`') ...
@property def first_name(self): 'Gets the first_name of this Name2. # noqa: E501\n\n\n :return: The first_name of this Name2. # noqa: E501\n :rtype: str\n ' return self._first_name
6,137,112,359,837,039,000
Gets the first_name of this Name2. # noqa: E501 :return: The first_name of this Name2. # noqa: E501 :rtype: str
velo_payments/models/name2.py
first_name
velopaymentsapi/velo-python
python
@property def first_name(self): 'Gets the first_name of this Name2. # noqa: E501\n\n\n :return: The first_name of this Name2. # noqa: E501\n :rtype: str\n ' return self._first_name
@first_name.setter def first_name(self, first_name): 'Sets the first_name of this Name2.\n\n\n :param first_name: The first_name of this Name2. # noqa: E501\n :type: str\n ' if ((first_name is not None) and (len(first_name) > 40)): raise ValueError('Invalid value for `first_name`, ...
4,208,640,053,617,927,700
Sets the first_name of this Name2. :param first_name: The first_name of this Name2. # noqa: E501 :type: str
velo_payments/models/name2.py
first_name
velopaymentsapi/velo-python
python
@first_name.setter def first_name(self, first_name): 'Sets the first_name of this Name2.\n\n\n :param first_name: The first_name of this Name2. # noqa: E501\n :type: str\n ' if ((first_name is not None) and (len(first_name) > 40)): raise ValueError('Invalid value for `first_name`, ...
@property def other_names(self): 'Gets the other_names of this Name2. # noqa: E501\n\n\n :return: The other_names of this Name2. # noqa: E501\n :rtype: str\n ' return self._other_names
-1,837,420,641,573,318,400
Gets the other_names of this Name2. # noqa: E501 :return: The other_names of this Name2. # noqa: E501 :rtype: str
velo_payments/models/name2.py
other_names
velopaymentsapi/velo-python
python
@property def other_names(self): 'Gets the other_names of this Name2. # noqa: E501\n\n\n :return: The other_names of this Name2. # noqa: E501\n :rtype: str\n ' return self._other_names
@other_names.setter def other_names(self, other_names): 'Sets the other_names of this Name2.\n\n\n :param other_names: The other_names of this Name2. # noqa: E501\n :type: str\n ' if ((other_names is not None) and (len(other_names) > 40)): raise ValueError('Invalid value for `other...
1,413,021,188,074,489,000
Sets the other_names of this Name2. :param other_names: The other_names of this Name2. # noqa: E501 :type: str
velo_payments/models/name2.py
other_names
velopaymentsapi/velo-python
python
@other_names.setter def other_names(self, other_names): 'Sets the other_names of this Name2.\n\n\n :param other_names: The other_names of this Name2. # noqa: E501\n :type: str\n ' if ((other_names is not None) and (len(other_names) > 40)): raise ValueError('Invalid value for `other...
@property def last_name(self): 'Gets the last_name of this Name2. # noqa: E501\n\n\n :return: The last_name of this Name2. # noqa: E501\n :rtype: str\n ' return self._last_name
6,837,372,023,683,964,000
Gets the last_name of this Name2. # noqa: E501 :return: The last_name of this Name2. # noqa: E501 :rtype: str
velo_payments/models/name2.py
last_name
velopaymentsapi/velo-python
python
@property def last_name(self): 'Gets the last_name of this Name2. # noqa: E501\n\n\n :return: The last_name of this Name2. # noqa: E501\n :rtype: str\n ' return self._last_name
@last_name.setter def last_name(self, last_name): 'Sets the last_name of this Name2.\n\n\n :param last_name: The last_name of this Name2. # noqa: E501\n :type: str\n ' if ((last_name is not None) and (len(last_name) > 40)): raise ValueError('Invalid value for `last_name`, length mu...
7,584,318,513,949,805,000
Sets the last_name of this Name2. :param last_name: The last_name of this Name2. # noqa: E501 :type: str
velo_payments/models/name2.py
last_name
velopaymentsapi/velo-python
python
@last_name.setter def last_name(self, last_name): 'Sets the last_name of this Name2.\n\n\n :param last_name: The last_name of this Name2. # noqa: E501\n :type: str\n ' if ((last_name is not None) and (len(last_name) > 40)): raise ValueError('Invalid value for `last_name`, length mu...
def to_dict(self): 'Returns the model properties as a dict' result = {} for (attr, _) in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) e...
8,442,519,487,048,767,000
Returns the model properties as a dict
velo_payments/models/name2.py
to_dict
velopaymentsapi/velo-python
python
def to_dict(self): result = {} for (attr, _) in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) elif hasattr(value, 'to_dict'): ...
def to_str(self): 'Returns the string representation of the model' return pprint.pformat(self.to_dict())
5,849,158,643,760,736,000
Returns the string representation of the model
velo_payments/models/name2.py
to_str
velopaymentsapi/velo-python
python
def to_str(self): return pprint.pformat(self.to_dict())
def __repr__(self): 'For `print` and `pprint`' return self.to_str()
-8,960,031,694,814,905,000
For `print` and `pprint`
velo_payments/models/name2.py
__repr__
velopaymentsapi/velo-python
python
def __repr__(self): return self.to_str()
def __eq__(self, other): 'Returns true if both objects are equal' if (not isinstance(other, Name2)): return False return (self.__dict__ == other.__dict__)
5,736,994,555,762,344,000
Returns true if both objects are equal
velo_payments/models/name2.py
__eq__
velopaymentsapi/velo-python
python
def __eq__(self, other): if (not isinstance(other, Name2)): return False return (self.__dict__ == other.__dict__)
def __ne__(self, other): 'Returns true if both objects are not equal' return (not (self == other))
7,764,124,047,908,058,000
Returns true if both objects are not equal
velo_payments/models/name2.py
__ne__
velopaymentsapi/velo-python
python
def __ne__(self, other): return (not (self == other))
def convert(self): 'Perform the conversion from datapackage to destination format\n ' handle = self._header() logger.debug(self.default_values) for (name, df) in self.package.items(): logger.debug(name) if df.empty: columns = [x['name'] for x in df._metadata['schema'][...
5,956,221,640,661,579,000
Perform the conversion from datapackage to destination format
src/otoole/preprocess/narrow_to_datafile.py
convert
chrwm/otoole
python
def convert(self): '\n ' handle = self._header() logger.debug(self.default_values) for (name, df) in self.package.items(): logger.debug(name) if df.empty: columns = [x['name'] for x in df._metadata['schema']['fields']] df = pd.DataFrame(columns=columns) ...
@abstractmethod def _write_parameter(self, df: pd.DataFrame, parameter_name: str, handle: TextIO, default: float) -> pd.DataFrame: 'Write parameter data' raise NotImplementedError()
1,703,931,284,228,020,700
Write parameter data
src/otoole/preprocess/narrow_to_datafile.py
_write_parameter
chrwm/otoole
python
@abstractmethod def _write_parameter(self, df: pd.DataFrame, parameter_name: str, handle: TextIO, default: float) -> pd.DataFrame: raise NotImplementedError()
@abstractmethod def _write_set(self, df: pd.DataFrame, set_name, handle: TextIO) -> pd.DataFrame: 'Write set data' raise NotImplementedError()
5,731,673,263,464,903,000
Write set data
src/otoole/preprocess/narrow_to_datafile.py
_write_set
chrwm/otoole
python
@abstractmethod def _write_set(self, df: pd.DataFrame, set_name, handle: TextIO) -> pd.DataFrame: raise NotImplementedError()
def _write_parameter(self, df: pd.DataFrame, parameter_name: str, handle: TextIO, default: float): 'Write parameter data to a csv file, omitting data which matches the default value\n\n Arguments\n ---------\n filepath : StreamIO\n df : pandas.DataFrame\n parameter_name : str\n ...
3,071,068,969,233,579,500
Write parameter data to a csv file, omitting data which matches the default value Arguments --------- filepath : StreamIO df : pandas.DataFrame parameter_name : str handle: TextIO default : int
src/otoole/preprocess/narrow_to_datafile.py
_write_parameter
chrwm/otoole
python
def _write_parameter(self, df: pd.DataFrame, parameter_name: str, handle: TextIO, default: float): 'Write parameter data to a csv file, omitting data which matches the default value\n\n Arguments\n ---------\n filepath : StreamIO\n df : pandas.DataFrame\n parameter_name : str\n ...
def _write_set(self, df: pd.DataFrame, set_name, handle: TextIO): '\n\n Arguments\n ---------\n df : pandas.DataFrame\n set_name : str\n handle: TextIO\n ' handle.write('set {} :=\n'.format(set_name)) df.to_csv(path_or_buf=handle, sep=' ', header=False, index=False)...
3,455,871,895,498,749,000
Arguments --------- df : pandas.DataFrame set_name : str handle: TextIO
src/otoole/preprocess/narrow_to_datafile.py
_write_set
chrwm/otoole
python
def _write_set(self, df: pd.DataFrame, set_name, handle: TextIO): '\n\n Arguments\n ---------\n df : pandas.DataFrame\n set_name : str\n handle: TextIO\n ' handle.write('set {} :=\n'.format(set_name)) df.to_csv(path_or_buf=handle, sep=' ', header=False, index=False)...
def _form_parameter(self, df: pd.DataFrame, parameter_name: str, default: float) -> pd.DataFrame: 'Converts data into wide format\n\n Arguments\n ---------\n df: pd.DataFrame\n parameter_name: str\n default: float\n\n Returns\n -------\n pandas.DataFrame\n ...
-7,803,264,701,268,087,000
Converts data into wide format Arguments --------- df: pd.DataFrame parameter_name: str default: float Returns ------- pandas.DataFrame
src/otoole/preprocess/narrow_to_datafile.py
_form_parameter
chrwm/otoole
python
def _form_parameter(self, df: pd.DataFrame, parameter_name: str, default: float) -> pd.DataFrame: 'Converts data into wide format\n\n Arguments\n ---------\n df: pd.DataFrame\n parameter_name: str\n default: float\n\n Returns\n -------\n pandas.DataFrame\n ...
def RunGit(args, **kwargs): 'Returns stdout.' return RunCommand((['git'] + args), **kwargs)
-5,287,102,442,574,532,000
Returns stdout.
git_cl.py
RunGit
wuyong2k/chromium_depot_tool
python
def RunGit(args, **kwargs): return RunCommand((['git'] + args), **kwargs)
def RunGitWithCode(args, suppress_stderr=False): 'Returns return code and stdout.' try: if suppress_stderr: stderr = subprocess2.VOID else: stderr = sys.stderr (out, code) = subprocess2.communicate((['git'] + args), env=GetNoGitPagerEnv(), stdout=subprocess2.PIPE,...
7,143,899,178,419,619,000
Returns return code and stdout.
git_cl.py
RunGitWithCode
wuyong2k/chromium_depot_tool
python
def RunGitWithCode(args, suppress_stderr=False): try: if suppress_stderr: stderr = subprocess2.VOID else: stderr = sys.stderr (out, code) = subprocess2.communicate((['git'] + args), env=GetNoGitPagerEnv(), stdout=subprocess2.PIPE, stderr=stderr) return (c...
def RunGitSilent(args): 'Returns stdout, suppresses stderr and ignores the return code.' return RunGitWithCode(args, suppress_stderr=True)[1]
-1,088,870,218,897,835,300
Returns stdout, suppresses stderr and ignores the return code.
git_cl.py
RunGitSilent
wuyong2k/chromium_depot_tool
python
def RunGitSilent(args): return RunGitWithCode(args, suppress_stderr=True)[1]
def BranchExists(branch): 'Return True if specified branch exists.' (code, _) = RunGitWithCode(['rev-parse', '--verify', branch], suppress_stderr=True) return (not code)
-5,487,771,598,012,838,000
Return True if specified branch exists.
git_cl.py
BranchExists
wuyong2k/chromium_depot_tool
python
def BranchExists(branch): (code, _) = RunGitWithCode(['rev-parse', '--verify', branch], suppress_stderr=True) return (not code)
def _prefix_master(master): "Convert user-specified master name to full master name.\n\n Buildbucket uses full master name(master.tryserver.chromium.linux) as bucket\n name, while the developers always use shortened master name\n (tryserver.chromium.linux) by stripping off the prefix 'master.'. This\n function ...
-8,604,759,538,425,906,000
Convert user-specified master name to full master name. Buildbucket uses full master name(master.tryserver.chromium.linux) as bucket name, while the developers always use shortened master name (tryserver.chromium.linux) by stripping off the prefix 'master.'. This function does the conversion for buildbucket migration.
git_cl.py
_prefix_master
wuyong2k/chromium_depot_tool
python
def _prefix_master(master): "Convert user-specified master name to full master name.\n\n Buildbucket uses full master name(master.tryserver.chromium.linux) as bucket\n name, while the developers always use shortened master name\n (tryserver.chromium.linux) by stripping off the prefix 'master.'. This\n function ...
def _buildbucket_retry(operation_name, http, *args, **kwargs): 'Retries requests to buildbucket service and returns parsed json content.' try_count = 0 while True: (response, content) = http.request(*args, **kwargs) try: content_json = json.loads(content) except ValueErro...
4,700,090,738,834,549,000
Retries requests to buildbucket service and returns parsed json content.
git_cl.py
_buildbucket_retry
wuyong2k/chromium_depot_tool
python
def _buildbucket_retry(operation_name, http, *args, **kwargs): try_count = 0 while True: (response, content) = http.request(*args, **kwargs) try: content_json = json.loads(content) except ValueError: content_json = None if (content_json and content_js...
def trigger_luci_job(changelist, masters, options): 'Send a job to run on LUCI.' issue_props = changelist.GetIssueProperties() issue = changelist.GetIssue() patchset = changelist.GetMostRecentPatchset() for builders_and_tests in sorted(masters.itervalues()): for builder in sorted(builders_an...
-6,207,832,785,841,236,000
Send a job to run on LUCI.
git_cl.py
trigger_luci_job
wuyong2k/chromium_depot_tool
python
def trigger_luci_job(changelist, masters, options): issue_props = changelist.GetIssueProperties() issue = changelist.GetIssue() patchset = changelist.GetMostRecentPatchset() for builders_and_tests in sorted(masters.itervalues()): for builder in sorted(builders_and_tests): luci_t...
def fetch_try_jobs(auth_config, changelist, options): 'Fetches tryjobs from buildbucket.\n\n Returns a map from build id to build info as json dictionary.\n ' rietveld_url = settings.GetDefaultServerUrl() rietveld_host = urlparse.urlparse(rietveld_url).hostname authenticator = auth.get_authenticator_f...
-8,651,788,814,486,410,000
Fetches tryjobs from buildbucket. Returns a map from build id to build info as json dictionary.
git_cl.py
fetch_try_jobs
wuyong2k/chromium_depot_tool
python
def fetch_try_jobs(auth_config, changelist, options): 'Fetches tryjobs from buildbucket.\n\n Returns a map from build id to build info as json dictionary.\n ' rietveld_url = settings.GetDefaultServerUrl() rietveld_host = urlparse.urlparse(rietveld_url).hostname authenticator = auth.get_authenticator_f...
def print_tryjobs(options, builds): 'Prints nicely result of fetch_try_jobs.' if (not builds): print('No tryjobs scheduled') return builds = builds.copy() builder_names_cache = {} def get_builder(b): try: return builder_names_cache[b['id']] except KeyErro...
3,467,436,648,795,702,000
Prints nicely result of fetch_try_jobs.
git_cl.py
print_tryjobs
wuyong2k/chromium_depot_tool
python
def print_tryjobs(options, builds): if (not builds): print('No tryjobs scheduled') return builds = builds.copy() builder_names_cache = {} def get_builder(b): try: return builder_names_cache[b['id']] except KeyError: try: param...
def MatchSvnGlob(url, base_url, glob_spec, allow_wildcards): 'Return the corresponding git ref if |base_url| together with |glob_spec|\n matches the full |url|.\n\n If |allow_wildcards| is true, |glob_spec| can contain wildcards (see below).\n ' (fetch_suburl, as_ref) = glob_spec.split(':') if allow_wild...
-7,813,583,685,021,503,000
Return the corresponding git ref if |base_url| together with |glob_spec| matches the full |url|. If |allow_wildcards| is true, |glob_spec| can contain wildcards (see below).
git_cl.py
MatchSvnGlob
wuyong2k/chromium_depot_tool
python
def MatchSvnGlob(url, base_url, glob_spec, allow_wildcards): 'Return the corresponding git ref if |base_url| together with |glob_spec|\n matches the full |url|.\n\n If |allow_wildcards| is true, |glob_spec| can contain wildcards (see below).\n ' (fetch_suburl, as_ref) = glob_spec.split(':') if allow_wild...
def print_stats(similarity, find_copies, args): 'Prints statistics about the change to the user.' env = GetNoGitPagerEnv() if ('GIT_EXTERNAL_DIFF' in env): del env['GIT_EXTERNAL_DIFF'] if find_copies: similarity_options = ['--find-copies-harder', '-l100000', ('-C%s' % similarity)] el...
-2,500,755,617,917,667,300
Prints statistics about the change to the user.
git_cl.py
print_stats
wuyong2k/chromium_depot_tool
python
def print_stats(similarity, find_copies, args): env = GetNoGitPagerEnv() if ('GIT_EXTERNAL_DIFF' in env): del env['GIT_EXTERNAL_DIFF'] if find_copies: similarity_options = ['--find-copies-harder', '-l100000', ('-C%s' % similarity)] else: similarity_options = [('-M%s' % simil...
def ShortBranchName(branch): "Convert a name like 'refs/heads/foo' to just 'foo'." return branch.replace('refs/heads/', '', 1)
1,362,601,367,376,277,200
Convert a name like 'refs/heads/foo' to just 'foo'.
git_cl.py
ShortBranchName
wuyong2k/chromium_depot_tool
python
def ShortBranchName(branch): return branch.replace('refs/heads/', , 1)
def GetCurrentBranchRef(): 'Returns branch ref (e.g., refs/heads/master) or None.' return (RunGit(['symbolic-ref', 'HEAD'], stderr=subprocess2.VOID, error_ok=True).strip() or None)
-5,729,977,296,304,144,000
Returns branch ref (e.g., refs/heads/master) or None.
git_cl.py
GetCurrentBranchRef
wuyong2k/chromium_depot_tool
python
def GetCurrentBranchRef(): return (RunGit(['symbolic-ref', 'HEAD'], stderr=subprocess2.VOID, error_ok=True).strip() or None)
def GetCurrentBranch(): 'Returns current branch or None.\n\n For refs/heads/* branches, returns just last part. For others, full ref.\n ' branchref = GetCurrentBranchRef() if branchref: return ShortBranchName(branchref) return None
2,375,936,194,256,374,300
Returns current branch or None. For refs/heads/* branches, returns just last part. For others, full ref.
git_cl.py
GetCurrentBranch
wuyong2k/chromium_depot_tool
python
def GetCurrentBranch(): 'Returns current branch or None.\n\n For refs/heads/* branches, returns just last part. For others, full ref.\n ' branchref = GetCurrentBranchRef() if branchref: return ShortBranchName(branchref) return None
def ParseIssueNumberArgument(arg): 'Parses the issue argument and returns _ParsedIssueNumberArgument.' fail_result = _ParsedIssueNumberArgument() if arg.isdigit(): return _ParsedIssueNumberArgument(issue=int(arg)) if (not arg.startswith('http')): return fail_result url = gclient_util...
1,000,651,171,004,019,700
Parses the issue argument and returns _ParsedIssueNumberArgument.
git_cl.py
ParseIssueNumberArgument
wuyong2k/chromium_depot_tool
python
def ParseIssueNumberArgument(arg): fail_result = _ParsedIssueNumberArgument() if arg.isdigit(): return _ParsedIssueNumberArgument(issue=int(arg)) if (not arg.startswith('http')): return fail_result url = gclient_utils.UpgradeToHttps(arg) try: parsed_url = urlparse.urlpar...
def _add_codereview_select_options(parser): 'Appends --gerrit and --rietveld options to force specific codereview.' parser.codereview_group = optparse.OptionGroup(parser, 'EXPERIMENTAL! Codereview override options') parser.add_option_group(parser.codereview_group) parser.codereview_group.add_option('--g...
-8,934,478,034,858,730,000
Appends --gerrit and --rietveld options to force specific codereview.
git_cl.py
_add_codereview_select_options
wuyong2k/chromium_depot_tool
python
def _add_codereview_select_options(parser): parser.codereview_group = optparse.OptionGroup(parser, 'EXPERIMENTAL! Codereview override options') parser.add_option_group(parser.codereview_group) parser.codereview_group.add_option('--gerrit', action='store_true', help='Force the use of Gerrit for coderevi...
def get_approving_reviewers(props): 'Retrieves the reviewers that approved a CL from the issue properties with\n messages.\n\n Note that the list may contain reviewers that are not committer, thus are not\n considered by the CQ.\n ' return sorted(set((message['sender'] for message in props['messages'] if (m...
8,787,014,851,502,826,000
Retrieves the reviewers that approved a CL from the issue properties with messages. Note that the list may contain reviewers that are not committer, thus are not considered by the CQ.
git_cl.py
get_approving_reviewers
wuyong2k/chromium_depot_tool
python
def get_approving_reviewers(props): 'Retrieves the reviewers that approved a CL from the issue properties with\n messages.\n\n Note that the list may contain reviewers that are not committer, thus are not\n considered by the CQ.\n ' return sorted(set((message['sender'] for message in props['messages'] if (m...
def FindCodereviewSettingsFile(filename='codereview.settings'): "Finds the given file starting in the cwd and going up.\n\n Only looks up to the top of the repository unless an\n 'inherit-review-settings-ok' file exists in the root of the repository.\n " inherit_ok_file = 'inherit-review-settings-ok' cwd...
4,084,806,995,077,205,500
Finds the given file starting in the cwd and going up. Only looks up to the top of the repository unless an 'inherit-review-settings-ok' file exists in the root of the repository.
git_cl.py
FindCodereviewSettingsFile
wuyong2k/chromium_depot_tool
python
def FindCodereviewSettingsFile(filename='codereview.settings'): "Finds the given file starting in the cwd and going up.\n\n Only looks up to the top of the repository unless an\n 'inherit-review-settings-ok' file exists in the root of the repository.\n " inherit_ok_file = 'inherit-review-settings-ok' cwd...
def LoadCodereviewSettingsFromFile(fileobj): 'Parse a codereview.settings file and updates hooks.' keyvals = gclient_utils.ParseCodereviewSettingsContent(fileobj.read()) def SetProperty(name, setting, unset_error_ok=False): fullname = ('rietveld.' + name) if (setting in keyvals): ...
-4,062,880,140,684,171,000
Parse a codereview.settings file and updates hooks.
git_cl.py
LoadCodereviewSettingsFromFile
wuyong2k/chromium_depot_tool
python
def LoadCodereviewSettingsFromFile(fileobj): keyvals = gclient_utils.ParseCodereviewSettingsContent(fileobj.read()) def SetProperty(name, setting, unset_error_ok=False): fullname = ('rietveld.' + name) if (setting in keyvals): RunGit(['config', fullname, keyvals[setting]]) ...
def urlretrieve(source, destination): "urllib is broken for SSL connections via a proxy therefore we\n can't use urllib.urlretrieve()." with open(destination, 'w') as f: f.write(urllib2.urlopen(source).read())
-8,312,412,582,893,265,000
urllib is broken for SSL connections via a proxy therefore we can't use urllib.urlretrieve().
git_cl.py
urlretrieve
wuyong2k/chromium_depot_tool
python
def urlretrieve(source, destination): "urllib is broken for SSL connections via a proxy therefore we\n can't use urllib.urlretrieve()." with open(destination, 'w') as f: f.write(urllib2.urlopen(source).read())
def hasSheBang(fname): 'Checks fname is a #! script.' with open(fname) as f: return f.read(2).startswith('#!')
-3,424,342,128,742,994,400
Checks fname is a #! script.
git_cl.py
hasSheBang
wuyong2k/chromium_depot_tool
python
def hasSheBang(fname): with open(fname) as f: return f.read(2).startswith('#!')
def DownloadGerritHook(force): 'Download and install Gerrit commit-msg hook.\n\n Args:\n force: True to update hooks. False to install hooks if not present.\n ' if (not settings.GetIsGerrit()): return src = 'https://gerrit-review.googlesource.com/tools/hooks/commit-msg' dst = os.path.join(s...
6,228,536,019,035,251,000
Download and install Gerrit commit-msg hook. Args: force: True to update hooks. False to install hooks if not present.
git_cl.py
DownloadGerritHook
wuyong2k/chromium_depot_tool
python
def DownloadGerritHook(force): 'Download and install Gerrit commit-msg hook.\n\n Args:\n force: True to update hooks. False to install hooks if not present.\n ' if (not settings.GetIsGerrit()): return src = 'https://gerrit-review.googlesource.com/tools/hooks/commit-msg' dst = os.path.join(s...
def GetRietveldCodereviewSettingsInteractively(): 'Prompt the user for settings.' server = settings.GetDefaultServerUrl(error_ok=True) prompt = 'Rietveld server (host[:port])' prompt += (' [%s]' % (server or DEFAULT_SERVER)) newserver = ask_for_data((prompt + ':')) if ((not server) and (not news...
3,663,493,880,168,690,700
Prompt the user for settings.
git_cl.py
GetRietveldCodereviewSettingsInteractively
wuyong2k/chromium_depot_tool
python
def GetRietveldCodereviewSettingsInteractively(): server = settings.GetDefaultServerUrl(error_ok=True) prompt = 'Rietveld server (host[:port])' prompt += (' [%s]' % (server or DEFAULT_SERVER)) newserver = ask_for_data((prompt + ':')) if ((not server) and (not newserver)): newserver = DE...
@subcommand.usage('[repo root containing codereview.settings]') def CMDconfig(parser, args): 'Edits configuration for this tree.' print('WARNING: git cl config works for Rietveld only.\nFor Gerrit, see http://crbug.com/603116.') parser.add_option('--activate-update', action='store_true', help='activate auto...
77,438,087,323,842,530
Edits configuration for this tree.
git_cl.py
CMDconfig
wuyong2k/chromium_depot_tool
python
@subcommand.usage('[repo root containing codereview.settings]') def CMDconfig(parser, args): print('WARNING: git cl config works for Rietveld only.\nFor Gerrit, see http://crbug.com/603116.') parser.add_option('--activate-update', action='store_true', help='activate auto-updating [rietveld] section in .git...
def CMDbaseurl(parser, args): 'Gets or sets base-url for this branch.' branchref = RunGit(['symbolic-ref', 'HEAD']).strip() branch = ShortBranchName(branchref) (_, args) = parser.parse_args(args) if (not args): print('Current base-url:') return RunGit(['config', ('branch.%s.base-url'...
-1,379,295,837,932,834,600
Gets or sets base-url for this branch.
git_cl.py
CMDbaseurl
wuyong2k/chromium_depot_tool
python
def CMDbaseurl(parser, args): branchref = RunGit(['symbolic-ref', 'HEAD']).strip() branch = ShortBranchName(branchref) (_, args) = parser.parse_args(args) if (not args): print('Current base-url:') return RunGit(['config', ('branch.%s.base-url' % branch)], error_ok=False).strip() ...
def color_for_status(status): 'Maps a Changelist status to color, for CMDstatus and other tools.' return {'unsent': Fore.RED, 'waiting': Fore.BLUE, 'reply': Fore.YELLOW, 'lgtm': Fore.GREEN, 'commit': Fore.MAGENTA, 'closed': Fore.CYAN, 'error': Fore.WHITE}.get(status, Fore.WHITE)
813,356,962,964,108,900
Maps a Changelist status to color, for CMDstatus and other tools.
git_cl.py
color_for_status
wuyong2k/chromium_depot_tool
python
def color_for_status(status): return {'unsent': Fore.RED, 'waiting': Fore.BLUE, 'reply': Fore.YELLOW, 'lgtm': Fore.GREEN, 'commit': Fore.MAGENTA, 'closed': Fore.CYAN, 'error': Fore.WHITE}.get(status, Fore.WHITE)
def get_cl_statuses(changes, fine_grained, max_processes=None): "Returns a blocking iterable of (cl, status) for given branches.\n\n If fine_grained is true, this will fetch CL statuses from the server.\n Otherwise, simply indicate if there's a matching url for the given branches.\n\n If max_processes is specifi...
5,757,548,687,413,044,000
Returns a blocking iterable of (cl, status) for given branches. If fine_grained is true, this will fetch CL statuses from the server. Otherwise, simply indicate if there's a matching url for the given branches. If max_processes is specified, it is used as the maximum number of processes to spawn to fetch CL status fr...
git_cl.py
get_cl_statuses
wuyong2k/chromium_depot_tool
python
def get_cl_statuses(changes, fine_grained, max_processes=None): "Returns a blocking iterable of (cl, status) for given branches.\n\n If fine_grained is true, this will fetch CL statuses from the server.\n Otherwise, simply indicate if there's a matching url for the given branches.\n\n If max_processes is specifi...
def upload_branch_deps(cl, args): 'Uploads CLs of local branches that are dependents of the current branch.\n\n If the local branch dependency tree looks like:\n test1 -> test2.1 -> test3.1\n -> test3.2\n -> test2.2 -> test3.3\n\n and you run "git cl upload --dependencies" from test1 the...
-9,003,330,700,420,991,000
Uploads CLs of local branches that are dependents of the current branch. If the local branch dependency tree looks like: test1 -> test2.1 -> test3.1 -> test3.2 -> test2.2 -> test3.3 and you run "git cl upload --dependencies" from test1 then "git cl upload" is run on the dependent branches in th...
git_cl.py
upload_branch_deps
wuyong2k/chromium_depot_tool
python
def upload_branch_deps(cl, args): 'Uploads CLs of local branches that are dependents of the current branch.\n\n If the local branch dependency tree looks like:\n test1 -> test2.1 -> test3.1\n -> test3.2\n -> test2.2 -> test3.3\n\n and you run "git cl upload --dependencies" from test1 the...
def CMDarchive(parser, args): 'Archives and deletes branches associated with closed changelists.' parser.add_option('-j', '--maxjobs', action='store', type=int, help='The maximum number of jobs to use when retrieving review status') parser.add_option('-f', '--force', action='store_true', help='Bypasses the ...
-6,254,498,161,913,117,000
Archives and deletes branches associated with closed changelists.
git_cl.py
CMDarchive
wuyong2k/chromium_depot_tool
python
def CMDarchive(parser, args): parser.add_option('-j', '--maxjobs', action='store', type=int, help='The maximum number of jobs to use when retrieving review status') parser.add_option('-f', '--force', action='store_true', help='Bypasses the confirmation prompt.') auth.add_auth_options(parser) (optio...
def CMDstatus(parser, args): "Show status of changelists.\n\n Colors are used to tell the state of the CL unless --fast is used:\n - Red not sent for review or broken\n - Blue waiting for review\n - Yellow waiting for you to reply to review\n - Green LGTM'ed\n - Magenta in the commit ...
7,393,758,512,050,732,000
Show status of changelists. Colors are used to tell the state of the CL unless --fast is used: - Red not sent for review or broken - Blue waiting for review - Yellow waiting for you to reply to review - Green LGTM'ed - Magenta in the commit queue - Cyan was committed, branch can be delet...
git_cl.py
CMDstatus
wuyong2k/chromium_depot_tool
python
def CMDstatus(parser, args): "Show status of changelists.\n\n Colors are used to tell the state of the CL unless --fast is used:\n - Red not sent for review or broken\n - Blue waiting for review\n - Yellow waiting for you to reply to review\n - Green LGTM'ed\n - Magenta in the commit ...
def colorize_CMDstatus_doc(): 'To be called once in main() to add colors to git cl status help.' colors = [i for i in dir(Fore) if i[0].isupper()] def colorize_line(line): for color in colors: if (color in line.upper()): indent = ((len(line) - len(line.lstrip(' '))) + 1)...
4,285,850,215,364,875,300
To be called once in main() to add colors to git cl status help.
git_cl.py
colorize_CMDstatus_doc
wuyong2k/chromium_depot_tool
python
def colorize_CMDstatus_doc(): colors = [i for i in dir(Fore) if i[0].isupper()] def colorize_line(line): for color in colors: if (color in line.upper()): indent = ((len(line) - len(line.lstrip(' '))) + 1) return (((line[:indent] + getattr(Fore, color)) +...
@subcommand.usage('[issue_number]') def CMDissue(parser, args): 'Sets or displays the current code review issue number.\n\n Pass issue number 0 to clear the current issue.\n ' parser.add_option('-r', '--reverse', action='store_true', help='Lookup the branch(es) for the specified issues. If no issues are speci...
-2,807,526,720,289,769,000
Sets or displays the current code review issue number. Pass issue number 0 to clear the current issue.
git_cl.py
CMDissue
wuyong2k/chromium_depot_tool
python
@subcommand.usage('[issue_number]') def CMDissue(parser, args): 'Sets or displays the current code review issue number.\n\n Pass issue number 0 to clear the current issue.\n ' parser.add_option('-r', '--reverse', action='store_true', help='Lookup the branch(es) for the specified issues. If no issues are speci...
def CMDcomments(parser, args): 'Shows or posts review comments for any changelist.' parser.add_option('-a', '--add-comment', dest='comment', help='comment to add to an issue') parser.add_option('-i', dest='issue', help='review issue id (defaults to current issue)') parser.add_option('-j', '--json-file',...
-7,667,378,544,018,240,000
Shows or posts review comments for any changelist.
git_cl.py
CMDcomments
wuyong2k/chromium_depot_tool
python
def CMDcomments(parser, args): parser.add_option('-a', '--add-comment', dest='comment', help='comment to add to an issue') parser.add_option('-i', dest='issue', help='review issue id (defaults to current issue)') parser.add_option('-j', '--json-file', help='File to write JSON summary to') auth.add_...
@subcommand.usage('[codereview url or issue id]') def CMDdescription(parser, args): "Brings up the editor for the current CL's description." parser.add_option('-d', '--display', action='store_true', help='Display the description instead of opening an editor') parser.add_option('-n', '--new-description', hel...
-3,280,009,347,181,202,400
Brings up the editor for the current CL's description.
git_cl.py
CMDdescription
wuyong2k/chromium_depot_tool
python
@subcommand.usage('[codereview url or issue id]') def CMDdescription(parser, args): parser.add_option('-d', '--display', action='store_true', help='Display the description instead of opening an editor') parser.add_option('-n', '--new-description', help='New description to set for this issue (- for stdin)')...
def CreateDescriptionFromLog(args): 'Pulls out the commit log to use as a base for the CL description.' log_args = [] if ((len(args) == 1) and (not args[0].endswith('.'))): log_args = [(args[0] + '..')] elif ((len(args) == 1) and args[0].endswith('...')): log_args = [args[0][:(- 1)]] ...
-1,814,644,899,593,277,200
Pulls out the commit log to use as a base for the CL description.
git_cl.py
CreateDescriptionFromLog
wuyong2k/chromium_depot_tool
python
def CreateDescriptionFromLog(args): log_args = [] if ((len(args) == 1) and (not args[0].endswith('.'))): log_args = [(args[0] + '..')] elif ((len(args) == 1) and args[0].endswith('...')): log_args = [args[0][:(- 1)]] elif (len(args) == 2): log_args = [((args[0] + '..') + arg...
def CMDlint(parser, args): 'Runs cpplint on the current changelist.' parser.add_option('--filter', action='append', metavar='-x,+y', help="Comma-separated list of cpplint's category-filters") auth.add_auth_options(parser) (options, args) = parser.parse_args(args) auth_config = auth.extract_auth_conf...
5,296,917,262,715,844,000
Runs cpplint on the current changelist.
git_cl.py
CMDlint
wuyong2k/chromium_depot_tool
python
def CMDlint(parser, args): parser.add_option('--filter', action='append', metavar='-x,+y', help="Comma-separated list of cpplint's category-filters") auth.add_auth_options(parser) (options, args) = parser.parse_args(args) auth_config = auth.extract_auth_config_from_options(options) try: ...
def CMDpresubmit(parser, args): 'Runs presubmit tests on the current changelist.' parser.add_option('-u', '--upload', action='store_true', help='Run upload hook instead of the push/dcommit hook') parser.add_option('-f', '--force', action='store_true', help='Run checks even if tree is dirty') auth.add_au...
-8,723,193,488,120,087,000
Runs presubmit tests on the current changelist.
git_cl.py
CMDpresubmit
wuyong2k/chromium_depot_tool
python
def CMDpresubmit(parser, args): parser.add_option('-u', '--upload', action='store_true', help='Run upload hook instead of the push/dcommit hook') parser.add_option('-f', '--force', action='store_true', help='Run checks even if tree is dirty') auth.add_auth_options(parser) (options, args) = parser.p...
def GenerateGerritChangeId(message): 'Returns Ixxxxxx...xxx change id.\n\n Works the same way as\n https://gerrit-review.googlesource.com/tools/hooks/commit-msg\n but can be called on demand on all platforms.\n\n The basic idea is to generate git hash of a state of the tree, original commit\n message, author/c...
1,807,800,228,276,951,000
Returns Ixxxxxx...xxx change id. Works the same way as https://gerrit-review.googlesource.com/tools/hooks/commit-msg but can be called on demand on all platforms. The basic idea is to generate git hash of a state of the tree, original commit message, author/committer info and timestamps.
git_cl.py
GenerateGerritChangeId
wuyong2k/chromium_depot_tool
python
def GenerateGerritChangeId(message): 'Returns Ixxxxxx...xxx change id.\n\n Works the same way as\n https://gerrit-review.googlesource.com/tools/hooks/commit-msg\n but can be called on demand on all platforms.\n\n The basic idea is to generate git hash of a state of the tree, original commit\n message, author/c...
def GetTargetRef(remote, remote_branch, target_branch, pending_prefix): 'Computes the remote branch ref to use for the CL.\n\n Args:\n remote (str): The git remote for the CL.\n remote_branch (str): The git remote branch for the CL.\n target_branch (str): The target branch specified by the user.\n pend...
-1,148,269,362,434,899,100
Computes the remote branch ref to use for the CL. Args: remote (str): The git remote for the CL. remote_branch (str): The git remote branch for the CL. target_branch (str): The target branch specified by the user. pending_prefix (str): The pending prefix from the settings.
git_cl.py
GetTargetRef
wuyong2k/chromium_depot_tool
python
def GetTargetRef(remote, remote_branch, target_branch, pending_prefix): 'Computes the remote branch ref to use for the CL.\n\n Args:\n remote (str): The git remote for the CL.\n remote_branch (str): The git remote branch for the CL.\n target_branch (str): The target branch specified by the user.\n pend...
def cleanup_list(l): 'Fixes a list so that comma separated items are put as individual items.\n\n So that "--reviewers joe@c,john@c --reviewers joa@c" results in\n options.reviewers == sorted([\'joe@c\', \'john@c\', \'joa@c\']).\n ' items = sum((i.split(',') for i in l), []) stripped_items = (i.strip() f...
2,816,913,004,485,716,500
Fixes a list so that comma separated items are put as individual items. So that "--reviewers joe@c,john@c --reviewers joa@c" results in options.reviewers == sorted(['joe@c', 'john@c', 'joa@c']).
git_cl.py
cleanup_list
wuyong2k/chromium_depot_tool
python
def cleanup_list(l): 'Fixes a list so that comma separated items are put as individual items.\n\n So that "--reviewers joe@c,john@c --reviewers joa@c" results in\n options.reviewers == sorted([\'joe@c\', \'john@c\', \'joa@c\']).\n ' items = sum((i.split(',') for i in l), []) stripped_items = (i.strip() f...
@subcommand.usage('[args to "git diff"]') def CMDupload(parser, args): 'Uploads the current changelist to codereview.\n\n Can skip dependency patchset uploads for a branch by running:\n git config branch.branch_name.skip-deps-uploads True\n To unset run:\n git config --unset branch.branch_name.skip-deps-upl...
-1,781,172,476,083,426,800
Uploads the current changelist to codereview. Can skip dependency patchset uploads for a branch by running: git config branch.branch_name.skip-deps-uploads True To unset run: git config --unset branch.branch_name.skip-deps-uploads Can also set the above globally by using the --global flag.
git_cl.py
CMDupload
wuyong2k/chromium_depot_tool
python
@subcommand.usage('[args to "git diff"]') def CMDupload(parser, args): 'Uploads the current changelist to codereview.\n\n Can skip dependency patchset uploads for a branch by running:\n git config branch.branch_name.skip-deps-uploads True\n To unset run:\n git config --unset branch.branch_name.skip-deps-upl...
def SendUpstream(parser, args, cmd): 'Common code for CMDland and CmdDCommit\n\n In case of Gerrit, uses Gerrit REST api to "submit" the issue, which pushes\n upstream and closes the issue automatically and atomically.\n\n Otherwise (in case of Rietveld):\n Squashes branch into a single commit.\n Updates c...
149,992,166,533,250,600
Common code for CMDland and CmdDCommit In case of Gerrit, uses Gerrit REST api to "submit" the issue, which pushes upstream and closes the issue automatically and atomically. Otherwise (in case of Rietveld): Squashes branch into a single commit. Updates changelog with metadata (e.g. pointer to review). Pushes/d...
git_cl.py
SendUpstream
wuyong2k/chromium_depot_tool
python
def SendUpstream(parser, args, cmd): 'Common code for CMDland and CmdDCommit\n\n In case of Gerrit, uses Gerrit REST api to "submit" the issue, which pushes\n upstream and closes the issue automatically and atomically.\n\n Otherwise (in case of Rietveld):\n Squashes branch into a single commit.\n Updates c...
def PushToGitPending(remote, pending_ref, upstream_ref): 'Fetches pending_ref, cherry-picks current HEAD on top of it, pushes.\n\n Returns:\n (retcode of last operation, output log of last operation).\n ' assert pending_ref.startswith('refs/'), pending_ref local_pending_ref = ('refs/git-cl/' + pending_...
6,304,055,351,849,430,000
Fetches pending_ref, cherry-picks current HEAD on top of it, pushes. Returns: (retcode of last operation, output log of last operation).
git_cl.py
PushToGitPending
wuyong2k/chromium_depot_tool
python
def PushToGitPending(remote, pending_ref, upstream_ref): 'Fetches pending_ref, cherry-picks current HEAD on top of it, pushes.\n\n Returns:\n (retcode of last operation, output log of last operation).\n ' assert pending_ref.startswith('refs/'), pending_ref local_pending_ref = ('refs/git-cl/' + pending_...
def IsFatalPushFailure(push_stdout): "True if retrying push won't help." return ('(prohibited by Gerrit)' in push_stdout)
908,085,907,017,846,900
True if retrying push won't help.
git_cl.py
IsFatalPushFailure
wuyong2k/chromium_depot_tool
python
def IsFatalPushFailure(push_stdout): return ('(prohibited by Gerrit)' in push_stdout)