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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9f8ce7be9da343b32a81c898 | train | class | class UpdateAlbumTrackFeaturing_args(object):
"""
Attributes:
- idAlbum
- trackNumber
- newFeaturing
"""
def __init__(self, idAlbum=None, trackNumber=None, newFeaturing=None,):
self.idAlbum = idAlbum
self.trackNumber = trackNumber
self.newFeaturing = newFeaturin... | class UpdateAlbumTrackFeaturing_args(object):
| """
Attributes:
- idAlbum
- trackNumber
- newFeaturing
"""
def __init__(self, idAlbum=None, trackNumber=None, newFeaturing=None,):
self.idAlbum = idAlbum
self.trackNumber = trackNumber
self.newFeaturing = newFeaturing
def read(self, iprot):
if iprot... | def __ne__(self, other):
return not (self == other)
all_structs.append(UpdateAlbumTrackTitle_result)
UpdateAlbumTrackTitle_result.thrift_spec = (
(0, TType.STRUCT, 'success', [SpotifakeManagement.ttypes.Track, None], None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErr... | 191 | 191 | 639 | 8 | 183 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | UpdateAlbumTrackFeaturing_args | UpdateAlbumTrackFeaturing_args | 3,331 | 3,408 | 3,331 | 3,331 | f63d9b6ec15223bd2c432fa6e8f2509d83404474 | bigcode/the-stack | train |
e889727835c2c9142bec5a0e | train | class | class GetLocalTracksByIdConsumer_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not No... | class GetLocalTracksByIdConsumer_result(object):
| """
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadab... | oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq_... | 192 | 192 | 643 | 10 | 182 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetLocalTracksByIdConsumer_result | GetLocalTracksByIdConsumer_result | 4,655 | 4,730 | 4,655 | 4,655 | bd84201db06aa9370723d5d5f9255ad854a43388 | bigcode/the-stack | train |
030462a098d644607554aa53 | train | class | class GetTrackByQuery_args(object):
"""
Attributes:
- query
"""
def __init__(self, query=None,):
self.query = query
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
... | class GetTrackByQuery_args(object):
| """
Attributes:
- query
"""
def __init__(self, query=None,):
self.query = query
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [... | , 'success', None, None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 2
(3, TType.STRUCT, 'sErrorInvalidRequestE', [SpotifakeMana... | 138 | 138 | 461 | 8 | 130 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetTrackByQuery_args | GetTrackByQuery_args | 2,986 | 3,040 | 2,986 | 2,986 | 0f261144d363887089f4003b5a4f65c12b52e992 | bigcode/the-stack | train |
28bcca9000909852df91113b | train | class | class GenerateRadioStation_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and... | class GenerateRadioStation_result(object):
| """
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadab... | 16(self.idGender)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__,... | 190 | 190 | 636 | 7 | 183 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GenerateRadioStation_result | GenerateRadioStation_result | 4,510 | 4,585 | 4,510 | 4,510 | ad59af586f60e21e3f84d9c65db96e6e14063bec | bigcode/the-stack | train |
d69e0f2140ba1361eabe4bc5 | train | class | class AddFeaturingTrack_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and is... | class AddFeaturingTrack_result(object):
| """
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadab... | % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_... | 165 | 165 | 550 | 7 | 158 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddFeaturingTrack_result | AddFeaturingTrack_result | 2,738 | 2,804 | 2,738 | 2,738 | 00abe10fd7cb5e33b496c1e4d6bd59c5a2058197 | bigcode/the-stack | train |
6400ce1d375a6339409568ac | train | class | class Iface(object):
def GetTrackByTitle(self, title):
"""
Get Track by Title
@param title
The Track Title to be obtained
@return Track
Track object
Parameters:
- title
"""
pass
def GetTrackByAlbumId(self, idAlbum):
... | class Iface(object):
| def GetTrackByTitle(self, title):
"""
Get Track by Title
@param title
The Track Title to be obtained
@return Track
Track object
Parameters:
- title
"""
pass
def GetTrackByAlbumId(self, idAlbum):
"""
Ge... | #
# Autogenerated by Thrift Compiler (0.13.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive impo... | 122 | 256 | 1,418 | 5 | 117 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | Iface | Iface | 21 | 384 | 21 | 21 | 41a98bfeb65835e208536f16a9ef2d564527b031 | bigcode/the-stack | train |
4c68b67990ed01a1c7c1eb1a | train | class | class AddLocalTrack_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinst... | class AddLocalTrack_result(object):
| """
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadab... | def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other)... | 164 | 164 | 548 | 7 | 157 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddLocalTrack_result | AddLocalTrack_result | 4,801 | 4,867 | 4,801 | 4,801 | 981ce020d7aec30ce652d1aff23b2b686c5a565e | bigcode/the-stack | train |
9e9093d20e45650710a3d813 | train | class | class GetTrackByQuery_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = ... | class GetTrackByQuery_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, ipro... | None:
oprot.writeFieldBegin('query', TType.STRING, 1)
oprot.writeString(self.query.encode('utf-8') if sys.version_info[0] == 2 else self.query)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr... | 232 | 232 | 776 | 8 | 224 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetTrackByQuery_result | GetTrackByQuery_result | 3,048 | 3,135 | 3,048 | 3,048 | 9cf44c71eb6a2c189697ca6b21fd01501cf9cfac | bigcode/the-stack | train |
97908fa0bb3fb113193cc5fa | train | class | class GetTrackByPlaylistId_args(object):
"""
Attributes:
- idPlaylist
"""
def __init__(self, idPlaylist=None,):
self.idPlaylist = idPlaylist
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_sp... | class GetTrackByPlaylistId_args(object):
| """
Attributes:
- idPlaylist
"""
def __init__(self, idPlaylist=None,):
self.idPlaylist = idPlaylist
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_d... | _result.thrift_spec = (
(0, TType.LIST, 'success', (TType.STRUCT, [SpotifakeManagement.ttypes.Track, None], False), None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErr... | 130 | 130 | 434 | 9 | 121 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetTrackByPlaylistId_args | GetTrackByPlaylistId_args | 2,187 | 2,241 | 2,187 | 2,187 | 7f498fba55cac9796168f099ed5902feef69a326 | bigcode/the-stack | train |
35c1d380bd2ffc2d04f3e41c | train | class | class GetTrackByTitle_args(object):
"""
Attributes:
- title
"""
def __init__(self, title=None,):
self.title = title
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
... | class GetTrackByTitle_args(object):
| """
Attributes:
- title
"""
def __init__(self, title=None,):
self.title = title
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [... | PLY
result.sErrorSystemE = sErrorSystemE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handl... | 138 | 138 | 461 | 8 | 129 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetTrackByTitle_args | GetTrackByTitle_args | 1,879 | 1,933 | 1,879 | 1,879 | 8ed33004c9f1978b7852cf11d9cb82caee61f216 | bigcode/the-stack | train |
23fd518b9b5c7e0d846d61ba | train | class | class DeletePlaylistTrack_args(object):
"""
Attributes:
- idPlaylist
- trackNumber
"""
def __init__(self, idPlaylist=None, trackNumber=None,):
self.idPlaylist = idPlaylist
self.trackNumber = trackNumber
def read(self, iprot):
if iprot._fast_decode is not None an... | class DeletePlaylistTrack_args(object):
| """
Attributes:
- idPlaylist
- trackNumber
"""
def __init__(self, idPlaylist=None, trackNumber=None,):
self.idPlaylist = idPlaylist
self.trackNumber = trackNumber
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CRe... | in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddTrackToPlaylist_result)
A... | 158 | 158 | 529 | 7 | 151 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | DeletePlaylistTrack_args | DeletePlaylistTrack_args | 3,976 | 4,041 | 3,976 | 3,976 | a2164b5d05152fcb818521c44689f8abcd041fe3 | bigcode/the-stack | train |
6ca6201a8afa9a44386639e6 | train | class | class AddLocalTrack_args(object):
"""
Attributes:
- LocalTrack
"""
def __init__(self, LocalTrack=None,):
self.LocalTrack = LocalTrack
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is n... | class AddLocalTrack_args(object):
| """
Attributes:
- LocalTrack
"""
def __init__(self, LocalTrack=None,):
self.LocalTrack = LocalTrack
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_d... | __ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetLocalTracksByIdConsumer_result)
GetLocalTracksByIdConsumer_result.thrift_spec = (
(0, TType.LIST, 'success', (TType.STRUCT, [SpotifakeManagement.ttypes.LocalTrack, None], False), None, ), # 0
(1, TType.S... | 131 | 131 | 439 | 7 | 124 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddLocalTrack_args | AddLocalTrack_args | 4,738 | 4,793 | 4,738 | 4,738 | d039ed8315a52230fa42a5b7845dccba416ac247 | bigcode/the-stack | train |
762d1545f8ef794b80eff881 | train | class | class AddTrackToAlbum_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isin... | class AddTrackToAlbum_result(object):
| """
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadab... | ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddTrackToAlbum_args)
AddTrackToAlbum_args.thrift_spec = (
None, # 0
(1, TType.I16, 'idAlbum', No... | 165 | 165 | 552 | 8 | 157 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddTrackToAlbum_result | AddTrackToAlbum_result | 2,590 | 2,656 | 2,590 | 2,590 | da9dca51bd6a34bae347af9013937ae32bf91a00 | bigcode/the-stack | train |
260116b626fd65c4588e996a | train | class | class UpdateAlbumTrackFeaturing_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
- sErrorInvalidRequestE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None, sErrorInvalidRequestE=None,):
self.success = success
s... | class UpdateAlbumTrackFeaturing_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
- sErrorInvalidRequestE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None, sErrorInvalidRequestE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
se... | self.newFeaturing.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__cla... | 250 | 250 | 835 | 8 | 242 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | UpdateAlbumTrackFeaturing_result | UpdateAlbumTrackFeaturing_result | 3,418 | 3,509 | 3,418 | 3,418 | 4431e9d6ed2a9e309805594df49f97205ee3693b | bigcode/the-stack | train |
6b76f251c624080c39011830 | train | class | class GetTrackByPlaylistId_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSyste... | class GetTrackByPlaylistId_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, ipro... | TrackByPlaylistId_args')
if self.idPlaylist is not None:
oprot.writeFieldBegin('idPlaylist', TType.I16, 1)
oprot.writeI16(self.idPlaylist)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __re... | 233 | 233 | 778 | 9 | 224 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetTrackByPlaylistId_result | GetTrackByPlaylistId_result | 2,249 | 2,336 | 2,249 | 2,249 | 3baf83eac69763aabd0f40917a5f177a026c1ef0 | bigcode/the-stack | train |
b59b0f7153197e3618ae4879 | train | class | class AddTrackToLibrary_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and is... | class AddTrackToLibrary_result(object):
| """
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadab... | % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_... | 165 | 165 | 550 | 8 | 157 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddTrackToLibrary_result | AddTrackToLibrary_result | 3,593 | 3,659 | 3,593 | 3,593 | a8654c9ad8cce62e164c46a83a69dff921437de3 | bigcode/the-stack | train |
e73589cbc35cb06bbd4eff2e | train | class | class DeleteAlbumTrack_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
- sErrorInvalidRequestE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None, sErrorInvalidRequestE=None,):
self.success = success
self.sErro... | class DeleteAlbumTrack_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
- sErrorInvalidRequestE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None, sErrorInvalidRequestE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
se... | FieldEnd()
if self.trackNumber is not None:
oprot.writeFieldBegin('trackNumber', TType.I16, 2)
oprot.writeI16(self.trackNumber)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):... | 247 | 247 | 826 | 7 | 240 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | DeleteAlbumTrack_result | DeleteAlbumTrack_result | 2,886 | 2,976 | 2,886 | 2,886 | f1e981eca0dc7ef662401390f7c2dce05bbf8135 | bigcode/the-stack | train |
a86a3a59d171f2c6e5dd0d71 | train | class | class AddTrackToLibrary_args(object):
"""
Attributes:
- idLibrary
- idTrack
"""
def __init__(self, idLibrary=None, idTrack=None,):
self.idLibrary = idLibrary
self.idTrack = idTrack
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.tra... | class AddTrackToLibrary_args(object):
| """
Attributes:
- idLibrary
- idTrack
"""
def __init__(self, idLibrary=None, idTrack=None,):
self.idLibrary = idLibrary
self.idTrack = idTrack
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and... | .thrift_spec = (
(0, TType.STRUCT, 'success', [SpotifakeManagement.ttypes.Track, None], None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], No... | 159 | 159 | 531 | 8 | 151 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddTrackToLibrary_args | AddTrackToLibrary_args | 3,519 | 3,584 | 3,519 | 3,519 | 950939d5361f25f4d147901548390402f29c65aa | bigcode/the-stack | train |
15ad26993848890f17d77102 | train | class | class GetTrackByLibraryId_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystem... | class GetTrackByLibraryId_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, ipro... | TrackByLibraryId_args')
if self.idLibrary is not None:
oprot.writeFieldBegin('idLibrary', TType.I16, 1)
oprot.writeI16(self.idLibrary)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__... | 233 | 233 | 778 | 9 | 224 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetTrackByLibraryId_result | GetTrackByLibraryId_result | 2,407 | 2,494 | 2,407 | 2,407 | 662c0eb7c0c1d675808611a89c51525fb5a1800b | bigcode/the-stack | train |
6950366b8162290bad4ae467 | train | class | class DeleteAlbumTrack_args(object):
"""
Attributes:
- idAlbum
- trackNumber
"""
def __init__(self, idAlbum=None, trackNumber=None,):
self.idAlbum = idAlbum
self.trackNumber = trackNumber
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(ip... | class DeleteAlbumTrack_args(object):
| """
Attributes:
- idAlbum
- trackNumber
"""
def __init__(self, idAlbum=None, trackNumber=None,):
self.idAlbum = idAlbum
self.trackNumber = trackNumber
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransp... | , value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddFeaturingTrack_res... | 158 | 158 | 529 | 7 | 151 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | DeleteAlbumTrack_args | DeleteAlbumTrack_args | 2,812 | 2,877 | 2,812 | 2,812 | e3951a51403a87d6013ea6a94985e187a39b7385 | bigcode/the-stack | train |
50123fa6b09c9d693dcba50e | train | class | class Processor(Iface, TProcessor):
def __init__(self, handler):
self._handler = handler
self._processMap = {}
self._processMap["GetTrackByTitle"] = Processor.process_GetTrackByTitle
self._processMap["GetTrackByAlbumId"] = Processor.process_GetTrackByAlbumId
self._processMap[... | class Processor(Iface, TProcessor):
| def __init__(self, handler):
self._handler = handler
self._processMap = {}
self._processMap["GetTrackByTitle"] = Processor.process_GetTrackByTitle
self._processMap["GetTrackByAlbumId"] = Processor.process_GetTrackByAlbumId
self._processMap["GetTrackByPlaylistId"] = Processor.... |
Parameters:
- LocalTrack
"""
self.send_AddLocalTrack(LocalTrack)
return self.recv_AddLocalTrack()
def send_AddLocalTrack(self, LocalTrack):
self._oprot.writeMessageBegin('AddLocalTrack', TMessageType.CALL, self._seqid)
args = AddLocalTrack_args()
... | 256 | 256 | 5,764 | 8 | 248 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | Processor | Processor | 1,295 | 1,874 | 1,295 | 1,295 | ee05de0032019b0c4856357b537eeb791667f3d1 | bigcode/the-stack | train |
3e359717483477ab488a226e | train | class | class DeleteLibraryTrack_args(object):
"""
Attributes:
- idLibrary
- trackNumber
"""
def __init__(self, idLibrary=None, trackNumber=None,):
self.idLibrary = idLibrary
self.trackNumber = trackNumber
def read(self, iprot):
if iprot._fast_decode is not None and isi... | class DeleteLibraryTrack_args(object):
| """
Attributes:
- idLibrary
- trackNumber
"""
def __init__(self, idLibrary=None, trackNumber=None,):
self.idLibrary = idLibrary
self.trackNumber = trackNumber
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadab... | in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddTrackToLibrary_result)
Ad... | 158 | 158 | 529 | 7 | 151 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | DeleteLibraryTrack_args | DeleteLibraryTrack_args | 3,667 | 3,732 | 3,667 | 3,667 | 397bd739c6b4a4e1bc57ecb550b90dda69117aac | bigcode/the-stack | train |
c3f31bd23e8b8c1337deb772 | train | class | class GetLocalTracksByIdConsumer_args(object):
"""
Attributes:
- idConsumer
"""
def __init__(self, idConsumer=None,):
self.idConsumer = idConsumer
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thr... | class GetLocalTracksByIdConsumer_args(object):
| """
Attributes:
- idConsumer
"""
def __init__(self, idConsumer=None,):
self.idConsumer = idConsumer
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_d... | .__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GenerateRadioStation_result)
GenerateRadioStation_result.thrift_spec = (
(0, TType.LIST, 'success', (TType.STRUCT, [SpotifakeManagement.ttypes.Track, None], False), None, ), # 0
(1, TType.STRUCT, 'sE... | 130 | 130 | 436 | 10 | 120 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetLocalTracksByIdConsumer_args | GetLocalTracksByIdConsumer_args | 4,593 | 4,647 | 4,593 | 4,593 | 7545b9108714fa5551a6ea1db770ec222d437f85 | bigcode/the-stack | train |
a387b0f182d190751d83bc42 | train | class | class AddTrackToPlaylist_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and i... | class AddTrackToPlaylist_result(object):
| """
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadab... | % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_... | 165 | 165 | 550 | 8 | 157 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddTrackToPlaylist_result | AddTrackToPlaylist_result | 3,902 | 3,968 | 3,902 | 3,902 | 48a7b09a18ef5ef4e6037af58baaf7c67576eb6f | bigcode/the-stack | train |
a5679afc3a6e1c378bd2ab29 | train | class | class UpdateAlbumTrackTitle_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
- sErrorInvalidRequestE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None, sErrorInvalidRequestE=None,):
self.success = success
self.... | class UpdateAlbumTrackTitle_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
- sErrorInvalidRequestE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None, sErrorInvalidRequestE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
se... | _info[0] == 2 else self.newAlbumTrackTitle)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' %... | 250 | 250 | 835 | 8 | 242 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | UpdateAlbumTrackTitle_result | UpdateAlbumTrackTitle_result | 3,230 | 3,321 | 3,230 | 3,230 | d5690672226e93937b347e7b592bda2c89a37db7 | bigcode/the-stack | train |
93f9ae3584ae10096dad1d3f | train | class | class UpdateAlbumTrackTitle_args(object):
"""
Attributes:
- idAlbum
- trackNumber
- newAlbumTrackTitle
"""
def __init__(self, idAlbum=None, trackNumber=None, newAlbumTrackTitle=None,):
self.idAlbum = idAlbum
self.trackNumber = trackNumber
self.newAlbumTrackTitle... | class UpdateAlbumTrackTitle_args(object):
| """
Attributes:
- idAlbum
- trackNumber
- newAlbumTrackTitle
"""
def __init__(self, idAlbum=None, trackNumber=None, newAlbumTrackTitle=None,):
self.idAlbum = idAlbum
self.trackNumber = trackNumber
self.newAlbumTrackTitle = newAlbumTrackTitle
def read(self, ... | s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetTrackByQuery_result)
GetTrackByQuery_result.thrift_spec = (
(0, T... | 205 | 205 | 686 | 8 | 197 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | UpdateAlbumTrackTitle_args | UpdateAlbumTrackTitle_args | 3,144 | 3,220 | 3,144 | 3,144 | bbbf76640bba2d82e71a6fda867dfe2f199d17e3 | bigcode/the-stack | train |
4ce0ce8365a0a959814e91bb | train | class | class AddFeaturingTrack_args(object):
"""
Attributes:
- idNewTrack
- idContenCreator
"""
def __init__(self, idNewTrack=None, idContenCreator=None,):
self.idNewTrack = idNewTrack
self.idContenCreator = idContenCreator
def read(self, iprot):
if iprot._fast_decode ... | class AddFeaturingTrack_args(object):
| """
Attributes:
- idNewTrack
- idContenCreator
"""
def __init__(self, idNewTrack=None, idContenCreator=None,):
self.idNewTrack = idNewTrack
self.idContenCreator = idContenCreator
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans... | value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.... | 165 | 165 | 553 | 7 | 158 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddFeaturingTrack_args | AddFeaturingTrack_args | 2,664 | 2,729 | 2,664 | 2,664 | 8fa7f8f7bf6e8ca8f19484f7152ed85a7f084a72 | bigcode/the-stack | train |
f69a9e681ec309a7ceb6f992 | train | class | class AddTrackToPlaylist_args(object):
"""
Attributes:
- idPlaylist
- idTrack
"""
def __init__(self, idPlaylist=None, idTrack=None,):
self.idPlaylist = idPlaylist
self.idTrack = idTrack
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(ipro... | class AddTrackToPlaylist_args(object):
| """
Attributes:
- idPlaylist
- idTrack
"""
def __init__(self, idPlaylist=None, idTrack=None,):
self.idPlaylist = idPlaylist
self.idTrack = idTrack
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport)... | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(DeleteLibraryTrack_result)
DeleteLibraryTrack_result.thrift_spec = (
(0, TType.I16, 'success', None, None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE'... | 159 | 159 | 531 | 8 | 151 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddTrackToPlaylist_args | AddTrackToPlaylist_args | 3,828 | 3,893 | 3,828 | 3,828 | 30db8fe94b22b7f24c10cc7ba850f3549cf43ee0 | bigcode/the-stack | train |
c435e45e2fbfa6242ffd7a7e | train | function | def resnet_v1_downsample_block(scope, factor):
""" """
return DownSampleBlock(scope, downsample, [{'s_factor': factor}])
| def resnet_v1_downsample_block(scope, factor):
| """ """
return DownSampleBlock(scope, downsample, [{'s_factor': factor}])
| ]
* (num_units - 1)
+ [
{
'depth': major_depth,
'depth_bottleneck': minor_depth,
'stride': stride,
'overide_rate': rate,
}
],
)
def resnet_v1_downsample_block(scope, factor):
| 64 | 64 | 32 | 12 | 52 | deltaautonomy/delta_perception | segmentation/third_party/dilated_resnet_v1.py | Python | resnet_v1_downsample_block | resnet_v1_downsample_block | 163 | 165 | 163 | 163 | dc5012407e38499ca7825b220fcfda1da1410de3 | bigcode/the-stack | train |
45f120c29271743daf07f223 | train | class | class DownSampleBlock(collections.namedtuple('Block', ['scope', 'unit_fn', 'args'])):
""" """
| class DownSampleBlock(collections.namedtuple('Block', ['scope', 'unit_fn', 'args'])):
| """ """
| division
from __future__ import print_function
import collections
import tensorflow as tf
from third_party import resnet_utils
from third_party import resnet_v1
slim = tf.contrib.slim
class DownSampleBlock(collections.namedtuple('Block', ['scope', 'unit_fn', 'args'])):
| 64 | 64 | 25 | 22 | 41 | deltaautonomy/delta_perception | segmentation/third_party/dilated_resnet_v1.py | Python | DownSampleBlock | DownSampleBlock | 33 | 34 | 33 | 33 | 25bc28af30722cce5548edca9a77208f870e9dcb | bigcode/the-stack | train |
bccd523b0c650439db722397 | train | function | def resnet_v1(
inputs,
blocks,
filter_scale=1.0,
num_classes=None,
is_training=True,
global_pool=True,
output_stride=None,
include_root_block=True,
reuse=None,
scope=None,
):
with tf.variable_scope(scope, 'resnet_v1', [inputs], reuse=reuse) as sc:
end_points_collectio... | def resnet_v1(
inputs,
blocks,
filter_scale=1.0,
num_classes=None,
is_training=True,
global_pool=True,
output_stride=None,
include_root_block=True,
reuse=None,
scope=None,
):
| with tf.variable_scope(scope, 'resnet_v1', [inputs], reuse=reuse) as sc:
end_points_collection = sc.original_name_scope + '_end_points'
with slim.arg_scope(
[slim.conv2d, bottleneck, resnet_utils.stack_blocks_dense],
outputs_collections=end_points_collection,
):
... | {
'depth': major_depth,
'depth_bottleneck': minor_depth,
'stride': stride,
'overide_rate': rate,
}
],
)
def resnet_v1_downsample_block(scope, factor):
""" """
return DownSampleBlock(scope, downsample, [{'s_fact... | 126 | 126 | 422 | 55 | 71 | deltaautonomy/delta_perception | segmentation/third_party/dilated_resnet_v1.py | Python | resnet_v1 | resnet_v1 | 168 | 218 | 168 | 179 | 3c0bf1ccfdf3377df93f50cff6a36b8b9a2a3941 | bigcode/the-stack | train |
b909133f4e8abfed66ff9bf4 | train | function | def resnet_v1_block(scope, base_depth, num_units, stride, rate=1):
"""Helper function for creating a resnet_v1 bottleneck block.
Args:
scope: The scope of the block.
base_depth: The depth of the bottleneck layer for each unit.
num_units: The number of units in the block.
stride: The stride of the... | def resnet_v1_block(scope, base_depth, num_units, stride, rate=1):
| """Helper function for creating a resnet_v1 bottleneck block.
Args:
scope: The scope of the block.
base_depth: The depth of the bottleneck layer for each unit.
num_units: The number of units in the block.
stride: The stride of the block, implemented as a stride in the last unit.
All other u... | -6.0, 6.0)
output = tf.nn.relu6(shortcut + residual)
else:
output = tf.nn.relu(shortcut + residual)
return slim.utils.collect_named_outputs(outputs_collections, sc.name, output)
def resnet_v1_block(scope, base_depth, num_units, stride, rate=1):
| 72 | 72 | 240 | 20 | 52 | deltaautonomy/delta_perception | segmentation/third_party/dilated_resnet_v1.py | Python | resnet_v1_block | resnet_v1_block | 125 | 160 | 125 | 125 | 6edd111791cf5652ec6f93b9c74f0feb17374c80 | bigcode/the-stack | train |
83f2d56eab7618fcc4ff4f62 | train | function | @slim.add_arg_scope
def bottleneck(
inputs,
depth,
depth_bottleneck,
stride,
overide_rate=1,
rate=1,
outputs_collections=None,
scope=None,
use_bounded_activations=False,
):
"""Bottleneck residual unit variant with BN after convolutions.
This is the original residual unit propo... | @slim.add_arg_scope
def bottleneck(
inputs,
depth,
depth_bottleneck,
stride,
overide_rate=1,
rate=1,
outputs_collections=None,
scope=None,
use_bounded_activations=False,
):
| """Bottleneck residual unit variant with BN after convolutions.
This is the original residual unit proposed in [1]. See Fig. 1(a) of [2] for
its definition. Note that we use here the bottleneck variant which has an
extra bottleneck layer.
When putting together two consecutive ResNet blocks that use this u... | slim.add_arg_scope
def downsample(inputs, s_factor, stride=1, rate=1, scope=None):
""""""
with tf.variable_scope(scope, 'Interp', [inputs]) as sc:
_, input_h, input_w, _ = inputs.get_shape().as_list()
shrink_h = (input_h - 1) * s_factor + 1
shrink_w = (input_w - 1) * s_factor + 1
... | 186 | 186 | 622 | 58 | 128 | deltaautonomy/delta_perception | segmentation/third_party/dilated_resnet_v1.py | Python | bottleneck | bottleneck | 49 | 122 | 49 | 60 | f4427cfe043cc7143d2227a13c568dc87fe3037b | bigcode/the-stack | train |
2f04db2e32348f643c03a912 | train | function | @slim.add_arg_scope
def downsample(inputs, s_factor, stride=1, rate=1, scope=None):
""""""
with tf.variable_scope(scope, 'Interp', [inputs]) as sc:
_, input_h, input_w, _ = inputs.get_shape().as_list()
shrink_h = (input_h - 1) * s_factor + 1
shrink_w = (input_w - 1) * s_factor + 1
... | @slim.add_arg_scope
def downsample(inputs, s_factor, stride=1, rate=1, scope=None):
| """"""
with tf.variable_scope(scope, 'Interp', [inputs]) as sc:
_, input_h, input_w, _ = inputs.get_shape().as_list()
shrink_h = (input_h - 1) * s_factor + 1
shrink_w = (input_w - 1) * s_factor + 1
return tf.image.resize_bilinear(
inputs, [int(shrink_h), int(shrink_w)... | resnet_v1
slim = tf.contrib.slim
class DownSampleBlock(collections.namedtuple('Block', ['scope', 'unit_fn', 'args'])):
""" """
@slim.add_arg_scope
def downsample(inputs, s_factor, stride=1, rate=1, scope=None):
| 63 | 64 | 129 | 26 | 37 | deltaautonomy/delta_perception | segmentation/third_party/dilated_resnet_v1.py | Python | downsample | downsample | 37 | 46 | 37 | 38 | 3ebee4c84c2ab6fe3e5ada274cf763d611f339da | bigcode/the-stack | train |
cd18231a4acba3c88003caa8 | train | function | def dilated_resnet_v1_50(
inputs,
filter_scale=1.0,
mid_downsample=False,
num_classes=None,
is_training=True,
global_pool=True,
output_stride=None,
reuse=None,
scope='resnet_v1_50',
):
"""Resnet v1 50 variant with dilations.
This variant modifies the first convolution layer of... | def dilated_resnet_v1_50(
inputs,
filter_scale=1.0,
mid_downsample=False,
num_classes=None,
is_training=True,
global_pool=True,
output_stride=None,
reuse=None,
scope='resnet_v1_50',
):
| """Resnet v1 50 variant with dilations.
This variant modifies the first convolution layer of ResNet-v1-50. In
particular, it changes the original several of the last ResNet blocks
to include dilated convolutions as used in ICNet.
"""
blocks = [
resnet_v1_block('block1', base_depth=64 / filter_... | _classes is not None:
end_points['predictions'] = slim.softmax(net, scope='predictions')
return net, end_points
resnet_v1.default_image_size = 224
def dilated_resnet_v1_50(
inputs,
filter_scale=1.0,
mid_downsample=False,
num_classes=None,
is_training=True,
g... | 102 | 102 | 343 | 62 | 39 | deltaautonomy/delta_perception | segmentation/third_party/dilated_resnet_v1.py | Python | dilated_resnet_v1_50 | dilated_resnet_v1_50 | 224 | 270 | 224 | 234 | 7712f47a96bd75fb71c580ce48531158b3b2044c | bigcode/the-stack | train |
63172d692b3cec903e64c253 | train | function | async def translator(trans: str) -> str:
tr = Translator()
cont = 0
while cont < 10:
try: return tr.translate(trans, dest = "ar").text
except: cont += 1
return trans
| async def translator(trans: str) -> str:
| tr = Translator()
cont = 0
while cont < 10:
try: return tr.translate(trans, dest = "ar").text
except: cont += 1
return trans
| from os import getenv
API_ID = int(getenv("API_ID"))
API_HASH = getenv("API_HASH")
BOT_TOKEN = getenv("MASABITO_BOT")
bot = TelegramClient("bot", API_ID, API_HASH).start(bot_token = BOT_TOKEN)
async def translator(trans: str) -> str:
| 64 | 64 | 55 | 10 | 54 | GH0STsama/ArabicTranslate | masabito.py | Python | translator | translator | 13 | 19 | 13 | 13 | 6fd370d6bcd7b0e80c994ac62ee9f4818c608e0d | bigcode/the-stack | train |
b92f9089fc2719330f5303ff | train | function | @bot.on(NewMessage())
async def messages_handler(event: Message):
if event.raw_text:
await event.reply(await translator(event.raw_text))
else:
await event.reply("✖️ Dame un texto para traducir")
| @bot.on(NewMessage())
async def messages_handler(event: Message):
| if event.raw_text:
await event.reply(await translator(event.raw_text))
else:
await event.reply("✖️ Dame un texto para traducir")
| str) -> str:
tr = Translator()
cont = 0
while cont < 10:
try: return tr.translate(trans, dest = "ar").text
except: cont += 1
return trans
@bot.on(NewMessage())
async def messages_handler(event: Message):
| 64 | 64 | 50 | 14 | 49 | GH0STsama/ArabicTranslate | masabito.py | Python | messages_handler | messages_handler | 21 | 26 | 21 | 22 | eeee9e53fa425c0aae2e3ae28104522d2b934f36 | bigcode/the-stack | train |
dd7b141281396d65de64d191 | train | function | @bw2test
def test_import_initial_data():
fp = os.path.join(EXCEL_FIXTURES_DIR, "lcia.xlsx")
expected = [
{
"name": ("foo",),
"description": "",
"filename": "lcia.xlsx",
"unit": "bar",
"exchanges": [
{
"name":... | @bw2test
def test_import_initial_data():
| fp = os.path.join(EXCEL_FIXTURES_DIR, "lcia.xlsx")
expected = [
{
"name": ("foo",),
"description": "",
"filename": "lcia.xlsx",
"unit": "bar",
"exchanges": [
{
"name": "Aluminium",
"catego... | ["Aluminium", "Resource::in ground", 42],
["Uranium ore, 1.11 GJ per kg", "Resource", 1000000],
],
)
]
assert ExcelExtractor.extract(fp) == expected
@bw2test
def test_import_initial_data():
| 64 | 64 | 168 | 11 | 52 | sc-gcoste/brightway2-io | tests/excel/lcia.py | Python | test_import_initial_data | test_import_initial_data | 27 | 51 | 27 | 28 | 777f0aa2daf6f08f2121659fde715985d5ce1e07 | bigcode/the-stack | train |
cb4f2946deaca24d5bca6d06 | train | function | def test_excel_lcia_extraction():
fp = os.path.join(EXCEL_FIXTURES_DIR, "lcia.xlsx")
expected = [
(
"Sheet1",
[
["name", "categories", "amount"],
["Aluminium", "Resource::in ground", 42],
["Uranium ore, 1.11 GJ per kg", "Resource", ... | def test_excel_lcia_extraction():
| fp = os.path.join(EXCEL_FIXTURES_DIR, "lcia.xlsx")
expected = [
(
"Sheet1",
[
["name", "categories", "amount"],
["Aluminium", "Resource::in ground", 42],
["Uranium ore, 1.11 GJ per kg", "Resource", 1000000],
],
)... | from bw2data.tests import bw2test
from bw2io import ExcelLCIAImporter
from bw2io.extractors.excel import ExcelExtractor
EXCEL_FIXTURES_DIR = os.path.join(os.path.dirname(__file__), "..", "fixtures", "excel")
def test_excel_lcia_extraction():
| 64 | 64 | 103 | 8 | 56 | sc-gcoste/brightway2-io | tests/excel/lcia.py | Python | test_excel_lcia_extraction | test_excel_lcia_extraction | 12 | 24 | 12 | 12 | 339934ad9b18ee5af191137afb55f4e978da3fe7 | bigcode/the-stack | train |
cb7cf6bd6cdb220ebe234ddf | train | function | @bw2test
def test_excel_lcia_integration():
Database("biosphere").write(
{
("biosphere", "a"): {
"name": "aluminium",
"categories": ("Resource", "in ground"),
},
("biosphere", "b"): {
"name": "Uranium ore, 1.11 GJ per kg",
... | @bw2test
def test_excel_lcia_integration():
| Database("biosphere").write(
{
("biosphere", "a"): {
"name": "aluminium",
"categories": ("Resource", "in ground"),
},
("biosphere", "b"): {
"name": "Uranium ore, 1.11 GJ per kg",
"categories": ("Resource",),
... | },
{
"name": "Uranium ore, 1.11 GJ per kg",
"categories": "Resource",
"amount": 1000000,
},
],
}
]
eli = ExcelLCIAImporter(fp, ("foo",), "", "bar")
assert eli.data == expected
@bw2... | 84 | 84 | 281 | 13 | 70 | sc-gcoste/brightway2-io | tests/excel/lcia.py | Python | test_excel_lcia_integration | test_excel_lcia_integration | 54 | 85 | 54 | 55 | dbaa244eaadbacb7c37ad8f45927234bcf4d4b08 | bigcode/the-stack | train |
087c9626c33c205dac56e6c5 | train | class | class ChromeAddonInstallSettings(AddonInstallSettings):
# --------------------------------------------------------- Init --------------------------------------------------------- #
def __init__(
self,
path: str, # path to extracted extension folder, NOT .crx (this is a limitation by undetected... | class ChromeAddonInstallSettings(AddonInstallSettings):
# --------------------------------------------------------- Init --------------------------------------------------------- #
| def __init__(
self,
path: str, # path to extracted extension folder, NOT .crx (this is a limitation by undetected-chromedriver)
addon_id: str
):
super().__init__(path)
self.addon_id = addon_id
self.addon_url = 'chrome-extension://{}'.format(addon_id)
# ----... | # ------------------------------------------------------------ Imports ----------------------------------------------------------- #
# Pip
from selenium_browser import AddonInstallSettings
# -------------------------------------------------------------------------------------------------------------------------------... | 54 | 64 | 127 | 18 | 36 | kkristof200/selenium_chrome | selenium_chrome/chrome_addons/chrome_addon_install_settings.py | Python | ChromeAddonInstallSettings | ChromeAddonInstallSettings | 12 | 33 | 12 | 15 | b9f38a87e66117aad485dd57f0b5e1b3b032bf7f | bigcode/the-stack | train |
af4bcc4d416548600384dfa5 | train | class | class FakeContainerBroker(object):
def __init__(self, path):
self.path = path
self.db_file = path
self.file = os.path.basename(path)
def is_deleted(self):
return False
def get_info(self):
if self.file.startswith('fail'):
raise ValueError
if self.... | class FakeContainerBroker(object):
| def __init__(self, path):
self.path = path
self.db_file = path
self.file = os.path.basename(path)
def is_deleted(self):
return False
def get_info(self):
if self.file.startswith('fail'):
raise ValueError
if self.file.startswith('true'):
... | See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import mock
import time
import os
import random
from tempfile import mkdtemp
from shutil import rmtree
from swift.container import auditor
from test.unit import FakeLogger
class FakeContainerBroker(ob... | 64 | 64 | 79 | 6 | 57 | citrix-openstack-build/swift | test/unit/container/test_auditor.py | Python | FakeContainerBroker | FakeContainerBroker | 28 | 41 | 28 | 28 | ba0cdab15631c7dcb27d2b2ea70f5d6d90a090da | bigcode/the-stack | train |
e71238d9c172322472043ffc | train | class | class TestAuditor(unittest.TestCase):
def setUp(self):
self.testdir = os.path.join(mkdtemp(), 'tmp_test_container_auditor')
self.logger = FakeLogger()
rmtree(self.testdir, ignore_errors=1)
os.mkdir(self.testdir)
fnames = ['true1.db', 'true2.db', 'true3.db',
... | class TestAuditor(unittest.TestCase):
| def setUp(self):
self.testdir = os.path.join(mkdtemp(), 'tmp_test_container_auditor')
self.logger = FakeLogger()
rmtree(self.testdir, ignore_errors=1)
os.mkdir(self.testdir)
fnames = ['true1.db', 'true2.db', 'true3.db',
'fail1.db', 'fail2.db']
for fn... | #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
... | 192 | 192 | 640 | 8 | 184 | citrix-openstack-build/swift | test/unit/container/test_auditor.py | Python | TestAuditor | TestAuditor | 44 | 118 | 44 | 45 | 30c3af349c88031e67ba3cd2a7992c3943876bc6 | bigcode/the-stack | train |
28a58adede77da5c8024fcdc | train | class | class LedgerAuthDialog(QDialog):
def __init__(self, handler, data, *, client: 'Ledger_Client'):
'''Ask user for 2nd factor authentication. Support text and security card methods.
Use last method from settings, but support downgrade.
'''
QDialog.__init__(self, handler.top_level_window... | class LedgerAuthDialog(QDialog):
| def __init__(self, handler, data, *, client: 'Ledger_Client'):
'''Ask user for 2nd factor authentication. Support text and security card methods.
Use last method from settings, but support downgrade.
'''
QDialog.__init__(self, handler.top_level_window())
self.handler = handle... | , QVBoxLayout, QLabel,
QWidget, QHBoxLayout, QComboBox)
from btchip.btchip import BTChipException
from electrum_mars.gui.qt.util import PasswordLineEdit
from electrum_mars.i18n import _
from electrum_mars import constants, bitcoin
from electrum_mars.logging import get_logger
if TYPE_CHE... | 256 | 256 | 1,415 | 7 | 249 | marscoin/electrum-mars | electrum_mars/plugins/ledger/auth2fa.py | Python | LedgerAuthDialog | LedgerAuthDialog | 33 | 168 | 33 | 33 | c2f7311e7f35554266bf731fb5832e8165596268 | bigcode/the-stack | train |
a5993f67e824e57fe6731a3f | train | class | class TestData(unittest.TestCase):
def getPIWebApiClient(self):
"""
TODO: The PI Web API client must provide a user name and password when using “basic” authentication
Store passwords outside of the code in a hardware TPM, trusted service (credential manager) or in a protected file.
... | class TestData(unittest.TestCase):
| def getPIWebApiClient(self):
"""
TODO: The PI Web API client must provide a user name and password when using “basic” authentication
Store passwords outside of the code in a hardware TPM, trusted service (credential manager) or in a protected file.
Code to return the user... | # coding: utf-8
"""
Copyright 2017 OSIsoft, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
<http://www.apache.org/licenses/LICENSE-2.0>
Unless required by applicable law or agreed to ... | 211 | 256 | 2,224 | 7 | 203 | Jasmine0729/PI-Web-API-Client-Python | test/test_data.py | Python | TestData | TestData | 24 | 155 | 24 | 24 | c19a8f94d878bff0ea8fa97255d1af113028014b | bigcode/the-stack | train |
0f83a717fccdedc922c56a14 | train | class | class Overview(BaseView):
"""总览"""
def index(self,request):
return render(request,"admin/overview.html",self.context)
| class Overview(BaseView):
| """总览"""
def index(self,request):
return render(request,"admin/overview.html",self.context)
| from django.shortcuts import render
from admin.views.base import BaseView
class Overview(BaseView):
| 19 | 64 | 30 | 5 | 13 | wdcxc/blog | admin/views/overview.py | Python | Overview | Overview | 4 | 8 | 4 | 4 | 0708c888ce3152ec1767ae0bc2056fe872f93f65 | bigcode/the-stack | train |
ff2b885877ae3ef8b42aa2a9 | train | function | def index(request):
"""Basic view."""
plugins = \
[plugin.load() for plugin in
pkg_resources.iter_entry_points(group='elrados.plugins')]
return render(request, "index.html", {
"plugins": plugins
})
| def index(request):
| """Basic view."""
plugins = \
[plugin.load() for plugin in
pkg_resources.iter_entry_points(group='elrados.plugins')]
return render(request, "index.html", {
"plugins": plugins
})
| """Global index view."""
import pkg_resources
from django.shortcuts import render
def index(request):
| 19 | 64 | 53 | 4 | 14 | IamShobe/elrados | src/elrados/views.py | Python | index | index | 7 | 14 | 7 | 7 | ce045889c078419b6034fcbe0df37f727bb8e03b | bigcode/the-stack | train |
3a9950cb9b501cca89fe6869 | train | function | def _exception_safe_class_factory(base_class):
"""
Creates an exception safe metaclass that inherits from `base_class`.
"""
class _ExceptionSafeClass(base_class):
"""
Metaclass that wraps all functions defined on the specified class with broad error handling
logic to guard again... | def _exception_safe_class_factory(base_class):
| """
Creates an exception safe metaclass that inherits from `base_class`.
"""
class _ExceptionSafeClass(base_class):
"""
Metaclass that wraps all functions defined on the specified class with broad error handling
logic to guard against unexpected errors during autlogging.
... | kwargs):
try:
return function(*args, **kwargs)
except Exception as e:
if _is_testing():
raise
else:
_logger.warning("Encountered unexpected error during autologging: %s", e)
safe_function = _update_wrapper_extended(safe_function, f... | 79 | 79 | 264 | 9 | 69 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _exception_safe_class_factory | _exception_safe_class_factory | 532 | 559 | 532 | 532 | 513baa4c12a752eadfb4cd3cd7c2d845cf202b26 | bigcode/the-stack | train |
57610df16443be56b21d8143 | train | class | class BatchMetricsLogger:
"""
The BatchMetricsLogger will log metrics in batch against an mlflow run.
If run_id is passed to to constructor then all recording and logging will
happen against that run_id.
If no run_id is passed into constructor, then the run ID will be fetched
from `mlflow.active... | class BatchMetricsLogger:
| """
The BatchMetricsLogger will log metrics in batch against an mlflow run.
If run_id is passed to to constructor then all recording and logging will
happen against that run_id.
If no run_id is passed into constructor, then the run ID will be fetched
from `mlflow.active_run()` each time `record_... | _example = get_input_example()
except Exception as e:
input_example_failure_msg = str(e)
input_example_user_msg = "Failed to gather input example: " + str(e)
model_signature = None
model_signature_user_msg = None
if log_model_signature:
try:
if input_exam... | 190 | 190 | 636 | 5 | 184 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | BatchMetricsLogger | BatchMetricsLogger | 206 | 288 | 206 | 206 | 2d2ee070741d17c1a1bc106696e6844cc93b3c39 | bigcode/the-stack | train |
beabdc853f581359f46f027f | train | function | def _validate_args(
user_call_args, user_call_kwargs, autologging_call_args, autologging_call_kwargs
):
"""
Used for testing purposes to verify that, when a patched ML function calls its underlying
/ original ML function, the following properties are satisfied:
- All arguments supplied to the p... | def _validate_args(
user_call_args, user_call_kwargs, autologging_call_args, autologging_call_kwargs
):
| """
Used for testing purposes to verify that, when a patched ML function calls its underlying
/ original ML function, the following properties are satisfied:
- All arguments supplied to the patched ML function are forwarded to the
original ML function
- Any additional arguments su... | validate_autologging_run(autologging_integration, run_id):
"""
For testing purposes, verifies that an MLflow run produced by an `autologging_integration`
satisfies the following properties:
- The run has an autologging tag whose value is the name of the autologging integration
- The run has... | 256 | 256 | 1,068 | 27 | 229 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _validate_args | _validate_args | 1,262 | 1,360 | 1,262 | 1,264 | b22d40b30f23274965bfc1e16dc9ba04501adc26 | bigcode/the-stack | train |
29ff497c92dafe9300cc1a65 | train | function | def _check_version_in_range(ver, min_ver, max_ver):
return LooseVersion(min_ver) <= LooseVersion(ver) <= LooseVersion(max_ver)
| def _check_version_in_range(ver, min_ver, max_ver):
| return LooseVersion(min_ver) <= LooseVersion(ver) <= LooseVersion(max_ver)
| to be logged will be logged.
:param run_id: ID of the run that the metrics will be logged to.
"""
batch_metrics_logger = BatchMetricsLogger(run_id)
yield batch_metrics_logger
batch_metrics_logger.flush()
def _check_version_in_range(ver, min_ver, max_ver):
| 64 | 64 | 32 | 14 | 50 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _check_version_in_range | _check_version_in_range | 313 | 314 | 313 | 313 | 0ba27bedc8a4eaa8f1c4ed4d30660768d8bae9e1 | bigcode/the-stack | train |
c1ca8ebe56abc8eb50576b5c | train | class | class _InputExampleInfo:
"""
Stores info about the input example collection before it is needed.
For example, in xgboost and lightgbm, an InputExampleInfo object is attached to the dataset,
where its value is read later by the train method.
Exactly one of input_example or error_msg should be popul... | class _InputExampleInfo:
| """
Stores info about the input example collection before it is needed.
For example, in xgboost and lightgbm, an InputExampleInfo object is attached to the dataset,
where its value is read later by the train method.
Exactly one of input_example or error_msg should be populated.
"""
def __... | settings = gorilla.Settings(allow_hit=True, store_hit=True)
original = getattr(destination, name)
wrapped = _update_wrapper_extended(patch, original)
patch = gorilla.Patch(destination, name, wrapped, settings=settings)
gorilla.apply(patch)
class _InputExampleInfo:
| 64 | 64 | 103 | 6 | 58 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _InputExampleInfo | _InputExampleInfo | 135 | 147 | 135 | 135 | b2795d226a1b834e3cf6303428cd64c28e434d19 | bigcode/the-stack | train |
6d875eb7c6b161c75c6edc7a | train | function | def safe_patch(
autologging_integration, destination, function_name, patch_function, manage_run=False
):
"""
Patches the specified `function_name` on the specified `destination` class for autologging
purposes, preceding its implementation with an error-safe copy of the specified patch
`patch_functio... | def safe_patch(
autologging_integration, destination, function_name, patch_function, manage_run=False
):
| """
Patches the specified `function_name` on the specified `destination` class for autologging
purposes, preceding its implementation with an error-safe copy of the specified patch
`patch_function` with the following error handling behavior:
- Exceptions thrown from the underlying / original fu... | kwargs
)
if self.managed_run:
try_mlflow_log(mlflow.end_run, RunStatus.to_string(RunStatus.FINISHED))
return result
def _on_exception(self, e):
if self.managed_run:
try_mlflow_log(mlflow.end_run, RunSt... | 256 | 256 | 1,779 | 24 | 231 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | safe_patch | safe_patch | 972 | 1,191 | 972 | 974 | dc28d78b7fd433164a47ae122dbeca548ff430ff | bigcode/the-stack | train |
73797cccbe80b1485124c743 | train | function | def autologging_integration(name):
"""
**All autologging integrations should be decorated with this wrapper.**
Wraps an autologging function in order to store its configuration arguments. This enables
patch functions to broadly obey certain configurations (e.g., disable=True) without
requiring spec... | def autologging_integration(name):
| """
**All autologging integrations should be decorated with this wrapper.**
Wraps an autologging function in order to store its configuration arguments. This enables
patch functions to broadly obey certain configurations (e.g., disable=True) without
requiring specific logic to be present in each au... | compatible with mlflow, if not compatible, log a warning message.
"""
if (
flavor_name in _cross_tested_flavor_to_module_name_and_module_key
and not get_autologging_config(flavor_name, "disable", True)
and not get_autologging_config(flavor_name, "disable_for_unsupported_versions", False... | 161 | 161 | 537 | 8 | 153 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | autologging_integration | autologging_integration | 397 | 453 | 397 | 397 | 0d656ee019c5af87d5f279474b1d533f4ad10e25 | bigcode/the-stack | train |
952465a498aa28bf2e443263 | train | function | def get_autologging_config(flavor_name, config_key, default_value=None):
"""
Returns a desired config value for a specified autologging integration.
Returns `None` if specified `flavor_name` has no recorded configs.
If `config_key` is not set on the config object, default value is returned.
:param ... | def get_autologging_config(flavor_name, config_key, default_value=None):
| """
Returns a desired config value for a specified autologging integration.
Returns `None` if specified `flavor_name` has no recorded configs.
If `config_key` is not set on the config object, default value is returned.
:param flavor_name: An autologging integration flavor name.
:param config_ke... | _module_name_and_module_key:
wrapped_autolog.__doc__ = (
_gen_autologging_package_version_requirements_doc(name) + wrapped_autolog.__doc__
)
return wrapped_autolog
return wrapper
def get_autologging_config(flavor_name, config_key, default_value=None):
| 64 | 64 | 150 | 17 | 46 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | get_autologging_config | get_autologging_config | 456 | 470 | 456 | 456 | 5cf67ec69ac2c0bd89a5eae190888e8a748f3228 | bigcode/the-stack | train |
71d1032da4f60229de6194ff | train | function | def _validate_autologging_run(autologging_integration, run_id):
"""
For testing purposes, verifies that an MLflow run produced by an `autologging_integration`
satisfies the following properties:
- The run has an autologging tag whose value is the name of the autologging integration
- The ru... | def _validate_autologging_run(autologging_integration, run_id):
| """
For testing purposes, verifies that an MLflow run produced by an `autologging_integration`
satisfies the following properties:
- The run has an autologging tag whose value is the name of the autologging integration
- The run has a terminal status (e.g., KILLED, FAILED, FINISHED)
"""... | sys.stderr`). For reference, see
# https://docs.python.org/3/library/warnings.html#warnings.showwarning
warnings.showwarning = autologging_showwarning
yield
finally:
warnings.showwarning = original_showwarning
def _validate_autologging_run(autologging_integration, run_id):
| 69 | 69 | 231 | 17 | 51 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _validate_autologging_run | _validate_autologging_run | 1,242 | 1,259 | 1,242 | 1,242 | b067fece05d298bc16fc8abf3d03cf9239d79862 | bigcode/the-stack | train |
b7241e27b044dc5d35672ee3 | train | function | def try_mlflow_log(fn, *args, **kwargs):
"""
Catch exceptions and log a warning to avoid autolog throwing.
"""
try:
return fn(*args, **kwargs)
except Exception as e:
if _is_testing():
raise
else:
warnings.warn("Logging to MLflow failed: " + str(e), sta... | def try_mlflow_log(fn, *args, **kwargs):
| """
Catch exceptions and log a warning to avoid autolog throwing.
"""
try:
return fn(*args, **kwargs)
except Exception as e:
if _is_testing():
raise
else:
warnings.warn("Logging to MLflow failed: " + str(e), stacklevel=2)
| ging is enabled before constructing the dataset."
)
_AUTOLOGGING_TEST_MODE_ENV_VAR = "MLFLOW_AUTOLOGGING_TESTING"
# Dict mapping integration name to its config.
AUTOLOGGING_INTEGRATIONS = {}
_logger = logging.getLogger(__name__)
def try_mlflow_log(fn, *args, **kwargs):
| 64 | 64 | 80 | 13 | 51 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | try_mlflow_log | try_mlflow_log | 41 | 51 | 41 | 41 | 64b500c6a9bd278b1522736fcccf23c0a0ccb99f | bigcode/the-stack | train |
a68b378dd5ab300b34eb6958 | train | class | class _AutologgingSessionManager:
_session = None
@classmethod
@contextmanager
def start_session(cls, integration):
try:
prev_session = cls._session
if prev_session is None:
session_id = uuid.uuid4().hex
cls._session = AutologgingSession(i... | class _AutologgingSessionManager:
| _session = None
@classmethod
@contextmanager
def start_session(cls, integration):
try:
prev_session = cls._session
if prev_session is None:
session_id = uuid.uuid4().hex
cls._session = AutologgingSession(integration, session_id)
... | using two fields:
# - integration: the name of the autologging integration corresponding to the session
# - id: a unique session identifier (e.g., a UUID)
AutologgingSession = namedtuple("AutologgingSession", ["integration", "id"])
class _AutologgingSessionManager:
| 63 | 64 | 166 | 8 | 55 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _AutologgingSessionManager | _AutologgingSessionManager | 639 | 664 | 639 | 639 | 2cb52964e01a136886696c5be3b87382529bcb80 | bigcode/the-stack | train |
652d63ed8cae6db3cefb7476 | train | function | def log_fn_args_as_params(fn, args, kwargs, unlogged=[]): # pylint: disable=W0102
"""
Log parameters explicitly passed to a function.
:param fn: function whose parameters are to be logged
:param args: arguments explicitly passed into fn. If `fn` is defined on a class,
`self` should no... | def log_fn_args_as_params(fn, args, kwargs, unlogged=[]): # pylint: disable=W0102
| """
Log parameters explicitly passed to a function.
:param fn: function whose parameters are to be logged
:param args: arguments explicitly passed into fn. If `fn` is defined on a class,
`self` should not be part of `args`; the caller is responsible for
filtering out `... | .
AUTOLOGGING_INTEGRATIONS = {}
_logger = logging.getLogger(__name__)
def try_mlflow_log(fn, *args, **kwargs):
"""
Catch exceptions and log a warning to avoid autolog throwing.
"""
try:
return fn(*args, **kwargs)
except Exception as e:
if _is_testing():
raise
e... | 122 | 122 | 408 | 25 | 97 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | log_fn_args_as_params | log_fn_args_as_params | 54 | 90 | 54 | 54 | cc187035ecaf6726018383b97df1655efc8bf54d | bigcode/the-stack | train |
b2ac5c05d3ef5f0f86dc1d50 | train | function | def _gen_autologging_package_version_requirements_doc(flavor_name):
"""
:return: A document note string saying the compatibility for the flavor's associated package
versions.
"""
_, module_key = _cross_tested_flavor_to_module_name_and_module_key[flavor_name]
min_ver, max_ver, pip_releas... | def _gen_autologging_package_version_requirements_doc(flavor_name):
| """
:return: A document note string saying the compatibility for the flavor's associated package
versions.
"""
_, module_key = _cross_tested_flavor_to_module_name_and_module_key[flavor_name]
min_ver, max_ver, pip_release = _get_min_max_version_and_pip_release(module_key)
required_pk... | actual_version = importlib.import_module(module_name).__version__
min_version, max_version, _ = _get_min_max_version_and_pip_release(module_key)
return _check_version_in_range(actual_version, min_version, max_version)
def _gen_autologging_package_version_requirements_doc(flavor_name):
| 64 | 64 | 189 | 15 | 49 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _gen_autologging_package_version_requirements_doc | _gen_autologging_package_version_requirements_doc | 358 | 374 | 358 | 358 | b826103039230b083be7385f8806a9c233ba18b9 | bigcode/the-stack | train |
65b3d7098e21a80bcf20987b | train | function | @contextlib.contextmanager
def batch_metrics_logger(run_id):
"""
Context manager that yields a BatchMetricsLogger object, which metrics can be logged against.
The BatchMetricsLogger keeps metrics in a list until it decides they should be logged, at
which point the accumulated metrics will be batch logge... | @contextlib.contextmanager
def batch_metrics_logger(run_id):
| """
Context manager that yields a BatchMetricsLogger object, which metrics can be logged against.
The BatchMetricsLogger keeps metrics in a list until it decides they should be logged, at
which point the accumulated metrics will be batch logged. The BatchMetricsLogger ensures
that logging imposes no... | 0
for key, value in metrics.items():
self.data.append(Metric(key, value, int(current_timestamp * 1000), step))
if self._should_flush():
self.flush()
self.previous_training_timestamp = current_timestamp
@contextlib.contextmanager
def batch_metrics_logger(run_id):
| 64 | 64 | 192 | 13 | 50 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | batch_metrics_logger | batch_metrics_logger | 291 | 310 | 291 | 292 | 5305501116ed642b4488fae271966cbba05fcd39 | bigcode/the-stack | train |
f57b73f814a586712c27f57b | train | function | def _is_testing():
"""
Indicates whether or not autologging functionality is running in test mode (as determined
by the `MLFLOW_AUTOLOGGING_TESTING` environment variable). Test mode performs additional
validation during autologging, including:
- Checks for the exception safety of arguments pass... | def _is_testing():
| """
Indicates whether or not autologging functionality is running in test mode (as determined
by the `MLFLOW_AUTOLOGGING_TESTING` environment variable). Test mode performs additional
validation during autologging, including:
- Checks for the exception safety of arguments passed to model trainin... | (
flavor_name in _cross_tested_flavor_to_module_name_and_module_key
and not _is_autologging_integration_supported(flavor_name)
):
return get_autologging_config(flavor_name, "disable_for_unsupported_versions", False)
return False
def _is_testing():
| 64 | 64 | 133 | 5 | 58 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _is_testing | _is_testing | 492 | 503 | 492 | 492 | caf65336cbf2819b3858c8ac51427aa47b007e53 | bigcode/the-stack | train |
9b3b2a53ac8aad4105c471e1 | train | function | def _is_autologging_integration_supported(flavor_name):
"""
:return: True if the flavor's associated package version is compatible with mlflow,
False otherwise.
"""
module_name, module_key = _cross_tested_flavor_to_module_name_and_module_key[flavor_name]
actual_version = importlib.impor... | def _is_autologging_integration_supported(flavor_name):
| """
:return: True if the flavor's associated package version is compatible with mlflow,
False otherwise.
"""
module_name, module_key = _cross_tested_flavor_to_module_name_and_module_key[flavor_name]
actual_version = importlib.import_module(module_name).__version__
min_version, max_v... | ging"]["minimum"]
max_version = _module_version_info_dict[module_key]["autologging"]["maximum"]
pip_release = _module_version_info_dict[module_key]["package_info"]["pip_release"]
return min_version, max_version, pip_release
def _is_autologging_integration_supported(flavor_name):
| 64 | 64 | 113 | 13 | 50 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _is_autologging_integration_supported | _is_autologging_integration_supported | 347 | 355 | 347 | 347 | 58f683b7590b0dbb8cb5bda069f2b2f7c7e637fd | bigcode/the-stack | train |
af51980f33d4ed1ddeeddcbd | train | class | class PatchFunction:
"""
Base class representing a function patch implementation with a callback for error handling.
`PatchFunction` should be subclassed and used in conjunction with `safe_patch` to
safely modify the implementation of a function. Subclasses of `PatchFunction` should
use `_patch_impl... | class PatchFunction:
| """
Base class representing a function patch implementation with a callback for error handling.
`PatchFunction` should be subclassed and used in conjunction with `safe_patch` to
safely modify the implementation of a function. Subclasses of `PatchFunction` should
use `_patch_implementation` to define... | # class DerivedClass(AbstractClass, metaclass=ExceptionSafeClass):
# ...
# ```
#
# This raises:
#
# ```
# TypeError: metaclass conflict: the metaclass of a derived class must be
# a (non-strict) subclass of the metaclasses of all its bases.
# ```
#
# To avoid this error, create `ExceptionSafeAbstractClass... | 109 | 109 | 365 | 4 | 105 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | PatchFunction | PatchFunction | 585 | 630 | 585 | 585 | 88529a17acffc8da0eab27cf3b9d7c944999c514 | bigcode/the-stack | train |
2c1241018f08be604bbba18a | train | function | def exception_safe_function(function):
"""
Wraps the specified function with broad exception handling to guard
against unexpected errors during autologging.
"""
if _is_testing():
setattr(function, _ATTRIBUTE_EXCEPTION_SAFE, True)
def safe_function(*args, **kwargs):
try:
... | def exception_safe_function(function):
| """
Wraps the specified function with broad exception handling to guard
against unexpected errors during autologging.
"""
if _is_testing():
setattr(function, _ATTRIBUTE_EXCEPTION_SAFE, True)
def safe_function(*args, **kwargs):
try:
return function(*args, **kwargs)
... | """
return os.environ.get(_AUTOLOGGING_TEST_MODE_ENV_VAR, "false") == "true"
# Function attribute used for testing purposes to verify that a given function
# has been wrapped with the `exception_safe_function` decorator
_ATTRIBUTE_EXCEPTION_SAFE = "exception_safe"
def exception_safe_function(function):
| 64 | 64 | 127 | 6 | 58 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | exception_safe_function | exception_safe_function | 511 | 529 | 511 | 511 | aea662c3ae05f805dd234ebbc5a825cad55dd092 | bigcode/the-stack | train |
cec07589345e8680a7644b1b | train | function | def resolve_input_example_and_signature(
get_input_example, infer_model_signature, log_input_example, log_model_signature, logger
):
"""
Handles the logic of calling functions to gather the input example and infer the model
signature.
:param get_input_example: function which returns an input exampl... | def resolve_input_example_and_signature(
get_input_example, infer_model_signature, log_input_example, log_model_signature, logger
):
| """
Handles the logic of calling functions to gather the input example and infer the model
signature.
:param get_input_example: function which returns an input example, usually sliced from a
dataset. This function can raise an exception, its message will be
... | = gorilla.Patch(destination, name, wrapped, settings=settings)
gorilla.apply(patch)
class _InputExampleInfo:
"""
Stores info about the input example collection before it is needed.
For example, in xgboost and lightgbm, an InputExampleInfo object is attached to the dataset,
where its value is rea... | 151 | 151 | 506 | 27 | 123 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | resolve_input_example_and_signature | resolve_input_example_and_signature | 150 | 203 | 150 | 152 | 10569add25758dac5f435e2b243bbe6e33b27474 | bigcode/the-stack | train |
f407cdcc35aa9ea266044f57 | train | function | def _update_wrapper_extended(wrapper, wrapped):
"""
Update a `wrapper` function to look like the `wrapped` function. This is an extension of
`functools.update_wrapper` that applies the docstring *and* signature of `wrapped` to
`wrapper`, producing a new function.
:return: A new function with the sa... | def _update_wrapper_extended(wrapper, wrapped):
| """
Update a `wrapper` function to look like the `wrapped` function. This is an extension of
`functools.update_wrapper` that applies the docstring *and* signature of `wrapped` to
`wrapper`, producing a new function.
:return: A new function with the same implementation as `wrapper` and the same docs... | not be logged, as specified by the `unlogged` parameter
params_to_log = {key: value for key, value in params_to_log.items() if key not in unlogged}
try_mlflow_log(mlflow.log_params, params_to_log)
def _update_wrapper_extended(wrapper, wrapped):
| 64 | 64 | 202 | 9 | 55 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _update_wrapper_extended | _update_wrapper_extended | 93 | 110 | 93 | 93 | a3a3c0f26f477a02bf335f0acd7b310fe074c404 | bigcode/the-stack | train |
6d4f5ca1c2cbbf83799dc1c5 | train | class | class AutologgingEventLogger:
"""
Provides instrumentation hooks for important autologging lifecycle events, including:
- Calls to `mlflow.autolog()` APIs
- Calls to patched APIs with associated termination states
("success" and "failure due to error")
- Calls to original / un... | class AutologgingEventLogger:
| """
Provides instrumentation hooks for important autologging lifecycle events, including:
- Calls to `mlflow.autolog()` APIs
- Calls to patched APIs with associated termination states
("success" and "failure due to error")
- Calls to original / underlying APIs made by patched ... | reraise
# the original implementation exception once the callback completes
raise e
# Represents an active autologging session using two fields:
# - integration: the name of the autologging integration corresponding to the session
# - id: a unique session identifier (e.g., a UUID)
Aut... | 256 | 256 | 2,197 | 7 | 248 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | AutologgingEventLogger | AutologgingEventLogger | 667 | 883 | 667 | 667 | f661e5017478a2b5ed09ab582d9913efd038c2ba | bigcode/the-stack | train |
6f0f1dc41f282059ee4ba873 | train | function | def autologging_is_disabled(flavor_name):
"""
Returns a boolean flag of whether the autologging integration is disabled.
:param flavor_name: An autologging integration flavor name.
"""
explicit_disabled = get_autologging_config(flavor_name, "disable", True)
if explicit_disabled:
return ... | def autologging_is_disabled(flavor_name):
| """
Returns a boolean flag of whether the autologging integration is disabled.
:param flavor_name: An autologging integration flavor name.
"""
explicit_disabled = get_autologging_config(flavor_name, "disable", True)
if explicit_disabled:
return True
if (
flavor_name in _cro... | .
:param default_value: The default_value to return
"""
config = AUTOLOGGING_INTEGRATIONS.get(flavor_name)
if config is not None:
return config.get(config_key, default_value)
else:
return default_value
def autologging_is_disabled(flavor_name):
| 64 | 64 | 131 | 10 | 53 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | autologging_is_disabled | autologging_is_disabled | 473 | 489 | 473 | 473 | 8f981460757a3b4568a0e6b1b0121e7ae38cd91d | bigcode/the-stack | train |
95e9b02f29547d98973d8042 | train | function | def _get_min_max_version_and_pip_release(module_key):
min_version = _module_version_info_dict[module_key]["autologging"]["minimum"]
max_version = _module_version_info_dict[module_key]["autologging"]["maximum"]
pip_release = _module_version_info_dict[module_key]["package_info"]["pip_release"]
return min_... | def _get_min_max_version_and_pip_release(module_key):
| min_version = _module_version_info_dict[module_key]["autologging"]["minimum"]
max_version = _module_version_info_dict[module_key]["autologging"]["maximum"]
pip_release = _module_version_info_dict[module_key]["package_info"]["pip_release"]
return min_version, max_version, pip_release
| ", "tensorflow"),
"xgboost": ("xgboost", "xgboost"),
"sklearn": ("sklearn", "sklearn"),
"pytorch": ("pytorch_lightning", "pytorch-lightning"),
}
def _get_min_max_version_and_pip_release(module_key):
| 64 | 64 | 78 | 13 | 51 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _get_min_max_version_and_pip_release | _get_min_max_version_and_pip_release | 340 | 344 | 340 | 340 | e638e8ae0267d20b7c282208245b386c0e3c3894 | bigcode/the-stack | train |
55c1b02db9d3f9a46045c892 | train | function | @contextmanager
def _augment_mlflow_warnings(autologging_integration):
"""
MLflow routines called by autologging patch code may issue warnings via the `warnings.warn`
API. In many cases, the user cannot remediate the cause of these warnings because
they result from the autologging patch implementation, ... | @contextmanager
def _augment_mlflow_warnings(autologging_integration):
| """
MLflow routines called by autologging patch code may issue warnings via the `warnings.warn`
API. In many cases, the user cannot remediate the cause of these warnings because
they result from the autologging patch implementation, rather than a user-facing API call.
Accordingly, this context mana... | run was created during the execution of patch code, verify that
# it is no longer active and that it contains expected autologging tags
assert not mlflow.active_run(), (
"Autologging integration %s leaked an active run" % autologging_integration
)
... | 150 | 150 | 500 | 18 | 132 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _augment_mlflow_warnings | _augment_mlflow_warnings | 1,194 | 1,239 | 1,194 | 1,195 | 955a1efffdafb50a3f4756ba11fcc7ce387fa0f2 | bigcode/the-stack | train |
81d658837c76eb4b53b11382 | train | function | def _check_and_log_warning_for_unsupported_integration(flavor_name):
"""
When autologging enabled disable_for_unsupported_versions disabled, check whether the flavor
package version is compatible with mlflow, if not compatible, log a warning message.
"""
if (
flavor_name in _cross_tested_fla... | def _check_and_log_warning_for_unsupported_integration(flavor_name):
| """
When autologging enabled disable_for_unsupported_versions disabled, check whether the flavor
package version is compatible with mlflow, if not compatible, log a warning message.
"""
if (
flavor_name in _cross_tested_flavor_to_module_name_and_module_key
and not get_autologging_con... | :: Autologging is known to be compatible with the following package versions: "
+ required_pkg_versions
+ ". Autologging may not succeed when used with package versions outside of this range."
+ "\n\n"
)
def _check_and_log_warning_for_unsupported_integration(flavor_name):
| 64 | 64 | 192 | 15 | 49 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _check_and_log_warning_for_unsupported_integration | _check_and_log_warning_for_unsupported_integration | 377 | 394 | 377 | 377 | 9e1613fc734840559ad4ad71c23d6e6e80ec650f | bigcode/the-stack | train |
594f58fb6027066c9a518c7c | train | function | def _load_version_file_as_dict():
version_file_path = resource_filename(__name__, "../ml-package-versions.yml")
with open(version_file_path) as f:
return yaml.load(f, Loader=yaml.SafeLoader)
| def _load_version_file_as_dict():
| version_file_path = resource_filename(__name__, "../ml-package-versions.yml")
with open(version_file_path) as f:
return yaml.load(f, Loader=yaml.SafeLoader)
| """
batch_metrics_logger = BatchMetricsLogger(run_id)
yield batch_metrics_logger
batch_metrics_logger.flush()
def _check_version_in_range(ver, min_ver, max_ver):
return LooseVersion(min_ver) <= LooseVersion(ver) <= LooseVersion(max_ver)
def _load_version_file_as_dict():
| 64 | 64 | 47 | 8 | 56 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | _load_version_file_as_dict | _load_version_file_as_dict | 317 | 320 | 317 | 317 | b454a1aa17b7d0b4be523deb70ac157b5bffd003 | bigcode/the-stack | train |
6750f4d00bb382b4c5ca313f | train | function | def with_managed_run(autologging_integration, patch_function, tags=None):
"""
Given a `patch_function`, returns an `augmented_patch_function` that wraps the execution of
`patch_function` with an active MLflow run. The following properties apply:
- An MLflow run is only created if there is no active... | def with_managed_run(autologging_integration, patch_function, tags=None):
| """
Given a `patch_function`, returns an `augmented_patch_function` that wraps the execution of
`patch_function` with an active MLflow run. The following properties apply:
- An MLflow run is only created if there is no active run present when the
patch function is executed
- If a... | underlying implementation terminates with an exception.
:param session: The `AutologgingSession` associated with the patched API call.
:param patch_obj: The object (class, module, etc) on which the original API was called.
:param function_name: The name of the original API that was called.
... | 214 | 214 | 716 | 18 | 196 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | with_managed_run | with_managed_run | 886 | 969 | 886 | 886 | 6db76e25ad86c55a7eff07f2029e023776a31cd5 | bigcode/the-stack | train |
be0c33b51c1eef442b6a0aab | train | function | def wrap_patch(destination, name, patch, settings=None):
"""
Apply a patch while preserving the attributes (e.g. __doc__) of an original function.
TODO(dbczumar): Convert this to an internal method once existing `wrap_patch` calls
outside of `autologging_utils` have been converted to `s... | def wrap_patch(destination, name, patch, settings=None):
| """
Apply a patch while preserving the attributes (e.g. __doc__) of an original function.
TODO(dbczumar): Convert this to an internal method once existing `wrap_patch` calls
outside of `autologging_utils` have been converted to `safe_patch`
:param destination: Patch destination
... | .estimator.Estimator.export_savedmodel()` function
try:
updated_wrapper.__signature__ = inspect.signature(wrapped)
except Exception:
_logger.debug("Failed to restore original signature for wrapper around %s", wrapped)
return updated_wrapper
def wrap_patch(destination, name, patch, settings=N... | 64 | 64 | 178 | 12 | 51 | bmello4688/mlflow | mlflow/utils/autologging_utils.py | Python | wrap_patch | wrap_patch | 113 | 132 | 113 | 113 | 8d8bb14d80fd3bbab0ddd12494ebdb50d0776774 | bigcode/the-stack | train |
1b5ec0e465ac9214aeb16f53 | train | class | class TestTable(unittest.TestCase):
def setUp(self):
self.testfilename = "t.nix"
self.file = nix.File.open(self.testfilename, nix.FileMode.Overwrite)
self.block = self.file.create_block("test_block", "abc")
di = {'name': np.int64, 'id': str, 'time': float, 'sig1':
np.f... | class TestTable(unittest.TestCase):
| def setUp(self):
self.testfilename = "t.nix"
self.file = nix.File.open(self.testfilename, nix.FileMode.Overwrite)
self.block = self.file.create_block("test_block", "abc")
di = {'name': np.int64, 'id': str, 'time': float, 'sig1':
np.float64, 'sig2': np.int64}
arr... | import numpy as np
import nixio as nix
import unittest
from nixworks.table import table
class TestTable(unittest.TestCase):
| 28 | 86 | 287 | 7 | 20 | mpsonntag/nixworks | nixworks/test/test_table.py | Python | TestTable | TestTable | 7 | 28 | 7 | 8 | a3ba798e2fc668b82d0ec29d05c9f36cef24daec | bigcode/the-stack | train |
cf497516e8686282dd724d01 | train | class | class File_System:
def __init__(self, folder_root):
self.folder_root = folder_root
self.folder_data = Files.path_combine(self.folder_root, 'data')
self.folder_indexes = Files.path_combine(self.folder_root, 'indexes')
def safe_string(self,value,join_char='_'):
re... | class File_System:
| def __init__(self, folder_root):
self.folder_root = folder_root
self.folder_data = Files.path_combine(self.folder_root, 'data')
self.folder_indexes = Files.path_combine(self.folder_root, 'indexes')
def safe_string(self,value,join_char='_'):
return join_char.join(... | import re
from osbot_utils.utils.Files import Files
from osbot_graphsv.api.Issue_Type import Issue_Type
class File_System:
| 29 | 64 | 135 | 4 | 24 | pbx-gs/OSBot-jira | OSBot-GraphDB/osbot_graphsv/api/File_System.py | Python | File_System | File_System | 8 | 25 | 8 | 9 | 2ab35770e477d9c2abed63bbccbea1b560af3786 | bigcode/the-stack | train |
37e639b7146ea34004b98000 | train | class | class Decoder(tf.keras.Model):
def __init__(self, batch_size, h_dim, input_dim):
super(Decoder, self).__init__()
self.batch_size = batch_size
self.h_dim = h_dim
self.input_dim = input_dim
self.dense0 = tf.keras.layers.Dense(24,
... | class Decoder(tf.keras.Model):
| def __init__(self, batch_size, h_dim, input_dim):
super(Decoder, self).__init__()
self.batch_size = batch_size
self.h_dim = h_dim
self.input_dim = input_dim
self.dense0 = tf.keras.layers.Dense(24,
name = 'dec_dens... | # -*- coding:utf-8 -*-
import os
import sys
import tensorflow as tf
import numpy as np
class Decoder(tf.keras.Model):
| 29 | 104 | 348 | 6 | 22 | takat0m0/test_code | tf2/seq_auto_encoder/decoder.py | Python | Decoder | Decoder | 9 | 55 | 9 | 9 | c06354591e58690ac54c148f27fdc41e140ef998 | bigcode/the-stack | train |
a7e046e8d4093b2f479c4170 | train | class | @override_settings(ROOT_URLCONF='admin_widgets.urls')
class ManyToManyRawIdWidgetTest(TestCase):
def test_render(self):
band = models.Band.objects.create(name='Linkin Park')
m1 = models.Member.objects.create(name='Chester')
m2 = models.Member.objects.create(name='Mike')
band.member... | @override_settings(ROOT_URLCONF='admin_widgets.urls')
class ManyToManyRawIdWidgetTest(TestCase):
| def test_render(self):
band = models.Band.objects.create(name='Linkin Park')
m1 = models.Member.objects.create(name='Chester')
m2 = models.Member.objects.create(name='Mike')
band.members.add(m1, m2)
rel = models.Band._meta.get_field('members').remote_field
w = widge... | child_of_hidden = models.Inventory.objects.create(
barcode=94, name='Child of hidden', parent=hidden
)
self.assertHTMLEqual(
w.render('test', child_of_hidden.parent_id, attrs={}),
'<input type="text" name="test" value="93" class="vForeignKeyRawIdAdminField" />... | 172 | 172 | 575 | 22 | 150 | himleyb85/django | tests/admin_widgets/tests.py | Python | ManyToManyRawIdWidgetTest | ManyToManyRawIdWidgetTest | 559 | 604 | 559 | 561 | 0c45d848cc129b357758bf84817a03979c41b0ef | bigcode/the-stack | train |
c08b4ff9d6c5202f0d52b7a4 | train | class | class TestDataMixin(object):
@classmethod
def setUpTestData(cls):
cls.u1 = User.objects.create(
pk=100, username='super', first_name='Super', last_name='User', email='super@example.com',
password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158', is_active=True, is_superuser... | class TestDataMixin(object):
@classmethod
| def setUpTestData(cls):
cls.u1 = User.objects.create(
pk=100, username='super', first_name='Super', last_name='User', email='super@example.com',
password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158', is_active=True, is_superuser=True,
is_staff=True, last_login=da... | default_storage
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models import CharField, DateField
from django.test import SimpleTestCase, TestCase, override_settings
from django.urls import reverse
from django.utils import six, translation
from . import models
from .widgetadmin import si... | 97 | 97 | 325 | 10 | 86 | himleyb85/django | tests/admin_widgets/tests.py | Python | TestDataMixin | TestDataMixin | 32 | 49 | 32 | 34 | 561f2dfe0b1501a67747de1d85783e5fdb0fa15d | bigcode/the-stack | train |
e551760aa8e36330199b0056 | train | class | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class RelatedFieldWidgetSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriverTestCase):
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available... | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class RelatedFieldWidgetSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriverTestCase):
| available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
def test_ForeignKey_using_to_field(self):
self.admin_login(username='super', password='secret', login_url='/')
self.selenium.get('%s%s' % (
... | href'))
link.click()
# The field now contains the two selected bands' ids
self.selenium.switch_to.window(main_window)
self.wait_for_value('#id_supporting_bands', '42,98')
class AdminRawIdWidgetSeleniumChromeTests(AdminRawIdWidgetSeleniumFirefoxTests):
webdriver_class = 'selenium.w... | 157 | 157 | 525 | 49 | 108 | himleyb85/django | tests/admin_widgets/tests.py | Python | RelatedFieldWidgetSeleniumFirefoxTests | RelatedFieldWidgetSeleniumFirefoxTests | 1,300 | 1,350 | 1,300 | 1,302 | 37cd4e5404e53344b649f6d09ba7c36858d1f1fe | bigcode/the-stack | train |
dbe2327b235be04300216d02 | train | class | class DateTimePickerShortcutsSeleniumIETests(DateTimePickerShortcutsSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
| class DateTimePickerShortcutsSeleniumIETests(DateTimePickerShortcutsSeleniumFirefoxTests):
| webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
| Less(member.birthdate, now + error_margin)
class DateTimePickerShortcutsSeleniumChromeTests(DateTimePickerShortcutsSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
class DateTimePickerShortcutsSeleniumIETests(DateTimePickerShortcutsSeleniumFirefoxTests):
| 64 | 64 | 34 | 21 | 43 | himleyb85/django | tests/admin_widgets/tests.py | Python | DateTimePickerShortcutsSeleniumIETests | DateTimePickerShortcutsSeleniumIETests | 884 | 885 | 884 | 884 | 630395f0b9e008d64e5eea4e4d387015ebb62119 | bigcode/the-stack | train |
75c43e723eaef6cae2a1c97e | train | class | class RelatedFieldWidgetSeleniumIETests(RelatedFieldWidgetSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
| class RelatedFieldWidgetSeleniumIETests(RelatedFieldWidgetSeleniumFirefoxTests):
| webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
| )
self.assertEqual(profiles[0].user.username, username_value)
class RelatedFieldWidgetSeleniumChromeTests(RelatedFieldWidgetSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
class RelatedFieldWidgetSeleniumIETests(RelatedFieldWidgetSeleniumFirefoxTests):
| 64 | 64 | 31 | 18 | 46 | himleyb85/django | tests/admin_widgets/tests.py | Python | RelatedFieldWidgetSeleniumIETests | RelatedFieldWidgetSeleniumIETests | 1,357 | 1,358 | 1,357 | 1,357 | 9fe100eaa3a4bf9f586ee43023ed2feb3a21d492 | bigcode/the-stack | train |
8c298802dea613be4362f624 | train | class | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class HorizontalVerticalFilterSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriverTestCase):
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
... | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class HorizontalVerticalFilterSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriverTestCase):
| available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
def setUp(self):
super(HorizontalVerticalFilterSeleniumFirefoxTests, self).setUp()
self.lisa = models.Student.objects.create(name='Lisa')
... | date, now + error_margin)
class DateTimePickerShortcutsSeleniumChromeTests(DateTimePickerShortcutsSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
class DateTimePickerShortcutsSeleniumIETests(DateTimePickerShortcutsSeleniumFirefoxTests):
webdriver_class = 'selenium.we... | 256 | 256 | 3,228 | 49 | 207 | himleyb85/django | tests/admin_widgets/tests.py | Python | HorizontalVerticalFilterSeleniumFirefoxTests | HorizontalVerticalFilterSeleniumFirefoxTests | 903 | 1,193 | 903 | 906 | 1ffa498676c3a897f2ac58ee9aaa591b6e885d1f | bigcode/the-stack | train |
0effe0656172e0ef278dd658 | train | class | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminFormfieldForDBFieldWithRequestTests(TestDataMixin, TestCase):
def test_filter_choices_by_request_user(self):
"""
Ensure the user can only see their own cars in t... | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminFormfieldForDBFieldWithRequestTests(TestDataMixin, TestCase):
| def test_filter_choices_by_request_user(self):
"""
Ensure the user can only see their own cars in the foreign key dropdown.
"""
self.client.login(username="super", password="secret")
response = self.client.get(reverse('admin:admin_widgets_cartire_add'))
self.assertNot... | "Control", or "Command" on a Mac, to select more than one.'
)
@override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminFormfieldForDBFieldWithRequestTests(TestDataMixin, TestCase):
| 64 | 64 | 127 | 45 | 19 | himleyb85/django | tests/admin_widgets/tests.py | Python | AdminFormfieldForDBFieldWithRequestTests | AdminFormfieldForDBFieldWithRequestTests | 198 | 209 | 198 | 201 | 8f1c5847016be86c38cf3194800a19492f6df3c2 | bigcode/the-stack | train |
e0aff65b0772d581fc398478 | train | class | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminForeignKeyWidgetChangeList(TestDataMixin, TestCase):
def setUp(self):
self.client.login(username="super", password="secret")
def test_changelist_ForeignKey(self):
... | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminForeignKeyWidgetChangeList(TestDataMixin, TestCase):
| def setUp(self):
self.client.login(username="super", password="secret")
def test_changelist_ForeignKey(self):
response = self.client.get(reverse('admin:admin_widgets_car_changelist'))
self.assertContains(response, '/auth/user/add/')
| .assertNotContains(response, "BMW M3")
self.assertContains(response, "Volkswagen Passat")
@override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminForeignKeyWidgetChangeList(TestDataMixin, TestCase):
| 64 | 64 | 100 | 42 | 22 | himleyb85/django | tests/admin_widgets/tests.py | Python | AdminForeignKeyWidgetChangeList | AdminForeignKeyWidgetChangeList | 212 | 221 | 212 | 215 | 6ab05bd0c75b52d7e1c729664544918ed8196b6d | bigcode/the-stack | train |
1982e8890772a08219e2bb08 | train | class | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminRawIdWidgetSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriverTestCase):
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
webdriv... | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminRawIdWidgetSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriverTestCase):
| available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
def setUp(self):
super(AdminRawIdWidgetSeleniumFirefoxTests, self).setUp()
models.Band.objects.create(id=42, name='Bogey Blues')
mode... | admin:admin_widgets_school_change', args=(self.school.id,))
self.selenium.get(self.live_server_url + change_url)
options_len = len(self.selenium.find_elements_by_css_selector('#id_students_to > option'))
self.assertEqual(options_len, 2)
# self.selenium.refresh() or send_keys(Keys.F5) d... | 249 | 249 | 832 | 50 | 199 | himleyb85/django | tests/admin_widgets/tests.py | Python | AdminRawIdWidgetSeleniumFirefoxTests | AdminRawIdWidgetSeleniumFirefoxTests | 1,204 | 1,289 | 1,204 | 1,206 | ab696914964abe043501016ca617d0253f5b0b12 | bigcode/the-stack | train |
d7ca1253413cb399b5fb3b30 | train | class | class DateTimePickerSeleniumChromeTests(DateTimePickerSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
| class DateTimePickerSeleniumChromeTests(DateTimePickerSeleniumFirefoxTests):
| webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
| # Click on the calendar icon
self.selenium.find_element_by_id('calendarlink0').click()
# Make sure that the right month and year are displayed
self.wait_for_text('#calendarin0 caption', expected_caption)
class DateTimePickerSeleniumChromeTests(DateTimePickerSeleniumFiref... | 64 | 64 | 29 | 16 | 48 | himleyb85/django | tests/admin_widgets/tests.py | Python | DateTimePickerSeleniumChromeTests | DateTimePickerSeleniumChromeTests | 811 | 812 | 811 | 811 | 366dae623f848dd246f69b4a92f3a434b94517b9 | bigcode/the-stack | train |
39e4f609b31fe8909911f14c | train | class | class HorizontalVerticalFilterSeleniumChromeTests(HorizontalVerticalFilterSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
| class HorizontalVerticalFilterSeleniumChromeTests(HorizontalVerticalFilterSeleniumFirefoxTests):
| webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
| button.
self.selenium.execute_script("location.reload()")
self.wait_page_loaded()
options_len = len(self.selenium.find_elements_by_css_selector('#id_students_to > option'))
self.assertEqual(options_len, 2)
class HorizontalVerticalFilterSeleniumChromeTests(HorizontalVerticalFilterSeleni... | 64 | 64 | 30 | 17 | 47 | himleyb85/django | tests/admin_widgets/tests.py | Python | HorizontalVerticalFilterSeleniumChromeTests | HorizontalVerticalFilterSeleniumChromeTests | 1,196 | 1,197 | 1,196 | 1,196 | bee3c97f0fb2afffd782730df56208a6b984156d | bigcode/the-stack | train |
a94d3f822c2234a2814c077a | train | class | class RelatedFieldWidgetWrapperTests(SimpleTestCase):
def test_no_can_add_related(self):
rel = models.Individual._meta.get_field('parent').remote_field
w = widgets.AdminRadioSelect()
# Used to fail with a name error.
w = widgets.RelatedFieldWidgetWrapper(w, rel, widget_admin_site)
... | class RelatedFieldWidgetWrapperTests(SimpleTestCase):
| def test_no_can_add_related(self):
rel = models.Individual._meta.get_field('parent').remote_field
w = widgets.AdminRadioSelect()
# Used to fail with a name error.
w = widgets.RelatedFieldWidgetWrapper(w, rel, widget_admin_site)
self.assertFalse(w.can_add_related)
def tes... | {'c1pk': c1.pk, 'c2pk': c2.pk}
)
self.assertHTMLEqual(
w.render('company_widget2', [c1.pk]),
'<input type="text" name="company_widget2" value="%(c1pk)s" />' % {'c1pk': c1.pk}
)
class RelatedFieldWidgetWrapperTests(SimpleTestCase):
| 85 | 85 | 285 | 10 | 75 | himleyb85/django | tests/admin_widgets/tests.py | Python | RelatedFieldWidgetWrapperTests | RelatedFieldWidgetWrapperTests | 607 | 639 | 607 | 607 | 582035bc452b5eaf63c49c30bafbe0b8bf9a8926 | bigcode/the-stack | train |
0c5b7b77af5db585b40df94b | train | class | class AdminRawIdWidgetSeleniumChromeTests(AdminRawIdWidgetSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
| class AdminRawIdWidgetSeleniumChromeTests(AdminRawIdWidgetSeleniumFirefoxTests):
| webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
| ('href'))
link.click()
# The field now contains the two selected bands' ids
self.selenium.switch_to.window(main_window)
self.wait_for_value('#id_supporting_bands', '42,98')
class AdminRawIdWidgetSeleniumChromeTests(AdminRawIdWidgetSeleniumFirefoxTests):
| 64 | 64 | 31 | 18 | 46 | himleyb85/django | tests/admin_widgets/tests.py | Python | AdminRawIdWidgetSeleniumChromeTests | AdminRawIdWidgetSeleniumChromeTests | 1,292 | 1,293 | 1,292 | 1,292 | 1dd31113c80de0cfeca1191ad29c2368d3bf111a | bigcode/the-stack | train |
ebd9dd12cc6cde03084147aa | train | class | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class DateTimePickerSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriverTestCase):
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
webdrive... | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class DateTimePickerSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriverTestCase):
| available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
def test_show_hide_date_time_picker_widgets(self):
"""
Ensure that pressing the ESC key closes the date and time picker
widgets.
... | )
def test_select_multiple_widget_cant_change_delete_related(self):
rel = models.Individual._meta.get_field('parent').remote_field
widget = forms.SelectMultiple()
wrapper = widgets.RelatedFieldWidgetWrapper(
widget, rel, widget_admin_site,
can_add_related=True,
... | 256 | 256 | 1,543 | 49 | 207 | himleyb85/django | tests/admin_widgets/tests.py | Python | DateTimePickerSeleniumFirefoxTests | DateTimePickerSeleniumFirefoxTests | 642 | 808 | 642 | 645 | 163adf82deba6062401609d88ad0b5f769d74864 | bigcode/the-stack | train |
802dd568dae2c5e520007434 | train | class | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminForeignKeyRawIdWidget(TestDataMixin, TestCase):
def setUp(self):
self.client.login(username="super", password="secret")
def test_nonexistent_target_id(self):
... | @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminForeignKeyRawIdWidget(TestDataMixin, TestCase):
| def setUp(self):
self.client.login(username="super", password="secret")
def test_nonexistent_target_id(self):
band = models.Band.objects.create(name='Bogey Blues')
pk = band.pk
band.delete()
post_data = {
"main_band": '%s' % pk,
}
# Try postin... | HA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class AdminForeignKeyWidgetChangeList(TestDataMixin, TestCase):
def setUp(self):
self.client.login(username="super", password="secret")
def test_changelist_ForeignKey(self):
response = self.client.get(reverse('admin:admin_widgets_car_... | 128 | 129 | 433 | 42 | 86 | himleyb85/django | tests/admin_widgets/tests.py | Python | AdminForeignKeyRawIdWidget | AdminForeignKeyRawIdWidget | 224 | 265 | 224 | 227 | 96122a19d6312fa4509a3a0292e368fd28688d37 | bigcode/the-stack | train |
176a67049c159e3bccac0cf2 | train | class | class HorizontalVerticalFilterSeleniumIETests(HorizontalVerticalFilterSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
| class HorizontalVerticalFilterSeleniumIETests(HorizontalVerticalFilterSeleniumFirefoxTests):
| webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
| id_students_to > option'))
self.assertEqual(options_len, 2)
class HorizontalVerticalFilterSeleniumChromeTests(HorizontalVerticalFilterSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
class HorizontalVerticalFilterSeleniumIETests(HorizontalVerticalFilterSeleniumFiref... | 64 | 64 | 31 | 18 | 46 | himleyb85/django | tests/admin_widgets/tests.py | Python | HorizontalVerticalFilterSeleniumIETests | HorizontalVerticalFilterSeleniumIETests | 1,200 | 1,201 | 1,200 | 1,200 | de6c2e225c6fcd112e3c7c048172d691e5fa8dd0 | bigcode/the-stack | train |
895cbd9d4a4033d3330c8268 | train | class | class RelatedFieldWidgetSeleniumChromeTests(RelatedFieldWidgetSeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
| class RelatedFieldWidgetSeleniumChromeTests(RelatedFieldWidgetSeleniumFirefoxTests):
| webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
| ', 'The profile "changednewuser" was added successfully.')
profiles = models.Profile.objects.all()
self.assertEqual(len(profiles), 1)
self.assertEqual(profiles[0].user.username, username_value)
class RelatedFieldWidgetSeleniumChromeTests(RelatedFieldWidgetSeleniumFirefoxTests):
| 64 | 64 | 30 | 17 | 47 | himleyb85/django | tests/admin_widgets/tests.py | Python | RelatedFieldWidgetSeleniumChromeTests | RelatedFieldWidgetSeleniumChromeTests | 1,353 | 1,354 | 1,353 | 1,353 | cac4d510d45384a6978d0d56ad335924bff730ba | bigcode/the-stack | train |
454974e3be8f29817c533abd | train | class | @override_settings(ROOT_URLCONF='admin_widgets.urls')
class ForeignKeyRawIdWidgetTest(TestCase):
def test_render(self):
band = models.Band.objects.create(name='Linkin Park')
band.album_set.create(
name='Hybrid Theory', cover_art=r'albums\hybrid_theory.jpg'
)
rel = models... | @override_settings(ROOT_URLCONF='admin_widgets.urls')
class ForeignKeyRawIdWidgetTest(TestCase):
| def test_render(self):
band = models.Band.objects.create(name='Linkin Park')
band.album_set.create(
name='Hybrid Theory', cover_art=r'albums\hybrid_theory.jpg'
)
rel = models.Album._meta.get_field('band').remote_field
w = widgets.ForeignKeyRawIdWidget(rel, widget... | (''),
},
)
self.assertHTMLEqual(
w.render('test', SimpleUploadedFile('test', b'content')),
'<input type="file" name="test" />',
)
def test_readonly_fields(self):
"""
File widgets should render as a link when they're marked "read only."
... | 256 | 256 | 1,040 | 21 | 235 | himleyb85/django | tests/admin_widgets/tests.py | Python | ForeignKeyRawIdWidgetTest | ForeignKeyRawIdWidgetTest | 467 | 556 | 467 | 469 | 56ca6de298f7171e9eeb882c7251f36f2d02c7d0 | bigcode/the-stack | train |
b652f48c3fc15313ad22de02 | train | class | @skipIf(pytz is None, "this test requires pytz")
@override_settings(TIME_ZONE='Asia/Singapore')
@override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class DateTimePickerShortcutsSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriverTestCa... | @skipIf(pytz is None, "this test requires pytz")
@override_settings(TIME_ZONE='Asia/Singapore')
@override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='admin_widgets.urls')
class DateTimePickerShortcutsSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDriverTestCa... | available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
def test_date_time_picker_shortcuts(self):
"""
Ensure that date/time/datetime picker shortcuts work in the current time zone.
Refs #2... | self.selenium.find_element_by_id('calendarlink0').click()
# Make sure that the right month and year are displayed
self.wait_for_text('#calendarin0 caption', expected_caption)
class DateTimePickerSeleniumChromeTests(DateTimePickerSeleniumFirefoxTests):
webdriver_clas... | 179 | 179 | 597 | 79 | 100 | himleyb85/django | tests/admin_widgets/tests.py | Python | DateTimePickerShortcutsSeleniumFirefoxTests | DateTimePickerShortcutsSeleniumFirefoxTests | 819 | 877 | 819 | 823 | 9ebae61aec6a629a39ebb4007ae7d4c03fac64de | bigcode/the-stack | train |
34521973c8df2071d834c5b9 | train | class | class AdminURLWidgetTest(SimpleTestCase):
def test_render(self):
w = widgets.AdminURLFieldWidget()
self.assertHTMLEqual(
w.render('test', ''),
'<input class="vURLField" name="test" type="url" />'
)
self.assertHTMLEqual(
w.render('test', 'http://exa... | class AdminURLWidgetTest(SimpleTestCase):
| def test_render(self):
w = widgets.AdminURLFieldWidget()
self.assertHTMLEqual(
w.render('test', ''),
'<input class="vURLField" name="test" type="url" />'
)
self.assertHTMLEqual(
w.render('test', 'http://example.com'),
'<p class="url">Cu... | ="2007-12-01" type="text" class="vDateField" '
'name="test_0" size="10" /><br />'
'Time: <input value="09:30:00" type="text" class="vTimeField" '
'name="test_1" size="8" /></p>'
)
def test_localization(self):
w = widgets.AdminSplitDateTime()
with self.se... | 248 | 248 | 829 | 9 | 239 | himleyb85/django | tests/admin_widgets/tests.py | Python | AdminURLWidgetTest | AdminURLWidgetTest | 353 | 407 | 353 | 353 | bf965efdf98ff927bd16fdfb7aa6969e7c98a743 | bigcode/the-stack | train |
106e8b546d1c4edd24cd9fa7 | train | class | class AdminTimeWidgetTest(SimpleTestCase):
def test_attrs(self):
"""
Ensure that user-supplied attrs are used.
Refs #12073.
"""
w = widgets.AdminTimeWidget()
self.assertHTMLEqual(
w.render('test', datetime(2007, 12, 1, 9, 30)),
'<input value="0... | class AdminTimeWidgetTest(SimpleTestCase):
| def test_attrs(self):
"""
Ensure that user-supplied attrs are used.
Refs #12073.
"""
w = widgets.AdminTimeWidget()
self.assertHTMLEqual(
w.render('test', datetime(2007, 12, 1, 9, 30)),
'<input value="09:30:00" type="text" class="vTimeField" nam... | .render('test', datetime(2007, 12, 1, 9, 30)),
'<input value="2007-12-01" type="text" class="myDateField" name="test" size="20" />',
)
class AdminTimeWidgetTest(SimpleTestCase):
| 64 | 64 | 200 | 9 | 55 | himleyb85/django | tests/admin_widgets/tests.py | Python | AdminTimeWidgetTest | AdminTimeWidgetTest | 307 | 323 | 307 | 307 | 17c853463bb9d3bd9bf4811d43eac9dcdbb9256b | bigcode/the-stack | train |
b9973a623b9856877f7c2cdb | train | class | class SeleniumDataMixin(object):
def setUp(self):
self.u1 = User.objects.create(
pk=100, username='super', first_name='Super', last_name='User', email='super@example.com',
password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158', is_active=True, is_superuser=True,
i... | class SeleniumDataMixin(object):
| def setUp(self):
self.u1 = User.objects.create(
pk=100, username='super', first_name='Super', last_name='User', email='super@example.com',
password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158', is_active=True, is_superuser=True,
is_staff=True, last_login=datetime... | , 20, 10)
)
models.Car.objects.create(id=1, owner=cls.u1, make='Volkswagen', model='Passat')
models.Car.objects.create(id=2, owner=cls.u2, make='BMW', model='M3')
class SeleniumDataMixin(object):
| 64 | 64 | 140 | 6 | 58 | himleyb85/django | tests/admin_widgets/tests.py | Python | SeleniumDataMixin | SeleniumDataMixin | 52 | 59 | 52 | 52 | 9621b0a8267688b6892e76a2a5a1d0c8b2997ba1 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.