Vadim Markovtsev, dotAI 2018
Vadim Markovtsev
@vadimlearning
class ???:
def connect(self, dbname, user, password, host, port):
# ...
def query(self, sql):
# ...
def close(self):
# ...
class Database:
def connect(self, dbname, user, password, host, port):
# ...
def query(self, sql):
# ...
def close(self):
# ...
class Foo:
def bar(self, qux):
# ...
def baz(self, waldo):
# ...
def do(self, really):
# ...
\( \begin{split} V_1 \Leftrightarrow & \,\texttt{"foo"} \\ \\ V_2 \Leftrightarrow & \,\texttt{"bar"} \\ \\ V_3 \Leftrightarrow & \,\texttt{"integrate"} \end{split} \)
\( distance(V_1, V_2) < distance(V_1, V_3) \)
\( distance(V_i, V_j) = \arccos \frac{V_i \cdot V_j}{\left\lVert V_i \right\rVert \left\lVert V_j \right\rVert} \)
class Database:
def connect(self, user, password, host, port):
self._tcp_socket_connect(host, port)
try:
self._authenticate(user, password)
except AuthenticationError as e:
self.socket.close()
raise e from None
_tcp_socket_connect -> [tcp, socket, connect]
AuthenticationError -> [authentication, error]
authentication, authenticate -> authenticate
class Database:
def connect(self, user, password, host, port):
self._tcp_socket_connect(host, port)
try:
self._authenticate(user, password)
except AuthenticationError as e:
self.socket.close()
raise e from None
database, connect2, user2, password2, host2, port2, tcp, socket2, authenticate2, error, close
class Database:
def connect(self, user, password, host, port):
self._tcp_socket_connect(host, port)
try:
self._authenticate(user, password)
except AuthenticationError as e:
self.socket.close()
raise e from None
connect2, user2, password2, host2, port2, tcp, socket2, authenticate2, error, close
class Database:
def connect(self, user, password, host, port):
self._tcp_socket_connect(host, port)
try:
self._authenticate(user, password)
except AuthenticationError as e:
self.socket.close()
raise e from None
connect, user, password, host, port
class Database:
def connect(self, user, password, host, port):
self._tcp_socket_connect(host, port)
try:
self._authenticate(user, password)
except AuthenticationError as e:
self.socket.close()
raise e from None
tcp, socket, connect, host, port
class Database:
def connect(self, user, password, host, port):
self._tcp_socket_connect(host, port)
try:
self._authenticate(user, password)
except AuthenticationError as e:
self.socket.close()
raise e from None
authenticate2, user, password, error, socket, close
class Database:
def connect(self, user, password, host, port):
self._tcp_socket_connect(host, port)
try:
self._authenticate(user, password)
except AuthenticationError as e:
self.socket.close()
raise e from None
authenticate, user, password
class Database:
def connect(self, user, password, host, port):
self._tcp_socket_connect(host, port)
try:
self._authenticate(user, password)
except AuthenticationError as e:
self.socket.close()
raise e from None
authenticate, error, socket, close
class Database:
def connect(self, user, password, host, port):
self._tcp_socket_connect(host, port)
try:
self._authenticate(user, password)
except AuthenticationError as e:
self.socket.close()
raise e from None
authenticate, error
class Database:
def connect(self, user, password, host, port):
self._tcp_socket_connect(host, port)
try:
self._authenticate(user, password)
except AuthenticationError as e:
self.socket.close()
raise e from None
socket, close
“bug” - “test” + “expect” = “suppress”
“database” - “query” + “tune” = “settings”
“send” - “receive” + “pop” = “push”