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 |
|---|---|---|---|---|---|---|---|---|---|
7c4fe9fe630e2db359cf03c09f75fefe91ce0836793f0977c8f5e6ed3f52bd20 | def load_index(request):
'\n Prepare data information for main page\n - experiment identifiers available from configuration\n '
data = get_base_data()
configurations = configurations_collection.find()
data['configurations'] = {}
for config in configurations:
guild_id = config['guild... | Prepare data information for main page
- experiment identifiers available from configuration | links/views.py | load_index | prise-3d/SIN3D-launcher | 0 | python | def load_index(request):
'\n Prepare data information for main page\n - experiment identifiers available from configuration\n '
data = get_base_data()
configurations = configurations_collection.find()
data['configurations'] = {}
for config in configurations:
guild_id = config['guild... | def load_index(request):
'\n Prepare data information for main page\n - experiment identifiers available from configuration\n '
data = get_base_data()
configurations = configurations_collection.find()
data['configurations'] = {}
for config in configurations:
guild_id = config['guild... |
b50db7bb7d05854dcb8be7adc1fa40aa80c81c6db09fbbc038aaf71716f7e941 | def generate_user_link(request):
'\n Generate link is possible for user, otherwise send an issue with error code\n '
data = get_base_data()
data['status'] = True
data['message'] = None
if (request.method == 'POST'):
form_input = json.loads(request.body)
guild_id = form_input['g... | Generate link is possible for user, otherwise send an issue with error code | links/views.py | generate_user_link | prise-3d/SIN3D-launcher | 0 | python | def generate_user_link(request):
'\n \n '
data = get_base_data()
data['status'] = True
data['message'] = None
if (request.method == 'POST'):
form_input = json.loads(request.body)
guild_id = form_input['guildId']
user_id = form_input['userId']
if ((len(user_id) >... | def generate_user_link(request):
'\n \n '
data = get_base_data()
data['status'] = True
data['message'] = None
if (request.method == 'POST'):
form_input = json.loads(request.body)
guild_id = form_input['guildId']
user_id = form_input['userId']
if ((len(user_id) >... |
baf63109d8002d8dd29e3f8c93121c7e4c50c8b2bd3f28f4ca6ac930f9d693dc | def test_not_authenticated(self):
'Tests requests that have not yet been authenticated.'
response = self.client.get(teams_url)
self.assertEqual(403, response.status_code) | Tests requests that have not yet been authenticated. | server/auvsi_suas/views/teams_test.py | test_not_authenticated | derekbt96/interop | 0 | python | def test_not_authenticated(self):
response = self.client.get(teams_url)
self.assertEqual(403, response.status_code) | def test_not_authenticated(self):
response = self.client.get(teams_url)
self.assertEqual(403, response.status_code)<|docstring|>Tests requests that have not yet been authenticated.<|endoftext|> |
cedc76682e19558f1ce74d3ca2626893b2c95eee4a9b4c5eb11e5ffb9336aea7 | def create_data(self):
'Create a basic sample dataset.'
self.user1 = User.objects.create_user('user1', 'example@example.com', 'testpass')
self.user1.save()
self.user2 = User.objects.create_user('user2', 'example@example.com', 'testpass')
self.user2.save()
event = TakeoffOrLandingEvent(user=self.... | Create a basic sample dataset. | server/auvsi_suas/views/teams_test.py | create_data | derekbt96/interop | 0 | python | def create_data(self):
self.user1 = User.objects.create_user('user1', 'example@example.com', 'testpass')
self.user1.save()
self.user2 = User.objects.create_user('user2', 'example@example.com', 'testpass')
self.user2.save()
event = TakeoffOrLandingEvent(user=self.user1, uas_in_air=True)
even... | def create_data(self):
self.user1 = User.objects.create_user('user1', 'example@example.com', 'testpass')
self.user1.save()
self.user2 = User.objects.create_user('user2', 'example@example.com', 'testpass')
self.user2.save()
event = TakeoffOrLandingEvent(user=self.user1, uas_in_air=True)
even... |
cb4bba4d631c636fb0626f1dd77dd9ccfcfedf869e627096de3899ca620daf58 | def test_normal_user(self):
'Normal users not allowed access.'
user = User.objects.create_user('testuser', 'example@example.com', 'testpass')
user.save()
self.client.force_login(user)
response = self.client.get(teams_url)
self.assertEqual(403, response.status_code) | Normal users not allowed access. | server/auvsi_suas/views/teams_test.py | test_normal_user | derekbt96/interop | 0 | python | def test_normal_user(self):
user = User.objects.create_user('testuser', 'example@example.com', 'testpass')
user.save()
self.client.force_login(user)
response = self.client.get(teams_url)
self.assertEqual(403, response.status_code) | def test_normal_user(self):
user = User.objects.create_user('testuser', 'example@example.com', 'testpass')
user.save()
self.client.force_login(user)
response = self.client.get(teams_url)
self.assertEqual(403, response.status_code)<|docstring|>Normal users not allowed access.<|endoftext|> |
d56d725d4f0d590e3cbdfc7beb544bfbf58ac8de3cd1d3924bbdba155bda7a28 | def test_no_users(self):
'No users results in empty list, no superusers.'
response = self.client.get(teams_url)
self.assertEqual(200, response.status_code)
self.assertEqual([], json.loads(response.content)) | No users results in empty list, no superusers. | server/auvsi_suas/views/teams_test.py | test_no_users | derekbt96/interop | 0 | python | def test_no_users(self):
response = self.client.get(teams_url)
self.assertEqual(200, response.status_code)
self.assertEqual([], json.loads(response.content)) | def test_no_users(self):
response = self.client.get(teams_url)
self.assertEqual(200, response.status_code)
self.assertEqual([], json.loads(response.content))<|docstring|>No users results in empty list, no superusers.<|endoftext|> |
7d782f1553ced14ce65685ce74c4b4f77d99261136fac3428ed32d3f03ada096 | def test_post(self):
'POST not allowed'
response = self.client.post(teams_url)
self.assertEqual(405, response.status_code) | POST not allowed | server/auvsi_suas/views/teams_test.py | test_post | derekbt96/interop | 0 | python | def test_post(self):
response = self.client.post(teams_url)
self.assertEqual(405, response.status_code) | def test_post(self):
response = self.client.post(teams_url)
self.assertEqual(405, response.status_code)<|docstring|>POST not allowed<|endoftext|> |
75fe8a384cf9dcb9466ac86c44a9ce55da7e2c25883aa13d1e45214a4e28756b | def test_correct_json(self):
'Response JSON is properly formatted.'
self.create_data()
response = self.client.get(teams_url)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
self.assertEqual(2, len(data))
for user in data:
self.assertIn('id', user)
... | Response JSON is properly formatted. | server/auvsi_suas/views/teams_test.py | test_correct_json | derekbt96/interop | 0 | python | def test_correct_json(self):
self.create_data()
response = self.client.get(teams_url)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
self.assertEqual(2, len(data))
for user in data:
self.assertIn('id', user)
self.assertIn('name', user)
... | def test_correct_json(self):
self.create_data()
response = self.client.get(teams_url)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
self.assertEqual(2, len(data))
for user in data:
self.assertIn('id', user)
self.assertIn('name', user)
... |
918dc55f4ba8a307da0fac3af925bc668578e60d41d789680289e69152ea95e5 | def test_users_correct(self):
'User names and status correct.'
self.create_data()
response = self.client.get(teams_url)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
names = [d['name'] for d in data]
self.assertIn('user1', names)
self.assertIn('user2', n... | User names and status correct. | server/auvsi_suas/views/teams_test.py | test_users_correct | derekbt96/interop | 0 | python | def test_users_correct(self):
self.create_data()
response = self.client.get(teams_url)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
names = [d['name'] for d in data]
self.assertIn('user1', names)
self.assertIn('user2', names)
user1 = data[names.ind... | def test_users_correct(self):
self.create_data()
response = self.client.get(teams_url)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
names = [d['name'] for d in data]
self.assertIn('user1', names)
self.assertIn('user2', names)
user1 = data[names.ind... |
aa1d9882413cd623c36c846213ec6cb15846b341ac9d840b422bc64c75db6d3c | def test_not_authenticated(self):
'Tests requests that have not yet been authenticated.'
response = self.client.get(teams_id_url(args=[1]))
self.assertEqual(403, response.status_code) | Tests requests that have not yet been authenticated. | server/auvsi_suas/views/teams_test.py | test_not_authenticated | derekbt96/interop | 0 | python | def test_not_authenticated(self):
response = self.client.get(teams_id_url(args=[1]))
self.assertEqual(403, response.status_code) | def test_not_authenticated(self):
response = self.client.get(teams_id_url(args=[1]))
self.assertEqual(403, response.status_code)<|docstring|>Tests requests that have not yet been authenticated.<|endoftext|> |
5e3918746c87ad2b479a5d5a824939d175545a58191e3036a421bb4afd0522f1 | def test_bad_id(self):
'Invalid user id rejected'
response = self.client.get(teams_id_url(args=[999]))
self.assertGreaterEqual(400, response.status_code) | Invalid user id rejected | server/auvsi_suas/views/teams_test.py | test_bad_id | derekbt96/interop | 0 | python | def test_bad_id(self):
response = self.client.get(teams_id_url(args=[999]))
self.assertGreaterEqual(400, response.status_code) | def test_bad_id(self):
response = self.client.get(teams_id_url(args=[999]))
self.assertGreaterEqual(400, response.status_code)<|docstring|>Invalid user id rejected<|endoftext|> |
e1b91e0f69bfbb96c0abd108b97af687263cd0b54603419c96be50692023e44b | def test_correct_user(self):
'User requested is correct'
response = self.client.get(teams_id_url(args=[self.user1.pk]))
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
self.assertEqual('user1', data['name'])
self.assertEqual(self.user1.pk, data['id'])
self.ass... | User requested is correct | server/auvsi_suas/views/teams_test.py | test_correct_user | derekbt96/interop | 0 | python | def test_correct_user(self):
response = self.client.get(teams_id_url(args=[self.user1.pk]))
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
self.assertEqual('user1', data['name'])
self.assertEqual(self.user1.pk, data['id'])
self.assertEqual(False, data['in_ai... | def test_correct_user(self):
response = self.client.get(teams_id_url(args=[self.user1.pk]))
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
self.assertEqual('user1', data['name'])
self.assertEqual(self.user1.pk, data['id'])
self.assertEqual(False, data['in_ai... |
8c01247e0795f9a04fa50a4266be0778f045caab533b70768b530f0caa06b140 | def test_bad_json(self):
'Invalid json rejected'
response = self.client.put(teams_id_url(args=[self.user1.pk]), 'Hi there!')
self.assertGreaterEqual(400, response.status_code) | Invalid json rejected | server/auvsi_suas/views/teams_test.py | test_bad_json | derekbt96/interop | 0 | python | def test_bad_json(self):
response = self.client.put(teams_id_url(args=[self.user1.pk]), 'Hi there!')
self.assertGreaterEqual(400, response.status_code) | def test_bad_json(self):
response = self.client.put(teams_id_url(args=[self.user1.pk]), 'Hi there!')
self.assertGreaterEqual(400, response.status_code)<|docstring|>Invalid json rejected<|endoftext|> |
46b61315424645339e879e777400d673be691c72414bc176e0c0a80b14fcd7e2 | def test_invalid_in_air(self):
'invalid in_air rejected'
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'active': False, 'in_air': 'Hi!'})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertGreaterEqual(400, response.status_code) | invalid in_air rejected | server/auvsi_suas/views/teams_test.py | test_invalid_in_air | derekbt96/interop | 0 | python | def test_invalid_in_air(self):
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'active': False, 'in_air': 'Hi!'})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertGreaterEqual(400, response.status_code) | def test_invalid_in_air(self):
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'active': False, 'in_air': 'Hi!'})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertGreaterEqual(400, response.status_code)<|docstring|>invalid in_air rejected<|endoftext|> |
fe9f7e80fd45a61bf42fb8235de980c3776a0ec3a9f7a4e55ec242d6c557184b | def test_no_extra_events(self):
"No new TakeoffOrLandingEvents created if status doesn't change"
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'telemetry': None, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.s... | No new TakeoffOrLandingEvents created if status doesn't change | server/auvsi_suas/views/teams_test.py | test_no_extra_events | derekbt96/interop | 0 | python | def test_no_extra_events(self):
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'telemetry': None, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
self.ass... | def test_no_extra_events(self):
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'telemetry': None, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
self.ass... |
2964f9c3bd1d7546205d5ee98eab44338a3f675d607b848d23c14480fc1c5c17 | def test_update_in_air(self):
'In-air can be updated'
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'telemetry': None, 'in_air': True})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(response.c... | In-air can be updated | server/auvsi_suas/views/teams_test.py | test_update_in_air | derekbt96/interop | 0 | python | def test_update_in_air(self):
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'telemetry': None, 'in_air': True})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
self.assert... | def test_update_in_air(self):
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'telemetry': None, 'in_air': True})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
self.assert... |
61f2dc948bb0ad8f1fae05a8c74f40813865bb0b01e918ba941b60eb77e2905b | def test_name_ignored(self):
'name field ignored'
expected = self.user1.username
data = json.dumps({'name': 'Hello World!', 'id': self.user1.pk, 'telemetery': False, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
... | name field ignored | server/auvsi_suas/views/teams_test.py | test_name_ignored | derekbt96/interop | 0 | python | def test_name_ignored(self):
expected = self.user1.username
data = json.dumps({'name': 'Hello World!', 'id': self.user1.pk, 'telemetery': False, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(r... | def test_name_ignored(self):
expected = self.user1.username
data = json.dumps({'name': 'Hello World!', 'id': self.user1.pk, 'telemetery': False, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(r... |
74036fad8a0763072f89db7cd3bfb14d68131de25eceb618d248f16a6c4c21ec | def test_id_ignored(self):
'id field ignored'
expected = self.user1.pk
data = json.dumps({'name': self.user1.username, 'id': 999, 'telemetry': None, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.load... | id field ignored | server/auvsi_suas/views/teams_test.py | test_id_ignored | derekbt96/interop | 0 | python | def test_id_ignored(self):
expected = self.user1.pk
data = json.dumps({'name': self.user1.username, 'id': 999, 'telemetry': None, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(response.content... | def test_id_ignored(self):
expected = self.user1.pk
data = json.dumps({'name': self.user1.username, 'id': 999, 'telemetry': None, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(response.content... |
5b3b6ca090b2455919f9e8b751c36fb302f14fcb92d40b75f5a2c61536fb0008 | def test_telemetry_ignored(self):
'telemetry field ignored'
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'telemetry': {'id': 1}, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.load... | telemetry field ignored | server/auvsi_suas/views/teams_test.py | test_telemetry_ignored | derekbt96/interop | 0 | python | def test_telemetry_ignored(self):
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'telemetry': {'id': 1}, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
s... | def test_telemetry_ignored(self):
data = json.dumps({'name': self.user1.username, 'id': self.user1.pk, 'telemetry': {'id': 1}, 'in_air': False})
response = self.client.put(teams_id_url(args=[self.user1.pk]), data)
self.assertEqual(200, response.status_code)
data = json.loads(response.content)
s... |
f1eb8862b9e2edf802f8db8a72080ef6426361554944bbdd18948ed6c57490a9 | def is_mod():
'\n Decorator\n Is a moderator as defined in the settings\n '
async def predicate(ctx: commands.context):
if any(((role.name in MODERATOR_ROLES) for role in ctx.message.author.roles)):
return True
else:
return False
return commands.check(predic... | Decorator
Is a moderator as defined in the settings | polyphony/helpers/checks.py | is_mod | naneko/Polyphony | 3 | python | def is_mod():
'\n Decorator\n Is a moderator as defined in the settings\n '
async def predicate(ctx: commands.context):
if any(((role.name in MODERATOR_ROLES) for role in ctx.message.author.roles)):
return True
else:
return False
return commands.check(predic... | def is_mod():
'\n Decorator\n Is a moderator as defined in the settings\n '
async def predicate(ctx: commands.context):
if any(((role.name in MODERATOR_ROLES) for role in ctx.message.author.roles)):
return True
else:
return False
return commands.check(predic... |
226b66f8752d7f6228d2686acdf088dbf2dc438e6188351021347935afbb9e6f | def is_polyphony_user():
'\n Decorator\n Is a Polyphony user in the users database\n '
async def predicate(ctx: commands.context):
user = conn.execute('SELECT * FROM users WHERE id = ?', [ctx.author.id]).fetchone()
if (user is not None):
return True
else:
... | Decorator
Is a Polyphony user in the users database | polyphony/helpers/checks.py | is_polyphony_user | naneko/Polyphony | 3 | python | def is_polyphony_user():
'\n Decorator\n Is a Polyphony user in the users database\n '
async def predicate(ctx: commands.context):
user = conn.execute('SELECT * FROM users WHERE id = ?', [ctx.author.id]).fetchone()
if (user is not None):
return True
else:
... | def is_polyphony_user():
'\n Decorator\n Is a Polyphony user in the users database\n '
async def predicate(ctx: commands.context):
user = conn.execute('SELECT * FROM users WHERE id = ?', [ctx.author.id]).fetchone()
if (user is not None):
return True
else:
... |
5b44006dcb18c2d29cd49c76c69528eff59d3884d87443d1cc2ee7b211bd13a3 | async def check_token(token: str) -> [bool, int]:
'\n Checks discord token is valid\n\n :param token: Discord Token\n :return: boolean\n '
out = True
client_id = None
test_client = discord.Client()
log.debug('Checking bot token...')
try:
log.debug('Attempting login...')
... | Checks discord token is valid
:param token: Discord Token
:return: boolean | polyphony/helpers/checks.py | check_token | naneko/Polyphony | 3 | python | async def check_token(token: str) -> [bool, int]:
'\n Checks discord token is valid\n\n :param token: Discord Token\n :return: boolean\n '
out = True
client_id = None
test_client = discord.Client()
log.debug('Checking bot token...')
try:
log.debug('Attempting login...')
... | async def check_token(token: str) -> [bool, int]:
'\n Checks discord token is valid\n\n :param token: Discord Token\n :return: boolean\n '
out = True
client_id = None
test_client = discord.Client()
log.debug('Checking bot token...')
try:
log.debug('Attempting login...')
... |
5f9e0ca25ac6dd338ba386f144557f88ab7d77bc8d0b47ea08671f99a9010da8 | def notify_premium_end():
'sent to user who has canceled their subscription and who has their subscription ending soon'
for sub in Subscription.query.filter_by(cancelled=True).all():
if (arrow.now().shift(days=3).date() > sub.next_bill_date >= arrow.now().shift(days=2).date()):
user = sub.us... | sent to user who has canceled their subscription and who has their subscription ending soon | cron.py | notify_premium_end | AndreasGassmann/app | 5 | python | def notify_premium_end():
for sub in Subscription.query.filter_by(cancelled=True).all():
if (arrow.now().shift(days=3).date() > sub.next_bill_date >= arrow.now().shift(days=2).date()):
user = sub.user
LOG.d(f'Send subscription ending soon email to user {user}')
send_... | def notify_premium_end():
for sub in Subscription.query.filter_by(cancelled=True).all():
if (arrow.now().shift(days=3).date() > sub.next_bill_date >= arrow.now().shift(days=2).date()):
user = sub.user
LOG.d(f'Send subscription ending soon email to user {user}')
send_... |
8a008796180b037774d64e2a22eda105934049e372423640c2de14e56c71e73c | def poll_apple_subscription():
'Poll Apple API to update AppleSubscription'
for apple_sub in AppleSubscription.query.all():
user = apple_sub.user
verify_receipt(apple_sub.receipt_data, user, APPLE_API_SECRET)
verify_receipt(apple_sub.receipt_data, user, MACAPP_APPLE_API_SECRET)
LOG.d... | Poll Apple API to update AppleSubscription | cron.py | poll_apple_subscription | AndreasGassmann/app | 5 | python | def poll_apple_subscription():
for apple_sub in AppleSubscription.query.all():
user = apple_sub.user
verify_receipt(apple_sub.receipt_data, user, APPLE_API_SECRET)
verify_receipt(apple_sub.receipt_data, user, MACAPP_APPLE_API_SECRET)
LOG.d('Finish poll_apple_subscription') | def poll_apple_subscription():
for apple_sub in AppleSubscription.query.all():
user = apple_sub.user
verify_receipt(apple_sub.receipt_data, user, APPLE_API_SECRET)
verify_receipt(apple_sub.receipt_data, user, MACAPP_APPLE_API_SECRET)
LOG.d('Finish poll_apple_subscription')<|docstrin... |
8b1a20e37a9531bfe4b9fbd0c9b3884ae75ccedd4c450b05595ff596f32d60da | def stats_before(moment: Arrow) -> Stats:
'return the stats before a specific moment, ignoring all stats come from users in IGNORED_EMAILS'
q = User.query
for ie in IGNORED_EMAILS:
q = q.filter((~ User.email.contains(ie)), (User.created_at < moment))
nb_user = q.count()
LOG.d('total number u... | return the stats before a specific moment, ignoring all stats come from users in IGNORED_EMAILS | cron.py | stats_before | AndreasGassmann/app | 5 | python | def stats_before(moment: Arrow) -> Stats:
q = User.query
for ie in IGNORED_EMAILS:
q = q.filter((~ User.email.contains(ie)), (User.created_at < moment))
nb_user = q.count()
LOG.d('total number user %s', nb_user)
nb_referred_user = q.filter(User.referral_id.isnot(None)).count()
nb_re... | def stats_before(moment: Arrow) -> Stats:
q = User.query
for ie in IGNORED_EMAILS:
q = q.filter((~ User.email.contains(ie)), (User.created_at < moment))
nb_user = q.count()
LOG.d('total number user %s', nb_user)
nb_referred_user = q.filter(User.referral_id.isnot(None)).count()
nb_re... |
c2ab21544866190cc0a1cc613b614bd8e6951e377a29ebc5a69bf6f359c72637 | def stats():
'send admin stats everyday'
if (not ADMIN_EMAIL):
return
stats_today = stats_before(arrow.now())
stats_yesterday = stats_before(arrow.now().shift(days=(- 1)))
nb_user_increase = increase_percent(stats_yesterday.nb_user, stats_today.nb_user)
nb_alias_increase = increase_perce... | send admin stats everyday | cron.py | stats | AndreasGassmann/app | 5 | python | def stats():
if (not ADMIN_EMAIL):
return
stats_today = stats_before(arrow.now())
stats_yesterday = stats_before(arrow.now().shift(days=(- 1)))
nb_user_increase = increase_percent(stats_yesterday.nb_user, stats_today.nb_user)
nb_alias_increase = increase_percent(stats_yesterday.nb_alias... | def stats():
if (not ADMIN_EMAIL):
return
stats_today = stats_before(arrow.now())
stats_yesterday = stats_before(arrow.now().shift(days=(- 1)))
nb_user_increase = increase_percent(stats_yesterday.nb_user, stats_today.nb_user)
nb_alias_increase = increase_percent(stats_yesterday.nb_alias... |
12e191ae7547fe23c6629c46c04cb118eacc4f3e70e7f1acde44eeeb8cce311c | def sanity_check():
"\n #TODO: investigate why DNS sometimes not working\n Different sanity checks\n - detect if there's mailbox that's using a invalid domain\n "
mailbox_ids = db.session.query(Mailbox.id).filter(Mailbox.verified.is_(True), Mailbox.disabled.is_(False)).all()
mailbox_ids = [e[0] ... | #TODO: investigate why DNS sometimes not working
Different sanity checks
- detect if there's mailbox that's using a invalid domain | cron.py | sanity_check | AndreasGassmann/app | 5 | python | def sanity_check():
"\n #TODO: investigate why DNS sometimes not working\n Different sanity checks\n - detect if there's mailbox that's using a invalid domain\n "
mailbox_ids = db.session.query(Mailbox.id).filter(Mailbox.verified.is_(True), Mailbox.disabled.is_(False)).all()
mailbox_ids = [e[0] ... | def sanity_check():
"\n #TODO: investigate why DNS sometimes not working\n Different sanity checks\n - detect if there's mailbox that's using a invalid domain\n "
mailbox_ids = db.session.query(Mailbox.id).filter(Mailbox.verified.is_(True), Mailbox.disabled.is_(False)).all()
mailbox_ids = [e[0] ... |
f1aef6ca8d9a13b9483cce295e01e6ecc70e5dc259a2be247238174399d60c1e | def delete_old_monitoring():
'\n Delete old monitoring records\n '
max_time = arrow.now().shift(days=(- 30))
nb_row = Monitoring.query.filter((Monitoring.created_at < max_time)).delete()
db.session.commit()
LOG.d('delete monitoring records older than %s, nb row %s', max_time, nb_row) | Delete old monitoring records | cron.py | delete_old_monitoring | AndreasGassmann/app | 5 | python | def delete_old_monitoring():
'\n \n '
max_time = arrow.now().shift(days=(- 30))
nb_row = Monitoring.query.filter((Monitoring.created_at < max_time)).delete()
db.session.commit()
LOG.d('delete monitoring records older than %s, nb row %s', max_time, nb_row) | def delete_old_monitoring():
'\n \n '
max_time = arrow.now().shift(days=(- 30))
nb_row = Monitoring.query.filter((Monitoring.created_at < max_time)).delete()
db.session.commit()
LOG.d('delete monitoring records older than %s, nb row %s', max_time, nb_row)<|docstring|>Delete old monitoring reco... |
aba3b665ad0f46317ad6adc974a474e5a312460eea46a7c192cf5acf19be94a6 | def _parse_image(self, image, out_map):
'\n :param image: loaded image as numpy array\n :param out_map: map from segmentation\n :return:\n list: crops\n list: coordinates of crops\n list: mask for skiping of crops\n '
batch = []
shape = []
ski... | :param image: loaded image as numpy array
:param out_map: map from segmentation
:return:
list: crops
list: coordinates of crops
list: mask for skiping of crops | pero_quality/quality_evaluator_regression.py | _parse_image | DCGM/pero-quality | 6 | python | def _parse_image(self, image, out_map):
'\n :param image: loaded image as numpy array\n :param out_map: map from segmentation\n :return:\n list: crops\n list: coordinates of crops\n list: mask for skiping of crops\n '
batch = []
shape = []
ski... | def _parse_image(self, image, out_map):
'\n :param image: loaded image as numpy array\n :param out_map: map from segmentation\n :return:\n list: crops\n list: coordinates of crops\n list: mask for skiping of crops\n '
batch = []
shape = []
ski... |
6f443065da67e4dbd660bcdc147b356735a1f21da7755df2218a17c9a9c95a06 | def _compute_map(self, preds, shape, image, skip):
'\n :param preds: predictions from regression network\n :param shape: coordinates of crops\n :param image: loaded image as numpy array\n :param skip: mask for skiping of crops\n :return:\n np.ndarray: heatmap with each ... | :param preds: predictions from regression network
:param shape: coordinates of crops
:param image: loaded image as numpy array
:param skip: mask for skiping of crops
:return:
np.ndarray: heatmap with each pixel having value <0, 1> for score | pero_quality/quality_evaluator_regression.py | _compute_map | DCGM/pero-quality | 6 | python | def _compute_map(self, preds, shape, image, skip):
'\n :param preds: predictions from regression network\n :param shape: coordinates of crops\n :param image: loaded image as numpy array\n :param skip: mask for skiping of crops\n :return:\n np.ndarray: heatmap with each ... | def _compute_map(self, preds, shape, image, skip):
'\n :param preds: predictions from regression network\n :param shape: coordinates of crops\n :param image: loaded image as numpy array\n :param skip: mask for skiping of crops\n :return:\n np.ndarray: heatmap with each ... |
4c931e8c71c4b02af181c15fae3f14dedda94bf79b4c02bb11bc681a4b8b36e0 | def evaluate_image(self, image):
'\n Compute quality and heatmap for given image.\n\n :param image: loaded image as numpy array\n :return:\n float: global image score in interval <0, 1>\n np.ndarray: heatmap with each pixel having value <0, 1> for score\n '
resi... | Compute quality and heatmap for given image.
:param image: loaded image as numpy array
:return:
float: global image score in interval <0, 1>
np.ndarray: heatmap with each pixel having value <0, 1> for score | pero_quality/quality_evaluator_regression.py | evaluate_image | DCGM/pero-quality | 6 | python | def evaluate_image(self, image):
'\n Compute quality and heatmap for given image.\n\n :param image: loaded image as numpy array\n :return:\n float: global image score in interval <0, 1>\n np.ndarray: heatmap with each pixel having value <0, 1> for score\n '
resi... | def evaluate_image(self, image):
'\n Compute quality and heatmap for given image.\n\n :param image: loaded image as numpy array\n :return:\n float: global image score in interval <0, 1>\n np.ndarray: heatmap with each pixel having value <0, 1> for score\n '
resi... |
2b76b130912d214bad87490f76de3b7a7a99d9e5ca28ca817c456b82cedced8b | def create_parser():
'Create the parser to capture CLI arguments.'
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description='Evaluates a bottleneck agent over a grid of inflows')
parser.add_argument('checkpoint_dir', type=str, help='Directory containing results')
... | Create the parser to capture CLI arguments. | flow/visualize/bottleneck_results.py | create_parser | eugenevinitsky/cdc_bottlenecks | 2 | python | def create_parser():
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description='Evaluates a bottleneck agent over a grid of inflows')
parser.add_argument('checkpoint_dir', type=str, help='Directory containing results')
parser.add_argument('checkpoint_num', type=... | def create_parser():
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description='Evaluates a bottleneck agent over a grid of inflows')
parser.add_argument('checkpoint_dir', type=str, help='Directory containing results')
parser.add_argument('checkpoint_num', type=... |
3f6b140f289dc4e89df268698ab67444812e3bac473171756f5e508e43439b42 | def create_git_repo(self, repo_name, bare_repo=False):
'Create a new git repository\n\n Keyword arguments:\n repo_name -- the name of the repository\n bare_repo -- specify if this is a bare repo (default False)\n '
self.repo_name = repo_name
self.repo = Repo()
try:
se... | Create a new git repository
Keyword arguments:
repo_name -- the name of the repository
bare_repo -- specify if this is a bare repo (default False) | py_libgit/py_libgit/api/init.py | create_git_repo | tony-yang/e-libgit | 0 | python | def create_git_repo(self, repo_name, bare_repo=False):
'Create a new git repository\n\n Keyword arguments:\n repo_name -- the name of the repository\n bare_repo -- specify if this is a bare repo (default False)\n '
self.repo_name = repo_name
self.repo = Repo()
try:
se... | def create_git_repo(self, repo_name, bare_repo=False):
'Create a new git repository\n\n Keyword arguments:\n repo_name -- the name of the repository\n bare_repo -- specify if this is a bare repo (default False)\n '
self.repo_name = repo_name
self.repo = Repo()
try:
se... |
6d8e87edab77d22cab4baeca346b100f1b9663c8d63561cae2ba869fcc24f609 | def init_heatmap(title: str):
'\n Initialize the heatmap figure plot.\n Returns a plot tuple (fig, ax, im).\n '
(fig, ax) = plt.subplots()
frame = (np.random.random((8, 8)) * 0)
im = plt.imshow(frame, cmap='hot', interpolation='nearest')
plt.clim(30, 40)
plt.show(block=False)
ax.set_xtick... | Initialize the heatmap figure plot.
Returns a plot tuple (fig, ax, im). | grideye/visualizer.py | init_heatmap | Kazykiddo/sensor-pod | 0 | python | def init_heatmap(title: str):
'\n Initialize the heatmap figure plot.\n Returns a plot tuple (fig, ax, im).\n '
(fig, ax) = plt.subplots()
frame = (np.random.random((8, 8)) * 0)
im = plt.imshow(frame, cmap='hot', interpolation='nearest')
plt.clim(30, 40)
plt.show(block=False)
ax.set_xtick... | def init_heatmap(title: str):
'\n Initialize the heatmap figure plot.\n Returns a plot tuple (fig, ax, im).\n '
(fig, ax) = plt.subplots()
frame = (np.random.random((8, 8)) * 0)
im = plt.imshow(frame, cmap='hot', interpolation='nearest')
plt.clim(30, 40)
plt.show(block=False)
ax.set_xtick... |
2445e7897fdda238f7c1cce9712a4f52c9c340e34e2a59364e130e8f4d531933 | def update_heatmap(frame: Array[(float, 8, 8)], plot):
'\n Given a plot tuple of (fig, ax, im), updates the plot with the new frame received.\n '
(fig, ax, im) = plot
im.set_array(frame)
fig.canvas.draw() | Given a plot tuple of (fig, ax, im), updates the plot with the new frame received. | grideye/visualizer.py | update_heatmap | Kazykiddo/sensor-pod | 0 | python | def update_heatmap(frame: Array[(float, 8, 8)], plot):
'\n \n '
(fig, ax, im) = plot
im.set_array(frame)
fig.canvas.draw() | def update_heatmap(frame: Array[(float, 8, 8)], plot):
'\n \n '
(fig, ax, im) = plot
im.set_array(frame)
fig.canvas.draw()<|docstring|>Given a plot tuple of (fig, ax, im), updates the plot with the new frame received.<|endoftext|> |
b553cf332676bb0c6a58d79401fdf46f84554d0867ee265e36ee211b52bd1d93 | def fetch_owners(url):
'Load a list of email addresses from an OWNERS file.'
cached_owners = ramcache.get(url)
if cached_owners:
return cached_owners
owners = []
response = requests.get(url)
if (response.status_code != 200):
logging.error('Could not fetch %r', url)
loggin... | Load a list of email addresses from an OWNERS file. | internals/approval_defs.py | fetch_owners | GoogleChrome/chromium-dashboard | 450 | python | def fetch_owners(url):
cached_owners = ramcache.get(url)
if cached_owners:
return cached_owners
owners = []
response = requests.get(url)
if (response.status_code != 200):
logging.error('Could not fetch %r', url)
logging.error('Got response %s', repr(response)[:settings.M... | def fetch_owners(url):
cached_owners = ramcache.get(url)
if cached_owners:
return cached_owners
owners = []
response = requests.get(url)
if (response.status_code != 200):
logging.error('Could not fetch %r', url)
logging.error('Got response %s', repr(response)[:settings.M... |
76d961552a474b9d7baea5a9501803e41d3f8144b8d86c59f37e81fa36f1d2a2 | def get_approvers(field_id):
'Return a list of email addresses of users allowed to approve.'
afd = APPROVAL_FIELDS_BY_ID[field_id]
if isinstance(afd.approvers, str):
owners = fetch_owners(afd.approvers)
return owners
return afd.approvers | Return a list of email addresses of users allowed to approve. | internals/approval_defs.py | get_approvers | GoogleChrome/chromium-dashboard | 450 | python | def get_approvers(field_id):
afd = APPROVAL_FIELDS_BY_ID[field_id]
if isinstance(afd.approvers, str):
owners = fetch_owners(afd.approvers)
return owners
return afd.approvers | def get_approvers(field_id):
afd = APPROVAL_FIELDS_BY_ID[field_id]
if isinstance(afd.approvers, str):
owners = fetch_owners(afd.approvers)
return owners
return afd.approvers<|docstring|>Return a list of email addresses of users allowed to approve.<|endoftext|> |
553f4f052fa85131c7426966017ae470df15bb798305397cffafa6484095201e | def fields_approvable_by(user):
'Return a set of field IDs that the user is allowed to approve.'
if permissions.can_admin_site(user):
return set(APPROVAL_FIELDS_BY_ID.keys())
email = user.email()
approvable_ids = {field_id for field_id in APPROVAL_FIELDS_BY_ID if (email in get_approvers(field_id... | Return a set of field IDs that the user is allowed to approve. | internals/approval_defs.py | fields_approvable_by | GoogleChrome/chromium-dashboard | 450 | python | def fields_approvable_by(user):
if permissions.can_admin_site(user):
return set(APPROVAL_FIELDS_BY_ID.keys())
email = user.email()
approvable_ids = {field_id for field_id in APPROVAL_FIELDS_BY_ID if (email in get_approvers(field_id))}
return approvable_ids | def fields_approvable_by(user):
if permissions.can_admin_site(user):
return set(APPROVAL_FIELDS_BY_ID.keys())
email = user.email()
approvable_ids = {field_id for field_id in APPROVAL_FIELDS_BY_ID if (email in get_approvers(field_id))}
return approvable_ids<|docstring|>Return a set of field ... |
ffa1b9a437b90bb1451dcb82e9297f5662fd9abb669e2e6274beeff09f93b0a7 | def is_valid_field_id(field_id):
'Return true if field_id is a known field.'
return (field_id in APPROVAL_FIELDS_BY_ID) | Return true if field_id is a known field. | internals/approval_defs.py | is_valid_field_id | GoogleChrome/chromium-dashboard | 450 | python | def is_valid_field_id(field_id):
return (field_id in APPROVAL_FIELDS_BY_ID) | def is_valid_field_id(field_id):
return (field_id in APPROVAL_FIELDS_BY_ID)<|docstring|>Return true if field_id is a known field.<|endoftext|> |
c96b393ea8ce0e7f2b8e74f0b4f499d9d0bd514789085463de15acfc5bcb4b98 | def make_request(dep_city='bjs', arr_city='can', date='2020-04-04', hasChild=False, hasBaby=False, classType='ALL', last_ref='https://flights.ctrip.com/'):
'\n 函数用于根据参数对ctrip的api站点发送请求并返回routeList数据\n :param dep_city:始发城市\n :param arr_city:到达城市\n :param date:起飞日期\n :param hasChild:是否有儿童\n :param h... | 函数用于根据参数对ctrip的api站点发送请求并返回routeList数据
:param dep_city:始发城市
:param arr_city:到达城市
:param date:起飞日期
:param hasChild:是否有儿童
:param hasBaby:是否有婴儿
:param classType:舱位类型
:return: routeList 用于paser_route
:return: next_referer 用于下一次的headers | p32_get_ctrip.py | make_request | zzzzzzhu/py_application | 0 | python | def make_request(dep_city='bjs', arr_city='can', date='2020-04-04', hasChild=False, hasBaby=False, classType='ALL', last_ref='https://flights.ctrip.com/'):
'\n 函数用于根据参数对ctrip的api站点发送请求并返回routeList数据\n :param dep_city:始发城市\n :param arr_city:到达城市\n :param date:起飞日期\n :param hasChild:是否有儿童\n :param h... | def make_request(dep_city='bjs', arr_city='can', date='2020-04-04', hasChild=False, hasBaby=False, classType='ALL', last_ref='https://flights.ctrip.com/'):
'\n 函数用于根据参数对ctrip的api站点发送请求并返回routeList数据\n :param dep_city:始发城市\n :param arr_city:到达城市\n :param date:起飞日期\n :param hasChild:是否有儿童\n :param h... |
4c2ba6c8d5e2aacb250fe55edbb3dc7ce0818d3d3527bf64424b87271c0e31d4 | def route_parser(routeList):
'\n 函数用于从route的集合中遍历每个舱位及其价格\n 对于一个航班,最终返回母舱位中的最低价\n :param routeList:\n :return: pd.DataFrame 每一行是一个母舱位最低价\n '
class_lines = []
for (i, route0) in enumerate(routeList):
legs = route0['legs']
print(('方案%d/%d' % (i, len(routeList))))
for (j,... | 函数用于从route的集合中遍历每个舱位及其价格
对于一个航班,最终返回母舱位中的最低价
:param routeList:
:return: pd.DataFrame 每一行是一个母舱位最低价 | p32_get_ctrip.py | route_parser | zzzzzzhu/py_application | 0 | python | def route_parser(routeList):
'\n 函数用于从route的集合中遍历每个舱位及其价格\n 对于一个航班,最终返回母舱位中的最低价\n :param routeList:\n :return: pd.DataFrame 每一行是一个母舱位最低价\n '
class_lines = []
for (i, route0) in enumerate(routeList):
legs = route0['legs']
print(('方案%d/%d' % (i, len(routeList))))
for (j,... | def route_parser(routeList):
'\n 函数用于从route的集合中遍历每个舱位及其价格\n 对于一个航班,最终返回母舱位中的最低价\n :param routeList:\n :return: pd.DataFrame 每一行是一个母舱位最低价\n '
class_lines = []
for (i, route0) in enumerate(routeList):
legs = route0['legs']
print(('方案%d/%d' % (i, len(routeList))))
for (j,... |
235162c0ba10875ca8943c25ae1953e0a0207382ecab3795f28bad1ab35936c5 | @staticmethod
def use_fatal_exceptions():
'Return True if use fatal exceptions by raising them.'
return False | Return True if use fatal exceptions by raising them. | octavia/amphorae/driver_exceptions/exceptions.py | use_fatal_exceptions | elastx/octavia | 129 | python | @staticmethod
def use_fatal_exceptions():
return False | @staticmethod
def use_fatal_exceptions():
return False<|docstring|>Return True if use fatal exceptions by raising them.<|endoftext|> |
95f74b0909c75b4de87bf84eea34050c8a820b45ea7c403d8e7ab433d4b42992 | def ordered_load(stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict):
' Helper function to allow yaml load routine to use an OrderedDict instead of regular dict.\n This helps keeps things sane when ordering the runs and printing out routines\n '
class OrderedLoader(Loader):
pass
d... | Helper function to allow yaml load routine to use an OrderedDict instead of regular dict.
This helps keeps things sane when ordering the runs and printing out routines | lexic/utils.py | ordered_load | virantha/lexic | 1 | python | def ordered_load(stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict):
' Helper function to allow yaml load routine to use an OrderedDict instead of regular dict.\n This helps keeps things sane when ordering the runs and printing out routines\n '
class OrderedLoader(Loader):
pass
d... | def ordered_load(stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict):
' Helper function to allow yaml load routine to use an OrderedDict instead of regular dict.\n This helps keeps things sane when ordering the runs and printing out routines\n '
class OrderedLoader(Loader):
pass
d... |
e182a8e80b4993ab59a0a860f97e665250c33375ff4361f3f285d0c0c7bf58cf | def merge_args(conf_args, orig_args):
' Return new dict with args, and then conf_args merged in.\n Make sure that any keys in conf_args are also present in args\n '
args = {}
for plugin_name in list(conf_args.keys()):
if plugin_name.startswith('-'):
pass
else:
... | Return new dict with args, and then conf_args merged in.
Make sure that any keys in conf_args are also present in args | lexic/utils.py | merge_args | virantha/lexic | 1 | python | def merge_args(conf_args, orig_args):
' Return new dict with args, and then conf_args merged in.\n Make sure that any keys in conf_args are also present in args\n '
args = {}
for plugin_name in list(conf_args.keys()):
if plugin_name.startswith('-'):
pass
else:
... | def merge_args(conf_args, orig_args):
' Return new dict with args, and then conf_args merged in.\n Make sure that any keys in conf_args are also present in args\n '
args = {}
for plugin_name in list(conf_args.keys()):
if plugin_name.startswith('-'):
pass
else:
... |
53af930eccdc857fb60df23617bfc151ea4b5f56327418134d78bd41b0535f75 | def report(self, acc, loss):
'Report at every step.'
reporter.report({'acc': acc}, self)
reporter.report({'loss': loss}, self) | Report at every step. | espnet/nets/pytorch_backend/e2e_lid_lstm.py | report | luyizhou4/espnet | 0 | python | def report(self, acc, loss):
reporter.report({'acc': acc}, self)
reporter.report({'loss': loss}, self) | def report(self, acc, loss):
reporter.report({'acc': acc}, self)
reporter.report({'loss': loss}, self)<|docstring|>Report at every step.<|endoftext|> |
146a99af98656e4fde75f151a959302b8f9a58fcdc8de5742681ec14880dbad4 | @staticmethod
def add_arguments(parser):
'Add arguments for the encoder.'
group = parser.add_argument_group('E2E encoder setting')
group.add_argument('--etype', default='cnnblstm', type=str, help='Type of encoder network architecture')
group.add_argument('--elayers', default=3, type=int, help='Number of... | Add arguments for the encoder. | espnet/nets/pytorch_backend/e2e_lid_lstm.py | add_arguments | luyizhou4/espnet | 0 | python | @staticmethod
def add_arguments(parser):
group = parser.add_argument_group('E2E encoder setting')
group.add_argument('--etype', default='cnnblstm', type=str, help='Type of encoder network architecture')
group.add_argument('--elayers', default=3, type=int, help='Number of encoder layers (for shared reco... | @staticmethod
def add_arguments(parser):
group = parser.add_argument_group('E2E encoder setting')
group.add_argument('--etype', default='cnnblstm', type=str, help='Type of encoder network architecture')
group.add_argument('--elayers', default=3, type=int, help='Number of encoder layers (for shared reco... |
2db349258dbc86ce49ba3b0162bfb5dbe0cf0786b89ac2d941d05ba487ffcd00 | def __init__(self, idim, odim, args):
'Construct an E2E object.\n\n :param int idim: dimension of inputs\n :param int odim: dimension of outputs\n :param Namespace args: argument Namespace containing options\n '
super(E2E, self).__init__()
torch.nn.Module.__init__(self)
self.... | Construct an E2E object.
:param int idim: dimension of inputs
:param int odim: dimension of outputs
:param Namespace args: argument Namespace containing options | espnet/nets/pytorch_backend/e2e_lid_lstm.py | __init__ | luyizhou4/espnet | 0 | python | def __init__(self, idim, odim, args):
'Construct an E2E object.\n\n :param int idim: dimension of inputs\n :param int odim: dimension of outputs\n :param Namespace args: argument Namespace containing options\n '
super(E2E, self).__init__()
torch.nn.Module.__init__(self)
self.... | def __init__(self, idim, odim, args):
'Construct an E2E object.\n\n :param int idim: dimension of inputs\n :param int odim: dimension of outputs\n :param Namespace args: argument Namespace containing options\n '
super(E2E, self).__init__()
torch.nn.Module.__init__(self)
self.... |
638926a33ff97da8a4fc0fc70ec7215fa8606c2dcb072f9fc8a9cbf5b856bf94 | def forward(self, xs_pad, ilens, ys_pad):
'E2E forward.\n\n :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim)\n :param torch.Tensor ilens: batch of lengths of input sequences (B)\n :param torch.Tensor ys_pad: batch of padded token id sequence tensor (B, Lmax)\n ... | E2E forward.
:param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim)
:param torch.Tensor ilens: batch of lengths of input sequences (B)
:param torch.Tensor ys_pad: batch of padded token id sequence tensor (B, Lmax)
:return: loss value
:rtype: torch.Tensor | espnet/nets/pytorch_backend/e2e_lid_lstm.py | forward | luyizhou4/espnet | 0 | python | def forward(self, xs_pad, ilens, ys_pad):
'E2E forward.\n\n :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim)\n :param torch.Tensor ilens: batch of lengths of input sequences (B)\n :param torch.Tensor ys_pad: batch of padded token id sequence tensor (B, Lmax)\n ... | def forward(self, xs_pad, ilens, ys_pad):
'E2E forward.\n\n :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim)\n :param torch.Tensor ilens: batch of lengths of input sequences (B)\n :param torch.Tensor ys_pad: batch of padded token id sequence tensor (B, Lmax)\n ... |
712f7debd2bffb56648a5ec90f692965702d1eb4a741251daf4b1ca18ca52d50 | def encode(self, x):
'Encode acoustic features.\n\n :param ndarray x: input acoustic feature (T, D)\n :return: encoder outputs\n :rtype: torch.Tensor\n '
self.eval()
ilens = [x.shape[0]]
x = x[(::self.subsample[0], :)]
p = next(self.parameters())
h = torch.as_tensor(x... | Encode acoustic features.
:param ndarray x: input acoustic feature (T, D)
:return: encoder outputs
:rtype: torch.Tensor | espnet/nets/pytorch_backend/e2e_lid_lstm.py | encode | luyizhou4/espnet | 0 | python | def encode(self, x):
'Encode acoustic features.\n\n :param ndarray x: input acoustic feature (T, D)\n :return: encoder outputs\n :rtype: torch.Tensor\n '
self.eval()
ilens = [x.shape[0]]
x = x[(::self.subsample[0], :)]
p = next(self.parameters())
h = torch.as_tensor(x... | def encode(self, x):
'Encode acoustic features.\n\n :param ndarray x: input acoustic feature (T, D)\n :return: encoder outputs\n :rtype: torch.Tensor\n '
self.eval()
ilens = [x.shape[0]]
x = x[(::self.subsample[0], :)]
p = next(self.parameters())
h = torch.as_tensor(x... |
59e4e7c0e68ea9303827110c7802a05eef6e717312778e47b1d61d368bfbe095 | def recognize(self, x, recog_args, char_list=None, rnnlm=None):
'E2E beam search.\n\n :param ndarray x: input acoustic feature (T, D)\n :param Namespace recog_args: argument Namespace containing options\n :param list char_list: list of characters\n :param torch.nn.Module rnnlm: language ... | E2E beam search.
:param ndarray x: input acoustic feature (T, D)
:param Namespace recog_args: argument Namespace containing options
:param list char_list: list of characters
:param torch.nn.Module rnnlm: language model module
:return: N-best decoding results
:rtype: list | espnet/nets/pytorch_backend/e2e_lid_lstm.py | recognize | luyizhou4/espnet | 0 | python | def recognize(self, x, recog_args, char_list=None, rnnlm=None):
'E2E beam search.\n\n :param ndarray x: input acoustic feature (T, D)\n :param Namespace recog_args: argument Namespace containing options\n :param list char_list: list of characters\n :param torch.nn.Module rnnlm: language ... | def recognize(self, x, recog_args, char_list=None, rnnlm=None):
'E2E beam search.\n\n :param ndarray x: input acoustic feature (T, D)\n :param Namespace recog_args: argument Namespace containing options\n :param list char_list: list of characters\n :param torch.nn.Module rnnlm: language ... |
567965df9ddefd0372fa579583bbfa049ac011fcba5424ffb120b4f1aa79102d | def vars(self, scope: str='') -> VarCollection:
'Collect all the variables (and their names) contained in the module and its submodules.\n Important: Variables and modules stored Python structures such as dict or list are not collected. See ModuleList\n if you need such a feature.\n\n Args:\n ... | Collect all the variables (and their names) contained in the module and its submodules.
Important: Variables and modules stored Python structures such as dict or list are not collected. See ModuleList
if you need such a feature.
Args:
scope: string to prefix to the variable names.
Returns:
A VarCollection of a... | objax/module.py | vars | parmarsuraj99/objax | 2 | python | def vars(self, scope: str=) -> VarCollection:
'Collect all the variables (and their names) contained in the module and its submodules.\n Important: Variables and modules stored Python structures such as dict or list are not collected. See ModuleList\n if you need such a feature.\n\n Args:\n ... | def vars(self, scope: str=) -> VarCollection:
'Collect all the variables (and their names) contained in the module and its submodules.\n Important: Variables and modules stored Python structures such as dict or list are not collected. See ModuleList\n if you need such a feature.\n\n Args:\n ... |
fa97a198d335e41851a41b63acabb63824d82250b2cf64ca5fd57263e78f58cb | def __call__(self, *args, **kwargs):
'Optional module __call__ method, typically a forward pass computation for standard primitives.'
raise NotImplementedError | Optional module __call__ method, typically a forward pass computation for standard primitives. | objax/module.py | __call__ | parmarsuraj99/objax | 2 | python | def __call__(self, *args, **kwargs):
raise NotImplementedError | def __call__(self, *args, **kwargs):
raise NotImplementedError<|docstring|>Optional module __call__ method, typically a forward pass computation for standard primitives.<|endoftext|> |
cc7c3641411eae1e745d1f540901a632c9665bcaec870946fd37444553603290 | def vars(self, scope: str='') -> VarCollection:
'Collect all the variables (and their names) contained in the list and its submodules.\n\n Args:\n scope: string to prefix to the variable names.\n Returns:\n A VarCollection of all the variables.\n '
vc = VarCollection()... | Collect all the variables (and their names) contained in the list and its submodules.
Args:
scope: string to prefix to the variable names.
Returns:
A VarCollection of all the variables. | objax/module.py | vars | parmarsuraj99/objax | 2 | python | def vars(self, scope: str=) -> VarCollection:
'Collect all the variables (and their names) contained in the list and its submodules.\n\n Args:\n scope: string to prefix to the variable names.\n Returns:\n A VarCollection of all the variables.\n '
vc = VarCollection()
... | def vars(self, scope: str=) -> VarCollection:
'Collect all the variables (and their names) contained in the list and its submodules.\n\n Args:\n scope: string to prefix to the variable names.\n Returns:\n A VarCollection of all the variables.\n '
vc = VarCollection()
... |
90047934388eac9846bc68b3c72c0f38fdd5d80b2be1f13a7459afb52cad1de4 | def vars(self, scope: str='') -> VarCollection:
'Collect all the variables (and their names) contained in the VarCollection.\n\n Args:\n scope: string to prefix to the variable names.\n Returns:\n A VarCollection of all the variables.\n '
return VarCollection((((scope ... | Collect all the variables (and their names) contained in the VarCollection.
Args:
scope: string to prefix to the variable names.
Returns:
A VarCollection of all the variables. | objax/module.py | vars | parmarsuraj99/objax | 2 | python | def vars(self, scope: str=) -> VarCollection:
'Collect all the variables (and their names) contained in the VarCollection.\n\n Args:\n scope: string to prefix to the variable names.\n Returns:\n A VarCollection of all the variables.\n '
return VarCollection((((scope + ... | def vars(self, scope: str=) -> VarCollection:
'Collect all the variables (and their names) contained in the VarCollection.\n\n Args:\n scope: string to prefix to the variable names.\n Returns:\n A VarCollection of all the variables.\n '
return VarCollection((((scope + ... |
593c777a255202e1ab52b2e1c53345b21fda717da4a4dafbc74b1f21b7844cd4 | def __init__(self, f: Union[(Module, Callable)], vc: Optional[VarCollection]=None, static_argnums: Optional[Tuple[(int, ...)]]=None):
"Jit constructor.\n\n Args:\n f: the function or the module to compile.\n vc: the VarCollection of variables used by the function or module. This argumen... | Jit constructor.
Args:
f: the function or the module to compile.
vc: the VarCollection of variables used by the function or module. This argument is required for functions.
static_argnums: tuple of indexes of f's input arguments to treat as static (constants)).
A new graph is compiled for each diff... | objax/module.py | __init__ | parmarsuraj99/objax | 2 | python | def __init__(self, f: Union[(Module, Callable)], vc: Optional[VarCollection]=None, static_argnums: Optional[Tuple[(int, ...)]]=None):
"Jit constructor.\n\n Args:\n f: the function or the module to compile.\n vc: the VarCollection of variables used by the function or module. This argumen... | def __init__(self, f: Union[(Module, Callable)], vc: Optional[VarCollection]=None, static_argnums: Optional[Tuple[(int, ...)]]=None):
"Jit constructor.\n\n Args:\n f: the function or the module to compile.\n vc: the VarCollection of variables used by the function or module. This argumen... |
db048e6422c3fe7e59a12345737df9a42601b7bdf2b4074ff2f9f22e63181d0c | def jit_local_method(self, f, static_argnums):
'Compiles a function or module and returns method that can be attached to self instance.\n\n Args:\n f: function or module to compile.\n static_argnums: indexes of the arguments to be treated as static.\n\n Returns:\n A me... | Compiles a function or module and returns method that can be attached to self instance.
Args:
f: function or module to compile.
static_argnums: indexes of the arguments to be treated as static.
Returns:
A method containing the compiled version of f. | objax/module.py | jit_local_method | parmarsuraj99/objax | 2 | python | def jit_local_method(self, f, static_argnums):
'Compiles a function or module and returns method that can be attached to self instance.\n\n Args:\n f: function or module to compile.\n static_argnums: indexes of the arguments to be treated as static.\n\n Returns:\n A me... | def jit_local_method(self, f, static_argnums):
'Compiles a function or module and returns method that can be attached to self instance.\n\n Args:\n f: function or module to compile.\n static_argnums: indexes of the arguments to be treated as static.\n\n Returns:\n A me... |
91b66a95ac83d674d8a2bcaf57f4c0b88a3aaeff47a2d68ff3c586235451f75f | def __call__(self, *args):
'Call the compiled version of the function or module.'
return self._call(*args) | Call the compiled version of the function or module. | objax/module.py | __call__ | parmarsuraj99/objax | 2 | python | def __call__(self, *args):
return self._call(*args) | def __call__(self, *args):
return self._call(*args)<|docstring|>Call the compiled version of the function or module.<|endoftext|> |
368384cbf035ecb27475efe9074a3d61663d6a51813620980ff6185e1690d000 | def __init__(self, f: Union[(Module, Callable)], vc: Optional[VarCollection]=None, reduce: Callable[([JaxArray], JaxArray)]=jn.concatenate, axis_name: str='device', static_argnums: Optional[Tuple[(int, ...)]]=None):
"Parallel constructor.\n\n Args:\n f: the function or the module to compile for pa... | Parallel constructor.
Args:
f: the function or the module to compile for parallelism.
vc: the VarCollection of variables used by the function or module. This argument is required for functions.
reduce: the function used reduce the outputs from many devices to a single device value.
axis_name: what name... | objax/module.py | __init__ | parmarsuraj99/objax | 2 | python | def __init__(self, f: Union[(Module, Callable)], vc: Optional[VarCollection]=None, reduce: Callable[([JaxArray], JaxArray)]=jn.concatenate, axis_name: str='device', static_argnums: Optional[Tuple[(int, ...)]]=None):
"Parallel constructor.\n\n Args:\n f: the function or the module to compile for pa... | def __init__(self, f: Union[(Module, Callable)], vc: Optional[VarCollection]=None, reduce: Callable[([JaxArray], JaxArray)]=jn.concatenate, axis_name: str='device', static_argnums: Optional[Tuple[(int, ...)]]=None):
"Parallel constructor.\n\n Args:\n f: the function or the module to compile for pa... |
f87ca15be4b796d654e5fe84ab21148e584737e9e0e68e635f500af61068cf93 | def device_reshape(self, x: JaxArray) -> JaxArray:
'Utility to reshape an input array in order to broadcast to multiple devices.'
return x.reshape(((self.ndevices, (x.shape[0] // self.ndevices)) + x.shape[1:])) | Utility to reshape an input array in order to broadcast to multiple devices. | objax/module.py | device_reshape | parmarsuraj99/objax | 2 | python | def device_reshape(self, x: JaxArray) -> JaxArray:
return x.reshape(((self.ndevices, (x.shape[0] // self.ndevices)) + x.shape[1:])) | def device_reshape(self, x: JaxArray) -> JaxArray:
return x.reshape(((self.ndevices, (x.shape[0] // self.ndevices)) + x.shape[1:]))<|docstring|>Utility to reshape an input array in order to broadcast to multiple devices.<|endoftext|> |
f9799f346377a640dd78827961d316caa41cea62041ce672722fd70996084ebc | def __call__(self, *args):
'Call the compiled function or module on multiple devices in parallel.\n Important: Make sure you call this function within the scope of VarCollection.replicate() statement.\n '
args = [(x if (i in self.static_argnums) else self.device_reshape(x)) for (i, x) in enumerate... | Call the compiled function or module on multiple devices in parallel.
Important: Make sure you call this function within the scope of VarCollection.replicate() statement. | objax/module.py | __call__ | parmarsuraj99/objax | 2 | python | def __call__(self, *args):
'Call the compiled function or module on multiple devices in parallel.\n Important: Make sure you call this function within the scope of VarCollection.replicate() statement.\n '
args = [(x if (i in self.static_argnums) else self.device_reshape(x)) for (i, x) in enumerate... | def __call__(self, *args):
'Call the compiled function or module on multiple devices in parallel.\n Important: Make sure you call this function within the scope of VarCollection.replicate() statement.\n '
args = [(x if (i in self.static_argnums) else self.device_reshape(x)) for (i, x) in enumerate... |
07d0184b065a170eff89a8d9a00a1119968b1c56cee0df1c068f99fcca206c4a | def __init__(self, f: Union[(Module, Callable)], vc: Optional[VarCollection]=None, batch_axis: Tuple[(Optional[int], ...)]=(0,)):
"Vectorize constructor.\n\n Args:\n f: the function or the module to compile for vectorization.\n vc: the VarCollection of variables used by the function or ... | Vectorize constructor.
Args:
f: the function or the module to compile for vectorization.
vc: the VarCollection of variables used by the function or module. This argument is required for functions.
batch_axis: tuple of int or None for each of f's input arguments: the axis to use as batch during
vect... | objax/module.py | __init__ | parmarsuraj99/objax | 2 | python | def __init__(self, f: Union[(Module, Callable)], vc: Optional[VarCollection]=None, batch_axis: Tuple[(Optional[int], ...)]=(0,)):
"Vectorize constructor.\n\n Args:\n f: the function or the module to compile for vectorization.\n vc: the VarCollection of variables used by the function or ... | def __init__(self, f: Union[(Module, Callable)], vc: Optional[VarCollection]=None, batch_axis: Tuple[(Optional[int], ...)]=(0,)):
"Vectorize constructor.\n\n Args:\n f: the function or the module to compile for vectorization.\n vc: the VarCollection of variables used by the function or ... |
1dc035192cd5208e2951f93dff4cd1f1317a05a30ae92730e6081601c81efab1 | def __call__(self, *args):
'Call the vectorized version of the function or module.'
assert (len(args) == len(self.batch_axis)), f'Number of arguments passed {len(args)} must match batched {len(self.batch_axis)}'
nsplits = args[self.batch_axis_argnums[0][0]].shape[self.batch_axis_argnums[0][1]]
(output, ... | Call the vectorized version of the function or module. | objax/module.py | __call__ | parmarsuraj99/objax | 2 | python | def __call__(self, *args):
assert (len(args) == len(self.batch_axis)), f'Number of arguments passed {len(args)} must match batched {len(self.batch_axis)}'
nsplits = args[self.batch_axis_argnums[0][0]].shape[self.batch_axis_argnums[0][1]]
(output, changes) = self._call(self.vc.tensors(), [v.split(nsplit... | def __call__(self, *args):
assert (len(args) == len(self.batch_axis)), f'Number of arguments passed {len(args)} must match batched {len(self.batch_axis)}'
nsplits = args[self.batch_axis_argnums[0][0]].shape[self.batch_axis_argnums[0][1]]
(output, changes) = self._call(self.vc.tensors(), [v.split(nsplit... |
a4e2ca2c32e8634a6c84ba5736727abacc33a79f053b3c192eb7c9f4e31f6173 | def __init__(self, output_nexus_filename, input_nexus_filename=None, compress_type=None, compress_opts=None, nx_entry_name='raw_data_1', idf_file=None, file_in_memory=False):
'\n compress_type=32001 for BLOSC\n\n :param output_nexus_filename: Name of the output file\n :param input_nexus_filenam... | compress_type=32001 for BLOSC
:param output_nexus_filename: Name of the output file
:param input_nexus_filename: Name of the input file
:param nx_entry_name: Name of the root group (NXentry class)
:param compress_type: Name or id of compression filter https://support.hdfgroup.org/services/contributions.html
:param com... | nexusutils/nexusbuilder.py | __init__ | ScreamingUdder/kafka-nexus-utilities | 1 | python | def __init__(self, output_nexus_filename, input_nexus_filename=None, compress_type=None, compress_opts=None, nx_entry_name='raw_data_1', idf_file=None, file_in_memory=False):
'\n compress_type=32001 for BLOSC\n\n :param output_nexus_filename: Name of the output file\n :param input_nexus_filenam... | def __init__(self, output_nexus_filename, input_nexus_filename=None, compress_type=None, compress_opts=None, nx_entry_name='raw_data_1', idf_file=None, file_in_memory=False):
'\n compress_type=32001 for BLOSC\n\n :param output_nexus_filename: Name of the output file\n :param input_nexus_filenam... |
e62d6dcc169ab778548204f17a060715fae1112fc78cbb7440ca7b9484d9dc4e | def copy_items(self, dataset_map):
'\n Copy datasets and groups from one NeXus file to another\n NB, the order is important as the method of copying groups used deletes any sub-groups and datasets.\n\n :param dataset_map: Input groups and datasets to output ones, order must be top-down in hiera... | Copy datasets and groups from one NeXus file to another
NB, the order is important as the method of copying groups used deletes any sub-groups and datasets.
:param dataset_map: Input groups and datasets to output ones, order must be top-down in hierarchy of output file
Must be ordered. | nexusutils/nexusbuilder.py | copy_items | ScreamingUdder/kafka-nexus-utilities | 1 | python | def copy_items(self, dataset_map):
'\n Copy datasets and groups from one NeXus file to another\n NB, the order is important as the method of copying groups used deletes any sub-groups and datasets.\n\n :param dataset_map: Input groups and datasets to output ones, order must be top-down in hiera... | def copy_items(self, dataset_map):
'\n Copy datasets and groups from one NeXus file to another\n NB, the order is important as the method of copying groups used deletes any sub-groups and datasets.\n\n :param dataset_map: Input groups and datasets to output ones, order must be top-down in hiera... |
3b0c4a17952655ced066a80fceada46d43d81c4df11292e71096dff1273db87f | def add_user(self, name, affiliation, number=1):
'\n Add an NXuser\n \n :param name: Name of the user\n :param affiliation: Affiliation of the user\n :param number: User entry number, usually starting from 1\n :return: NXuser\n '
user_group = self.add_nx_group(se... | Add an NXuser
:param name: Name of the user
:param affiliation: Affiliation of the user
:param number: User entry number, usually starting from 1
:return: NXuser | nexusutils/nexusbuilder.py | add_user | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_user(self, name, affiliation, number=1):
'\n Add an NXuser\n \n :param name: Name of the user\n :param affiliation: Affiliation of the user\n :param number: User entry number, usually starting from 1\n :return: NXuser\n '
user_group = self.add_nx_group(se... | def add_user(self, name, affiliation, number=1):
'\n Add an NXuser\n \n :param name: Name of the user\n :param affiliation: Affiliation of the user\n :param number: User entry number, usually starting from 1\n :return: NXuser\n '
user_group = self.add_nx_group(se... |
08e87009d2ce87c39cc630cb91deafa683efcdcf3af8871474f41a2a39b0c2c2 | def add_dataset(self, group, name, data, attributes=None):
'\n Add a dataset to a given group\n\n :param group: Group object, or group path from NXentry as a string\n :param name: Name of the dataset to create\n :param data: Data to put in the dataset\n :param attributes: Optional... | Add a dataset to a given group
:param group: Group object, or group path from NXentry as a string
:param name: Name of the dataset to create
:param data: Data to put in the dataset
:param attributes: Optional dictionary of attributes to add to dataset
:return: Dataset | nexusutils/nexusbuilder.py | add_dataset | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_dataset(self, group, name, data, attributes=None):
'\n Add a dataset to a given group\n\n :param group: Group object, or group path from NXentry as a string\n :param name: Name of the dataset to create\n :param data: Data to put in the dataset\n :param attributes: Optional... | def add_dataset(self, group, name, data, attributes=None):
'\n Add a dataset to a given group\n\n :param group: Group object, or group path from NXentry as a string\n :param name: Name of the dataset to create\n :param data: Data to put in the dataset\n :param attributes: Optional... |
fe2809ca5826c59ec7c33d5b65e812ef6f5b57ca04c0fb4125d5c64cdba56d42 | def add_detectors_from_idf(self):
'\n Add detector banks from a Mantid IDF file\n\n :return: Number of detector panels added\n '
if (self.idf_parser is None):
logger.error('No IDF file was given to the NexusBuilder, cannot call add_detector_banks_from_idf')
total_panels = 0
... | Add detector banks from a Mantid IDF file
:return: Number of detector panels added | nexusutils/nexusbuilder.py | add_detectors_from_idf | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_detectors_from_idf(self):
'\n Add detector banks from a Mantid IDF file\n\n :return: Number of detector panels added\n '
if (self.idf_parser is None):
logger.error('No IDF file was given to the NexusBuilder, cannot call add_detector_banks_from_idf')
total_panels = 0
... | def add_detectors_from_idf(self):
'\n Add detector banks from a Mantid IDF file\n\n :return: Number of detector panels added\n '
if (self.idf_parser is None):
logger.error('No IDF file was given to the NexusBuilder, cannot call add_detector_banks_from_idf')
total_panels = 0
... |
0d8b152345db55c57a701080241dd114e4a9903cd2ae01d65c2f5c2eb287b7b7 | def add_monitors_from_idf(self):
'\n Add monitors from a Mantid IDF file\n\n :return: Number of monitors added\n '
if (self.instrument is None):
raise Exception('There needs to be an NXinstrument before you can add monitors')
(monitors, monitor_types) = self.idf_parser.get_monit... | Add monitors from a Mantid IDF file
:return: Number of monitors added | nexusutils/nexusbuilder.py | add_monitors_from_idf | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_monitors_from_idf(self):
'\n Add monitors from a Mantid IDF file\n\n :return: Number of monitors added\n '
if (self.instrument is None):
raise Exception('There needs to be an NXinstrument before you can add monitors')
(monitors, monitor_types) = self.idf_parser.get_monit... | def add_monitors_from_idf(self):
'\n Add monitors from a Mantid IDF file\n\n :return: Number of monitors added\n '
if (self.instrument is None):
raise Exception('There needs to be an NXinstrument before you can add monitors')
(monitors, monitor_types) = self.idf_parser.get_monit... |
58ff445a1e590f2aab621f122c1057727de2ff1039e9615292cc24781ca668b3 | def add_detector(self, name, number, detector_ids, offsets, distance=None, x_pixel_size=None, y_pixel_size=None, diameter=None, thickness=None, x_beam_centre=None, y_beam_centre=None):
'\n Add an NXdetector, only suitable for rectangular detectors of consistent pixels\n \n :param name: Name of ... | Add an NXdetector, only suitable for rectangular detectors of consistent pixels
:param name: Name of the detector panel
:param number : Banks are numbered from 1
:param offsets : Dictionary of pixel offsets
:param x_pixel_size: Pixel width
:param y_pixel_size: Pixel height
:param diameter: If detector is cylindrical t... | nexusutils/nexusbuilder.py | add_detector | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_detector(self, name, number, detector_ids, offsets, distance=None, x_pixel_size=None, y_pixel_size=None, diameter=None, thickness=None, x_beam_centre=None, y_beam_centre=None):
'\n Add an NXdetector, only suitable for rectangular detectors of consistent pixels\n \n :param name: Name of ... | def add_detector(self, name, number, detector_ids, offsets, distance=None, x_pixel_size=None, y_pixel_size=None, diameter=None, thickness=None, x_beam_centre=None, y_beam_centre=None):
'\n Add an NXdetector, only suitable for rectangular detectors of consistent pixels\n \n :param name: Name of ... |
31fc78c0d8c660495f5dc26d2d6f82b59f77ebffe343d5c9b1b4194ed1dacb59 | def add_detector_minimal(self, name, number, depends_on=None):
'\n Add an NXdetector with minimal details\n \n :param name: Name of the detector panel\n :param number: Detectors are typically numbered from 1\n :param depends_on: Dataset object or name (full path) of axis the detec... | Add an NXdetector with minimal details
:param name: Name of the detector panel
:param number: Detectors are typically numbered from 1
:param depends_on: Dataset object or name (full path) of axis the detector depends on
:return: NXdetector group | nexusutils/nexusbuilder.py | add_detector_minimal | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_detector_minimal(self, name, number, depends_on=None):
'\n Add an NXdetector with minimal details\n \n :param name: Name of the detector panel\n :param number: Detectors are typically numbered from 1\n :param depends_on: Dataset object or name (full path) of axis the detec... | def add_detector_minimal(self, name, number, depends_on=None):
'\n Add an NXdetector with minimal details\n \n :param name: Name of the detector panel\n :param number: Detectors are typically numbered from 1\n :param depends_on: Dataset object or name (full path) of axis the detec... |
ec6877b09930740943aca90f7947f28493ed81546543d2c678724bec06685260 | def add_shape(self, group, name, vertices, off_faces, detector_faces=None):
'\n Add an NXoff_geometry to define geometry in OFF-like format\n\n :param group: Group or group name to add the NXoff_geometry group to\n :param name: Name of the NXoff_geometry group\n :param vertices: 2D numpy... | Add an NXoff_geometry to define geometry in OFF-like format
:param group: Group or group name to add the NXoff_geometry group to
:param name: Name of the NXoff_geometry group
:param vertices: 2D numpy array list of [x,y,z] coordinates of vertices
:param off_faces: OFF-style vertex indices for each face
:param detector... | nexusutils/nexusbuilder.py | add_shape | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_shape(self, group, name, vertices, off_faces, detector_faces=None):
'\n Add an NXoff_geometry to define geometry in OFF-like format\n\n :param group: Group or group name to add the NXoff_geometry group to\n :param name: Name of the NXoff_geometry group\n :param vertices: 2D numpy... | def add_shape(self, group, name, vertices, off_faces, detector_faces=None):
'\n Add an NXoff_geometry to define geometry in OFF-like format\n\n :param group: Group or group name to add the NXoff_geometry group to\n :param name: Name of the NXoff_geometry group\n :param vertices: 2D numpy... |
f45062d9c77745e72b8441d11950b11871d0d9a01b42ea2f4554108c94e8ff2d | def add_tube_pixel(self, group, height, radius, axis, centre=None):
'\n Construct an NXcylindrical_geometry description of a tube, using basic cylinder description\n\n :param group: Group to add the pixel geometry to\n :param height: Height of the tube\n :param radius: Radius of the tube... | Construct an NXcylindrical_geometry description of a tube, using basic cylinder description
:param group: Group to add the pixel geometry to
:param height: Height of the tube
:param radius: Radius of the tube
:param axis: Axis of the tube as a unit vector
:param centre: On-axis centre of the tube in form [x, y, z]
:re... | nexusutils/nexusbuilder.py | add_tube_pixel | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_tube_pixel(self, group, height, radius, axis, centre=None):
'\n Construct an NXcylindrical_geometry description of a tube, using basic cylinder description\n\n :param group: Group to add the pixel geometry to\n :param height: Height of the tube\n :param radius: Radius of the tube... | def add_tube_pixel(self, group, height, radius, axis, centre=None):
'\n Construct an NXcylindrical_geometry description of a tube, using basic cylinder description\n\n :param group: Group to add the pixel geometry to\n :param height: Height of the tube\n :param radius: Radius of the tube... |
a9fc30ef5b56b5cabee9e17b7bc93e4713cfcef8ec1ad7c3adc79891f5dc3c3b | def __copy_group(self, source_group_name, target_group_name):
'\n Copy a group with its attributes but without members\n \n :param source_group_name: Name of group in source file\n :param target_group_name: Name of group in target file\n '
self.target_file.copy(self.source_file[so... | Copy a group with its attributes but without members
:param source_group_name: Name of group in source file
:param target_group_name: Name of group in target file | nexusutils/nexusbuilder.py | __copy_group | ScreamingUdder/kafka-nexus-utilities | 1 | python | def __copy_group(self, source_group_name, target_group_name):
'\n Copy a group with its attributes but without members\n \n :param source_group_name: Name of group in source file\n :param target_group_name: Name of group in target file\n '
self.target_file.copy(self.source_file[so... | def __copy_group(self, source_group_name, target_group_name):
'\n Copy a group with its attributes but without members\n \n :param source_group_name: Name of group in source file\n :param target_group_name: Name of group in target file\n '
self.target_file.copy(self.source_file[so... |
6e59d710597a7004cd09d9b27fc3d71bba1aa5886d08dd5ec78fa0211e3b0b70 | def __copy_dataset(self, dataset, target_dataset):
"\n Copy a dataset with specified compression options and the source dataset's attributes\n \n :param dataset: The dataset being copied\n :param target_dataset: Name of the dataset in the target file\n "
try:
d_set = self.... | Copy a dataset with specified compression options and the source dataset's attributes
:param dataset: The dataset being copied
:param target_dataset: Name of the dataset in the target file | nexusutils/nexusbuilder.py | __copy_dataset | ScreamingUdder/kafka-nexus-utilities | 1 | python | def __copy_dataset(self, dataset, target_dataset):
"\n Copy a dataset with specified compression options and the source dataset's attributes\n \n :param dataset: The dataset being copied\n :param target_dataset: Name of the dataset in the target file\n "
try:
d_set = self.... | def __copy_dataset(self, dataset, target_dataset):
"\n Copy a dataset with specified compression options and the source dataset's attributes\n \n :param dataset: The dataset being copied\n :param target_dataset: Name of the dataset in the target file\n "
try:
d_set = self.... |
2420f138910be14899bebe36737559a37120bbb51c266b35363a2de3ca02edae | def add_shape_from_file(self, filename, group, name):
'\n Add an NXoff_geometry shape definition from an OFF file\n\n :param filename: Name of the OFF file from which to get the geometry\n :param group: Group to add the NXoff_geometry to\n :param name: Name of the NXoff_geometry group to... | Add an NXoff_geometry shape definition from an OFF file
:param filename: Name of the OFF file from which to get the geometry
:param group: Group to add the NXoff_geometry to
:param name: Name of the NXoff_geometry group to be created
:return: NXoff_geometry group | nexusutils/nexusbuilder.py | add_shape_from_file | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_shape_from_file(self, filename, group, name):
'\n Add an NXoff_geometry shape definition from an OFF file\n\n :param filename: Name of the OFF file from which to get the geometry\n :param group: Group to add the NXoff_geometry to\n :param name: Name of the NXoff_geometry group to... | def add_shape_from_file(self, filename, group, name):
'\n Add an NXoff_geometry shape definition from an OFF file\n\n :param filename: Name of the OFF file from which to get the geometry\n :param group: Group to add the NXoff_geometry to\n :param name: Name of the NXoff_geometry group to... |
765d4c611e472e20a5523b29d08d291216440957f3af337fb485c9b8169c194f | def add_structured_detectors_from_idf(self):
'\n Find structured detectors in the IDF and add corresponding NXgrid_shapes in the NeXus file\n\n :return: Number of grid shapes added\n '
detector_number = 1
for detector in self.idf_parser.get_structured_detectors():
detector_group... | Find structured detectors in the IDF and add corresponding NXgrid_shapes in the NeXus file
:return: Number of grid shapes added | nexusutils/nexusbuilder.py | add_structured_detectors_from_idf | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_structured_detectors_from_idf(self):
'\n Find structured detectors in the IDF and add corresponding NXgrid_shapes in the NeXus file\n\n :return: Number of grid shapes added\n '
detector_number = 1
for detector in self.idf_parser.get_structured_detectors():
detector_group... | def add_structured_detectors_from_idf(self):
'\n Find structured detectors in the IDF and add corresponding NXgrid_shapes in the NeXus file\n\n :return: Number of grid shapes added\n '
detector_number = 1
for detector in self.idf_parser.get_structured_detectors():
detector_group... |
dd9a879f4dda8a598118278ccd970f76ff06b64b65ec77d1590b2e2d251a20a7 | def add_monitor(self, name, detector_id, location, units=None):
'\n Add a monitor to instrument\n\n :param name: Name for the monitor group\n :param detector_id: The detector id of the monitor\n :param location: Location of the monitor relative to the source\n :param units: Units ... | Add a monitor to instrument
:param name: Name for the monitor group
:param detector_id: The detector id of the monitor
:param location: Location of the monitor relative to the source
:param units: Units of the distances
:return: NXmonitor | nexusutils/nexusbuilder.py | add_monitor | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_monitor(self, name, detector_id, location, units=None):
'\n Add a monitor to instrument\n\n :param name: Name for the monitor group\n :param detector_id: The detector id of the monitor\n :param location: Location of the monitor relative to the source\n :param units: Units ... | def add_monitor(self, name, detector_id, location, units=None):
'\n Add a monitor to instrument\n\n :param name: Name for the monitor group\n :param detector_id: The detector id of the monitor\n :param location: Location of the monitor relative to the source\n :param units: Units ... |
39af05ba52e9d9b37d6a633e69033dc9b3723e8b3c03416d80b7db7c89fcdbb4 | def add_depends_on(self, group, dependee):
'\n Add a "depends_on" dataset to a group\n\n :param group: Group to add dataset to\n :param dependee: The dependee as a dataset, group (NXlog) or name (full path) string\n :return: The "depends_on" dataset\n '
if isinstance(dependee,... | Add a "depends_on" dataset to a group
:param group: Group to add dataset to
:param dependee: The dependee as a dataset, group (NXlog) or name (full path) string
:return: The "depends_on" dataset | nexusutils/nexusbuilder.py | add_depends_on | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_depends_on(self, group, dependee):
'\n Add a "depends_on" dataset to a group\n\n :param group: Group to add dataset to\n :param dependee: The dependee as a dataset, group (NXlog) or name (full path) string\n :return: The "depends_on" dataset\n '
if isinstance(dependee,... | def add_depends_on(self, group, dependee):
'\n Add a "depends_on" dataset to a group\n\n :param group: Group to add dataset to\n :param dependee: The dependee as a dataset, group (NXlog) or name (full path) string\n :return: The "depends_on" dataset\n '
if isinstance(dependee,... |
fd8235443ab045a6032dd2285d80022d23805dbb5c6f35bc33f97e715e47521d | def add_instrument(self, name, instrument_group_name='instrument'):
'\n Add an NXinstrument with specified name\n\n :param name: Name of the instrument\n :param instrument_group_name: Name for the NXinstrument group\n :return: NXinstrument\n '
self.instrument = self.add_nx_gro... | Add an NXinstrument with specified name
:param name: Name of the instrument
:param instrument_group_name: Name for the NXinstrument group
:return: NXinstrument | nexusutils/nexusbuilder.py | add_instrument | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_instrument(self, name, instrument_group_name='instrument'):
'\n Add an NXinstrument with specified name\n\n :param name: Name of the instrument\n :param instrument_group_name: Name for the NXinstrument group\n :return: NXinstrument\n '
self.instrument = self.add_nx_gro... | def add_instrument(self, name, instrument_group_name='instrument'):
'\n Add an NXinstrument with specified name\n\n :param name: Name of the instrument\n :param instrument_group_name: Name for the NXinstrument group\n :return: NXinstrument\n '
self.instrument = self.add_nx_gro... |
8280e7d9814c19f5a7427ad4216d69c6b1fd2e804fb7dbd61becff2a7f3ed044 | def add_transformation(self, transform_group, transformation_type, values, units, vector, offset=None, name='transformation', depends_on='.'):
'\n Add a transformation to an NXtransformations group\n\n :param transform_group: The NXtransformations group to add the translation to\n :param transf... | Add a transformation to an NXtransformations group
:param transform_group: The NXtransformations group to add the translation to
:param transformation_type: "translation" or "rotation"
:param values: Values to add to the dataset: distance to translate or angle to rotate
:param units: Units for the dataset's values
:pa... | nexusutils/nexusbuilder.py | add_transformation | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_transformation(self, transform_group, transformation_type, values, units, vector, offset=None, name='transformation', depends_on='.'):
'\n Add a transformation to an NXtransformations group\n\n :param transform_group: The NXtransformations group to add the translation to\n :param transf... | def add_transformation(self, transform_group, transformation_type, values, units, vector, offset=None, name='transformation', depends_on='.'):
'\n Add a transformation to an NXtransformations group\n\n :param transform_group: The NXtransformations group to add the translation to\n :param transf... |
848d51defaa31c8876bad0e920a5585e8a338b0e64708a7bab50c58d9a2c8e78 | def add_instrument_geometry_from_idf(self):
'\n Get all the geometry information we can from the IDF file\n '
instrument_name = self.idf_parser.get_instrument_name()
self.add_instrument(instrument_name)
logger.info((('Got instrument geometry for ' + instrument_name) + ' from IDF file, it h... | Get all the geometry information we can from the IDF file | nexusutils/nexusbuilder.py | add_instrument_geometry_from_idf | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_instrument_geometry_from_idf(self):
'\n \n '
instrument_name = self.idf_parser.get_instrument_name()
self.add_instrument(instrument_name)
logger.info((('Got instrument geometry for ' + instrument_name) + ' from IDF file, it has:'))
source_name = self.idf_parser.get_source_name(... | def add_instrument_geometry_from_idf(self):
'\n \n '
instrument_name = self.idf_parser.get_instrument_name()
self.add_instrument(instrument_name)
logger.info((('Got instrument geometry for ' + instrument_name) + ' from IDF file, it has:'))
source_name = self.idf_parser.get_source_name(... |
e3219b3e4e9ad95f961d1ef266db4c15489f93fec8969ce7afdbdb6643a40747 | def add_sample(self, name='sample'):
'\n Add an NXsample group\n\n :param name: Name for the NXsample group\n :return: The NXsample group\n '
sample_group = self.add_nx_group(self.root, name, 'NXsample')
return sample_group | Add an NXsample group
:param name: Name for the NXsample group
:return: The NXsample group | nexusutils/nexusbuilder.py | add_sample | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_sample(self, name='sample'):
'\n Add an NXsample group\n\n :param name: Name for the NXsample group\n :return: The NXsample group\n '
sample_group = self.add_nx_group(self.root, name, 'NXsample')
return sample_group | def add_sample(self, name='sample'):
'\n Add an NXsample group\n\n :param name: Name for the NXsample group\n :return: The NXsample group\n '
sample_group = self.add_nx_group(self.root, name, 'NXsample')
return sample_group<|docstring|>Add an NXsample group
:param name: Name for... |
beb1a8877835a9433dd3fcb5aad7b054c26e9875e6a0b44c9bcffb700920d862 | def add_source(self, name, group_name='source', position=None):
'\n Add an NXsource group\n\n :param name: Name of the source\n :param group_name: Name for the NXsource group\n :param position: Position of the source relative to the sample\n :return: The NXsource group\n '
... | Add an NXsource group
:param name: Name of the source
:param group_name: Name for the NXsource group
:param position: Position of the source relative to the sample
:return: The NXsource group | nexusutils/nexusbuilder.py | add_source | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_source(self, name, group_name='source', position=None):
'\n Add an NXsource group\n\n :param name: Name of the source\n :param group_name: Name for the NXsource group\n :param position: Position of the source relative to the sample\n :return: The NXsource group\n '
... | def add_source(self, name, group_name='source', position=None):
'\n Add an NXsource group\n\n :param name: Name of the source\n :param group_name: Name for the NXsource group\n :param position: Position of the source relative to the sample\n :return: The NXsource group\n '
... |
c9575a98ee73ec68dda240d8ac2232a6942408cc3c1f356146e33956b14df91e | def add_nx_group(self, parent_group, group_name, nx_class_name):
'\n Add an NXclass group\n\n :param parent_group: The parent group object\n :param group_name: Name for the group, any spaces are replaced with underscores\n :param nx_class_name: Name of the NXclass\n :return:\n ... | Add an NXclass group
:param parent_group: The parent group object
:param group_name: Name for the group, any spaces are replaced with underscores
:param nx_class_name: Name of the NXclass
:return: | nexusutils/nexusbuilder.py | add_nx_group | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_nx_group(self, parent_group, group_name, nx_class_name):
'\n Add an NXclass group\n\n :param parent_group: The parent group object\n :param group_name: Name for the group, any spaces are replaced with underscores\n :param nx_class_name: Name of the NXclass\n :return:\n ... | def add_nx_group(self, parent_group, group_name, nx_class_name):
'\n Add an NXclass group\n\n :param parent_group: The parent group object\n :param group_name: Name for the group, any spaces are replaced with underscores\n :param nx_class_name: Name of the NXclass\n :return:\n ... |
99c9bfd529bb719768bceca070e4e0a0f52ac82139be5edb9e4796d106812472 | def add_feature_for_class(self, class_name):
'\n If there is a feature (see https://github.com/nexusformat/features) corresponding to the added NX class\n then append its feature id to the set of features\n :param class_name:\n '
if (class_name == 'NXlog'):
feature_id = 'B051... | If there is a feature (see https://github.com/nexusformat/features) corresponding to the added NX class
then append its feature id to the set of features
:param class_name: | nexusutils/nexusbuilder.py | add_feature_for_class | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_feature_for_class(self, class_name):
'\n If there is a feature (see https://github.com/nexusformat/features) corresponding to the added NX class\n then append its feature id to the set of features\n :param class_name:\n '
if (class_name == 'NXlog'):
feature_id = 'B051... | def add_feature_for_class(self, class_name):
'\n If there is a feature (see https://github.com/nexusformat/features) corresponding to the added NX class\n then append its feature id to the set of features\n :param class_name:\n '
if (class_name == 'NXlog'):
feature_id = 'B051... |
119193f525f0c9f32648503b6e028fba5605c8fabddb9d436d363f2cb1ace843 | def __add_features(self):
'\n Add a dataset which details which "features" the file contains (see https://github.com/nexusformat/features),\n either features explicitly noted using add_feature or based on what NeXus classes have been added through\n the builder\n '
if self.features:
... | Add a dataset which details which "features" the file contains (see https://github.com/nexusformat/features),
either features explicitly noted using add_feature or based on what NeXus classes have been added through
the builder | nexusutils/nexusbuilder.py | __add_features | ScreamingUdder/kafka-nexus-utilities | 1 | python | def __add_features(self):
'\n Add a dataset which details which "features" the file contains (see https://github.com/nexusformat/features),\n either features explicitly noted using add_feature or based on what NeXus classes have been added through\n the builder\n '
if self.features:
... | def __add_features(self):
'\n Add a dataset which details which "features" the file contains (see https://github.com/nexusformat/features),\n either features explicitly noted using add_feature or based on what NeXus classes have been added through\n the builder\n '
if self.features:
... |
52ab018f2ea16e1acb047b7f6638c09b51f8e2589878b648bb3dcd1310ba3ff0 | def add_feature(self, feature_id):
'\n Add a feature id to the list of features present in the file, id is a hex string or integer\n '
self.features.add(feature_id) | Add a feature id to the list of features present in the file, id is a hex string or integer | nexusutils/nexusbuilder.py | add_feature | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_feature(self, feature_id):
'\n \n '
self.features.add(feature_id) | def add_feature(self, feature_id):
'\n \n '
self.features.add(feature_id)<|docstring|>Add a feature id to the list of features present in the file, id is a hex string or integer<|endoftext|> |
a520e0bd47b5901ebd8846bdcada386623dcd2d83e387b4b90313d4ff7849772 | def add_fake_event_data(self, events_per_pulse, number_of_pulses, pulse_freq_hz=10.0, tof_min_ns=0, tof_max_ns=50000000):
'\n Adds fake event data to every NXdetector group\n TOF and detector ID for each event is random\n\n Returns an array of all detector IDs in the instrument - this can be us... | Adds fake event data to every NXdetector group
TOF and detector ID for each event is random
Returns an array of all detector IDs in the instrument - this can be used to create a detector-spectrum map | nexusutils/nexusbuilder.py | add_fake_event_data | ScreamingUdder/kafka-nexus-utilities | 1 | python | def add_fake_event_data(self, events_per_pulse, number_of_pulses, pulse_freq_hz=10.0, tof_min_ns=0, tof_max_ns=50000000):
'\n Adds fake event data to every NXdetector group\n TOF and detector ID for each event is random\n\n Returns an array of all detector IDs in the instrument - this can be us... | def add_fake_event_data(self, events_per_pulse, number_of_pulses, pulse_freq_hz=10.0, tof_min_ns=0, tof_max_ns=50000000):
'\n Adds fake event data to every NXdetector group\n TOF and detector ID for each event is random\n\n Returns an array of all detector IDs in the instrument - this can be us... |
c8c9850d5f9c736521f545c2640622dd6d8c241efa18ae69ca6d1da886008798 | def __init__(self, **kwargs):
'BuilderConfig for BookCorpus.\n Args:\n **kwargs: keyword arguments forwarded to super.\n '
super(BookCorpusOpenConfig, self).__init__(version=datasets.Version('1.0.0', ''), **kwargs) | BuilderConfig for BookCorpus.
Args:
**kwargs: keyword arguments forwarded to super. | examples/nlp/bookcorpus/bookcorpus.py | __init__ | initzhang/Hetu | 0 | python | def __init__(self, **kwargs):
'BuilderConfig for BookCorpus.\n Args:\n **kwargs: keyword arguments forwarded to super.\n '
super(BookCorpusOpenConfig, self).__init__(version=datasets.Version('1.0.0', ), **kwargs) | def __init__(self, **kwargs):
'BuilderConfig for BookCorpus.\n Args:\n **kwargs: keyword arguments forwarded to super.\n '
super(BookCorpusOpenConfig, self).__init__(version=datasets.Version('1.0.0', ), **kwargs)<|docstring|>BuilderConfig for BookCorpus.
Args:
**kwargs: keyword arguments fo... |
42d70e5681c29b9d9e39f67574cf153cd87c3fd3809fca49c9534c665716628f | def generate_B(self, set_nonzero=None, number_nonzero=None):
'\n Generate B under B_{j\\cdot} ~ \\sum \\pi_i N_R(0, U),\n with sparsity:\n - set_nonzero can be\n - a list of index: effects of SNPs within the list are marked non-zero.\n this help ensuring true effects occur i... | Generate B under B_{j\cdot} ~ \sum \pi_i N_R(0, U),
with sparsity:
- set_nonzero can be
- a list of index: effects of SNPs within the list are marked non-zero.
this help ensuring true effects occur in different LD blocks, creating
a simpler case where causal variants are not convoluted
- a probability: with... | py/src/regression_simulate.py | generate_B | gaow/libgaow | 0 | python | def generate_B(self, set_nonzero=None, number_nonzero=None):
'\n Generate B under B_{j\\cdot} ~ \\sum \\pi_i N_R(0, U),\n with sparsity:\n - set_nonzero can be\n - a list of index: effects of SNPs within the list are marked non-zero.\n this help ensuring true effects occur i... | def generate_B(self, set_nonzero=None, number_nonzero=None):
'\n Generate B under B_{j\\cdot} ~ \\sum \\pi_i N_R(0, U),\n with sparsity:\n - set_nonzero can be\n - a list of index: effects of SNPs within the list are marked non-zero.\n this help ensuring true effects occur i... |
c861ae41da117878196e26a850853ebbed26477609ae22ff9faeedffee38ff9e | def select_independent_snps(self, cutoff1=0.8, cutoff2=10, cutoff3=0.02):
'\n Based on LD matrix select SNPs in strong LD with other SNPs\n yet are independent among this selected set.\n - cutoff1: definition of LD block -- LD have to be > cutoff1\n - cutoff2: define a large enough block... | Based on LD matrix select SNPs in strong LD with other SNPs
yet are independent among this selected set.
- cutoff1: definition of LD block -- LD have to be > cutoff1
- cutoff2: define a large enough block -- block size have to be > cutoff2 / 0.8
- cutoff3: now select LD that are completely independent | py/src/regression_simulate.py | select_independent_snps | gaow/libgaow | 0 | python | def select_independent_snps(self, cutoff1=0.8, cutoff2=10, cutoff3=0.02):
'\n Based on LD matrix select SNPs in strong LD with other SNPs\n yet are independent among this selected set.\n - cutoff1: definition of LD block -- LD have to be > cutoff1\n - cutoff2: define a large enough block... | def select_independent_snps(self, cutoff1=0.8, cutoff2=10, cutoff3=0.02):
'\n Based on LD matrix select SNPs in strong LD with other SNPs\n yet are independent among this selected set.\n - cutoff1: definition of LD block -- LD have to be > cutoff1\n - cutoff2: define a large enough block... |
7cde0f83e5c2fbb24cb766926d483cdacee29582a780e20cd660392809265c66 | def swap_B(self, top_set):
'\n Reorder rows in B so that strongest B appears in the specified "top_set" (set of indices)\n - useful when used with "select_convoluted_snps" to ensure the true effects are separated in different LD blocks\n - useful when simulating with annotations -- that at leas... | Reorder rows in B so that strongest B appears in the specified "top_set" (set of indices)
- useful when used with "select_convoluted_snps" to ensure the true effects are separated in different LD blocks
- useful when simulating with annotations -- that at least for example indices near TSS will have strongest effects | py/src/regression_simulate.py | swap_B | gaow/libgaow | 0 | python | def swap_B(self, top_set):
'\n Reorder rows in B so that strongest B appears in the specified "top_set" (set of indices)\n - useful when used with "select_convoluted_snps" to ensure the true effects are separated in different LD blocks\n - useful when simulating with annotations -- that at leas... | def swap_B(self, top_set):
'\n Reorder rows in B so that strongest B appears in the specified "top_set" (set of indices)\n - useful when used with "select_convoluted_snps" to ensure the true effects are separated in different LD blocks\n - useful when simulating with annotations -- that at leas... |
e1ca52d93638e8b088ce0ce7d46909fba249f6bd35d733387e3166fd5acdfd79 | def greedy_set_cover(data, exclude=None, raise_error=True):
"Find unique set of attributes that uniquely identifies each element in ``data``.\n\n Feature selection is a well known problem, and is analogous to the `set cover problem <https://en.wikipedia.org/wiki/Set_cover_problem>`__, for which there is a `well ... | Find unique set of attributes that uniquely identifies each element in ``data``.
Feature selection is a well known problem, and is analogous to the `set cover problem <https://en.wikipedia.org/wiki/Set_cover_problem>`__, for which there is a `well known heuristic <https://en.wikipedia.org/wiki/Set_cover_problem#Greedy... | dev/processed_package.py | greedy_set_cover | ecoinvent/bw_processing | 1 | python | def greedy_set_cover(data, exclude=None, raise_error=True):
"Find unique set of attributes that uniquely identifies each element in ``data``.\n\n Feature selection is a well known problem, and is analogous to the `set cover problem <https://en.wikipedia.org/wiki/Set_cover_problem>`__, for which there is a `well ... | def greedy_set_cover(data, exclude=None, raise_error=True):
"Find unique set of attributes that uniquely identifies each element in ``data``.\n\n Feature selection is a well known problem, and is analogous to the `set cover problem <https://en.wikipedia.org/wiki/Set_cover_problem>`__, for which there is a `well ... |
c5158305fdcc058cacd5bfa5154e7801660dd34c194627442055204f0599ff5e | def as_unique_attributes(data, exclude=None, include=None, raise_error=False):
'Format ``data`` as unique set of attributes and values for use in ``create_processed_datapackage``.\n\n Each element in ``data`` must have the attribute ``id``, and it must be unique. However, the field "id" is not used in selecting ... | Format ``data`` as unique set of attributes and values for use in ``create_processed_datapackage``.
Each element in ``data`` must have the attribute ``id``, and it must be unique. However, the field "id" is not used in selecting the unique set of attributes.
If no set of attributes is found that uniquely identifies a... | dev/processed_package.py | as_unique_attributes | ecoinvent/bw_processing | 1 | python | def as_unique_attributes(data, exclude=None, include=None, raise_error=False):
'Format ``data`` as unique set of attributes and values for use in ``create_processed_datapackage``.\n\n Each element in ``data`` must have the attribute ``id``, and it must be unique. However, the field "id" is not used in selecting ... | def as_unique_attributes(data, exclude=None, include=None, raise_error=False):
'Format ``data`` as unique set of attributes and values for use in ``create_processed_datapackage``.\n\n Each element in ``data`` must have the attribute ``id``, and it must be unique. However, the field "id" is not used in selecting ... |
4068d109f4bc325adb328a5f3ef6422ea96752977533768d04809693f93ba662 | def format_processed_resource(res):
'Format metadata for a `datapackage resource <https://frictionlessdata.io/specs/data-resource/>`__.\n\n ``res`` should be a dictionary with the following keys:\n\n name (str): Simple name or identifier to be used for this matrix data\n filename (str): Filename fo... | Format metadata for a `datapackage resource <https://frictionlessdata.io/specs/data-resource/>`__.
``res`` should be a dictionary with the following keys:
name (str): Simple name or identifier to be used for this matrix data
filename (str): Filename for saved Numpy array
matrix (str): The name of the matr... | dev/processed_package.py | format_processed_resource | ecoinvent/bw_processing | 1 | python | def format_processed_resource(res):
'Format metadata for a `datapackage resource <https://frictionlessdata.io/specs/data-resource/>`__.\n\n ``res`` should be a dictionary with the following keys:\n\n name (str): Simple name or identifier to be used for this matrix data\n filename (str): Filename fo... | def format_processed_resource(res):
'Format metadata for a `datapackage resource <https://frictionlessdata.io/specs/data-resource/>`__.\n\n ``res`` should be a dictionary with the following keys:\n\n name (str): Simple name or identifier to be used for this matrix data\n filename (str): Filename fo... |
b6b78a297813b81be9a1cb669365ef6a1433e27029a036dfbb7bbebd2fcde3c0 | def create_processed_datapackage(name, array, rows, cols, path, id_=None, metadata=None):
'Create a datapackage with numpy structured arrays and metadata.\n\n Exchanging large, dense datasets like MRIO tables is not efficient if each exchange must be listed separately. Instead, we would prefer to exchange the pr... | Create a datapackage with numpy structured arrays and metadata.
Exchanging large, dense datasets like MRIO tables is not efficient if each exchange must be listed separately. Instead, we would prefer to exchange the processed arrays used to build the matrices directly. However, these arrays use integer indices which a... | dev/processed_package.py | create_processed_datapackage | ecoinvent/bw_processing | 1 | python | def create_processed_datapackage(name, array, rows, cols, path, id_=None, metadata=None):
'Create a datapackage with numpy structured arrays and metadata.\n\n Exchanging large, dense datasets like MRIO tables is not efficient if each exchange must be listed separately. Instead, we would prefer to exchange the pr... | def create_processed_datapackage(name, array, rows, cols, path, id_=None, metadata=None):
'Create a datapackage with numpy structured arrays and metadata.\n\n Exchanging large, dense datasets like MRIO tables is not efficient if each exchange must be listed separately. Instead, we would prefer to exchange the pr... |
b579b24a1e3849aa4f5823e6f1e973ea82528a38334be0899ae296b963e7f25d | def _update_hparams(hparams, is_training):
'Update hparams for given is_training option.'
if (not is_training):
hparams.set_hparam('drop_path_keep_prob', 1.0) | Update hparams for given is_training option. | utils/slim_nets/nasnet.py | _update_hparams | SMH17/TensorBoxPy3 | 12 | python | def _update_hparams(hparams, is_training):
if (not is_training):
hparams.set_hparam('drop_path_keep_prob', 1.0) | def _update_hparams(hparams, is_training):
if (not is_training):
hparams.set_hparam('drop_path_keep_prob', 1.0)<|docstring|>Update hparams for given is_training option.<|endoftext|> |
12421abedb1b80c56d91e46a263ec4704c1314307da016f6c57eace1b4d1f343 | def nasnet_cifar_arg_scope(weight_decay=0.0005, batch_norm_decay=0.9, batch_norm_epsilon=1e-05):
'Defines the default arg scope for the NASNet-A Cifar model.\n\n Args:\n weight_decay: The weight decay to use for regularizing the model.\n batch_norm_decay: Decay for batch norm moving average.\n batch_norm_... | Defines the default arg scope for the NASNet-A Cifar model.
Args:
weight_decay: The weight decay to use for regularizing the model.
batch_norm_decay: Decay for batch norm moving average.
batch_norm_epsilon: Small float added to variance to avoid dividing by zero
in batch norm.
Returns:
An `arg_scope` to u... | utils/slim_nets/nasnet.py | nasnet_cifar_arg_scope | SMH17/TensorBoxPy3 | 12 | python | def nasnet_cifar_arg_scope(weight_decay=0.0005, batch_norm_decay=0.9, batch_norm_epsilon=1e-05):
'Defines the default arg scope for the NASNet-A Cifar model.\n\n Args:\n weight_decay: The weight decay to use for regularizing the model.\n batch_norm_decay: Decay for batch norm moving average.\n batch_norm_... | def nasnet_cifar_arg_scope(weight_decay=0.0005, batch_norm_decay=0.9, batch_norm_epsilon=1e-05):
'Defines the default arg scope for the NASNet-A Cifar model.\n\n Args:\n weight_decay: The weight decay to use for regularizing the model.\n batch_norm_decay: Decay for batch norm moving average.\n batch_norm_... |
0317e9b796b666d9bf7961b12cb47276f1cc27b0f2a8a48a618ed4749dea8973 | def nasnet_mobile_arg_scope(weight_decay=4e-05, batch_norm_decay=0.9997, batch_norm_epsilon=0.001):
'Defines the default arg scope for the NASNet-A Mobile ImageNet model.\n\n Args:\n weight_decay: The weight decay to use for regularizing the model.\n batch_norm_decay: Decay for batch norm moving average.\n ... | Defines the default arg scope for the NASNet-A Mobile ImageNet model.
Args:
weight_decay: The weight decay to use for regularizing the model.
batch_norm_decay: Decay for batch norm moving average.
batch_norm_epsilon: Small float added to variance to avoid dividing by zero
in batch norm.
Returns:
An `arg_s... | utils/slim_nets/nasnet.py | nasnet_mobile_arg_scope | SMH17/TensorBoxPy3 | 12 | python | def nasnet_mobile_arg_scope(weight_decay=4e-05, batch_norm_decay=0.9997, batch_norm_epsilon=0.001):
'Defines the default arg scope for the NASNet-A Mobile ImageNet model.\n\n Args:\n weight_decay: The weight decay to use for regularizing the model.\n batch_norm_decay: Decay for batch norm moving average.\n ... | def nasnet_mobile_arg_scope(weight_decay=4e-05, batch_norm_decay=0.9997, batch_norm_epsilon=0.001):
'Defines the default arg scope for the NASNet-A Mobile ImageNet model.\n\n Args:\n weight_decay: The weight decay to use for regularizing the model.\n batch_norm_decay: Decay for batch norm moving average.\n ... |
72ca052d32d63fc9d40c9ce25ca5a85b0a037b975fa087cc8731e9a8295bf20a | def nasnet_large_arg_scope(weight_decay=5e-05, batch_norm_decay=0.9997, batch_norm_epsilon=0.001):
'Defines the default arg scope for the NASNet-A Large ImageNet model.\n\n Args:\n weight_decay: The weight decay to use for regularizing the model.\n batch_norm_decay: Decay for batch norm moving average.\n ... | Defines the default arg scope for the NASNet-A Large ImageNet model.
Args:
weight_decay: The weight decay to use for regularizing the model.
batch_norm_decay: Decay for batch norm moving average.
batch_norm_epsilon: Small float added to variance to avoid dividing by zero
in batch norm.
Returns:
An `arg_sc... | utils/slim_nets/nasnet.py | nasnet_large_arg_scope | SMH17/TensorBoxPy3 | 12 | python | def nasnet_large_arg_scope(weight_decay=5e-05, batch_norm_decay=0.9997, batch_norm_epsilon=0.001):
'Defines the default arg scope for the NASNet-A Large ImageNet model.\n\n Args:\n weight_decay: The weight decay to use for regularizing the model.\n batch_norm_decay: Decay for batch norm moving average.\n ... | def nasnet_large_arg_scope(weight_decay=5e-05, batch_norm_decay=0.9997, batch_norm_epsilon=0.001):
'Defines the default arg scope for the NASNet-A Large ImageNet model.\n\n Args:\n weight_decay: The weight decay to use for regularizing the model.\n batch_norm_decay: Decay for batch norm moving average.\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.