Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
TempDirectoryTypeRegistry.get_delete
(self, kind)
Get configured auto-delete flag for a given TempDirectory type, default True.
Get configured auto-delete flag for a given TempDirectory type, default True.
def get_delete(self, kind): # type: (str) -> bool """Get configured auto-delete flag for a given TempDirectory type, default True. """ return self._should_delete.get(kind, True)
[ "def", "get_delete", "(", "self", ",", "kind", ")", ":", "# type: (str) -> bool", "return", "self", ".", "_should_delete", ".", "get", "(", "kind", ",", "True", ")" ]
[ 63, 4 ]
[ 68, 50 ]
python
en
['en', 'en', 'en']
True
TempDirectory._create
(self, kind)
Create a temporary directory and store its path in self.path
Create a temporary directory and store its path in self.path
def _create(self, kind): # type: (str) -> str """Create a temporary directory and store its path in self.path """ # We realpath here because some systems have their default tmpdir # symlinked to another directory. This tends to confuse build # scripts, so we canonicalize...
[ "def", "_create", "(", "self", ",", "kind", ")", ":", "# type: (str) -> str", "# We realpath here because some systems have their default tmpdir", "# symlinked to another directory. This tends to confuse build", "# scripts, so we canonicalize the path by traversing potential", "# symlinks h...
[ 176, 4 ]
[ 188, 19 ]
python
en
['en', 'en', 'en']
True
TempDirectory.cleanup
(self)
Remove the temporary directory created and reset state
Remove the temporary directory created and reset state
def cleanup(self): # type: () -> None """Remove the temporary directory created and reset state """ self._deleted = True if os.path.exists(self._path): # Make sure to pass unicode on Python 2 to make the contents also # use unicode, ensuring non-ASCII name...
[ "def", "cleanup", "(", "self", ")", ":", "# type: () -> None", "self", ".", "_deleted", "=", "True", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "_path", ")", ":", "# Make sure to pass unicode on Python 2 to make the contents also", "# use unicode, ens...
[ 190, 4 ]
[ 198, 43 ]
python
en
['en', 'en', 'en']
True
AdjacentTempDirectory._generate_names
(cls, name)
Generates a series of temporary names. The algorithm replaces the leading characters in the name with ones that are valid filesystem characters, but are not valid package names (for both Python and pip definitions of package).
Generates a series of temporary names.
def _generate_names(cls, name): # type: (str) -> Iterator[str] """Generates a series of temporary names. The algorithm replaces the leading characters in the name with ones that are valid filesystem characters, but are not valid package names (for both Python and pip definitions...
[ "def", "_generate_names", "(", "cls", ",", "name", ")", ":", "# type: (str) -> Iterator[str]", "for", "i", "in", "range", "(", "1", ",", "len", "(", "name", ")", ")", ":", "for", "candidate", "in", "itertools", ".", "combinations_with_replacement", "(", "cls...
[ 228, 4 ]
[ 250, 34 ]
python
en
['en', 'en', 'en']
True
custom_parse_args
(argv=None, evaluation=False)
Parse default SampleFactory arguments and add user-defined arguments on top. Allow to override argv for unit tests. Default value (None) means use sys.argv. Setting the evaluation flag to True adds additional CLI arguments for evaluating the policy (see the enjoy_ script).
Parse default SampleFactory arguments and add user-defined arguments on top. Allow to override argv for unit tests. Default value (None) means use sys.argv. Setting the evaluation flag to True adds additional CLI arguments for evaluating the policy (see the enjoy_ script).
def custom_parse_args(argv=None, evaluation=False): """ Parse default SampleFactory arguments and add user-defined arguments on top. Allow to override argv for unit tests. Default value (None) means use sys.argv. Setting the evaluation flag to True adds additional CLI arguments for evaluating the policy...
[ "def", "custom_parse_args", "(", "argv", "=", "None", ",", "evaluation", "=", "False", ")", ":", "parser", "=", "arg_parser", "(", "argv", ",", "evaluation", "=", "evaluation", ")", "# add custom args here", "parser", ".", "add_argument", "(", "'--my_custom_arg'...
[ 22, 0 ]
[ 36, 14 ]
python
en
['en', 'error', 'th']
False
add_extra_params_func
(env, parser)
Specify any additional command line arguments for this family of custom environments.
Specify any additional command line arguments for this family of custom environments.
def add_extra_params_func(env, parser): """ Specify any additional command line arguments for this family of custom environments. """ p = parser p.add_argument('--custom_env_num_actions', default=10, type=int, help='Number of actions in my custom env') p.add_argument('--custom_env_episode_len', ...
[ "def", "add_extra_params_func", "(", "env", ",", "parser", ")", ":", "p", "=", "parser", "p", ".", "add_argument", "(", "'--custom_env_num_actions'", ",", "default", "=", "10", ",", "type", "=", "int", ",", "help", "=", "'Number of actions in my custom env'", ...
[ 76, 0 ]
[ 82, 109 ]
python
en
['en', 'error', 'th']
False
override_default_params_func
(env, parser)
Override default argument values for this family of environments. All experiments for environments from my_custom_env_ family will have these parameters unless different values are passed from command line.
Override default argument values for this family of environments. All experiments for environments from my_custom_env_ family will have these parameters unless different values are passed from command line.
def override_default_params_func(env, parser): """ Override default argument values for this family of environments. All experiments for environments from my_custom_env_ family will have these parameters unless different values are passed from command line. """ parser.set_defaults( enco...
[ "def", "override_default_params_func", "(", "env", ",", "parser", ")", ":", "parser", ".", "set_defaults", "(", "encoder_custom", "=", "'custom_env_encoder'", ",", "hidden_size", "=", "128", ",", ")" ]
[ 85, 0 ]
[ 95, 5 ]
python
en
['en', 'error', 'th']
False
main
()
Script entry point.
Script entry point.
def main(): """Script entry point.""" register_custom_components() cfg = custom_parse_args() status = run_algorithm(cfg) return status
[ "def", "main", "(", ")", ":", "register_custom_components", "(", ")", "cfg", "=", "custom_parse_args", "(", ")", "status", "=", "run_algorithm", "(", "cfg", ")", "return", "status" ]
[ 137, 0 ]
[ 142, 17 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.check_musicxml_and_sequence
(self, musicxml, sequence_proto)
Compares MusicXMLDocument object against a sequence proto. Args: musicxml: A MusicXMLDocument object. sequence_proto: A NoteSequence proto.
Compares MusicXMLDocument object against a sequence proto.
def check_musicxml_and_sequence(self, musicxml, sequence_proto): """Compares MusicXMLDocument object against a sequence proto. Args: musicxml: A MusicXMLDocument object. sequence_proto: A NoteSequence proto. """ # Test time signature changes. self.assertEqual(len(musicxml.get_time_signa...
[ "def", "check_musicxml_and_sequence", "(", "self", ",", "musicxml", ",", "sequence_proto", ")", ":", "# Test time signature changes.", "self", ".", "assertEqual", "(", "len", "(", "musicxml", ".", "get_time_signatures", "(", ")", ")", ",", "len", "(", "sequence_pr...
[ 129, 2 ]
[ 212, 20 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.check_musicxml_to_sequence
(self, filename)
Test the translation from MusicXML to Sequence proto.
Test the translation from MusicXML to Sequence proto.
def check_musicxml_to_sequence(self, filename): """Test the translation from MusicXML to Sequence proto.""" source_musicxml = musicxml_parser.MusicXMLDocument(filename) sequence_proto = musicxml_reader.musicxml_to_sequence_proto(source_musicxml) self.check_musicxml_and_sequence(source_musicxml, sequence...
[ "def", "check_musicxml_to_sequence", "(", "self", ",", "filename", ")", ":", "source_musicxml", "=", "musicxml_parser", ".", "MusicXMLDocument", "(", "filename", ")", "sequence_proto", "=", "musicxml_reader", ".", "musicxml_to_sequence_proto", "(", "source_musicxml", ")...
[ 214, 2 ]
[ 218, 69 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.check_fmajor_scale
(self, filename, part_name)
Verify MusicXML scale file. Verify that it contains the correct pitches (sounding pitch) and durations. Args: filename: file to test. part_name: name of the part the sequence is expected to contain.
Verify MusicXML scale file.
def check_fmajor_scale(self, filename, part_name): """Verify MusicXML scale file. Verify that it contains the correct pitches (sounding pitch) and durations. Args: filename: file to test. part_name: name of the part the sequence is expected to contain. """ expected_ns = testing_lib.pa...
[ "def", "check_fmajor_scale", "(", "self", ",", "filename", ",", "part_name", ")", ":", "expected_ns", "=", "testing_lib", ".", "parse_test_proto", "(", "music_pb2", ".", "NoteSequence", ",", "\"\"\"\n ticks_per_quarter: 220\n source_info: {\n source_typ...
[ 220, 2 ]
[ 275, 55 ]
python
it
['it', 'it', 'en']
True
MusicXMLParserTest.testsimplemusicxmltosequence
(self)
Test the simple flute scale MusicXML file.
Test the simple flute scale MusicXML file.
def testsimplemusicxmltosequence(self): """Test the simple flute scale MusicXML file.""" self.check_musicxml_to_sequence(self.flute_scale_filename) self.check_fmajor_scale(self.flute_scale_filename, 'Flute')
[ "def", "testsimplemusicxmltosequence", "(", "self", ")", ":", "self", ".", "check_musicxml_to_sequence", "(", "self", ".", "flute_scale_filename", ")", "self", ".", "check_fmajor_scale", "(", "self", ".", "flute_scale_filename", ",", "'Flute'", ")" ]
[ 277, 2 ]
[ 280, 63 ]
python
en
['en', 'it', 'en']
True
MusicXMLParserTest.testcomplexmusicxmltosequence
(self)
Test the complex band score MusicXML file.
Test the complex band score MusicXML file.
def testcomplexmusicxmltosequence(self): """Test the complex band score MusicXML file.""" self.check_musicxml_to_sequence(self.band_score_filename)
[ "def", "testcomplexmusicxmltosequence", "(", "self", ")", ":", "self", ".", "check_musicxml_to_sequence", "(", "self", ".", "band_score_filename", ")" ]
[ 282, 2 ]
[ 284, 61 ]
python
en
['en', 'it', 'en']
True
MusicXMLParserTest.testtransposedxmltosequence
(self)
Test the translation from transposed MusicXML to Sequence proto. Compare a transposed MusicXML file (clarinet) to an identical untransposed sequence (flute).
Test the translation from transposed MusicXML to Sequence proto.
def testtransposedxmltosequence(self): """Test the translation from transposed MusicXML to Sequence proto. Compare a transposed MusicXML file (clarinet) to an identical untransposed sequence (flute). """ untransposed_musicxml = musicxml_parser.MusicXMLDocument( self.flute_scale_filename) ...
[ "def", "testtransposedxmltosequence", "(", "self", ")", ":", "untransposed_musicxml", "=", "musicxml_parser", ".", "MusicXMLDocument", "(", "self", ".", "flute_scale_filename", ")", "transposed_musicxml", "=", "musicxml_parser", ".", "MusicXMLDocument", "(", "self", "."...
[ 286, 2 ]
[ 299, 75 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.testcompressedmxlunicodefilename
(self)
Test an MXL file containing a unicode filename within its zip archive.
Test an MXL file containing a unicode filename within its zip archive.
def testcompressedmxlunicodefilename(self): """Test an MXL file containing a unicode filename within its zip archive.""" unicode_filename = os.path.join( testing_lib.get_testdata_dir(), 'unicode_filename.mxl') sequence = musicxml_reader.musicxml_file_to_sequence_proto(unicode_filename) self.ass...
[ "def", "testcompressedmxlunicodefilename", "(", "self", ")", ":", "unicode_filename", "=", "os", ".", "path", ".", "join", "(", "testing_lib", ".", "get_testdata_dir", "(", ")", ",", "'unicode_filename.mxl'", ")", "sequence", "=", "musicxml_reader", ".", "musicxml...
[ 301, 2 ]
[ 307, 37 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.testcompressedxmltosequence
(self)
Test the translation from compressed MusicXML to Sequence proto. Compare a compressed MusicXML file to an identical uncompressed sequence.
Test the translation from compressed MusicXML to Sequence proto.
def testcompressedxmltosequence(self): """Test the translation from compressed MusicXML to Sequence proto. Compare a compressed MusicXML file to an identical uncompressed sequence. """ uncompressed_musicxml = musicxml_parser.MusicXMLDocument( self.flute_scale_filename) compressed_musicxml =...
[ "def", "testcompressedxmltosequence", "(", "self", ")", ":", "uncompressed_musicxml", "=", "musicxml_parser", ".", "MusicXMLDocument", "(", "self", ".", "flute_scale_filename", ")", "compressed_musicxml", "=", "musicxml_parser", ".", "MusicXMLDocument", "(", "self", "."...
[ 309, 2 ]
[ 321, 63 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.testmultiplecompressedxmltosequence
(self)
Test the translation from compressed MusicXML with multiple rootfiles. The example MXL file contains a MusicXML file of the Flute F Major scale, as well as the PNG rendering of the score contained within the single MXL file.
Test the translation from compressed MusicXML with multiple rootfiles.
def testmultiplecompressedxmltosequence(self): """Test the translation from compressed MusicXML with multiple rootfiles. The example MXL file contains a MusicXML file of the Flute F Major scale, as well as the PNG rendering of the score contained within the single MXL file. """ uncompressed_mus...
[ "def", "testmultiplecompressedxmltosequence", "(", "self", ")", ":", "uncompressed_musicxml", "=", "musicxml_parser", ".", "MusicXMLDocument", "(", "self", ".", "flute_scale_filename", ")", "compressed_musicxml", "=", "musicxml_parser", ".", "MusicXMLDocument", "(", "self...
[ 323, 2 ]
[ 337, 63 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.testrhythmdurationsxmltosequence
(self)
Test the rhythm durations MusicXML file.
Test the rhythm durations MusicXML file.
def testrhythmdurationsxmltosequence(self): """Test the rhythm durations MusicXML file.""" self.check_musicxml_to_sequence(self.rhythm_durations_filename)
[ "def", "testrhythmdurationsxmltosequence", "(", "self", ")", ":", "self", ".", "check_musicxml_to_sequence", "(", "self", ".", "rhythm_durations_filename", ")" ]
[ 339, 2 ]
[ 341, 67 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.testFluteScale
(self)
Verify properties of the flute scale.
Verify properties of the flute scale.
def testFluteScale(self): """Verify properties of the flute scale.""" ns = musicxml_reader.musicxml_file_to_sequence_proto( self.flute_scale_filename) expected_ns = testing_lib.parse_test_proto( music_pb2.NoteSequence, """ ticks_per_quarter: 220 time_signatures: { ...
[ "def", "testFluteScale", "(", "self", ")", ":", "ns", "=", "musicxml_reader", ".", "musicxml_file_to_sequence_proto", "(", "self", ".", "flute_scale_filename", ")", "expected_ns", "=", "testing_lib", ".", "parse_test_proto", "(", "music_pb2", ".", "NoteSequence", ",...
[ 343, 2 ]
[ 385, 43 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.test_atonal_transposition
(self)
Test that transposition works when changing instrument transposition. This can occur within a single part in a score where the score has no key signature / is atonal. Examples include changing from a non-transposing instrument to a transposing one (ex. Flute to Bb Clarinet) or vice versa, or changing a...
Test that transposition works when changing instrument transposition.
def test_atonal_transposition(self): """Test that transposition works when changing instrument transposition. This can occur within a single part in a score where the score has no key signature / is atonal. Examples include changing from a non-transposing instrument to a transposing one (ex. Flute to B...
[ "def", "test_atonal_transposition", "(", "self", ")", ":", "ns", "=", "musicxml_reader", ".", "musicxml_file_to_sequence_proto", "(", "self", ".", "atonal_transposition_filename", ")", "expected_ns", "=", "testing_lib", ".", "parse_test_proto", "(", "music_pb2", ".", ...
[ 387, 2 ]
[ 435, 43 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.test_incomplete_measures
(self)
Test that incomplete measures have the correct time signature. This can occur in pickup bars or incomplete measures. For example, if the time signature in the MusicXML is 4/4, but the measure only contains one quarter note, Magenta expects this pickup measure to have a time signature of 1/4.
Test that incomplete measures have the correct time signature.
def test_incomplete_measures(self): """Test that incomplete measures have the correct time signature. This can occur in pickup bars or incomplete measures. For example, if the time signature in the MusicXML is 4/4, but the measure only contains one quarter note, Magenta expects this pickup measure to h...
[ "def", "test_incomplete_measures", "(", "self", ")", ":", "ns", "=", "musicxml_reader", ".", "musicxml_file_to_sequence_proto", "(", "self", ".", "time_signature_filename", ")", "# One time signature per measure", "self", ".", "assertLen", "(", "ns", ".", "time_signatur...
[ 437, 2 ]
[ 451, 33 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.test_unmetered_music
(self)
Test that time signatures are inserted for music without time signatures. MusicXML does not require the use of time signatures. Music without time signatures occur in medieval chant, cadenzas, and contemporary music.
Test that time signatures are inserted for music without time signatures.
def test_unmetered_music(self): """Test that time signatures are inserted for music without time signatures. MusicXML does not require the use of time signatures. Music without time signatures occur in medieval chant, cadenzas, and contemporary music. """ ns = musicxml_reader.musicxml_file_to_seque...
[ "def", "test_unmetered_music", "(", "self", ")", ":", "ns", "=", "musicxml_reader", ".", "musicxml_file_to_sequence_proto", "(", "self", ".", "unmetered_filename", ")", "expected_ns", "=", "testing_lib", ".", "parse_test_proto", "(", "music_pb2", ".", "NoteSequence", ...
[ 453, 2 ]
[ 529, 43 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.test_st_anne
(self)
Verify properties of the St. Anne file. The file contains 2 parts and 4 voices.
Verify properties of the St. Anne file.
def test_st_anne(self): """Verify properties of the St. Anne file. The file contains 2 parts and 4 voices. """ ns = musicxml_reader.musicxml_file_to_sequence_proto( self.st_anne_filename) expected_ns = testing_lib.parse_test_proto( music_pb2.NoteSequence, """ ticks_p...
[ "def", "test_st_anne", "(", "self", ")", ":", "ns", "=", "musicxml_reader", ".", "musicxml_file_to_sequence_proto", "(", "self", ".", "st_anne_filename", ")", "expected_ns", "=", "testing_lib", ".", "parse_test_proto", "(", "music_pb2", ".", "NoteSequence", ",", "...
[ 531, 2 ]
[ 784, 43 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.test_empty_part_name
(self)
Verify that a part with an empty name can be parsed.
Verify that a part with an empty name can be parsed.
def test_empty_part_name(self): """Verify that a part with an empty name can be parsed.""" xml = br"""<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd"> ...
[ "def", "test_empty_part_name", "(", "self", ")", ":", "xml", "=", "br\"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n <!DOCTYPE score-partwise PUBLIC\n \"-//Recordare//DTD MusicXML 3.0 Partwise//EN\"\n \"http://www.musicxml.org/dtds/partwise.dtd\">\n <...
[ 786, 2 ]
[ 830, 43 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.test_empty_part_list
(self)
Verify that a part without a corresponding score-part can be parsed.
Verify that a part without a corresponding score-part can be parsed.
def test_empty_part_list(self): """Verify that a part without a corresponding score-part can be parsed.""" xml = br"""<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/part...
[ "def", "test_empty_part_list", "(", "self", ")", ":", "xml", "=", "br\"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n <!DOCTYPE score-partwise PUBLIC\n \"-//Recordare//DTD MusicXML 3.0 Partwise//EN\"\n \"http://www.musicxml.org/dtds/partwise.dtd\">\n <...
[ 832, 2 ]
[ 871, 43 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.test_empty_doc
(self)
Verify that an empty doc can be parsed.
Verify that an empty doc can be parsed.
def test_empty_doc(self): """Verify that an empty doc can be parsed.""" xml = br"""<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd"> <score-partwise ve...
[ "def", "test_empty_doc", "(", "self", ")", ":", "xml", "=", "br\"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n <!DOCTYPE score-partwise PUBLIC\n \"-//Recordare//DTD MusicXML 3.0 Partwise//EN\"\n \"http://www.musicxml.org/dtds/partwise.dtd\">\n <score-...
[ 873, 2 ]
[ 907, 43 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.test_whole_measure_rest_forward
(self)
Test that a whole measure rest can be encoded using <forward>. A whole measure rest is usually encoded as a <note> with a duration equal to that of a whole measure. An alternative encoding is to use the <forward> element to advance the time cursor to a duration equal to that of a whole measure. This im...
Test that a whole measure rest can be encoded using <forward>.
def test_whole_measure_rest_forward(self): """Test that a whole measure rest can be encoded using <forward>. A whole measure rest is usually encoded as a <note> with a duration equal to that of a whole measure. An alternative encoding is to use the <forward> element to advance the time cursor to a dura...
[ "def", "test_whole_measure_rest_forward", "(", "self", ")", ":", "ns", "=", "musicxml_reader", ".", "musicxml_file_to_sequence_proto", "(", "self", ".", "whole_measure_rest_forward_filename", ")", "expected_ns", "=", "testing_lib", ".", "parse_test_proto", "(", "music_pb2...
[ 962, 2 ]
[ 1036, 43 ]
python
en
['en', 'en', 'en']
True
MusicXMLParserTest.test_meter
(self)
Test that meters are encoded properly. Musical meters are expressed as a ratio of beats to divisions. The MusicXML parser uses this ratio in lowest terms for timing purposes. However, the meters should be in the actual terms when appearing in a NoteSequence.
Test that meters are encoded properly.
def test_meter(self): """Test that meters are encoded properly. Musical meters are expressed as a ratio of beats to divisions. The MusicXML parser uses this ratio in lowest terms for timing purposes. However, the meters should be in the actual terms when appearing in a NoteSequence. """ ns ...
[ "def", "test_meter", "(", "self", ")", ":", "ns", "=", "musicxml_reader", ".", "musicxml_file_to_sequence_proto", "(", "self", ".", "meter_test_filename", ")", "expected_ns", "=", "testing_lib", ".", "parse_test_proto", "(", "music_pb2", ".", "NoteSequence", ",", ...
[ 1038, 2 ]
[ 1599, 43 ]
python
en
['en', 'en', 'en']
True
ScriptMaker._build_shebang
(self, executable, post_interp)
Build a shebang line. In the simple case (on Windows, or a shebang line which is not too long or contains spaces) use a simple formulation for the shebang. Otherwise, use /bin/sh as the executable, with a contrived shebang which allows the script to run either under Python or sh, using ...
Build a shebang line. In the simple case (on Windows, or a shebang line which is not too long or contains spaces) use a simple formulation for the shebang. Otherwise, use /bin/sh as the executable, with a contrived shebang which allows the script to run either under Python or sh, using ...
def _build_shebang(self, executable, post_interp): """ Build a shebang line. In the simple case (on Windows, or a shebang line which is not too long or contains spaces) use a simple formulation for the shebang. Otherwise, use /bin/sh as the executable, with a contrived shebang wh...
[ "def", "_build_shebang", "(", "self", ",", "executable", ",", "post_interp", ")", ":", "if", "os", ".", "name", "!=", "'posix'", ":", "simple_shebang", "=", "True", "else", ":", "# Add 3 for '#!' prefix and newline suffix.", "shebang_length", "=", "len", "(", "e...
[ 126, 4 ]
[ 155, 21 ]
python
en
['en', 'error', 'th']
False
ScriptMaker.make
(self, specification, options=None)
Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by copying from a source location). ...
Make a script.
def make(self, specification, options=None): """ Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by ...
[ "def", "make", "(", "self", ",", "specification", ",", "options", "=", "None", ")", ":", "filenames", "=", "[", "]", "entry", "=", "get_export_entry", "(", "specification", ")", "if", "entry", "is", "None", ":", "self", ".", "_copy_script", "(", "specifi...
[ 390, 4 ]
[ 407, 24 ]
python
en
['en', 'error', 'th']
False
ScriptMaker.make_multiple
(self, specifications, options=None)
Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to,
Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to,
def make_multiple(self, specifications, options=None): """ Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to, """ filenames = [] for specification in spec...
[ "def", "make_multiple", "(", "self", ",", "specifications", ",", "options", "=", "None", ")", ":", "filenames", "=", "[", "]", "for", "specification", "in", "specifications", ":", "filenames", ".", "extend", "(", "self", ".", "make", "(", "specification", ...
[ 409, 4 ]
[ 418, 24 ]
python
en
['en', 'error', 'th']
False
Marker.evaluate
(self, environment=None)
Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Python process.
Evaluate a marker.
def evaluate(self, environment=None): # type: (Optional[Dict[str, str]]) -> bool """Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. ...
[ "def", "evaluate", "(", "self", ",", "environment", "=", "None", ")", ":", "# type: (Optional[Dict[str, str]]) -> bool", "current_environment", "=", "default_environment", "(", ")", "if", "environment", "is", "not", "None", ":", "current_environment", ".", "update", ...
[ 313, 4 ]
[ 327, 68 ]
python
en
['en', 'en', 'en']
True
SequenceLikelihood.get_num_categories
(cls)
:returns: The number of likelihood categories in the enum.
:returns: The number of likelihood categories in the enum.
def get_num_categories(cls): """:returns: The number of likelihood categories in the enum.""" return 4
[ "def", "get_num_categories", "(", "cls", ")", ":", "return", "4" ]
[ 59, 4 ]
[ 61, 16 ]
python
en
['en', 'af', 'en']
True
MiscTest.test_data_type_schema
(self)
We really only test this to get test coverage. The code covered here is really only used in testing tools.
We really only test this to get test coverage. The code covered here is really only used in testing tools.
def test_data_type_schema(self) -> None: """ We really only test this to get test coverage. The code covered here is really only used in testing tools. """ test_schema = DictType( [ ("type", Equals("realm")), ("maybe_n", OptionalType(i...
[ "def", "test_data_type_schema", "(", "self", ")", "->", "None", ":", "test_schema", "=", "DictType", "(", "[", "(", "\"type\"", ",", "Equals", "(", "\"realm\"", ")", ")", ",", "(", "\"maybe_n\"", ",", "OptionalType", "(", "int", ")", ")", ",", "(", "\"...
[ 17, 4 ]
[ 57, 79 ]
python
en
['en', 'error', 'th']
False
Attribute.__init__
(self, schema, root, aty)
@param aty: Array type information. @type aty: The value of wsdl:arrayType.
def __init__(self, schema, root, aty): """ @param aty: Array type information. @type aty: The value of wsdl:arrayType. """ SXAttribute.__init__(self, schema, root) if aty.endswith('[]'): self.aty = aty[:-2] else: self.aty = aty
[ "def", "__init__", "(", "self", ",", "schema", ",", "root", ",", "aty", ")", ":", "SXAttribute", ".", "__init__", "(", "self", ",", "schema", ",", "root", ")", "if", "aty", ".", "endswith", "(", "'[]'", ")", ":", "self", ".", "aty", "=", "aty", "...
[ 35, 4 ]
[ 44, 26 ]
python
en
['en', 'error', 'th']
False
add_provision_check_override_param
(parser: ArgumentParser)
Registers --skip-provision-check argument to be used with various commands/tests in our tools.
Registers --skip-provision-check argument to be used with various commands/tests in our tools.
def add_provision_check_override_param(parser: ArgumentParser) -> None: """ Registers --skip-provision-check argument to be used with various commands/tests in our tools. """ parser.add_argument( "--skip-provision-check", action="store_true", help="Skip check that provision has b...
[ "def", "add_provision_check_override_param", "(", "parser", ":", "ArgumentParser", ")", "->", "None", ":", "parser", ".", "add_argument", "(", "\"--skip-provision-check\"", ",", "action", "=", "\"store_true\"", ",", "help", "=", "\"Skip check that provision has been run; ...
[ 93, 0 ]
[ 101, 5 ]
python
en
['en', 'error', 'th']
False
PopulationBasedTraining._perturb
(self, old_params, default_params)
Params assumed to be a flat dict.
Params assumed to be a flat dict.
def _perturb(self, old_params, default_params): """Params assumed to be a flat dict.""" params = copy.deepcopy(old_params) for key, value in params.items(): if isinstance(value, (tuple, list)): # this is the case for reward shaping delta params params...
[ "def", "_perturb", "(", "self", ",", "old_params", ",", "default_params", ")", ":", "params", "=", "copy", ".", "deepcopy", "(", "old_params", ")", "for", "key", ",", "value", "in", "params", ".", "items", "(", ")", ":", "if", "isinstance", "(", "value...
[ 190, 4 ]
[ 204, 21 ]
python
en
['en', 'en', 'en']
True
invalid_config_error_message
(action, key, val)
Returns a better error message when invalid configuration option is provided.
Returns a better error message when invalid configuration option is provided.
def invalid_config_error_message(action, key, val): """Returns a better error message when invalid configuration option is provided.""" if action in ('store_true', 'store_false'): return ("{0} is not a valid value for {1} option, " "please specify a boolean value like yes/no, " ...
[ "def", "invalid_config_error_message", "(", "action", ",", "key", ",", "val", ")", ":", "if", "action", "in", "(", "'store_true'", ",", "'store_false'", ")", ":", "return", "(", "\"{0} is not a valid value for {1} option, \"", "\"please specify a boolean value like yes/no...
[ 255, 0 ]
[ 265, 40 ]
python
en
['en', 'fr', 'en']
True
PrettyHelpFormatter._format_option_strings
(self, option, mvarfmt=' <{}>', optsep=', ')
Return a comma-separated list of option strings and metavars. :param option: tuple of (short opt, long opt), e.g: ('-f', '--format') :param mvarfmt: metavar format string :param optsep: separator
Return a comma-separated list of option strings and metavars.
def _format_option_strings(self, option, mvarfmt=' <{}>', optsep=', '): """ Return a comma-separated list of option strings and metavars. :param option: tuple of (short opt, long opt), e.g: ('-f', '--format') :param mvarfmt: metavar format string :param optsep: separator ...
[ "def", "_format_option_strings", "(", "self", ",", "option", ",", "mvarfmt", "=", "' <{}>'", ",", "optsep", "=", "', '", ")", ":", "opts", "=", "[", "]", "if", "option", ".", "_short_opts", ":", "opts", ".", "append", "(", "option", ".", "_short_opts", ...
[ 35, 4 ]
[ 56, 28 ]
python
en
['en', 'error', 'th']
False
PrettyHelpFormatter.format_usage
(self, usage)
Ensure there is only one newline between usage and the first heading if there is no description.
Ensure there is only one newline between usage and the first heading if there is no description.
def format_usage(self, usage): """ Ensure there is only one newline between usage and the first heading if there is no description. """ msg = '\nUsage: {}\n'.format( self.indent_lines(textwrap.dedent(usage), " ")) return msg
[ "def", "format_usage", "(", "self", ",", "usage", ")", ":", "msg", "=", "'\\nUsage: {}\\n'", ".", "format", "(", "self", ".", "indent_lines", "(", "textwrap", ".", "dedent", "(", "usage", ")", ",", "\" \"", ")", ")", "return", "msg" ]
[ 63, 4 ]
[ 70, 18 ]
python
en
['en', 'error', 'th']
False
CustomOptionParser.insert_option_group
(self, idx, *args, **kwargs)
Insert an OptionGroup at a given position.
Insert an OptionGroup at a given position.
def insert_option_group(self, idx, *args, **kwargs): """Insert an OptionGroup at a given position.""" group = self.add_option_group(*args, **kwargs) self.option_groups.pop() self.option_groups.insert(idx, group) return group
[ "def", "insert_option_group", "(", "self", ",", "idx", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "group", "=", "self", ".", "add_option_group", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "option_groups", ".", "pop", "(", ...
[ 117, 4 ]
[ 124, 20 ]
python
en
['en', 'en', 'en']
True
CustomOptionParser.option_list_all
(self)
Get a list of all options, including those in option groups.
Get a list of all options, including those in option groups.
def option_list_all(self): """Get a list of all options, including those in option groups.""" res = self.option_list[:] for i in self.option_groups: res.extend(i.option_list) return res
[ "def", "option_list_all", "(", "self", ")", ":", "res", "=", "self", ".", "option_list", "[", ":", "]", "for", "i", "in", "self", ".", "option_groups", ":", "res", ".", "extend", "(", "i", ".", "option_list", ")", "return", "res" ]
[ 127, 4 ]
[ 133, 18 ]
python
en
['en', 'en', 'en']
True
ConfigOptionParser._update_defaults
(self, defaults)
Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).
Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).
def _update_defaults(self, defaults): """Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).""" # Accumulate complex default state. self.values = optparse.Values(self.defaults) ...
[ "def", "_update_defaults", "(", "self", ",", "defaults", ")", ":", "# Accumulate complex default state.", "self", ".", "values", "=", "optparse", ".", "Values", "(", "self", ".", "defaults", ")", "late_eval", "=", "set", "(", ")", "# Then set the options with thos...
[ 180, 4 ]
[ 227, 23 ]
python
en
['en', 'en', 'en']
True
ConfigOptionParser.get_default_values
(self)
Overriding to make updating the defaults after instantiation of the option parser possible, _update_defaults() does the dirty work.
Overriding to make updating the defaults after instantiation of the option parser possible, _update_defaults() does the dirty work.
def get_default_values(self): """Overriding to make updating the defaults after instantiation of the option parser possible, _update_defaults() does the dirty work.""" if not self.process_default_values: # Old, pre-Optik 1.5 behaviour. return optparse.Values(self.defaults...
[ "def", "get_default_values", "(", "self", ")", ":", "if", "not", "self", ".", "process_default_values", ":", "# Old, pre-Optik 1.5 behaviour.", "return", "optparse", ".", "Values", "(", "self", ".", "defaults", ")", "# Load the configuration, or error out in case of an er...
[ 229, 4 ]
[ 248, 40 ]
python
en
['en', 'en', 'en']
True
Main.setUp
(self)
Setting up test.
Setting up test.
def setUp(self): """Setting up test.""" self.server_url = self.conf_get('main', 'url')
[ "def", "setUp", "(", "self", ")", ":", "self", ".", "server_url", "=", "self", ".", "conf_get", "(", "'main'", ",", "'url'", ")" ]
[ 12, 4 ]
[ 14, 54 ]
python
en
['en', 'en', 'en']
True
Navigation._go_to_page
(self, path, page_class=None)
Go to page specified via path parameter. * page_class parameter overrides basic process for receiving pageobject
Go to page specified via path parameter.
def _go_to_page(self, path, page_class=None): """Go to page specified via path parameter. * page_class parameter overrides basic process for receiving pageobject """ path_len = len(path) if path_len < self.MIN_SUB_LEVEL or path_len > self.MAX_SUB_LEVEL: r...
[ "def", "_go_to_page", "(", "self", ",", "path", ",", "page_class", "=", "None", ")", ":", "path_len", "=", "len", "(", "path", ")", "if", "path_len", "<", "self", ".", "MIN_SUB_LEVEL", "or", "path_len", ">", "self", ".", "MAX_SUB_LEVEL", ":", "raise", ...
[ 177, 4 ]
[ 206, 77 ]
python
en
['en', 'en', 'en']
True
Navigation._go_to_settings_page
(self, item_text)
Go to page that is located under the settings tab.
Go to page that is located under the settings tab.
def _go_to_settings_page(self, item_text): """Go to page that is located under the settings tab.""" self.topbar.user_dropdown_menu.click_on_settings() self.navaccordion.click_on_menu_items(third_level=item_text)
[ "def", "_go_to_settings_page", "(", "self", ",", "item_text", ")", ":", "self", ".", "topbar", ".", "user_dropdown_menu", ".", "click_on_settings", "(", ")", "self", ".", "navaccordion", ".", "click_on_menu_items", "(", "third_level", "=", "item_text", ")" ]
[ 212, 4 ]
[ 215, 68 ]
python
en
['en', 'en', 'en']
True
Navigation._go_to_side_menu_page
(self, menu_items)
Go to page that is located in the side menu (navaccordion).
Go to page that is located in the side menu (navaccordion).
def _go_to_side_menu_page(self, menu_items): """Go to page that is located in the side menu (navaccordion).""" self.navaccordion.click_on_menu_items(*menu_items)
[ "def", "_go_to_side_menu_page", "(", "self", ",", "menu_items", ")", ":", "self", ".", "navaccordion", ".", "click_on_menu_items", "(", "*", "menu_items", ")" ]
[ 217, 4 ]
[ 219, 58 ]
python
en
['en', 'en', 'en']
True
Navigation._get_page_cls_name
(self, filename)
Gather page class name from path. * take last item from path (should be python filename without extension) * make the first letter capital * append 'Page'
Gather page class name from path.
def _get_page_cls_name(self, filename): """Gather page class name from path. * take last item from path (should be python filename without extension) * make the first letter capital * append 'Page' """ cls_name = "".join((filename.capitalize(), "Page")) ...
[ "def", "_get_page_cls_name", "(", "self", ",", "filename", ")", ":", "cls_name", "=", "\"\"", ".", "join", "(", "(", "filename", ".", "capitalize", "(", ")", ",", "\"Page\"", ")", ")", "return", "cls_name" ]
[ 221, 4 ]
[ 230, 23 ]
python
en
['en', 'en', 'en']
True
Navigation._initialize_go_to_methods
(cls)
Create all navigation methods based on the PAGE_STRUCTURE.
Create all navigation methods based on the PAGE_STRUCTURE.
def _initialize_go_to_methods(cls): """Create all navigation methods based on the PAGE_STRUCTURE.""" def rec(items, sub_menus): if isinstance(items, dict): for sub_menu, sub_item in items.items(): rec(sub_item, sub_menus + (sub_menu,)) elif is...
[ "def", "_initialize_go_to_methods", "(", "cls", ")", ":", "def", "rec", "(", "items", ",", "sub_menus", ")", ":", "if", "isinstance", "(", "items", ",", "dict", ")", ":", "for", "sub_menu", ",", "sub_item", "in", "items", ".", "items", "(", ")", ":", ...
[ 296, 4 ]
[ 313, 42 ]
python
en
['en', 'en', 'en']
True
Navigation.unify_page_path
(cls, path, preserve_spaces=True)
Unify path to page. Replace '&' in path with 'and', remove spaces (if not specified otherwise) and convert path to lower case.
Unify path to page.
def unify_page_path(cls, path, preserve_spaces=True): """Unify path to page. Replace '&' in path with 'and', remove spaces (if not specified otherwise) and convert path to lower case. """ path = path.replace("&", "and") path = path.lower() if preserve_spaces: ...
[ "def", "unify_page_path", "(", "cls", ",", "path", ",", "preserve_spaces", "=", "True", ")", ":", "path", "=", "path", ".", "replace", "(", "\"&\"", ",", "\"and\"", ")", "path", "=", "path", ".", "lower", "(", ")", "if", "preserve_spaces", ":", "path",...
[ 332, 4 ]
[ 344, 19 ]
python
en
['en', 'en', 'en']
True
handler500
(request)
500 error handler. Templates: `500.html` Context: None
500 error handler.
def handler500(request): """ 500 error handler. Templates: `500.html` Context: None """ from django.template import Context, loader from django.http import HttpResponseServerError context = {'request': request} t = loader.get_template('sentry/500.html') return HttpResponseServ...
[ "def", "handler500", "(", "request", ")", ":", "from", "django", ".", "template", "import", "Context", ",", "loader", "from", "django", ".", "http", "import", "HttpResponseServerError", "context", "=", "{", "'request'", ":", "request", "}", "t", "=", "loader...
[ 18, 0 ]
[ 31, 62 ]
python
en
['en', 'error', 'th']
False
__py_new
(name, data=b'', **kwargs)
new(name, data=b'', **kwargs) - Return a new hashing object using the named algorithm; optionally initialized with data (which must be bytes).
new(name, data=b'', **kwargs) - Return a new hashing object using the named algorithm; optionally initialized with data (which must be bytes).
def __py_new(name, data=b'', **kwargs): """new(name, data=b'', **kwargs) - Return a new hashing object using the named algorithm; optionally initialized with data (which must be bytes). """ return __get_builtin_constructor(name)(data, **kwargs)
[ "def", "__py_new", "(", "name", ",", "data", "=", "b''", ",", "*", "*", "kwargs", ")", ":", "return", "__get_builtin_constructor", "(", "name", ")", "(", "data", ",", "*", "*", "kwargs", ")" ]
[ 130, 0 ]
[ 134, 58 ]
python
en
['en', 'en', 'en']
True
__hash_new
(name, data=b'', **kwargs)
new(name, data=b'') - Return a new hashing object using the named algorithm; optionally initialized with data (which must be bytes).
new(name, data=b'') - Return a new hashing object using the named algorithm; optionally initialized with data (which must be bytes).
def __hash_new(name, data=b'', **kwargs): """new(name, data=b'') - Return a new hashing object using the named algorithm; optionally initialized with data (which must be bytes). """ if name in {'blake2b', 'blake2s'}: # Prefer our blake2 implementation. # OpenSSL 1.1.0 comes with a limite...
[ "def", "__hash_new", "(", "name", ",", "data", "=", "b''", ",", "*", "*", "kwargs", ")", ":", "if", "name", "in", "{", "'blake2b'", ",", "'blake2s'", "}", ":", "# Prefer our blake2 implementation.", "# OpenSSL 1.1.0 comes with a limited implementation of blake2b/s.", ...
[ 137, 0 ]
[ 154, 52 ]
python
en
['en', 'en', 'en']
True
MessageDictTest.test_both_codepaths
(self)
We have two different codepaths that extract a particular shape of dictionary for messages to send to clients: events: These are the events we send to MANY clients when a message is originally sent. fetch: ...
We have two different codepaths that extract a particular shape of dictionary for messages to send to clients:
def test_both_codepaths(self) -> None: """ We have two different codepaths that extract a particular shape of dictionary for messages to send to clients: events: These are the events we send to MANY clients when a message is originally ...
[ "def", "test_both_codepaths", "(", "self", ")", "->", "None", ":", "def", "reload_message", "(", "msg_id", ":", "int", ")", "->", "Message", ":", "# Get a clean copy of the message, and", "# clear the cache.", "cache_delete", "(", "to_dict_cache_key_id", "(", "msg_id"...
[ 28, 4 ]
[ 140, 65 ]
python
en
['en', 'error', 'th']
False
MessageHydrationTest.test_display_recipient_up_to_date
(self)
This is a test for a bug where due to caching of message_dicts, after updating a user's information, fetching those cached messages via messages_for_ids would return message_dicts with display_recipient still having the old information. The returned message_dicts should have up-...
This is a test for a bug where due to caching of message_dicts, after updating a user's information, fetching those cached messages via messages_for_ids would return message_dicts with display_recipient still having the old information. The returned message_dicts should have up-...
def test_display_recipient_up_to_date(self) -> None: """ This is a test for a bug where due to caching of message_dicts, after updating a user's information, fetching those cached messages via messages_for_ids would return message_dicts with display_recipient still having the old...
[ "def", "test_display_recipient_up_to_date", "(", "self", ")", "->", "None", ":", "hamlet", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", "cordelia", "=", "self", ".", "example_user", "(", "\"cordelia\"", ")", "message_id", "=", "self", ".", "send_p...
[ 436, 4 ]
[ 479, 81 ]
python
en
['en', 'error', 'th']
False
AboutPageTest.test_split_by
(self)
Utility function primarily used in authors page
Utility function primarily used in authors page
def test_split_by(self) -> None: """Utility function primarily used in authors page""" flat_list = [1, 2, 3, 4, 5, 6, 7, 8, 9] expected_result = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] self.assertEqual(split_by(flat_list, 3, None), expected_result)
[ "def", "test_split_by", "(", "self", ")", "->", "None", ":", "flat_list", "=", "[", "1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7", ",", "8", ",", "9", "]", "expected_result", "=", "[", "[", "1", ",", "2", ",", "3", "]", ...
[ 362, 4 ]
[ 366, 71 ]
python
en
['en', 'en', 'en']
True
Analyzer.__init__
(self, features)
Create Analyzer object. Args: features (features.Features): Features object with created FeaturesClass objects
Create Analyzer object.
def __init__(self, features): """Create Analyzer object. Args: features (features.Features): Features object with created FeaturesClass objects """ self.features = features self.max_categories = features.max_categories self.default_plot_design = PlotDesign()
[ "def", "__init__", "(", "self", ",", "features", ")", ":", "self", ".", "features", "=", "features", "self", ".", "max_categories", "=", "features", ".", "max_categories", "self", ".", "default_plot_design", "=", "PlotDesign", "(", ")" ]
[ 24, 4 ]
[ 32, 47 ]
python
de
['de', 'pl', 'en']
False
Analyzer.numerical_describe_df
(self)
Return numerical DataFrame if len of Numerical features in the data is greater than 0, None otherwise. Returns: {pandas.DataFrame, None}: pandas.Dataframe when Numerical features are present, None otherwise.
Return numerical DataFrame if len of Numerical features in the data is greater than 0, None otherwise.
def numerical_describe_df(self): """Return numerical DataFrame if len of Numerical features in the data is greater than 0, None otherwise. Returns: {pandas.DataFrame, None}: pandas.Dataframe when Numerical features are present, None otherwise. """ if len(self.features.numeri...
[ "def", "numerical_describe_df", "(", "self", ")", ":", "if", "len", "(", "self", ".", "features", ".", "numerical_features", "(", ")", ")", ">", "0", ":", "return", "self", ".", "_create_describe_df", "(", "self", ".", "features", ".", "numerical_features", ...
[ 34, 4 ]
[ 43, 23 ]
python
en
['en', 'en', 'en']
True
Analyzer.categorical_describe_df
(self)
Return categorical DataFrame if len of Categorical features in the data is greater than 0, None otherwise. Returns: {pandas.DataFrame, None}: pandas.Dataframe when Categorical features are present, None otherwise.
Return categorical DataFrame if len of Categorical features in the data is greater than 0, None otherwise.
def categorical_describe_df(self): """Return categorical DataFrame if len of Categorical features in the data is greater than 0, None otherwise. Returns: {pandas.DataFrame, None}: pandas.Dataframe when Categorical features are present, None otherwise. """ if len(self.feature...
[ "def", "categorical_describe_df", "(", "self", ")", ":", "if", "len", "(", "self", ".", "features", ".", "categorical_features", "(", ")", ")", ">", "0", ":", "return", "self", ".", "_create_describe_df", "(", "self", ".", "features", ".", "categorical_featu...
[ 45, 4 ]
[ 54, 23 ]
python
en
['en', 'en', 'en']
True
Analyzer.df_head
(self)
Return transposed, first 5 rows of original DataFrame (excluding unusued features). Returns: pandas.DataFrame: head of the DataFrame, transposed
Return transposed, first 5 rows of original DataFrame (excluding unusued features).
def df_head(self): """Return transposed, first 5 rows of original DataFrame (excluding unusued features). Returns: pandas.DataFrame: head of the DataFrame, transposed """ return self.features.raw_data()[self.features.features()].head().T
[ "def", "df_head", "(", "self", ")", ":", "return", "self", ".", "features", ".", "raw_data", "(", ")", "[", "self", ".", "features", ".", "features", "(", ")", "]", ".", "head", "(", ")", ".", "T" ]
[ 56, 4 ]
[ 62, 74 ]
python
en
['en', 'en', 'en']
True
Analyzer.skipped_features
(self)
Return list of unused features as calculated by Features object in features attribute. Returns: list: list of unused features
Return list of unused features as calculated by Features object in features attribute.
def skipped_features(self): """Return list of unused features as calculated by Features object in features attribute. Returns: list: list of unused features """ return self.features.unused_features()
[ "def", "skipped_features", "(", "self", ")", ":", "return", "self", ".", "features", ".", "unused_features", "(", ")" ]
[ 64, 4 ]
[ 70, 46 ]
python
en
['en', 'en', 'en']
True
Analyzer.features_pairplot_df
(self)
Return data that will be used to create seaborn pairplot. Returns: pandas.DataFrame: DataFrame used for pairplot visualization.
Return data that will be used to create seaborn pairplot.
def features_pairplot_df(self): """Return data that will be used to create seaborn pairplot. Returns: pandas.DataFrame: DataFrame used for pairplot visualization. """ df = self.features.data()[self.features.features()] return df
[ "def", "features_pairplot_df", "(", "self", ")", ":", "df", "=", "self", ".", "features", ".", "data", "(", ")", "[", "self", ".", "features", ".", "features", "(", ")", "]", "return", "df" ]
[ 72, 4 ]
[ 79, 17 ]
python
en
['en', 'en', 'en']
True
Analyzer.summary_statistics
(self)
Return features data that will be used to create summary statistics section. Statistics are calculated with describe method of a DataFrame, with manual addition of the number of missing values in the data and all numbers being rounded to 4th decimal place. Additionally, every feature gets appen...
Return features data that will be used to create summary statistics section.
def summary_statistics(self): """Return features data that will be used to create summary statistics section. Statistics are calculated with describe method of a DataFrame, with manual addition of the number of missing values in the data and all numbers being rounded to 4th decimal place. Addit...
[ "def", "summary_statistics", "(", "self", ")", ":", "df", "=", "self", ".", "features", ".", "data", "(", ")", ".", "describe", "(", ")", ".", "T", "df", "[", "self", ".", "_feature_missing", "]", "=", "np", ".", "sum", "(", "self", ".", "features"...
[ 81, 4 ]
[ 101, 16 ]
python
en
['en', 'en', 'en']
True
Analyzer.histogram_data
(self)
Return data on features that's required to plot Histogram visualization. If feature is Categorical, then the number of bins in histogram is equal to the number of unique values in the data. If the feature is Numerical, then the number of bins is calculated dynamically. Note: NaN va...
Return data on features that's required to plot Histogram visualization.
def histogram_data(self): """Return data on features that's required to plot Histogram visualization. If feature is Categorical, then the number of bins in histogram is equal to the number of unique values in the data. If the feature is Numerical, then the number of bins is calculated dynamical...
[ "def", "histogram_data", "(", "self", ")", ":", "all_histograms", "=", "{", "}", "for", "feature_name", "in", "self", ".", "features", ".", "features", "(", ")", ":", "feature", "=", "self", ".", "features", "[", "feature_name", "]", "# dropping NaN values -...
[ 103, 4 ]
[ 136, 29 ]
python
en
['en', 'en', 'en']
True
Analyzer.correlation_data_normalized
(self, random_state=None)
Return DataFrame with calculated correlations (Pearson) between features. Features are normalized using QuantileTransformer in comparison to calculating them on original (raw) data. Args: random_state (int, optional): integer for reproducibility on QuantileTransformer transformations, defa...
Return DataFrame with calculated correlations (Pearson) between features.
def correlation_data_normalized(self, random_state=None): """Return DataFrame with calculated correlations (Pearson) between features. Features are normalized using QuantileTransformer in comparison to calculating them on original (raw) data. Args: random_state (int, optional): int...
[ "def", "correlation_data_normalized", "(", "self", ",", "random_state", "=", "None", ")", ":", "df", "=", "self", ".", "features", ".", "data", "(", ")", "qt", "=", "QuantileTransformer", "(", "output_distribution", "=", "\"normal\"", ",", "random_state", "=",...
[ 138, 4 ]
[ 158, 30 ]
python
en
['en', 'en', 'en']
True
Analyzer.correlation_data_raw
(self)
Return DataFrame with calculated correlations (Pearson) between features. Returns: pandas.DataFrame: dataframe with correlation between columns
Return DataFrame with calculated correlations (Pearson) between features.
def correlation_data_raw(self): """Return DataFrame with calculated correlations (Pearson) between features. Returns: pandas.DataFrame: dataframe with correlation between columns """ df = self.features.data() raw_corr = df.corr(method="pearson") return raw_co...
[ "def", "correlation_data_raw", "(", "self", ")", ":", "df", "=", "self", ".", "features", ".", "data", "(", ")", "raw_corr", "=", "df", ".", "corr", "(", "method", "=", "\"pearson\"", ")", "return", "raw_corr" ]
[ 160, 4 ]
[ 168, 23 ]
python
en
['en', 'en', 'en']
True
Analyzer.scatter_data
(self)
Return data that will be used in ScatterPlot Visualizations. ScatterPlot Visualizations makes every feature (column) be used as a hue (coloring) of different combinations of features on plots. Bokeh's factor_cmap function that is used to provide coloring of CategoricalFeatures expects the data ...
Return data that will be used in ScatterPlot Visualizations.
def scatter_data(self): """Return data that will be used in ScatterPlot Visualizations. ScatterPlot Visualizations makes every feature (column) be used as a hue (coloring) of different combinations of features on plots. Bokeh's factor_cmap function that is used to provide coloring of Categorica...
[ "def", "scatter_data", "(", "self", ")", ":", "df", "=", "self", ".", "features", ".", "data", "(", ")", ".", "copy", "(", ")", "for", "col", "in", "self", ".", "features", ".", "categorical_features", "(", ")", ":", "df", "[", "col", "+", "self", ...
[ 170, 4 ]
[ 191, 27 ]
python
en
['en', 'en', 'en']
True
Analyzer.feature_list
(self)
Return list of features as provided by Features.features method. Returns: list: list of features
Return list of features as provided by Features.features method.
def feature_list(self): """Return list of features as provided by Features.features method. Returns: list: list of features """ return self.features.features()
[ "def", "feature_list", "(", "self", ")", ":", "return", "self", ".", "features", ".", "features", "(", ")" ]
[ 193, 4 ]
[ 199, 39 ]
python
en
['en', 'en', 'en']
True
Analyzer.unused_features
(self)
Return list of unused features as provided by Features.unused_features method. Returns: list: list of unused features
Return list of unused features as provided by Features.unused_features method.
def unused_features(self): """Return list of unused features as provided by Features.unused_features method. Returns: list: list of unused features """ return self.features.unused_features()
[ "def", "unused_features", "(", "self", ")", ":", "return", "self", ".", "features", ".", "unused_features", "(", ")" ]
[ 201, 4 ]
[ 207, 46 ]
python
en
['en', 'en', 'en']
True
Analyzer.features_mapping
(self)
Return mappings dict as provided by Features.mapping method. Returns: dict: features mappings dict
Return mappings dict as provided by Features.mapping method.
def features_mapping(self): """Return mappings dict as provided by Features.mapping method. Returns: dict: features mappings dict """ return self.features.mapping()
[ "def", "features_mapping", "(", "self", ")", ":", "return", "self", ".", "features", ".", "mapping", "(", ")" ]
[ 209, 4 ]
[ 215, 38 ]
python
en
['en', 'en', 'en']
True
Analyzer.features_descriptions
(self)
Return description dict as provided by Features.descriptions method. Returns: dict: features description dict
Return description dict as provided by Features.descriptions method.
def features_descriptions(self): """Return description dict as provided by Features.descriptions method. Returns: dict: features description dict """ return self.features.descriptions()
[ "def", "features_descriptions", "(", "self", ")", ":", "return", "self", ".", "features", ".", "descriptions", "(", ")" ]
[ 217, 4 ]
[ 223, 43 ]
python
en
['en', 'fr', 'en']
True
Analyzer._create_describe_df
(self, feature_list)
Return transposed pandas.DataFrame with summary statistics from describe method for features data in Features object. Additionally add percentage of missing values in the data. Args: feature_list (list): list of columns that will be extracted from Features data Returns: ...
Return transposed pandas.DataFrame with summary statistics from describe method for features data in Features object. Additionally add percentage of missing values in the data.
def _create_describe_df(self, feature_list): """Return transposed pandas.DataFrame with summary statistics from describe method for features data in Features object. Additionally add percentage of missing values in the data. Args: feature_list (list): list of columns that will be ex...
[ "def", "_create_describe_df", "(", "self", ",", "feature_list", ")", ":", "df", "=", "self", ".", "features", ".", "data", "(", ")", "[", "feature_list", "]", "ds", "=", "df", ".", "describe", "(", ")", ".", "astype", "(", "\"float64\"", ")", ".", "T...
[ 225, 4 ]
[ 238, 17 ]
python
en
['en', 'en', 'en']
True
default_never_cache_responses
(view_func: ViewFuncT)
Patched version of the standard Django never_cache_responses decorator that adds headers to a response so that it will never be cached, unless the view code has already set a Cache-Control header.
Patched version of the standard Django never_cache_responses decorator that adds headers to a response so that it will never be cached, unless the view code has already set a Cache-Control header.
def default_never_cache_responses(view_func: ViewFuncT) -> ViewFuncT: """Patched version of the standard Django never_cache_responses decorator that adds headers to a response so that it will never be cached, unless the view code has already set a Cache-Control header. """ @wraps(view_func) ...
[ "def", "default_never_cache_responses", "(", "view_func", ":", "ViewFuncT", ")", "->", "ViewFuncT", ":", "@", "wraps", "(", "view_func", ")", "def", "_wrapped_view_func", "(", "request", ":", "HttpRequest", ",", "*", "args", ":", "object", ",", "*", "*", "kw...
[ 23, 0 ]
[ 39, 46 ]
python
en
['en', 'en', 'en']
True
rest_dispatch
(request: HttpRequest, **kwargs: Any)
Dispatch to a REST API endpoint. Unauthenticated endpoints should not use this, as authentication is verified in the following ways: * for paths beginning with /api, HTTP basic auth * for paths beginning with /json (used by the web client), the session token This calls the function named i...
Dispatch to a REST API endpoint.
def rest_dispatch(request: HttpRequest, **kwargs: Any) -> HttpResponse: """Dispatch to a REST API endpoint. Unauthenticated endpoints should not use this, as authentication is verified in the following ways: * for paths beginning with /api, HTTP basic auth * for paths beginning with /json (...
[ "def", "rest_dispatch", "(", "request", ":", "HttpRequest", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "HttpResponse", ":", "supported_methods", ":", "Dict", "[", "str", ",", "Any", "]", "=", "{", "}", "if", "hasattr", "(", "request", ",", "\"save...
[ 44, 0 ]
[ 167, 66 ]
python
en
['en', 'en', 'en']
True
linux_distribution
(full_distribution_name=True)
Return information about the current OS distribution as a tuple ``(id_name, version, codename)`` with items as follows: * ``id_name``: If *full_distribution_name* is false, the result of :func:`distro.id`. Otherwise, the result of :func:`distro.name`. * ``version``: The result of :func:`distr...
Return information about the current OS distribution as a tuple ``(id_name, version, codename)`` with items as follows:
def linux_distribution(full_distribution_name=True): """ Return information about the current OS distribution as a tuple ``(id_name, version, codename)`` with items as follows: * ``id_name``: If *full_distribution_name* is false, the result of :func:`distro.id`. Otherwise, the result of :func:`d...
[ "def", "linux_distribution", "(", "full_distribution_name", "=", "True", ")", ":", "return", "_distro", ".", "linux_distribution", "(", "full_distribution_name", ")" ]
[ 99, 0 ]
[ 124, 61 ]
python
en
['en', 'error', 'th']
False
id
()
Return the distro ID of the current distribution, as a machine-readable string. For a number of OS distributions, the returned distro ID value is *reliable*, in the sense that it is documented and that it does not change across releases of the distribution. This package maintains the followin...
Return the distro ID of the current distribution, as a machine-readable string.
def id(): """ Return the distro ID of the current distribution, as a machine-readable string. For a number of OS distributions, the returned distro ID value is *reliable*, in the sense that it is documented and that it does not change across releases of the distribution. This package maint...
[ "def", "id", "(", ")", ":", "return", "_distro", ".", "id", "(", ")" ]
[ 127, 0 ]
[ 203, 23 ]
python
en
['en', 'error', 'th']
False
name
(pretty=False)
Return the name of the current OS distribution, as a human-readable string. If *pretty* is false, the name is returned without version or codename. (e.g. "CentOS Linux") If *pretty* is true, the version and codename are appended. (e.g. "CentOS Linux 7.1.1503 (Core)") **Lookup hierarchy:*...
Return the name of the current OS distribution, as a human-readable string.
def name(pretty=False): """ Return the name of the current OS distribution, as a human-readable string. If *pretty* is false, the name is returned without version or codename. (e.g. "CentOS Linux") If *pretty* is true, the version and codename are appended. (e.g. "CentOS Linux 7.1.1503 (Co...
[ "def", "name", "(", "pretty", "=", "False", ")", ":", "return", "_distro", ".", "name", "(", "pretty", ")" ]
[ 206, 0 ]
[ 242, 31 ]
python
en
['en', 'error', 'th']
False
version
(pretty=False, best=False)
Return the version of the current OS distribution, as a human-readable string. If *pretty* is false, the version is returned without codename (e.g. "7.0"). If *pretty* is true, the codename in parenthesis is appended, if the codename is non-empty (e.g. "7.0 (Maipo)"). Some distributions ...
Return the version of the current OS distribution, as a human-readable string.
def version(pretty=False, best=False): """ Return the version of the current OS distribution, as a human-readable string. If *pretty* is false, the version is returned without codename (e.g. "7.0"). If *pretty* is true, the codename in parenthesis is appended, if the codename is non-empty ...
[ "def", "version", "(", "pretty", "=", "False", ",", "best", "=", "False", ")", ":", "return", "_distro", ".", "version", "(", "pretty", ",", "best", ")" ]
[ 245, 0 ]
[ 286, 40 ]
python
en
['en', 'error', 'th']
False
version_parts
(best=False)
Return the version of the current OS distribution as a tuple ``(major, minor, build_number)`` with items as follows: * ``major``: The result of :func:`distro.major_version`. * ``minor``: The result of :func:`distro.minor_version`. * ``build_number``: The result of :func:`distro.build_number`....
Return the version of the current OS distribution as a tuple ``(major, minor, build_number)`` with items as follows:
def version_parts(best=False): """ Return the version of the current OS distribution as a tuple ``(major, minor, build_number)`` with items as follows: * ``major``: The result of :func:`distro.major_version`. * ``minor``: The result of :func:`distro.minor_version`. * ``build_number``: The ...
[ "def", "version_parts", "(", "best", "=", "False", ")", ":", "return", "_distro", ".", "version_parts", "(", "best", ")" ]
[ 289, 0 ]
[ 303, 38 ]
python
en
['en', 'error', 'th']
False
major_version
(best=False)
Return the major version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The major version is the first part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method.
Return the major version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The major version is the first part of the dot-separated version string.
def major_version(best=False): """ Return the major version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The major version is the first part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distr...
[ "def", "major_version", "(", "best", "=", "False", ")", ":", "return", "_distro", ".", "major_version", "(", "best", ")" ]
[ 306, 0 ]
[ 316, 38 ]
python
en
['en', 'error', 'th']
False
minor_version
(best=False)
Return the minor version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The minor version is the second part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method.
Return the minor version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The minor version is the second part of the dot-separated version string.
def minor_version(best=False): """ Return the minor version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The minor version is the second part of the dot-separated version string. For a description of the *best* parameter, see the :func:`dist...
[ "def", "minor_version", "(", "best", "=", "False", ")", ":", "return", "_distro", ".", "minor_version", "(", "best", ")" ]
[ 319, 0 ]
[ 329, 38 ]
python
en
['en', 'error', 'th']
False
build_number
(best=False)
Return the build number of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The build number is the third part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method.
Return the build number of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The build number is the third part of the dot-separated version string.
def build_number(best=False): """ Return the build number of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The build number is the third part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.v...
[ "def", "build_number", "(", "best", "=", "False", ")", ":", "return", "_distro", ".", "build_number", "(", "best", ")" ]
[ 332, 0 ]
[ 342, 37 ]
python
en
['en', 'error', 'th']
False
like
()
Return a space-separated list of distro IDs of distributions that are closely related to the current OS distribution in regards to packaging and programming interfaces, for example distributions the current distribution is a derivative from. **Lookup hierarchy:** This information item is only...
Return a space-separated list of distro IDs of distributions that are closely related to the current OS distribution in regards to packaging and programming interfaces, for example distributions the current distribution is a derivative from.
def like(): """ Return a space-separated list of distro IDs of distributions that are closely related to the current OS distribution in regards to packaging and programming interfaces, for example distributions the current distribution is a derivative from. **Lookup hierarchy:** This infor...
[ "def", "like", "(", ")", ":", "return", "_distro", ".", "like", "(", ")" ]
[ 345, 0 ]
[ 359, 25 ]
python
en
['en', 'error', 'th']
False
codename
()
Return the codename for the release of the current OS distribution, as a string. If the distribution does not have a codename, an empty string is returned. Note that the returned codename is not always really a codename. For example, openSUSE returns "x86_64". This function does not handle such ...
Return the codename for the release of the current OS distribution, as a string.
def codename(): """ Return the codename for the release of the current OS distribution, as a string. If the distribution does not have a codename, an empty string is returned. Note that the returned codename is not always really a codename. For example, openSUSE returns "x86_64". This function...
[ "def", "codename", "(", ")", ":", "return", "_distro", ".", "codename", "(", ")" ]
[ 362, 0 ]
[ 383, 29 ]
python
en
['en', 'error', 'th']
False
info
(pretty=False, best=False)
Return certain machine-readable information items about the current OS distribution in a dictionary, as shown in the following example: .. sourcecode:: python { 'id': 'rhel', 'version': '7.0', 'version_parts': { 'major': '7', 'mi...
Return certain machine-readable information items about the current OS distribution in a dictionary, as shown in the following example:
def info(pretty=False, best=False): """ Return certain machine-readable information items about the current OS distribution in a dictionary, as shown in the following example: .. sourcecode:: python { 'id': 'rhel', 'version': '7.0', 'version_parts': { ...
[ "def", "info", "(", "pretty", "=", "False", ",", "best", "=", "False", ")", ":", "return", "_distro", ".", "info", "(", "pretty", ",", "best", ")" ]
[ 386, 0 ]
[ 427, 37 ]
python
en
['en', 'error', 'th']
False
os_release_info
()
Return a dictionary containing key-value pairs for the information items from the os-release file data source of the current OS distribution. See `os-release file`_ for details about these information items.
Return a dictionary containing key-value pairs for the information items from the os-release file data source of the current OS distribution.
def os_release_info(): """ Return a dictionary containing key-value pairs for the information items from the os-release file data source of the current OS distribution. See `os-release file`_ for details about these information items. """ return _distro.os_release_info()
[ "def", "os_release_info", "(", ")", ":", "return", "_distro", ".", "os_release_info", "(", ")" ]
[ 430, 0 ]
[ 437, 36 ]
python
en
['en', 'error', 'th']
False
lsb_release_info
()
Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the current OS distribution. See `lsb_release command output`_ for details about these information items.
Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the current OS distribution.
def lsb_release_info(): """ Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the current OS distribution. See `lsb_release command output`_ for details about these information items. """ return _distro.lsb_release_info()
[ "def", "lsb_release_info", "(", ")", ":", "return", "_distro", ".", "lsb_release_info", "(", ")" ]
[ 440, 0 ]
[ 448, 37 ]
python
en
['en', 'error', 'th']
False
distro_release_info
()
Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution. See `distro release file`_ for details about these information items.
Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution.
def distro_release_info(): """ Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution. See `distro release file`_ for details about these information items. """ return _distro.distro_release_info()
[ "def", "distro_release_info", "(", ")", ":", "return", "_distro", ".", "distro_release_info", "(", ")" ]
[ 451, 0 ]
[ 458, 40 ]
python
en
['en', 'error', 'th']
False
uname_info
()
Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution.
Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution.
def uname_info(): """ Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution. """ return _distro.uname_info()
[ "def", "uname_info", "(", ")", ":", "return", "_distro", ".", "uname_info", "(", ")" ]
[ 461, 0 ]
[ 466, 31 ]
python
en
['en', 'error', 'th']
False
os_release_attr
(attribute)
Return a single named information item from the os-release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not...
Return a single named information item from the os-release file data source of the current OS distribution.
def os_release_attr(attribute): """ Return a single named information item from the os-release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. ...
[ "def", "os_release_attr", "(", "attribute", ")", ":", "return", "_distro", ".", "os_release_attr", "(", "attribute", ")" ]
[ 469, 0 ]
[ 485, 45 ]
python
en
['en', 'error', 'th']
False
lsb_release_attr
(attribute)
Return a single named information item from the lsb_release command output data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the it...
Return a single named information item from the lsb_release command output data source of the current OS distribution.
def lsb_release_attr(attribute): """ Return a single named information item from the lsb_release command output data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item e...
[ "def", "lsb_release_attr", "(", "attribute", ")", ":", "return", "_distro", ".", "lsb_release_attr", "(", "attribute", ")" ]
[ 488, 0 ]
[ 505, 46 ]
python
en
['en', 'error', 'th']
False
distro_release_attr
(attribute)
Return a single named information item from the distro release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does...
Return a single named information item from the distro release file data source of the current OS distribution.
def distro_release_attr(attribute): """ Return a single named information item from the distro release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exist...
[ "def", "distro_release_attr", "(", "attribute", ")", ":", "return", "_distro", ".", "distro_release_attr", "(", "attribute", ")" ]
[ 508, 0 ]
[ 524, 49 ]
python
en
['en', 'error', 'th']
False
uname_attr
(attribute)
Return a single named information item from the distro release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the...
Return a single named information item from the distro release file data source of the current OS distribution.
def uname_attr(attribute): """ Return a single named information item from the distro release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. ...
[ "def", "uname_attr", "(", "attribute", ")", ":", "return", "_distro", ".", "uname_attr", "(", "attribute", ")" ]
[ 527, 0 ]
[ 541, 40 ]
python
en
['en', 'error', 'th']
False
LinuxDistribution.__init__
(self, include_lsb=True, os_release_file='', distro_release_file='', include_uname=True)
The initialization method of this class gathers information from the available data sources, and stores that in private instance attributes. Subsequent access to the information items uses these private instance attributes, so that the data sources are read only once. Parameter...
The initialization method of this class gathers information from the available data sources, and stores that in private instance attributes. Subsequent access to the information items uses these private instance attributes, so that the data sources are read only once.
def __init__(self, include_lsb=True, os_release_file='', distro_release_file='', include_uname=True): """ The initialization method of this class gathers information from the available data sources, and stores that in private in...
[ "def", "__init__", "(", "self", ",", "include_lsb", "=", "True", ",", "os_release_file", "=", "''", ",", "distro_release_file", "=", "''", ",", "include_uname", "=", "True", ")", ":", "self", ".", "os_release_file", "=", "os_release_file", "or", "os", ".", ...
[ 577, 4 ]
[ 653, 42 ]
python
en
['en', 'error', 'th']
False
LinuxDistribution.__repr__
(self)
Return repr of all info
Return repr of all info
def __repr__(self): """Return repr of all info """ return \ "LinuxDistribution(" \ "os_release_file={self.os_release_file!r}, " \ "distro_release_file={self.distro_release_file!r}, " \ "include_lsb={self.include_lsb!r}, " \ "include_una...
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"LinuxDistribution(\"", "\"os_release_file={self.os_release_file!r}, \"", "\"distro_release_file={self.distro_release_file!r}, \"", "\"include_lsb={self.include_lsb!r}, \"", "\"include_uname={self.include_uname!r}, \"", "\"_os_release_inf...
[ 655, 4 ]
[ 668, 26 ]
python
en
['en', 'no', 'en']
True
LinuxDistribution.linux_distribution
(self, full_distribution_name=True)
Return information about the OS distribution that is compatible with Python's :func:`platform.linux_distribution`, supporting a subset of its parameters. For details, see :func:`distro.linux_distribution`.
Return information about the OS distribution that is compatible with Python's :func:`platform.linux_distribution`, supporting a subset of its parameters.
def linux_distribution(self, full_distribution_name=True): """ Return information about the OS distribution that is compatible with Python's :func:`platform.linux_distribution`, supporting a subset of its parameters. For details, see :func:`distro.linux_distribution`. ""...
[ "def", "linux_distribution", "(", "self", ",", "full_distribution_name", "=", "True", ")", ":", "return", "(", "self", ".", "name", "(", ")", "if", "full_distribution_name", "else", "self", ".", "id", "(", ")", ",", "self", ".", "version", "(", ")", ",",...
[ 670, 4 ]
[ 682, 9 ]
python
en
['en', 'error', 'th']
False
LinuxDistribution.id
(self)
Return the distro ID of the OS distribution, as a string. For details, see :func:`distro.id`.
Return the distro ID of the OS distribution, as a string.
def id(self): """Return the distro ID of the OS distribution, as a string. For details, see :func:`distro.id`. """ def normalize(distro_id, table): distro_id = distro_id.lower().replace(' ', '_') return table.get(distro_id, distro_id) distro_id = self.os...
[ "def", "id", "(", "self", ")", ":", "def", "normalize", "(", "distro_id", ",", "table", ")", ":", "distro_id", "=", "distro_id", ".", "lower", "(", ")", ".", "replace", "(", "' '", ",", "'_'", ")", "return", "table", ".", "get", "(", "distro_id", "...
[ 684, 4 ]
[ 709, 17 ]
python
en
['en', 'en', 'en']
True
LinuxDistribution.name
(self, pretty=False)
Return the name of the OS distribution, as a string. For details, see :func:`distro.name`.
Return the name of the OS distribution, as a string.
def name(self, pretty=False): """ Return the name of the OS distribution, as a string. For details, see :func:`distro.name`. """ name = self.os_release_attr('name') \ or self.lsb_release_attr('distributor_id') \ or self.distro_release_attr('name') \ ...
[ "def", "name", "(", "self", ",", "pretty", "=", "False", ")", ":", "name", "=", "self", ".", "os_release_attr", "(", "'name'", ")", "or", "self", ".", "lsb_release_attr", "(", "'distributor_id'", ")", "or", "self", ".", "distro_release_attr", "(", "'name'"...
[ 711, 4 ]
[ 730, 25 ]
python
en
['en', 'error', 'th']
False
LinuxDistribution.version
(self, pretty=False, best=False)
Return the version of the OS distribution, as a string. For details, see :func:`distro.version`.
Return the version of the OS distribution, as a string.
def version(self, pretty=False, best=False): """ Return the version of the OS distribution, as a string. For details, see :func:`distro.version`. """ versions = [ self.os_release_attr('version_id'), self.lsb_release_attr('release'), self.distr...
[ "def", "version", "(", "self", ",", "pretty", "=", "False", ",", "best", "=", "False", ")", ":", "versions", "=", "[", "self", ".", "os_release_attr", "(", "'version_id'", ")", ",", "self", ".", "lsb_release_attr", "(", "'release'", ")", ",", "self", "...
[ 732, 4 ]
[ 764, 22 ]
python
en
['en', 'error', 'th']
False