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 |
|---|---|---|---|---|---|---|---|---|---|
12aa2abde7569b19286f212c24f112c1b559afcfdf9f6d9854872cff399762ef | def nuke(self):
' Destroys the docker-compose environment. Removes all service containers and volumes.\n '
try:
subprocess.run(['docker-compose', '-f', self.compose_file, 'kill'], check=True, capture_output=True)
subprocess.run(['docker-compose', '-f', self.compose_file, 'rm', '-sf'], che... | Destroys the docker-compose environment. Removes all service containers and volumes. | envy/lib/docker_manager/compose_manager.py | nuke | magmastonealex/fydp | 6 | python | def nuke(self):
' \n '
try:
subprocess.run(['docker-compose', '-f', self.compose_file, 'kill'], check=True, capture_output=True)
subprocess.run(['docker-compose', '-f', self.compose_file, 'rm', '-sf'], check=True, capture_output=True)
except subprocess.CalledProcessError as e:
... | def nuke(self):
' \n '
try:
subprocess.run(['docker-compose', '-f', self.compose_file, 'kill'], check=True, capture_output=True)
subprocess.run(['docker-compose', '-f', self.compose_file, 'rm', '-sf'], check=True, capture_output=True)
except subprocess.CalledProcessError as e:
... |
34bcc068bc8b0f0395b0cf2f90d204f25b26acb8392f4386f457f4ddd4ea1669 | def header(self, palette, entry):
'\n Generate the message header\n '
page = entry.page
if (not page):
return
notes = entry.notes
marker = self.marker
severity = notes['severity']
filename = notes['filename']
if filename:
buffer = [palette[severity]]
... | Generate the message header | packages/journal/Memo.py | header | avalentino/pyre | 0 | python | def header(self, palette, entry):
'\n \n '
page = entry.page
if (not page):
return
notes = entry.notes
marker = self.marker
severity = notes['severity']
filename = notes['filename']
if filename:
buffer = [palette[severity]]
maxlen = self.maxlen
... | def header(self, palette, entry):
'\n \n '
page = entry.page
if (not page):
return
notes = entry.notes
marker = self.marker
severity = notes['severity']
filename = notes['filename']
if filename:
buffer = [palette[severity]]
maxlen = self.maxlen
... |
e6ff70794ef70028311cc9c03ced973275bd697b925ba5c8dd1efc492c1dc909 | def body(self, palette, entry):
'\n Generate the message body\n '
page = entry.page
if (not page):
return
notes = entry.notes
marker = self.continuation
severity = notes['severity']
for line in page:
buffer = [palette[severity], marker, palette['reset'], palette... | Generate the message body | packages/journal/Memo.py | body | avalentino/pyre | 0 | python | def body(self, palette, entry):
'\n \n '
page = entry.page
if (not page):
return
notes = entry.notes
marker = self.continuation
severity = notes['severity']
for line in page:
buffer = [palette[severity], marker, palette['reset'], palette['body'], line, palette['... | def body(self, palette, entry):
'\n \n '
page = entry.page
if (not page):
return
notes = entry.notes
marker = self.continuation
severity = notes['severity']
for line in page:
buffer = [palette[severity], marker, palette['reset'], palette['body'], line, palette['... |
7d2bdfaca0ff2e4e5a3b1d5279cab5a02913a490ad48daa250aaf842e9b5bd7a | @app.route('/recommend')
def registration_process():
' To get recommendations for a particular wholesaler, you need to enter the wholesaler ID.\n ---\n parameters:\n - name: name\n in: query\n type: string\n required: true\n - name: phone\n in: query\n ... | To get recommendations for a particular wholesaler, you need to enter the wholesaler ID.
---
parameters:
- name: name
in: query
type: string
required: true
- name: phone
in: query
type: number
required: true
- name: wholesaler_id
in: query
type: number
r... | app.py | registration_process | bafnayash/tech_savvy_Maverick | 0 | python | @app.route('/recommend')
def registration_process():
' To get recommendations for a particular wholesaler, you need to enter the wholesaler ID.\n ---\n parameters:\n - name: name\n in: query\n type: string\n required: true\n - name: phone\n in: query\n ... | @app.route('/recommend')
def registration_process():
' To get recommendations for a particular wholesaler, you need to enter the wholesaler ID.\n ---\n parameters:\n - name: name\n in: query\n type: string\n required: true\n - name: phone\n in: query\n ... |
92fd0b67676ff7da4a0823b987e07e1127d927a027eda43d05e5a9f8e6ee1fd0 | def __init__(self, first_name, last_name, age, sex, interest):
'Initializing first and last names atribute.'
self.first_name = first_name.title()
self.last_name = last_name.title()
self.age = age
self.sex = sex
self.interest = interest
self.logging_attempts = 0 | Initializing first and last names atribute. | 09_classes/9_8_privileges.py | __init__ | simonhoch/python_basics | 0 | python | def __init__(self, first_name, last_name, age, sex, interest):
self.first_name = first_name.title()
self.last_name = last_name.title()
self.age = age
self.sex = sex
self.interest = interest
self.logging_attempts = 0 | def __init__(self, first_name, last_name, age, sex, interest):
self.first_name = first_name.title()
self.last_name = last_name.title()
self.age = age
self.sex = sex
self.interest = interest
self.logging_attempts = 0<|docstring|>Initializing first and last names atribute.<|endoftext|> |
571b129527f79aa64e41c7ee5d4d0cfc911ed9f456591691ea683836abd54c0c | def describe_user(self):
'Print the initials atributes from the user.'
print(('\nFirst name : ' + self.first_name))
print(('Last name : ' + self.last_name))
print(('Age : ' + str(self.age)))
print(('Sex : ' + self.sex))
print(('Interest: ' + self.interest)) | Print the initials atributes from the user. | 09_classes/9_8_privileges.py | describe_user | simonhoch/python_basics | 0 | python | def describe_user(self):
print(('\nFirst name : ' + self.first_name))
print(('Last name : ' + self.last_name))
print(('Age : ' + str(self.age)))
print(('Sex : ' + self.sex))
print(('Interest: ' + self.interest)) | def describe_user(self):
print(('\nFirst name : ' + self.first_name))
print(('Last name : ' + self.last_name))
print(('Age : ' + str(self.age)))
print(('Sex : ' + self.sex))
print(('Interest: ' + self.interest))<|docstring|>Print the initials atributes from the user.<|endoftext|> |
1d8023bac1eb7348d0482dba6d172391c09621b01d166bdea039ca4e21841dab | def greet_user(self):
'Print personal message to the user.'
print(('\nHello, ' + self.first_name)) | Print personal message to the user. | 09_classes/9_8_privileges.py | greet_user | simonhoch/python_basics | 0 | python | def greet_user(self):
print(('\nHello, ' + self.first_name)) | def greet_user(self):
print(('\nHello, ' + self.first_name))<|docstring|>Print personal message to the user.<|endoftext|> |
f6d10c86621d6bbc3112b9b2c6e98ef1296d58769dd4135c6f92cd9249882e18 | def print_logging_attempt(self):
'Print the number of logging attempts.'
print(('Number of logging attempts : ' + str(self.logging_attempts))) | Print the number of logging attempts. | 09_classes/9_8_privileges.py | print_logging_attempt | simonhoch/python_basics | 0 | python | def print_logging_attempt(self):
print(('Number of logging attempts : ' + str(self.logging_attempts))) | def print_logging_attempt(self):
print(('Number of logging attempts : ' + str(self.logging_attempts)))<|docstring|>Print the number of logging attempts.<|endoftext|> |
74198b2ef62308e169e1048c67f222a5bf698be737060a803d3d308693d4acbc | def increment_logging_attempt(self):
'Increment by 1 the number of logging attempt.'
self.logging_attempts += 1 | Increment by 1 the number of logging attempt. | 09_classes/9_8_privileges.py | increment_logging_attempt | simonhoch/python_basics | 0 | python | def increment_logging_attempt(self):
self.logging_attempts += 1 | def increment_logging_attempt(self):
self.logging_attempts += 1<|docstring|>Increment by 1 the number of logging attempt.<|endoftext|> |
ca0eb63fd741435996317df0b77c185fd41c04d3e49f1cce69ec9dd4622424d6 | def reset_logging_attempts(self):
'Reset the number of logging attempt.'
self.logging_attempts = 0 | Reset the number of logging attempt. | 09_classes/9_8_privileges.py | reset_logging_attempts | simonhoch/python_basics | 0 | python | def reset_logging_attempts(self):
self.logging_attempts = 0 | def reset_logging_attempts(self):
self.logging_attempts = 0<|docstring|>Reset the number of logging attempt.<|endoftext|> |
2f15c41c313824530a6d81dd4ee89f861469ac98bdaeea10610a68e509a0b904 | def __init__(self, privileges=['can add post', 'can delete post', 'can ban user']):
'Initialization of attributes for privilages'
self.privileges = privileges | Initialization of attributes for privilages | 09_classes/9_8_privileges.py | __init__ | simonhoch/python_basics | 0 | python | def __init__(self, privileges=['can add post', 'can delete post', 'can ban user']):
self.privileges = privileges | def __init__(self, privileges=['can add post', 'can delete post', 'can ban user']):
self.privileges = privileges<|docstring|>Initialization of attributes for privilages<|endoftext|> |
faa34ddccfd1f8b1f62ca8f8b5ddf826aba934d33bf5749042e498f2a7ce8987 | def show_privileges(self):
'Printing privilges for an admin.'
print('Beeing an admin, you can :')
for privilege in self.privileges:
print(('\t-' + privilege)) | Printing privilges for an admin. | 09_classes/9_8_privileges.py | show_privileges | simonhoch/python_basics | 0 | python | def show_privileges(self):
print('Beeing an admin, you can :')
for privilege in self.privileges:
print(('\t-' + privilege)) | def show_privileges(self):
print('Beeing an admin, you can :')
for privilege in self.privileges:
print(('\t-' + privilege))<|docstring|>Printing privilges for an admin.<|endoftext|> |
a04236e5bb5a8e2c0f3aa677b81a12d2db2e073f3bd1800f79673972f79cf51b | def set_privileges(self):
'Set the privileges of an admin'
self.privileges = ['aaaaa'] | Set the privileges of an admin | 09_classes/9_8_privileges.py | set_privileges | simonhoch/python_basics | 0 | python | def set_privileges(self):
self.privileges = ['aaaaa'] | def set_privileges(self):
self.privileges = ['aaaaa']<|docstring|>Set the privileges of an admin<|endoftext|> |
6e6468aca4607eb332211c50d22d8ce29e675e05b6d4f938542854aec17f21bd | def __init__(self, first_name, last_name, age, sex, interest):
'\n Initialazing informations about a user.\n Then adding privileges for an admin.\n '
super().__init__(first_name, last_name, age, sex, interest)
self.privileges = Privileges() | Initialazing informations about a user.
Then adding privileges for an admin. | 09_classes/9_8_privileges.py | __init__ | simonhoch/python_basics | 0 | python | def __init__(self, first_name, last_name, age, sex, interest):
'\n Initialazing informations about a user.\n Then adding privileges for an admin.\n '
super().__init__(first_name, last_name, age, sex, interest)
self.privileges = Privileges() | def __init__(self, first_name, last_name, age, sex, interest):
'\n Initialazing informations about a user.\n Then adding privileges for an admin.\n '
super().__init__(first_name, last_name, age, sex, interest)
self.privileges = Privileges()<|docstring|>Initialazing informations about a ... |
96c52699f3a53655c8d4b53b9e005575d8b659893e08a679a1d57090215e62b9 | def is_accessible_by(self, user):
'Returns whether or not the user has access to the account.\n\n The account is accessible by the user if the user has access to the\n local site.\n '
return ((not self.local_site) or self.local_site.is_accessible_by(user)) | Returns whether or not the user has access to the account.
The account is accessible by the user if the user has access to the
local site. | reviewboard/hostingsvcs/models.py | is_accessible_by | freeamac/reviewboard | 921 | python | def is_accessible_by(self, user):
'Returns whether or not the user has access to the account.\n\n The account is accessible by the user if the user has access to the\n local site.\n '
return ((not self.local_site) or self.local_site.is_accessible_by(user)) | def is_accessible_by(self, user):
'Returns whether or not the user has access to the account.\n\n The account is accessible by the user if the user has access to the\n local site.\n '
return ((not self.local_site) or self.local_site.is_accessible_by(user))<|docstring|>Returns whether or not... |
705d1f581fc34b2904a50dab885fcd1743b15d59353cb748768779876b0b6f45 | def is_mutable_by(self, user):
'Returns whether or not the user can modify or delete the account.\n\n The acount is mutable by the user if the user is an administrator\n with proper permissions or the account is part of a LocalSite and\n the user has permissions to modify it.\n '
ret... | Returns whether or not the user can modify or delete the account.
The acount is mutable by the user if the user is an administrator
with proper permissions or the account is part of a LocalSite and
the user has permissions to modify it. | reviewboard/hostingsvcs/models.py | is_mutable_by | freeamac/reviewboard | 921 | python | def is_mutable_by(self, user):
'Returns whether or not the user can modify or delete the account.\n\n The acount is mutable by the user if the user is an administrator\n with proper permissions or the account is part of a LocalSite and\n the user has permissions to modify it.\n '
ret... | def is_mutable_by(self, user):
'Returns whether or not the user can modify or delete the account.\n\n The acount is mutable by the user if the user is an administrator\n with proper permissions or the account is part of a LocalSite and\n the user has permissions to modify it.\n '
ret... |
8d5f888e4ba04343020531e96abb2fe14e97673948cc7d4f4c0a9a9e756faeaf | def accept_certificate(self, certificate):
'Accept the SSL certificate for the linked hosting URL.\n\n Args:\n certificate (reviewboard.scmtools.certs.Certificate):\n The certificate to accept.\n\n Raises:\n ValueError:\n The certificate data did not... | Accept the SSL certificate for the linked hosting URL.
Args:
certificate (reviewboard.scmtools.certs.Certificate):
The certificate to accept.
Raises:
ValueError:
The certificate data did not include required fields. | reviewboard/hostingsvcs/models.py | accept_certificate | freeamac/reviewboard | 921 | python | def accept_certificate(self, certificate):
'Accept the SSL certificate for the linked hosting URL.\n\n Args:\n certificate (reviewboard.scmtools.certs.Certificate):\n The certificate to accept.\n\n Raises:\n ValueError:\n The certificate data did not... | def accept_certificate(self, certificate):
'Accept the SSL certificate for the linked hosting URL.\n\n Args:\n certificate (reviewboard.scmtools.certs.Certificate):\n The certificate to accept.\n\n Raises:\n ValueError:\n The certificate data did not... |
704cfc340d38ed2bcd06f19999b5261da76da9cd5b1a93cfd52f504b12ee0b87 | def get_unique_filename(filename):
"\n Create unique filename using given name to ensure that\n it's not already present in database. This method simply\n adds a counter to original filename.\n\n :param str filename:\n :rtype str:\n "
filename = secure_filename(filename)
final_name = filen... | Create unique filename using given name to ensure that
it's not already present in database. This method simply
adds a counter to original filename.
:param str filename:
:rtype str: | chgallery/image/__init__.py | get_unique_filename | jpocentek/ch-gallery | 0 | python | def get_unique_filename(filename):
"\n Create unique filename using given name to ensure that\n it's not already present in database. This method simply\n adds a counter to original filename.\n\n :param str filename:\n :rtype str:\n "
filename = secure_filename(filename)
final_name = filen... | def get_unique_filename(filename):
"\n Create unique filename using given name to ensure that\n it's not already present in database. This method simply\n adds a counter to original filename.\n\n :param str filename:\n :rtype str:\n "
filename = secure_filename(filename)
final_name = filen... |
3dc5e64be92b083d7854437a89c5ea3540c0d1c212a8bb9ab7b3cc892f0615db | def get_road_network(fn, fn_road, in_sys='wgs', out_sys='wgs'):
'@params: fn, fn_road'
road_type_filter = ['motorway', 'motorway_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary']
dom = xml.dom.minidom.parse(fn)
root = dom.documentElement
nodelist = root.getElementsByTagNam... | @params: fn, fn_road | src/.bak/TopoRoadNetwork.py | get_road_network | wenke727/RoadNetworkCreator | 1 | python | def get_road_network(fn, fn_road, in_sys='wgs', out_sys='wgs'):
road_type_filter = ['motorway', 'motorway_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary']
dom = xml.dom.minidom.parse(fn)
root = dom.documentElement
nodelist = root.getElementsByTagName('node')
waylist ... | def get_road_network(fn, fn_road, in_sys='wgs', out_sys='wgs'):
road_type_filter = ['motorway', 'motorway_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary']
dom = xml.dom.minidom.parse(fn)
root = dom.documentElement
nodelist = root.getElementsByTagName('node')
waylist ... |
2150c78c9902feb81b6f5f23d731716b88c4440aa9cf6174181259e1aadd72d7 | @pytest.mark.sanity
def test_single_interface_connected_multiple_interfaces():
'\n Deploy single otg duplicate interfaces kne topology,\n - namespace - 1: ixia-c\n Validate,\n - kne_cli error\n - total pods count - 0\n - total service count - 0\n - operator pod health\n '
namespace1 = 'i... | Deploy single otg duplicate interfaces kne topology,
- namespace - 1: ixia-c
Validate,
- kne_cli error
- total pods count - 0
- total service count - 0
- operator pod health | operator-tests/py/negative/test_single_otg_duplicate_interface.py | test_single_interface_connected_multiple_interfaces | open-traffic-generator/ixia-c-operator | 2 | python | @pytest.mark.sanity
def test_single_interface_connected_multiple_interfaces():
'\n Deploy single otg duplicate interfaces kne topology,\n - namespace - 1: ixia-c\n Validate,\n - kne_cli error\n - total pods count - 0\n - total service count - 0\n - operator pod health\n '
namespace1 = 'i... | @pytest.mark.sanity
def test_single_interface_connected_multiple_interfaces():
'\n Deploy single otg duplicate interfaces kne topology,\n - namespace - 1: ixia-c\n Validate,\n - kne_cli error\n - total pods count - 0\n - total service count - 0\n - operator pod health\n '
namespace1 = 'i... |
8e5e2a73562af8689a7f223f78e4cf55e89fb97af5dca539bceda50e8b202f56 | def set_creds_data(credentials):
'Set credentials, either as a dictionary or a JSON-encoded string.\n '
global _credentials_file, _credentials_data
_credentials_data = credentials
if _credentials_data:
_credentials_file = None
if isinstance(_credentials_data, str):
_creden... | Set credentials, either as a dictionary or a JSON-encoded string. | qpcr_analyzer/gdrive_utils.py | set_creds_data | martinwellman/odm-qpcr-analyzer | 0 | python | def set_creds_data(credentials):
'\n '
global _credentials_file, _credentials_data
_credentials_data = credentials
if _credentials_data:
_credentials_file = None
if isinstance(_credentials_data, str):
_credentials_data = json.loads(_credentials_data) | def set_creds_data(credentials):
'\n '
global _credentials_file, _credentials_data
_credentials_data = credentials
if _credentials_data:
_credentials_file = None
if isinstance(_credentials_data, str):
_credentials_data = json.loads(_credentials_data)<|docstring|>Set creden... |
ee42e66f318f56681d93905d9d780d1976783780787f0a83bb15f4bbea34692d | def set_token_data(token):
'Set access token, either as a dictionary or a JSON-encoded string.\n '
global _token_file, _token_data
_token_data = token
if _token_data:
_token_file = None
if isinstance(_token_data, str):
_token_data = json.loads(_token_data) | Set access token, either as a dictionary or a JSON-encoded string. | qpcr_analyzer/gdrive_utils.py | set_token_data | martinwellman/odm-qpcr-analyzer | 0 | python | def set_token_data(token):
'\n '
global _token_file, _token_data
_token_data = token
if _token_data:
_token_file = None
if isinstance(_token_data, str):
_token_data = json.loads(_token_data) | def set_token_data(token):
'\n '
global _token_file, _token_data
_token_data = token
if _token_data:
_token_file = None
if isinstance(_token_data, str):
_token_data = json.loads(_token_data)<|docstring|>Set access token, either as a dictionary or a JSON-encoded string.<|en... |
0ddb9a7747ebd8fbc1c388004a70ec6a464f00dc3b8c8dbb40c3893adc826632 | def set_partial_token_data_file(tokens_file):
'See set_partial_token_data: Sets the partial token using a file instead of an already loaded JSON string or dictionary.\n '
with open(tokens_file, 'r') as f:
set_partial_token_data(f.read()) | See set_partial_token_data: Sets the partial token using a file instead of an already loaded JSON string or dictionary. | qpcr_analyzer/gdrive_utils.py | set_partial_token_data_file | martinwellman/odm-qpcr-analyzer | 0 | python | def set_partial_token_data_file(tokens_file):
'\n '
with open(tokens_file, 'r') as f:
set_partial_token_data(f.read()) | def set_partial_token_data_file(tokens_file):
'\n '
with open(tokens_file, 'r') as f:
set_partial_token_data(f.read())<|docstring|>See set_partial_token_data: Sets the partial token using a file instead of an already loaded JSON string or dictionary.<|endoftext|> |
c08b9190b41a54ca3f7d2094479dab3c0c7e10b06bb6d8da65d7eba8bb0c78ac | def set_partial_token_data(tokens):
'Set the access token data, using a dictionary or JSON-encoded string that contains the "token" and "refresh_token" fields, but\n not other required fields such as the client_id. The missing fields are instead retrieved from the credentials set by\n a set_creds call.\n '... | Set the access token data, using a dictionary or JSON-encoded string that contains the "token" and "refresh_token" fields, but
not other required fields such as the client_id. The missing fields are instead retrieved from the credentials set by
a set_creds call. | qpcr_analyzer/gdrive_utils.py | set_partial_token_data | martinwellman/odm-qpcr-analyzer | 0 | python | def set_partial_token_data(tokens):
'Set the access token data, using a dictionary or JSON-encoded string that contains the "token" and "refresh_token" fields, but\n not other required fields such as the client_id. The missing fields are instead retrieved from the credentials set by\n a set_creds call.\n '... | def set_partial_token_data(tokens):
'Set the access token data, using a dictionary or JSON-encoded string that contains the "token" and "refresh_token" fields, but\n not other required fields such as the client_id. The missing fields are instead retrieved from the credentials set by\n a set_creds call.\n '... |
851d214d4befa8239e9f032cc42cbba067a79a5a80337c914a8eec1b800f8c94 | def set_allow_flow(allow):
'Disable or enable app login flow, which requires user input. If set to False then rather than waiting for user input\n a RuntimeError exception is raised.\n '
global allow_flow
allow_flow = allow | Disable or enable app login flow, which requires user input. If set to False then rather than waiting for user input
a RuntimeError exception is raised. | qpcr_analyzer/gdrive_utils.py | set_allow_flow | martinwellman/odm-qpcr-analyzer | 0 | python | def set_allow_flow(allow):
'Disable or enable app login flow, which requires user input. If set to False then rather than waiting for user input\n a RuntimeError exception is raised.\n '
global allow_flow
allow_flow = allow | def set_allow_flow(allow):
'Disable or enable app login flow, which requires user input. If set to False then rather than waiting for user input\n a RuntimeError exception is raised.\n '
global allow_flow
allow_flow = allow<|docstring|>Disable or enable app login flow, which requires user input. If se... |
f3269fbad0e6a7457db150d2fb2b233c955969fafa4a483692e84227ba635ec0 | def test_access_token():
"Test if the access token and credentials are valid and will us to access the Google Drive service.\n\n Returns\n -------\n True if we can access Google Drive service, False if we can't (typically means the access token has\n expired and needs refreshing).\n "
try:
... | Test if the access token and credentials are valid and will us to access the Google Drive service.
Returns
-------
True if we can access Google Drive service, False if we can't (typically means the access token has
expired and needs refreshing). | qpcr_analyzer/gdrive_utils.py | test_access_token | martinwellman/odm-qpcr-analyzer | 0 | python | def test_access_token():
"Test if the access token and credentials are valid and will us to access the Google Drive service.\n\n Returns\n -------\n True if we can access Google Drive service, False if we can't (typically means the access token has\n expired and needs refreshing).\n "
try:
... | def test_access_token():
"Test if the access token and credentials are valid and will us to access the Google Drive service.\n\n Returns\n -------\n True if we can access Google Drive service, False if we can't (typically means the access token has\n expired and needs refreshing).\n "
try:
... |
4146d9cd6606f42b449f593943a497ecd4ea13284d49e9e92b4d85d7f10af990 | def get_drive_service():
'Get a Google Drive service for making Google Drive API calls.\n '
creds = None
if (_token_file and os.path.exists(_token_file)):
creds = Credentials.from_authorized_user_file(_token_file, SCOPES)
elif _token_data:
creds = Credentials.from_authorized_user_info... | Get a Google Drive service for making Google Drive API calls. | qpcr_analyzer/gdrive_utils.py | get_drive_service | martinwellman/odm-qpcr-analyzer | 0 | python | def get_drive_service():
'\n '
creds = None
if (_token_file and os.path.exists(_token_file)):
creds = Credentials.from_authorized_user_file(_token_file, SCOPES)
elif _token_data:
creds = Credentials.from_authorized_user_info(_token_data, SCOPES)
if ((not creds) or (not creds.valid... | def get_drive_service():
'\n '
creds = None
if (_token_file and os.path.exists(_token_file)):
creds = Credentials.from_authorized_user_file(_token_file, SCOPES)
elif _token_data:
creds = Credentials.from_authorized_user_info(_token_data, SCOPES)
if ((not creds) or (not creds.valid... |
527baaed71bc7d03f084a393bc0ec324eaac9001771b4aef11f9505cd65cc7fb | def drive_get_root_id():
"Get the folder ID of the current root to use for all Google Drive access. This is the user's account root folder.\n "
return get_drive_service().files().get(fileId='root').execute()['id'] | Get the folder ID of the current root to use for all Google Drive access. This is the user's account root folder. | qpcr_analyzer/gdrive_utils.py | drive_get_root_id | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_get_root_id():
"\n "
return get_drive_service().files().get(fileId='root').execute()['id'] | def drive_get_root_id():
"\n "
return get_drive_service().files().get(fileId='root').execute()['id']<|docstring|>Get the folder ID of the current root to use for all Google Drive access. This is the user's account root folder.<|endoftext|> |
57ad671855ae632c5f2bc62feccf400b8881e740d5c9a63df96aa2b5c970abfb | def drive_download_from_id(file_id, local_dir=None, file_name=None):
'Download the specified file_id from Google Drive. It is saved to the local directory local_dir, either with\n the same filename as the source file, or named file_name if specified.\n '
if (not file_id):
return None
file_name... | Download the specified file_id from Google Drive. It is saved to the local directory local_dir, either with
the same filename as the source file, or named file_name if specified. | qpcr_analyzer/gdrive_utils.py | drive_download_from_id | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_download_from_id(file_id, local_dir=None, file_name=None):
'Download the specified file_id from Google Drive. It is saved to the local directory local_dir, either with\n the same filename as the source file, or named file_name if specified.\n '
if (not file_id):
return None
file_name... | def drive_download_from_id(file_id, local_dir=None, file_name=None):
'Download the specified file_id from Google Drive. It is saved to the local directory local_dir, either with\n the same filename as the source file, or named file_name if specified.\n '
if (not file_id):
return None
file_name... |
b53845a0788bbb6b57566a0c53b2cd927ececc5216c614c5ab2bfa80fa48b9b3 | def drive_download(path, local_dir=None, file_name=None, root_id=None):
"Download the specified file (path) from the current Google Drive account, and save it at local_dir. \n The path parameter is relative to folder with the specified root_id, or the user's root folder. If file_name \n is specified then save... | Download the specified file (path) from the current Google Drive account, and save it at local_dir.
The path parameter is relative to folder with the specified root_id, or the user's root folder. If file_name
is specified then save it with that filename (in local_dir), otherwise the filename in path is used. | qpcr_analyzer/gdrive_utils.py | drive_download | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_download(path, local_dir=None, file_name=None, root_id=None):
"Download the specified file (path) from the current Google Drive account, and save it at local_dir. \n The path parameter is relative to folder with the specified root_id, or the user's root folder. If file_name \n is specified then save... | def drive_download(path, local_dir=None, file_name=None, root_id=None):
"Download the specified file (path) from the current Google Drive account, and save it at local_dir. \n The path parameter is relative to folder with the specified root_id, or the user's root folder. If file_name \n is specified then save... |
3c8c64b936d51aa28e7992ea9dae0af392a6b52cb11ecf5d6a551e614953faf0 | def get_mime_type(file):
"Get the MIME-type of the specified file. It uses the file's extension.\n\n Currently supported: xlsx, pdf, csv.\n "
ext = os.path.splitext(file)[1].lower()
return {'.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', '.pdf': 'application/pdf', '.csv':... | Get the MIME-type of the specified file. It uses the file's extension.
Currently supported: xlsx, pdf, csv. | qpcr_analyzer/gdrive_utils.py | get_mime_type | martinwellman/odm-qpcr-analyzer | 0 | python | def get_mime_type(file):
"Get the MIME-type of the specified file. It uses the file's extension.\n\n Currently supported: xlsx, pdf, csv.\n "
ext = os.path.splitext(file)[1].lower()
return {'.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', '.pdf': 'application/pdf', '.csv':... | def get_mime_type(file):
"Get the MIME-type of the specified file. It uses the file's extension.\n\n Currently supported: xlsx, pdf, csv.\n "
ext = os.path.splitext(file)[1].lower()
return {'.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', '.pdf': 'application/pdf', '.csv':... |
7b5b54a1916305b002c373f780acf5b746759f124123602480f229073dbb2765 | def drive_upload(local_file, remote_file, root_id=None):
'Upload a file. All remote directories to remote_file will be created if they do not exist.\n '
remote_file_name = os.path.basename(remote_file)
parent = drive_create_folder(os.path.dirname(remote_file), root_id)
existing_id = drive_get_file_id... | Upload a file. All remote directories to remote_file will be created if they do not exist. | qpcr_analyzer/gdrive_utils.py | drive_upload | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_upload(local_file, remote_file, root_id=None):
'\n '
remote_file_name = os.path.basename(remote_file)
parent = drive_create_folder(os.path.dirname(remote_file), root_id)
existing_id = drive_get_file_id(remote_file_name, parent)
media = MediaFileUpload(local_file, mimetype=get_mime_type(... | def drive_upload(local_file, remote_file, root_id=None):
'\n '
remote_file_name = os.path.basename(remote_file)
parent = drive_create_folder(os.path.dirname(remote_file), root_id)
existing_id = drive_get_file_id(remote_file_name, parent)
media = MediaFileUpload(local_file, mimetype=get_mime_type(... |
db8136c366f191079150fee9b15713cbf143b835e55492541e05052c28a126b7 | def drive_get_file_name(file_id):
'Get the file name of a Google drive file.\n '
try:
response = get_drive_service().files().get(fileId=file_id).execute()
except:
return None
return response.get('name', None) | Get the file name of a Google drive file. | qpcr_analyzer/gdrive_utils.py | drive_get_file_name | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_get_file_name(file_id):
'\n '
try:
response = get_drive_service().files().get(fileId=file_id).execute()
except:
return None
return response.get('name', None) | def drive_get_file_name(file_id):
'\n '
try:
response = get_drive_service().files().get(fileId=file_id).execute()
except:
return None
return response.get('name', None)<|docstring|>Get the file name of a Google drive file.<|endoftext|> |
282b1f3257feb2245994f62aae87bf3ac42bf728e404a6d559ce2968fa465588 | def drive_get_file_id(path, root_id=None):
'Get the Google file ID of the specified Google Drive file (path).\n '
files = drive_get_files_in_folder(os.path.dirname(path), root_id)
if (files is None):
return None
name = os.path.basename(path)
matches = [f.get('id', None) for f in files if ... | Get the Google file ID of the specified Google Drive file (path). | qpcr_analyzer/gdrive_utils.py | drive_get_file_id | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_get_file_id(path, root_id=None):
'\n '
files = drive_get_files_in_folder(os.path.dirname(path), root_id)
if (files is None):
return None
name = os.path.basename(path)
matches = [f.get('id', None) for f in files if (f.get('name') == name)]
return (matches[0] if (len(matches) ... | def drive_get_file_id(path, root_id=None):
'\n '
files = drive_get_files_in_folder(os.path.dirname(path), root_id)
if (files is None):
return None
name = os.path.basename(path)
matches = [f.get('id', None) for f in files if (f.get('name') == name)]
return (matches[0] if (len(matches) ... |
30f771bca27b124439bbeb61122d6313f8c03e20cb363d4bacbf346917ceee34 | def drive_get_folder_id(path, root_id=None):
'Get the Google Drive folder ID of the specified file (path) on Google Drive.\n '
page_token = None
service = get_drive_service()
path_comps = path.split('/')
parent = (root_id or drive_get_root_id())
if ((len(path_comps) > 0) and get_tagged_id(pat... | Get the Google Drive folder ID of the specified file (path) on Google Drive. | qpcr_analyzer/gdrive_utils.py | drive_get_folder_id | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_get_folder_id(path, root_id=None):
'\n '
page_token = None
service = get_drive_service()
path_comps = path.split('/')
parent = (root_id or drive_get_root_id())
if ((len(path_comps) > 0) and get_tagged_id(path_comps[0])):
parent = get_tagged_id(path_comps[0])
path_com... | def drive_get_folder_id(path, root_id=None):
'\n '
page_token = None
service = get_drive_service()
path_comps = path.split('/')
parent = (root_id or drive_get_root_id())
if ((len(path_comps) > 0) and get_tagged_id(path_comps[0])):
parent = get_tagged_id(path_comps[0])
path_com... |
757b4df4615bb4c08a367f1d9fa72cf15ce3244ad9315d7c38a255779e00de10 | def drive_get_files_in_folder(path, root_id=None):
'Get a list of all files in the specified Google Drive path. Each returned element is a\n dictionary with the fields "id", "name", and "parents".\n '
parent = drive_get_folder_id(path, root_id)
page_token = None
service = get_drive_service()
f... | Get a list of all files in the specified Google Drive path. Each returned element is a
dictionary with the fields "id", "name", and "parents". | qpcr_analyzer/gdrive_utils.py | drive_get_files_in_folder | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_get_files_in_folder(path, root_id=None):
'Get a list of all files in the specified Google Drive path. Each returned element is a\n dictionary with the fields "id", "name", and "parents".\n '
parent = drive_get_folder_id(path, root_id)
page_token = None
service = get_drive_service()
f... | def drive_get_files_in_folder(path, root_id=None):
'Get a list of all files in the specified Google Drive path. Each returned element is a\n dictionary with the fields "id", "name", and "parents".\n '
parent = drive_get_folder_id(path, root_id)
page_token = None
service = get_drive_service()
f... |
e20f5a30c8ba7546ea765cbeebcdcc4643710cde55d2a5b09a9d4b2a1d93d391 | def drive_create_folder(path, root_id=None):
'Create the specified folder (path) on Google Drive.\n '
path_comps = path.split('/')
parent = (root_id or drive_get_root_id())
if ((len(path_comps) > 0) and get_tagged_id(path_comps[0])):
parent = get_tagged_id(path_comps[0])
path_comps.po... | Create the specified folder (path) on Google Drive. | qpcr_analyzer/gdrive_utils.py | drive_create_folder | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_create_folder(path, root_id=None):
'\n '
path_comps = path.split('/')
parent = (root_id or drive_get_root_id())
if ((len(path_comps) > 0) and get_tagged_id(path_comps[0])):
parent = get_tagged_id(path_comps[0])
path_comps.pop(0)
last_exist_idx = (- 1)
for i in range(... | def drive_create_folder(path, root_id=None):
'\n '
path_comps = path.split('/')
parent = (root_id or drive_get_root_id())
if ((len(path_comps) > 0) and get_tagged_id(path_comps[0])):
parent = get_tagged_id(path_comps[0])
path_comps.pop(0)
last_exist_idx = (- 1)
for i in range(... |
98b0f3228b13f318ba76f33996f1cddd5cc501da0c3f38ec301fdf0546c32aad | def drive_get_user_permission_id():
'Get the permission ID associated with the current Drive user. This can be used to\n see what types of permissions (eg. write permission) the user has for accessing certain files.\n '
service = get_drive_service()
about = service.about().get(fields='user').execute()... | Get the permission ID associated with the current Drive user. This can be used to
see what types of permissions (eg. write permission) the user has for accessing certain files. | qpcr_analyzer/gdrive_utils.py | drive_get_user_permission_id | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_get_user_permission_id():
'Get the permission ID associated with the current Drive user. This can be used to\n see what types of permissions (eg. write permission) the user has for accessing certain files.\n '
service = get_drive_service()
about = service.about().get(fields='user').execute()... | def drive_get_user_permission_id():
'Get the permission ID associated with the current Drive user. This can be used to\n see what types of permissions (eg. write permission) the user has for accessing certain files.\n '
service = get_drive_service()
about = service.about().get(fields='user').execute()... |
60d18024c88aefa0bb31e8fae8ef5c5d18563b44e14536efa53d0383d3978557 | def drive_get_user_email_address():
"Get the current user's email address.\n "
service = get_drive_service()
about = service.about().get(fields='user').execute()
return about['user']['emailAddress'] | Get the current user's email address. | qpcr_analyzer/gdrive_utils.py | drive_get_user_email_address | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_get_user_email_address():
"\n "
service = get_drive_service()
about = service.about().get(fields='user').execute()
return about['user']['emailAddress'] | def drive_get_user_email_address():
"\n "
service = get_drive_service()
about = service.about().get(fields='user').execute()
return about['user']['emailAddress']<|docstring|>Get the current user's email address.<|endoftext|> |
9f80eab3db3903b19594aa672a0968b6e7b6fd377a34f9828a4af0f7f6e68a96 | def drive_has_write_permission(file_id):
'Check if the current user has write permission to the specified Google Drive file ID.\n '
try:
user_permission_id = drive_get_user_permission_id()
service = get_drive_service()
page_token = None
while True:
file_permissions... | Check if the current user has write permission to the specified Google Drive file ID. | qpcr_analyzer/gdrive_utils.py | drive_has_write_permission | martinwellman/odm-qpcr-analyzer | 0 | python | def drive_has_write_permission(file_id):
'\n '
try:
user_permission_id = drive_get_user_permission_id()
service = get_drive_service()
page_token = None
while True:
file_permissions = service.permissions().list(fileId=file_id, fields='nextPageToken, permissions', pa... | def drive_has_write_permission(file_id):
'\n '
try:
user_permission_id = drive_get_user_permission_id()
service = get_drive_service()
page_token = None
while True:
file_permissions = service.permissions().list(fileId=file_id, fields='nextPageToken, permissions', pa... |
1a3549730698aaf06a70b627fdb3f43c5f2a625ddf22701075e6fff1d83f8ea4 | def parse(self, cls: Type['JAMLCompatible'], data: Dict) -> 'JAMLCompatible':
'\n :param cls: target class type to parse into, must be a :class:`JAMLCompatible` type\n :param data: flow yaml file loaded as python dict\n :return: the YAML parser given the syntax version number\n '
exp... | :param cls: target class type to parse into, must be a :class:`JAMLCompatible` type
:param data: flow yaml file loaded as python dict
:return: the YAML parser given the syntax version number | jina/jaml/parsers/default/v1.py | parse | arp99/jina | 15,179 | python | def parse(self, cls: Type['JAMLCompatible'], data: Dict) -> 'JAMLCompatible':
'\n :param cls: target class type to parse into, must be a :class:`JAMLCompatible` type\n :param data: flow yaml file loaded as python dict\n :return: the YAML parser given the syntax version number\n '
exp... | def parse(self, cls: Type['JAMLCompatible'], data: Dict) -> 'JAMLCompatible':
'\n :param cls: target class type to parse into, must be a :class:`JAMLCompatible` type\n :param data: flow yaml file loaded as python dict\n :return: the YAML parser given the syntax version number\n '
exp... |
aced87f5a8ec362cf1842a8bb33bbde31e4fff743772b91ef10a2cea9d91f2aa | def dump(self, data: 'JAMLCompatible') -> Dict:
'\n :param data: versioned flow object\n :return: the dictionary given a versioned flow object\n '
a = V1Parser._dump_instance_to_yaml(data)
r = {}
if a:
r['with'] = a
return r | :param data: versioned flow object
:return: the dictionary given a versioned flow object | jina/jaml/parsers/default/v1.py | dump | arp99/jina | 15,179 | python | def dump(self, data: 'JAMLCompatible') -> Dict:
'\n :param data: versioned flow object\n :return: the dictionary given a versioned flow object\n '
a = V1Parser._dump_instance_to_yaml(data)
r = {}
if a:
r['with'] = a
return r | def dump(self, data: 'JAMLCompatible') -> Dict:
'\n :param data: versioned flow object\n :return: the dictionary given a versioned flow object\n '
a = V1Parser._dump_instance_to_yaml(data)
r = {}
if a:
r['with'] = a
return r<|docstring|>:param data: versioned flow object... |
20483aec3b293553e1fe2534bfd424cd52abe87160100229542d93bf75570eae | def select_product():
'\n binds the frozen context the selected features\n\n should be called only once - calls after the first call have\n no effect\n '
global _product_selected
if _product_selected:
return
_product_selected = True
from django_productline import context, templat... | binds the frozen context the selected features
should be called only once - calls after the first call have
no effect | django_productline/startup.py | select_product | henzk/django-productline | 5 | python | def select_product():
'\n binds the frozen context the selected features\n\n should be called only once - calls after the first call have\n no effect\n '
global _product_selected
if _product_selected:
return
_product_selected = True
from django_productline import context, templat... | def select_product():
'\n binds the frozen context the selected features\n\n should be called only once - calls after the first call have\n no effect\n '
global _product_selected
if _product_selected:
return
_product_selected = True
from django_productline import context, templat... |
5d4e3ed204634b629a6ea90deffc7d37f4894172418b24829961a8a0a1f79780 | def get_wsgi_application():
'\n returns the wsgi application for the selected product\n\n this function is called by featuredjango.wsgi to get the wsgi\n application object\n\n if you need to refine the wsgi application object e.g. to add\n wsgi middleware please refine django.core.wsgi.get_wsgi_appl... | returns the wsgi application for the selected product
this function is called by featuredjango.wsgi to get the wsgi
application object
if you need to refine the wsgi application object e.g. to add
wsgi middleware please refine django.core.wsgi.get_wsgi_application directly. | django_productline/startup.py | get_wsgi_application | henzk/django-productline | 5 | python | def get_wsgi_application():
'\n returns the wsgi application for the selected product\n\n this function is called by featuredjango.wsgi to get the wsgi\n application object\n\n if you need to refine the wsgi application object e.g. to add\n wsgi middleware please refine django.core.wsgi.get_wsgi_appl... | def get_wsgi_application():
'\n returns the wsgi application for the selected product\n\n this function is called by featuredjango.wsgi to get the wsgi\n application object\n\n if you need to refine the wsgi application object e.g. to add\n wsgi middleware please refine django.core.wsgi.get_wsgi_appl... |
ea015dcdc6a4bfc22cc9522057af26a3d062cd0a43edb71032a621194b0bdbf4 | async def call(self, url=None, data=None, headers=None):
'http异步调用\n\n :param path_args: 命令行参数\n :param params: query参数\n :param data: body(GET 忽略)\n :param headers: Header\n '
self._build_request(url, data, headers)
try:
resp = (await AsyncHTTPClient().fetch(self.... | http异步调用
:param path_args: 命令行参数
:param params: query参数
:param data: body(GET 忽略)
:param headers: Header | easyHTTP/client/client.py | call | hxgz/easyHTTP | 0 | python | async def call(self, url=None, data=None, headers=None):
'http异步调用\n\n :param path_args: 命令行参数\n :param params: query参数\n :param data: body(GET 忽略)\n :param headers: Header\n '
self._build_request(url, data, headers)
try:
resp = (await AsyncHTTPClient().fetch(self.... | async def call(self, url=None, data=None, headers=None):
'http异步调用\n\n :param path_args: 命令行参数\n :param params: query参数\n :param data: body(GET 忽略)\n :param headers: Header\n '
self._build_request(url, data, headers)
try:
resp = (await AsyncHTTPClient().fetch(self.... |
17535cebacf54822fd44a217a8dcea42f11d5c13695f9d239ce70915271181e9 | @classmethod
def _resp_human(cls, response):
'处理返回数据'
if (response.code in (301, 302)):
return response.headers['Location']
ct = (cls.RESPONSE_CONTENT_TYPE or cgi.parse_header(response.headers['Content-Type'])[0])
if ct.startswith('text'):
return response.body.decode('utf-8')
elif (c... | 处理返回数据 | easyHTTP/client/client.py | _resp_human | hxgz/easyHTTP | 0 | python | @classmethod
def _resp_human(cls, response):
if (response.code in (301, 302)):
return response.headers['Location']
ct = (cls.RESPONSE_CONTENT_TYPE or cgi.parse_header(response.headers['Content-Type'])[0])
if ct.startswith('text'):
return response.body.decode('utf-8')
elif (ct in ['a... | @classmethod
def _resp_human(cls, response):
if (response.code in (301, 302)):
return response.headers['Location']
ct = (cls.RESPONSE_CONTENT_TYPE or cgi.parse_header(response.headers['Content-Type'])[0])
if ct.startswith('text'):
return response.body.decode('utf-8')
elif (ct in ['a... |
6a2d0fe69014fd7a50f1199c23151aecc4a8d9cab2ae5fc6fb3551b99acdc797 | def transform(self, resp_data):
'需要继承,返回业务需要的数据'
return resp_data | 需要继承,返回业务需要的数据 | easyHTTP/client/client.py | transform | hxgz/easyHTTP | 0 | python | def transform(self, resp_data):
return resp_data | def transform(self, resp_data):
return resp_data<|docstring|>需要继承,返回业务需要的数据<|endoftext|> |
a0e063264fdc1d18b4aec4aa4153b68000583f4ff2cd5802ae294a4840542d65 | @pytest.mark.simulation
def test_run_npt():
'Test an npt run.'
snapshot = initialise.init_from_none(hoomd_args=HOOMD_ARGS)
simrun.run_npt(snapshot=snapshot, context=hoomd.context.initialize(''), sim_params=PARAMETERS)
assert True | Test an npt run. | test/simulation_test.py | test_run_npt | malramsay64/MD-Molecules-Hoomd | 1 | python | @pytest.mark.simulation
def test_run_npt():
snapshot = initialise.init_from_none(hoomd_args=HOOMD_ARGS)
simrun.run_npt(snapshot=snapshot, context=hoomd.context.initialize(), sim_params=PARAMETERS)
assert True | @pytest.mark.simulation
def test_run_npt():
snapshot = initialise.init_from_none(hoomd_args=HOOMD_ARGS)
simrun.run_npt(snapshot=snapshot, context=hoomd.context.initialize(), sim_params=PARAMETERS)
assert True<|docstring|>Test an npt run.<|endoftext|> |
89f08013175fbef9459ef3c006c47d7039b77829608075ec36e6c0798d540d06 | @given(integers(max_value=10, min_value=1))
@settings(max_examples=5, deadline=None)
@pytest.mark.hypothesis
def test_run_multiple_concurrent(max_initial):
'Test running multiple concurrent.'
snapshot = initialise.init_from_file(Path('test/data/Trimer-13.50-3.00.gsd'), hoomd_args=HOOMD_ARGS)
with paramsCont... | Test running multiple concurrent. | test/simulation_test.py | test_run_multiple_concurrent | malramsay64/MD-Molecules-Hoomd | 1 | python | @given(integers(max_value=10, min_value=1))
@settings(max_examples=5, deadline=None)
@pytest.mark.hypothesis
def test_run_multiple_concurrent(max_initial):
snapshot = initialise.init_from_file(Path('test/data/Trimer-13.50-3.00.gsd'), hoomd_args=HOOMD_ARGS)
with paramsContext(PARAMETERS, max_initial=max_ini... | @given(integers(max_value=10, min_value=1))
@settings(max_examples=5, deadline=None)
@pytest.mark.hypothesis
def test_run_multiple_concurrent(max_initial):
snapshot = initialise.init_from_file(Path('test/data/Trimer-13.50-3.00.gsd'), hoomd_args=HOOMD_ARGS)
with paramsContext(PARAMETERS, max_initial=max_ini... |
5f4180c4cdfae27caa362dc5599a5bb483f0b86086ddcc0f87c4fbb5d390908b | def test_thermo():
'Test the _set_thermo function works.\n\n There are many thermodynamic values set in the function and ensuring that\n they can all be initialised is crucial to a successful simulation.\n '
output = Path('test/tmp')
output.mkdir(exist_ok=True)
snapshot = initialise.init_from_n... | Test the _set_thermo function works.
There are many thermodynamic values set in the function and ensuring that
they can all be initialised is crucial to a successful simulation. | test/simulation_test.py | test_thermo | malramsay64/MD-Molecules-Hoomd | 1 | python | def test_thermo():
'Test the _set_thermo function works.\n\n There are many thermodynamic values set in the function and ensuring that\n they can all be initialised is crucial to a successful simulation.\n '
output = Path('test/tmp')
output.mkdir(exist_ok=True)
snapshot = initialise.init_from_n... | def test_thermo():
'Test the _set_thermo function works.\n\n There are many thermodynamic values set in the function and ensuring that\n they can all be initialised is crucial to a successful simulation.\n '
output = Path('test/tmp')
output.mkdir(exist_ok=True)
snapshot = initialise.init_from_n... |
c2e01b4e15797088df92bcd8098dfb28109460ffa625cff9cff25f3dc7d958b3 | @given(tuples(integers(max_value=30, min_value=5), integers(max_value=5, min_value=1)))
@settings(max_examples=10, deadline=None)
def test_orthorhombic_sims(cell_dimensions):
'Test the initialisation from a crystal unit cell.\n\n This also ensures there is no unusual things going on with the calculation\n of ... | Test the initialisation from a crystal unit cell.
This also ensures there is no unusual things going on with the calculation
of the orthorhombic unit cell. | test/simulation_test.py | test_orthorhombic_sims | malramsay64/MD-Molecules-Hoomd | 1 | python | @given(tuples(integers(max_value=30, min_value=5), integers(max_value=5, min_value=1)))
@settings(max_examples=10, deadline=None)
def test_orthorhombic_sims(cell_dimensions):
'Test the initialisation from a crystal unit cell.\n\n This also ensures there is no unusual things going on with the calculation\n of ... | @given(tuples(integers(max_value=30, min_value=5), integers(max_value=5, min_value=1)))
@settings(max_examples=10, deadline=None)
def test_orthorhombic_sims(cell_dimensions):
'Test the initialisation from a crystal unit cell.\n\n This also ensures there is no unusual things going on with the calculation\n of ... |
2e8cd77f6defecb2a335d13503e5dc2fbe79356b654783a288dbaf13bd9ea7d9 | def test_file_placement():
'Ensure files are located in the correct directory when created.'
outdir = Path('test/output')
current = list(Path.cwd().glob('*'))
for i in outdir.glob('*'):
os.remove(str(i))
with paramsContext(PARAMETERS, outfile_path=outdir, dynamics=True, temperature=3.0):
... | Ensure files are located in the correct directory when created. | test/simulation_test.py | test_file_placement | malramsay64/MD-Molecules-Hoomd | 1 | python | def test_file_placement():
outdir = Path('test/output')
current = list(Path.cwd().glob('*'))
for i in outdir.glob('*'):
os.remove(str(i))
with paramsContext(PARAMETERS, outfile_path=outdir, dynamics=True, temperature=3.0):
snapshot = initialise.init_from_none(hoomd_args=HOOMD_ARGS)
... | def test_file_placement():
outdir = Path('test/output')
current = list(Path.cwd().glob('*'))
for i in outdir.glob('*'):
os.remove(str(i))
with paramsContext(PARAMETERS, outfile_path=outdir, dynamics=True, temperature=3.0):
snapshot = initialise.init_from_none(hoomd_args=HOOMD_ARGS)
... |
b3e3a675505d18258177172ea3013d29a1dcdf07d4186de2ba6d7207eb177b0f | def test_dynamics_output():
'Ensure files are located in the correct directory when created.'
outdir = Path('test/output')
for i in outdir.glob('*'):
os.remove(str(i))
with paramsContext(PARAMETERS, outfile_path=outdir, dynamics=True, temperature=3.0):
snapshot = initialise.init_from_non... | Ensure files are located in the correct directory when created. | test/simulation_test.py | test_dynamics_output | malramsay64/MD-Molecules-Hoomd | 1 | python | def test_dynamics_output():
outdir = Path('test/output')
for i in outdir.glob('*'):
os.remove(str(i))
with paramsContext(PARAMETERS, outfile_path=outdir, dynamics=True, temperature=3.0):
snapshot = initialise.init_from_none(hoomd_args=HOOMD_ARGS)
simrun.run_npt(snapshot, hoomd.c... | def test_dynamics_output():
outdir = Path('test/output')
for i in outdir.glob('*'):
os.remove(str(i))
with paramsContext(PARAMETERS, outfile_path=outdir, dynamics=True, temperature=3.0):
snapshot = initialise.init_from_none(hoomd_args=HOOMD_ARGS)
simrun.run_npt(snapshot, hoomd.c... |
4a9254ead924179bb8eb9474144c13dbcfadc39e15ddd22a4cd9f80d065183ed | def printFullStockDetail(tickerSymbol):
"\n Print the unedited json dump for given stock ticker(s).\n\n Example: printFullStockDetail(['AAPL', 'VIE:BKS'])\n Prints: entire dump from getQuotes for both AAPL and VIE:BKS\n "
try:
print(json.dumps(getQuotes(tickerSymbol), indent=2))
except:
... | Print the unedited json dump for given stock ticker(s).
Example: printFullStockDetail(['AAPL', 'VIE:BKS'])
Prints: entire dump from getQuotes for both AAPL and VIE:BKS | realtime.py | printFullStockDetail | GitMazzone/tenlo-stock-watcher | 2 | python | def printFullStockDetail(tickerSymbol):
"\n Print the unedited json dump for given stock ticker(s).\n\n Example: printFullStockDetail(['AAPL', 'VIE:BKS'])\n Prints: entire dump from getQuotes for both AAPL and VIE:BKS\n "
try:
print(json.dumps(getQuotes(tickerSymbol), indent=2))
except:
... | def printFullStockDetail(tickerSymbol):
"\n Print the unedited json dump for given stock ticker(s).\n\n Example: printFullStockDetail(['AAPL', 'VIE:BKS'])\n Prints: entire dump from getQuotes for both AAPL and VIE:BKS\n "
try:
print(json.dumps(getQuotes(tickerSymbol), indent=2))
except:
... |
669944cd082cbd31b0cb6c9f246755728c62a6e44caba03486edfc91be20dfba | def getStockPrice(tickerSymbol):
'\n Return the value (as string) of the given stock ticker.\n Ex: getStockPrice("GOOG") returns 939.78\n\n Use regex to first get LastTradePrice price line, then use regex again\n to get only the dollar value.\n '
try:
company = json.dumps(getQuotes(ticker... | Return the value (as string) of the given stock ticker.
Ex: getStockPrice("GOOG") returns 939.78
Use regex to first get LastTradePrice price line, then use regex again
to get only the dollar value. | realtime.py | getStockPrice | GitMazzone/tenlo-stock-watcher | 2 | python | def getStockPrice(tickerSymbol):
'\n Return the value (as string) of the given stock ticker.\n Ex: getStockPrice("GOOG") returns 939.78\n\n Use regex to first get LastTradePrice price line, then use regex again\n to get only the dollar value.\n '
try:
company = json.dumps(getQuotes(ticker... | def getStockPrice(tickerSymbol):
'\n Return the value (as string) of the given stock ticker.\n Ex: getStockPrice("GOOG") returns 939.78\n\n Use regex to first get LastTradePrice price line, then use regex again\n to get only the dollar value.\n '
try:
company = json.dumps(getQuotes(ticker... |
4c6a7ef81324d9dd9d57894416c53df16c6747c473bc9fbd00d406cdd10096ca | def getStockExchange(tickerSymbol):
'\n Return the stock exchange (as string) of the given stock ticker.\n Ex: getStockExchange("GOOG") returns NASDAQ\n\n Use regex to first get full Exchange line, then use regex again to\n only get the quoted Exchange, then a final time to strip quotes.\n '
try:... | Return the stock exchange (as string) of the given stock ticker.
Ex: getStockExchange("GOOG") returns NASDAQ
Use regex to first get full Exchange line, then use regex again to
only get the quoted Exchange, then a final time to strip quotes. | realtime.py | getStockExchange | GitMazzone/tenlo-stock-watcher | 2 | python | def getStockExchange(tickerSymbol):
'\n Return the stock exchange (as string) of the given stock ticker.\n Ex: getStockExchange("GOOG") returns NASDAQ\n\n Use regex to first get full Exchange line, then use regex again to\n only get the quoted Exchange, then a final time to strip quotes.\n '
try:... | def getStockExchange(tickerSymbol):
'\n Return the stock exchange (as string) of the given stock ticker.\n Ex: getStockExchange("GOOG") returns NASDAQ\n\n Use regex to first get full Exchange line, then use regex again to\n only get the quoted Exchange, then a final time to strip quotes.\n '
try:... |
d552115dd67ad8e7a5efb14d5d964c207748f8e22af721b73182b78b740b43eb | def getLastTradeYear(tickerSymbol):
'\n Return the year (as string) the given stock was traded.\n Ex: getLastTradeYear("GOOG") returns 2017\n\n Use regex to first get full LastTradeDateTime line, then use regex again to\n only get the 4-digit year.\n '
try:
company = json.dumps(getQuotes(... | Return the year (as string) the given stock was traded.
Ex: getLastTradeYear("GOOG") returns 2017
Use regex to first get full LastTradeDateTime line, then use regex again to
only get the 4-digit year. | realtime.py | getLastTradeYear | GitMazzone/tenlo-stock-watcher | 2 | python | def getLastTradeYear(tickerSymbol):
'\n Return the year (as string) the given stock was traded.\n Ex: getLastTradeYear("GOOG") returns 2017\n\n Use regex to first get full LastTradeDateTime line, then use regex again to\n only get the 4-digit year.\n '
try:
company = json.dumps(getQuotes(... | def getLastTradeYear(tickerSymbol):
'\n Return the year (as string) the given stock was traded.\n Ex: getLastTradeYear("GOOG") returns 2017\n\n Use regex to first get full LastTradeDateTime line, then use regex again to\n only get the 4-digit year.\n '
try:
company = json.dumps(getQuotes(... |
3b108981247ffda55abf48473e1e701461bf69aab8092257616b0819bdd9048b | def getLastTradeDate(tickerSymbol):
'\n Return the month and day (as string) the given stock was traded.\n Ex: getLastTradeDate("GOOG") returns Jun 16\n\n Use regex to get full LastTradeDateTimeLong line, then use regex again to\n only get the month and day.\n '
try:
company = json.dumps(... | Return the month and day (as string) the given stock was traded.
Ex: getLastTradeDate("GOOG") returns Jun 16
Use regex to get full LastTradeDateTimeLong line, then use regex again to
only get the month and day. | realtime.py | getLastTradeDate | GitMazzone/tenlo-stock-watcher | 2 | python | def getLastTradeDate(tickerSymbol):
'\n Return the month and day (as string) the given stock was traded.\n Ex: getLastTradeDate("GOOG") returns Jun 16\n\n Use regex to get full LastTradeDateTimeLong line, then use regex again to\n only get the month and day.\n '
try:
company = json.dumps(... | def getLastTradeDate(tickerSymbol):
'\n Return the month and day (as string) the given stock was traded.\n Ex: getLastTradeDate("GOOG") returns Jun 16\n\n Use regex to get full LastTradeDateTimeLong line, then use regex again to\n only get the month and day.\n '
try:
company = json.dumps(... |
ddd3b2facb6d81b904b9c29e662d6869b63b1978370012c9c165b02cbaac2b5b | def getLastTradeHour(tickerSymbol):
'\n Return the hour and time zone (as string) the given stock was traded.\n Ex: getLastTradeHour("GOOG") returns 4:00PM EDT\n\n Use regex to get full LastTradeDateTimeLong line, then use regex again to\n only get the hour, AM/PM, and time zone.\n '
try:
... | Return the hour and time zone (as string) the given stock was traded.
Ex: getLastTradeHour("GOOG") returns 4:00PM EDT
Use regex to get full LastTradeDateTimeLong line, then use regex again to
only get the hour, AM/PM, and time zone. | realtime.py | getLastTradeHour | GitMazzone/tenlo-stock-watcher | 2 | python | def getLastTradeHour(tickerSymbol):
'\n Return the hour and time zone (as string) the given stock was traded.\n Ex: getLastTradeHour("GOOG") returns 4:00PM EDT\n\n Use regex to get full LastTradeDateTimeLong line, then use regex again to\n only get the hour, AM/PM, and time zone.\n '
try:
... | def getLastTradeHour(tickerSymbol):
'\n Return the hour and time zone (as string) the given stock was traded.\n Ex: getLastTradeHour("GOOG") returns 4:00PM EDT\n\n Use regex to get full LastTradeDateTimeLong line, then use regex again to\n only get the hour, AM/PM, and time zone.\n '
try:
... |
52921b1dcf5a22f5886a25b4713b81ceb4a63d0807726549ecd318ed995f5383 | def argparser():
' Command Line Argument Parsing'
parser = ArgumentParser(description='CLOSURE IDL File Generator')
parser.add_argument('-g', '--gedl', required=True, type=str, help='Input GEDL Filepath')
parser.add_argument('-o', '--ofile', required=True, type=str, help='Output Filepath')
parser.ad... | Command Line Argument Parsing | gedl/IDLGenerator.py | argparser | gaps-closure/capo | 1 | python | def argparser():
' '
parser = ArgumentParser(description='CLOSURE IDL File Generator')
parser.add_argument('-g', '--gedl', required=True, type=str, help='Input GEDL Filepath')
parser.add_argument('-o', '--ofile', required=True, type=str, help='Output Filepath')
parser.add_argument('-i', '--ipc', req... | def argparser():
' '
parser = ArgumentParser(description='CLOSURE IDL File Generator')
parser.add_argument('-g', '--gedl', required=True, type=str, help='Input GEDL Filepath')
parser.add_argument('-o', '--ofile', required=True, type=str, help='Output Filepath')
parser.add_argument('-i', '--ipc', req... |
530ef7e6f37fabf905d3f28b52cfada90af940b3c6001eb3fcddda52809060cd | def get_gedl_schema(schema_location):
'Load the schema json to verify against'
basepath = ''
if (len(sys.path) > 1):
basepath = sys.path[0]
path = os.path.join(basepath, schema_location)
if (not os.path.exists(path)):
path = schema_location
if (not os.path.exists(path)):
... | Load the schema json to verify against | gedl/IDLGenerator.py | get_gedl_schema | gaps-closure/capo | 1 | python | def get_gedl_schema(schema_location):
basepath =
if (len(sys.path) > 1):
basepath = sys.path[0]
path = os.path.join(basepath, schema_location)
if (not os.path.exists(path)):
path = schema_location
if (not os.path.exists(path)):
raise IOError(('Unable to fild cle... | def get_gedl_schema(schema_location):
basepath =
if (len(sys.path) > 1):
basepath = sys.path[0]
path = os.path.join(basepath, schema_location)
if (not os.path.exists(path)):
path = schema_location
if (not os.path.exists(path)):
raise IOError(('Unable to fild cle... |
06a5b008d65e268a766fbf2e401d4cec3155545531c7d617eafa0ba5704bc7c4 | def check_jsonschema_version():
'validate the json schema version is new enogh to process\n Draft 7 schemas\n '
if (jsonschema.__version__ < '3.2.0'):
raise ModuleNotFoundError('Newer version of jsonschema module required (>= 3.2.0)') | validate the json schema version is new enogh to process
Draft 7 schemas | gedl/IDLGenerator.py | check_jsonschema_version | gaps-closure/capo | 1 | python | def check_jsonschema_version():
'validate the json schema version is new enogh to process\n Draft 7 schemas\n '
if (jsonschema.__version__ < '3.2.0'):
raise ModuleNotFoundError('Newer version of jsonschema module required (>= 3.2.0)') | def check_jsonschema_version():
'validate the json schema version is new enogh to process\n Draft 7 schemas\n '
if (jsonschema.__version__ < '3.2.0'):
raise ModuleNotFoundError('Newer version of jsonschema module required (>= 3.2.0)')<|docstring|>validate the json schema version is new enogh t... |
82ab4f0919cc22a8f477219dd4a62fff77c5d0d93bbb149de516a77f79ff7f1e | def validate_gedl(gedl_json, schema_json):
'validate the GEDL entry is valid against the shcema'
try:
jsonschema.validate(gedl_json, schema)
except Exception as e:
print('')
print('Error parsing GEDL')
raise
print('')
print('GEDL is valid') | validate the GEDL entry is valid against the shcema | gedl/IDLGenerator.py | validate_gedl | gaps-closure/capo | 1 | python | def validate_gedl(gedl_json, schema_json):
try:
jsonschema.validate(gedl_json, schema)
except Exception as e:
print()
print('Error parsing GEDL')
raise
print()
print('GEDL is valid') | def validate_gedl(gedl_json, schema_json):
try:
jsonschema.validate(gedl_json, schema)
except Exception as e:
print()
print('Error parsing GEDL')
raise
print()
print('GEDL is valid')<|docstring|>validate the GEDL entry is valid against the shcema<|endoftext|> |
687779a68ad4aedd3ecba9d914d93ba3f23aadc6fdf28b982d503f52e76bb689 | def generate_idl(gedl, args):
'Generate the output IDL file'
with open(args.ofile, 'w') as idl_file:
idl_file.write('struct NextRPC {\n\tint mux;\n\tint sec;\n\tint typ;\n};')
idl_file.write('\n\nstruct Okay {\n\tint x;\n};')
for enclavePair in gedl['gedl']:
for call in encla... | Generate the output IDL file | gedl/IDLGenerator.py | generate_idl | gaps-closure/capo | 1 | python | def generate_idl(gedl, args):
with open(args.ofile, 'w') as idl_file:
idl_file.write('struct NextRPC {\n\tint mux;\n\tint sec;\n\tint typ;\n};')
idl_file.write('\n\nstruct Okay {\n\tint x;\n};')
for enclavePair in gedl['gedl']:
for call in enclavePair['calls']:
... | def generate_idl(gedl, args):
with open(args.ofile, 'w') as idl_file:
idl_file.write('struct NextRPC {\n\tint mux;\n\tint sec;\n\tint typ;\n};')
idl_file.write('\n\nstruct Okay {\n\tint x;\n};')
for enclavePair in gedl['gedl']:
for call in enclavePair['calls']:
... |
2a4df668b9ead9582fa005ec99407b0aff620e72f683e65822c8e27e760b5884 | def main():
'IDL Generator entry point'
args = argparser()
with open(args.gedl) as edl_file:
gedl = json.load(edl_file)
if (not args.liberal):
check_jsonschema_version()
schema = get_gedl_schema(args.schema)
try:
jsonschema.validate(gedl, s... | IDL Generator entry point | gedl/IDLGenerator.py | main | gaps-closure/capo | 1 | python | def main():
args = argparser()
with open(args.gedl) as edl_file:
gedl = json.load(edl_file)
if (not args.liberal):
check_jsonschema_version()
schema = get_gedl_schema(args.schema)
try:
jsonschema.validate(gedl, schema)
except j... | def main():
args = argparser()
with open(args.gedl) as edl_file:
gedl = json.load(edl_file)
if (not args.liberal):
check_jsonschema_version()
schema = get_gedl_schema(args.schema)
try:
jsonschema.validate(gedl, schema)
except j... |
338647debf2515afda1b0d2e166368a6ab657c105b2f30e741f0f9570dbba2e5 | def save(self, *args, **kwargs):
'Generate a permalink for the entry.'
super(XTMFundocEntry, self).save(*args, **kwargs)
if (not self.permalink):
self.permalink = nice_url_name(self.name.replace(':', '-'))
super(XTMFundocEntry, self).save(*args, **kwargs) | Generate a permalink for the entry. | src/apps/extempore/models.py | save | lambdamusic/xtm-docs | 0 | python | def save(self, *args, **kwargs):
super(XTMFundocEntry, self).save(*args, **kwargs)
if (not self.permalink):
self.permalink = nice_url_name(self.name.replace(':', '-'))
super(XTMFundocEntry, self).save(*args, **kwargs) | def save(self, *args, **kwargs):
super(XTMFundocEntry, self).save(*args, **kwargs)
if (not self.permalink):
self.permalink = nice_url_name(self.name.replace(':', '-'))
super(XTMFundocEntry, self).save(*args, **kwargs)<|docstring|>Generate a permalink for the entry.<|endoftext|> |
eb1282e19739477327e231bebeab0843623e5032d54089b12f276a6f431aa85d | @classmethod
def cleanup_permalinks(self, *args, **kwargs):
'Ensure each permalink is unique.\n\t\tIf two functions have the same name, add a number to the end.\n\t\tNOTE run this utility after data input is complete.\n\t\t'
for each in self.objects.all().order_by('-id'):
test = XTMFundocEntry.objects.f... | Ensure each permalink is unique.
If two functions have the same name, add a number to the end.
NOTE run this utility after data input is complete. | src/apps/extempore/models.py | cleanup_permalinks | lambdamusic/xtm-docs | 0 | python | @classmethod
def cleanup_permalinks(self, *args, **kwargs):
'Ensure each permalink is unique.\n\t\tIf two functions have the same name, add a number to the end.\n\t\tNOTE run this utility after data input is complete.\n\t\t'
for each in self.objects.all().order_by('-id'):
test = XTMFundocEntry.objects.f... | @classmethod
def cleanup_permalinks(self, *args, **kwargs):
'Ensure each permalink is unique.\n\t\tIf two functions have the same name, add a number to the end.\n\t\tNOTE run this utility after data input is complete.\n\t\t'
for each in self.objects.all().order_by('-id'):
test = XTMFundocEntry.objects.f... |
0f75f61fa5c6be54d3215317abcd63b1c70159fe75671a5d8fca2aad915da6e5 | def save_model(self, request, obj, form, change):
'adds the user information when the rec is saved'
if (getattr(obj, 'created_by', None) is None):
obj.created_by = request.user
obj.updated_by = request.user
obj.save() | adds the user information when the rec is saved | src/apps/extempore/models.py | save_model | lambdamusic/xtm-docs | 0 | python | def save_model(self, request, obj, form, change):
if (getattr(obj, 'created_by', None) is None):
obj.created_by = request.user
obj.updated_by = request.user
obj.save() | def save_model(self, request, obj, form, change):
if (getattr(obj, 'created_by', None) is None):
obj.created_by = request.user
obj.updated_by = request.user
obj.save()<|docstring|>adds the user information when the rec is saved<|endoftext|> |
4b2bc1322e938fcaa6cbc7653c6ce75bc3173b4cdefe1faeac1c1e6330bd2107 | def index(request):
'Create variable to call Todolist table and sort it by id'
todo_items = Todolist.objects.order_by('id')
'Create instance of the form'
form = TodoListForm()
'Add todo_items into dictionary with name context'
context = {'todo_items': todo_items, 'form': form}
return render(... | Create variable to call Todolist table and sort it by id | todolist/views.py | index | ivancekic/todoapp | 0 | python | def index(request):
todo_items = Todolist.objects.order_by('id')
'Create instance of the form'
form = TodoListForm()
'Add todo_items into dictionary with name context'
context = {'todo_items': todo_items, 'form': form}
return render(request, 'todolist/index.html', context) | def index(request):
todo_items = Todolist.objects.order_by('id')
'Create instance of the form'
form = TodoListForm()
'Add todo_items into dictionary with name context'
context = {'todo_items': todo_items, 'form': form}
return render(request, 'todolist/index.html', context)<|docstring|>Creat... |
7e09079f68d6e1773e1de788d0f20103b215d3ab5f78c3b34104815ae16b32f5 | @class_schedule_bp.route('/get')
@check_access_token
@get_school_config
def get():
'\n 获取课程表数据\n :return:\n '
r = Redis(host='localhost', password=getenv('REDIS_PASSWORD'), port=6379)
class_schedule_version = r.get(f'class-schedule-version-{g.user.id}')
if (class_schedule_version is None):
... | 获取课程表数据
:return: | nfu/api_bp/class_schedule.py | get | EachinChung/nfu_with_zhuzhu | 3 | python | @class_schedule_bp.route('/get')
@check_access_token
@get_school_config
def get():
'\n 获取课程表数据\n :return:\n '
r = Redis(host='localhost', password=getenv('REDIS_PASSWORD'), port=6379)
class_schedule_version = r.get(f'class-schedule-version-{g.user.id}')
if (class_schedule_version is None):
... | @class_schedule_bp.route('/get')
@check_access_token
@get_school_config
def get():
'\n 获取课程表数据\n :return:\n '
r = Redis(host='localhost', password=getenv('REDIS_PASSWORD'), port=6379)
class_schedule_version = r.get(f'class-schedule-version-{g.user.id}')
if (class_schedule_version is None):
... |
db7a8243a58084c1f96ac101c86bdc1dea5db5711be8ffd9c059b286338b7982 | @class_schedule_bp.route('/update')
@check_access_token
@get_school_config
def update():
'\n 更新课程表数据\n :return:\n '
r = Redis(host='localhost', password=getenv('REDIS_PASSWORD'), port=6379)
try:
return jsonify({'code': '1000', 'message': db_update(g.user.id, g.user.jw_pwd, g.school_config['... | 更新课程表数据
:return: | nfu/api_bp/class_schedule.py | update | EachinChung/nfu_with_zhuzhu | 3 | python | @class_schedule_bp.route('/update')
@check_access_token
@get_school_config
def update():
'\n 更新课程表数据\n :return:\n '
r = Redis(host='localhost', password=getenv('REDIS_PASSWORD'), port=6379)
try:
return jsonify({'code': '1000', 'message': db_update(g.user.id, g.user.jw_pwd, g.school_config['... | @class_schedule_bp.route('/update')
@check_access_token
@get_school_config
def update():
'\n 更新课程表数据\n :return:\n '
r = Redis(host='localhost', password=getenv('REDIS_PASSWORD'), port=6379)
try:
return jsonify({'code': '1000', 'message': db_update(g.user.id, g.user.jw_pwd, g.school_config['... |
76b6638bc5593a5a223f0cf8a0afce34c09a6e95fe4e8613586ac3cb1c3ec509 | @class_schedule_bp.route('/version')
@check_access_token
def version():
'\n 获取缓存的版本号\n :return:\n '
r = Redis(host='localhost', password=getenv('REDIS_PASSWORD'), port=6379)
class_schedule_version = r.get(f'class-schedule-version-{g.user.id}')
if (class_schedule_version is None):
class_... | 获取缓存的版本号
:return: | nfu/api_bp/class_schedule.py | version | EachinChung/nfu_with_zhuzhu | 3 | python | @class_schedule_bp.route('/version')
@check_access_token
def version():
'\n 获取缓存的版本号\n :return:\n '
r = Redis(host='localhost', password=getenv('REDIS_PASSWORD'), port=6379)
class_schedule_version = r.get(f'class-schedule-version-{g.user.id}')
if (class_schedule_version is None):
class_... | @class_schedule_bp.route('/version')
@check_access_token
def version():
'\n 获取缓存的版本号\n :return:\n '
r = Redis(host='localhost', password=getenv('REDIS_PASSWORD'), port=6379)
class_schedule_version = r.get(f'class-schedule-version-{g.user.id}')
if (class_schedule_version is None):
class_... |
779d919f30d49700f43001447edea78097a0748ab0704e320c2665f1deab7c40 | @class_schedule_bp.route('/config')
@check_access_token
@get_school_config
def school_config():
'\n 获取学年配置\n '
return jsonify({'code': '1000', 'message': g.school_config}) | 获取学年配置 | nfu/api_bp/class_schedule.py | school_config | EachinChung/nfu_with_zhuzhu | 3 | python | @class_schedule_bp.route('/config')
@check_access_token
@get_school_config
def school_config():
'\n \n '
return jsonify({'code': '1000', 'message': g.school_config}) | @class_schedule_bp.route('/config')
@check_access_token
@get_school_config
def school_config():
'\n \n '
return jsonify({'code': '1000', 'message': g.school_config})<|docstring|>获取学年配置<|endoftext|> |
635c8752f58020705301527a85eee5a7e827820667a2e00e45626a1f552ee3cb | def get_payment_gateway_controller(payment_gateway):
'Return payment gateway controller'
gateway = frappe.get_doc('Payment Gateway', payment_gateway)
if (gateway.gateway_controller is None):
try:
return frappe.get_doc('{0} Settings'.format(payment_gateway))
except Exception:
... | Return payment gateway controller | frappe/integrations/utils.py | get_payment_gateway_controller | ektai/frappe3 | 0 | python | def get_payment_gateway_controller(payment_gateway):
gateway = frappe.get_doc('Payment Gateway', payment_gateway)
if (gateway.gateway_controller is None):
try:
return frappe.get_doc('{0} Settings'.format(payment_gateway))
except Exception:
frappe.throw(_('{0} Setting... | def get_payment_gateway_controller(payment_gateway):
gateway = frappe.get_doc('Payment Gateway', payment_gateway)
if (gateway.gateway_controller is None):
try:
return frappe.get_doc('{0} Settings'.format(payment_gateway))
except Exception:
frappe.throw(_('{0} Setting... |
984f9dda3130dab953be563f35fca0130a9db1f2fe1fdb30626d3fc6a09ed0d7 | def winapi_result(result):
'Validate WINAPI BOOL result, raise exception if failed'
if (not result):
raise WinApiException(('%d (%x): %s' % (ctypes.GetLastError(), ctypes.GetLastError(), ctypes.FormatError())))
return result | Validate WINAPI BOOL result, raise exception if failed | pywinusb/hid/winapi.py | winapi_result | SUSHMITAH/pywinusb | 157 | python | def winapi_result(result):
if (not result):
raise WinApiException(('%d (%x): %s' % (ctypes.GetLastError(), ctypes.GetLastError(), ctypes.FormatError())))
return result | def winapi_result(result):
if (not result):
raise WinApiException(('%d (%x): %s' % (ctypes.GetLastError(), ctypes.GetLastError(), ctypes.FormatError())))
return result<|docstring|>Validate WINAPI BOOL result, raise exception if failed<|endoftext|> |
26efe1799d8cad0241c11371ae78740c85c01306a2f3fa95705d91cf9fdcbe62 | def GetHidGuid():
'Get system-defined GUID for HIDClass devices'
hid_guid = GUID()
hid_dll.HidD_GetHidGuid(byref(hid_guid))
return hid_guid | Get system-defined GUID for HIDClass devices | pywinusb/hid/winapi.py | GetHidGuid | SUSHMITAH/pywinusb | 157 | python | def GetHidGuid():
hid_guid = GUID()
hid_dll.HidD_GetHidGuid(byref(hid_guid))
return hid_guid | def GetHidGuid():
hid_guid = GUID()
hid_dll.HidD_GetHidGuid(byref(hid_guid))
return hid_guid<|docstring|>Get system-defined GUID for HIDClass devices<|endoftext|> |
d69867a9c76bfc6f8fc693ddefe7c7586c7d2dfabe23c9fa23e7e72ea89089c0 | def enum_device_interfaces(h_info, guid):
'Function generator that returns a device_interface_data enumerator\n for the given device interface info and GUID parameters\n '
dev_interface_data = SP_DEVICE_INTERFACE_DATA()
dev_interface_data.cb_size = sizeof(dev_interface_data)
device_index = 0
w... | Function generator that returns a device_interface_data enumerator
for the given device interface info and GUID parameters | pywinusb/hid/winapi.py | enum_device_interfaces | SUSHMITAH/pywinusb | 157 | python | def enum_device_interfaces(h_info, guid):
'Function generator that returns a device_interface_data enumerator\n for the given device interface info and GUID parameters\n '
dev_interface_data = SP_DEVICE_INTERFACE_DATA()
dev_interface_data.cb_size = sizeof(dev_interface_data)
device_index = 0
w... | def enum_device_interfaces(h_info, guid):
'Function generator that returns a device_interface_data enumerator\n for the given device interface info and GUID parameters\n '
dev_interface_data = SP_DEVICE_INTERFACE_DATA()
dev_interface_data.cb_size = sizeof(dev_interface_data)
device_index = 0
w... |
e3a24310edaba9ab713285b18368a938d0de830c86a30cfef14908015b4785fb | def get_device_path(h_info, interface_data, ptr_info_data=None):
'"Returns Hardware device path\n Parameters:\n h_info, interface set info handler\n interface_data, device interface enumeration data\n ptr_info_data, pointer to SP_DEVINFO_DATA() instance to receive details\n '
... | "Returns Hardware device path
Parameters:
h_info, interface set info handler
interface_data, device interface enumeration data
ptr_info_data, pointer to SP_DEVINFO_DATA() instance to receive details | pywinusb/hid/winapi.py | get_device_path | SUSHMITAH/pywinusb | 157 | python | def get_device_path(h_info, interface_data, ptr_info_data=None):
'"Returns Hardware device path\n Parameters:\n h_info, interface set info handler\n interface_data, device interface enumeration data\n ptr_info_data, pointer to SP_DEVINFO_DATA() instance to receive details\n '
... | def get_device_path(h_info, interface_data, ptr_info_data=None):
'"Returns Hardware device path\n Parameters:\n h_info, interface set info handler\n interface_data, device interface enumeration data\n ptr_info_data, pointer to SP_DEVINFO_DATA() instance to receive details\n '
... |
56df97d4001876e8ba453ba10ab51774287405ff934eace810fe481dddad6c94 | def get_string(self):
'Retreive stored string'
return ctypes.wstring_at(byref(self, sizeof(DWORD))) | Retreive stored string | pywinusb/hid/winapi.py | get_string | SUSHMITAH/pywinusb | 157 | python | def get_string(self):
return ctypes.wstring_at(byref(self, sizeof(DWORD))) | def get_string(self):
return ctypes.wstring_at(byref(self, sizeof(DWORD)))<|docstring|>Retreive stored string<|endoftext|> |
86b9b6e2a33b0a049ba70a1d1b85748b14c419ceae2ab516dd93e64e8c01b2b5 | def __enter__(self):
'Context manager initializer, calls self.open()'
return self.open() | Context manager initializer, calls self.open() | pywinusb/hid/winapi.py | __enter__ | SUSHMITAH/pywinusb | 157 | python | def __enter__(self):
return self.open() | def __enter__(self):
return self.open()<|docstring|>Context manager initializer, calls self.open()<|endoftext|> |
81a2bba443b2acf85ccc07472e2ea8821859c211e0778cd149520ef4141229ea | def open(self):
'\n Calls SetupDiGetClassDevs to obtain a handle to an opaque device\n information set that describes the device interfaces supported by all\n the USB collections currently installed in the system. The\n application should specify DIGCF.PRESENT and DIGCF.INTERFACEDEVICE\n... | Calls SetupDiGetClassDevs to obtain a handle to an opaque device
information set that describes the device interfaces supported by all
the USB collections currently installed in the system. The
application should specify DIGCF.PRESENT and DIGCF.INTERFACEDEVICE
in the Flags parameter passed to SetupDiGetClassDevs. | pywinusb/hid/winapi.py | open | SUSHMITAH/pywinusb | 157 | python | def open(self):
'\n Calls SetupDiGetClassDevs to obtain a handle to an opaque device\n information set that describes the device interfaces supported by all\n the USB collections currently installed in the system. The\n application should specify DIGCF.PRESENT and DIGCF.INTERFACEDEVICE\n... | def open(self):
'\n Calls SetupDiGetClassDevs to obtain a handle to an opaque device\n information set that describes the device interfaces supported by all\n the USB collections currently installed in the system. The\n application should specify DIGCF.PRESENT and DIGCF.INTERFACEDEVICE\n... |
99207b23ce48a0f2496da7ddca7e413f8457b73444e38c8e73ad6c691ed2674d | def __exit__(self, exc_type, exc_value, traceback):
'Context manager clean up, calls self.close()'
self.close() | Context manager clean up, calls self.close() | pywinusb/hid/winapi.py | __exit__ | SUSHMITAH/pywinusb | 157 | python | def __exit__(self, exc_type, exc_value, traceback):
self.close() | def __exit__(self, exc_type, exc_value, traceback):
self.close()<|docstring|>Context manager clean up, calls self.close()<|endoftext|> |
08010c4ad8316173278bdaa638f56007c5899a19019235893f450b09654856ea | def close(self):
'Destroy allocated storage'
if (self.h_info and (self.h_info != INVALID_HANDLE_VALUE)):
SetupDiDestroyDeviceInfoList(self.h_info)
self.h_info = None | Destroy allocated storage | pywinusb/hid/winapi.py | close | SUSHMITAH/pywinusb | 157 | python | def close(self):
if (self.h_info and (self.h_info != INVALID_HANDLE_VALUE)):
SetupDiDestroyDeviceInfoList(self.h_info)
self.h_info = None | def close(self):
if (self.h_info and (self.h_info != INVALID_HANDLE_VALUE)):
SetupDiDestroyDeviceInfoList(self.h_info)
self.h_info = None<|docstring|>Destroy allocated storage<|endoftext|> |
53144b2cdcec429a8b64f79004f8eef63ac3c0f3e53cb11307aac3bd8f73a13f | def get_auth(self):
'\n\t\tThis function mounts a Google Drive in Google Colab. The objective is\n\t\tto access the json credential directly from Google Drive since Google\n\t\tColab creates new instance each time, there is no other way to locate\n\t\tthe credentialself\n\n\t\tThe function also gives access to SDK\... | This function mounts a Google Drive in Google Colab. The objective is
to access the json credential directly from Google Drive since Google
Colab creates new instance each time, there is no other way to locate
the credentialself
The function also gives access to SDK | GoogleDrivePy/google_authorization/connect_service_colab.py | get_auth | thomaspernet/GoogleDrive-python | 0 | python | def get_auth(self):
'\n\t\tThis function mounts a Google Drive in Google Colab. The objective is\n\t\tto access the json credential directly from Google Drive since Google\n\t\tColab creates new instance each time, there is no other way to locate\n\t\tthe credentialself\n\n\t\tThe function also gives access to SDK\... | def get_auth(self):
'\n\t\tThis function mounts a Google Drive in Google Colab. The objective is\n\t\tto access the json credential directly from Google Drive since Google\n\t\tColab creates new instance each time, there is no other way to locate\n\t\tthe credentialself\n\n\t\tThe function also gives access to SDK\... |
4462865c76bf444b6a33de8e5856c14e7e1c37f6f4b72b6c6d62d00d5bf219f1 | def check_argv():
'Check the command line arguments.'
parser = argparse.ArgumentParser(description=__doc__.strip().split('\n')[0], add_help=False)
parser.add_argument('model', help='input VQ representations')
parser.add_argument('dataset', type=str, help='input dataset')
parser.add_argument('split',... | Check the command line arguments. | vq_phoneseg.py | check_argv | kamperh/vqwordseg | 10 | python | def check_argv():
parser = argparse.ArgumentParser(description=__doc__.strip().split('\n')[0], add_help=False)
parser.add_argument('model', help='input VQ representations')
parser.add_argument('dataset', type=str, help='input dataset')
parser.add_argument('split', type=str, help='input split')
... | def check_argv():
parser = argparse.ArgumentParser(description=__doc__.strip().split('\n')[0], add_help=False)
parser.add_argument('model', help='input VQ representations')
parser.add_argument('dataset', type=str, help='input dataset')
parser.add_argument('split', type=str, help='input split')
... |
795beff108b9e479ffd57eb6646a88d97386f4618d098f2183330817a767b87d | @classmethod
def _replaceNonBreakingChars(cls, text: str) -> str:
'\n Replace non-breaking space and dash with html entities for better readability of wiki-pages sources and safe\n copy-pasting to editors without proper Unicode support\n\n :param str text:\n :return: modified text\n ... | Replace non-breaking space and dash with html entities for better readability of wiki-pages sources and safe
copy-pasting to editors without proper Unicode support
:param str text:
:return: modified text | writer2wiki/convert/WikiTextPortionDecorator.py | _replaceNonBreakingChars | AlexanderMalahov/writer2wiki | 4 | python | @classmethod
def _replaceNonBreakingChars(cls, text: str) -> str:
'\n Replace non-breaking space and dash with html entities for better readability of wiki-pages sources and safe\n copy-pasting to editors without proper Unicode support\n\n :param str text:\n :return: modified text\n ... | @classmethod
def _replaceNonBreakingChars(cls, text: str) -> str:
'\n Replace non-breaking space and dash with html entities for better readability of wiki-pages sources and safe\n copy-pasting to editors without proper Unicode support\n\n :param str text:\n :return: modified text\n ... |
fde64773d687d23ac0dc17710eedda34e05a2609d59bedc32fe98957506bd215 | def applyCharPosture(self, posture):
'italic etc'
if (posture != FontSlant.ITALIC):
print('unexpected posture:', posture)
self._surround("''") | italic etc | writer2wiki/convert/WikiTextPortionDecorator.py | applyCharPosture | AlexanderMalahov/writer2wiki | 4 | python | def applyCharPosture(self, posture):
if (posture != FontSlant.ITALIC):
print('unexpected posture:', posture)
self._surround() | def applyCharPosture(self, posture):
if (posture != FontSlant.ITALIC):
print('unexpected posture:', posture)
self._surround()<|docstring|>italic etc<|endoftext|> |
dd41ee5238b3930cfff0bf80f94ebed8ecc4ec08daed006e88f5a90fc776c1c1 | def __init__(self, active=None, mfrom=None, to=None):
'Constructor for the MondayModel class'
self.active = active
self.mfrom = mfrom
self.to = to | Constructor for the MondayModel class | meraki_sdk/models/monday_model.py | __init__ | meraki/meraki-python-sdk | 37 | python | def __init__(self, active=None, mfrom=None, to=None):
self.active = active
self.mfrom = mfrom
self.to = to | def __init__(self, active=None, mfrom=None, to=None):
self.active = active
self.mfrom = mfrom
self.to = to<|docstring|>Constructor for the MondayModel class<|endoftext|> |
1d30014987ad0cac8cf119f5da003d69c2c4d8879c19956b24738ec54c79b26a | @classmethod
def from_dictionary(cls, dictionary):
"Creates an instance of this model from a dictionary\n\n Args:\n dictionary (dictionary): A dictionary representation of the object as\n obtained from the deserialization of the server's response. The keys\n MUST match proper... | Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
Returns:
object: An instance of this structure class. | meraki_sdk/models/monday_model.py | from_dictionary | meraki/meraki-python-sdk | 37 | python | @classmethod
def from_dictionary(cls, dictionary):
"Creates an instance of this model from a dictionary\n\n Args:\n dictionary (dictionary): A dictionary representation of the object as\n obtained from the deserialization of the server's response. The keys\n MUST match proper... | @classmethod
def from_dictionary(cls, dictionary):
"Creates an instance of this model from a dictionary\n\n Args:\n dictionary (dictionary): A dictionary representation of the object as\n obtained from the deserialization of the server's response. The keys\n MUST match proper... |
3d16d44ef285a592017d25ddc8f4e3365bd267dbc806d5b8a4f4ee699d07477c | def custom_exception_handler(exc, context):
'\n Add status_code to the returned exception response\n\n :param exc:\n :param context:\n :return: Response\n '
response = exception_handler(exc, context)
if response:
response.data['status_code'] = response.status_code
return respo... | Add status_code to the returned exception response
:param exc:
:param context:
:return: Response | api/utils/errors.py | custom_exception_handler | Nta1e/pizza_api | 1 | python | def custom_exception_handler(exc, context):
'\n Add status_code to the returned exception response\n\n :param exc:\n :param context:\n :return: Response\n '
response = exception_handler(exc, context)
if response:
response.data['status_code'] = response.status_code
return respo... | def custom_exception_handler(exc, context):
'\n Add status_code to the returned exception response\n\n :param exc:\n :param context:\n :return: Response\n '
response = exception_handler(exc, context)
if response:
response.data['status_code'] = response.status_code
return respo... |
b329c9c911efddbff58efc65df42534f5307b646a92a0054f91276ca3bd6a2c1 | def handle(error):
'\n Handle specific error responses\n :param error:\n :return: Exception\n '
error_response = {'Error': {'message': error.message}}
if (int(error.status_code) == 400):
raise ValidationError(error_response)
elif (int(error.status_code) == 404):
raise NotFoun... | Handle specific error responses
:param error:
:return: Exception | api/utils/errors.py | handle | Nta1e/pizza_api | 1 | python | def handle(error):
'\n Handle specific error responses\n :param error:\n :return: Exception\n '
error_response = {'Error': {'message': error.message}}
if (int(error.status_code) == 400):
raise ValidationError(error_response)
elif (int(error.status_code) == 404):
raise NotFoun... | def handle(error):
'\n Handle specific error responses\n :param error:\n :return: Exception\n '
error_response = {'Error': {'message': error.message}}
if (int(error.status_code) == 400):
raise ValidationError(error_response)
elif (int(error.status_code) == 404):
raise NotFoun... |
f156d4cadb219a62a53835bb489f18155007538cffdae5e5d5ffaff4c371bd3a | def get_seq_mask(sequence, dataset, dimensions, neighborhood_size, grid_size):
'\n Get the obstacle grid masks for all the frames in the sequence\n params:\n sequence : A numpy matrix of shape SL x MNP x 3\n dimensions : This will be a list [width, height]\n neighborhood_size : Scalar value represent... | Get the obstacle grid masks for all the frames in the sequence
params:
sequence : A numpy matrix of shape SL x MNP x 3
dimensions : This will be a list [width, height]
neighborhood_size : Scalar value representing the size of neighborhood considered
grid_size : Scalar value representing the size of the grid discretizat... | social-lstm-pytorch-group-distance-obst/obst_grid.py | get_seq_mask | mmlab-cv/Group-Obstacle-LSTM | 4 | python | def get_seq_mask(sequence, dataset, dimensions, neighborhood_size, grid_size):
'\n Get the obstacle grid masks for all the frames in the sequence\n params:\n sequence : A numpy matrix of shape SL x MNP x 3\n dimensions : This will be a list [width, height]\n neighborhood_size : Scalar value represent... | def get_seq_mask(sequence, dataset, dimensions, neighborhood_size, grid_size):
'\n Get the obstacle grid masks for all the frames in the sequence\n params:\n sequence : A numpy matrix of shape SL x MNP x 3\n dimensions : This will be a list [width, height]\n neighborhood_size : Scalar value represent... |
398d4a47c63e218b805a444bc8e8316ad29720eaf4ff6a3783edd0349c5672d4 | def __init__(self, bot):
'\n __init__ del bots\n '
secret = os.getenv('FAUNADB_SECRET_KEY')
self.bot = bot
self.db = DB(secret)
self.get_list()
self.channel_test = 776196097131413534
self.channel_cafe = 594935077637718027
self.guild_id = 594363964499165194 | __init__ del bots | src/modules/newMembers.py | __init__ | ljgago/matebot | 6 | python | def __init__(self, bot):
'\n \n '
secret = os.getenv('FAUNADB_SECRET_KEY')
self.bot = bot
self.db = DB(secret)
self.get_list()
self.channel_test = 776196097131413534
self.channel_cafe = 594935077637718027
self.guild_id = 594363964499165194 | def __init__(self, bot):
'\n \n '
secret = os.getenv('FAUNADB_SECRET_KEY')
self.bot = bot
self.db = DB(secret)
self.get_list()
self.channel_test = 776196097131413534
self.channel_cafe = 594935077637718027
self.guild_id = 594363964499165194<|docstring|>__init__ del bots<|end... |
2d3a9965169efd7f3bdb3987271c0bca4f3b71b774786f6a15c0c148761704e9 | def get_list(self):
'\n Descripción: Obtiene la lista de usuarios nuevos y otros parámetros para análisis\n Precondición: Debe existir la colección con el documento\n Poscondición: Se obtiene la lista de usuarios nuevos, la condición de usuarios nuevos, el tiempo de inicio y el tiempo de espera... | Descripción: Obtiene la lista de usuarios nuevos y otros parámetros para análisis
Precondición: Debe existir la colección con el documento
Poscondición: Se obtiene la lista de usuarios nuevos, la condición de usuarios nuevos, el tiempo de inicio y el tiempo de espera | src/modules/newMembers.py | get_list | ljgago/matebot | 6 | python | def get_list(self):
'\n Descripción: Obtiene la lista de usuarios nuevos y otros parámetros para análisis\n Precondición: Debe existir la colección con el documento\n Poscondición: Se obtiene la lista de usuarios nuevos, la condición de usuarios nuevos, el tiempo de inicio y el tiempo de espera... | def get_list(self):
'\n Descripción: Obtiene la lista de usuarios nuevos y otros parámetros para análisis\n Precondición: Debe existir la colección con el documento\n Poscondición: Se obtiene la lista de usuarios nuevos, la condición de usuarios nuevos, el tiempo de inicio y el tiempo de espera... |
d6faea882b06c77e5308cf55c22eac23a4ff0a330f5e97d6876922c970673296 | def update_list(self, list_users: list, users: int, time_zero: float, delta: float):
'\n Descripción: Actualiza la lista de usuarios nuevos, la condición de usuarios nuevos y el tiempo de espera\n Precondición: Debe existir la colección con el documento\n Poscondición: La lista de usuarios nuev... | Descripción: Actualiza la lista de usuarios nuevos, la condición de usuarios nuevos y el tiempo de espera
Precondición: Debe existir la colección con el documento
Poscondición: La lista de usuarios nuevos, la condición de usuarios nuevos y el tiempo de espera se actualizan | src/modules/newMembers.py | update_list | ljgago/matebot | 6 | python | def update_list(self, list_users: list, users: int, time_zero: float, delta: float):
'\n Descripción: Actualiza la lista de usuarios nuevos, la condición de usuarios nuevos y el tiempo de espera\n Precondición: Debe existir la colección con el documento\n Poscondición: La lista de usuarios nuev... | def update_list(self, list_users: list, users: int, time_zero: float, delta: float):
'\n Descripción: Actualiza la lista de usuarios nuevos, la condición de usuarios nuevos y el tiempo de espera\n Precondición: Debe existir la colección con el documento\n Poscondición: La lista de usuarios nuev... |
ce64d0fcea45392726713dcdbbb1ef0cf8877058323fde8f2d8c0a388afab91a | @commands.Cog.listener()
async def on_member_join(self, member):
'\n Descripción: Se activa cuando un nuevo usuario entra al servidor y se guarda su id en la base de datos\n Precondición: Debe existir la colección con el documento\n Poscondición: Se activa el mensaje de bienvenida a los nuevos ... | Descripción: Se activa cuando un nuevo usuario entra al servidor y se guarda su id en la base de datos
Precondición: Debe existir la colección con el documento
Poscondición: Se activa el mensaje de bienvenida a los nuevos miembros de FrontendCafé al alcanzar el número de usuarios necesarios | src/modules/newMembers.py | on_member_join | ljgago/matebot | 6 | python | @commands.Cog.listener()
async def on_member_join(self, member):
'\n Descripción: Se activa cuando un nuevo usuario entra al servidor y se guarda su id en la base de datos\n Precondición: Debe existir la colección con el documento\n Poscondición: Se activa el mensaje de bienvenida a los nuevos ... | @commands.Cog.listener()
async def on_member_join(self, member):
'\n Descripción: Se activa cuando un nuevo usuario entra al servidor y se guarda su id en la base de datos\n Precondición: Debe existir la colección con el documento\n Poscondición: Se activa el mensaje de bienvenida a los nuevos ... |
15072baca074d6479b79552abeb6f6aedc27e737d51a4c6f500610e21fdc6949 | def __init__(self, *, camAttr, writeOK, readOK, **kwargs):
'\n Uses a locally held value and the actual camera attribute when the camera is active.\n \n camAttr : the attribute in a PiCamera that handles this var\n \n writeOK : this attribute can be set on PiCamera at any ... | Uses a locally held value and the actual camera attribute when the camera is active.
camAttr : the attribute in a PiCamera that handles this var
writeOK : this attribute can be set on PiCamera at any time
readOK : read this attribute from a PiCamera to find its value | piCamHandler.py | __init__ | pootle/piCameraWeb | 1 | python | def __init__(self, *, camAttr, writeOK, readOK, **kwargs):
'\n Uses a locally held value and the actual camera attribute when the camera is active.\n \n camAttr : the attribute in a PiCamera that handles this var\n \n writeOK : this attribute can be set on PiCamera at any ... | def __init__(self, *, camAttr, writeOK, readOK, **kwargs):
'\n Uses a locally held value and the actual camera attribute when the camera is active.\n \n camAttr : the attribute in a PiCamera that handles this var\n \n writeOK : this attribute can be set on PiCamera at any ... |
868ecfa289b5639aeafb3f6a48438f1ef2b57ca3eb3b716e85264fc9cf2bfe87 | def setCameraValue(self):
'\n sets the actual attribute on the camera object if the camera is active and it is allowed\n '
if (self.writeOK and (not (self.app.picam is None))):
val = super().getValue()
self.log(wv.loglvls.DEBUG, ('camera %s set to %s' % (self.camAttr, val)))
... | sets the actual attribute on the camera object if the camera is active and it is allowed | piCamHandler.py | setCameraValue | pootle/piCameraWeb | 1 | python | def setCameraValue(self):
'\n \n '
if (self.writeOK and (not (self.app.picam is None))):
val = super().getValue()
self.log(wv.loglvls.DEBUG, ('camera %s set to %s' % (self.camAttr, val)))
setattr(self.app.picam, self.camAttr, val) | def setCameraValue(self):
'\n \n '
if (self.writeOK and (not (self.app.picam is None))):
val = super().getValue()
self.log(wv.loglvls.DEBUG, ('camera %s set to %s' % (self.camAttr, val)))
setattr(self.app.picam, self.camAttr, val)<|docstring|>sets the actual attribute on th... |
096de883a7e0c2498ec7930278cbc14236adfe2c82b3fb07020c01331f290602 | def setValue(self, value, agent):
'\n This saves the value locally and updates the camera attribute if relevant /applicable.\n \n Calling super().setValue means any callbacks will be triggered if appropriate.\n '
super().setValue(value, agent)
self.setCameraValue() | This saves the value locally and updates the camera attribute if relevant /applicable.
Calling super().setValue means any callbacks will be triggered if appropriate. | piCamHandler.py | setValue | pootle/piCameraWeb | 1 | python | def setValue(self, value, agent):
'\n This saves the value locally and updates the camera attribute if relevant /applicable.\n \n Calling super().setValue means any callbacks will be triggered if appropriate.\n '
super().setValue(value, agent)
self.setCameraValue() | def setValue(self, value, agent):
'\n This saves the value locally and updates the camera attribute if relevant /applicable.\n \n Calling super().setValue means any callbacks will be triggered if appropriate.\n '
super().setValue(value, agent)
self.setCameraValue()<|docstring|>Th... |
90ad3aaeebf61789db1db23a3dc74c838e80698fa17514af702d0fd68bd0ec2c | def getValue(self):
'\n Fetches the current camera value if the camera is active and it is allowed else returns the last known value\n '
if ((not self.readOK) or (self.app.picam is None)):
return super().getValue()
else:
curval = getattr(self.app.picam, self.camAttr)
su... | Fetches the current camera value if the camera is active and it is allowed else returns the last known value | piCamHandler.py | getValue | pootle/piCameraWeb | 1 | python | def getValue(self):
'\n \n '
if ((not self.readOK) or (self.app.picam is None)):
return super().getValue()
else:
curval = getattr(self.app.picam, self.camAttr)
super().setValue(curval, self.app.agentclass.app)
return curval | def getValue(self):
'\n \n '
if ((not self.readOK) or (self.app.picam is None)):
return super().getValue()
else:
curval = getattr(self.app.picam, self.camAttr)
super().setValue(curval, self.app.agentclass.app)
return curval<|docstring|>Fetches the current camera... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.