uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c4fba01c678ffa081b5eddf5 | train | class | class RelationUnitsWatcherFacade(Type):
name = 'RelationUnitsWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*'... | class RelationUnitsWatcherFacade(Type):
| name = 'RelationUnitsWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | Returns -> typing.Union[typing.Sequence[~RelationLifeSuspendedStatusChange], _ForwardRef('Error'), str]
'''
# map input types to rpc msg
_params = dict()
msg = dict(type='RelationStatusWatcher',
request='Next',
version=1,
params=... | 159 | 159 | 531 | 7 | 151 | hpidcock/python-libjuju | juju/client/_client1.py | Python | RelationUnitsWatcherFacade | RelationUnitsWatcherFacade | 9,335 | 9,404 | 9,335 | 9,335 | 164273c281b06e18557c8fae48d617163b25e561 | bigcode/the-stack | train |
d9cce5069b4ed31e7c7a2961 | train | class | class AllWatcherFacade(Type):
name = 'AllWatcher'
version = 1
schema = {'definitions': {'AllWatcherNextResults': {'additionalProperties': False,
'properties': {'deltas': {'items': {'$ref': '#/definitions/Delta'},
... | class AllWatcherFacade(Type):
| name = 'AllWatcher'
version = 1
schema = {'definitions': {'AllWatcherNextResults': {'additionalProperties': False,
'properties': {'deltas': {'items': {'$ref': '#/definitions/Delta'},
'... | properties': {'UpdateToolsAvailable': {'type': 'object'}}, 'type': 'object'}
@ReturnMapping(None)
async def UpdateToolsAvailable(self):
'''
Returns -> None
'''
# map input types to rpc msg
_params = dict()
msg = dict(type='AgentTools',
r... | 103 | 103 | 345 | 6 | 96 | hpidcock/python-libjuju | juju/client/_client1.py | Python | AllWatcherFacade | AllWatcherFacade | 134 | 188 | 134 | 134 | 437310f0a96fa45e87ce9d463b6199ff4b3e9413 | bigcode/the-stack | train |
ee817653cae403abc747e3a3 | train | class | class VolumeAttachmentPlansWatcherFacade(Type):
name = 'VolumeAttachmentPlansWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternPr... | class VolumeAttachmentPlansWatcherFacade(Type):
| name = 'VolumeAttachmentPlansWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,... | not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
if include_disabled is not None and not isinstance(include_disabled, bool):
raise Exception("Expected include_disabled to be a bool, received: {}".fo... | 146 | 146 | 487 | 8 | 137 | hpidcock/python-libjuju | juju/client/_client1.py | Python | VolumeAttachmentPlansWatcherFacade | VolumeAttachmentPlansWatcherFacade | 12,225 | 12,290 | 12,225 | 12,225 | bfa1124e09499a14e0a4de39f1cf8d59ff73733a | bigcode/the-stack | train |
7f001faec0db0f18d99daaeb | train | class | class CAASUnitProvisionerFacade(Type):
name = 'CAASUnitProvisioner'
version = 1
schema = {'definitions': {'Address': {'additionalProperties': False,
'properties': {'scope': {'type': 'string'},
'space-id': {'type': 'string'}... | class CAASUnitProvisionerFacade(Type):
| name = 'CAASUnitProvisioner'
version = 1
schema = {'definitions': {'Address': {'additionalProperties': False,
'properties': {'scope': {'type': 'string'},
'space-id': {'type': 'string'},
... | '}},
'properties': {'UpgradeOperator': {'properties': {'Params': {'$ref': '#/definitions/KubernetesUpgradeArg'},
'Result': {'$ref': '#/definitions/ErrorResult'}},
'type': 'object'}},
'type': 'object'}
@Ret... | 256 | 256 | 4,952 | 9 | 246 | hpidcock/python-libjuju | juju/client/_client1.py | Python | CAASUnitProvisionerFacade | CAASUnitProvisionerFacade | 1,954 | 2,487 | 1,954 | 1,954 | fd32306169e36603f936a8f58abeb99322301bfd | bigcode/the-stack | train |
855418b9211bee49ac0030eb | train | class | class MachinerFacade(Type):
name = 'Machiner'
version = 1
schema = {'definitions': {'APIHostPortsResult': {'additionalProperties': False,
'properties': {'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'},
... | class MachinerFacade(Type):
| name = 'Machiner'
version = 1
schema = {'definitions': {'APIHostPortsResult': {'additionalProperties': False,
'properties': {'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'},
... | not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='MachineUndertaker',
request='GetMachineProviderInt... | 256 | 256 | 4,006 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | MachinerFacade | MachinerFacade | 6,532 | 7,015 | 6,532 | 6,532 | b43bb34e24b98fb3879d5af3bba9d1a9754d461c | bigcode/the-stack | train |
f66a43dceb8b30cd64b24f01 | train | class | class RetryStrategyFacade(Type):
name = 'RetryStrategy'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
... | class RetryStrategyFacade(Type):
| name = 'RetryStrategy'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | ': 'array'}},
'required': ['ErrorResult',
'resources'],
'type': 'object'}},
'properties': {'GetResourceInfo': {'properties': {'Params': {'$ref': '#/definitions/ListUni... | 256 | 256 | 932 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | RetryStrategyFacade | RetryStrategyFacade | 10,548 | 10,646 | 10,548 | 10,548 | af30fe7e98572e6ec534838995d638a5241e698f | bigcode/the-stack | train |
fe660670152e00ab786364ae | train | class | class CloudFacade(Type):
name = 'Cloud'
version = 1
schema = {'definitions': {'Cloud': {'additionalProperties': False,
'properties': {'auth-types': {'items': {'type': 'string'},
'type': 'array'},
... | class CloudFacade(Type):
| name = 'Cloud'
version = 1
schema = {'definitions': {'Cloud': {'additionalProperties': False,
'properties': {'auth-types': {'items': {'type': 'string'},
'type': 'array'},
... | params['ModelSLAInfo'] = modelslainfo
_params['creds'] = creds
reply = await self.rpc(msg)
return reply
@ReturnMapping(StatusHistoryResults)
async def StatusHistory(self, requests=None):
'''
requests : typing.Sequence[~StatusHistoryRequest]
Returns -> typing.Se... | 256 | 256 | 3,156 | 5 | 250 | hpidcock/python-libjuju | juju/client/_client1.py | Python | CloudFacade | CloudFacade | 3,935 | 4,281 | 3,935 | 3,935 | 4344814105d62bfc39e665c8e4157ecd2a516e52 | bigcode/the-stack | train |
45a41d43929f3c9f4a939465 | train | class | class BackupsFacade(Type):
name = 'Backups'
version = 1
schema = {'definitions': {'BackupsCreateArgs': {'additionalProperties': False,
'properties': {'notes': {'type': 'string'}},
'required': ['notes'],
... | class BackupsFacade(Type):
| name = 'Backups'
version = 1
schema = {'definitions': {'BackupsCreateArgs': {'additionalProperties': False,
'properties': {'notes': {'type': 'string'}},
'required': ['notes'],
... | /StringsWatchResult'}},
'type': 'object'}},
'type': 'object'}
@ReturnMapping(ErrorResults)
async def Rescale(self, entities=None):
'''
entities : typing.Sequence[~Entity]
Returns -> typing.Sequence[~ErrorResult]
'''
if entities is ... | 256 | 256 | 1,646 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | BackupsFacade | BackupsFacade | 359 | 587 | 359 | 359 | c2801eb1e2266abea7969cae181cf01ac81157b2 | bigcode/the-stack | train |
bb06e2536ba77a88771dff10 | train | class | class CAASFirewallerFacade(Type):
name = 'CAASFirewaller'
version = 1
schema = {'definitions': {'ApplicationGetConfigResults': {'additionalProperties': False,
'properties': {'Results': {'items': {'$ref': '#/definitions/ConfigResult'},
... | class CAASFirewallerFacade(Type):
| name = 'CAASFirewaller'
version = 1
schema = {'definitions': {'ApplicationGetConfigResults': {'additionalProperties': False,
'properties': {'Results': {'items': {'$ref': '#/definitions/ConfigResult'},
... | .rpc(msg)
return reply
@ReturnMapping(NotifyWatchResults)
async def WatchCloudSpecsChanges(self, entities=None):
'''
entities : typing.Sequence[~Entity]
Returns -> typing.Sequence[~NotifyWatchResult]
'''
if entities is not None and not isinstance(entities, (byt... | 256 | 256 | 1,627 | 9 | 246 | hpidcock/python-libjuju | juju/client/_client1.py | Python | CAASFirewallerFacade | CAASFirewallerFacade | 888 | 1,073 | 888 | 888 | c368615c3e3c6680143b8475e1d2e10b06664f1d | bigcode/the-stack | train |
9bd7fbf19cda95e4a561cc07 | train | class | class AgentToolsFacade(Type):
name = 'AgentTools'
version = 1
schema = {'properties': {'UpdateToolsAvailable': {'type': 'object'}}, 'type': 'object'}
@ReturnMapping(None)
async def UpdateToolsAvailable(self):
'''
Returns -> None
'''
# map input types to rp... | class AgentToolsFacade(Type):
| name = 'AgentTools'
version = 1
schema = {'properties': {'UpdateToolsAvailable': {'type': 'object'}}, 'type': 'object'}
@ReturnMapping(None)
async def UpdateToolsAvailable(self):
'''
Returns -> None
'''
# map input types to rpc msg
_params = dict()... | '''
# map input types to rpc msg
_params = dict()
msg = dict(type='ActionPruner',
request='WatchForModelConfigChanges',
version=1,
params=_params)
reply = await self.rpc(msg)
return reply
class AgentToolsFacade(Ty... | 64 | 64 | 121 | 6 | 57 | hpidcock/python-libjuju | juju/client/_client1.py | Python | AgentToolsFacade | AgentToolsFacade | 109 | 130 | 109 | 109 | 9f1b9f2f118a1375b8b375881d90647928e7ee09 | bigcode/the-stack | train |
f8ff3b56ec73abf8df58bc0d | train | class | class ModelConfigFacade(Type):
name = 'ModelConfig'
version = 1
schema = {'definitions': {'ConfigValue': {'additionalProperties': False,
'properties': {'source': {'type': 'string'},
'value': {'additionalProperties':... | class ModelConfigFacade(Type):
| name = 'ModelConfig'
version = 1
schema = {'definitions': {'ConfigValue': {'additionalProperties': False,
'properties': {'source': {'type': 'string'},
'value': {'additionalProperties': True,
... | _agent_version is not None and not isinstance(controller_agent_version, (dict, Number)):
raise Exception("Expected controller_agent_version to be a Number, received: {}".format(type(controller_agent_version)))
if name is not None and not isinstance(name, (bytes, str)):
raise Exception("... | 256 | 256 | 1,386 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ModelConfigFacade | ModelConfigFacade | 8,145 | 8,312 | 8,145 | 8,145 | 634d4dbb05febdfaf1e8e1dc70628e5db30b7fcb | bigcode/the-stack | train |
2d87a0be59fe13ab404037cc | train | class | class PingerFacade(Type):
name = 'Pinger'
version = 1
schema = {'properties': {'Ping': {'type': 'object'}, 'Stop': {'type': 'object'}},
'type': 'object'}
@ReturnMapping(None)
async def Ping(self):
'''
Returns -> None
'''
# map input types to rpc msg
... | class PingerFacade(Type):
| name = 'Pinger'
version = 1
schema = {'properties': {'Ping': {'type': 'object'}, 'Stop': {'type': 'object'}},
'type': 'object'}
@ReturnMapping(None)
async def Ping(self):
'''
Returns -> None
'''
# map input types to rpc msg
_params = dict()
... | to rpc msg
_params = dict()
msg = dict(type='PayloadsHookContext',
request='Untrack',
version=1,
params=_params)
_params['entities'] = entities
reply = await self.rpc(msg)
return reply
class PingerFacade(Type):
| 64 | 64 | 197 | 6 | 57 | hpidcock/python-libjuju | juju/client/_client1.py | Python | PingerFacade | PingerFacade | 9,111 | 9,152 | 9,111 | 9,111 | 90284f0e2be45c4a8eab5eeef03ad8cfa8a3c6ee | bigcode/the-stack | train |
7f211ffdff5e932719689647 | train | class | class RemoteApplicationWatcherFacade(Type):
name = 'RemoteApplicationWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'$ref': '#/definit... | class RemoteApplicationWatcherFacade(Type):
| name = 'RemoteApplicationWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'$ref': '#/definitions/ErrorInfo'},
... | 'properties': {'version': {'type': 'integer'}},
'required': ['version'],
'type': 'object'}},
'properties': {'Next': {'properties': {'Result': {'$ref': '#/definitions/RelationUnitsWatchResult'}},
... | 256 | 256 | 866 | 7 | 248 | hpidcock/python-libjuju | juju/client/_client1.py | Python | RemoteApplicationWatcherFacade | RemoteApplicationWatcherFacade | 9,408 | 9,505 | 9,408 | 9,408 | 45e9004cdd0cde351363bc86ae5cb0eb3a60ea42 | bigcode/the-stack | train |
5fe67a78653eb5e329110b54 | train | class | class MeterStatusFacade(Type):
name = 'MeterStatus'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'ty... | class MeterStatusFacade(Type):
| name = 'MeterStatus'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | reply = await self.rpc(msg)
return reply
@ReturnMapping(NotifyWatchResults)
async def Watch(self, entities=None):
'''
entities : typing.Sequence[~Entity]
Returns -> typing.Sequence[~NotifyWatchResult]
'''
if entities is not None and not isinstance(entit... | 248 | 248 | 827 | 6 | 241 | hpidcock/python-libjuju | juju/client/_client1.py | Python | MeterStatusFacade | MeterStatusFacade | 7,019 | 7,107 | 7,019 | 7,019 | d0ae69319fa36c11af879f80d5584cae53e42a84 | bigcode/the-stack | train |
5a457d7e6134558e2c77d1e3 | train | class | class CAASOperatorFacade(Type):
name = 'CAASOperator'
version = 1
schema = {'definitions': {'APIHostPortsResult': {'additionalProperties': False,
'properties': {'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'},
... | class CAASOperatorFacade(Type):
| name = 'CAASOperator'
version = 1
schema = {'definitions': {'APIHostPortsResult': {'additionalProperties': False,
'properties': {'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'},
... | reply = await self.rpc(msg)
return reply
@ReturnMapping(NotifyWatchResults)
async def Watch(self, entities=None):
'''
entities : typing.Sequence[~Entity]
Returns -> typing.Sequence[~NotifyWatchResult]
'''
if entities is not None and not isinstance(entit... | 256 | 256 | 4,040 | 7 | 248 | hpidcock/python-libjuju | juju/client/_client1.py | Python | CAASOperatorFacade | CAASOperatorFacade | 1,077 | 1,567 | 1,077 | 1,077 | 20d7b70f3dbdd61f1234c82e71dbfb3ad9a64901 | bigcode/the-stack | train |
a9a758f9b73770f972427fab | train | class | class StringsWatcherFacade(Type):
name = 'StringsWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'addition... | class StringsWatcherFacade(Type):
| name = 'StringsWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | [~Entity]
Returns -> typing.Sequence[~ErrorResult]
'''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
... | 120 | 120 | 400 | 6 | 113 | hpidcock/python-libjuju | juju/client/_client1.py | Python | StringsWatcherFacade | StringsWatcherFacade | 10,887 | 10,945 | 10,887 | 10,887 | 1bcf3cd17aa15999eb7ec057871435533fbb1f8e | bigcode/the-stack | train |
2b5f69743f36016140c46d69 | train | class | class CrossModelRelationsFacade(Type):
name = 'CrossModelRelations'
version = 1
schema = {'definitions': {'EntityStatus': {'additionalProperties': False,
'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
... | class CrossModelRelationsFacade(Type):
| name = 'CrossModelRelations'
version = 1
schema = {'definitions': {'EntityStatus': {'additionalProperties': False,
'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
... | object'}},
'properties': {'ControllerInfo': {'properties': {'Result': {'$ref': '#/definitions/ControllerAPIInfoResults'}},
'type': 'object'},
'WatchControllerInfo': {'properties': {'Result': {'$ref': '#/definitions/NotifyWatchResults'}},
... | 256 | 256 | 4,554 | 7 | 248 | hpidcock/python-libjuju | juju/client/_client1.py | Python | CrossModelRelationsFacade | CrossModelRelationsFacade | 4,408 | 4,872 | 4,408 | 4,408 | ef8c68475f7d1bf697c57e8525bc033450a50f3a | bigcode/the-stack | train |
7462ccad9c040fe94300a9ee | train | class | class CAASOperatorUpgraderFacade(Type):
name = 'CAASOperatorUpgrader'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*'... | class CAASOperatorUpgraderFacade(Type):
| name = 'CAASOperatorUpgrader'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | ('Error')]
'''
# map input types to rpc msg
_params = dict()
msg = dict(type='CAASOperatorProvisioner',
request='WatchAPIHostPorts',
version=1,
params=_params)
reply = await self.rpc(msg)
return reply
@Retu... | 165 | 165 | 550 | 9 | 155 | hpidcock/python-libjuju | juju/client/_client1.py | Python | CAASOperatorUpgraderFacade | CAASOperatorUpgraderFacade | 1,891 | 1,950 | 1,891 | 1,891 | 71f7c16484fd5fa6fd7636a3d3801c4ba271f6e9 | bigcode/the-stack | train |
e45e23fd1f58d1b166680fdf | train | class | class NotifyWatcherFacade(Type):
name = 'NotifyWatcher'
version = 1
schema = {'properties': {'Next': {'type': 'object'}, 'Stop': {'type': 'object'}},
'type': 'object'}
@ReturnMapping(None)
async def Next(self):
'''
Returns -> None
'''
# map input type... | class NotifyWatcherFacade(Type):
| name = 'NotifyWatcher'
version = 1
schema = {'properties': {'Next': {'type': 'object'}, 'Stop': {'type': 'object'}},
'type': 'object'}
@ReturnMapping(None)
async def Next(self):
'''
Returns -> None
'''
# map input types to rpc msg
_params = di... | msg
_params = dict()
msg = dict(type='ModelUpgrader',
request='WatchModelEnvironVersion',
version=1,
params=_params)
_params['entities'] = entities
reply = await self.rpc(msg)
return reply
class NotifyWatcherFacade(Type):
| 64 | 64 | 197 | 6 | 57 | hpidcock/python-libjuju | juju/client/_client1.py | Python | NotifyWatcherFacade | NotifyWatcherFacade | 8,727 | 8,768 | 8,727 | 8,727 | c1f62f8e00b0553e4cc13d28abeaf813c5f5eba9 | bigcode/the-stack | train |
fa975f85b87abc61b132d775 | train | class | class ResourcesFacade(Type):
name = 'Resources'
version = 1
schema = {'definitions': {'AddCharmWithAuthorization': {'additionalProperties': False,
'properties': {'channel': {'type': 'string'},
... | class ResourcesFacade(Type):
| name = 'Resources'
version = 1
schema = {'definitions': {'AddCharmWithAuthorization': {'additionalProperties': False,
'properties': {'channel': {'type': 'string'},
'force': {'type': 'bool... | 'error': {'$ref': '#/definitions/Error'}},
'required': ['RemoteRelationsWatcherId'],
'type': 'object'}},
'properties': {'Next': {'properties': {'Result': {'$ref': '#/definitions/RemoteRelationsWatchResult'}},
... | 256 | 256 | 2,139 | 5 | 250 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ResourcesFacade | ResourcesFacade | 10,212 | 10,435 | 10,212 | 10,212 | 11aabb013571c0d41ae26845da5d9372592537d4 | bigcode/the-stack | train |
19eff17af682997aa2195762 | train | class | class PayloadsFacade(Type):
name = 'Payloads'
version = 1
schema = {'definitions': {'Payload': {'additionalProperties': False,
'properties': {'class': {'type': 'string'},
'id': {'type': 'string'},
... | class PayloadsFacade(Type):
| name = 'Payloads'
version = 1
schema = {'definitions': {'Payload': {'additionalProperties': False,
'properties': {'class': {'type': 'string'},
'id': {'type': 'string'},
'label... | '), str]
'''
# map input types to rpc msg
_params = dict()
msg = dict(type='OfferStatusWatcher',
request='Next',
version=1,
params=_params)
reply = await self.rpc(msg)
return reply
@ReturnMapping(None)
... | 136 | 136 | 456 | 6 | 129 | hpidcock/python-libjuju | juju/client/_client1.py | Python | PayloadsFacade | PayloadsFacade | 8,850 | 8,903 | 8,850 | 8,850 | a1b6440203b2172adc856046cb0e2532e8b4f390 | bigcode/the-stack | train |
da4585bb7debade3e5d6c095 | train | class | class OfferStatusWatcherFacade(Type):
name = 'OfferStatusWatcher'
version = 1
schema = {'definitions': {'EntityStatus': {'additionalProperties': False,
'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
... | class OfferStatusWatcherFacade(Type):
| name = 'OfferStatusWatcher'
version = 1
schema = {'definitions': {'EntityStatus': {'additionalProperties': False,
'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
... | ': {'type': 'object'}, 'Stop': {'type': 'object'}},
'type': 'object'}
@ReturnMapping(None)
async def Next(self):
'''
Returns -> None
'''
# map input types to rpc msg
_params = dict()
msg = dict(type='NotifyWatcher',
request='Next',
... | 176 | 176 | 588 | 7 | 168 | hpidcock/python-libjuju | juju/client/_client1.py | Python | OfferStatusWatcherFacade | OfferStatusWatcherFacade | 8,772 | 8,846 | 8,772 | 8,772 | f0ed13e5b65c1d4009218d06d34d1fef4b73bab2 | bigcode/the-stack | train |
56c83cd9acc4f9b1564badc7 | train | class | class MigrationFlagFacade(Type):
name = 'MigrationFlag'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
... | class MigrationFlagFacade(Type):
| name = 'MigrationFlag'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | (entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='MetricsManager',
request='CleanupOldMetrics',
version=1,
... | 236 | 236 | 789 | 6 | 229 | hpidcock/python-libjuju | juju/client/_client1.py | Python | MigrationFlagFacade | MigrationFlagFacade | 7,210 | 7,296 | 7,210 | 7,210 | c7319614de771909fde8b0fb4b8c7e1c654a794d | bigcode/the-stack | train |
36e3464e0e0ba5dad08fe687 | train | class | class MetricsManagerFacade(Type):
name = 'MetricsManager'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
... | class MetricsManagerFacade(Type):
| name = 'MetricsManager'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | ("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='MeterStatus',
request='GetMeterStatus',
version=1,
params=_params)
_params['entities'] = en... | 228 | 228 | 761 | 6 | 221 | hpidcock/python-libjuju | juju/client/_client1.py | Python | MetricsManagerFacade | MetricsManagerFacade | 7,111 | 7,206 | 7,111 | 7,111 | bce7d9b0f5cec1882b9f1f1d1d24c703a496d11f | bigcode/the-stack | train |
92cb74c18e700e8ef0198bca | train | class | class UserManagerFacade(Type):
name = 'UserManager'
version = 1
schema = {'definitions': {'AddUser': {'additionalProperties': False,
'properties': {'display-name': {'type': 'string'},
'password': {'type': 'string'},
... | class UserManagerFacade(Type):
| name = 'UserManager'
version = 1
schema = {'definitions': {'AddUser': {'additionalProperties': False,
'properties': {'display-name': {'type': 'string'},
'password': {'type': 'string'},
... | ~ToolsResult]
'''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='Upgrader',
... | 256 | 256 | 2,170 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | UserManagerFacade | UserManagerFacade | 11,977 | 12,221 | 11,977 | 11,977 | d9db7b21f75dafffa3ffbe4937b992c840bf113f | bigcode/the-stack | train |
9753372281c377405d8846bc | train | class | class CredentialManagerFacade(Type):
name = 'CredentialManager'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'ad... | class CredentialManagerFacade(Type):
| name = 'CredentialManager'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | is not None and not isinstance(user_clouds, (bytes, str, list)):
raise Exception("Expected user_clouds to be a Sequence, received: {}".format(type(user_clouds)))
# map input types to rpc msg
_params = dict()
msg = dict(type='Cloud',
request='UserCredentials',
... | 109 | 109 | 365 | 6 | 102 | hpidcock/python-libjuju | juju/client/_client1.py | Python | CredentialManagerFacade | CredentialManagerFacade | 4,285 | 4,325 | 4,285 | 4,285 | d3d1926fa14db243b858591590c5f97e6145b50d | bigcode/the-stack | train |
cab0523511fb0dcd1bfe2610 | train | class | class ExternalControllerUpdaterFacade(Type):
name = 'ExternalControllerUpdater'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
... | class ExternalControllerUpdaterFacade(Type):
| name = 'ExternalControllerUpdater'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | entities'] = entities
reply = await self.rpc(msg)
return reply
@ReturnMapping(NotifyWatchResult)
async def WatchAPIHostPorts(self):
'''
Returns -> typing.Union[str, _ForwardRef('Error')]
'''
# map input types to rpc msg
_params = dict()
msg = ... | 256 | 256 | 1,278 | 7 | 248 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ExternalControllerUpdaterFacade | ExternalControllerUpdaterFacade | 5,253 | 5,392 | 5,253 | 5,253 | 12a4bed4699a13b66ab4f46f3a788b532e6a91ba | bigcode/the-stack | train |
02ca55447dd7fb8355939406 | train | class | class CAASOperatorProvisionerFacade(Type):
name = 'CAASOperatorProvisioner'
version = 1
schema = {'definitions': {'APIHostPortsResult': {'additionalProperties': False,
'properties': {'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'},
... | class CAASOperatorProvisionerFacade(Type):
| name = 'CAASOperatorProvisioner'
version = 1
schema = {'definitions': {'APIHostPortsResult': {'additionalProperties': False,
'properties': {'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'},
... |
reply = await self.rpc(msg)
return reply
@ReturnMapping(NotifyWatchResult)
async def WatchAPIHostPorts(self):
'''
Returns -> typing.Union[str, _ForwardRef('Error')]
'''
# map input types to rpc msg
_params = dict()
msg = dict(type='CAASOperat... | 256 | 256 | 2,607 | 9 | 246 | hpidcock/python-libjuju | juju/client/_client1.py | Python | CAASOperatorProvisionerFacade | CAASOperatorProvisionerFacade | 1,571 | 1,887 | 1,571 | 1,571 | 4d2af38bc1e76f4f1b359aa02543d6f475ec0baa | bigcode/the-stack | train |
6b26b8ca39ba185a88f6c5bb | train | class | class RemoteRelationsFacade(Type):
name = 'RemoteRelations'
version = 1
schema = {'definitions': {'ControllerAPIInfoResult': {'additionalProperties': False,
'properties': {'addresses': {'items': {'type': 'string'},
... | class RemoteRelationsFacade(Type):
| name = 'RemoteRelations'
version = 1
schema = {'definitions': {'ControllerAPIInfoResult': {'additionalProperties': False,
'properties': {'addresses': {'items': {'type': 'string'},
... | ': {'type': 'integer'},
'type': 'array'}},
'required': ['initial'],
'type': 'object'}},
'properties': {'Next': {'properties': {'Result': {'$ref': '... | 256 | 256 | 5,396 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | RemoteRelationsFacade | RemoteRelationsFacade | 9,509 | 10,115 | 9,509 | 9,509 | aed9bc5eb30f2a4c02a58df82a13beb0a5965e3e | bigcode/the-stack | train |
0e28ab52d0316d2aa51244d3 | train | class | class UnitAssignerFacade(Type):
name = 'UnitAssigner'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'... | class UnitAssignerFacade(Type):
| name = 'UnitAssigner'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | _params['entities'] = entities
reply = await self.rpc(msg)
return reply
@ReturnMapping(ErrorResults)
async def UpdateStatus(self, entities=None):
'''
entities : typing.Sequence[~EntityStatusArgs]
Returns -> typing.Sequence[~ErrorResult]
'''
if e... | 256 | 256 | 1,038 | 7 | 248 | hpidcock/python-libjuju | juju/client/_client1.py | Python | UnitAssignerFacade | UnitAssignerFacade | 11,174 | 11,294 | 11,174 | 11,174 | 25ee2696170d950ed4d7fb7c68eabc375ef9f502 | bigcode/the-stack | train |
df943285499798e2551cdf3e | train | class | class ActionPrunerFacade(Type):
name = 'ActionPruner'
version = 1
schema = {'definitions': {'ActionPruneArgs': {'additionalProperties': False,
'properties': {'max-history-mb': {'type': 'integer'},
'max-histo... | class ActionPrunerFacade(Type):
| name = 'ActionPruner'
version = 1
schema = {'definitions': {'ActionPruneArgs': {'additionalProperties': False,
'properties': {'max-history-mb': {'type': 'integer'},
'max-history-time': {'type': 'integer'}},
... | # DO NOT CHANGE THIS FILE! This file is auto-generated by facade.py.
# Changes will be overwritten/lost when the file is regenerated.
from juju.client.facade import Type, ReturnMapping
from juju.client._definitions import *
class ActionPrunerFacade(Type):
| 56 | 235 | 786 | 7 | 49 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ActionPrunerFacade | ActionPrunerFacade | 8 | 105 | 8 | 8 | 57d792e385fc24a4da784359d28ede7c1cf9283b | bigcode/the-stack | train |
9f5e0e1bd3b7d97b977f07bb | train | function | def get_base_freq(reads: List[str]):
"""
Returns the aggregate frequency of bases in the sequencing reads
>>> get_base_freq(["NAACGTTA"])
Counter({'A': 3, 'T': 2, 'N': 1, 'C': 1, 'G': 1})
>>> get_base_freq(["AACGTTA", "CGCGTTT"])
Counter({'T': 5, 'A': 3, 'C': 3, 'G': 3})
"""
concatenated... | def get_base_freq(reads: List[str]):
| """
Returns the aggregate frequency of bases in the sequencing reads
>>> get_base_freq(["NAACGTTA"])
Counter({'A': 3, 'T': 2, 'N': 1, 'C': 1, 'G': 1})
>>> get_base_freq(["AACGTTA", "CGCGTTT"])
Counter({'T': 5, 'A': 3, 'C': 3, 'G': 3})
"""
concatenated_reads = "".join(reads)
return Co... | C", "G", "T", "N"} == set()
for index, base in enumerate(read):
if base in ["G", "C"]:
gc[index] += 1
gc = gc / len(reads)
return gc
def get_base_freq(reads: List[str]):
| 64 | 64 | 130 | 10 | 53 | SvoONs/genomics_algo | genomics_algo/utilities/seq_reads_processing.py | Python | get_base_freq | get_base_freq | 23 | 32 | 23 | 23 | b18c3b32db822be8f2fd0db2a065eac89150e0ea | bigcode/the-stack | train |
c6451e8a735e0fc698df5f0d | train | function | def find_GC_by_position(reads: List[str]) -> np.ndarray:
"""
Returns the average GC content per index in a list of sequencing reads
"""
assert same_length_reads(reads)
reads_length = len(reads[0])
gc = np.zeros(reads_length)
for read in reads:
assert set(read) - {"A", "C", "G", "T", ... | def find_GC_by_position(reads: List[str]) -> np.ndarray:
| """
Returns the average GC content per index in a list of sequencing reads
"""
assert same_length_reads(reads)
reads_length = len(reads[0])
gc = np.zeros(reads_length)
for read in reads:
assert set(read) - {"A", "C", "G", "T", "N"} == set()
for index, base in enumerate(read):... | import numpy as np
from collections import Counter
from typing import List
def find_GC_by_position(reads: List[str]) -> np.ndarray:
| 31 | 64 | 132 | 16 | 14 | SvoONs/genomics_algo | genomics_algo/utilities/seq_reads_processing.py | Python | find_GC_by_position | find_GC_by_position | 7 | 20 | 7 | 7 | 108c2f61feac0c27fb58e27594855df9b6133c52 | bigcode/the-stack | train |
6ed7e1ceadc2070a79535b48 | train | function | def same_length_reads(reads: List[str]) -> bool:
"""
Returns true if the list of sequencing reads has at least one sequence read and
each of the reads has the same length, False otherwise
>>> same_length_reads(["AACGTTA"])
True
>>> same_length_reads(["AACGTTA", "CGCGTTT"])
True
>>> same_... | def same_length_reads(reads: List[str]) -> bool:
| """
Returns true if the list of sequencing reads has at least one sequence read and
each of the reads has the same length, False otherwise
>>> same_length_reads(["AACGTTA"])
True
>>> same_length_reads(["AACGTTA", "CGCGTTT"])
True
>>> same_length_reads(["AACGTTA", "CGCGTTT", "GTTAC"])
... | CGTTT"])
Counter({'T': 5, 'A': 3, 'C': 3, 'G': 3})
"""
concatenated_reads = "".join(reads)
return Counter(concatenated_reads)
def same_length_reads(reads: List[str]) -> bool:
| 64 | 64 | 136 | 13 | 51 | SvoONs/genomics_algo | genomics_algo/utilities/seq_reads_processing.py | Python | same_length_reads | same_length_reads | 35 | 48 | 35 | 35 | abb88ae06eee7801fe34604a907b89bd4667045a | bigcode/the-stack | train |
e1f7d000ce2a2af2dfbc0a46 | train | function | def stage_2(cond):
"""wait for the condition telling us stage_1 is done"""
name = multiprocessing.current_process().name
print('Starting', name)
with cond:
cond.wait()
print('{} running'.format(name))
| def stage_2(cond):
| """wait for the condition telling us stage_1 is done"""
name = multiprocessing.current_process().name
print('Starting', name)
with cond:
cond.wait()
print('{} running'.format(name))
| """perform first stage of work,
then notify stage_2 to continue
"""
name = multiprocessing.current_process().name
print('Starting', name)
with cond:
print('{} done and ready for stage 2'.format(name))
cond.notify_all()
def stage_2(cond):
| 64 | 64 | 52 | 6 | 58 | axetang/AxePython | PyMOTW/source/multiprocessing/multiprocessing_condition.py | Python | stage_2 | stage_2 | 24 | 30 | 24 | 24 | 5d4ce3ff50a27c3627d43a279845046ece9f6de0 | bigcode/the-stack | train |
c7e001308e24db720f0fba32 | train | function | def stage_1(cond):
"""perform first stage of work,
then notify stage_2 to continue
"""
name = multiprocessing.current_process().name
print('Starting', name)
with cond:
print('{} done and ready for stage 2'.format(name))
cond.notify_all()
| def stage_1(cond):
| """perform first stage of work,
then notify stage_2 to continue
"""
name = multiprocessing.current_process().name
print('Starting', name)
with cond:
print('{} done and ready for stage 2'.format(name))
cond.notify_all()
| #!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""Using a Condition to control sequencing between workers.
"""
#end_pymotw_header
import multiprocessing
import time
def stage_1(cond):
| 62 | 64 | 64 | 6 | 55 | axetang/AxePython | PyMOTW/source/multiprocessing/multiprocessing_condition.py | Python | stage_1 | stage_1 | 13 | 21 | 13 | 13 | 086726fe8fe83f636229a8125a6f51ec4431ce4a | bigcode/the-stack | train |
81aca2cd262d64fe3068fa6c | train | function | def to_sql(
df: pd.DataFrame,
con: pymysql.connections.Connection,
table: str,
schema: str,
mode: str = "append",
index: bool = False,
dtype: Optional[Dict[str, str]] = None,
varchar_lengths: Optional[Dict[str, int]] = None,
) -> None:
"""Write records stored in a DataFrame into MySQ... | def to_sql(
df: pd.DataFrame,
con: pymysql.connections.Connection,
table: str,
schema: str,
mode: str = "append",
index: bool = False,
dtype: Optional[Dict[str, str]] = None,
varchar_lengths: Optional[Dict[str, int]] = None,
) -> None:
| """Write records stored in a DataFrame into MySQL.
Parameters
----------
df : pandas.DataFrame
Pandas DataFrame https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html
con : pymysql.connections.Connection
Use pymysql.connect() to use credentials directly or ... | (
... table="my_table",
... schema="test",
... con=con
... )
>>> con.close()
"""
sql: str = f"SELECT * FROM `{table}`" if schema is None else f"SELECT * FROM `{schema}`.`{table}`"
return read_sql_query(
sql=sql, con=con, index_col=index_col, params=params, chunksize=... | 179 | 179 | 598 | 75 | 104 | njdanielsen/aws-data-wrangler | awswrangler/mysql.py | Python | to_sql | to_sql | 260 | 340 | 260 | 269 | 0c3c06aec9b18987ddf976e18fd0a7427adcbf2a | bigcode/the-stack | train |
55ade08ea621bf057bd7181e | train | function | def connect(
connection: Optional[str] = None,
secret_id: Optional[str] = None,
catalog_id: Optional[str] = None,
dbname: Optional[str] = None,
boto3_session: Optional[boto3.Session] = None,
read_timeout: Optional[int] = None,
write_timeout: Optional[int] = None,
connect_timeout: int = 1... | def connect(
connection: Optional[str] = None,
secret_id: Optional[str] = None,
catalog_id: Optional[str] = None,
dbname: Optional[str] = None,
boto3_session: Optional[boto3.Session] = None,
read_timeout: Optional[int] = None,
write_timeout: Optional[int] = None,
connect_timeout: int = 1... | """Return a pymysql connection from a Glue Catalog Connection.
https://pymysql.readthedocs.io
Parameters
----------
connection : str
Glue Catalog Connection name.
secret_id: Optional[str]:
Specifies the secret containing the version that you want to retrieve.
You can sp... | TEXT",
varchar_lengths=varchar_lengths,
converter_func=_data_types.pyarrow2mysql,
)
cols_str: str = "".join([f"`{k}` {v},\n" for k, v in mysql_types.items()])[:-2]
sql = f"CREATE TABLE IF NOT EXISTS `{schema}`.`{table}` (\n{cols_str})"
_logger.debug("Create table query:\n%s", sql)
cu... | 190 | 190 | 634 | 92 | 98 | njdanielsen/aws-data-wrangler | awswrangler/mysql.py | Python | connect | connect | 69 | 140 | 69 | 78 | 13664d8c18fbb179dd2e0205c213942d52cc7a6a | bigcode/the-stack | train |
1854752e3d4f3af4babcccc1 | train | function | def _drop_table(cursor: Cursor, schema: Optional[str], table: str) -> None:
schema_str = f"`{schema}`." if schema else ""
sql = f"DROP TABLE IF EXISTS {schema_str}`{table}`"
_logger.debug("Drop table query:\n%s", sql)
cursor.execute(sql)
| def _drop_table(cursor: Cursor, schema: Optional[str], table: str) -> None:
| schema_str = f"`{schema}`." if schema else ""
sql = f"DROP TABLE IF EXISTS {schema_str}`{table}`"
_logger.debug("Drop table query:\n%s", sql)
cursor.execute(sql)
| conn' argument, please pass a "
"pymysql.connections.Connection object. Use pymysql.connect() to use "
"credentials directly or wr.mysql.connect() to fetch it from the Glue Catalog."
)
def _drop_table(cursor: Cursor, schema: Optional[str], table: str) -> None:
| 64 | 64 | 70 | 20 | 44 | njdanielsen/aws-data-wrangler | awswrangler/mysql.py | Python | _drop_table | _drop_table | 28 | 32 | 28 | 28 | 73ef8918fe845697f8c3343c23b61f0f3d65387f | bigcode/the-stack | train |
626af865c5e6073c46fbf42f | train | function | def read_sql_query(
sql: str,
con: pymysql.connections.Connection,
index_col: Optional[Union[str, List[str]]] = None,
params: Optional[Union[List[Any], Tuple[Any, ...], Dict[Any, Any]]] = None,
chunksize: Optional[int] = None,
dtype: Optional[Dict[str, pa.DataType]] = None,
safe: bool = True... | def read_sql_query(
sql: str,
con: pymysql.connections.Connection,
index_col: Optional[Union[str, List[str]]] = None,
params: Optional[Union[List[Any], Tuple[Any, ...], Dict[Any, Any]]] = None,
chunksize: Optional[int] = None,
dtype: Optional[Dict[str, pa.DataType]] = None,
safe: bool = True... | """Return a DataFrame corresponding to the result set of the query string.
Parameters
----------
sql : str
SQL query.
con : pymysql.connections.Connection
Use pymysql.connect() to use credentials directly or wr.mysql.connect() to fetch it from the Glue Catalog.
index_col : Union... | =attrs.database,
password=attrs.password,
port=attrs.port,
host=attrs.host,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
)
def read_sql_query(
sql: str,
con: pymysql.connections.Connection,
index_col: Optional[Un... | 146 | 146 | 489 | 101 | 45 | njdanielsen/aws-data-wrangler | awswrangler/mysql.py | Python | read_sql_query | read_sql_query | 143 | 196 | 143 | 151 | 112a97e2630b33ad395b1c06dba9f3cb5240b2cb | bigcode/the-stack | train |
675a4d3c0afbe686e650c089 | train | function | def _create_table(
df: pd.DataFrame,
cursor: Cursor,
table: str,
schema: str,
mode: str,
index: bool,
dtype: Optional[Dict[str, str]],
varchar_lengths: Optional[Dict[str, int]],
) -> None:
if mode == "overwrite":
_drop_table(cursor=cursor, schema=schema, table=table)
elif... | def _create_table(
df: pd.DataFrame,
cursor: Cursor,
table: str,
schema: str,
mode: str,
index: bool,
dtype: Optional[Dict[str, str]],
varchar_lengths: Optional[Dict[str, int]],
) -> None:
| if mode == "overwrite":
_drop_table(cursor=cursor, schema=schema, table=table)
elif _does_table_exist(cursor=cursor, schema=schema, table=table):
return
mysql_types: Dict[str, str] = _data_types.database_types_from_pandas(
df=df,
index=index,
dtype=dtype,
varc... | ()) > 0 # type: ignore
def _create_table(
df: pd.DataFrame,
cursor: Cursor,
table: str,
schema: str,
mode: str,
index: bool,
dtype: Optional[Dict[str, str]],
varchar_lengths: Optional[Dict[str, int]],
) -> None:
| 72 | 72 | 241 | 62 | 9 | njdanielsen/aws-data-wrangler | awswrangler/mysql.py | Python | _create_table | _create_table | 41 | 66 | 41 | 50 | 52cdb4a9c339aa81b29b41dbc3e83f548f6feacf | bigcode/the-stack | train |
72f3a8d3e6362868ae689979 | train | function | def _validate_connection(con: pymysql.connections.Connection) -> None:
if not isinstance(con, pymysql.connections.Connection):
raise exceptions.InvalidConnection(
"Invalid 'conn' argument, please pass a "
"pymysql.connections.Connection object. Use pymysql.connect() to use "
... | def _validate_connection(con: pymysql.connections.Connection) -> None:
| if not isinstance(con, pymysql.connections.Connection):
raise exceptions.InvalidConnection(
"Invalid 'conn' argument, please pass a "
"pymysql.connections.Connection object. Use pymysql.connect() to use "
"credentials directly or wr.mysql.connect() to fetch it from the Gl... | ysql
from pymysql.cursors import Cursor
from awswrangler import _data_types
from awswrangler import _databases as _db_utils
from awswrangler import exceptions
_logger: logging.Logger = logging.getLogger(__name__)
def _validate_connection(con: pymysql.connections.Connection) -> None:
| 64 | 64 | 79 | 14 | 50 | njdanielsen/aws-data-wrangler | awswrangler/mysql.py | Python | _validate_connection | _validate_connection | 19 | 25 | 19 | 19 | fef165b17c01f44b1cfecda132cdd536298dd6b0 | bigcode/the-stack | train |
0d75ebf2472f8c3b37505225 | train | function | def read_sql_table(
table: str,
con: pymysql.connections.Connection,
schema: Optional[str] = None,
index_col: Optional[Union[str, List[str]]] = None,
params: Optional[Union[List[Any], Tuple[Any, ...], Dict[Any, Any]]] = None,
chunksize: Optional[int] = None,
dtype: Optional[Dict[str, pa.Data... | def read_sql_table(
table: str,
con: pymysql.connections.Connection,
schema: Optional[str] = None,
index_col: Optional[Union[str, List[str]]] = None,
params: Optional[Union[List[Any], Tuple[Any, ...], Dict[Any, Any]]] = None,
chunksize: Optional[int] = None,
dtype: Optional[Dict[str, pa.Data... | """Return a DataFrame corresponding the table.
Parameters
----------
table : str
Table name.
con : pymysql.connections.Connection
Use pymysql.connect() to use credentials directly or wr.mysql.connect() to fetch it from the Glue Catalog.
schema : str, optional
Name of SQL... | """
_validate_connection(con=con)
return _db_utils.read_sql_query(
sql=sql, con=con, index_col=index_col, params=params, chunksize=chunksize, dtype=dtype, safe=safe
)
def read_sql_table(
table: str,
con: pymysql.connections.Connection,
schema: Optional[str] = None,
index_col: Opt... | 162 | 162 | 540 | 110 | 52 | njdanielsen/aws-data-wrangler | awswrangler/mysql.py | Python | read_sql_table | read_sql_table | 199 | 257 | 199 | 208 | 42888dd15bc5731f0e5d6ce599db117076c9bfca | bigcode/the-stack | train |
bddcf462a1a01ac1a66f4ed8 | train | function | def _does_table_exist(cursor: Cursor, schema: Optional[str], table: str) -> bool:
schema_str = f"TABLE_SCHEMA = '{schema}' AND" if schema else ""
cursor.execute(f"SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE " f"{schema_str} TABLE_NAME = '{table}'")
return len(cursor.fetchall()) > 0 # type: ignore
| def _does_table_exist(cursor: Cursor, schema: Optional[str], table: str) -> bool:
| schema_str = f"TABLE_SCHEMA = '{schema}' AND" if schema else ""
cursor.execute(f"SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE " f"{schema_str} TABLE_NAME = '{table}'")
return len(cursor.fetchall()) > 0 # type: ignore
| schema}`." if schema else ""
sql = f"DROP TABLE IF EXISTS {schema_str}`{table}`"
_logger.debug("Drop table query:\n%s", sql)
cursor.execute(sql)
def _does_table_exist(cursor: Cursor, schema: Optional[str], table: str) -> bool:
| 64 | 64 | 80 | 21 | 43 | njdanielsen/aws-data-wrangler | awswrangler/mysql.py | Python | _does_table_exist | _does_table_exist | 35 | 38 | 35 | 35 | 7499098b3d51f5e476d57cccb4db2289f46bc1bc | bigcode/the-stack | train |
b2a6c383bd208e323cb198d4 | train | class | class SmartContractInformation(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribut... | class SmartContractInformation(object):
| """NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
... | # coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | 119 | 249 | 832 | 6 | 112 | joekohlsdorf/docusign-esign-python-client | docusign_esign/models/smart_contract_information.py | Python | SmartContractInformation | SmartContractInformation | 22 | 151 | 22 | 22 | 4143bce4a1970f4d492e5956ee159143b79ddc0a | bigcode/the-stack | train |
8c11d6c6b655530fc7add808 | train | function | def summary(refseqGenome, assemblySummary):
assembly_summary = pandas.read_csv(refseqGenome+'/archaea/assembly_summary.txt', dtype=str, sep='\t', header=1)
assembly_summary_2 = pandas.read_csv(refseqGenome+'/bacteria/assembly_summary.txt', dtype=str, sep='\t', header=1)
assembly_summary = assembly_summ... | def summary(refseqGenome, assemblySummary):
| assembly_summary = pandas.read_csv(refseqGenome+'/archaea/assembly_summary.txt', dtype=str, sep='\t', header=1)
assembly_summary_2 = pandas.read_csv(refseqGenome+'/bacteria/assembly_summary.txt', dtype=str, sep='\t', header=1)
assembly_summary = assembly_summary.append(assembly_summary_2)
assembly_su... | import argparse
import os
import pandas
FLAGS = None
def summary(refseqGenome, assemblySummary):
| 22 | 123 | 412 | 9 | 12 | HKU-BAL/MegaPath-Nano | db_preparation/genAssemblySummary.py | Python | summary | summary | 7 | 33 | 7 | 8 | fc0b3c55e403b260b39222d3d9af2412f084a538 | bigcode/the-stack | train |
2fbee2151dc13896b0636eae | train | class | class OrderPaymentTransaction(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attr... | class OrderPaymentTransaction(object):
| """
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute ... | # coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class OrderPaymentTransaction(obj... | 86 | 256 | 1,062 | 6 | 79 | gstingy/uc_python_api | ultracart/models/order_payment_transaction.py | Python | OrderPaymentTransaction | OrderPaymentTransaction | 19 | 210 | 19 | 19 | b4d4369f347c44cc20044e176b6f90d1b1a133b5 | bigcode/the-stack | train |
e9724dbd4e9efb353430b16f | train | function | def test_word_largest_score():
assert get_word_largest_score("Beautiful is better than ugly.") == 'Beautiful'
assert get_word_largest_score("Explicit is better than implicit.") == 'Explicit'
| def test_word_largest_score():
| assert get_word_largest_score("Beautiful is better than ugly.") == 'Beautiful'
assert get_word_largest_score("Explicit is better than implicit.") == 'Explicit'
| assert score_word('biodiversity') == 21
assert score_word('entrepreneurs') == 15
def test_madeup_words():
assert score_word('sheeps') == 0
assert score_word('xylophenatic') == 0
def test_word_largest_score():
| 64 | 64 | 43 | 7 | 56 | RiddhiDamani/Python | 8_things_to_know_exercise/challenge/tests/test_min_max_challenge.py | Python | test_word_largest_score | test_word_largest_score | 15 | 17 | 15 | 15 | bc13dafc01871e470e980d5bcb25ea19631e3dfd | bigcode/the-stack | train |
0811566a94c796d51dcbad21 | train | function | def test_word_with_punctuation():
assert get_word_largest_score('In the face of ambiguity, refuse the temptation to guess.') == 'ambiguity'
assert get_word_largest_score('Errors should never pass silently.') == 'silently'
| def test_word_with_punctuation():
| assert get_word_largest_score('In the face of ambiguity, refuse the temptation to guess.') == 'ambiguity'
assert get_word_largest_score('Errors should never pass silently.') == 'silently'
| assert score_word('xylophenatic') == 0
def test_word_largest_score():
assert get_word_largest_score("Beautiful is better than ugly.") == 'Beautiful'
assert get_word_largest_score("Explicit is better than implicit.") == 'Explicit'
def test_word_with_punctuation():
| 64 | 64 | 51 | 7 | 57 | RiddhiDamani/Python | 8_things_to_know_exercise/challenge/tests/test_min_max_challenge.py | Python | test_word_with_punctuation | test_word_with_punctuation | 19 | 21 | 19 | 19 | f004f7e4e3699f2f0f0badf076a08ebc55d1f312 | bigcode/the-stack | train |
e2ba46e97d53509cc5d8abe5 | train | function | def test_madeup_words():
assert score_word('sheeps') == 0
assert score_word('xylophenatic') == 0
| def test_madeup_words():
| assert score_word('sheeps') == 0
assert score_word('xylophenatic') == 0
| case():
assert score_word('ABANDON') == 10
assert score_word('VOID') == 8
def test_words_lowercase():
assert score_word('biodiversity') == 21
assert score_word('entrepreneurs') == 15
def test_madeup_words():
| 64 | 64 | 33 | 7 | 56 | RiddhiDamani/Python | 8_things_to_know_exercise/challenge/tests/test_min_max_challenge.py | Python | test_madeup_words | test_madeup_words | 11 | 13 | 11 | 11 | b4de5b863b2739fa1e389cf13af2b8a7935df528 | bigcode/the-stack | train |
5f3b146ad5538a5c6f2e576a | train | function | def test_words_uppercase():
assert score_word('ABANDON') == 10
assert score_word('VOID') == 8
| def test_words_uppercase():
| assert score_word('ABANDON') == 10
assert score_word('VOID') == 8
| from min_max_challenge import letter_scores, get_scrabble_dictionary, score_word, get_word_largest_score
def test_words_uppercase():
| 29 | 64 | 30 | 6 | 22 | RiddhiDamani/Python | 8_things_to_know_exercise/challenge/tests/test_min_max_challenge.py | Python | test_words_uppercase | test_words_uppercase | 3 | 5 | 3 | 3 | 6befa32ba5059434e249861403278184f4eedd14 | bigcode/the-stack | train |
d1b81486e7a9f2d0b54c0c1d | train | function | def test_madeup_sentence():
# All of the words have a score of 0, return the first word
assert get_word_largest_score('wefpie fefq fqpw pwqww') == 'wefpie'
assert get_word_largest_score('pwqw zxxz lmpny zsxrwq') == 'pwqw' | def test_madeup_sentence():
# All of the words have a score of 0, return the first word
| assert get_word_largest_score('wefpie fefq fqpw pwqww') == 'wefpie'
assert get_word_largest_score('pwqw zxxz lmpny zsxrwq') == 'pwqw' | argest_score('In the face of ambiguity, refuse the temptation to guess.') == 'ambiguity'
assert get_word_largest_score('Errors should never pass silently.') == 'silently'
def test_madeup_sentence():
# All of the words have a score of 0, return the first word
| 64 | 64 | 78 | 25 | 39 | RiddhiDamani/Python | 8_things_to_know_exercise/challenge/tests/test_min_max_challenge.py | Python | test_madeup_sentence | test_madeup_sentence | 23 | 26 | 23 | 24 | 8ca359132061fd34a9b06fa237e2b19f7dbeace5 | bigcode/the-stack | train |
edd634e226e5d1b61fd496f3 | train | function | def test_words_lowercase():
assert score_word('biodiversity') == 21
assert score_word('entrepreneurs') == 15
| def test_words_lowercase():
| assert score_word('biodiversity') == 21
assert score_word('entrepreneurs') == 15
| from min_max_challenge import letter_scores, get_scrabble_dictionary, score_word, get_word_largest_score
def test_words_uppercase():
assert score_word('ABANDON') == 10
assert score_word('VOID') == 8
def test_words_lowercase():
| 59 | 64 | 31 | 6 | 52 | RiddhiDamani/Python | 8_things_to_know_exercise/challenge/tests/test_min_max_challenge.py | Python | test_words_lowercase | test_words_lowercase | 7 | 9 | 7 | 7 | 5437c4a572f8d1286995e7d2fa1ff276211f2b03 | bigcode/the-stack | train |
c4c790f1f171ef7c3713384d | train | class | class JobList(object):
"""
Represents a list of Oozie jobs (Workflows or Coordinators or Bundles).
"""
_ATTRS = [
'offset',
'len',
'total',
'jobs',
]
def __init__(self, klass, jobs_key, api, json_dict, filters=None):
"""
json_dict is the oozie json.
filters is (optionally) the l... | class JobList(object):
| """
Represents a list of Oozie jobs (Workflows or Coordinators or Bundles).
"""
_ATTRS = [
'offset',
'len',
'total',
'jobs',
]
def __init__(self, klass, jobs_key, api, json_dict, filters=None):
"""
json_dict is the oozie json.
filters is (optionally) the list of filters used to ... | self.id}) + extra_params
def get_progress(self):
progresses = [action.get_progress() for action in self.actions]
count = len(progresses)
if count != 0:
return sum(progresses) / float(count)
else:
return 0
class JobList(object):
| 64 | 64 | 159 | 5 | 58 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | JobList | JobList | 606 | 626 | 606 | 606 | deea55a8a8bed3a6d9915344491ba1e42e35ffdb | bigcode/the-stack | train |
9ecce4b935b17d0e9ecf6630 | train | class | class Bundle(Job):
_ATTRS = [
'status',
'toString',
'group',
'conf',
'bundleJobName',
'startTime',
'bundleCoordJobs',
'kickoffTime',
'acl',
'bundleJobPath',
'createdTime',
'timeOut',
'consoleUrl',
'bundleExternalId',
'timeUnit',
'pauseTime',
'bundleJ... | class Bundle(Job):
| _ATTRS = [
'status',
'toString',
'group',
'conf',
'bundleJobName',
'startTime',
'bundleCoordJobs',
'kickoffTime',
'acl',
'bundleJobPath',
'createdTime',
'timeOut',
'consoleUrl',
'bundleExternalId',
'timeUnit',
'pauseTime',
'bundleJobId',
'endTime... | action in self.actions]) / action_count * 100)
return progress
@classmethod
def aggreate(cls, actions):
if not actions:
return []
result = []
first = prev = actions[0]
for a in actions[1:]:
if int(a) != int(prev) + 1:
result.append('-'.join((first, prev)))
first ... | 111 | 111 | 370 | 4 | 106 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | Bundle | Bundle | 549 | 603 | 549 | 549 | 7c4082dc74ade406e8156776e9a9ade9d2396051 | bigcode/the-stack | train |
083a4a805a6294d46392b4f6 | train | class | class Workflow(Job):
_ATTRS = [
'actions',
'appName',
'appPath',
'conf',
'consoleUrl',
'createdTime',
'endTime',
'externalId',
'group',
'id',
'lastModTime',
'run',
'startTime',
'status',
'user',
'acl',
'parentId'
]
ACTION = WorkflowAction
RUNNI... | class Workflow(Job):
| _ATTRS = [
'actions',
'appName',
'appPath',
'conf',
'consoleUrl',
'createdTime',
'endTime',
'externalId',
'group',
'id',
'lastModTime',
'run',
'startTime',
'status',
'user',
'acl',
'parentId'
]
ACTION = WorkflowAction
RUNNING_STATUSES = set(['P... | .") %
dict(username=request.user.username, user=self.user))
def get_control_flow_actions(self):
return [action for action in self.actions if ControlFlowAction.is_control_flow(action.type)]
def get_working_actions(self):
return [action for action in self.actions if not ControlFlo... | 146 | 146 | 487 | 4 | 141 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | Workflow | Workflow | 382 | 445 | 382 | 382 | 264c5207430da2205d8f8b298470418c8d8a705a | bigcode/the-stack | train |
330df9b069c699778567eeb3 | train | class | class WorkflowAction(Action):
_ATTRS = [
'conf',
'consoleUrl',
'data',
'endTime',
'errorCode',
'errorMessage',
'externalId',
'externalStatus',
'id',
'name',
'retries',
'startTime',
'status',
'trackerUri',
'transition',
'type',
'externalChildIDs',
]... | class WorkflowAction(Action):
| _ATTRS = [
'conf',
'consoleUrl',
'data',
'endTime',
'errorCode',
'errorMessage',
'externalId',
'externalStatus',
'id',
'name',
'retries',
'startTime',
'status',
'trackerUri',
'transition',
'type',
'externalChildIDs',
]
def _fixup(self):
"""
... | - time fields as struct_time
- config dict
- protect externalId
"""
super(ControlFlowAction, self)._fixup()
if self.startTime:
self.startTime = parse_timestamp(self.startTime)
if self.endTime:
self.endTime = parse_timestamp(self.endTime)
if self.retries:
self.retries ... | 117 | 118 | 394 | 5 | 112 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | WorkflowAction | WorkflowAction | 113 | 171 | 113 | 113 | 6b006f4bf42c872015aa1e1cdaf6aa1bfd1f48cc | bigcode/the-stack | train |
f533fb463f5d8b8bbf237155 | train | class | class BundleAction(Action):
_ATTRS = [
'startTime',
'actions',
'frequency',
'concurrency',
'pauseTime',
'group',
'toString',
'consoleUrl',
'mat_throttling',
'status',
'conf',
'user',
'timeOut',
'coordJobPath',
'timeUnit',
... | class BundleAction(Action):
| _ATTRS = [
'startTime',
'actions',
'frequency',
'concurrency',
'pauseTime',
'group',
'toString',
'consoleUrl',
'mat_throttling',
'status',
'conf',
'user',
'timeOut',
'coordJobPath',
'timeUnit',
'coordJobId',
'coordJo... | parse_timestamp(self.nominalTime)
if self.lastModifiedTime:
self.lastModifiedTime = parse_timestamp(self.lastModifiedTime)
if self.runConf:
xml = StringIO(i18n.smart_str(self.runConf))
self.conf_dict = hadoop.confparse.ConfParse(xml)
else:
self.conf_dict = {}
self.title = ' %s... | 97 | 97 | 325 | 5 | 92 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | BundleAction | BundleAction | 219 | 275 | 219 | 219 | 5d80dc2bbcf82b4957c79d77432a6b36a1e9d852 | bigcode/the-stack | train |
e24377c1197427f21b08790c | train | class | class CoordinatorList(JobList):
def __init__(self, api, json_dict, filters=None):
super(CoordinatorList, self).__init__(Coordinator, 'coordinatorjobs', api, json_dict, filters)
| class CoordinatorList(JobList):
| def __init__(self, api, json_dict, filters=None):
super(CoordinatorList, self).__init__(Coordinator, 'coordinatorjobs', api, json_dict, filters)
| _dict in json_dict[jobs_key]]
self.filters = filters
class WorkflowList(JobList):
def __init__(self, api, json_dict, filters=None):
super(WorkflowList, self).__init__(Workflow, 'workflows', api, json_dict, filters)
class CoordinatorList(JobList):
| 64 | 64 | 45 | 6 | 58 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | CoordinatorList | CoordinatorList | 634 | 636 | 634 | 634 | 788c41e3159d933eec02638a6e296084c6dc84d5 | bigcode/the-stack | train |
c9af0709a05d7c6664a3fe1e | train | class | class CoordinatorAction(Action):
_ATTRS = [
'status',
'runConf',
'errorMessage',
'missingDependencies',
'coordJobId',
'errorCode',
'actionNumber',
'consoleUrl',
'nominalTime',
'externalStatus',
'createdConf',
'createdTime',
'externalId',
'lastModifiedTime',
... | class CoordinatorAction(Action):
| _ATTRS = [
'status',
'runConf',
'errorMessage',
'missingDependencies',
'coordJobId',
'errorCode',
'actionNumber',
'consoleUrl',
'nominalTime',
'externalStatus',
'createdConf',
'createdTime',
'externalId',
'lastModifiedTime',
'type',
'id',
'trackerUri... | related_job_ids.append('bundle_job_id=%s' % self.oozie_bundle.id)
if related_job_ids:
extra_params = '?' + '&'.join(related_job_ids)
else:
extra_params = ''
return reverse('oozie:list_oozie_workflow_action', kwargs={'action': self.id}) + extra_params
class CoordinatorAction(Action):
| 77 | 77 | 259 | 5 | 71 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | CoordinatorAction | CoordinatorAction | 174 | 216 | 174 | 174 | fa7921c3cf2ddcc2f1f7939e366f5cf994b1f1a8 | bigcode/the-stack | train |
ffc4fa5fc8ce03929be5c07b | train | class | class Coordinator(Job):
_ATTRS = [
'acl',
'actions',
'conf',
'concurrency',
'consoleUrl',
'coordExternalId',
'coordJobId',
'coordJobName',
'coordJobPath',
'endTime',
'executionPolicy',
'frequency',
'group',
'lastAction',
'mat_throttling',
'nextMaterializ... | class Coordinator(Job):
| _ATTRS = [
'acl',
'actions',
'conf',
'concurrency',
'consoleUrl',
'coordExternalId',
'coordJobId',
'coordJobName',
'coordJobPath',
'endTime',
'executionPolicy',
'frequency',
'group',
'lastAction',
'mat_throttling',
'nextMaterializedTime',
'pauseTime'... | zie_coordinator.id)
if hasattr(self, 'oozie_bundle') and self.oozie_bundle:
extra_params.append('bundle_job_id=%s' % self.oozie_bundle.id)
if extra_params:
extra_params = '?' + '&'.join(extra_params)
else:
extra_params = ''
return reverse('oozie:list_oozie_workflow', kwargs={'job_id'... | 209 | 209 | 699 | 4 | 205 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | Coordinator | Coordinator | 448 | 546 | 448 | 448 | 0935087d186393a8b11ae659753fabc797c3bddb | bigcode/the-stack | train |
ba6bdf781cd064ac28b9b6b8 | train | class | class BundleList(JobList):
def __init__(self, api, json_dict, filters=None):
super(BundleList, self).__init__(Bundle, 'bundlejobs', api, json_dict, filters)
| class BundleList(JobList):
| def __init__(self, api, json_dict, filters=None):
super(BundleList, self).__init__(Bundle, 'bundlejobs', api, json_dict, filters)
| Workflow, 'workflows', api, json_dict, filters)
class CoordinatorList(JobList):
def __init__(self, api, json_dict, filters=None):
super(CoordinatorList, self).__init__(Coordinator, 'coordinatorjobs', api, json_dict, filters)
class BundleList(JobList):
| 64 | 64 | 43 | 6 | 58 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | BundleList | BundleList | 639 | 641 | 639 | 639 | 8bbecac3643227bdb6281faf275b21630ba2ec32 | bigcode/the-stack | train |
e595dac9a57a54aa48d81a8f | train | class | class ControlFlowAction(Action):
_ATTRS = [
'errorMessage',
'status',
'stats',
'data',
'transition',
'externalStatus',
'cred',
'conf',
'type',
'endTime',
'externalId',
'id',
'startTime',
'externalChildIDs',
'name',
'errorCode',
'trackerUri',
'ret... | class ControlFlowAction(Action):
| _ATTRS = [
'errorMessage',
'status',
'stats',
'data',
'transition',
'externalStatus',
'cred',
'conf',
'type',
'endTime',
'externalId',
'id',
'startTime',
'externalChildIDs',
'name',
'errorCode',
'trackerUri',
'retries',
'toString',
'conso... | ', 'DONE')
@classmethod
def create(self, action_class, action_dict):
if ControlFlowAction.is_control_flow(action_dict.get('type')):
return ControlFlowAction(action_dict)
else:
return action_class(action_dict)
def __str__(self):
return '%s - %s' % (self.type, self.name)
class ControlFlowA... | 80 | 80 | 267 | 6 | 74 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | ControlFlowAction | ControlFlowAction | 64 | 110 | 64 | 64 | 99c68bead1ef7a5468bebf3678fdd22c7b728e4c | bigcode/the-stack | train |
929ee88ba2e6fc071ed75cb9 | train | class | class Job(object):
MAX_LOG_SIZE = 3500 * 20 # 20 pages
"""
Accessing log and definition will trigger Oozie API calls.
"""
def __init__(self, api, json_dict):
for attr in self._ATTRS:
setattr(self, attr, json_dict.get(attr))
self._fixup()
self._api = api
self._log = None
self._defin... | class Job(object):
| MAX_LOG_SIZE = 3500 * 20 # 20 pages
"""
Accessing log and definition will trigger Oozie API calls.
"""
def __init__(self, api, json_dict):
for attr in self._ATTRS:
setattr(self, attr, json_dict.get(attr))
self._fixup()
self._api = api
self._log = None
self._definition = None
def... | izedTime',
'coordExternalId',
'acl',
'lastAction',
'executionPolicy',
'timeZone',
'endTime'
]
def _fixup(self):
"""
Fixup:
- time fields as struct_time
- config dict
"""
super(BundleAction, self)._fixup()
self.type = 'coord-action'
self.name ... | 230 | 230 | 769 | 4 | 225 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | Job | Job | 278 | 379 | 278 | 278 | 0d66a44dd143218db893b1db10a4206436a54e90 | bigcode/the-stack | train |
e83b3dd43f1578cf82f533a4 | train | class | class WorkflowList(JobList):
def __init__(self, api, json_dict, filters=None):
super(WorkflowList, self).__init__(Workflow, 'workflows', api, json_dict, filters)
| class WorkflowList(JobList):
| def __init__(self, api, json_dict, filters=None):
super(WorkflowList, self).__init__(Workflow, 'workflows', api, json_dict, filters)
| """
self._api = api
self.offset = int(json_dict['offset'])
self.total = int(json_dict['total'])
self.jobs = [klass(self._api, wf_dict) for wf_dict in json_dict[jobs_key]]
self.filters = filters
class WorkflowList(JobList):
| 64 | 64 | 44 | 6 | 57 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | WorkflowList | WorkflowList | 629 | 631 | 629 | 629 | 8961edce2e6f8f1bcb505b55f1e68b262fa9ab5a | bigcode/the-stack | train |
46e0d318d4b260114744e9b3 | train | class | class Action(object):
def __init__(self, json_dict):
for attr in self._ATTRS:
setattr(self, attr, json_dict.get(attr))
self._fixup()
def _fixup(self): pass
def is_finished(self):
return self.status in ('OK', 'SUCCEEDED', 'DONE')
@classmethod
def create(self, action_class, action_dict):
... | class Action(object):
| def __init__(self, json_dict):
for attr in self._ATTRS:
setattr(self, attr, json_dict.get(attr))
self._fixup()
def _fixup(self): pass
def is_finished(self):
return self.status in ('OK', 'SUCCEEDED', 'DONE')
@classmethod
def create(self, action_class, action_dict):
if ControlFlowAction... | .lib import i18n
from desktop.lib.exceptions_renderable import PopupException
from desktop.log.access import access_warn
import hadoop.confparse
from liboozie.utils import parse_timestamp, format_time
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
class Action(object):... | 64 | 64 | 140 | 4 | 59 | lonely7345/hue | desktop/libs/liboozie/src/liboozie/types.py | Python | Action | Action | 41 | 61 | 41 | 42 | 363c1c2251088256d83aadd98d8050a0fe0271fd | bigcode/the-stack | train |
0d1192a6d47fb1bfabc7122b | train | function | def raise_if_not_started(fn):
def wrapper(self, *args, **kwargs):
if not self.started_status:
raise ValueError(
"Recorded must be started first, call `recorder.start()`"
)
return fn(self, *args, **kwargs)
return wrapper
| def raise_if_not_started(fn):
| def wrapper(self, *args, **kwargs):
if not self.started_status:
raise ValueError(
"Recorded must be started first, call `recorder.start()`"
)
return fn(self, *args, **kwargs)
return wrapper
| pandas as pd
import csv
from fcutils import path as fcpath
from fcutils.plot.figure import save_figure
from pyinspect.panels import Report
from myterial import salmon, green, green_light, blue_light, orange
from tpd import utils
def raise_if_not_started(fn):
| 64 | 64 | 62 | 7 | 56 | FedeClaudi/tape | tpd/core.py | Python | raise_if_not_started | raise_if_not_started | 23 | 31 | 23 | 23 | 77e522b0ffa1b55c048d94ca7e825aa9a16023b8 | bigcode/the-stack | train |
95165ba01522f71b52c30bde | train | class | class Recorder:
def __init__(self):
self.started_status = False
self.saved_figures = []
self.saved_data = []
self.folder = "not yet startd: call `recorder.start()...)`"
self.name = None
def __repr__(self):
return self.__str__()
def __str__(self):
ret... | class Recorder:
| def __init__(self):
self.started_status = False
self.saved_figures = []
self.saved_data = []
self.folder = "not yet startd: call `recorder.start()...)`"
self.name = None
def __repr__(self):
return self.__str__()
def __str__(self):
return f"Data Plots... | from pathlib import Path
from typing import Union
import numpy as np
from loguru import logger
from rich.logging import RichHandler
import matplotlib.pyplot as plt
from shutil import copyfile
from rich import print
from scipy.io import savemat
import json
import yaml
import pandas as pd
import csv
from fcutils import ... | 181 | 256 | 1,852 | 3 | 177 | FedeClaudi/tape | tpd/core.py | Python | Recorder | Recorder | 34 | 283 | 34 | 34 | 5411ade23ed4edd3b3c740ebde33edf24016df66 | bigcode/the-stack | train |
ac0ab7427bfb6f028c6dedee | train | function | def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
diagonal='hist', marker='.', density_kwds=None,
hist_kwds=None, range_padding=0.05, **kwds):
"""
Draw a matrix of scatter plots.
Parameters
----------
frame : DataFrame
alpha : float, o... | def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
diagonal='hist', marker='.', density_kwds=None,
hist_kwds=None, range_padding=0.05, **kwds):
| """
Draw a matrix of scatter plots.
Parameters
----------
frame : DataFrame
alpha : float, optional
amount of transparency applied
figsize : (float,float), optional
a tuple (width, height) in inches
ax : Matplotlib axis object, optional
grid : bool, optional
... | key = self._get_canonical_key(key)
if key in self._DEFAULT_KEYS:
raise ValueError('Cannot remove default parameter %s' % key)
return super(_Options, self).__delitem__(key)
def __contains__(self, key):
key = self._get_canonical_key(key)
return super(_Options, self).__con... | 256 | 256 | 1,048 | 50 | 206 | springcoil/pandas | pandas/tools/plotting.py | Python | scatter_matrix | scatter_matrix | 237 | 358 | 237 | 239 | 20d4a20d335af06b561f58c8668c28e79761b3fb | bigcode/the-stack | train |
da8d203378b8f4ace6bce9a6 | train | function | def _grouped_plot(plotf, data, column=None, by=None, numeric_only=True,
figsize=None, sharex=True, sharey=True, layout=None,
rot=0, ax=None, **kwargs):
from pandas import DataFrame
if figsize == 'default':
# allowed to specify mpl default with 'default'
warni... | def _grouped_plot(plotf, data, column=None, by=None, numeric_only=True,
figsize=None, sharex=True, sharey=True, layout=None,
rot=0, ax=None, **kwargs):
| from pandas import DataFrame
if figsize == 'default':
# allowed to specify mpl default with 'default'
warnings.warn("figsize='default' is deprecated. Specify figure"
"size by tuple instead", FutureWarning)
figsize = None
grouped = data.groupby(by)
if colum... | rot,
grid=grid, ax=ax, figsize=figsize, layout=layout, **kwds)
return ret
def _grouped_plot(plotf, data, column=None, by=None, numeric_only=True,
figsize=None, sharex=True, sharey=True, layout=None,
rot=0, ax=None, **kwargs):
| 73 | 73 | 245 | 46 | 26 | springcoil/pandas | pandas/tools/plotting.py | Python | _grouped_plot | _grouped_plot | 2,982 | 3,011 | 2,982 | 2,984 | a5f41bb8e44b4d9a42a4e00d369a633b871ea8ee | bigcode/the-stack | train |
addc6637862b91f837298349 | train | function | @deprecate_kwarg(old_arg_name='colors', new_arg_name='color')
@deprecate_kwarg(old_arg_name='data', new_arg_name='frame')
def parallel_coordinates(frame, class_column, cols=None, ax=None, color=None,
use_columns=False, xticks=None, colormap=None,
axvlines=True, **kwds):... | @deprecate_kwarg(old_arg_name='colors', new_arg_name='color')
@deprecate_kwarg(old_arg_name='data', new_arg_name='frame')
def parallel_coordinates(frame, class_column, cols=None, ax=None, color=None,
use_columns=False, xticks=None, colormap=None,
axvlines=True, **kwds):... | """Parallel coordinates plotting.
Parameters
----------
frame: DataFrame
class_column: str
Column name containing class names
cols: list, optional
A list of column names to use
ax: matplotlib.axis, optional
matplotlib axis object
color: list or tuple, optional
... | .add_subplot(2, 3, 4)
ax4.set_xlabel("Mean")
axes.append(ax4)
ax4.hist(means, **kwds)
ax5 = fig.add_subplot(2, 3, 5)
ax5.set_xlabel("Median")
axes.append(ax5)
ax5.hist(medians, **kwds)
ax6 = fig.add_subplot(2, 3, 6)
ax6.set_xlabel("Midrange")
axes.append(ax6)
ax6.hist(midrang... | 233 | 233 | 778 | 76 | 156 | springcoil/pandas | pandas/tools/plotting.py | Python | parallel_coordinates | parallel_coordinates | 594 | 693 | 594 | 598 | 81022a0caf73cf1a2f61c7065f568d055881321c | bigcode/the-stack | train |
05d0241ebeebe867fd18c6de | train | class | class HexBinPlot(MPLPlot):
_kind = 'hexbin'
_layout_type = 'single'
def __init__(self, data, x, y, C=None, **kwargs):
MPLPlot.__init__(self, data, **kwargs)
if x is None or y is None:
raise ValueError('hexbin requires and x and y column')
if com.is_integer(x) and not se... | class HexBinPlot(MPLPlot):
| _kind = 'hexbin'
_layout_type = 'single'
def __init__(self, data, x, y, C=None, **kwargs):
MPLPlot.__init__(self, data, **kwargs)
if x is None or y is None:
raise ValueError('hexbin requires and x and y column')
if com.is_integer(x) and not self.data.columns.holds_integ... | ) > 0 or len(errors_y) > 0:
err_kwds = dict(errors_x, **errors_y)
err_kwds['ecolor'] = scatter.get_facecolor()[0]
ax.errorbar(data[x].values, data[y].values, linestyle='none', **err_kwds)
def _post_plot_logic(self):
ax = self.axes[0]
x, y = self.x, self.y
... | 122 | 122 | 408 | 8 | 114 | springcoil/pandas | pandas/tools/plotting.py | Python | HexBinPlot | HexBinPlot | 1,501 | 1,554 | 1,501 | 1,501 | e481b9baace9912a15c9789da848fa76fd219907 | bigcode/the-stack | train |
74c08661052af9422aeb256a | train | function | def _flatten(axes):
if not com.is_list_like(axes):
return np.array([axes])
elif isinstance(axes, (np.ndarray, Index)):
return axes.ravel()
return np.array(axes)
| def _flatten(axes):
| if not com.is_list_like(axes):
return np.array([axes])
elif isinstance(axes, (np.ndarray, Index)):
return axes.ravel()
return np.array(axes)
| get y labels -> set all other to off
# as we only have labels in teh first column and we always have a subplot there,
# we can skip the layout test
if ax.is_first_col():
continue
_remove_ylables_from_axis(ax)
def _flatten(axes):
| 64 | 64 | 48 | 6 | 58 | springcoil/pandas | pandas/tools/plotting.py | Python | _flatten | _flatten | 3,356 | 3,361 | 3,356 | 3,356 | fe84af46c8c2f5715ffa2a23bc69e422ad26dd3c | bigcode/the-stack | train |
8436f823094b6a2ca49a193f | train | function | def radviz(frame, class_column, ax=None, color=None, colormap=None, **kwds):
"""RadViz - a multivariate data visualization algorithm
Parameters:
-----------
frame: DataFrame
class_column: str
Column name containing class names
ax: Matplotlib axis object, optional
color: list or tupl... | def radviz(frame, class_column, ax=None, color=None, colormap=None, **kwds):
| """RadViz - a multivariate data visualization algorithm
Parameters:
-----------
frame: DataFrame
class_column: str
Column name containing class names
ax: Matplotlib axis object, optional
color: list or tuple, optional
Colors to use for the different classes
colormap : st... | lim0 = axes[0][0].get_ylim()
adj = adj * (lim0[1] - lim0[0]) + lim0[0]
axes[0][0].yaxis.set_ticks(adj)
if np.all(locs == locs.astype(int)):
# if all ticks are int
locs = locs.astype(int)
axes[0][0].yaxis.set_ticklabels(locs)
_set_ticks_props(axes, xl... | 248 | 248 | 827 | 22 | 225 | springcoil/pandas | pandas/tools/plotting.py | Python | radviz | radviz | 379 | 461 | 379 | 379 | 86dc127abd0f118c3eb8ae96571d21b92718ac7d | bigcode/the-stack | train |
3d1e015f9f5f5b6504fc9e54 | train | function | def _plot(data, x=None, y=None, subplots=False,
ax=None, kind='line', **kwds):
kind = _get_standard_kind(kind.lower().strip())
if kind in _all_kinds:
klass = _plot_klass[kind]
else:
raise ValueError("%r is not a valid plot kind" % kind)
from pandas import DataFrame
if kind... | def _plot(data, x=None, y=None, subplots=False,
ax=None, kind='line', **kwds):
| kind = _get_standard_kind(kind.lower().strip())
if kind in _all_kinds:
klass = _plot_klass[kind]
else:
raise ValueError("%r is not a valid plot kind" % kind)
from pandas import DataFrame
if kind in _dataframe_kinds:
if isinstance(data, DataFrame):
plot_obj = klas... | density', 'area', 'hist', 'box']
# kinds supported by dataframe
_dataframe_kinds = ['scatter', 'hexbin']
# kinds supported only by series or dataframe single column
_series_kinds = ['pie']
_all_kinds = _common_kinds + _dataframe_kinds + _series_kinds
_klasses = [LinePlot, BarPlot, BarhPlot, KdePlot, HistPlot, BoxPlot,... | 157 | 157 | 524 | 27 | 129 | springcoil/pandas | pandas/tools/plotting.py | Python | _plot | _plot | 2,279 | 2,335 | 2,279 | 2,280 | 37f6e5665577d0bf4ed557912509c7578d78b6a5 | bigcode/the-stack | train |
6347b292c6e52450c4f6f4df | train | function | def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds):
"""Bootstrap plot.
Parameters:
-----------
series: Time series
fig: matplotlib figure object, optional
size: number of data points to consider during each sampling
samples: number of times the bootstrap procedure is perform... | def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds):
| """Bootstrap plot.
Parameters:
-----------
series: Time series
fig: matplotlib figure object, optional
size: number of data points to consider during each sampling
samples: number of times the bootstrap procedure is performed
kwds: optional keyword arguments for plotting commands, must ... | ax = plt.gca(xlim=(-pi, pi))
for i in range(n):
row = df.iloc[i].values
f = function(row)
y = [f(t) for t in x]
kls = class_col.iat[i]
label = com.pprint_thing(kls)
if label not in used_legends:
used_legends.add(label)
ax.plot(x, y, col... | 161 | 161 | 539 | 20 | 140 | springcoil/pandas | pandas/tools/plotting.py | Python | bootstrap_plot | bootstrap_plot | 534 | 592 | 534 | 534 | 6591da0c681e877848a55dafdb4698ca9c3cdde1 | bigcode/the-stack | train |
ea9d06464deb0a6cf25d35aa | train | function | def _get_marker_compat(marker):
import matplotlib.lines as mlines
import matplotlib as mpl
if mpl.__version__ < '1.1.0' and marker == '.':
return 'o'
if marker not in mlines.lineMarkers:
return 'o'
return marker
| def _get_marker_compat(marker):
| import matplotlib.lines as mlines
import matplotlib as mpl
if mpl.__version__ < '1.1.0' and marker == '.':
return 'o'
if marker not in mlines.lineMarkers:
return 'o'
return marker
| , xrot=90, ylabelsize=8, yrot=0)
return axes
def _gca():
import matplotlib.pyplot as plt
return plt.gca()
def _gcf():
import matplotlib.pyplot as plt
return plt.gcf()
def _get_marker_compat(marker):
| 64 | 64 | 65 | 8 | 56 | springcoil/pandas | pandas/tools/plotting.py | Python | _get_marker_compat | _get_marker_compat | 370 | 377 | 370 | 370 | 66ba6674070b94363716fdb4877ba5ac55a48a03 | bigcode/the-stack | train |
94fb0e5f6b1c58ce45bbc8a5 | train | function | @deprecate_kwarg(old_arg_name='data', new_arg_name='frame')
def andrews_curves(frame, class_column, ax=None, samples=200, color=None,
colormap=None, **kwds):
"""
Parameters:
-----------
frame : DataFrame
Data to be plotted, preferably normalized to (0.0, 1.0)
class_column ... | @deprecate_kwarg(old_arg_name='data', new_arg_name='frame')
def andrews_curves(frame, class_column, ax=None, samples=200, color=None,
colormap=None, **kwds):
| """
Parameters:
-----------
frame : DataFrame
Data to be plotted, preferably normalized to (0.0, 1.0)
class_column : Name of the column containing class names
ax : matplotlib axes object, default None
samples : Number of points to plot in each curve
color: list or tuple, optional... | size='small')
elif xy[0] >= 0.0 and xy[1] < 0.0:
ax.text(xy[0] + 0.025, xy[1] - 0.025, name,
ha='left', va='top', size='small')
elif xy[0] >= 0.0 and xy[1] >= 0.0:
ax.text(xy[0] + 0.025, xy[1] + 0.025, name,
ha='left', va='bottom', size='s... | 183 | 183 | 612 | 47 | 135 | springcoil/pandas | pandas/tools/plotting.py | Python | andrews_curves | andrews_curves | 463 | 531 | 463 | 465 | b72acd3afb225889483c3bd0338c5a9ed96cd8f6 | bigcode/the-stack | train |
d136e414d8aafd2e93a07439 | train | function | def scatter_plot(data, x, y, by=None, ax=None, figsize=None, grid=False,
**kwargs):
"""
Make a scatter plot from two DataFrame columns
Parameters
----------
data : DataFrame
x : Column name for the x-axis values
y : Column name for the y-axis values
ax : Matplotlib axis... | def scatter_plot(data, x, y, by=None, ax=None, figsize=None, grid=False,
**kwargs):
| """
Make a scatter plot from two DataFrame columns
Parameters
----------
data : DataFrame
x : Column name for the x-axis values
y : Column name for the y-axis values
ax : Matplotlib axis object
figsize : A tuple (width, height) in inches
grid : Setting this to True will show the... | , rot):
# mini version of autofmt_xdate
try:
for label in ax.get_xticklabels():
label.set_ha('right')
label.set_rotation(rot)
fig = ax.get_figure()
fig.subplots_adjust(bottom=0.2)
except Exception: # pragma: no cover
pass
def scatter_plot(data, x, y, ... | 96 | 96 | 321 | 25 | 70 | springcoil/pandas | pandas/tools/plotting.py | Python | scatter_plot | scatter_plot | 2,670 | 2,715 | 2,670 | 2,671 | ddbd1757fdb2285daa624c55f7bb7e35920c39e8 | bigcode/the-stack | train |
a93e2ddb8cd932f4c9c92b38 | train | function | def lag_plot(series, lag=1, ax=None, **kwds):
"""Lag plot for time series.
Parameters:
-----------
series: Time series
lag: lag of the scatter plot, default 1
ax: Matplotlib axis object, optional
kwds: Matplotlib scatter method keyword arguments, optional
Returns:
--------
ax: ... | def lag_plot(series, lag=1, ax=None, **kwds):
| """Lag plot for time series.
Parameters:
-----------
series: Time series
lag: lag of the scatter plot, default 1
ax: Matplotlib axis object, optional
kwds: Matplotlib scatter method keyword arguments, optional
Returns:
--------
ax: Matplotlib axis object
"""
import matp... | , color='black')
ax.set_xticks(x)
ax.set_xticklabels(df.columns)
ax.set_xlim(x[0], x[-1])
ax.legend(loc='upper right')
ax.grid()
return ax
def lag_plot(series, lag=1, ax=None, **kwds):
| 64 | 64 | 203 | 16 | 47 | springcoil/pandas | pandas/tools/plotting.py | Python | lag_plot | lag_plot | 696 | 723 | 696 | 696 | 57215c07292768641efd779bb3161d716aab6e0d | bigcode/the-stack | train |
68810b5b3ced437796fdd223 | train | function | def table(ax, data, rowLabels=None, colLabels=None,
**kwargs):
"""
Helper function to convert DataFrame and Series to matplotlib.table
Parameters
----------
`ax`: Matplotlib axes object
`data`: DataFrame or Series
data for table contents
`kwargs`: keywords, optional
... | def table(ax, data, rowLabels=None, colLabels=None,
**kwargs):
| """
Helper function to convert DataFrame and Series to matplotlib.table
Parameters
----------
`ax`: Matplotlib axes object
`data`: DataFrame or Series
data for table contents
`kwargs`: keywords, optional
keyword arguments which passed to matplotlib.table.table.
If `r... | .suptitle('Boxplot grouped by %s' % byline)
fig.subplots_adjust(bottom=0.15, top=0.9, left=0.1, right=0.9, wspace=0.2)
return result
def table(ax, data, rowLabels=None, colLabels=None,
**kwargs):
| 72 | 72 | 243 | 18 | 53 | springcoil/pandas | pandas/tools/plotting.py | Python | table | table | 3,051 | 3,089 | 3,051 | 3,053 | 80e24b8a78d2ef9cfdd0cb7166b2b88dc15e6ca8 | bigcode/the-stack | train |
d3acdd9befe00c2904f60bfd | train | function | def grouped_hist(data, column=None, by=None, ax=None, bins=50, figsize=None,
layout=None, sharex=False, sharey=False, rot=90, grid=True,
xlabelsize=None, xrot=None, ylabelsize=None, yrot=None,
**kwargs):
"""
Grouped histogram
Parameters
----------
... | def grouped_hist(data, column=None, by=None, ax=None, bins=50, figsize=None,
layout=None, sharex=False, sharey=False, rot=90, grid=True,
xlabelsize=None, xrot=None, ylabelsize=None, yrot=None,
**kwargs):
| """
Grouped histogram
Parameters
----------
data: Series/DataFrame
column: object, optional
by: object, optional
ax: axes, optional
bins: int, default 50
figsize: tuple, optional
layout: optional
sharex: boolean, default False
sharey: boolean, default False
rot: ... | rot,
**kwds)
if hasattr(axes, 'ndim'):
if axes.ndim == 1 and len(axes) == 1:
return axes[0]
return axes
def grouped_hist(data, column=None, by=None, ax=None, bins=50, figsize=None,
layout=None, sharex=False, sharey=False, rot=90, grid=True,
... | 105 | 105 | 351 | 61 | 43 | springcoil/pandas | pandas/tools/plotting.py | Python | grouped_hist | grouped_hist | 2,864 | 2,904 | 2,864 | 2,867 | ecff3eeb059fcffdd13fe42d9eb42c28a2b631e6 | bigcode/the-stack | train |
e4ad99900c19b6ce6622c130 | train | function | def _gcf():
import matplotlib.pyplot as plt
return plt.gcf()
| def _gcf():
| import matplotlib.pyplot as plt
return plt.gcf()
| ].yaxis.set_ticklabels(locs)
_set_ticks_props(axes, xlabelsize=8, xrot=90, ylabelsize=8, yrot=0)
return axes
def _gca():
import matplotlib.pyplot as plt
return plt.gca()
def _gcf():
| 64 | 64 | 18 | 5 | 59 | springcoil/pandas | pandas/tools/plotting.py | Python | _gcf | _gcf | 366 | 368 | 366 | 366 | 7122c9d8454d9f04e56b2993d516ce27650c5286 | bigcode/the-stack | train |
7b077408f5ae4d66bcf523ce | train | function | def _remove_ylables_from_axis(ax):
for label in ax.get_yticklabels():
label.set_visible(False)
try:
import matplotlib.ticker as ticker
if isinstance(ax.yaxis.get_minor_locator(), ticker.NullLocator):
ax.yaxis.set_minor_locator(ticker.AutoLocator())
if isinstance(ax.ya... | def _remove_ylables_from_axis(ax):
| for label in ax.get_yticklabels():
label.set_visible(False)
try:
import matplotlib.ticker as ticker
if isinstance(ax.yaxis.get_minor_locator(), ticker.NullLocator):
ax.yaxis.set_minor_locator(ticker.AutoLocator())
if isinstance(ax.yaxis.get_minor_formatter(), ticker.N... | .xaxis.set_minor_formatter(ticker.FormatStrFormatter(''))
for label in ax.get_xticklabels(minor=True):
label.set_visible(False)
except Exception: # pragma no cover
pass
ax.xaxis.get_label().set_visible(False)
def _remove_ylables_from_axis(ax):
| 64 | 64 | 134 | 10 | 54 | springcoil/pandas | pandas/tools/plotting.py | Python | _remove_ylables_from_axis | _remove_ylables_from_axis | 3,314 | 3,327 | 3,314 | 3,314 | 365d223ccae88f5ea2398d56911201bf977d19e4 | bigcode/the-stack | train |
585095fab658774bb89468dd | train | class | class _Options(dict):
"""
Stores pandas plotting options.
Allows for parameter aliasing so you can just use parameter names that are
the same as the plot function parameters, but is stored in a canonical
format that makes it easy to breakdown into groups later
"""
# alias so the names are s... | class _Options(dict):
| """
Stores pandas plotting options.
Allows for parameter aliasing so you can just use parameter names that are
the same as the plot function parameters, but is stored in a canonical
format that makes it easy to breakdown into groups later
"""
# alias so the names are same as plotting method... | . Specify each color using a list "
"like ['{0}'] or {1}")
raise ValueError(msg.format(colors, list(colors)))
elif maybe_single_color:
colors = [colors]
else:
# ``colors`` is regarded as color cycle.
# mpl will raise error any of them is... | 126 | 126 | 420 | 5 | 120 | springcoil/pandas | pandas/tools/plotting.py | Python | _Options | _Options | 172 | 231 | 172 | 172 | e8aec8967aef4559092790542b67ab6bc4917278 | bigcode/the-stack | train |
1ad9a42bdfb85e1f9856ed04 | train | function | def _remove_xlabels_from_axis(ax):
for label in ax.get_xticklabels():
label.set_visible(False)
try:
# set_visible will not be effective if
# minor axis has NullLocator and NullFormattor (default)
import matplotlib.ticker as ticker
if isinstance(ax.xaxis.get_minor_locator... | def _remove_xlabels_from_axis(ax):
| for label in ax.get_xticklabels():
label.set_visible(False)
try:
# set_visible will not be effective if
# minor axis has NullLocator and NullFormattor (default)
import matplotlib.ticker as ticker
if isinstance(ax.xaxis.get_minor_locator(), ticker.NullLocator):
... | = axarr.reshape(nrows, ncols).squeeze()
else:
# returned axis array will be always 2-d, even if nrows=ncols=1
axes = axarr.reshape(nrows, ncols)
return fig, axes
def _remove_xlabels_from_axis(ax):
| 64 | 64 | 156 | 9 | 54 | springcoil/pandas | pandas/tools/plotting.py | Python | _remove_xlabels_from_axis | _remove_xlabels_from_axis | 3,296 | 3,312 | 3,296 | 3,296 | efe211ac4139b0a9b3a70d19f4a59fb8ed86f2e4 | bigcode/the-stack | train |
7175e6b41a8df6db614f9065 | train | function | def _get_xlim(lines):
left, right = np.inf, -np.inf
for l in lines:
x = l.get_xdata(orig=False)
left = min(x[0], left)
right = max(x[-1], right)
return left, right
| def _get_xlim(lines):
| left, right = np.inf, -np.inf
for l in lines:
x = l.get_xdata(orig=False)
left = min(x[0], left)
right = max(x[-1], right)
return left, right
| .array(axes)
def _get_all_lines(ax):
lines = ax.get_lines()
if hasattr(ax, 'right_ax'):
lines += ax.right_ax.get_lines()
if hasattr(ax, 'left_ax'):
lines += ax.left_ax.get_lines()
return lines
def _get_xlim(lines):
| 64 | 64 | 60 | 6 | 57 | springcoil/pandas | pandas/tools/plotting.py | Python | _get_xlim | _get_xlim | 3,376 | 3,382 | 3,376 | 3,376 | f8b4910c12e49e16f367aa1a25f7a36522aa5d01 | bigcode/the-stack | train |
0f8a63209b00878fe2605ea2 | train | function | @Appender(_shared_docs['plot'] % _shared_doc_series_kwargs)
def plot_series(data, kind='line', ax=None, # Series unique
figsize=None, use_index=True, title=None, grid=None,
legend=False, style=None, logx=False, logy=False, loglog=False,
xticks=None, yti... | @Appender(_shared_docs['plot'] % _shared_doc_series_kwargs)
def plot_series(data, kind='line', ax=None, # Series unique
figsize=None, use_index=True, title=None, grid=None,
legend=False, style=None, logx=False, logy=False, loglog=False,
xticks=None, yti... | import matplotlib.pyplot as plt
"""
If no axes is specified, check whether there are existing figures
If there is no existing figures, _gca() will
create a figure with the default figsize, causing the figsize=parameter to
be ignored.
"""
if ax is None and len(plt.get_fignums()) > 0:
... | @Appender(_shared_docs['plot'] % _shared_doc_series_kwargs)
def plot_series(data, kind='line', ax=None, # Series unique
figsize=None, use_index=True, title=None, grid=None,
legend=False, style=None, logx=False, logy=False, loglog=False,
xticks=None, yti... | 122 | 103 | 346 | 122 | 0 | springcoil/pandas | pandas/tools/plotting.py | Python | plot_series | plot_series | 2,500 | 2,528 | 2,500 | 2,509 | 770c09342af7a5c809d3ca8aed5b59c00ce2a93e | bigcode/the-stack | train |
3849995c3544959d56b23e42 | train | function | def _get_layout(nplots, layout=None, layout_type='box'):
if layout is not None:
if not isinstance(layout, (tuple, list)) or len(layout) != 2:
raise ValueError('Layout must be a tuple of (rows, columns)')
nrows, ncols = layout
# Python 2 compat
ceil_ = lambda x: int(ceil... | def _get_layout(nplots, layout=None, layout_type='box'):
| if layout is not None:
if not isinstance(layout, (tuple, list)) or len(layout) != 2:
raise ValueError('Layout must be a tuple of (rows, columns)')
nrows, ncols = layout
# Python 2 compat
ceil_ = lambda x: int(ceil(x))
if nrows == -1 and ncols >0:
lay... | .name])
elif isinstance(data, DataFrame):
pass
else:
raise ValueError('Input data must be DataFrame or Series')
if rowLabels is None:
rowLabels = data.index
if colLabels is None:
colLabels = data.columns
cellText = data.values
import matplotlib.table
table... | 118 | 118 | 396 | 15 | 102 | springcoil/pandas | pandas/tools/plotting.py | Python | _get_layout | _get_layout | 3,092 | 3,133 | 3,092 | 3,092 | 8f869cb514df091d05d22aeb97dbd80a948fe9e8 | bigcode/the-stack | train |
80207a5b2959db0eca8a9fde | train | function | def format_date_labels(ax, rot):
# mini version of autofmt_xdate
try:
for label in ax.get_xticklabels():
label.set_ha('right')
label.set_rotation(rot)
fig = ax.get_figure()
fig.subplots_adjust(bottom=0.2)
except Exception: # pragma: no cover
pass
| def format_date_labels(ax, rot):
# mini version of autofmt_xdate
| try:
for label in ax.get_xticklabels():
label.set_ha('right')
label.set_rotation(rot)
fig = ax.get_figure()
fig.subplots_adjust(bottom=0.2)
except Exception: # pragma: no cover
pass
| _data()
if columns is None:
columns = data.columns
else:
data = data[columns]
result = plot_group(columns, data.values.T, ax)
ax.grid(grid)
return result
def format_date_labels(ax, rot):
# mini version of autofmt_xdate
| 64 | 64 | 76 | 18 | 45 | springcoil/pandas | pandas/tools/plotting.py | Python | format_date_labels | format_date_labels | 2,658 | 2,667 | 2,658 | 2,659 | a919a9e034b50926103a7f5fe1853e3b134e361b | bigcode/the-stack | train |
f9f7a35fac4f2c3f09cbd921 | train | class | class MPLPlot(object):
"""
Base class for assembling a pandas plot using matplotlib
Parameters
----------
data :
"""
_kind = 'base'
_layout_type = 'vertical'
_default_rot = 0
orientation = None
_pop_attributes = ['label', 'style', 'logy', 'logx', 'loglog',
... | class MPLPlot(object):
| """
Base class for assembling a pandas plot using matplotlib
Parameters
----------
data :
"""
_kind = 'base'
_layout_type = 'vertical'
_default_rot = 0
orientation = None
_pop_attributes = ['label', 'style', 'logy', 'logx', 'loglog',
'mark_right', 's... | 0))
mean = np.mean(data)
c0 = np.sum((data - mean) ** 2) / float(n)
def r(h):
return ((data[:n - h] - mean) * (data[h:] - mean)).sum() / float(n) / c0
x = np.arange(n) + 1
y = lmap(r, x)
z95 = 1.959963984540054
z99 = 2.5758293035489004
ax.axhline(y=z99 / np.sqrt(n), linestyle='-... | 256 | 256 | 4,823 | 5 | 250 | springcoil/pandas | pandas/tools/plotting.py | Python | MPLPlot | MPLPlot | 768 | 1,420 | 768 | 768 | 1486a4c02901c05331fcda9564b121256a0b3aab | bigcode/the-stack | train |
996f442ed4f68b28ca108aef | train | class | class BarhPlot(BarPlot):
_kind = 'barh'
_default_rot = 0
orientation = 'horizontal'
@property
def _start_base(self):
return self.left
@classmethod
def _plot(cls, ax, x, y, w, start=0, log=False, **kwds):
return ax.barh(x, y, w, left=start, log=log, **kwds)
def _decorat... | class BarhPlot(BarPlot):
| _kind = 'barh'
_default_rot = 0
orientation = 'horizontal'
@property
def _start_base(self):
return self.left
@classmethod
def _plot(cls, ax, x, y, w, start=0, log=False, **kwds):
return ax.barh(x, y, w, left=start, log=log, **kwds)
def _decorate_ticks(self, ax, name, t... | name, ticklabels, start_edge, end_edge):
ax.set_xlim((start_edge, end_edge))
ax.set_xticks(self.tick_pos)
ax.set_xticklabels(ticklabels)
if name is not None and self.use_index:
ax.set_xlabel(name)
class BarhPlot(BarPlot):
| 64 | 64 | 169 | 8 | 56 | springcoil/pandas | pandas/tools/plotting.py | Python | BarhPlot | BarhPlot | 1,890 | 1,909 | 1,890 | 1,890 | 36474a885e0629ce37577b6d20a6d56f540f2225 | bigcode/the-stack | train |
fbda9df7f2c70c342220e4d6 | train | function | def _grouped_plot_by_column(plotf, data, columns=None, by=None,
numeric_only=True, grid=False,
figsize=None, ax=None, layout=None, return_type=None,
**kwargs):
grouped = data.groupby(by)
if columns is None:
if not isinst... | def _grouped_plot_by_column(plotf, data, columns=None, by=None,
numeric_only=True, grid=False,
figsize=None, ax=None, layout=None, return_type=None,
**kwargs):
| grouped = data.groupby(by)
if columns is None:
if not isinstance(by, (list, tuple)):
by = [by]
columns = data._get_numeric_data().columns.difference(by)
naxes = len(columns)
fig, axes = _subplots(naxes=naxes, sharex=True, sharey=True,
figsize=figsize... | ax = _axes[i]
if numeric_only and isinstance(group, DataFrame):
group = group._get_numeric_data()
plotf(group, ax, **kwargs)
ax.set_title(com.pprint_thing(key))
return fig, axes
def _grouped_plot_by_column(plotf, data, columns=None, by=None,
n... | 98 | 98 | 328 | 44 | 53 | springcoil/pandas | pandas/tools/plotting.py | Python | _grouped_plot_by_column | _grouped_plot_by_column | 3,014 | 3,048 | 3,014 | 3,017 | 53995ecfc0f40795d285f8be1aa455cfef570f98 | bigcode/the-stack | train |
48dae59091529c625752953d | train | function | def _set_ticks_props(axes, xlabelsize=None, xrot=None,
ylabelsize=None, yrot=None):
import matplotlib.pyplot as plt
for ax in _flatten(axes):
if xlabelsize is not None:
plt.setp(ax.get_xticklabels(), fontsize=xlabelsize)
if xrot is not None:
plt.setp... | def _set_ticks_props(axes, xlabelsize=None, xrot=None,
ylabelsize=None, yrot=None):
| import matplotlib.pyplot as plt
for ax in _flatten(axes):
if xlabelsize is not None:
plt.setp(ax.get_xticklabels(), fontsize=xlabelsize)
if xrot is not None:
plt.setp(ax.get_xticklabels(), rotation=xrot)
if ylabelsize is not None:
plt.setp(ax.get_ytic... | in lines:
x = l.get_xdata(orig=False)
left = min(x[0], left)
right = max(x[-1], right)
return left, right
def _set_ticks_props(axes, xlabelsize=None, xrot=None,
ylabelsize=None, yrot=None):
| 64 | 64 | 133 | 25 | 38 | springcoil/pandas | pandas/tools/plotting.py | Python | _set_ticks_props | _set_ticks_props | 3,385 | 3,398 | 3,385 | 3,386 | 36dd949d23788b9869a1b9238e47d75534ca4111 | bigcode/the-stack | train |
630cddb2508ff165b1b03b43 | train | class | class KdePlot(HistPlot):
_kind = 'kde'
orientation = 'vertical'
def __init__(self, data, bw_method=None, ind=None, **kwargs):
MPLPlot.__init__(self, data, **kwargs)
self.bw_method = bw_method
self.ind = ind
def _args_adjust(self):
pass
def _get_ind(self, y):
... | class KdePlot(HistPlot):
| _kind = 'kde'
orientation = 'vertical'
def __init__(self, data, bw_method=None, ind=None, **kwargs):
MPLPlot.__init__(self, data, **kwargs)
self.bw_method = bw_method
self.ind = ind
def _args_adjust(self):
pass
def _get_ind(self, y):
if self.ind is None:
... | KdePlot
kwds['bottom'] = self.bottom
kwds['bins'] = self.bins
return kwds
def _post_plot_logic(self):
if self.orientation == 'horizontal':
for ax in self.axes:
ax.set_xlabel('Frequency')
else:
for ax in self.axes:
ax.s... | 122 | 122 | 408 | 8 | 114 | springcoil/pandas | pandas/tools/plotting.py | Python | KdePlot | KdePlot | 1,994 | 2,043 | 1,994 | 1,994 | 9cbe5b18ce78aecc444abf0e12a2200543ab598b | bigcode/the-stack | train |
2832438d2cf7597cc489275c | train | function | def _subplots(naxes=None, sharex=False, sharey=False, squeeze=True,
subplot_kw=None, ax=None, layout=None, layout_type='box', **fig_kw):
"""Create a figure with a set of subplots already made.
This utility wrapper makes it convenient to create common layouts of
subplots, including the enclosi... | def _subplots(naxes=None, sharex=False, sharey=False, squeeze=True,
subplot_kw=None, ax=None, layout=None, layout_type='box', **fig_kw):
| """Create a figure with a set of subplots already made.
This utility wrapper makes it convenient to create common layouts of
subplots, including the enclosing figure object, in a single call.
Keyword arguments:
naxes : int
Number of required axes. Exceeded axes are set invisible. Default is... | if nrows * ncols < nplots:
raise ValueError('Layout of %sx%s must be larger than required size %s' %
(nrows, ncols, nplots))
return layout
if layout_type == 'single':
return (1, 1)
elif layout_type == 'horizontal':
return (1, nplots)
elif layout_type ==... | 256 | 256 | 1,392 | 39 | 216 | springcoil/pandas | pandas/tools/plotting.py | Python | _subplots | _subplots | 3,138 | 3,294 | 3,138 | 3,139 | 0bfb04b3d978d2b78fb9ef920ff680ecb235e899 | bigcode/the-stack | train |
db00706034b74ecab2d5dbee | train | function | @Appender(_shared_docs['plot'] % _shared_doc_df_kwargs)
def plot_frame(data, x=None, y=None, kind='line', ax=None, # Dataframe unique
subplots=False, sharex=None, sharey=False, layout=None, # Dataframe unique
figsize=None, use_index=True, title=None, grid=None,
... | @Appender(_shared_docs['plot'] % _shared_doc_df_kwargs)
def plot_frame(data, x=None, y=None, kind='line', ax=None, # Dataframe unique
subplots=False, sharex=None, sharey=False, layout=None, # Dataframe unique
figsize=None, use_index=True, title=None, grid=None,
... | return _plot(data, kind=kind, x=x, y=y, ax=ax,
subplots=subplots, sharex=sharex, sharey=sharey,
layout=layout, figsize=figsize, use_index=use_index,
title=title, grid=grid, legend=legend,
style=style, logx=logx, logy=logy, loglog=loglog,
... | @Appender(_shared_docs['plot'] % _shared_doc_df_kwargs)
def plot_frame(data, x=None, y=None, kind='line', ax=None, # Dataframe unique
subplots=False, sharex=None, sharey=False, layout=None, # Dataframe unique
figsize=None, use_index=True, title=None, grid=None,
... | 153 | 93 | 312 | 153 | 0 | springcoil/pandas | pandas/tools/plotting.py | Python | plot_frame | plot_frame | 2,478 | 2,497 | 2,478 | 2,487 | 8ef2101721c06ff435ea1da6ae8ff5be77e5db74 | bigcode/the-stack | train |
a7ca08e89efeae6b234383da | train | function | @Appender(_shared_docs['boxplot'] % _shared_doc_kwargs)
def boxplot(data, column=None, by=None, ax=None, fontsize=None,
rot=0, grid=True, figsize=None, layout=None, return_type=None,
**kwds):
# validate return_type:
if return_type not in BoxPlot._valid_return_types:
raise ValueE... | @Appender(_shared_docs['boxplot'] % _shared_doc_kwargs)
def boxplot(data, column=None, by=None, ax=None, fontsize=None,
rot=0, grid=True, figsize=None, layout=None, return_type=None,
**kwds):
# validate return_type:
| if return_type not in BoxPlot._valid_return_types:
raise ValueError("return_type must be {None, 'axes', 'dict', 'both'}")
from pandas import Series, DataFrame
if isinstance(data, Series):
data = DataFrame({'x': data})
column = 'x'
def _get_colors():
return _get_standard... | 'both' returns a namedtuple with the axes and dict.
When grouping with ``by``, a dict mapping columns to ``return_type``
is returned.
kwds : other plotting keyword arguments to be passed to matplotlib boxplot
function
Returns
-------
lines : dict
ax : matplotlib Axes
... | 202 | 203 | 677 | 61 | 141 | springcoil/pandas | pandas/tools/plotting.py | Python | boxplot | boxplot | 2,575 | 2,655 | 2,575 | 2,580 | 82d74f6bf8367e86efc36014246340d826faae41 | bigcode/the-stack | train |
74ac87d1fb310075d6be6453 | train | class | class AreaPlot(LinePlot):
_kind = 'area'
def __init__(self, data, **kwargs):
kwargs.setdefault('stacked', True)
data = data.fillna(value=0)
LinePlot.__init__(self, data, **kwargs)
if not self.stacked:
# use smaller alpha to distinguish overlap
self.kwds.... | class AreaPlot(LinePlot):
| _kind = 'area'
def __init__(self, data, **kwargs):
kwargs.setdefault('stacked', True)
data = data.fillna(value=0)
LinePlot.__init__(self, data, **kwargs)
if not self.stacked:
# use smaller alpha to distinguish overlap
self.kwds.setdefault('alpha', 0.5)
... | values
elif (values <= 0).all():
ax._stacker_neg_prior[stacking_id] += values
def _post_plot_logic(self):
df = self.data
condition = (not self._use_dynamic_x()
and df.index.is_all_dates
and not self.subplots
or (se... | 171 | 171 | 573 | 6 | 165 | springcoil/pandas | pandas/tools/plotting.py | Python | AreaPlot | AreaPlot | 1,710 | 1,770 | 1,710 | 1,710 | ddf55729c233a7d73ec7cff65965162a5bce593d | bigcode/the-stack | train |
3222097d0fb9512d2db76511 | train | class | class LinePlot(MPLPlot):
_kind = 'line'
_default_rot = 0
orientation = 'vertical'
def __init__(self, data, **kwargs):
MPLPlot.__init__(self, data, **kwargs)
if self.stacked:
self.data = self.data.fillna(value=0)
self.x_compat = plot_params['x_compat']
if 'x_c... | class LinePlot(MPLPlot):
| _kind = 'line'
_default_rot = 0
orientation = 'vertical'
def __init__(self, data, **kwargs):
MPLPlot.__init__(self, data, **kwargs)
if self.stacked:
self.data = self.data.fillna(value=0)
self.x_compat = plot_params['x_compat']
if 'x_compat' in self.kwds:
... | self.y = y
self.C = C
@property
def nseries(self):
return 1
def _make_plot(self):
import matplotlib.pyplot as plt
x, y, data, C = self.x, self.y, self.data, self.C
ax = self.axes[0]
# pandas uses colormap, matplotlib uses cmap.
cmap = self.colormap... | 256 | 256 | 1,351 | 7 | 249 | springcoil/pandas | pandas/tools/plotting.py | Python | LinePlot | LinePlot | 1,557 | 1,707 | 1,557 | 1,557 | 462da03b627493b4ddb255204c30bbf7827ef31d | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.