prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>statistics.py<|end_file_name|><|fim▁begin|>""" Copyright (C) 2013 Matthew Woodruff This script is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your opti...
deltas = []
<|file_name|>statistics.py<|end_file_name|><|fim▁begin|>""" Copyright (C) 2013 Matthew Woodruff This script is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your opti...
cli()
<|file_name|>statistics.py<|end_file_name|><|fim▁begin|>""" Copyright (C) 2013 Matthew Woodruff This script is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your opti...
is_quantile
<|file_name|>statistics.py<|end_file_name|><|fim▁begin|>""" Copyright (C) 2013 Matthew Woodruff This script is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your opti...
is_stat
<|file_name|>statistics.py<|end_file_name|><|fim▁begin|>""" Copyright (C) 2013 Matthew Woodruff This script is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your opti...
get_args
<|file_name|>statistics.py<|end_file_name|><|fim▁begin|>""" Copyright (C) 2013 Matthew Woodruff This script is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your opti...
compute
<|file_name|>statistics.py<|end_file_name|><|fim▁begin|>""" Copyright (C) 2013 Matthew Woodruff This script is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your opti...
analyze
<|file_name|>statistics.py<|end_file_name|><|fim▁begin|>""" Copyright (C) 2013 Matthew Woodruff This script is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your opti...
write_result
<|file_name|>statistics.py<|end_file_name|><|fim▁begin|>""" Copyright (C) 2013 Matthew Woodruff This script is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your opti...
cli
<|file_name|>test_seqreader.py<|end_file_name|><|fim▁begin|>import pytest from canon.seq.seqreader import SeqReader from .. import resource def test_read_seq(): reader = SeqReader(resource('seq/Quartz_500Mpa_.SEQ')) reader.get_Om() Z, _, N = reader.get_Zmap('orsnr___') def test_merge_Zmap():<|fim▁hole|>...
<|file_name|>test_seqreader.py<|end_file_name|><|fim▁begin|>import pytest from canon.seq.seqreader import SeqReader from .. import resource def test_read_seq(): <|fim_middle|> def test_merge_Zmap(): reader = SeqReader() reader.read_seq(resource('seq/au30_a1_.SEQ')) Z1, _, N1 = reader.get_Zmap('ors...
reader = SeqReader(resource('seq/Quartz_500Mpa_.SEQ')) reader.get_Om() Z, _, N = reader.get_Zmap('orsnr___')
<|file_name|>test_seqreader.py<|end_file_name|><|fim▁begin|>import pytest from canon.seq.seqreader import SeqReader from .. import resource def test_read_seq(): reader = SeqReader(resource('seq/Quartz_500Mpa_.SEQ')) reader.get_Om() Z, _, N = reader.get_Zmap('orsnr___') def test_merge_Zmap(): <|fim_m...
reader = SeqReader() reader.read_seq(resource('seq/au30_a1_.SEQ')) Z1, _, N1 = reader.get_Zmap('orsnr___') reader.read_seq(resource('seq/au30_m1_.SEQ')) Z2, _, N2 = reader.get_Zmap('orsnr___') Z, N = SeqReader.merge_Zmap(Z1, Z2, N1, N2)
<|file_name|>test_seqreader.py<|end_file_name|><|fim▁begin|>import pytest from canon.seq.seqreader import SeqReader from .. import resource def test_read_seq(): reader = SeqReader(resource('seq/Quartz_500Mpa_.SEQ')) reader.get_Om() Z, _, N = reader.get_Zmap('orsnr___') def test_merge_Zmap(): reader ...
pytest.main()
<|file_name|>test_seqreader.py<|end_file_name|><|fim▁begin|>import pytest from canon.seq.seqreader import SeqReader from .. import resource def <|fim_middle|>(): reader = SeqReader(resource('seq/Quartz_500Mpa_.SEQ')) reader.get_Om() Z, _, N = reader.get_Zmap('orsnr___') def test_merge_Zmap(): reader...
test_read_seq
<|file_name|>test_seqreader.py<|end_file_name|><|fim▁begin|>import pytest from canon.seq.seqreader import SeqReader from .. import resource def test_read_seq(): reader = SeqReader(resource('seq/Quartz_500Mpa_.SEQ')) reader.get_Om() Z, _, N = reader.get_Zmap('orsnr___') def <|fim_middle|>(): reader =...
test_merge_Zmap
<|file_name|>__main__.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Stefano Palazzo <stefano.palazzo@gmail.com> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Li...
Options: --help -h display this help message and exit --version print version information and exit
<|file_name|>__main__.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Stefano Palazzo <stefano.palazzo@gmail.com> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Li...
try: docopt.docopt(__doc__, argv=argv, version=hello.__version__) except docopt.DocoptExit as e: print(str(e), file=sys.stderr) return 2 except SystemExit as e: return 0
<|file_name|>__main__.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Stefano Palazzo <stefano.palazzo@gmail.com> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Li...
sys.exit(main())
<|file_name|>__main__.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Stefano Palazzo <stefano.palazzo@gmail.com> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Li...
main
<|file_name|>max_tiff.py<|end_file_name|><|fim▁begin|>from PIL import Image import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np img1 = Image.open('multipage.tif') # The following approach seems to be having issue with the # current TIFF format data print('The size of each frame is:')...
<|file_name|>guestby1currentsnapshot.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # This file is part of Karesansui. #<|fim▁hole|># # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Softwar...
# Copyright (C) 2009-2012 HDE, Inc.
<|file_name|>guestby1currentsnapshot.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"),...
@auth def _PUT(self, *param, **params): (host_id, guest_id) = self.chk_guestby1(param) if guest_id is None: return web.notfound() if is_param(self.input, 'id') is False \ or is_int(self.input.id) is False: return web.badrequest("Request data is invalid.") ...
<|file_name|>guestby1currentsnapshot.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"),...
(host_id, guest_id) = self.chk_guestby1(param) if guest_id is None: return web.notfound() if is_param(self.input, 'id') is False \ or is_int(self.input.id) is False: return web.badrequest("Request data is invalid.") snapshot_id = str(self.input.id) snap...
<|file_name|>guestby1currentsnapshot.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"),...
return web.notfound()
<|file_name|>guestby1currentsnapshot.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"),...
return web.badrequest("Request data is invalid.")
<|file_name|>guestby1currentsnapshot.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"),...
pass # ignore snapshots that is not in database. #return web.badrequest("Request data is invalid.")
<|file_name|>guestby1currentsnapshot.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"),...
return web.notfound()
<|file_name|>guestby1currentsnapshot.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"),...
self.logger.debug(_("The specified snapshot does not exist in database. - %s") % snapshot_id) # ignore snapshots that is not in database. #return web.notfound()
<|file_name|>guestby1currentsnapshot.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"),...
_PUT
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
"""
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): <|fim_middle|> class MySQLDatabase(object): ...
return bool(float_match(string))
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
""" This is the driver class that we will use for connecting to our database. In here we'll create a constructor (__init__) that will connect to the database once the driver class is instantiated and a destructor method that will close the database connection once the driver object is destro...
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
""" Here we'll try to connect to the database using the variables that we passed through and if the connection fails we'll print out the error """ try: self.db = _mysql.connect(db=database_name, host=host, user=username, passwd=password) self.datab...
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
""" Here we'll do a check to see if `self.db` is present. This will only be the case if the connection was successfully made in the initialiser. Inside that condition we'll close the connection """ if hasattr(self, 'db'): self.db.close() pr...
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
""" This method will allow us to see what tables are available to us when we're running our queries """ cursor = self.db.cursor() cursor.execute("SHOW TABLES;") self.tables = cursor.fetchall() cursor.close() return self.tables
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
results = None names = " ".join(d[0] for d in cursor.description) klass = namedtuple('Results', names) try: results = map(klass._make, cursor.fetchall()) except _mysql.ProgrammingError, e: print e return results
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
""" This method will enable us to interact with our database to find what columns are currently in a specific table """ cursor = self.db.cursor() cursor.execute("SHOW COLUMNS FROM `%s`" % table_name) self.columns = cursor.fetchall() cursor.close(...
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
""" We'll create our `select` method in order to make it simpler for extracting data from the database. select(table_name, [list_of_column_names]) """ sql_str = "SELECT " # add columns or just use the wildcard if not columns: sql_str +...
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
""" This function will allow us to delete data from a given tables based on wether or not a WHERE clause is present or not """ sql_str = "DELETE FROM `%s`.`%s`" % (self.database_name, table) if wheres is not None: first_where_clause = True for w...
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
return bool(float_match(string))
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
""" Insert function Example usages:- db.insert('people', first_name='Ringo', second_name='Starr', DOB=STR_TO_DATE('01-01-1999', '%d-%m-%Y')) """
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
sql_str = "UPDATE `%s`.`%s` SET " % (self.database_name, table) if column_values is not None: for column_name, value in column_names.iteritems(): sql_str += "`%s`=" % column_name # check how we should add this to the column string if is_numbe...
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
self.db.close() print "MySQL Connection Closed"
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
sql_str += " * "
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
for column in columns: sql_str += "%s, " % column sql_str = sql_str[:-2] # remove the last comma!
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
sql_str += " JOIN %s " % kwargs.get('join')
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
sql_str += " WHERE %s " % kwargs.get('where')
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
sql_str += " LIMIT %s " % kwargs.get('limit')
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
results = self.convert_to_named_tuples(cursor)
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
results = cursor.fetchall()
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
first_where_clause = True for where, term in wheres.iteritems(): if first_where_clause: # This is the first WHERE clause sql_str += " WHERE `%s`.`%s` %s" % (table, where, term) first_where_clause = False ...
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
sql_str += " WHERE `%s`.`%s` %s" % (table, where, term) first_where_clause = False
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
sql_str += " AND `%s`.`%s` %s" % (table, where, term)
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
columns = "(" values = "(" for arg, value in column_names.iteritems(): columns += "`%s`, " % arg # Check how we should add this to the columns string if is_number(value) or arg == 'DOB': # It's a number or date so we don'...
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
values += "%s, " % value
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
values += "5S, " % value
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
for column_name, value in column_names.iteritems(): sql_str += "`%s`=" % column_name # check how we should add this to the column string if is_number(value): # it's a number so we don't add '' sql_str += "%s, " % value ...
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
sql_str += "%s, " % value
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
sql_str += "'%s', " % value
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
sql_str += " WHERE %s" % where
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def <|fim_middle|>(string): return bool(float_match(string)) class MySQ...
is_number
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
__init__
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
__del__
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
get_available_tables
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
convert_to_named_tuples
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
get_columns_for_table
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
select
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
delete
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
is_number
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
insert
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLData...
update
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
if sample_weight is None: sample_weight = tf.ones_like(y_true, dtype) else: sample_weight = tf.cast(sample_weight, dtype) for token in masked_tokens: mask = tf.cast(tf.not_equal(y_true, token), dtype) sample_weight = sample_weight * mask return sample_weight
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
"""A `tf.keras.metrics.Metric` that counts tokens seen after masking.""" def __init__(self, masked_tokens=None, name='num_tokens', dtype=tf.int64): self._masked_tokens = masked_tokens or [] super().__init__(name, dtype) def update_state(self, y_true, y_pred, sample_weight=None): sample_weight = _app...
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
self._masked_tokens = masked_tokens or [] super().__init__(name, dtype)
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
sample_weight = _apply_mask(y_true, sample_weight, self._masked_tokens, self._dtype) sample_weight = tf.reshape(sample_weight, [-1]) super().update_state(sample_weight)
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
config = super().get_config() config['masked_tokens'] = tuple(self._masked_tokens) return config
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
"""An accuracy metric that masks some tokens.""" def __init__(self, masked_tokens=None, name='accuracy', dtype=None): self._masked_tokens = masked_tokens or [] super().__init__(name, dtype=dtype) def update_state(self, y_true, y_pred, sample_weight=None): sample_weight = _apply_mask(y_true, sample_w...
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
self._masked_tokens = masked_tokens or [] super().__init__(name, dtype=dtype)
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
sample_weight = _apply_mask(y_true, sample_weight, self._masked_tokens, self._dtype) num_classes = tf.shape(y_pred)[-1] y_true = tf.reshape(y_true, [-1]) y_pred = tf.reshape(y_pred, [-1, num_classes]) sample_weight = tf.reshape(sample_weight, [-1]) super().update_...
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
config = super().get_config() config['masked_tokens'] = tuple(self._masked_tokens) return config
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
sample_weight = tf.ones_like(y_true, dtype)
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
sample_weight = tf.cast(sample_weight, dtype)
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
_apply_mask
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
__init__
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
update_state
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
get_config
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
__init__
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
update_state
<|file_name|>keras_metrics.py<|end_file_name|><|fim▁begin|># Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
get_config
<|file_name|>media.py<|end_file_name|><|fim▁begin|>class movie: """Stores movie metadata""" # The constructor takes # - The Title # - The youtube trailer # - The poster image URL def __init__(self, title, youtube_trailer, poster_url): self.title = title<|fim▁hole|><|fim▁end|>
self.trailer_youtube_url = youtube_trailer self.poster_image_url = poster_url
<|file_name|>media.py<|end_file_name|><|fim▁begin|>class movie: <|fim_middle|> <|fim▁end|>
"""Stores movie metadata""" # The constructor takes # - The Title # - The youtube trailer # - The poster image URL def __init__(self, title, youtube_trailer, poster_url): self.title = title self.trailer_youtube_url = youtube_trailer self.poster_image_url = poster...
<|file_name|>media.py<|end_file_name|><|fim▁begin|>class movie: """Stores movie metadata""" # The constructor takes # - The Title # - The youtube trailer # - The poster image URL def __init__(self, title, youtube_trailer, poster_url): <|fim_middle|> <|fim▁end|>
self.title = title self.trailer_youtube_url = youtube_trailer self.poster_image_url = poster_url
<|file_name|>media.py<|end_file_name|><|fim▁begin|>class movie: """Stores movie metadata""" # The constructor takes # - The Title # - The youtube trailer # - The poster image URL def <|fim_middle|>(self, title, youtube_trailer, poster_url): self.title = title self.traile...
__init__
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """<|fim▁hole|> ~~~~~~~ Get popular cat/dog/superhero/supervillain names. :copyright: (c) 2015 by lord63. :license: MIT, see LICENSE for more details. """ from getname.main import random_name __title_...
getname
<|file_name|>331.py<|end_file_name|><|fim▁begin|>class Solution: def isValidSerialization(self, preorder): """ :type preorder: str :rtype: bool """ arr_pre_order = preorder.split(',') stack = [] for node in arr_pre_order: stack.append(node...
if len(stack) < 1: return False
<|file_name|>331.py<|end_file_name|><|fim▁begin|>class Solution: <|fim_middle|> <|fim▁end|>
def isValidSerialization(self, preorder): """ :type preorder: str :rtype: bool """ arr_pre_order = preorder.split(',') stack = [] for node in arr_pre_order: stack.append(node) while len(stack) > 1 and stack[-1] == '#' and stack...
<|file_name|>331.py<|end_file_name|><|fim▁begin|>class Solution: def isValidSerialization(self, preorder): <|fim_middle|> <|fim▁end|>
""" :type preorder: str :rtype: bool """ arr_pre_order = preorder.split(',') stack = [] for node in arr_pre_order: stack.append(node) while len(stack) > 1 and stack[-1] == '#' and stack[-2] == '#': stack.pop() ...
<|file_name|>331.py<|end_file_name|><|fim▁begin|>class Solution: def isValidSerialization(self, preorder): """ :type preorder: str :rtype: bool """ arr_pre_order = preorder.split(',') stack = [] for node in arr_pre_order: stack.append(node...
return False
<|file_name|>331.py<|end_file_name|><|fim▁begin|>class Solution: def isValidSerialization(self, preorder): """ :type preorder: str :rtype: bool """ arr_pre_order = preorder.split(',') stack = [] for node in arr_pre_order: stack.append(node...
return True