body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
7826689bad44a39d8f809017d7087e3a228e098007f07ed4de0f2c17a7d9732f | def mock_install_third_party_libs_main():
'Mock for install_third_party_libs.'
return | Mock for install_third_party_libs. | scripts/run_mypy_checks_test.py | mock_install_third_party_libs_main | ParmeetChawla25/oppia | 5,422 | python | def mock_install_third_party_libs_main():
return | def mock_install_third_party_libs_main():
return<|docstring|>Mock for install_third_party_libs.<|endoftext|> |
b407c3f20da7a177b11262b11fbbd07c8fc9cabacb194b180a87ea7656c3f816 | def communicate(self):
'Return user-prefix error as stderr.'
return (b'', b"can't combine user with prefix") | Return user-prefix error as stderr. | scripts/run_mypy_checks_test.py | communicate | ParmeetChawla25/oppia | 5,422 | python | def communicate(self):
return (b, b"can't combine user with prefix") | def communicate(self):
return (b, b"can't combine user with prefix")<|docstring|>Return user-prefix error as stderr.<|endoftext|> |
18e76a7e0b446e79aa3298f067039a68b5326222346da274045e22029daed9dd | def __init__(self, hist_file):
'Configure the app to load persistent history from a file (both readline and cmd2 history command affected).\n\n :param hist_file: file to load history from at start and write it to at end\n '
super().__init__(persistent_history_file=hist_file, persistent_history_len... | Configure the app to load persistent history from a file (both readline and cmd2 history command affected).
:param hist_file: file to load history from at start and write it to at end | examples/persistent_history.py | __init__ | aquilax/cmd2 | 469 | python | def __init__(self, hist_file):
'Configure the app to load persistent history from a file (both readline and cmd2 history command affected).\n\n :param hist_file: file to load history from at start and write it to at end\n '
super().__init__(persistent_history_file=hist_file, persistent_history_len... | def __init__(self, hist_file):
'Configure the app to load persistent history from a file (both readline and cmd2 history command affected).\n\n :param hist_file: file to load history from at start and write it to at end\n '
super().__init__(persistent_history_file=hist_file, persistent_history_len... |
671defb025128c80e617a74bf1ca947ba3cca731940830e9a65a79cfd3ee9211 | def _GetPossibleDisks(self, resources, name, instance_ref):
'Gets the possible disks that match the provided disk name.\n\n First, we attempt to parse the provided disk name as a regional and as a\n zonal disk. Next, we iterate over the attached disks to find the ones that\n match the parsed regional and z... | Gets the possible disks that match the provided disk name.
First, we attempt to parse the provided disk name as a regional and as a
zonal disk. Next, we iterate over the attached disks to find the ones that
match the parsed regional and zonal disks.
If the disk can match either a zonal or regional disk, we prompt the... | lib/surface/compute/instances/set_disk_auto_delete.py | _GetPossibleDisks | google-cloud-sdk-unofficial/google-cloud-sdk | 2 | python | def _GetPossibleDisks(self, resources, name, instance_ref):
'Gets the possible disks that match the provided disk name.\n\n First, we attempt to parse the provided disk name as a regional and as a\n zonal disk. Next, we iterate over the attached disks to find the ones that\n match the parsed regional and z... | def _GetPossibleDisks(self, resources, name, instance_ref):
'Gets the possible disks that match the provided disk name.\n\n First, we attempt to parse the provided disk name as a regional and as a\n zonal disk. Next, we iterate over the attached disks to find the ones that\n match the parsed regional and z... |
1dee1b35e6050a6e1a5af95ea5bfe2af0b32e8247115d66e6ad1b9cd5cee1905 | def GetAttachedDiskByName(self, resources, name, instance_ref, instance):
'Gets an attached disk with the specified disk name.\n\n First, we attempt to parse the provided disk name to find the possible disks\n that it may describe. Next, we iterate over the attached disks to find the\n ones that match the ... | Gets an attached disk with the specified disk name.
First, we attempt to parse the provided disk name to find the possible disks
that it may describe. Next, we iterate over the attached disks to find the
ones that match the possible disks.
If the disk can match multiple disks, we prompt the user to choose one.
Args:... | lib/surface/compute/instances/set_disk_auto_delete.py | GetAttachedDiskByName | google-cloud-sdk-unofficial/google-cloud-sdk | 2 | python | def GetAttachedDiskByName(self, resources, name, instance_ref, instance):
'Gets an attached disk with the specified disk name.\n\n First, we attempt to parse the provided disk name to find the possible disks\n that it may describe. Next, we iterate over the attached disks to find the\n ones that match the ... | def GetAttachedDiskByName(self, resources, name, instance_ref, instance):
'Gets an attached disk with the specified disk name.\n\n First, we attempt to parse the provided disk name to find the possible disks\n that it may describe. Next, we iterate over the attached disks to find the\n ones that match the ... |
65842dd4f8227778b8f1d7e700eb8456d9a98df30529dd055f81db0599070fdb | def GetAttachedDiskByDeviceName(self, resources, device_name, instance_ref, instance):
'Gets an attached disk with the specified device name.\n\n Args:\n resources: resources.Registry, The resource registry\n device_name: str, device name of the attached disk.\n instance_ref: Reference of the inst... | Gets an attached disk with the specified device name.
Args:
resources: resources.Registry, The resource registry
device_name: str, device name of the attached disk.
instance_ref: Reference of the instance instance.
instance: Instance object.
Returns:
An attached disk object.
Raises:
compute_exceptions.Ar... | lib/surface/compute/instances/set_disk_auto_delete.py | GetAttachedDiskByDeviceName | google-cloud-sdk-unofficial/google-cloud-sdk | 2 | python | def GetAttachedDiskByDeviceName(self, resources, device_name, instance_ref, instance):
'Gets an attached disk with the specified device name.\n\n Args:\n resources: resources.Registry, The resource registry\n device_name: str, device name of the attached disk.\n instance_ref: Reference of the inst... | def GetAttachedDiskByDeviceName(self, resources, device_name, instance_ref, instance):
'Gets an attached disk with the specified device name.\n\n Args:\n resources: resources.Registry, The resource registry\n device_name: str, device name of the attached disk.\n instance_ref: Reference of the inst... |
35b66ceeb51e09bc22eccc0faeb677e3b58e05dccf6fafcbfa8c30f37b15d97f | def is_prime(num):
'Checks if num is a prime value'
for i in range(2, (int((num ** 0.5)) + 1)):
if ((num % i) == 0):
return False
return True | Checks if num is a prime value | tool/haltonSequence.py | is_prime | wangkepfe/Real-Time-Ray-Tracing | 4 | python | def is_prime(num):
for i in range(2, (int((num ** 0.5)) + 1)):
if ((num % i) == 0):
return False
return True | def is_prime(num):
for i in range(2, (int((num ** 0.5)) + 1)):
if ((num % i) == 0):
return False
return True<|docstring|>Checks if num is a prime value<|endoftext|> |
39d29d7c576861a056a3fb46e8f1ed2b6008479f286cabf1e452183487707bf1 | def nextValidId(self, orderId):
'Always called by TWS but not relevant for our example'
pass | Always called by TWS but not relevant for our example | examples/historicaldata.py | nextValidId | 447327642/swigibpy | 139 | python | def nextValidId(self, orderId):
pass | def nextValidId(self, orderId):
pass<|docstring|>Always called by TWS but not relevant for our example<|endoftext|> |
891fbac007eb7a591a95f6a8d3c1817f510bd59e39d5c3107a65883eeb74f9a0 | def openOrderEnd(self):
'Always called by TWS but not relevant for our example'
pass | Always called by TWS but not relevant for our example | examples/historicaldata.py | openOrderEnd | 447327642/swigibpy | 139 | python | def openOrderEnd(self):
pass | def openOrderEnd(self):
pass<|docstring|>Always called by TWS but not relevant for our example<|endoftext|> |
4b5606fb56afb0ceceb1a7e09229afdb7afc8ab2e7b0942677b42797d64c313f | def managedAccounts(self, openOrderEnd):
'Called by TWS but not relevant for our example'
pass | Called by TWS but not relevant for our example | examples/historicaldata.py | managedAccounts | 447327642/swigibpy | 139 | python | def managedAccounts(self, openOrderEnd):
pass | def managedAccounts(self, openOrderEnd):
pass<|docstring|>Called by TWS but not relevant for our example<|endoftext|> |
e63e71cceb192d4b77e1a2d3401b38b41a0d6e93f44ac418bf39269cee8e2119 | def parse(source: Union[(str, bytes)], fnam: str, module: Optional[str], errors: Optional[Errors]=None, options: Optional[Options]=None) -> MypyFile:
'Parse a source file, without doing any semantic analysis.\n\n Return the parse tree. If errors is not provided, raise ParseError\n on failure. Otherwise, use t... | Parse a source file, without doing any semantic analysis.
Return the parse tree. If errors is not provided, raise ParseError
on failure. Otherwise, use the errors object to report parse errors. | mypy/fastparse.py | parse | c-bata/mypy | 35 | python | def parse(source: Union[(str, bytes)], fnam: str, module: Optional[str], errors: Optional[Errors]=None, options: Optional[Options]=None) -> MypyFile:
'Parse a source file, without doing any semantic analysis.\n\n Return the parse tree. If errors is not provided, raise ParseError\n on failure. Otherwise, use t... | def parse(source: Union[(str, bytes)], fnam: str, module: Optional[str], errors: Optional[Errors]=None, options: Optional[Options]=None) -> MypyFile:
'Parse a source file, without doing any semantic analysis.\n\n Return the parse tree. If errors is not provided, raise ParseError\n on failure. Otherwise, use t... |
3a0986724c3617cb6f3da360e6951214c68e255a46c3106efa6e673937b22fe4 | def parse_type_ignore_tag(tag: Optional[str]) -> Optional[List[str]]:
'Parse optional "[code, ...]" tag after "# type: ignore".\n\n Return:\n * [] if no tag was found (ignore all errors)\n * list of ignored error codes if a tag was found\n * None if the tag was invalid.\n '
if ((not tag) or (t... | Parse optional "[code, ...]" tag after "# type: ignore".
Return:
* [] if no tag was found (ignore all errors)
* list of ignored error codes if a tag was found
* None if the tag was invalid. | mypy/fastparse.py | parse_type_ignore_tag | c-bata/mypy | 35 | python | def parse_type_ignore_tag(tag: Optional[str]) -> Optional[List[str]]:
'Parse optional "[code, ...]" tag after "# type: ignore".\n\n Return:\n * [] if no tag was found (ignore all errors)\n * list of ignored error codes if a tag was found\n * None if the tag was invalid.\n '
if ((not tag) or (t... | def parse_type_ignore_tag(tag: Optional[str]) -> Optional[List[str]]:
'Parse optional "[code, ...]" tag after "# type: ignore".\n\n Return:\n * [] if no tag was found (ignore all errors)\n * list of ignored error codes if a tag was found\n * None if the tag was invalid.\n '
if ((not tag) or (t... |
5bed08df4389d438690d99dd5fd8cdcc1406f3d964bcd257c8b4ebff039ca87a | def parse_type_comment(type_comment: str, line: int, column: int, errors: Optional[Errors], assume_str_is_unicode: bool=True) -> Tuple[(Optional[List[str]], Optional[ProperType])]:
'Parse type portion of a type comment (+ optional type ignore).\n\n Return (ignore info, parsed type).\n '
try:
typ =... | Parse type portion of a type comment (+ optional type ignore).
Return (ignore info, parsed type). | mypy/fastparse.py | parse_type_comment | c-bata/mypy | 35 | python | def parse_type_comment(type_comment: str, line: int, column: int, errors: Optional[Errors], assume_str_is_unicode: bool=True) -> Tuple[(Optional[List[str]], Optional[ProperType])]:
'Parse type portion of a type comment (+ optional type ignore).\n\n Return (ignore info, parsed type).\n '
try:
typ =... | def parse_type_comment(type_comment: str, line: int, column: int, errors: Optional[Errors], assume_str_is_unicode: bool=True) -> Tuple[(Optional[List[str]], Optional[ProperType])]:
'Parse type portion of a type comment (+ optional type ignore).\n\n Return (ignore info, parsed type).\n '
try:
typ =... |
97697ba37a901763471b5797d5eb7f07fd99cdd81b4ec7e40465e79e6b6cb1f2 | def parse_type_string(expr_string: str, expr_fallback_name: str, line: int, column: int, assume_str_is_unicode: bool=True) -> ProperType:
'Parses a type that was originally present inside of an explicit string,\n byte string, or unicode string.\n\n For example, suppose we have the type `Foo["blah"]`. We shoul... | Parses a type that was originally present inside of an explicit string,
byte string, or unicode string.
For example, suppose we have the type `Foo["blah"]`. We should parse the
string expression "blah" using this function.
If `assume_str_is_unicode` is set to true, this function will assume that
`Foo["blah"]` is equi... | mypy/fastparse.py | parse_type_string | c-bata/mypy | 35 | python | def parse_type_string(expr_string: str, expr_fallback_name: str, line: int, column: int, assume_str_is_unicode: bool=True) -> ProperType:
'Parses a type that was originally present inside of an explicit string,\n byte string, or unicode string.\n\n For example, suppose we have the type `Foo["blah"]`. We shoul... | def parse_type_string(expr_string: str, expr_fallback_name: str, line: int, column: int, assume_str_is_unicode: bool=True) -> ProperType:
'Parses a type that was originally present inside of an explicit string,\n byte string, or unicode string.\n\n For example, suppose we have the type `Foo["blah"]`. We shoul... |
85f63f50812903cc87253f9b20d4b49b95d74cdce27a91001432408f07bd73ee | def bytes_to_human_readable_repr(b: bytes) -> str:
"Converts bytes into some human-readable representation. Unprintable\n bytes such as the nul byte are escaped. For example:\n\n >>> b = bytes([102, 111, 111, 10, 0])\n >>> s = bytes_to_human_readable_repr(b)\n >>> print(s)\n foo\n\x00... | Converts bytes into some human-readable representation. Unprintable
bytes such as the nul byte are escaped. For example:
>>> b = bytes([102, 111, 111, 10, 0])
>>> s = bytes_to_human_readable_repr(b)
>>> print(s)
foo
>>> print(repr(s))
'foo\n\x00' | mypy/fastparse.py | bytes_to_human_readable_repr | c-bata/mypy | 35 | python | def bytes_to_human_readable_repr(b: bytes) -> str:
"Converts bytes into some human-readable representation. Unprintable\n bytes such as the nul byte are escaped. For example:\n\n >>> b = bytes([102, 111, 111, 10, 0])\n >>> s = bytes_to_human_readable_repr(b)\n >>> print(s)\n foo\n\x00... | def bytes_to_human_readable_repr(b: bytes) -> str:
"Converts bytes into some human-readable representation. Unprintable\n bytes such as the nul byte are escaped. For example:\n\n >>> b = bytes([102, 111, 111, 10, 0])\n >>> s = bytes_to_human_readable_repr(b)\n >>> print(s)\n foo\n\x00... |
f2a5a27e06d45f8b7ab74343a4b1c3487ba9eff8330c23f6dfd74d15701a605a | def translate_module_id(self, id: str) -> str:
"Return the actual, internal module id for a source text id.\n\n For example, translate '__builtin__' in Python 2 to 'builtins'.\n "
if (id == self.options.custom_typing_module):
return 'typing'
elif ((id == '__builtin__') and (self.option... | Return the actual, internal module id for a source text id.
For example, translate '__builtin__' in Python 2 to 'builtins'. | mypy/fastparse.py | translate_module_id | c-bata/mypy | 35 | python | def translate_module_id(self, id: str) -> str:
"Return the actual, internal module id for a source text id.\n\n For example, translate '__builtin__' in Python 2 to 'builtins'.\n "
if (id == self.options.custom_typing_module):
return 'typing'
elif ((id == '__builtin__') and (self.option... | def translate_module_id(self, id: str) -> str:
"Return the actual, internal module id for a source text id.\n\n For example, translate '__builtin__' in Python 2 to 'builtins'.\n "
if (id == self.options.custom_typing_module):
return 'typing'
elif ((id == '__builtin__') and (self.option... |
8af3ffa7855321939ac5a87c91d6dfa48fd8e00ed3ab8cd1887cdd02a8e51a88 | def do_func_def(self, n: Union[(ast3.FunctionDef, ast3.AsyncFunctionDef)], is_coroutine: bool=False) -> Union[(FuncDef, Decorator)]:
'Helper shared between visit_FunctionDef and visit_AsyncFunctionDef.'
self.class_and_function_stack.append('F')
no_type_check = bool((n.decorator_list and any((is_no_type_chec... | Helper shared between visit_FunctionDef and visit_AsyncFunctionDef. | mypy/fastparse.py | do_func_def | c-bata/mypy | 35 | python | def do_func_def(self, n: Union[(ast3.FunctionDef, ast3.AsyncFunctionDef)], is_coroutine: bool=False) -> Union[(FuncDef, Decorator)]:
self.class_and_function_stack.append('F')
no_type_check = bool((n.decorator_list and any((is_no_type_check_decorator(d) for d in n.decorator_list))))
lineno = n.lineno
... | def do_func_def(self, n: Union[(ast3.FunctionDef, ast3.AsyncFunctionDef)], is_coroutine: bool=False) -> Union[(FuncDef, Decorator)]:
self.class_and_function_stack.append('F')
no_type_check = bool((n.decorator_list and any((is_no_type_check_decorator(d) for d in n.decorator_list))))
lineno = n.lineno
... |
030ef19bab87987ce53dc159f0729e57e77a63e019f413024c7646c64d284eaf | def convert_column(self, column: int) -> int:
'Apply column override if defined; otherwise return column.\n\n Column numbers are sometimes incorrect in the AST and the column\n override can be used to work around that.\n '
if (self.override_column < 0):
return column
else:
... | Apply column override if defined; otherwise return column.
Column numbers are sometimes incorrect in the AST and the column
override can be used to work around that. | mypy/fastparse.py | convert_column | c-bata/mypy | 35 | python | def convert_column(self, column: int) -> int:
'Apply column override if defined; otherwise return column.\n\n Column numbers are sometimes incorrect in the AST and the column\n override can be used to work around that.\n '
if (self.override_column < 0):
return column
else:
... | def convert_column(self, column: int) -> int:
'Apply column override if defined; otherwise return column.\n\n Column numbers are sometimes incorrect in the AST and the column\n override can be used to work around that.\n '
if (self.override_column < 0):
return column
else:
... |
5d7958ca0072cc905d6e75a17a88b2e593aad2b95ab570f27968dffc065f784c | def invalid_type(self, node: AST, note: Optional[str]=None) -> RawExpressionType:
'Constructs a type representing some expression that normally forms an invalid type.\n For example, if we see a type hint that says "3 + 4", we would transform that\n expression into a RawExpressionType.\n\n The s... | Constructs a type representing some expression that normally forms an invalid type.
For example, if we see a type hint that says "3 + 4", we would transform that
expression into a RawExpressionType.
The semantic analysis layer will report an "Invalid type" error when it
encounters this type, along with the given note ... | mypy/fastparse.py | invalid_type | c-bata/mypy | 35 | python | def invalid_type(self, node: AST, note: Optional[str]=None) -> RawExpressionType:
'Constructs a type representing some expression that normally forms an invalid type.\n For example, if we see a type hint that says "3 + 4", we would transform that\n expression into a RawExpressionType.\n\n The s... | def invalid_type(self, node: AST, note: Optional[str]=None) -> RawExpressionType:
'Constructs a type representing some expression that normally forms an invalid type.\n For example, if we see a type hint that says "3 + 4", we would transform that\n expression into a RawExpressionType.\n\n The s... |
19a7a8d9a4062217fbbe7d988bc9e8dbde2e3915197dec3e8326e6e65d3d6a9f | def visit(self, node: Optional[AST]) -> Optional[ProperType]:
'Modified visit -- keep track of the stack of nodes'
if (node is None):
return None
self.node_stack.append(node)
try:
method = ('visit_' + node.__class__.__name__)
visitor = getattr(self, method, None)
if (visi... | Modified visit -- keep track of the stack of nodes | mypy/fastparse.py | visit | c-bata/mypy | 35 | python | def visit(self, node: Optional[AST]) -> Optional[ProperType]:
if (node is None):
return None
self.node_stack.append(node)
try:
method = ('visit_' + node.__class__.__name__)
visitor = getattr(self, method, None)
if (visitor is not None):
return visitor(node)
... | def visit(self, node: Optional[AST]) -> Optional[ProperType]:
if (node is None):
return None
self.node_stack.append(node)
try:
method = ('visit_' + node.__class__.__name__)
visitor = getattr(self, method, None)
if (visitor is not None):
return visitor(node)
... |
b5cc679855c44b86200bcf66bd0cc8a60f193340fae5ec8603670d5be0187b6c | def parent(self) -> Optional[AST]:
'Return the AST node above the one we are processing'
if (len(self.node_stack) < 2):
return None
return self.node_stack[(- 2)] | Return the AST node above the one we are processing | mypy/fastparse.py | parent | c-bata/mypy | 35 | python | def parent(self) -> Optional[AST]:
if (len(self.node_stack) < 2):
return None
return self.node_stack[(- 2)] | def parent(self) -> Optional[AST]:
if (len(self.node_stack) < 2):
return None
return self.node_stack[(- 2)]<|docstring|>Return the AST node above the one we are processing<|endoftext|> |
31093468f69b5b85be351efab3ae775a5c221ff635e01833b7f4a04b5551e265 | def create_handle(handle_url, handle_user, handle_pw, parsed_data):
" registered a handle-id for the url passed in as 'parsed_data "
payload = json.dumps([{'type': 'URL', 'parsed_data': '{}'.format(parsed_data)}])
headers = {'accept': 'application/json', 'content-type': 'application/json'}
auth = (handl... | registered a handle-id for the url passed in as 'parsed_data | handle/utils.py | create_handle | acdh-oeaw/acdh-django-handle | 0 | python | def create_handle(handle_url, handle_user, handle_pw, parsed_data):
" "
payload = json.dumps([{'type': 'URL', 'parsed_data': '{}'.format(parsed_data)}])
headers = {'accept': 'application/json', 'content-type': 'application/json'}
auth = (handle_user, handle_pw)
try:
response = requests.requ... | def create_handle(handle_url, handle_user, handle_pw, parsed_data):
" "
payload = json.dumps([{'type': 'URL', 'parsed_data': '{}'.format(parsed_data)}])
headers = {'accept': 'application/json', 'content-type': 'application/json'}
auth = (handle_user, handle_pw)
try:
response = requests.requ... |
6df979ad8e8f6b86dd7b26f9f4d69d58ef50f14f775d1b8d81c21febc95d8df8 | def __init__(self):
'\n Initialize your data structure here.\n '
self.root = TrieNode() | Initialize your data structure here. | py/208. Implement Trie (Prefix Tree).py | __init__ | longwangjhu/LeetCode | 3 | python | def __init__(self):
'\n \n '
self.root = TrieNode() | def __init__(self):
'\n \n '
self.root = TrieNode()<|docstring|>Initialize your data structure here.<|endoftext|> |
9baf0e91bd7a80059f4a1a4878d1236cf85e328d42c41b92bcc71898071330e7 | def insert(self, word: str) -> None:
'\n Inserts a word into the trie.\n '
curr = self.root
for char in word:
curr = curr.child[char]
curr.is_word = True | Inserts a word into the trie. | py/208. Implement Trie (Prefix Tree).py | insert | longwangjhu/LeetCode | 3 | python | def insert(self, word: str) -> None:
'\n \n '
curr = self.root
for char in word:
curr = curr.child[char]
curr.is_word = True | def insert(self, word: str) -> None:
'\n \n '
curr = self.root
for char in word:
curr = curr.child[char]
curr.is_word = True<|docstring|>Inserts a word into the trie.<|endoftext|> |
77e504931658a728cbfb61e913934576c7e0590425bada5377dfb059108bfe08 | def search(self, word: str) -> bool:
'\n Returns if the word is in the trie.\n '
curr = self.root
for char in word:
if (char not in curr.child):
return False
curr = curr.child[char]
return curr.is_word | Returns if the word is in the trie. | py/208. Implement Trie (Prefix Tree).py | search | longwangjhu/LeetCode | 3 | python | def search(self, word: str) -> bool:
'\n \n '
curr = self.root
for char in word:
if (char not in curr.child):
return False
curr = curr.child[char]
return curr.is_word | def search(self, word: str) -> bool:
'\n \n '
curr = self.root
for char in word:
if (char not in curr.child):
return False
curr = curr.child[char]
return curr.is_word<|docstring|>Returns if the word is in the trie.<|endoftext|> |
ef6d3fb29b2b79719d3fb6bd557300cb7d5e8a9524647937dab5b78fb058e50b | def startsWith(self, prefix: str) -> bool:
'\n Returns if there is any word in the trie that starts with the given prefix.\n '
curr = self.root
for char in prefix:
if (char not in curr.child):
return False
curr = curr.child[char]
return True | Returns if there is any word in the trie that starts with the given prefix. | py/208. Implement Trie (Prefix Tree).py | startsWith | longwangjhu/LeetCode | 3 | python | def startsWith(self, prefix: str) -> bool:
'\n \n '
curr = self.root
for char in prefix:
if (char not in curr.child):
return False
curr = curr.child[char]
return True | def startsWith(self, prefix: str) -> bool:
'\n \n '
curr = self.root
for char in prefix:
if (char not in curr.child):
return False
curr = curr.child[char]
return True<|docstring|>Returns if there is any word in the trie that starts with the given prefix.<|endoft... |
3eb0cc1cc838e21497b560d5680e6fb2ab1e166ecc50fb60b80ff8bdf38f26ac | def configure_alias(graph, ns, mappings):
'\n Register Alias endpoints for a resource object.\n\n '
convention = AliasConvention(graph)
convention.configure(ns, mappings) | Register Alias endpoints for a resource object. | microcosm_flask/conventions/alias.py | configure_alias | Sinon/microcosm-flask | 11 | python | def configure_alias(graph, ns, mappings):
'\n \n\n '
convention = AliasConvention(graph)
convention.configure(ns, mappings) | def configure_alias(graph, ns, mappings):
'\n \n\n '
convention = AliasConvention(graph)
convention.configure(ns, mappings)<|docstring|>Register Alias endpoints for a resource object.<|endoftext|> |
b5d3542e08b9f11d71fa242d10dfc5884d48c6ad59c4381b92ccd18028fd60a3 | def configure_alias(self, ns, definition):
"\n Register an alias endpoint which will redirect to a resource's retrieve endpoint.\n\n Note that the retrieve endpoint MUST be registered prior to the alias endpoint.\n\n The definition's func should be a retrieve function, which must:\n - ac... | Register an alias endpoint which will redirect to a resource's retrieve endpoint.
Note that the retrieve endpoint MUST be registered prior to the alias endpoint.
The definition's func should be a retrieve function, which must:
- accept kwargs for path data
- return a resource
:param ns: the namespace
:param definiti... | microcosm_flask/conventions/alias.py | configure_alias | Sinon/microcosm-flask | 11 | python | def configure_alias(self, ns, definition):
"\n Register an alias endpoint which will redirect to a resource's retrieve endpoint.\n\n Note that the retrieve endpoint MUST be registered prior to the alias endpoint.\n\n The definition's func should be a retrieve function, which must:\n - ac... | def configure_alias(self, ns, definition):
"\n Register an alias endpoint which will redirect to a resource's retrieve endpoint.\n\n Note that the retrieve endpoint MUST be registered prior to the alias endpoint.\n\n The definition's func should be a retrieve function, which must:\n - ac... |
b8ebf77866a82bcd7dbc6c73f736977666b7f4fe52cce443fa0786db0782da14 | def check(self):
'\n 检测是否存在漏洞\n\n :param:\n\n :return bool True or False: 是否存在漏洞\n '
if ((not self.url.startswith('http')) and (not self.url.startswith('https'))):
self.url = ('http://' + self.url)
flag_list = ['src="navigation.php', 'frameborder="0" id="frame_content"', ... | 检测是否存在漏洞
:param:
:return bool True or False: 是否存在漏洞 | python/app/plugins/http/Phpmyadmin/Phpmyadmin_Weakpwd.py | check | taomujian/linbing | 351 | python | def check(self):
'\n 检测是否存在漏洞\n\n :param:\n\n :return bool True or False: 是否存在漏洞\n '
if ((not self.url.startswith('http')) and (not self.url.startswith('https'))):
self.url = ('http://' + self.url)
flag_list = ['src="navigation.php', 'frameborder="0" id="frame_content"', ... | def check(self):
'\n 检测是否存在漏洞\n\n :param:\n\n :return bool True or False: 是否存在漏洞\n '
if ((not self.url.startswith('http')) and (not self.url.startswith('https'))):
self.url = ('http://' + self.url)
flag_list = ['src="navigation.php', 'frameborder="0" id="frame_content"', ... |
f481209929ecc8f330731f55894cc8029b93cdbe51a158919990ee2f91a4a5ce | def retrieve_data(symbol, comparison_symbol='USD', limit=1, aggregate=1, allData='true'):
"Note that raw dataframe includes empty data rows for periods where the token didn't exist. Not an issue for graphing trailing 3-months, but will skew metric calculations for full period."
url = f'https://min-api.cryptocom... | Note that raw dataframe includes empty data rows for periods where the token didn't exist. Not an issue for graphing trailing 3-months, but will skew metric calculations for full period. | src/graph_crypto.py | retrieve_data | smfxfc/smfxfc.github.io | 1 | python | def retrieve_data(symbol, comparison_symbol='USD', limit=1, aggregate=1, allData='true'):
url = f'https://min-api.cryptocompare.com/data/histoday?fsym={symbol}&tsym={comparison_symbol}&limit={limit}&aggregate={aggregate}&allData={allData}&tryconversion=true'
page = requests.get(url)
data = page.json()[... | def retrieve_data(symbol, comparison_symbol='USD', limit=1, aggregate=1, allData='true'):
url = f'https://min-api.cryptocompare.com/data/histoday?fsym={symbol}&tsym={comparison_symbol}&limit={limit}&aggregate={aggregate}&allData={allData}&tryconversion=true'
page = requests.get(url)
data = page.json()[... |
88505b909c1e3ff9579dac3f03ca7f2a5b98eec9db3f182dad62f434e74a83b9 | def format_data(df):
'\n Strip dataframe to required columns and format times from unix to m/d/Y.\n '
df['time'] = [datetime.fromtimestamp(d) for d in df.time]
df['time'] = (df['time'] + pd.Timedelta(hours=0))
df['time'] = pd.to_datetime(df.time)
df['time'] = df['time'].dt.strftime('%m/%d/%Y')... | Strip dataframe to required columns and format times from unix to m/d/Y. | src/graph_crypto.py | format_data | smfxfc/smfxfc.github.io | 1 | python | def format_data(df):
'\n \n '
df['time'] = [datetime.fromtimestamp(d) for d in df.time]
df['time'] = (df['time'] + pd.Timedelta(hours=0))
df['time'] = pd.to_datetime(df.time)
df['time'] = df['time'].dt.strftime('%m/%d/%Y')
return df | def format_data(df):
'\n \n '
df['time'] = [datetime.fromtimestamp(d) for d in df.time]
df['time'] = (df['time'] + pd.Timedelta(hours=0))
df['time'] = pd.to_datetime(df.time)
df['time'] = df['time'].dt.strftime('%m/%d/%Y')
return df<|docstring|>Strip dataframe to required columns and forma... |
96849bd2e79c3c0d71e3eb286f15f71e72bc6c0e5b16718cc86de6518477d400 | def chart(df):
'Create combined line+bar chart from dataframe.'
SYM = df.name
if (SYM == 'NANO'):
SYM = 'XNO'
df = df.tail(93)
fig = make_subplots(specs=[[{'secondary_y': True}]])
fig.add_trace(go.Scatter(x=df['time'], y=df['close'], line=dict(color='blue', width=5), marker_color='blue',... | Create combined line+bar chart from dataframe. | src/graph_crypto.py | chart | smfxfc/smfxfc.github.io | 1 | python | def chart(df):
SYM = df.name
if (SYM == 'NANO'):
SYM = 'XNO'
df = df.tail(93)
fig = make_subplots(specs=[[{'secondary_y': True}]])
fig.add_trace(go.Scatter(x=df['time'], y=df['close'], line=dict(color='blue', width=5), marker_color='blue', name=f"{SYM} 'Closing Price'", opacity=1, showl... | def chart(df):
SYM = df.name
if (SYM == 'NANO'):
SYM = 'XNO'
df = df.tail(93)
fig = make_subplots(specs=[[{'secondary_y': True}]])
fig.add_trace(go.Scatter(x=df['time'], y=df['close'], line=dict(color='blue', width=5), marker_color='blue', name=f"{SYM} 'Closing Price'", opacity=1, showl... |
e6e46e1d286eac3a5d0f1da13f81c5a1f58641b8e0e2782e845cc446cd768c44 | def __init__(self, event_periods, debug):
'Setup the application'
self._events = []
self.should_bail = False
self.debug = debug
self.event_periods = event_periods | Setup the application | sensor_app/sensor_app_base.py | __init__ | dmkent/sensor-feed-esp8266 | 0 | python | def __init__(self, event_periods, debug):
self._events = []
self.should_bail = False
self.debug = debug
self.event_periods = event_periods | def __init__(self, event_periods, debug):
self._events = []
self.should_bail = False
self.debug = debug
self.event_periods = event_periods<|docstring|>Setup the application<|endoftext|> |
4029d3cae197847d8a97d8c2e09c22e28013f13ceef996784942eb792f352c64 | def log(self, current_time, message):
'Simple logging to stout.'
if self.debug:
print(self.localtime(current_time), message) | Simple logging to stout. | sensor_app/sensor_app_base.py | log | dmkent/sensor-feed-esp8266 | 0 | python | def log(self, current_time, message):
if self.debug:
print(self.localtime(current_time), message) | def log(self, current_time, message):
if self.debug:
print(self.localtime(current_time), message)<|docstring|>Simple logging to stout.<|endoftext|> |
f13cb6f84f362224bb0f62bac2bf555940df9da056f3fe8c78b8217bbb6142ee | def event_schedule_dtime(self, dtime, event):
'\n Add a new event to the queue to be triggered at specific date/time.\n \n Trigger date/time is specified in epoch seconds. i.e. response from\n ``utime.time()``.\n '
self._events.append((dtime, event)) | Add a new event to the queue to be triggered at specific date/time.
Trigger date/time is specified in epoch seconds. i.e. response from
``utime.time()``. | sensor_app/sensor_app_base.py | event_schedule_dtime | dmkent/sensor-feed-esp8266 | 0 | python | def event_schedule_dtime(self, dtime, event):
'\n Add a new event to the queue to be triggered at specific date/time.\n \n Trigger date/time is specified in epoch seconds. i.e. response from\n ``utime.time()``.\n '
self._events.append((dtime, event)) | def event_schedule_dtime(self, dtime, event):
'\n Add a new event to the queue to be triggered at specific date/time.\n \n Trigger date/time is specified in epoch seconds. i.e. response from\n ``utime.time()``.\n '
self._events.append((dtime, event))<|docstring|>Ad... |
db4c889c1550713cf3dc9bb94664f203b9e7b7834d10905e592a8f652ac061af | def event_schedule_offset(self, offset_secs, event):
'\n Add a new event to the queue to be triggered ``offset_secs`` from current time.\n '
dtime_secs = (self.time() + offset_secs)
self._events.append((dtime_secs, event)) | Add a new event to the queue to be triggered ``offset_secs`` from current time. | sensor_app/sensor_app_base.py | event_schedule_offset | dmkent/sensor-feed-esp8266 | 0 | python | def event_schedule_offset(self, offset_secs, event):
'\n \n '
dtime_secs = (self.time() + offset_secs)
self._events.append((dtime_secs, event)) | def event_schedule_offset(self, offset_secs, event):
'\n \n '
dtime_secs = (self.time() + offset_secs)
self._events.append((dtime_secs, event))<|docstring|>Add a new event to the queue to be triggered ``offset_secs`` from current time.<|endoftext|> |
b279ac6dae23404e71bce117e04e5135e069c081353144fefa29a31391fbb646 | def event_period(self, value):
'Look-up period in event_periods, default if not found.'
return self.event_periods.get(value, self.DEFAULT_EVENT_PERIOD) | Look-up period in event_periods, default if not found. | sensor_app/sensor_app_base.py | event_period | dmkent/sensor-feed-esp8266 | 0 | python | def event_period(self, value):
return self.event_periods.get(value, self.DEFAULT_EVENT_PERIOD) | def event_period(self, value):
return self.event_periods.get(value, self.DEFAULT_EVENT_PERIOD)<|docstring|>Look-up period in event_periods, default if not found.<|endoftext|> |
bfc254b8b9b61335afe925519502a6b15bd9ecf10816551c97835e6f7863151d | def run(self):
'Main event loop. Will run loop until ``should_bail`` is True.'
self.should_bail = False
while (not self.should_bail):
self.loop() | Main event loop. Will run loop until ``should_bail`` is True. | sensor_app/sensor_app_base.py | run | dmkent/sensor-feed-esp8266 | 0 | python | def run(self):
self.should_bail = False
while (not self.should_bail):
self.loop() | def run(self):
self.should_bail = False
while (not self.should_bail):
self.loop()<|docstring|>Main event loop. Will run loop until ``should_bail`` is True.<|endoftext|> |
2d7cf1e774766324f86f8963a0b0bb5ac8d9481b2f482b59dab063e66586ce58 | def loop(self):
'The inner-event loop.'
self.pre_event_handler()
current_time = self.time()
triggered = []
for i in range(len(self._events)):
if (self._events[i][0] <= current_time):
self._events[i][1](current_time)
triggered.append(i)
for i in triggered[::(- 1)]:... | The inner-event loop. | sensor_app/sensor_app_base.py | loop | dmkent/sensor-feed-esp8266 | 0 | python | def loop(self):
self.pre_event_handler()
current_time = self.time()
triggered = []
for i in range(len(self._events)):
if (self._events[i][0] <= current_time):
self._events[i][1](current_time)
triggered.append(i)
for i in triggered[::(- 1)]:
del self._even... | def loop(self):
self.pre_event_handler()
current_time = self.time()
triggered = []
for i in range(len(self._events)):
if (self._events[i][0] <= current_time):
self._events[i][1](current_time)
triggered.append(i)
for i in triggered[::(- 1)]:
del self._even... |
53f9c191892d9c10065ea7fa821b7a474f3dfba460291a7b1b161279cb6622d5 | def time(self):
'Get current time.'
raise NotImplementedError | Get current time. | sensor_app/sensor_app_base.py | time | dmkent/sensor-feed-esp8266 | 0 | python | def time(self):
raise NotImplementedError | def time(self):
raise NotImplementedError<|docstring|>Get current time.<|endoftext|> |
b6272e503f9b696cc6c4597991f847e1da684794ad0c967e7b2e33cc384f2bcc | def sleep(self, seconds):
'Delay for seconds.'
raise NotImplementedError | Delay for seconds. | sensor_app/sensor_app_base.py | sleep | dmkent/sensor-feed-esp8266 | 0 | python | def sleep(self, seconds):
raise NotImplementedError | def sleep(self, seconds):
raise NotImplementedError<|docstring|>Delay for seconds.<|endoftext|> |
5819e66869493da5e59a53a006225070f041ea31f328b48b726a6aff757697fb | def localtime(self, timeval):
'Format timeval as localtime struct.'
raise NotImplementedError | Format timeval as localtime struct. | sensor_app/sensor_app_base.py | localtime | dmkent/sensor-feed-esp8266 | 0 | python | def localtime(self, timeval):
raise NotImplementedError | def localtime(self, timeval):
raise NotImplementedError<|docstring|>Format timeval as localtime struct.<|endoftext|> |
325beaa84de995e2ce8d9270bcfba5b536923d79046f75309ca4ba1a793a0cec | def init_events(self):
'Trigger initial events.'
pass | Trigger initial events. | sensor_app/sensor_app_base.py | init_events | dmkent/sensor-feed-esp8266 | 0 | python | def init_events(self):
pass | def init_events(self):
pass<|docstring|>Trigger initial events.<|endoftext|> |
044cacc0fe8e1a21d749333fc18bce82449cf0fde4505cfb427f2d465476230d | def pre_event_handler(self):
'Perform any housekeeping in event loop.'
pass | Perform any housekeeping in event loop. | sensor_app/sensor_app_base.py | pre_event_handler | dmkent/sensor-feed-esp8266 | 0 | python | def pre_event_handler(self):
pass | def pre_event_handler(self):
pass<|docstring|>Perform any housekeeping in event loop.<|endoftext|> |
f95cfc3e3c3660203068f01bb895dacbc4d2d6c5acd4d58b93e76b0668175dc8 | @property
def body(self) -> str:
'Github issue body.'
return self.issue.body | Github issue body. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | body | Nordix/pytooling | 0 | python | @property
def body(self) -> str:
return self.issue.body | @property
def body(self) -> str:
return self.issue.body<|docstring|>Github issue body.<|endoftext|> |
e015cac35e6cf6cf9df0b17a59d0268857a46d6e761ed3256b89059e6f92f67a | @property
def closing_tpl(self) -> str:
'String template for closing comment.'
return self.issues.closing_tpl | String template for closing comment. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | closing_tpl | Nordix/pytooling | 0 | python | @property
def closing_tpl(self) -> str:
return self.issues.closing_tpl | @property
def closing_tpl(self) -> str:
return self.issues.closing_tpl<|docstring|>String template for closing comment.<|endoftext|> |
6fea86e18bb7c4b5c7690be7d6cf8ef7681f53e2462bc59a741d635f28deda89 | @property
def dep(self) -> Optional[str]:
'Associated dependency id.'
return self.parsed.get('dep') | Associated dependency id. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | dep | Nordix/pytooling | 0 | python | @property
def dep(self) -> Optional[str]:
return self.parsed.get('dep') | @property
def dep(self) -> Optional[str]:
return self.parsed.get('dep')<|docstring|>Associated dependency id.<|endoftext|> |
0bf76ce1b34f613ed3fdcae436350658e5d943437622141cf4d85ad917ce8185 | @property
def number(self) -> int:
'Github issue number.'
return self.issue.number | Github issue number. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | number | Nordix/pytooling | 0 | python | @property
def number(self) -> int:
return self.issue.number | @property
def number(self) -> int:
return self.issue.number<|docstring|>Github issue number.<|endoftext|> |
1dd2bc8aae3ba193d685481b9f3d82f28572d1ff5d0200bce1785c2021c4cecc | @cached_property
def parsed(self) -> Dict[(str, str)]:
'Parsed element from issue title.'
parsed = self.title_re.search(self.title)
return (dict(dep=parsed.group(1), version=parsed.group(2)) if parsed else {}) | Parsed element from issue title. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | parsed | Nordix/pytooling | 0 | python | @cached_property
def parsed(self) -> Dict[(str, str)]:
parsed = self.title_re.search(self.title)
return (dict(dep=parsed.group(1), version=parsed.group(2)) if parsed else {}) | @cached_property
def parsed(self) -> Dict[(str, str)]:
parsed = self.title_re.search(self.title)
return (dict(dep=parsed.group(1), version=parsed.group(2)) if parsed else {})<|docstring|>Parsed element from issue title.<|endoftext|> |
1241f5d576fae88d2c089f36d67f5374711c3063048eba532bd62e89ce9df287 | @property
def repo_name(self) -> str:
'Github repo name.'
return self.issues.repo_name | Github repo name. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | repo_name | Nordix/pytooling | 0 | python | @property
def repo_name(self) -> str:
return self.issues.repo_name | @property
def repo_name(self) -> str:
return self.issues.repo_name<|docstring|>Github repo name.<|endoftext|> |
5a47988e9d305e5d7dde0dc0474f79e3b965f5b02443793ecaa5ac965bc637b2 | @property
def title(self) -> str:
'Github issue title.'
return self.issue.title | Github issue title. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | title | Nordix/pytooling | 0 | python | @property
def title(self) -> str:
return self.issue.title | @property
def title(self) -> str:
return self.issue.title<|docstring|>Github issue title.<|endoftext|> |
6a91eaf625d957b045bb5da903e5eb46a9ad59541ea45bf75c96b80caffa2c9b | @cached_property
def version(self) -> Optional[Union[(version.LegacyVersion, version.Version)]]:
'Version parsed from the title.'
return (version.parse(self.parsed['version']) if ('version' in self.parsed) else None) | Version parsed from the title. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | version | Nordix/pytooling | 0 | python | @cached_property
def version(self) -> Optional[Union[(version.LegacyVersion, version.Version)]]:
return (version.parse(self.parsed['version']) if ('version' in self.parsed) else None) | @cached_property
def version(self) -> Optional[Union[(version.LegacyVersion, version.Version)]]:
return (version.parse(self.parsed['version']) if ('version' in self.parsed) else None)<|docstring|>Version parsed from the title.<|endoftext|> |
c9b81dba9f9a169197db1c7d63f6a44ff440c2173cdc346b130f3cd3c474f43f | async def close(self) -> github.AGithubIssue:
'Close this issue.'
return (await self.issue.close()) | Close this issue. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | close | Nordix/pytooling | 0 | python | async def close(self) -> github.AGithubIssue:
return (await self.issue.close()) | async def close(self) -> github.AGithubIssue:
return (await self.issue.close())<|docstring|>Close this issue.<|endoftext|> |
5d5ee9ae0782358fc230f17f6f991582a3c42d7223b10e951003665694339238 | async def close_duplicate(self, old_issue: 'AGithubDependencyIssue') -> None:
'Close a duplicate issue of this one.'
(await old_issue.close()) | Close a duplicate issue of this one. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | close_duplicate | Nordix/pytooling | 0 | python | async def close_duplicate(self, old_issue: 'AGithubDependencyIssue') -> None:
(await old_issue.close()) | async def close_duplicate(self, old_issue: 'AGithubDependencyIssue') -> None:
(await old_issue.close())<|docstring|>Close a duplicate issue of this one.<|endoftext|> |
4d21cc712d52808957474c8a781467ac75fdfebd7533d5ef679b0f1407c29ade | async def close_old(self, old_issue: 'AGithubDependencyIssue', dep: 'abstract.ADependency') -> None:
'Close old associated issue.'
newer_release = (await dep.newer_release)
(await old_issue.comment(self.closing_tpl.format(newer_release=newer_release, newer_release_date=(await newer_release.date), full_name=... | Close old associated issue. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | close_old | Nordix/pytooling | 0 | python | async def close_old(self, old_issue: 'AGithubDependencyIssue', dep: 'abstract.ADependency') -> None:
newer_release = (await dep.newer_release)
(await old_issue.comment(self.closing_tpl.format(newer_release=newer_release, newer_release_date=(await newer_release.date), full_name=dep.repo.name, repo_location=... | async def close_old(self, old_issue: 'AGithubDependencyIssue', dep: 'abstract.ADependency') -> None:
newer_release = (await dep.newer_release)
(await old_issue.comment(self.closing_tpl.format(newer_release=newer_release, newer_release_date=(await newer_release.date), full_name=dep.repo.name, repo_location=... |
c53bd3e215211de825883c6435211d5e12d13d3f766ddc9ae17ea6b72eb02ede | async def comment(self, comment: str) -> Any:
'Comment on this issue.'
return (await self.issue.comment(comment)) | Comment on this issue. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | comment | Nordix/pytooling | 0 | python | async def comment(self, comment: str) -> Any:
return (await self.issue.comment(comment)) | async def comment(self, comment: str) -> Any:
return (await self.issue.comment(comment))<|docstring|>Comment on this issue.<|endoftext|> |
81f1e46ccb0bf7e107029aea7f3f9c360e7b265b933b63f5d38252dca5f352f7 | @async_property(cache=True)
async def dep_issues(self) -> Dict[(str, AGithubDependencyIssue)]:
'Dependency dictionary of current issues.'
issues: Dict[(str, AGithubDependencyIssue)] = {}
for issue in (await self.open_issues):
if (issue.dep in issues):
if (issue.version <= issues[issue.de... | Dependency dictionary of current issues. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | dep_issues | Nordix/pytooling | 0 | python | @async_property(cache=True)
async def dep_issues(self) -> Dict[(str, AGithubDependencyIssue)]:
issues: Dict[(str, AGithubDependencyIssue)] = {}
for issue in (await self.open_issues):
if (issue.dep in issues):
if (issue.version <= issues[issue.dep].version):
continue
... | @async_property(cache=True)
async def dep_issues(self) -> Dict[(str, AGithubDependencyIssue)]:
issues: Dict[(str, AGithubDependencyIssue)] = {}
for issue in (await self.open_issues):
if (issue.dep in issues):
if (issue.version <= issues[issue.dep].version):
continue
... |
79beaaef59534284540f65b694dfc18e1a6b8a0c34b091279c14fd9a8b548cb7 | @async_property
async def duplicate_issues(self) -> AsyncGenerator[(AGithubDependencyIssue, AGithubDependencyIssue)]:
'Iterate duplicate issues.'
dep_issues = (await self.dep_issues)
for issue in (await self.open_issues):
if (issue not in dep_issues.values()):
(yield issue) | Iterate duplicate issues. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | duplicate_issues | Nordix/pytooling | 0 | python | @async_property
async def duplicate_issues(self) -> AsyncGenerator[(AGithubDependencyIssue, AGithubDependencyIssue)]:
dep_issues = (await self.dep_issues)
for issue in (await self.open_issues):
if (issue not in dep_issues.values()):
(yield issue) | @async_property
async def duplicate_issues(self) -> AsyncGenerator[(AGithubDependencyIssue, AGithubDependencyIssue)]:
dep_issues = (await self.dep_issues)
for issue in (await self.open_issues):
if (issue not in dep_issues.values()):
(yield issue)<|docstring|>Iterate duplicate issues.<|e... |
200c4d2b6e51cd8c4860dc80974fa74658400c942bd882c71983f5762599c66f | @property
@abstracts.interfacemethod
def issue_class(self) -> Type[AGithubDependencyIssue]:
'Issue class.'
raise NotImplementedError | Issue class. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | issue_class | Nordix/pytooling | 0 | python | @property
@abstracts.interfacemethod
def issue_class(self) -> Type[AGithubDependencyIssue]:
raise NotImplementedError | @property
@abstracts.interfacemethod
def issue_class(self) -> Type[AGithubDependencyIssue]:
raise NotImplementedError<|docstring|>Issue class.<|endoftext|> |
79bf88988884d8d4d4ee864212225b725b4f797470f7b21e2e1ce9e05608e528 | @async_property(cache=True)
async def missing_labels(self) -> Tuple[(str, ...)]:
'Missing Github issue labels.'
found = []
async for label in self.repo.labels:
if (label.name in self.labels):
found.append(label.name)
if (len(found) == len(self.labels)):
break
retu... | Missing Github issue labels. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | missing_labels | Nordix/pytooling | 0 | python | @async_property(cache=True)
async def missing_labels(self) -> Tuple[(str, ...)]:
found = []
async for label in self.repo.labels:
if (label.name in self.labels):
found.append(label.name)
if (len(found) == len(self.labels)):
break
return tuple((label for label in s... | @async_property(cache=True)
async def missing_labels(self) -> Tuple[(str, ...)]:
found = []
async for label in self.repo.labels:
if (label.name in self.labels):
found.append(label.name)
if (len(found) == len(self.labels)):
break
return tuple((label for label in s... |
e29c38c17e426f35d420d3af3919a62a98bd946f83c2b88e65938584f8423cd6 | @async_property(cache=True)
async def open_issues(self) -> Tuple[(AGithubDependencyIssue, ...)]:
'All current open, matching issues.'
issues = []
async for issue in self:
issues.append(issue)
return tuple(issues) | All current open, matching issues. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | open_issues | Nordix/pytooling | 0 | python | @async_property(cache=True)
async def open_issues(self) -> Tuple[(AGithubDependencyIssue, ...)]:
issues = []
async for issue in self:
issues.append(issue)
return tuple(issues) | @async_property(cache=True)
async def open_issues(self) -> Tuple[(AGithubDependencyIssue, ...)]:
issues = []
async for issue in self:
issues.append(issue)
return tuple(issues)<|docstring|>All current open, matching issues.<|endoftext|> |
49ad16a22a86be02123cecac2233d2f0229d40a56ee5b758a9e76d118a4f1879 | @cached_property
def repo(self) -> github.AGithubRepo:
'Github repo.'
return self.github[self.repo_name] | Github repo. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | repo | Nordix/pytooling | 0 | python | @cached_property
def repo(self) -> github.AGithubRepo:
return self.github[self.repo_name] | @cached_property
def repo(self) -> github.AGithubRepo:
return self.github[self.repo_name]<|docstring|>Github repo.<|endoftext|> |
6fc372c268c88e3de994aa5b87a4d1cc9632536008623a0e9570e600ff18c643 | @cached_property
def title_re(self) -> Pattern[str]:
'Regex for matching/parsing issue titles.'
return re.compile(self.title_re_tpl.format(title_prefix=self.title_prefix)) | Regex for matching/parsing issue titles. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | title_re | Nordix/pytooling | 0 | python | @cached_property
def title_re(self) -> Pattern[str]:
return re.compile(self.title_re_tpl.format(title_prefix=self.title_prefix)) | @cached_property
def title_re(self) -> Pattern[str]:
return re.compile(self.title_re_tpl.format(title_prefix=self.title_prefix))<|docstring|>Regex for matching/parsing issue titles.<|endoftext|> |
392b833adafe67e947bed62c7e6bcf393e8f47f84bedb94351abe3601a0c0fac | @async_property(cache=True)
async def titles(self) -> Tuple[(str, ...)]:
'Tuple of current issue titles.'
return tuple((issue.title for issue in (await self.open_issues))) | Tuple of current issue titles. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | titles | Nordix/pytooling | 0 | python | @async_property(cache=True)
async def titles(self) -> Tuple[(str, ...)]:
return tuple((issue.title for issue in (await self.open_issues))) | @async_property(cache=True)
async def titles(self) -> Tuple[(str, ...)]:
return tuple((issue.title for issue in (await self.open_issues)))<|docstring|>Tuple of current issue titles.<|endoftext|> |
49fadf22a25b67c36b127cb50541f2ad7a1c6f62b406b7b410ae79f453e9f9b8 | async def create(self, dep: 'abstract.ADependency') -> AGithubDependencyIssue:
'Create an issue for a dependency.'
issue_title = (await self.issue_title(dep))
if (issue_title in (await self.titles)):
raise github.exceptions.IssueExists(issue_title)
return self.issue_class(self, (await self.repo.... | Create an issue for a dependency. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | create | Nordix/pytooling | 0 | python | async def create(self, dep: 'abstract.ADependency') -> AGithubDependencyIssue:
issue_title = (await self.issue_title(dep))
if (issue_title in (await self.titles)):
raise github.exceptions.IssueExists(issue_title)
return self.issue_class(self, (await self.repo.issues.create(issue_title, body=(aw... | async def create(self, dep: 'abstract.ADependency') -> AGithubDependencyIssue:
issue_title = (await self.issue_title(dep))
if (issue_title in (await self.titles)):
raise github.exceptions.IssueExists(issue_title)
return self.issue_class(self, (await self.repo.issues.create(issue_title, body=(aw... |
27a74b1d13204534377bd56cacbd15625a901e99ec4070d9e0ee845fdf4b4094 | async def issue_body(self, dep: 'abstract.ADependency') -> str:
'Issue body for a dependency.'
newer_release = (await dep.newer_release)
return self.body_tpl.format(dep=dep, newer_release=newer_release, newer_release_date=(await newer_release.date), release_date=(await dep.release.date)) | Issue body for a dependency. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | issue_body | Nordix/pytooling | 0 | python | async def issue_body(self, dep: 'abstract.ADependency') -> str:
newer_release = (await dep.newer_release)
return self.body_tpl.format(dep=dep, newer_release=newer_release, newer_release_date=(await newer_release.date), release_date=(await dep.release.date)) | async def issue_body(self, dep: 'abstract.ADependency') -> str:
newer_release = (await dep.newer_release)
return self.body_tpl.format(dep=dep, newer_release=newer_release, newer_release_date=(await newer_release.date), release_date=(await dep.release.date))<|docstring|>Issue body for a dependency.<|endofte... |
0db6f044d64e272ee57a32ffaf653222d46418d75f052f2fa265d676eb6319cd | async def issue_title(self, dep: 'abstract.ADependency') -> str:
'Issue title for a dependency.'
return self.title_tpl.format(dep=dep, title_prefix=self.title_prefix, newer_release=(await dep.newer_release)) | Issue title for a dependency. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | issue_title | Nordix/pytooling | 0 | python | async def issue_title(self, dep: 'abstract.ADependency') -> str:
return self.title_tpl.format(dep=dep, title_prefix=self.title_prefix, newer_release=(await dep.newer_release)) | async def issue_title(self, dep: 'abstract.ADependency') -> str:
return self.title_tpl.format(dep=dep, title_prefix=self.title_prefix, newer_release=(await dep.newer_release))<|docstring|>Issue title for a dependency.<|endoftext|> |
6b44967e1044bcf990bad421b8939419f20066b0f16020a1880635db8f8c1367 | def iter_issues(self) -> github.AGithubIterator:
'Issues search iterator.'
return self.repo.issues.search(self.issues_search_tpl.format(self=self)) | Issues search iterator. | envoy.dependency.check/envoy/dependency/check/abstract/issues.py | iter_issues | Nordix/pytooling | 0 | python | def iter_issues(self) -> github.AGithubIterator:
return self.repo.issues.search(self.issues_search_tpl.format(self=self)) | def iter_issues(self) -> github.AGithubIterator:
return self.repo.issues.search(self.issues_search_tpl.format(self=self))<|docstring|>Issues search iterator.<|endoftext|> |
33f939d4f2065f3bc8d3441d332a4600b1c18a581d6ddf4719e43af8570a2d95 | @staticmethod
def make_connection():
'\n DBMS тэй холболт үүсгэх\n :return:\n '
if (DatabaseWorker.isConnected is False):
if (Settings.get_db_engine() == 'mongodb'):
DatabaseWorker.db = MongoClient(Settings.get_db_host(), Settings.get_db_port())[Settings.get_db_name()]
... | DBMS тэй холболт үүсгэх
:return: | AIbase/utilities/databaseWorker.py | make_connection | lupino22/GHTWXADWA | 4 | python | @staticmethod
def make_connection():
'\n DBMS тэй холболт үүсгэх\n :return:\n '
if (DatabaseWorker.isConnected is False):
if (Settings.get_db_engine() == 'mongodb'):
DatabaseWorker.db = MongoClient(Settings.get_db_host(), Settings.get_db_port())[Settings.get_db_name()]
... | @staticmethod
def make_connection():
'\n DBMS тэй холболт үүсгэх\n :return:\n '
if (DatabaseWorker.isConnected is False):
if (Settings.get_db_engine() == 'mongodb'):
DatabaseWorker.db = MongoClient(Settings.get_db_host(), Settings.get_db_port())[Settings.get_db_name()]
... |
7045df4e5d64dadaf17a3c41ed01cd48343a9d72116df4bb43ccabd456bf4178 | @staticmethod
def select_all(table_name, row_id, type):
'\n Өгөгдлийн сангийн нэгжээс бүх өгөгдлийг дуудах\n :param table_name: Нэгжийн нэр\n :param type: Q/A Асуулт эсвэл Хариулт унших\n :return: list утга буцаана\n '
DatabaseWorker.make_connection()
data = []
for row... | Өгөгдлийн сангийн нэгжээс бүх өгөгдлийг дуудах
:param table_name: Нэгжийн нэр
:param type: Q/A Асуулт эсвэл Хариулт унших
:return: list утга буцаана | AIbase/utilities/databaseWorker.py | select_all | lupino22/GHTWXADWA | 4 | python | @staticmethod
def select_all(table_name, row_id, type):
'\n Өгөгдлийн сангийн нэгжээс бүх өгөгдлийг дуудах\n :param table_name: Нэгжийн нэр\n :param type: Q/A Асуулт эсвэл Хариулт унших\n :return: list утга буцаана\n '
DatabaseWorker.make_connection()
data = []
for row... | @staticmethod
def select_all(table_name, row_id, type):
'\n Өгөгдлийн сангийн нэгжээс бүх өгөгдлийг дуудах\n :param table_name: Нэгжийн нэр\n :param type: Q/A Асуулт эсвэл Хариулт унших\n :return: list утга буцаана\n '
DatabaseWorker.make_connection()
data = []
for row... |
3e3957b26519e52717921fcf9e9451758eb4f90711bd87fa1c4c341269bdb0b3 | def latticeDistribution(leftLimit, rightLimit, topLimit, bottomLimit, spacing):
'\n Obtains the two dimensional computational domain limits: \n left, right, top, bottom\n and fill the computational domain with particles equispaced in\n the two dimensions.\n '
(x, y) = mgrid[(leftLimit:rightLi... | Obtains the two dimensional computational domain limits:
left, right, top, bottom
and fill the computational domain with particles equispaced in
the two dimensions. | Test/particleDistribution.py | latticeDistribution | gforsyth/pyfmm | 11 | python | def latticeDistribution(leftLimit, rightLimit, topLimit, bottomLimit, spacing):
'\n Obtains the two dimensional computational domain limits: \n left, right, top, bottom\n and fill the computational domain with particles equispaced in\n the two dimensions.\n '
(x, y) = mgrid[(leftLimit:rightLi... | def latticeDistribution(leftLimit, rightLimit, topLimit, bottomLimit, spacing):
'\n Obtains the two dimensional computational domain limits: \n left, right, top, bottom\n and fill the computational domain with particles equispaced in\n the two dimensions.\n '
(x, y) = mgrid[(leftLimit:rightLi... |
80342fe43857ede206c6a4d85975d02bccec475c128167324b4c7e024a482bf1 | def triangleDistribution(leftLimit, rightLimit, topLimit, bottomLimit, spacing):
'\n Obtains the two dimensional computational domain limits: \n left, right, top, bottom\n and fill the computational domain with particles equispaced in\n the two dimensions and then shift the even .\n '
halfSpa... | Obtains the two dimensional computational domain limits:
left, right, top, bottom
and fill the computational domain with particles equispaced in
the two dimensions and then shift the even . | Test/particleDistribution.py | triangleDistribution | gforsyth/pyfmm | 11 | python | def triangleDistribution(leftLimit, rightLimit, topLimit, bottomLimit, spacing):
'\n Obtains the two dimensional computational domain limits: \n left, right, top, bottom\n and fill the computational domain with particles equispaced in\n the two dimensions and then shift the even .\n '
halfSpa... | def triangleDistribution(leftLimit, rightLimit, topLimit, bottomLimit, spacing):
'\n Obtains the two dimensional computational domain limits: \n left, right, top, bottom\n and fill the computational domain with particles equispaced in\n the two dimensions and then shift the even .\n '
halfSpa... |
b52b9fb58dd6232a79b6b29b93c11d3eba10e13aedd7173cd262a84dc978b938 | def quasiRandomDistribution(leftLimit, rightLimit, topLimit, bottomLimit, spacing, noise):
'\n Obtains the two dimensional computational domain limits: \n left, right, top, bottom\n and fill the computational domain with particles quasi random equispaced in\n the two dimensions.\n '
(x, y) = ... | Obtains the two dimensional computational domain limits:
left, right, top, bottom
and fill the computational domain with particles quasi random equispaced in
the two dimensions. | Test/particleDistribution.py | quasiRandomDistribution | gforsyth/pyfmm | 11 | python | def quasiRandomDistribution(leftLimit, rightLimit, topLimit, bottomLimit, spacing, noise):
'\n Obtains the two dimensional computational domain limits: \n left, right, top, bottom\n and fill the computational domain with particles quasi random equispaced in\n the two dimensions.\n '
(x, y) = ... | def quasiRandomDistribution(leftLimit, rightLimit, topLimit, bottomLimit, spacing, noise):
'\n Obtains the two dimensional computational domain limits: \n left, right, top, bottom\n and fill the computational domain with particles quasi random equispaced in\n the two dimensions.\n '
(x, y) = ... |
18fc2657ee2af6e920feab86dd729edcf87fa534ae2b81b5ff2ecb24226bd414 | def forward(self, x, y):
'\n 순전파. 두 수의 곱을 출력하는데 역전파를 위해 x, y 값을 보관한다.\n :param x: 곱셈의 피연산자1 : float\n :param y: 곱셈의 피연산자2 : float\n :return: x*y : float\n '
self.x = x
self.y = y
out = (x * y)
return out | 순전파. 두 수의 곱을 출력하는데 역전파를 위해 x, y 값을 보관한다.
:param x: 곱셈의 피연산자1 : float
:param y: 곱셈의 피연산자2 : float
:return: x*y : float | DeepLearning/DeepLearning/09_Deep_SongJW/ch5/layers.py | forward | ghost9023/DeepLearningPythonStudy | 1 | python | def forward(self, x, y):
'\n 순전파. 두 수의 곱을 출력하는데 역전파를 위해 x, y 값을 보관한다.\n :param x: 곱셈의 피연산자1 : float\n :param y: 곱셈의 피연산자2 : float\n :return: x*y : float\n '
self.x = x
self.y = y
out = (x * y)
return out | def forward(self, x, y):
'\n 순전파. 두 수의 곱을 출력하는데 역전파를 위해 x, y 값을 보관한다.\n :param x: 곱셈의 피연산자1 : float\n :param y: 곱셈의 피연산자2 : float\n :return: x*y : float\n '
self.x = x
self.y = y
out = (x * y)
return out<|docstring|>순전파. 두 수의 곱을 출력하는데 역전파를 위해 x, y 값을 보관한다.
:param x... |
b3ca518719c8614eaada468c020f96913e58d5951e32497add30cc794238032e | def backward(self, dout):
'\n 역전파. x, y 에 대한 미분은 역전파된 미분값에 y, x 를 곱한 값이다.\n :param dout: 상류에서 역전파된 미분값 : float\n :return: dout/dx, dout/dy : float, float\n '
dx = (dout * self.y)
dy = (dout * self.x)
return (dx, dy) | 역전파. x, y 에 대한 미분은 역전파된 미분값에 y, x 를 곱한 값이다.
:param dout: 상류에서 역전파된 미분값 : float
:return: dout/dx, dout/dy : float, float | DeepLearning/DeepLearning/09_Deep_SongJW/ch5/layers.py | backward | ghost9023/DeepLearningPythonStudy | 1 | python | def backward(self, dout):
'\n 역전파. x, y 에 대한 미분은 역전파된 미분값에 y, x 를 곱한 값이다.\n :param dout: 상류에서 역전파된 미분값 : float\n :return: dout/dx, dout/dy : float, float\n '
dx = (dout * self.y)
dy = (dout * self.x)
return (dx, dy) | def backward(self, dout):
'\n 역전파. x, y 에 대한 미분은 역전파된 미분값에 y, x 를 곱한 값이다.\n :param dout: 상류에서 역전파된 미분값 : float\n :return: dout/dx, dout/dy : float, float\n '
dx = (dout * self.y)
dy = (dout * self.x)
return (dx, dy)<|docstring|>역전파. x, y 에 대한 미분은 역전파된 미분값에 y, x 를 곱한 값이다.
:par... |
6cf050a9eaa490c767a3f9db1d5b08436039204a726fff54fd09362ade0140ec | def forward(self, x):
'\n ReLU 함수 순전파.\n numpy 벡터 x 에서 0과 같거나 0보다 작은 요소를 0으로 바꿔서 출력. \n :param x: numpy vector\n :return: numpy vector\n '
self.mask = (x <= 0)
out = x.copy()
out[self.mask] = 0
return out | ReLU 함수 순전파.
numpy 벡터 x 에서 0과 같거나 0보다 작은 요소를 0으로 바꿔서 출력.
:param x: numpy vector
:return: numpy vector | DeepLearning/DeepLearning/09_Deep_SongJW/ch5/layers.py | forward | ghost9023/DeepLearningPythonStudy | 1 | python | def forward(self, x):
'\n ReLU 함수 순전파.\n numpy 벡터 x 에서 0과 같거나 0보다 작은 요소를 0으로 바꿔서 출력. \n :param x: numpy vector\n :return: numpy vector\n '
self.mask = (x <= 0)
out = x.copy()
out[self.mask] = 0
return out | def forward(self, x):
'\n ReLU 함수 순전파.\n numpy 벡터 x 에서 0과 같거나 0보다 작은 요소를 0으로 바꿔서 출력. \n :param x: numpy vector\n :return: numpy vector\n '
self.mask = (x <= 0)
out = x.copy()
out[self.mask] = 0
return out<|docstring|>ReLU 함수 순전파.
numpy 벡터 x 에서 0과 같거나 0보다 작은 요소를 0으로... |
1d2cf4addabed3f844604050f829485256ef3cc76fd30e9a65ef25f7a0d3ee2c | def __init__(self, W, b):
'\n 입력에 가중치를 곱하고 편향을 더하는 affine 변환 전체를 정의한 클래스이므로\n 가중치 W, 편향 b 를 포함하고, 이 값들을 갱신하기 위해 dW, db 값을 갖는다.\n 미분값을 역전파하기위해서 입력 x 를 보관한다.\n :param W: numpy matrix : 가중치\n :param b: numpy array : 편향\n '
self.W = W
self.b = b
self.x = None
... | 입력에 가중치를 곱하고 편향을 더하는 affine 변환 전체를 정의한 클래스이므로
가중치 W, 편향 b 를 포함하고, 이 값들을 갱신하기 위해 dW, db 값을 갖는다.
미분값을 역전파하기위해서 입력 x 를 보관한다.
:param W: numpy matrix : 가중치
:param b: numpy array : 편향 | DeepLearning/DeepLearning/09_Deep_SongJW/ch5/layers.py | __init__ | ghost9023/DeepLearningPythonStudy | 1 | python | def __init__(self, W, b):
'\n 입력에 가중치를 곱하고 편향을 더하는 affine 변환 전체를 정의한 클래스이므로\n 가중치 W, 편향 b 를 포함하고, 이 값들을 갱신하기 위해 dW, db 값을 갖는다.\n 미분값을 역전파하기위해서 입력 x 를 보관한다.\n :param W: numpy matrix : 가중치\n :param b: numpy array : 편향\n '
self.W = W
self.b = b
self.x = None
... | def __init__(self, W, b):
'\n 입력에 가중치를 곱하고 편향을 더하는 affine 변환 전체를 정의한 클래스이므로\n 가중치 W, 편향 b 를 포함하고, 이 값들을 갱신하기 위해 dW, db 값을 갖는다.\n 미분값을 역전파하기위해서 입력 x 를 보관한다.\n :param W: numpy matrix : 가중치\n :param b: numpy array : 편향\n '
self.W = W
self.b = b
self.x = None
... |
fedfbdc5d27014ff591bce0d15339571395870b1f3dd2581d58ae02f29fe9ed5 | def forward(self, x):
'\n 순전파\n :param x: numpy matrix : 입력\n :return: numpy matrix : 입력*가중치+편향\n '
self.x = x
out = (np.dot(x, self.W) + self.b)
return out | 순전파
:param x: numpy matrix : 입력
:return: numpy matrix : 입력*가중치+편향 | DeepLearning/DeepLearning/09_Deep_SongJW/ch5/layers.py | forward | ghost9023/DeepLearningPythonStudy | 1 | python | def forward(self, x):
'\n 순전파\n :param x: numpy matrix : 입력\n :return: numpy matrix : 입력*가중치+편향\n '
self.x = x
out = (np.dot(x, self.W) + self.b)
return out | def forward(self, x):
'\n 순전파\n :param x: numpy matrix : 입력\n :return: numpy matrix : 입력*가중치+편향\n '
self.x = x
out = (np.dot(x, self.W) + self.b)
return out<|docstring|>순전파
:param x: numpy matrix : 입력
:return: numpy matrix : 입력*가중치+편향<|endoftext|> |
1bdc12e6dc881f25af26dcd5f91eb5f7c9305f1986b31eb853fa527cfd14fc37 | def backward(self, dout):
'\n 역전파. x 에 대한 미분만 반환하고 W, b 에 대한 미분은 보관\n :param dout: ? :역전파받은 미분값\n :return: numpy matrix : x 에 대한 미분\n '
dx = np.dot(dout, self.W.T)
self.dW = np.dot(self.x.T, dout)
self.db = np.sum(dout, axis=0)
return dx | 역전파. x 에 대한 미분만 반환하고 W, b 에 대한 미분은 보관
:param dout: ? :역전파받은 미분값
:return: numpy matrix : x 에 대한 미분 | DeepLearning/DeepLearning/09_Deep_SongJW/ch5/layers.py | backward | ghost9023/DeepLearningPythonStudy | 1 | python | def backward(self, dout):
'\n 역전파. x 에 대한 미분만 반환하고 W, b 에 대한 미분은 보관\n :param dout: ? :역전파받은 미분값\n :return: numpy matrix : x 에 대한 미분\n '
dx = np.dot(dout, self.W.T)
self.dW = np.dot(self.x.T, dout)
self.db = np.sum(dout, axis=0)
return dx | def backward(self, dout):
'\n 역전파. x 에 대한 미분만 반환하고 W, b 에 대한 미분은 보관\n :param dout: ? :역전파받은 미분값\n :return: numpy matrix : x 에 대한 미분\n '
dx = np.dot(dout, self.W.T)
self.dW = np.dot(self.x.T, dout)
self.db = np.sum(dout, axis=0)
return dx<|docstring|>역전파. x 에 대한 미분만 반환하고 W... |
e6c04b0d6f22625f4283ef5663b34dfdb026193cdccfac5eced189e7aa010a27 | def forward(self, x, t):
'\n 순전파\n :param x: numpy matrix : 입력 \n :param t: numpy matrix : 레이블\n :return: float : loss\n '
self.t = t
self.y = softmax(x)
self.loss = cross_entropy_error(self.y, self.t)
return self.loss | 순전파
:param x: numpy matrix : 입력
:param t: numpy matrix : 레이블
:return: float : loss | DeepLearning/DeepLearning/09_Deep_SongJW/ch5/layers.py | forward | ghost9023/DeepLearningPythonStudy | 1 | python | def forward(self, x, t):
'\n 순전파\n :param x: numpy matrix : 입력 \n :param t: numpy matrix : 레이블\n :return: float : loss\n '
self.t = t
self.y = softmax(x)
self.loss = cross_entropy_error(self.y, self.t)
return self.loss | def forward(self, x, t):
'\n 순전파\n :param x: numpy matrix : 입력 \n :param t: numpy matrix : 레이블\n :return: float : loss\n '
self.t = t
self.y = softmax(x)
self.loss = cross_entropy_error(self.y, self.t)
return self.loss<|docstring|>순전파
:param x: numpy matrix : 입력
:... |
59fc29aa09efb0a55fcc74aa128a6bf65f09de3db7b85c950b6aa8f7a452f405 | def backward(self, dout=1):
'\n 역전파. 역전파시에는 미분값을 배치 크기로 나눠서 데이터 한개당 오차를 전달한다.\n :param dout: float : default 1\n :return: numpy matrix : 입력에 대한 미분 \n '
batch_size = self.t.shape[0]
dx = ((self.y - self.t) / batch_size)
return dx | 역전파. 역전파시에는 미분값을 배치 크기로 나눠서 데이터 한개당 오차를 전달한다.
:param dout: float : default 1
:return: numpy matrix : 입력에 대한 미분 | DeepLearning/DeepLearning/09_Deep_SongJW/ch5/layers.py | backward | ghost9023/DeepLearningPythonStudy | 1 | python | def backward(self, dout=1):
'\n 역전파. 역전파시에는 미분값을 배치 크기로 나눠서 데이터 한개당 오차를 전달한다.\n :param dout: float : default 1\n :return: numpy matrix : 입력에 대한 미분 \n '
batch_size = self.t.shape[0]
dx = ((self.y - self.t) / batch_size)
return dx | def backward(self, dout=1):
'\n 역전파. 역전파시에는 미분값을 배치 크기로 나눠서 데이터 한개당 오차를 전달한다.\n :param dout: float : default 1\n :return: numpy matrix : 입력에 대한 미분 \n '
batch_size = self.t.shape[0]
dx = ((self.y - self.t) / batch_size)
return dx<|docstring|>역전파. 역전파시에는 미분값을 배치 크기로 나눠서 데이터 한개당... |
d3574580299e38afdb8e5da3a9cf4f1312aa46f4ea6a8655ef4107863f6292ac | def extractDocument(self, filename):
'Check if filename is word or pdf '
filepath = ((MEDIA_ROOT + '/') + filename)
if filename.lower().endswith('.pdf'):
filereader = open(filepath, 'rb')
pdfReader = PdfFileReader(filereader)
pdftext = ''
for page in range(pdfReader.numPages)... | Check if filename is word or pdf | app/summerizer/service.py | extractDocument | Nwokolo2007/Deeplearning_Text_summerizer | 0 | python | def extractDocument(self, filename):
' '
filepath = ((MEDIA_ROOT + '/') + filename)
if filename.lower().endswith('.pdf'):
filereader = open(filepath, 'rb')
pdfReader = PdfFileReader(filereader)
pdftext =
for page in range(pdfReader.numPages):
pageObj = pdfReader.... | def extractDocument(self, filename):
' '
filepath = ((MEDIA_ROOT + '/') + filename)
if filename.lower().endswith('.pdf'):
filereader = open(filepath, 'rb')
pdfReader = PdfFileReader(filereader)
pdftext =
for page in range(pdfReader.numPages):
pageObj = pdfReader.... |
5238fb6bc5a290b33b2b6b6c26f230545c493db3591e1c0667b9d4e5f9b24d30 | @app.task()
def clear_es_index(projects):
'Clearing ES indexes for removed projects.'
projects_str = ', '.join([str(p) for p in projects])
log.info('Clearing indexes for removed projects: %s', projects_str)
e_s = Elasticsearch(settings.ES_HOSTS)
for p_id in projects:
try:
e_s.del... | Clearing ES indexes for removed projects. | readthedocs/docsitalia/tasks.py | clear_es_index | italia/readthedocs.org | 19 | python | @app.task()
def clear_es_index(projects):
projects_str = ', '.join([str(p) for p in projects])
log.info('Clearing indexes for removed projects: %s', projects_str)
e_s = Elasticsearch(settings.ES_HOSTS)
for p_id in projects:
try:
e_s.delete(index='readthedocs', doc_type='project'... | @app.task()
def clear_es_index(projects):
projects_str = ', '.join([str(p) for p in projects])
log.info('Clearing indexes for removed projects: %s', projects_str)
e_s = Elasticsearch(settings.ES_HOSTS)
for p_id in projects:
try:
e_s.delete(index='readthedocs', doc_type='project'... |
82ffd5b80f2a4c2e53c4b166e9f08cd47d0a804ec037779d8f6d6b8eb4a680ad | @classmethod
def guiStart(self, parent=None):
'Graphical interface for starting this class'
args = _DisplayStart().startDisplay()
args['parent'] = parent
return (self(**args), True) | Graphical interface for starting this class | artview/components/plot_radar.py | guiStart | jjhelmus/artview | 0 | python | @classmethod
def guiStart(self, parent=None):
args = _DisplayStart().startDisplay()
args['parent'] = parent
return (self(**args), True) | @classmethod
def guiStart(self, parent=None):
args = _DisplayStart().startDisplay()
args['parent'] = parent
return (self(**args), True)<|docstring|>Graphical interface for starting this class<|endoftext|> |
53b625efd9acdda41719f0bfcc8c89206dfb1975ebba599b9ae1fe0428a6dff6 | def __init__(self, Vradar=None, Vfield=None, Vtilt=None, Vlims=None, Vcmap=None, Vgatefilter=None, name='RadarDisplay', parent=None):
'\n Initialize the class to create display.\n\n Parameters\n ----------\n [Optional]\n Vradar : :py:class:`~artview.core.core.Variable` instance\n ... | Initialize the class to create display.
Parameters
----------
[Optional]
Vradar : :py:class:`~artview.core.core.Variable` instance
Radar signal variable. If None start new one with None.
Vfield : :py:class:`~artview.core.core.Variable` instance
Field signal variable. If None start new one with empty string.
Vt... | artview/components/plot_radar.py | __init__ | jjhelmus/artview | 0 | python | def __init__(self, Vradar=None, Vfield=None, Vtilt=None, Vlims=None, Vcmap=None, Vgatefilter=None, name='RadarDisplay', parent=None):
'\n Initialize the class to create display.\n\n Parameters\n ----------\n [Optional]\n Vradar : :py:class:`~artview.core.core.Variable` instance\n ... | def __init__(self, Vradar=None, Vfield=None, Vtilt=None, Vlims=None, Vcmap=None, Vgatefilter=None, name='RadarDisplay', parent=None):
'\n Initialize the class to create display.\n\n Parameters\n ----------\n [Optional]\n Vradar : :py:class:`~artview.core.core.Variable` instance\n ... |
ebba17331bf5728ac98776bc13450f619ba1a719f3083be9a3664a53fe1cc653 | def keyPressEvent(self, event):
'Allow tilt adjustment via the Up-Down arrow keys.'
if (event.key() == QtCore.Qt.Key_Up):
self.TiltSelectCmd((self.Vtilt.value + 1))
elif (event.key() == QtCore.Qt.Key_Down):
self.TiltSelectCmd((self.Vtilt.value - 1))
else:
super(RadarDisplay, self... | Allow tilt adjustment via the Up-Down arrow keys. | artview/components/plot_radar.py | keyPressEvent | jjhelmus/artview | 0 | python | def keyPressEvent(self, event):
if (event.key() == QtCore.Qt.Key_Up):
self.TiltSelectCmd((self.Vtilt.value + 1))
elif (event.key() == QtCore.Qt.Key_Down):
self.TiltSelectCmd((self.Vtilt.value - 1))
else:
super(RadarDisplay, self).keyPressEvent(event) | def keyPressEvent(self, event):
if (event.key() == QtCore.Qt.Key_Up):
self.TiltSelectCmd((self.Vtilt.value + 1))
elif (event.key() == QtCore.Qt.Key_Down):
self.TiltSelectCmd((self.Vtilt.value - 1))
else:
super(RadarDisplay, self).keyPressEvent(event)<|docstring|>Allow tilt adjus... |
1bf6e34f6140d893d36a8e97b1baf87ca8a683bab9254158edd32f0f1bb52137 | def LaunchGUI(self):
'Launches a GUI interface.'
self.layout = QtGui.QGridLayout()
self.layout.setSpacing(8)
self.central_widget = QtGui.QWidget()
self.setCentralWidget(self.central_widget)
self._set_figure_canvas()
self.central_widget.setLayout(self.layout)
self.addButtons()
self.se... | Launches a GUI interface. | artview/components/plot_radar.py | LaunchGUI | jjhelmus/artview | 0 | python | def LaunchGUI(self):
self.layout = QtGui.QGridLayout()
self.layout.setSpacing(8)
self.central_widget = QtGui.QWidget()
self.setCentralWidget(self.central_widget)
self._set_figure_canvas()
self.central_widget.setLayout(self.layout)
self.addButtons()
self.setUILayout()
self.status... | def LaunchGUI(self):
self.layout = QtGui.QGridLayout()
self.layout.setSpacing(8)
self.central_widget = QtGui.QWidget()
self.setCentralWidget(self.central_widget)
self._set_figure_canvas()
self.central_widget.setLayout(self.layout)
self.addButtons()
self.setUILayout()
self.status... |
9f99d92343eb7027563bc64013ecc53b43d6d36e5379dde8c71cfed0b04cdfdb | def addButtons(self):
'Add a series of buttons for user control over display.'
self._add_displayBoxUI()
self._add_tiltBoxUI()
self._add_fieldBoxUI()
self._add_toolsBoxUI()
self._add_infolabel() | Add a series of buttons for user control over display. | artview/components/plot_radar.py | addButtons | jjhelmus/artview | 0 | python | def addButtons(self):
self._add_displayBoxUI()
self._add_tiltBoxUI()
self._add_fieldBoxUI()
self._add_toolsBoxUI()
self._add_infolabel() | def addButtons(self):
self._add_displayBoxUI()
self._add_tiltBoxUI()
self._add_fieldBoxUI()
self._add_toolsBoxUI()
self._add_infolabel()<|docstring|>Add a series of buttons for user control over display.<|endoftext|> |
ae0b71aeef56fcf8d9ad6133b2229677471551a6e4c86f915b773a859acb0b7c | def setUILayout(self):
'Setup the button/display UI layout.'
self.layout.addWidget(self.tiltBox, 0, 0)
self.layout.addWidget(self.fieldBox, 0, 1)
self.layout.addWidget(self.dispButton, 0, 2)
self.layout.addWidget(self.toolsButton, 0, 3)
self.layout.addWidget(self.infolabel, 0, 4) | Setup the button/display UI layout. | artview/components/plot_radar.py | setUILayout | jjhelmus/artview | 0 | python | def setUILayout(self):
self.layout.addWidget(self.tiltBox, 0, 0)
self.layout.addWidget(self.fieldBox, 0, 1)
self.layout.addWidget(self.dispButton, 0, 2)
self.layout.addWidget(self.toolsButton, 0, 3)
self.layout.addWidget(self.infolabel, 0, 4) | def setUILayout(self):
self.layout.addWidget(self.tiltBox, 0, 0)
self.layout.addWidget(self.fieldBox, 0, 1)
self.layout.addWidget(self.dispButton, 0, 2)
self.layout.addWidget(self.toolsButton, 0, 3)
self.layout.addWidget(self.infolabel, 0, 4)<|docstring|>Setup the button/display UI layout.<|end... |
33411188c704a6e231632bd278b6642ead0f736c5e996b14deac14780b49061f | def _open_LimsDialog(self):
'Open a dialog box to change display limits.'
from .limits import limits_dialog
(limits, cmap, change) = limits_dialog(self.Vlims.value, self.Vcmap.value, self.name)
if (change == 1):
self.Vcmap.change(cmap)
self.Vlims.change(limits) | Open a dialog box to change display limits. | artview/components/plot_radar.py | _open_LimsDialog | jjhelmus/artview | 0 | python | def _open_LimsDialog(self):
from .limits import limits_dialog
(limits, cmap, change) = limits_dialog(self.Vlims.value, self.Vcmap.value, self.name)
if (change == 1):
self.Vcmap.change(cmap)
self.Vlims.change(limits) | def _open_LimsDialog(self):
from .limits import limits_dialog
(limits, cmap, change) = limits_dialog(self.Vlims.value, self.Vcmap.value, self.name)
if (change == 1):
self.Vcmap.change(cmap)
self.Vlims.change(limits)<|docstring|>Open a dialog box to change display limits.<|endoftext|> |
18ec5120dfd243e2d28895ef08d3fd95ad1091f5b40351300b5cfccfe6d6e4bc | def _fillTiltBox(self):
'Fill in the Tilt Window Box with current elevation angles.'
self.tiltBox.clear()
self.tiltBox.addItem('Tilt Window')
elevs = self.Vradar.value.fixed_angle['data'][:]
for (i, ntilt) in enumerate(self.rTilts):
btntxt = ('%2.1f deg (Tilt %d)' % (elevs[i], (i + 1)))
... | Fill in the Tilt Window Box with current elevation angles. | artview/components/plot_radar.py | _fillTiltBox | jjhelmus/artview | 0 | python | def _fillTiltBox(self):
self.tiltBox.clear()
self.tiltBox.addItem('Tilt Window')
elevs = self.Vradar.value.fixed_angle['data'][:]
for (i, ntilt) in enumerate(self.rTilts):
btntxt = ('%2.1f deg (Tilt %d)' % (elevs[i], (i + 1)))
self.tiltBox.addItem(btntxt) | def _fillTiltBox(self):
self.tiltBox.clear()
self.tiltBox.addItem('Tilt Window')
elevs = self.Vradar.value.fixed_angle['data'][:]
for (i, ntilt) in enumerate(self.rTilts):
btntxt = ('%2.1f deg (Tilt %d)' % (elevs[i], (i + 1)))
self.tiltBox.addItem(btntxt)<|docstring|>Fill in the Til... |
50f87ff31365660f65fa65cfd878d03001ed9ca85785743b2a083de1c42efaa0 | def _fillFieldBox(self):
'Fill in the Field Window Box with current variable names.'
self.fieldBox.clear()
self.fieldBox.addItem('Field Window')
for field in self.fieldnames:
self.fieldBox.addItem(field) | Fill in the Field Window Box with current variable names. | artview/components/plot_radar.py | _fillFieldBox | jjhelmus/artview | 0 | python | def _fillFieldBox(self):
self.fieldBox.clear()
self.fieldBox.addItem('Field Window')
for field in self.fieldnames:
self.fieldBox.addItem(field) | def _fillFieldBox(self):
self.fieldBox.clear()
self.fieldBox.addItem('Field Window')
for field in self.fieldnames:
self.fieldBox.addItem(field)<|docstring|>Fill in the Field Window Box with current variable names.<|endoftext|> |
13ecfde5a0611682b92004c7b638bbd674bdb41e30ef405a486e41c3541a520b | def _tiltAction(self, text):
'Define action for Tilt Button selection.'
if (text == 'Tilt Window'):
self._open_tiltbuttonwindow()
else:
ntilt = (int(text.split('(Tilt ')[1][:(- 1)]) - 1)
self.TiltSelectCmd(ntilt) | Define action for Tilt Button selection. | artview/components/plot_radar.py | _tiltAction | jjhelmus/artview | 0 | python | def _tiltAction(self, text):
if (text == 'Tilt Window'):
self._open_tiltbuttonwindow()
else:
ntilt = (int(text.split('(Tilt ')[1][:(- 1)]) - 1)
self.TiltSelectCmd(ntilt) | def _tiltAction(self, text):
if (text == 'Tilt Window'):
self._open_tiltbuttonwindow()
else:
ntilt = (int(text.split('(Tilt ')[1][:(- 1)]) - 1)
self.TiltSelectCmd(ntilt)<|docstring|>Define action for Tilt Button selection.<|endoftext|> |
7ee7c9798b3b3f9206d3ac827414ac442c14ca0b68df2725595d1fb50238da12 | def _fieldAction(self, text):
'Define action for Field Button selection.'
if (text == 'Field Window'):
self._open_fieldbuttonwindow()
else:
self.FieldSelectCmd(str(text)) | Define action for Field Button selection. | artview/components/plot_radar.py | _fieldAction | jjhelmus/artview | 0 | python | def _fieldAction(self, text):
if (text == 'Field Window'):
self._open_fieldbuttonwindow()
else:
self.FieldSelectCmd(str(text)) | def _fieldAction(self, text):
if (text == 'Field Window'):
self._open_fieldbuttonwindow()
else:
self.FieldSelectCmd(str(text))<|docstring|>Define action for Field Button selection.<|endoftext|> |
fbefdd69e2cf345647fab14cfd47ebb1635c30e2c4cd0177356e3b5a77467638 | def _GateFilterToggleAction(self):
'Define action for GateFilterToggle menu selection.'
if self.gatefilterToggle.isChecked():
self.gatefilterToggle.setText('GateFilter On')
else:
self.gatefilterToggle.setText('GateFilter Off')
self._update_plot() | Define action for GateFilterToggle menu selection. | artview/components/plot_radar.py | _GateFilterToggleAction | jjhelmus/artview | 0 | python | def _GateFilterToggleAction(self):
if self.gatefilterToggle.isChecked():
self.gatefilterToggle.setText('GateFilter On')
else:
self.gatefilterToggle.setText('GateFilter Off')
self._update_plot() | def _GateFilterToggleAction(self):
if self.gatefilterToggle.isChecked():
self.gatefilterToggle.setText('GateFilter On')
else:
self.gatefilterToggle.setText('GateFilter Off')
self._update_plot()<|docstring|>Define action for GateFilterToggle menu selection.<|endoftext|> |
a24d909691889823f693c801e4b8d75692c461027861dd92aa33592b743e1161 | def _title_input(self):
'Retrieve new plot title.'
(val, entry) = common.string_dialog_with_reset(self.title, 'Plot Title', 'Title:', self._get_default_title())
if (entry is True):
self.title = val
self._update_plot() | Retrieve new plot title. | artview/components/plot_radar.py | _title_input | jjhelmus/artview | 0 | python | def _title_input(self):
(val, entry) = common.string_dialog_with_reset(self.title, 'Plot Title', 'Title:', self._get_default_title())
if (entry is True):
self.title = val
self._update_plot() | def _title_input(self):
(val, entry) = common.string_dialog_with_reset(self.title, 'Plot Title', 'Title:', self._get_default_title())
if (entry is True):
self.title = val
self._update_plot()<|docstring|>Retrieve new plot title.<|endoftext|> |
d14b8413937f9d1220ba7c3ba1001a5a94382093cd6bd896ce9bd74edbcb3618 | def _units_input(self):
'Retrieve new plot units.'
(val, entry) = common.string_dialog_with_reset(self.units, 'Plot Units', 'Units:', self._get_default_units())
if (entry is True):
self.units = val
self._update_plot() | Retrieve new plot units. | artview/components/plot_radar.py | _units_input | jjhelmus/artview | 0 | python | def _units_input(self):
(val, entry) = common.string_dialog_with_reset(self.units, 'Plot Units', 'Units:', self._get_default_units())
if (entry is True):
self.units = val
self._update_plot() | def _units_input(self):
(val, entry) = common.string_dialog_with_reset(self.units, 'Plot Units', 'Units:', self._get_default_units())
if (entry is True):
self.units = val
self._update_plot()<|docstring|>Retrieve new plot units.<|endoftext|> |
4cf0c0c17e34db53124ea60bc32476a44e92c3a44c85dd751aa979cc77fa8289 | def _open_tiltbuttonwindow(self):
'Open a TiltButtonWindow instance.'
from .level import LevelButtonWindow
self.tiltbuttonwindow = LevelButtonWindow(self.Vtilt, plot_type=self.plot_type, Vcontainer=self.Vradar, name=(self.name + ' Tilt Selection'), parent=self.parent) | Open a TiltButtonWindow instance. | artview/components/plot_radar.py | _open_tiltbuttonwindow | jjhelmus/artview | 0 | python | def _open_tiltbuttonwindow(self):
from .level import LevelButtonWindow
self.tiltbuttonwindow = LevelButtonWindow(self.Vtilt, plot_type=self.plot_type, Vcontainer=self.Vradar, name=(self.name + ' Tilt Selection'), parent=self.parent) | def _open_tiltbuttonwindow(self):
from .level import LevelButtonWindow
self.tiltbuttonwindow = LevelButtonWindow(self.Vtilt, plot_type=self.plot_type, Vcontainer=self.Vradar, name=(self.name + ' Tilt Selection'), parent=self.parent)<|docstring|>Open a TiltButtonWindow instance.<|endoftext|> |
7fda9cabef62488398fb586d763bb796e2648df916c70f548a2310d05459c4ef | def _open_fieldbuttonwindow(self):
'Open a FieldButtonWindow instance.'
from .field import FieldButtonWindow
self.fieldbuttonwindow = FieldButtonWindow(self.Vradar, self.Vfield, name=(self.name + ' Field Selection'), parent=self.parent) | Open a FieldButtonWindow instance. | artview/components/plot_radar.py | _open_fieldbuttonwindow | jjhelmus/artview | 0 | python | def _open_fieldbuttonwindow(self):
from .field import FieldButtonWindow
self.fieldbuttonwindow = FieldButtonWindow(self.Vradar, self.Vfield, name=(self.name + ' Field Selection'), parent=self.parent) | def _open_fieldbuttonwindow(self):
from .field import FieldButtonWindow
self.fieldbuttonwindow = FieldButtonWindow(self.Vradar, self.Vfield, name=(self.name + ' Field Selection'), parent=self.parent)<|docstring|>Open a FieldButtonWindow instance.<|endoftext|> |
8e87a0ff8f49c3fbce18ce809991bd459c0efc9c8e98c57976a4410ec01b18f8 | def _add_RngRing_to_button(self):
'Add a menu to display range rings on plot.'
for RngRing in self.RngRingList:
RingAction = self.dispRngRingmenu.addAction(RngRing)
RingAction.setStatusTip(('Apply Range Rings every %s' % RngRing))
RingAction.triggered[()].connect((lambda RngRing=RngRing:... | Add a menu to display range rings on plot. | artview/components/plot_radar.py | _add_RngRing_to_button | jjhelmus/artview | 0 | python | def _add_RngRing_to_button(self):
for RngRing in self.RngRingList:
RingAction = self.dispRngRingmenu.addAction(RngRing)
RingAction.setStatusTip(('Apply Range Rings every %s' % RngRing))
RingAction.triggered[()].connect((lambda RngRing=RngRing: self.RngRingSelectCmd(RngRing)))
se... | def _add_RngRing_to_button(self):
for RngRing in self.RngRingList:
RingAction = self.dispRngRingmenu.addAction(RngRing)
RingAction.setStatusTip(('Apply Range Rings every %s' % RngRing))
RingAction.triggered[()].connect((lambda RngRing=RngRing: self.RngRingSelectCmd(RngRing)))
se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.