-
Notifications
You must be signed in to change notification settings - Fork 30
Completion Use Cases
import numpy as np
data = np.array([0, 1, 2, 3, 4, 5, 6, 7])
max_value = np.
max(data)
import numpy as np
data = np.array([0, 1, 2, 3, 4, 5, 6, 7])
value = np.
max(
min(
argmin(
argmax(
etc...
import numpy as np
size = [10,10]
init = np.
zeros(size)
import tensorflow as tf
with tf.
Graph().as_default(), tf.Session() as session:
filename = "Helloworld.txt"
with open
(filename) as f:
Notes:
import tensorflow as tf
size = 100
vocab_size = 10000
embedding = tf.get_variable
("embedding", [vocab_size, size])
def count_lines(filename):
with open(filename) as f:
return len(f.readlines())
filename = "C:/temp/file1.txt"
count =
count_lines(filename)
###Notes: Use attention over all identifiers that are in scope (obtain from AST), may also need an encoding of the function signature to know how many arguments there are etc
def process_file(filename, mode=None, encoding=None):
with open(filename, mode or "r", encoding=encoding or "utf-8") as f:
lines = f.read().splitlines()
print(len(lines))
def dosomething():
process_file(filename,
mode=
encoding=
Requires attention over function definitions (signatures)
class MyClass :
def fullname ( self , firstname , surname ) :
fullname = firstname + " " + surname
return
fullname
User types: { if | for i in | myvar[ | myvar[i: | return | [x for x in } Suggestions: var1 / arg1 etc Requires attention over all identifiers that are in scope (obtain from AST)
Structure Suggestions User types: { if var1 | def myfunction(self) | for i in range(10) | else | elif | class MyClass } Suggestions: :
Method body Suggestions User types: def init(self, arg1): Suggestions: self.arg1 = arg1 Requires attention over function arguments
Block/body suggestions Context: for i, j in ... | if i == j | ... User types: a[ | b = Suggestions: i / j Requires attention over narrow "scope" (not really the scope because Python uses function-scoping, but it's likely that you'll refer to the closest variables inside the block)