body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def setOrientation(self, ort):
"Set the orientation of the widget. May be one of 'bottom', 'top', \n 'left', or 'right'."
self.item.setOrientation(ort)
self.orientation = ort
self.setMaxDim() | 5,583,583,484,988,916,000 | Set the orientation of the widget. May be one of 'bottom', 'top',
'left', or 'right'. | scripts/pyqtgraph-develop/pyqtgraph/widgets/GradientWidget.py | setOrientation | kuldeepaman/tf-pose | python | def setOrientation(self, ort):
"Set the orientation of the widget. May be one of 'bottom', 'top', \n 'left', or 'right'."
self.item.setOrientation(ort)
self.orientation = ort
self.setMaxDim() |
@property
async def nodes(self) -> Set[neo4j.graph.Node]:
'This property is a Coroutine, which is weird, but better matches the neo4j interface.\n\n When awaited this property will execute the query and return you a Set[neo4j.graph.Node]\n containing all of the nodes which the query matched.\n ... | -565,947,653,248,917,440 | This property is a Coroutine, which is weird, but better matches the neo4j interface.
When awaited this property will execute the query and return you a Set[neo4j.graph.Node]
containing all of the nodes which the query matched. | aiocypher/aioneo4j/graph.py | nodes | bbc/rd-cloudfit-python-aiocypher | python | @property
async def nodes(self) -> Set[neo4j.graph.Node]:
'This property is a Coroutine, which is weird, but better matches the neo4j interface.\n\n When awaited this property will execute the query and return you a Set[neo4j.graph.Node]\n containing all of the nodes which the query matched.\n ... |
@property
async def relationships(self) -> Set[neo4j.graph.Relationship]:
'This property is a Coroutine, which is weird, but better matches the neo4j interface.\n\n When awaited this property will execute the query and return you a Set[neo4j.graph.Relationship]\n containing all of the relationships wh... | -364,903,653,325,718,100 | This property is a Coroutine, which is weird, but better matches the neo4j interface.
When awaited this property will execute the query and return you a Set[neo4j.graph.Relationship]
containing all of the relationships which the query matched. | aiocypher/aioneo4j/graph.py | relationships | bbc/rd-cloudfit-python-aiocypher | python | @property
async def relationships(self) -> Set[neo4j.graph.Relationship]:
'This property is a Coroutine, which is weird, but better matches the neo4j interface.\n\n When awaited this property will execute the query and return you a Set[neo4j.graph.Relationship]\n containing all of the relationships wh... |
def get_business_invoice_financings(self, **kwargs):
'Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501\n\n Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchron... | 1,579,009,774,282,378,000 | Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501
Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_business_invoice_fin... | products_and_services_client/api/invoice_financings_api.py | get_business_invoice_financings | pitzer42/opbk-br-quickstart | python | def get_business_invoice_financings(self, **kwargs):
'Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501\n\n Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchron... |
def get_business_invoice_financings_with_http_info(self, **kwargs):
'Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501\n\n Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n ... | 592,169,061,374,179,800 | Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501
Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_business_invoice_fin... | products_and_services_client/api/invoice_financings_api.py | get_business_invoice_financings_with_http_info | pitzer42/opbk-br-quickstart | python | def get_business_invoice_financings_with_http_info(self, **kwargs):
'Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501\n\n Obtém a lista de Adiantamento de Recebíveis de Pessoa Jurídica. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n ... |
def get_personal_invoice_financings(self, **kwargs):
'Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501\n\n Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronou... | -6,094,684,954,823,276,000 | Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501
Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_personal_invoice_finan... | products_and_services_client/api/invoice_financings_api.py | get_personal_invoice_financings | pitzer42/opbk-br-quickstart | python | def get_personal_invoice_financings(self, **kwargs):
'Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501\n\n Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronou... |
def get_personal_invoice_financings_with_http_info(self, **kwargs):
'Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501\n\n Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n ... | 280,250,529,202,642,340 | Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501
Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_personal_invoice_finan... | products_and_services_client/api/invoice_financings_api.py | get_personal_invoice_financings_with_http_info | pitzer42/opbk-br-quickstart | python | def get_personal_invoice_financings_with_http_info(self, **kwargs):
'Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501\n\n Obtém a lista de Adiantamento de Recebíveis de Pessoa Natural. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n ... |
def add_callback(self, start_cursor: int, callback: Callable[([EventLogEntry], None)]):
'Observer has started watching this run.\n Add a callback to execute on new EventLogEntrys st. id >= start_cursor\n\n Args:\n start_cursor (int): minimum event_id for the callback to execute\n ... | 8,486,249,283,612,698,000 | Observer has started watching this run.
Add a callback to execute on new EventLogEntrys st. id >= start_cursor
Args:
start_cursor (int): minimum event_id for the callback to execute
callback (Callable[[EventLogEntry], None]): callback to update the Dagster UI | python_modules/dagster/dagster/core/storage/event_log/polling_event_watcher.py | add_callback | AndreaGiardini/dagster | python | def add_callback(self, start_cursor: int, callback: Callable[([EventLogEntry], None)]):
'Observer has started watching this run.\n Add a callback to execute on new EventLogEntrys st. id >= start_cursor\n\n Args:\n start_cursor (int): minimum event_id for the callback to execute\n ... |
def remove_callback(self, callback: Callable[([EventLogEntry], None)]):
'Observer has stopped watching this run;\n Remove a callback from the list of callbacks to execute on new EventLogEntrys\n\n Also kill thread if no callbacks remaining (i.e. no Observers are watching this run_id)\n\n ... | -1,103,090,747,135,853,200 | Observer has stopped watching this run;
Remove a callback from the list of callbacks to execute on new EventLogEntrys
Also kill thread if no callbacks remaining (i.e. no Observers are watching this run_id)
Args:
callback (Callable[[EventLogEntry], None]): callback to remove from list of callbacks | python_modules/dagster/dagster/core/storage/event_log/polling_event_watcher.py | remove_callback | AndreaGiardini/dagster | python | def remove_callback(self, callback: Callable[([EventLogEntry], None)]):
'Observer has stopped watching this run;\n Remove a callback from the list of callbacks to execute on new EventLogEntrys\n\n Also kill thread if no callbacks remaining (i.e. no Observers are watching this run_id)\n\n ... |
def run(self):
'Polling function to update Observers with EventLogEntrys from Event Log DB.\n Wakes every POLLING_CADENCE &\n 1. executes a SELECT query to get new EventLogEntrys\n 2. fires each callback (taking into account the callback.cursor) on the new EventLogEntrys\n Uses m... | 6,395,378,902,785,917,000 | Polling function to update Observers with EventLogEntrys from Event Log DB.
Wakes every POLLING_CADENCE &
1. executes a SELECT query to get new EventLogEntrys
2. fires each callback (taking into account the callback.cursor) on the new EventLogEntrys
Uses max_index_so_far as a cursor in the DB to make sure that ... | python_modules/dagster/dagster/core/storage/event_log/polling_event_watcher.py | run | AndreaGiardini/dagster | python | def run(self):
'Polling function to update Observers with EventLogEntrys from Event Log DB.\n Wakes every POLLING_CADENCE &\n 1. executes a SELECT query to get new EventLogEntrys\n 2. fires each callback (taking into account the callback.cursor) on the new EventLogEntrys\n Uses m... |
def generate_device_uuid() -> int:
'\n Get unique identifier for device\n :return: Unique identifier\n '
return getnode() | -6,184,631,668,975,892,000 | Get unique identifier for device
:return: Unique identifier | src/electionguard/encrypt.py | generate_device_uuid | john-s-morgan/electionguard-python | python | def generate_device_uuid() -> int:
'\n Get unique identifier for device\n :return: Unique identifier\n '
return getnode() |
def selection_from(description: SelectionDescription, is_placeholder: bool=False, is_affirmative: bool=False) -> PlaintextBallotSelection:
'\n Construct a `BallotSelection` from a specific `SelectionDescription`.\n This function is useful for filling selections when a voter undervotes a ballot.\n It is als... | -181,945,839,889,832,260 | Construct a `BallotSelection` from a specific `SelectionDescription`.
This function is useful for filling selections when a voter undervotes a ballot.
It is also used to create placeholder representations when generating the `ConstantChaumPedersenProof`
:param description: The `SelectionDescription` which provides the... | src/electionguard/encrypt.py | selection_from | john-s-morgan/electionguard-python | python | def selection_from(description: SelectionDescription, is_placeholder: bool=False, is_affirmative: bool=False) -> PlaintextBallotSelection:
'\n Construct a `BallotSelection` from a specific `SelectionDescription`.\n This function is useful for filling selections when a voter undervotes a ballot.\n It is als... |
def contest_from(description: ContestDescription) -> PlaintextBallotContest:
'\n Construct a `BallotContest` from a specific `ContestDescription` with all false fields.\n This function is useful for filling contests and selections when a voter undervotes a ballot.\n\n :param description: The `ContestDescri... | 511,095,952,070,037,440 | Construct a `BallotContest` from a specific `ContestDescription` with all false fields.
This function is useful for filling contests and selections when a voter undervotes a ballot.
:param description: The `ContestDescription` used to derive the well-formed `BallotContest`
:return: a `BallotContest` | src/electionguard/encrypt.py | contest_from | john-s-morgan/electionguard-python | python | def contest_from(description: ContestDescription) -> PlaintextBallotContest:
'\n Construct a `BallotContest` from a specific `ContestDescription` with all false fields.\n This function is useful for filling contests and selections when a voter undervotes a ballot.\n\n :param description: The `ContestDescri... |
def encrypt_selection(selection: PlaintextBallotSelection, selection_description: SelectionDescription, elgamal_public_key: ElementModP, crypto_extended_base_hash: ElementModQ, nonce_seed: ElementModQ, is_placeholder: bool=False, should_verify_proofs: bool=True) -> Optional[CiphertextBallotSelection]:
"\n Encryp... | -3,978,470,818,273,879,000 | Encrypt a specific `BallotSelection` in the context of a specific `BallotContest`
:param selection: the selection in the valid input form
:param selection_description: the `SelectionDescription` from the
`ContestDescription` which defines this selection's structure
:param elgamal_public_key: the public key (K) use... | src/electionguard/encrypt.py | encrypt_selection | john-s-morgan/electionguard-python | python | def encrypt_selection(selection: PlaintextBallotSelection, selection_description: SelectionDescription, elgamal_public_key: ElementModP, crypto_extended_base_hash: ElementModQ, nonce_seed: ElementModQ, is_placeholder: bool=False, should_verify_proofs: bool=True) -> Optional[CiphertextBallotSelection]:
"\n Encryp... |
def encrypt_contest(contest: PlaintextBallotContest, contest_description: ContestDescriptionWithPlaceholders, elgamal_public_key: ElementModP, crypto_extended_base_hash: ElementModQ, nonce_seed: ElementModQ, should_verify_proofs: bool=True) -> Optional[CiphertextBallotContest]:
"\n Encrypt a specific `BallotCont... | 8,492,002,618,950,993,000 | Encrypt a specific `BallotContest` in the context of a specific `Ballot`.
This method accepts a contest representation that only includes `True` selections.
It will fill missing selections for a contest with `False` values, and generate `placeholder`
selections to represent the number of seats available for a given co... | src/electionguard/encrypt.py | encrypt_contest | john-s-morgan/electionguard-python | python | def encrypt_contest(contest: PlaintextBallotContest, contest_description: ContestDescriptionWithPlaceholders, elgamal_public_key: ElementModP, crypto_extended_base_hash: ElementModQ, nonce_seed: ElementModQ, should_verify_proofs: bool=True) -> Optional[CiphertextBallotContest]:
"\n Encrypt a specific `BallotCont... |
def encrypt_ballot(ballot: PlaintextBallot, internal_manifest: InternalManifest, context: CiphertextElectionContext, encryption_seed: ElementModQ, nonce: Optional[ElementModQ]=None, should_verify_proofs: bool=True) -> Optional[CiphertextBallot]:
"\n Encrypt a specific `Ballot` in the context of a specific `Ciphe... | -711,263,883,848,211,600 | Encrypt a specific `Ballot` in the context of a specific `CiphertextElectionContext`.
This method accepts a ballot representation that only includes `True` selections.
It will fill missing selections for a contest with `False` values, and generate `placeholder`
selections to represent the number of seats available for... | src/electionguard/encrypt.py | encrypt_ballot | john-s-morgan/electionguard-python | python | def encrypt_ballot(ballot: PlaintextBallot, internal_manifest: InternalManifest, context: CiphertextElectionContext, encryption_seed: ElementModQ, nonce: Optional[ElementModQ]=None, should_verify_proofs: bool=True) -> Optional[CiphertextBallot]:
"\n Encrypt a specific `Ballot` in the context of a specific `Ciphe... |
def encrypt_ballot_contests(ballot: PlaintextBallot, description: InternalManifest, context: CiphertextElectionContext, nonce_seed: ElementModQ) -> Optional[List[CiphertextBallotContest]]:
'Encrypt contests from a plaintext ballot with a specific style'
encrypted_contests: List[CiphertextBallotContest] = []
... | -1,018,229,742,560,874,900 | Encrypt contests from a plaintext ballot with a specific style | src/electionguard/encrypt.py | encrypt_ballot_contests | john-s-morgan/electionguard-python | python | def encrypt_ballot_contests(ballot: PlaintextBallot, description: InternalManifest, context: CiphertextElectionContext, nonce_seed: ElementModQ) -> Optional[List[CiphertextBallotContest]]:
encrypted_contests: List[CiphertextBallotContest] = []
for ballot_style_contest in description.get_contests_for(ballot... |
def get_hash(self) -> ElementModQ:
'\n Get hash for encryption device\n :return: Starting hash\n '
return get_hash_for_device(self.device_id, self.session_id, self.launch_code, self.location) | -6,686,709,131,770,202,000 | Get hash for encryption device
:return: Starting hash | src/electionguard/encrypt.py | get_hash | john-s-morgan/electionguard-python | python | def get_hash(self) -> ElementModQ:
'\n Get hash for encryption device\n :return: Starting hash\n '
return get_hash_for_device(self.device_id, self.session_id, self.launch_code, self.location) |
def get_timestamp(self) -> int:
'\n Get the current timestamp in utc\n '
return int(datetime.utcnow().timestamp()) | 2,224,961,735,383,121,000 | Get the current timestamp in utc | src/electionguard/encrypt.py | get_timestamp | john-s-morgan/electionguard-python | python | def get_timestamp(self) -> int:
'\n \n '
return int(datetime.utcnow().timestamp()) |
def encrypt(self, ballot: PlaintextBallot) -> Optional[CiphertextBallot]:
'\n Encrypt the specified ballot using the cached election context.\n '
log_info(f' encrypt: objectId: {ballot.object_id}')
encrypted_ballot = encrypt_ballot(ballot, self._internal_manifest, self._context, self._encrypti... | 4,068,697,592,877,654,500 | Encrypt the specified ballot using the cached election context. | src/electionguard/encrypt.py | encrypt | john-s-morgan/electionguard-python | python | def encrypt(self, ballot: PlaintextBallot) -> Optional[CiphertextBallot]:
'\n \n '
log_info(f' encrypt: objectId: {ballot.object_id}')
encrypted_ballot = encrypt_ballot(ballot, self._internal_manifest, self._context, self._encryption_seed)
if ((encrypted_ballot is not None) and (encrypted_... |
def parse_arguments():
'\n Simple argument parser for the command line\n :return: The text to be edited\n '
parser = argparse.ArgumentParser(description='Receive text to be edited')
parser.add_argument('text', metavar='input text', type=str)
args = parser.parse_args()
return args.text | 3,160,303,962,437,517,300 | Simple argument parser for the command line
:return: The text to be edited | ml_editor/ml_editor.py | parse_arguments | 0105rahulk/ml-powered-applications | python | def parse_arguments():
'\n Simple argument parser for the command line\n :return: The text to be edited\n '
parser = argparse.ArgumentParser(description='Receive text to be edited')
parser.add_argument('text', metavar='input text', type=str)
args = parser.parse_args()
return args.text |
def clean_input(text):
'\n Text sanitization function\n :param text: User input text\n :return: Sanitized text, without non ascii characters\n '
return str(text.encode().decode('ascii', errors='ignore')) | 7,846,739,265,640,172,000 | Text sanitization function
:param text: User input text
:return: Sanitized text, without non ascii characters | ml_editor/ml_editor.py | clean_input | 0105rahulk/ml-powered-applications | python | def clean_input(text):
'\n Text sanitization function\n :param text: User input text\n :return: Sanitized text, without non ascii characters\n '
return str(text.encode().decode('ascii', errors='ignore')) |
def preprocess_input(text):
'\n Tokenizes text that has been sainitized\n :param text: Sanitized text\n :return: Text ready to be fed to analysis, by having sentences and words tokenized\n '
sentences = nltk.sent_tokenize(text)
tokens = [nltk.word_tokenize(sentence) for sentence in sentences]
... | 1,946,638,053,518,465,300 | Tokenizes text that has been sainitized
:param text: Sanitized text
:return: Text ready to be fed to analysis, by having sentences and words tokenized | ml_editor/ml_editor.py | preprocess_input | 0105rahulk/ml-powered-applications | python | def preprocess_input(text):
'\n Tokenizes text that has been sainitized\n :param text: Sanitized text\n :return: Text ready to be fed to analysis, by having sentences and words tokenized\n '
sentences = nltk.sent_tokenize(text)
tokens = [nltk.word_tokenize(sentence) for sentence in sentences]
... |
def compute_flesch_reading_ease(total_syllables, total_words, total_sentences):
'\n Computes readability score from summary statistics\n :param total_syllables: number of syllables in input text\n :param total_words: number of words in input text\n :param total_sentences: number of sentences in input te... | -7,876,112,017,044,023,000 | Computes readability score from summary statistics
:param total_syllables: number of syllables in input text
:param total_words: number of words in input text
:param total_sentences: number of sentences in input text
:return: A readability score: the lower the score, the more complex the text is deemed to be | ml_editor/ml_editor.py | compute_flesch_reading_ease | 0105rahulk/ml-powered-applications | python | def compute_flesch_reading_ease(total_syllables, total_words, total_sentences):
'\n Computes readability score from summary statistics\n :param total_syllables: number of syllables in input text\n :param total_words: number of words in input text\n :param total_sentences: number of sentences in input te... |
def get_reading_level_from_flesch(flesch_score):
'\n Thresholds taken from https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests\n :param flesch_score:\n :return: A reading level and difficulty for a given flesch score\n '
if (flesch_score < 30):
return 'Very difficult to re... | 8,117,084,314,785,368,000 | Thresholds taken from https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests
:param flesch_score:
:return: A reading level and difficulty for a given flesch score | ml_editor/ml_editor.py | get_reading_level_from_flesch | 0105rahulk/ml-powered-applications | python | def get_reading_level_from_flesch(flesch_score):
'\n Thresholds taken from https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests\n :param flesch_score:\n :return: A reading level and difficulty for a given flesch score\n '
if (flesch_score < 30):
return 'Very difficult to re... |
def compute_average_word_length(tokens):
'\n Calculate word length for a sentence\n :param tokens: a list of words\n :return: The average length of words in this list\n '
word_lengths = [len(word) for word in tokens]
return (sum(word_lengths) / len(word_lengths)) | 4,506,613,735,038,787,000 | Calculate word length for a sentence
:param tokens: a list of words
:return: The average length of words in this list | ml_editor/ml_editor.py | compute_average_word_length | 0105rahulk/ml-powered-applications | python | def compute_average_word_length(tokens):
'\n Calculate word length for a sentence\n :param tokens: a list of words\n :return: The average length of words in this list\n '
word_lengths = [len(word) for word in tokens]
return (sum(word_lengths) / len(word_lengths)) |
def compute_total_average_word_length(sentence_list):
'\n Calculate average word length for multiple sentences\n :param sentence_list: a list of sentences, each being a list of words\n :return: The average length of words in this list of sentences\n '
lengths = [compute_average_word_length(tokens) f... | -3,756,731,325,639,814,700 | Calculate average word length for multiple sentences
:param sentence_list: a list of sentences, each being a list of words
:return: The average length of words in this list of sentences | ml_editor/ml_editor.py | compute_total_average_word_length | 0105rahulk/ml-powered-applications | python | def compute_total_average_word_length(sentence_list):
'\n Calculate average word length for multiple sentences\n :param sentence_list: a list of sentences, each being a list of words\n :return: The average length of words in this list of sentences\n '
lengths = [compute_average_word_length(tokens) f... |
def compute_total_unique_words_fraction(sentence_list):
'\n Compute fraction os unique words\n :param sentence_list: a list of sentences, each being a list of words\n :return: the fraction of unique words in the sentences\n '
all_words = [word for word_list in sentence_list for word in word_list]
... | -4,128,156,532,980,299,300 | Compute fraction os unique words
:param sentence_list: a list of sentences, each being a list of words
:return: the fraction of unique words in the sentences | ml_editor/ml_editor.py | compute_total_unique_words_fraction | 0105rahulk/ml-powered-applications | python | def compute_total_unique_words_fraction(sentence_list):
'\n Compute fraction os unique words\n :param sentence_list: a list of sentences, each being a list of words\n :return: the fraction of unique words in the sentences\n '
all_words = [word for word_list in sentence_list for word in word_list]
... |
def count_word_usage(tokens, word_list):
'\n Counts occurrences of a given list of words\n :param tokens: a list of tokens for one sentence\n :param word_list: a list of words to search for\n :return: the number of times the words appear in the list\n '
return len([word for word in tokens if (wor... | 6,031,960,145,593,758,000 | Counts occurrences of a given list of words
:param tokens: a list of tokens for one sentence
:param word_list: a list of words to search for
:return: the number of times the words appear in the list | ml_editor/ml_editor.py | count_word_usage | 0105rahulk/ml-powered-applications | python | def count_word_usage(tokens, word_list):
'\n Counts occurrences of a given list of words\n :param tokens: a list of tokens for one sentence\n :param word_list: a list of words to search for\n :return: the number of times the words appear in the list\n '
return len([word for word in tokens if (wor... |
def count_word_syllables(word):
'\n Count syllables in a word\n :param word: a one word string\n :return: the number of syllables according to pyphen\n '
dic = pyphen.Pyphen(lang='en_US')
hyphenated = dic.inserted(word)
return len(hyphenated.split('-')) | -6,612,760,813,597,651,000 | Count syllables in a word
:param word: a one word string
:return: the number of syllables according to pyphen | ml_editor/ml_editor.py | count_word_syllables | 0105rahulk/ml-powered-applications | python | def count_word_syllables(word):
'\n Count syllables in a word\n :param word: a one word string\n :return: the number of syllables according to pyphen\n '
dic = pyphen.Pyphen(lang='en_US')
hyphenated = dic.inserted(word)
return len(hyphenated.split('-')) |
def count_sentence_syllables(tokens):
'\n Count syllables in a sentence\n :param tokens: a list of words and potentially punctuation\n :return: the number of syllables in the sentence\n '
punctuation = '.,!?/'
return sum([count_word_syllables(word) for word in tokens if (word not in punctuation)... | 4,886,695,117,006,768,000 | Count syllables in a sentence
:param tokens: a list of words and potentially punctuation
:return: the number of syllables in the sentence | ml_editor/ml_editor.py | count_sentence_syllables | 0105rahulk/ml-powered-applications | python | def count_sentence_syllables(tokens):
'\n Count syllables in a sentence\n :param tokens: a list of words and potentially punctuation\n :return: the number of syllables in the sentence\n '
punctuation = '.,!?/'
return sum([count_word_syllables(word) for word in tokens if (word not in punctuation)... |
def count_total_syllables(sentence_list):
'\n Count syllables in a list of sentences\n :param sentence_list: a list of sentences, each being a list of words\n :return: the number of syllables in the sentences\n '
return sum([count_sentence_syllables(sentence) for sentence in sentence_list]) | 8,547,849,217,713,090,000 | Count syllables in a list of sentences
:param sentence_list: a list of sentences, each being a list of words
:return: the number of syllables in the sentences | ml_editor/ml_editor.py | count_total_syllables | 0105rahulk/ml-powered-applications | python | def count_total_syllables(sentence_list):
'\n Count syllables in a list of sentences\n :param sentence_list: a list of sentences, each being a list of words\n :return: the number of syllables in the sentences\n '
return sum([count_sentence_syllables(sentence) for sentence in sentence_list]) |
def count_words_per_sentence(sentence_tokens):
'\n Count words in a sentence\n :param sentence_tokens: a list of words and potentially punctuation\n :return: the number of words in the sentence\n '
punctuation = '.,!?/'
return len([word for word in sentence_tokens if (word not in punctuation)]) | -7,815,204,490,811,529,000 | Count words in a sentence
:param sentence_tokens: a list of words and potentially punctuation
:return: the number of words in the sentence | ml_editor/ml_editor.py | count_words_per_sentence | 0105rahulk/ml-powered-applications | python | def count_words_per_sentence(sentence_tokens):
'\n Count words in a sentence\n :param sentence_tokens: a list of words and potentially punctuation\n :return: the number of words in the sentence\n '
punctuation = '.,!?/'
return len([word for word in sentence_tokens if (word not in punctuation)]) |
def count_total_words(sentence_list):
'\n Count words in a list of sentences\n :param sentence_list: a list of sentences, each being a list of words\n :return: the number of words in the sentences\n '
return sum([count_words_per_sentence(sentence) for sentence in sentence_list]) | -590,611,117,762,690,600 | Count words in a list of sentences
:param sentence_list: a list of sentences, each being a list of words
:return: the number of words in the sentences | ml_editor/ml_editor.py | count_total_words | 0105rahulk/ml-powered-applications | python | def count_total_words(sentence_list):
'\n Count words in a list of sentences\n :param sentence_list: a list of sentences, each being a list of words\n :return: the number of words in the sentences\n '
return sum([count_words_per_sentence(sentence) for sentence in sentence_list]) |
def get_suggestions(sentence_list):
'\n Returns a string containing our suggestions\n :param sentence_list: a list of sentences, each being a list of words\n :return: suggestions to improve the input\n '
told_said_usage = sum((count_word_usage(tokens, ['told', 'said']) for tokens in sentence_list))
... | -7,753,332,045,319,814,000 | Returns a string containing our suggestions
:param sentence_list: a list of sentences, each being a list of words
:return: suggestions to improve the input | ml_editor/ml_editor.py | get_suggestions | 0105rahulk/ml-powered-applications | python | def get_suggestions(sentence_list):
'\n Returns a string containing our suggestions\n :param sentence_list: a list of sentences, each being a list of words\n :return: suggestions to improve the input\n '
told_said_usage = sum((count_word_usage(tokens, ['told', 'said']) for tokens in sentence_list))
... |
def get_recommendations_from_input(txt):
'\n Cleans, preprocesses, and generates heuristic suggestion for input string\n :param txt: Input text\n :return: Suggestions for a given text input\n '
processed = clean_input(txt)
tokenized_sentences = preprocess_input(processed)
suggestions = get_s... | -3,809,558,853,786,648,000 | Cleans, preprocesses, and generates heuristic suggestion for input string
:param txt: Input text
:return: Suggestions for a given text input | ml_editor/ml_editor.py | get_recommendations_from_input | 0105rahulk/ml-powered-applications | python | def get_recommendations_from_input(txt):
'\n Cleans, preprocesses, and generates heuristic suggestion for input string\n :param txt: Input text\n :return: Suggestions for a given text input\n '
processed = clean_input(txt)
tokenized_sentences = preprocess_input(processed)
suggestions = get_s... |
@api_bp.route('/all')
def all_storage():
'Get all storage in JSON.'
trees = current_app.trees
mounts = MountTree()
for (prefix, tree) in six.iteritems(trees):
for (path, storage) in tree.iter_storage():
mounts.mount(((prefix + '/') + path), storage)
def dfs(node):
childr... | 3,075,368,538,526,878,000 | Get all storage in JSON. | mlcomp/board/views/api.py | all_storage | korepwx/mlcomp | python | @api_bp.route('/all')
def all_storage():
trees = current_app.trees
mounts = MountTree()
for (prefix, tree) in six.iteritems(trees):
for (path, storage) in tree.iter_storage():
mounts.mount(((prefix + '/') + path), storage)
def dfs(node):
children = node.children
... |
def __call__(self, original_image):
'\n Args:\n original_image (np.ndarray): an image of shape (H, W, C) (in BGR order).\n\n Returns:\n predictions (dict):\n the output of the model for one image only.\n See :doc:`/tutorials/models` for details about... | -5,284,906,396,777,502,000 | Args:
original_image (np.ndarray): an image of shape (H, W, C) (in BGR order).
Returns:
predictions (dict):
the output of the model for one image only.
See :doc:`/tutorials/models` for details about the format. | cvpods/engine/predictor.py | __call__ | reinforcementdriving/cvpods | python | def __call__(self, original_image):
'\n Args:\n original_image (np.ndarray): an image of shape (H, W, C) (in BGR order).\n\n Returns:\n predictions (dict):\n the output of the model for one image only.\n See :doc:`/tutorials/models` for details about... |
def checkResponseCorrectnessFromNodes(receivedMsgs: Iterable, reqId: int, fValue: int) -> bool:
'\n the client must get at least :math:`f+1` responses\n '
msgs = [(msg[f.RESULT.nm][f.REQ_ID.nm], msg[f.RESULT.nm][f.IDENTIFIER.nm]) for msg in getRepliesFromClientInbox(receivedMsgs, reqId)]
groupedMsgs =... | 3,340,106,731,286,783,500 | the client must get at least :math:`f+1` responses | plenum/test/helper.py | checkResponseCorrectnessFromNodes | AYCH-Inc/aych.hyper.tolerant | python | def checkResponseCorrectnessFromNodes(receivedMsgs: Iterable, reqId: int, fValue: int) -> bool:
'\n \n '
msgs = [(msg[f.RESULT.nm][f.REQ_ID.nm], msg[f.RESULT.nm][f.IDENTIFIER.nm]) for msg in getRepliesFromClientInbox(receivedMsgs, reqId)]
groupedMsgs = {}
for tpl in msgs:
groupedMsgs[tpl] ... |
def sendMessage(sender: Node, reciever: Node, msg: Optional[Tuple]=None):
'\n Sends message from one node to another\n\n :param nodes:\n :param sender: sender\n :param reciever: recepient\n :param msg: optional message - by default random one generated\n :return:\n '
logger.debug('Sending m... | 6,135,663,388,558,338,000 | Sends message from one node to another
:param nodes:
:param sender: sender
:param reciever: recepient
:param msg: optional message - by default random one generated
:return: | plenum/test/helper.py | sendMessage | AYCH-Inc/aych.hyper.tolerant | python | def sendMessage(sender: Node, reciever: Node, msg: Optional[Tuple]=None):
'\n Sends message from one node to another\n\n :param nodes:\n :param sender: sender\n :param reciever: recepient\n :param msg: optional message - by default random one generated\n :return:\n '
logger.debug('Sending m... |
async def sendMessageAndCheckDelivery(sender: Node, reciever: Node, msg: Optional[Tuple]=None, method=None, customTimeout=None):
'\n Sends message from one node to another and checks that it was delivered\n\n :param sender: sender\n :param reciever: recepient\n :param msg: optional message - by default ... | -8,746,987,848,750,174,000 | Sends message from one node to another and checks that it was delivered
:param sender: sender
:param reciever: recepient
:param msg: optional message - by default random one generated
:param customTimeout:
:return: | plenum/test/helper.py | sendMessageAndCheckDelivery | AYCH-Inc/aych.hyper.tolerant | python | async def sendMessageAndCheckDelivery(sender: Node, reciever: Node, msg: Optional[Tuple]=None, method=None, customTimeout=None):
'\n Sends message from one node to another and checks that it was delivered\n\n :param sender: sender\n :param reciever: recepient\n :param msg: optional message - by default ... |
def sendMessageToAll(nodes, sender: Node, msg: Optional[Tuple]=None):
'\n Sends message from one node to all others\n\n :param nodes:\n :param sender: sender\n :param msg: optional message - by default random one generated\n :return:\n '
for node in nodes:
if (node != sender):
... | -5,977,631,795,381,608,000 | Sends message from one node to all others
:param nodes:
:param sender: sender
:param msg: optional message - by default random one generated
:return: | plenum/test/helper.py | sendMessageToAll | AYCH-Inc/aych.hyper.tolerant | python | def sendMessageToAll(nodes, sender: Node, msg: Optional[Tuple]=None):
'\n Sends message from one node to all others\n\n :param nodes:\n :param sender: sender\n :param msg: optional message - by default random one generated\n :return:\n '
for node in nodes:
if (node != sender):
... |
async def sendMessageAndCheckDeliveryToAll(nodes, sender: Node, msg: Optional[Tuple]=None, method=None, customTimeout=None):
'\n Sends message from one node to all other and checks that it was delivered\n\n :param nodes:\n :param sender: sender\n :param msg: optional message - by default random one gene... | -4,503,784,033,855,764,500 | Sends message from one node to all other and checks that it was delivered
:param nodes:
:param sender: sender
:param msg: optional message - by default random one generated
:param customTimeout:
:return: | plenum/test/helper.py | sendMessageAndCheckDeliveryToAll | AYCH-Inc/aych.hyper.tolerant | python | async def sendMessageAndCheckDeliveryToAll(nodes, sender: Node, msg: Optional[Tuple]=None, method=None, customTimeout=None):
'\n Sends message from one node to all other and checks that it was delivered\n\n :param nodes:\n :param sender: sender\n :param msg: optional message - by default random one gene... |
def checkViewNoForNodes(nodes: Iterable[TestNode], expectedViewNo: int=None):
'\n Checks if all the given nodes have the expected view no\n\n :param nodes: The nodes to check for\n :param expectedViewNo: the view no that the nodes are expected to have\n :return:\n '
viewNos = set()
for node i... | 4,019,316,257,189,537,300 | Checks if all the given nodes have the expected view no
:param nodes: The nodes to check for
:param expectedViewNo: the view no that the nodes are expected to have
:return: | plenum/test/helper.py | checkViewNoForNodes | AYCH-Inc/aych.hyper.tolerant | python | def checkViewNoForNodes(nodes: Iterable[TestNode], expectedViewNo: int=None):
'\n Checks if all the given nodes have the expected view no\n\n :param nodes: The nodes to check for\n :param expectedViewNo: the view no that the nodes are expected to have\n :return:\n '
viewNos = set()
for node i... |
def waitForViewChange(looper, txnPoolNodeSet, expectedViewNo=None, customTimeout=None):
'\n Waits for nodes to come to same view.\n Raises exception when time is out\n '
timeout = (customTimeout or waits.expectedPoolElectionTimeout(len(txnPoolNodeSet)))
return looper.run(eventually(checkViewNoForNo... | 6,331,853,845,034,578,000 | Waits for nodes to come to same view.
Raises exception when time is out | plenum/test/helper.py | waitForViewChange | AYCH-Inc/aych.hyper.tolerant | python | def waitForViewChange(looper, txnPoolNodeSet, expectedViewNo=None, customTimeout=None):
'\n Waits for nodes to come to same view.\n Raises exception when time is out\n '
timeout = (customTimeout or waits.expectedPoolElectionTimeout(len(txnPoolNodeSet)))
return looper.run(eventually(checkViewNoForNo... |
def filterNodeSet(nodeSet, exclude: List[Union[(str, Node)]]):
'\n Return a set of nodes with the nodes in exclude removed.\n\n :param nodeSet: the set of nodes\n :param exclude: the list of nodes or node names to exclude\n :return: the filtered nodeSet\n '
return [n for n in nodeSet if (n not in... | 4,421,575,545,505,831,000 | Return a set of nodes with the nodes in exclude removed.
:param nodeSet: the set of nodes
:param exclude: the list of nodes or node names to exclude
:return: the filtered nodeSet | plenum/test/helper.py | filterNodeSet | AYCH-Inc/aych.hyper.tolerant | python | def filterNodeSet(nodeSet, exclude: List[Union[(str, Node)]]):
'\n Return a set of nodes with the nodes in exclude removed.\n\n :param nodeSet: the set of nodes\n :param exclude: the list of nodes or node names to exclude\n :return: the filtered nodeSet\n '
return [n for n in nodeSet if (n not in... |
def init_discarded(value=None):
'init discarded field with value and return message like representation'
discarded = []
if value:
discarded.append(value)
return invalid_index_serializer.serialize(discarded, toBytes=False) | -3,476,248,819,505,986,600 | init discarded field with value and return message like representation | plenum/test/helper.py | init_discarded | AYCH-Inc/aych.hyper.tolerant | python | def init_discarded(value=None):
discarded = []
if value:
discarded.append(value)
return invalid_index_serializer.serialize(discarded, toBytes=False) |
def set_time(self, value):
'\n Update time and run scheduled callbacks afterwards\n '
self._ts.value = value
self._log_time()
self.service() | 4,053,135,774,855,907,000 | Update time and run scheduled callbacks afterwards | plenum/test/helper.py | set_time | AYCH-Inc/aych.hyper.tolerant | python | def set_time(self, value):
'\n \n '
self._ts.value = value
self._log_time()
self.service() |
def sleep(self, seconds):
'\n Simulate sleeping for given amount of seconds, and run scheduled callbacks afterwards\n '
self.set_time((self._ts.value + seconds)) | 3,932,969,567,631,461,000 | Simulate sleeping for given amount of seconds, and run scheduled callbacks afterwards | plenum/test/helper.py | sleep | AYCH-Inc/aych.hyper.tolerant | python | def sleep(self, seconds):
'\n \n '
self.set_time((self._ts.value + seconds)) |
def advance(self):
'\n Advance time to next scheduled callback and run that callback\n '
if (not self._events):
return
event = self._pop_event()
self._ts.value = event.timestamp
self._log_time()
event.callback() | -4,289,426,136,981,135,400 | Advance time to next scheduled callback and run that callback | plenum/test/helper.py | advance | AYCH-Inc/aych.hyper.tolerant | python | def advance(self):
'\n \n '
if (not self._events):
return
event = self._pop_event()
self._ts.value = event.timestamp
self._log_time()
event.callback() |
def advance_until(self, value):
'\n Advance time in steps until required value running scheduled callbacks in process\n '
while (self._events and (self._next_timestamp() <= value)):
self.advance()
self._ts.value = value | 2,968,606,903,881,629,000 | Advance time in steps until required value running scheduled callbacks in process | plenum/test/helper.py | advance_until | AYCH-Inc/aych.hyper.tolerant | python | def advance_until(self, value):
'\n \n '
while (self._events and (self._next_timestamp() <= value)):
self.advance()
self._ts.value = value |
def run_for(self, seconds):
'\n Simulate running for given amount of seconds, running scheduled callbacks at required timestamps\n '
self.advance_until((self._ts.value + seconds)) | 8,928,512,877,692,073,000 | Simulate running for given amount of seconds, running scheduled callbacks at required timestamps | plenum/test/helper.py | run_for | AYCH-Inc/aych.hyper.tolerant | python | def run_for(self, seconds):
'\n \n '
self.advance_until((self._ts.value + seconds)) |
def wait_for(self, condition: Callable[([], bool)], timeout: Optional=None, max_iterations: int=10000):
'\n Advance time in steps until condition is reached, running scheduled callbacks in process\n Throws TimeoutError if fail to reach condition (under required timeout if defined)\n '
count... | -6,568,998,434,249,261,000 | Advance time in steps until condition is reached, running scheduled callbacks in process
Throws TimeoutError if fail to reach condition (under required timeout if defined) | plenum/test/helper.py | wait_for | AYCH-Inc/aych.hyper.tolerant | python | def wait_for(self, condition: Callable[([], bool)], timeout: Optional=None, max_iterations: int=10000):
'\n Advance time in steps until condition is reached, running scheduled callbacks in process\n Throws TimeoutError if fail to reach condition (under required timeout if defined)\n '
count... |
def run_to_completion(self, max_iterations: int=10000):
'\n Advance time in steps until nothing is scheduled\n '
counter = 0
while (self._events and (counter < max_iterations)):
self.advance()
counter += 1
if self._events:
raise TimeoutError('Failed to complete in {... | 9,019,108,820,477,262,000 | Advance time in steps until nothing is scheduled | plenum/test/helper.py | run_to_completion | AYCH-Inc/aych.hyper.tolerant | python | def run_to_completion(self, max_iterations: int=10000):
'\n \n '
counter = 0
while (self._events and (counter < max_iterations)):
self.advance()
counter += 1
if self._events:
raise TimeoutError('Failed to complete in {} iterations'.format(max_iterations)) |
def __init__(self, venv: vec_env.VecEnv, expert_data: Union[(Iterable[Mapping], types.Transitions)], expert_batch_size: int, gen_algo: on_policy_algorithm.OnPolicyAlgorithm, discrim=None, *, discrim_kwargs: Optional[Mapping]=None, **kwargs):
'Generative Adversarial Imitation Learning that accepts Image Obs\n\n ... | 5,730,144,747,703,004,000 | Generative Adversarial Imitation Learning that accepts Image Obs
Most parameters are described in and passed to `AdversarialTrainer.__init__`.
Additional parameters that `CNNGAIL` adds on top of its superclass initializer are
as follows:
Args:
discrim_kwargs: Optional keyword arguments to use while constructing t... | cnn_modules/cnn_gail.py | __init__ | aj96/InfoGAIL | python | def __init__(self, venv: vec_env.VecEnv, expert_data: Union[(Iterable[Mapping], types.Transitions)], expert_batch_size: int, gen_algo: on_policy_algorithm.OnPolicyAlgorithm, discrim=None, *, discrim_kwargs: Optional[Mapping]=None, **kwargs):
'Generative Adversarial Imitation Learning that accepts Image Obs\n\n ... |
@pytest.fixture(scope='session')
def workspace(request) -> Workspace:
' Workspace Factory Fixture.\n\n Yields:\n directory(Workspace): Workspace Created.\n\n '
logger.debug('Setup of test structure.')
if request.config.getoption('workspace'):
result_dir = request.config.getoption('works... | -6,039,812,711,887,906,000 | Workspace Factory Fixture.
Yields:
directory(Workspace): Workspace Created. | orlov/libs/workspace/fixture.py | workspace | coppelia517/orlov | python | @pytest.fixture(scope='session')
def workspace(request) -> Workspace:
' Workspace Factory Fixture.\n\n Yields:\n directory(Workspace): Workspace Created.\n\n '
logger.debug('Setup of test structure.')
if request.config.getoption('workspace'):
result_dir = request.config.getoption('works... |
def kSmallestPairs(self, nums1, nums2, k):
'\n :type nums1: List[int]\n :type nums2: List[int]\n :type k: int\n :rtype: List[List[int]]\n '
pairs = []
if (len(nums1) > len(nums2)):
tmp = self.kSmallestPairs(nums2, nums1, k)
for pair in tmp:
pair... | 7,945,354,221,419,558,000 | :type nums1: List[int]
:type nums2: List[int]
:type k: int
:rtype: List[List[int]] | Python/find-k-pairs-with-smallest-sums.py | kSmallestPairs | RideGreg/LeetCode | python | def kSmallestPairs(self, nums1, nums2, k):
'\n :type nums1: List[int]\n :type nums2: List[int]\n :type k: int\n :rtype: List[List[int]]\n '
pairs = []
if (len(nums1) > len(nums2)):
tmp = self.kSmallestPairs(nums2, nums1, k)
for pair in tmp:
pair... |
def kSmallestPairs(self, nums1, nums2, k):
'\n :type nums1: List[int]\n :type nums2: List[int]\n :type k: int\n :rtype: List[List[int]]\n '
return nsmallest(k, product(nums1, nums2), key=sum) | -7,592,175,396,215,650,000 | :type nums1: List[int]
:type nums2: List[int]
:type k: int
:rtype: List[List[int]] | Python/find-k-pairs-with-smallest-sums.py | kSmallestPairs | RideGreg/LeetCode | python | def kSmallestPairs(self, nums1, nums2, k):
'\n :type nums1: List[int]\n :type nums2: List[int]\n :type k: int\n :rtype: List[List[int]]\n '
return nsmallest(k, product(nums1, nums2), key=sum) |
def do_query(archives, config_file=None, logger=None, context=None):
'\n Gets concordance for keywords and groups by word.\n\n config_file must be the path to a configuration file with a list\n of the keywords to search for, one per line.\n\n Both keywords and words in documents are normalized, by remov... | 4,697,018,643,465,533,000 | Gets concordance for keywords and groups by word.
config_file must be the path to a configuration file with a list
of the keywords to search for, one per line.
Both keywords and words in documents are normalized, by removing
all non-'a-z|A-Z' characters.
Returns result of form:
{
<WORD>:
[
... | defoe/alto/queries/keyword_concordance_by_word.py | do_query | kallewesterling/defoe | python | def do_query(archives, config_file=None, logger=None, context=None):
'\n Gets concordance for keywords and groups by word.\n\n config_file must be the path to a configuration file with a list\n of the keywords to search for, one per line.\n\n Both keywords and words in documents are normalized, by remov... |
def main():
' main entry point for module execution\n '
OnyxQosModule.main() | -6,186,697,678,587,604,000 | main entry point for module execution | venv/lib/python3.7/site-packages/ansible_collections/mellanox/onyx/plugins/modules/onyx_qos.py | main | DiptoChakrabarty/nexus | python | def main():
' \n '
OnyxQosModule.main() |
def init_module(self):
' initialize module\n '
element_spec = dict(interfaces=dict(type='list', required=True), trust=dict(choices=['L2', 'L3', 'both'], default='L2'), rewrite_pcp=dict(choices=['enabled', 'disabled'], default='disabled'), rewrite_dscp=dict(choices=['enabled', 'disabled'], default='disabl... | -4,328,371,342,356,709,400 | initialize module | venv/lib/python3.7/site-packages/ansible_collections/mellanox/onyx/plugins/modules/onyx_qos.py | init_module | DiptoChakrabarty/nexus | python | def init_module(self):
' \n '
element_spec = dict(interfaces=dict(type='list', required=True), trust=dict(choices=['L2', 'L3', 'both'], default='L2'), rewrite_pcp=dict(choices=['enabled', 'disabled'], default='disabled'), rewrite_dscp=dict(choices=['enabled', 'disabled'], default='disabled'))
argumen... |
def format_payoff_matrix(self, payoff_matrix: list, player_1_strategies: list, player_2_strategies: list) -> str:
'\n This is a helper function that turns a payoff matrix and available\n strategies into ASCII art of a payoff matrix\n '
ret = '\t Player 1\n'
ret += (('\t ' + ... | -598,379,013,262,517,200 | This is a helper function that turns a payoff matrix and available
strategies into ASCII art of a payoff matrix | modules/nashequilibrium.py | format_payoff_matrix | benedictvs/FOCS-Calculator | python | def format_payoff_matrix(self, payoff_matrix: list, player_1_strategies: list, player_2_strategies: list) -> str:
'\n This is a helper function that turns a payoff matrix and available\n strategies into ASCII art of a payoff matrix\n '
ret = '\t Player 1\n'
ret += (('\t ' + ... |
def nash(self, payoff_matrix: list, player_1_strategies: list, player_2_strategies: list) -> tuple:
'\n Takes a payoff matrix from game theory and the available strategies for\n both players. Solves for the Nash equilibrium\n '
work = ''
no_dominant_exists = False
while ((not no_dom... | -4,585,256,206,811,886,600 | Takes a payoff matrix from game theory and the available strategies for
both players. Solves for the Nash equilibrium | modules/nashequilibrium.py | nash | benedictvs/FOCS-Calculator | python | def nash(self, payoff_matrix: list, player_1_strategies: list, player_2_strategies: list) -> tuple:
'\n Takes a payoff matrix from game theory and the available strategies for\n both players. Solves for the Nash equilibrium\n '
work =
no_dominant_exists = False
while ((not no_domin... |
def pytest_addoption(parser) -> None:
'Get cli-arguments.\n\n :param parser: pytest parser\n :return:\n '
parser.addoption('--context', action='store', default='', help='The context to use in the kubeconfig file.')
parser.addoption('--image', action='store', default=DEFAULT_IMAGE, help='The Ingress... | 4,674,396,019,310,846,000 | Get cli-arguments.
:param parser: pytest parser
:return: | tests/conftest.py | pytest_addoption | 84flix/kubernetes-ingress | python | def pytest_addoption(parser) -> None:
'Get cli-arguments.\n\n :param parser: pytest parser\n :return:\n '
parser.addoption('--context', action='store', default=, help='The context to use in the kubeconfig file.')
parser.addoption('--image', action='store', default=DEFAULT_IMAGE, help='The Ingress C... |
def pytest_collection_modifyitems(config, items) -> None:
"\n Skip tests marked with '@pytest.mark.skip_for_nginx_oss' for Nginx OSS runs.\n Skip tests marked with '@pytest.mark.appprotect' for non AP images.\n\n :param config: pytest config\n :param items: pytest collected test-items\n :return:\n ... | 8,845,734,107,502,426,000 | Skip tests marked with '@pytest.mark.skip_for_nginx_oss' for Nginx OSS runs.
Skip tests marked with '@pytest.mark.appprotect' for non AP images.
:param config: pytest config
:param items: pytest collected test-items
:return: | tests/conftest.py | pytest_collection_modifyitems | 84flix/kubernetes-ingress | python | def pytest_collection_modifyitems(config, items) -> None:
"\n Skip tests marked with '@pytest.mark.skip_for_nginx_oss' for Nginx OSS runs.\n Skip tests marked with '@pytest.mark.appprotect' for non AP images.\n\n :param config: pytest config\n :param items: pytest collected test-items\n :return:\n ... |
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item) -> None:
"\n Print out IC Pod logs on test failure.\n\n Only look at actual failing test calls, not setup/teardown.\n Only show the logs if commandline argument `--show-ic-logs` is set to 'yes'\n\n :param item:\n :r... | 58,466,163,031,448,530 | Print out IC Pod logs on test failure.
Only look at actual failing test calls, not setup/teardown.
Only show the logs if commandline argument `--show-ic-logs` is set to 'yes'
:param item:
:return: | tests/conftest.py | pytest_runtest_makereport | 84flix/kubernetes-ingress | python | @pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item) -> None:
"\n Print out IC Pod logs on test failure.\n\n Only look at actual failing test calls, not setup/teardown.\n Only show the logs if commandline argument `--show-ic-logs` is set to 'yes'\n\n :param item:\n :r... |
def test_retrieve_spls(self):
'Test retrieving spls'
res = self.client.get(SPL_URL, format='json')
serializer = SplSerializer(Spl.objects.filter(), many=True)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(serializer.data, res.data['results']) | -5,536,810,454,583,763,000 | Test retrieving spls | api/dailymed/tests/test_api.py | test_retrieve_spls | coderxio/dailymed-api | python | def test_retrieve_spls(self):
res = self.client.get(SPL_URL, format='json')
serializer = SplSerializer(Spl.objects.filter(), many=True)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(serializer.data, res.data['results']) |
def test_retrieve_spls_filter_by_set(self):
'Test retrieving a spl by set filter'
set_id = Set.objects.first()
res = self.client.get(SPL_URL, {'set_id': set_id.id}, format='json')
serializer = SplSerializer(Spl.objects.filter(set__id=set_id.id), many=True)
self.assertEqual(res.status_code, status.HT... | -868,276,020,270,463,200 | Test retrieving a spl by set filter | api/dailymed/tests/test_api.py | test_retrieve_spls_filter_by_set | coderxio/dailymed-api | python | def test_retrieve_spls_filter_by_set(self):
set_id = Set.objects.first()
res = self.client.get(SPL_URL, {'set_id': set_id.id}, format='json')
serializer = SplSerializer(Spl.objects.filter(set__id=set_id.id), many=True)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(seria... |
def test_retrieve_spls_filter_by_inactive_ing(self):
'Test retrieving a spl by inactive ingredient filter'
inactive_ing = 'alcohol'
res = self.client.get(SPL_URL, {'inactive_ingredient_name': inactive_ing}, format='json')
serializer = SplSerializer(Spl.objects.filter(products__inactive_ingredients__name... | 5,513,470,254,975,822,000 | Test retrieving a spl by inactive ingredient filter | api/dailymed/tests/test_api.py | test_retrieve_spls_filter_by_inactive_ing | coderxio/dailymed-api | python | def test_retrieve_spls_filter_by_inactive_ing(self):
inactive_ing = 'alcohol'
res = self.client.get(SPL_URL, {'inactive_ingredient_name': inactive_ing}, format='json')
serializer = SplSerializer(Spl.objects.filter(products__inactive_ingredients__name__icontains=inactive_ing).distinct(), many=True)
... |
def test_retrieve_spls_filter_by_schedule(self):
'Test retrieving spls by schedule filter'
schedule = 'CIV'
res = self.client.get(SPL_URL, {'schedule': schedule}, format='json')
serializer = SplSerializer(Spl.objects.filter(products__schedule=schedule).distinct(), many=True)
self.assertEqual(res.sta... | -8,507,637,084,264,474,000 | Test retrieving spls by schedule filter | api/dailymed/tests/test_api.py | test_retrieve_spls_filter_by_schedule | coderxio/dailymed-api | python | def test_retrieve_spls_filter_by_schedule(self):
schedule = 'CIV'
res = self.client.get(SPL_URL, {'schedule': schedule}, format='json')
serializer = SplSerializer(Spl.objects.filter(products__schedule=schedule).distinct(), many=True)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.as... |
def test_retrieve_spls_filter_by_drug_name(self):
'Test retrieving spls by drug name filter'
name = 'Ciprofloxacin'
res = self.client.get(SPL_URL, {'product_name': name}, format='json')
serializer = SplSerializer(Spl.objects.filter(products__name=name).distinct(), many=True)
self.assertEqual(res.sta... | 1,683,314,421,140,632,800 | Test retrieving spls by drug name filter | api/dailymed/tests/test_api.py | test_retrieve_spls_filter_by_drug_name | coderxio/dailymed-api | python | def test_retrieve_spls_filter_by_drug_name(self):
name = 'Ciprofloxacin'
res = self.client.get(SPL_URL, {'product_name': name}, format='json')
serializer = SplSerializer(Spl.objects.filter(products__name=name).distinct(), many=True)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.ass... |
def test_retrieve_spls_filter_by_complex(self):
'Test retrieving spls filtered by set & inactive ingredient'
set_id = 'b88efb93-f1d1-4606-a669-6896f432a27f'
inactive_ing = 'alcohol'
res = self.client.get(SPL_URL, {'set_id': set_id, 'inactive_ingredient_name': inactive_ing}, format='json')
serializer... | -66,638,310,692,661,380 | Test retrieving spls filtered by set & inactive ingredient | api/dailymed/tests/test_api.py | test_retrieve_spls_filter_by_complex | coderxio/dailymed-api | python | def test_retrieve_spls_filter_by_complex(self):
set_id = 'b88efb93-f1d1-4606-a669-6896f432a27f'
inactive_ing = 'alcohol'
res = self.client.get(SPL_URL, {'set_id': set_id, 'inactive_ingredient_name': inactive_ing}, format='json')
serializer = SplSerializer(Spl.objects.filter(products__inactive_ingre... |
def diag_embed(input, offset=0, dim1=(- 2), dim2=(- 1)):
"\n This OP creates a tensor whose diagonals of certain 2D planes (specified by dim1 and dim2) \n are filled by ``input``. By default, a 2D plane formed by the last two dimensions \n of the returned tensor will be selected.\n\n The argument ``offs... | 666,630,465,588,496,500 | This OP creates a tensor whose diagonals of certain 2D planes (specified by dim1 and dim2)
are filled by ``input``. By default, a 2D plane formed by the last two dimensions
of the returned tensor will be selected.
The argument ``offset`` determines which diagonal is generated:
- If offset = 0, it is the main diagon... | python/paddle/nn/functional/extension.py | diag_embed | wangna11BD/Paddle | python | def diag_embed(input, offset=0, dim1=(- 2), dim2=(- 1)):
"\n This OP creates a tensor whose diagonals of certain 2D planes (specified by dim1 and dim2) \n are filled by ``input``. By default, a 2D plane formed by the last two dimensions \n of the returned tensor will be selected.\n\n The argument ``offs... |
def duplicate_batch(batch, tokenzier, args):
'\n 句子进行重复\n '
new_batch = []
for sentence in batch:
new_batch.append(sentence)
new_batch.append(sentence)
batch_encoding = tokenzier(new_batch, padding=True, truncation=True, max_length=args.max_length, return_tensors='pt')
return b... | 1,107,520,179,547,964,900 | 句子进行重复 | simcse/train_unsup.py | duplicate_batch | Macielyoung/sentence_representation_matching | python | def duplicate_batch(batch, tokenzier, args):
'\n \n '
new_batch = []
for sentence in batch:
new_batch.append(sentence)
new_batch.append(sentence)
batch_encoding = tokenzier(new_batch, padding=True, truncation=True, max_length=args.max_length, return_tensors='pt')
return batch_e... |
def topological_sort(self, start, visited, sort):
'Perform topological sort on a directed acyclic graph.'
current = start
visited.append(current)
neighbors = edges[current]
for neighbor in neighbors:
if (neighbor not in visited):
sort = topological_sort(neighbor, visited, sort)
... | -7,265,521,565,580,027,000 | Perform topological sort on a directed acyclic graph. | algorithm/python/topological_sort.py | topological_sort | yennanliu/Python_basics | python | def topological_sort(self, start, visited, sort):
current = start
visited.append(current)
neighbors = edges[current]
for neighbor in neighbors:
if (neighbor not in visited):
sort = topological_sort(neighbor, visited, sort)
sort.append(current)
if (len(visited) != len(ver... |
def __init__(self, api, data):
'\n Internal use only: initialize sample serie\n '
if (((data is not None) & (type(data) == dict)) & ('name' in data.keys())):
super().__init__(api, data, 'seriesID', str(data['name']))
else:
raise Exception('no (valid) sampleSerie data') | 2,506,736,206,531,914,000 | Internal use only: initialize sample serie | elabjournal/elabjournal/SampleSerie.py | __init__ | matthijsbrouwer/elabjournal-python | python | def __init__(self, api, data):
'\n \n '
if (((data is not None) & (type(data) == dict)) & ('name' in data.keys())):
super().__init__(api, data, 'seriesID', str(data['name']))
else:
raise Exception('no (valid) sampleSerie data') |
def barcode(self):
'\n Get the barcode.\n '
if ('barcode' in self.data()):
barcode = self.data()['barcode']
return barcode
return None | -556,167,806,567,873,200 | Get the barcode. | elabjournal/elabjournal/SampleSerie.py | barcode | matthijsbrouwer/elabjournal-python | python | def barcode(self):
'\n \n '
if ('barcode' in self.data()):
barcode = self.data()['barcode']
return barcode
return None |
def samples(self):
'\n Get a dict with the samples for this sample serie.\n The sampleID is used as a key, the value is a sample object. \n '
sample_list = []
if ('samples' in self.data()):
samplesData = self.data()['samples']
if isinstance(samplesData, li... | -5,221,679,118,685,270,000 | Get a dict with the samples for this sample serie.
The sampleID is used as a key, the value is a sample object. | elabjournal/elabjournal/SampleSerie.py | samples | matthijsbrouwer/elabjournal-python | python | def samples(self):
'\n Get a dict with the samples for this sample serie.\n The sampleID is used as a key, the value is a sample object. \n '
sample_list = []
if ('samples' in self.data()):
samplesData = self.data()['samples']
if isinstance(samplesData, li... |
def main():
'Start the ROS driver and ROS node.'
rospy.init_node('axis_driver')
arg_defaults = {'hostname': '192.168.0.90', 'username': None, 'password': None, 'width': 704, 'height': 576, 'frame_id': 'axis_camera', 'camera_info_url': '', 'use_encrypted_password': False, 'camera_id': 1, 'auto_wakeup_camera'... | -7,634,728,595,484,451,000 | Start the ROS driver and ROS node. | nodes/axis.py | main | MarcoStb1993/axis_camera | python | def main():
rospy.init_node('axis_driver')
arg_defaults = {'hostname': '192.168.0.90', 'username': None, 'password': None, 'width': 704, 'height': 576, 'frame_id': 'axis_camera', 'camera_info_url': , 'use_encrypted_password': False, 'camera_id': 1, 'auto_wakeup_camera': True, 'compression': 0, 'fps': 24, '... |
def read_args_with_defaults(arg_defaults):
"Look up parameters starting in the driver's private parameter space, but also searching outer namespaces.\n Defining them in a higher namespace allows the axis_ptz.py script to share parameters with the driver."
args = {}
for (name, val) in arg_defaults.iterite... | 3,282,720,258,080,658,400 | Look up parameters starting in the driver's private parameter space, but also searching outer namespaces.
Defining them in a higher namespace allows the axis_ptz.py script to share parameters with the driver. | nodes/axis.py | read_args_with_defaults | MarcoStb1993/axis_camera | python | def read_args_with_defaults(arg_defaults):
"Look up parameters starting in the driver's private parameter space, but also searching outer namespaces.\n Defining them in a higher namespace allows the axis_ptz.py script to share parameters with the driver."
args = {}
for (name, val) in arg_defaults.iterite... |
def __init__(self, hostname, username, password, width, height, frame_id, camera_info_url, use_encrypted_password, camera_id=1, auto_wakeup_camera=True, compression=0, fps=24, use_color=True, use_square_pixels=False):
'Create the ROS-VAPIX interface.\n\n :param hostname: Hostname of the camera (without http:... | 7,536,219,766,544,866,000 | Create the ROS-VAPIX interface.
:param hostname: Hostname of the camera (without http://, can be an IP address).
:type hostname: basestring
:param username: If login is needed, provide a username here.
:type username: :py:obj:`basestring` | None
:param password: If login is needed, provide a password here.
:type passw... | nodes/axis.py | __init__ | MarcoStb1993/axis_camera | python | def __init__(self, hostname, username, password, width, height, frame_id, camera_info_url, use_encrypted_password, camera_id=1, auto_wakeup_camera=True, compression=0, fps=24, use_color=True, use_square_pixels=False):
'Create the ROS-VAPIX interface.\n\n :param hostname: Hostname of the camera (without http:... |
def peer_subscribe(self, topic_name, topic_publish, peer_publish):
'Lazy-start the image-publisher.'
if (self._streaming_thread is None):
self._streaming_thread = ImageStreamingThread(self)
self._streaming_thread.start()
else:
self._streaming_thread.resume() | -9,192,376,579,225,204,000 | Lazy-start the image-publisher. | nodes/axis.py | peer_subscribe | MarcoStb1993/axis_camera | python | def peer_subscribe(self, topic_name, topic_publish, peer_publish):
if (self._streaming_thread is None):
self._streaming_thread = ImageStreamingThread(self)
self._streaming_thread.start()
else:
self._streaming_thread.resume() |
def peer_unsubscribe(self, topic_name, num_peers):
'Lazy-stop the image-publisher when nobody is interested'
if (num_peers == 0):
self._streaming_thread.pause() | 3,966,300,546,944,964,600 | Lazy-stop the image-publisher when nobody is interested | nodes/axis.py | peer_unsubscribe | MarcoStb1993/axis_camera | python | def peer_unsubscribe(self, topic_name, num_peers):
if (num_peers == 0):
self._streaming_thread.pause() |
def take_snapshot(self, request):
'Retrieve a snapshot from the camera.\n\n :param request: The service request.\n :type request: :py:class:`axis_camera.srv.TakeSnapshotRequest`\n :return: The response containing the image.\n :rtype: :py:class:`axis_camera.srv.TakeSnapshotResponse`\n ... | 5,884,849,822,967,185,000 | Retrieve a snapshot from the camera.
:param request: The service request.
:type request: :py:class:`axis_camera.srv.TakeSnapshotRequest`
:return: The response containing the image.
:rtype: :py:class:`axis_camera.srv.TakeSnapshotResponse`
:raises: :py:exc:`IOError`, :py:exc:`urllib2.URLError` | nodes/axis.py | take_snapshot | MarcoStb1993/axis_camera | python | def take_snapshot(self, request):
'Retrieve a snapshot from the camera.\n\n :param request: The service request.\n :type request: :py:class:`axis_camera.srv.TakeSnapshotRequest`\n :return: The response containing the image.\n :rtype: :py:class:`axis_camera.srv.TakeSnapshotResponse`\n ... |
def reconfigure_video(self, config, level):
'Dynamic reconfigure callback for video parameters.\n\n :param config: The requested configuration.\n :type config: dict\n :param level: Unused here.\n :type level: int\n :return: The config corresponding to what was really achieved.\n ... | -8,028,459,420,616,422,000 | Dynamic reconfigure callback for video parameters.
:param config: The requested configuration.
:type config: dict
:param level: Unused here.
:type level: int
:return: The config corresponding to what was really achieved.
:rtype: dict | nodes/axis.py | reconfigure_video | MarcoStb1993/axis_camera | python | def reconfigure_video(self, config, level):
'Dynamic reconfigure callback for video parameters.\n\n :param config: The requested configuration.\n :type config: dict\n :param level: Unused here.\n :type level: int\n :return: The config corresponding to what was really achieved.\n ... |
def __try_set_value_from_config(self, config, field, setter):
"First, try to call `setter(config[field])`, and if this call doesn't succeed. set the field in config to\n its value stored in this class.\n\n :param config: The dynamic reconfigure config dictionary.\n :type config: dict\n :... | 7,981,268,935,643,443,000 | First, try to call `setter(config[field])`, and if this call doesn't succeed. set the field in config to
its value stored in this class.
:param config: The dynamic reconfigure config dictionary.
:type config: dict
:param field: The field name (both in :py:obj:`config` and in :py:obj:`self`).
:type field: basestring
:p... | nodes/axis.py | __try_set_value_from_config | MarcoStb1993/axis_camera | python | def __try_set_value_from_config(self, config, field, setter):
"First, try to call `setter(config[field])`, and if this call doesn't succeed. set the field in config to\n its value stored in this class.\n\n :param config: The dynamic reconfigure config dictionary.\n :type config: dict\n :... |
def set_resolution(self, resolution_value):
'Request a new resolution for the video stream.\n\n :param resolution_value: The string of type `width`x`height` or a :py:class:`VideoResolution` object.\n :type resolution_value: basestring|VideoResolution\n :raises: :py:exc:`ValueError` if the resol... | 1,512,016,567,957,172,000 | Request a new resolution for the video stream.
:param resolution_value: The string of type `width`x`height` or a :py:class:`VideoResolution` object.
:type resolution_value: basestring|VideoResolution
:raises: :py:exc:`ValueError` if the resolution is unknown/unsupported. | nodes/axis.py | set_resolution | MarcoStb1993/axis_camera | python | def set_resolution(self, resolution_value):
'Request a new resolution for the video stream.\n\n :param resolution_value: The string of type `width`x`height` or a :py:class:`VideoResolution` object.\n :type resolution_value: basestring|VideoResolution\n :raises: :py:exc:`ValueError` if the resol... |
def _get_resolution_from_param_value(self, value):
'Return a :py:class:`VideoResolution` object corresponding to the given video resolution param string.\n\n :param value: Value of the resolution parameter to parse (of form `width`x`height`).\n :type value: basestring\n :return: The :py:class:`... | -8,950,817,674,447,291,000 | Return a :py:class:`VideoResolution` object corresponding to the given video resolution param string.
:param value: Value of the resolution parameter to parse (of form `width`x`height`).
:type value: basestring
:return: The :py:class:`VideoResolution` corresponding to the given resolution param string.
:rtype: :py:cla... | nodes/axis.py | _get_resolution_from_param_value | MarcoStb1993/axis_camera | python | def _get_resolution_from_param_value(self, value):
'Return a :py:class:`VideoResolution` object corresponding to the given video resolution param string.\n\n :param value: Value of the resolution parameter to parse (of form `width`x`height`).\n :type value: basestring\n :return: The :py:class:`... |
def find_resolution_by_size(self, width, height):
'Return a :py:class:`VideoResolution` object with the given dimensions.\n\n If there are more resolutions with the same size, any of them may be returned.\n\n :param width: Image width in pixels. If `None`, resolutions will be matched only by height.\n... | -2,798,699,544,438,996,500 | Return a :py:class:`VideoResolution` object with the given dimensions.
If there are more resolutions with the same size, any of them may be returned.
:param width: Image width in pixels. If `None`, resolutions will be matched only by height.
:type width: int|None
:param height: Image height in pixels. If `None`, reso... | nodes/axis.py | find_resolution_by_size | MarcoStb1993/axis_camera | python | def find_resolution_by_size(self, width, height):
'Return a :py:class:`VideoResolution` object with the given dimensions.\n\n If there are more resolutions with the same size, any of them may be returned.\n\n :param width: Image width in pixels. If `None`, resolutions will be matched only by height.\n... |
def _get_allowed_resolutions(self):
'Return a list of resolutions supported both by the camera.\n\n :return: The supported resolutions list.\n :rtype: list of :py:class:`VideoResolution`\n '
camera_resolutions = self._get_resolutions_supported_by_camera()
return camera_resolutions | -3,372,507,955,636,219,000 | Return a list of resolutions supported both by the camera.
:return: The supported resolutions list.
:rtype: list of :py:class:`VideoResolution` | nodes/axis.py | _get_allowed_resolutions | MarcoStb1993/axis_camera | python | def _get_allowed_resolutions(self):
'Return a list of resolutions supported both by the camera.\n\n :return: The supported resolutions list.\n :rtype: list of :py:class:`VideoResolution`\n '
camera_resolutions = self._get_resolutions_supported_by_camera()
return camera_resolutions |
def _get_resolutions_supported_by_camera(self):
'Return a list of resolutions supported the camera.\n\n :return: The supported resolutions list.\n :rtype: list of :py:class:`VideoResolution`\n '
try:
names = self._api.parse_list_parameter_value(self._api.get_parameter('Properties.Im... | -8,883,113,227,496,016,000 | Return a list of resolutions supported the camera.
:return: The supported resolutions list.
:rtype: list of :py:class:`VideoResolution` | nodes/axis.py | _get_resolutions_supported_by_camera | MarcoStb1993/axis_camera | python | def _get_resolutions_supported_by_camera(self):
'Return a list of resolutions supported the camera.\n\n :return: The supported resolutions list.\n :rtype: list of :py:class:`VideoResolution`\n '
try:
names = self._api.parse_list_parameter_value(self._api.get_parameter('Properties.Im... |
def set_compression(self, compression):
'Request the given compression level for the video stream.\n\n :param compression: Compression of the image (0 - no compression, 100 - max compression).\n :type compression: int\n :raises: :py:exc:`ValueError` if the given compression level is outside the... | -1,130,117,131,443,176,700 | Request the given compression level for the video stream.
:param compression: Compression of the image (0 - no compression, 100 - max compression).
:type compression: int
:raises: :py:exc:`ValueError` if the given compression level is outside the allowed range. | nodes/axis.py | set_compression | MarcoStb1993/axis_camera | python | def set_compression(self, compression):
'Request the given compression level for the video stream.\n\n :param compression: Compression of the image (0 - no compression, 100 - max compression).\n :type compression: int\n :raises: :py:exc:`ValueError` if the given compression level is outside the... |
@staticmethod
def sanitize_compression(compression):
'Make sure the given value can be used as a compression level of the video stream.\n\n :param compression: Compression of the image (0 - no compression, 100 - max compression).\n :type compression: int\n :return: The given compression convert... | -7,312,961,599,501,351,000 | Make sure the given value can be used as a compression level of the video stream.
:param compression: Compression of the image (0 - no compression, 100 - max compression).
:type compression: int
:return: The given compression converted to an int.
:rtype: int
:raises: :py:exc:`ValueError` if the given compression level... | nodes/axis.py | sanitize_compression | MarcoStb1993/axis_camera | python | @staticmethod
def sanitize_compression(compression):
'Make sure the given value can be used as a compression level of the video stream.\n\n :param compression: Compression of the image (0 - no compression, 100 - max compression).\n :type compression: int\n :return: The given compression convert... |
def set_fps(self, fps):
'Request the given compression level for the video stream.\n\n :param fps: The desired frames per second.\n :type fps: int\n :raises: :py:exc:`ValueError` if the given FPS is outside the allowed range.\n '
if (fps != self._fps):
self._fps = self.saniti... | -1,207,212,672,288,412,200 | Request the given compression level for the video stream.
:param fps: The desired frames per second.
:type fps: int
:raises: :py:exc:`ValueError` if the given FPS is outside the allowed range. | nodes/axis.py | set_fps | MarcoStb1993/axis_camera | python | def set_fps(self, fps):
'Request the given compression level for the video stream.\n\n :param fps: The desired frames per second.\n :type fps: int\n :raises: :py:exc:`ValueError` if the given FPS is outside the allowed range.\n '
if (fps != self._fps):
self._fps = self.saniti... |
@staticmethod
def sanitize_fps(fps):
'Make sure the given value can be used as FPS of the video stream.\n\n :param fps: The desired frames per second.\n :type fps: int\n :return: The given FPS converted to an int.\n :rtype: int\n :raises: :py:exc:`ValueError` if the given FPS is o... | 7,733,244,502,197,703,000 | Make sure the given value can be used as FPS of the video stream.
:param fps: The desired frames per second.
:type fps: int
:return: The given FPS converted to an int.
:rtype: int
:raises: :py:exc:`ValueError` if the given FPS is outside the allowed range. | nodes/axis.py | sanitize_fps | MarcoStb1993/axis_camera | python | @staticmethod
def sanitize_fps(fps):
'Make sure the given value can be used as FPS of the video stream.\n\n :param fps: The desired frames per second.\n :type fps: int\n :return: The given FPS converted to an int.\n :rtype: int\n :raises: :py:exc:`ValueError` if the given FPS is o... |
def set_use_color(self, use_color):
'Request using/not using color in the video stream.\n :param use_color: If True, send a color stream, otherwise send only grayscale image.\n\n :type use_color: bool\n :raises: :py:exc:`ValueError` if the given argument is not a bool.\n '
if (use_co... | 2,469,160,273,032,331,300 | Request using/not using color in the video stream.
:param use_color: If True, send a color stream, otherwise send only grayscale image.
:type use_color: bool
:raises: :py:exc:`ValueError` if the given argument is not a bool. | nodes/axis.py | set_use_color | MarcoStb1993/axis_camera | python | def set_use_color(self, use_color):
'Request using/not using color in the video stream.\n :param use_color: If True, send a color stream, otherwise send only grayscale image.\n\n :type use_color: bool\n :raises: :py:exc:`ValueError` if the given argument is not a bool.\n '
if (use_co... |
def set_use_square_pixels(self, use_square_pixels):
'Request using/not using square pixels.\n\n :param use_square_pixels: If True, the resolution will be stretched to match 1:1 pixels.\n By default, the pixels have a ratio of 11:12.\n :type use_square_pixels: bool\n ... | -3,645,591,623,173,462,000 | Request using/not using square pixels.
:param use_square_pixels: If True, the resolution will be stretched to match 1:1 pixels.
By default, the pixels have a ratio of 11:12.
:type use_square_pixels: bool
:raises: :py:exc:`ValueError` if the given argument is not a bool. | nodes/axis.py | set_use_square_pixels | MarcoStb1993/axis_camera | python | def set_use_square_pixels(self, use_square_pixels):
'Request using/not using square pixels.\n\n :param use_square_pixels: If True, the resolution will be stretched to match 1:1 pixels.\n By default, the pixels have a ratio of 11:12.\n :type use_square_pixels: bool\n ... |
@staticmethod
def sanitize_bool(value, field_name):
'Convert the given value to a bool.\n\n :param value: Either True, False,, "1", "0", 1 or 0.\n :type value: :py:class:`basestring` | :py:class:`bool` | :py:class:`int`\n :param field_name: Name of the field this value belongs to (just for debu... | 4,932,215,436,621,322,000 | Convert the given value to a bool.
:param value: Either True, False,, "1", "0", 1 or 0.
:type value: :py:class:`basestring` | :py:class:`bool` | :py:class:`int`
:param field_name: Name of the field this value belongs to (just for debug messages).
:type field_name: basestring
:return: The bool value of the given value.... | nodes/axis.py | sanitize_bool | MarcoStb1993/axis_camera | python | @staticmethod
def sanitize_bool(value, field_name):
'Convert the given value to a bool.\n\n :param value: Either True, False,, "1", "0", 1 or 0.\n :type value: :py:class:`basestring` | :py:class:`bool` | :py:class:`int`\n :param field_name: Name of the field this value belongs to (just for debu... |
def __init__(self, width, height):
'Create a representation of the resolution.\n\n :param width: Width of the resolution in pixels.\n :type width: int\n :param height: Height of the resolution in pixels.\n :type height: int\n '
super(VideoResolution, self).__init__()
self.... | -5,380,199,725,355,814,000 | Create a representation of the resolution.
:param width: Width of the resolution in pixels.
:type width: int
:param height: Height of the resolution in pixels.
:type height: int | nodes/axis.py | __init__ | MarcoStb1993/axis_camera | python | def __init__(self, width, height):
'Create a representation of the resolution.\n\n :param width: Width of the resolution in pixels.\n :type width: int\n :param height: Height of the resolution in pixels.\n :type height: int\n '
super(VideoResolution, self).__init__()
self.... |
def get_resolution(self, use_square_pixels=False):
'Get the image dimensions corresponding to this resolution.\n\n :param use_square_pixels: Whether to strech the resulting resolution to square pixels.\n :type use_square_pixels: bool\n :return: A tuple (width, height)\n :rtype: tuple\n ... | -3,825,175,919,994,191,400 | Get the image dimensions corresponding to this resolution.
:param use_square_pixels: Whether to strech the resulting resolution to square pixels.
:type use_square_pixels: bool
:return: A tuple (width, height)
:rtype: tuple | nodes/axis.py | get_resolution | MarcoStb1993/axis_camera | python | def get_resolution(self, use_square_pixels=False):
'Get the image dimensions corresponding to this resolution.\n\n :param use_square_pixels: Whether to strech the resulting resolution to square pixels.\n :type use_square_pixels: bool\n :return: A tuple (width, height)\n :rtype: tuple\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.