r/pythonforengineers • u/IAmKindOfCreative • Dec 13 '18
Demo Test Post
Hello world. how do exit a while loop? how do I exit a while loop? How do I exit a while loop. Should I import numpy?
edit: 01
1
u/IAmKindOfCreative Jan 03 '19
Hello! I'm a bot! It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python. That said, I am a bot and it is hard to tell. I highly recommend posting your question there. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.
Show /r/learnpython the code you have tried and describe where you are stuck. Be sure to format your code for reddit and include which version of python and what OS you are using.
this bot is written and managed by /u/IAmKindOfCreative | Source | FAQ
This bot is currently under development and experiencing changes to improve its usefulness
def loadAndShuffleCodeSample(returnSize): randomSeed = random.randint(0,1000) flsource = "misc/pyProgramTrainingLines.txt" with open(flsource,'r') as fl: code = fl.readlines() random.Random(randomSeed).shuffle(code) logging.debug("Random Seed for Code Samples Shuffle: " + str(randomSeed)) return [(x, 'code') for x in code[:returnSize]]
def lz78(s, D={}, k=4): '''Almost the LZ78 compression scheme ''' s = s.lower() s = s+'\n' s=s*k #print(s) i = 0 word_len = 1 while True: word_len = 1 while s[i:i+word_len] in D: D[s[i:i+word_len]] +=1 word_len += 1
if (i+word_len)>=len(s):
break if (i+word_len)<=len(s): D[s[i:i+word_len]] = 1 else: break i = i+1#+word_len #print(i, word_len, D) #if i return D
def buildTextCodeClassifier(): randomSeed = random.randint(0,1000) sampleSize = 2000 # Load code samples code = loadAndShuffleCodeSample(returnSize = int(sampleSize/2)) if len(code) < int(sampleSize/2): sampleSize = len(code)*2 logging.warning("Warning: Not enough code. New sample size = " + str(sampleSize)) #print(len(code)) #print(code[:10]) # Load comment samples #comments = [(x.text, 'text') for x in nltk.corpus.nps_chat.xml_posts()[:int(sampleSize/2)]] sents = brown.sents(categories='news') sents = [detokenize(sent) for sent in sents] #print(sents[0]) comments = [(x, 'text') for x in sents[:int(sampleSize/2)]] logging.debug("Shuffling Code") posts = code+comments random.Random(randomSeed).shuffle(posts) #print(posts[:10])
logging.debug("Random Seed for Training Shuffle: " + str(randomSeed))
logging.debug("getting features")
featureSets=[(code_text_features(post[0]), post[1]) for post in posts]
size = int(len(featureSets) * 0.1)
train_set, test_set = featureSets[size:], featureSets[:size]
logging.debug("Training Size: " + str( len(train_set)))
logging.debug("Testing Size: " + str( len(test_set)))
logging.debug(" Training Model")
classifier = nltk.NaiveBayesClassifier.train(train_set)
logging.debug(" Model Accuracy: " + str(nltk.classify.accuracy(classifier, test_set)))
ref = []
tagged = []
'''
for i in range(len(test_set)):
c = classifier.classify(test_set[i][0])
tagged.append(c)
ref.append(test_set[i][1])
if i < 5:
#print("Text:\n", test_set[i][0])
print("Classified: ", c)
print("Actually: ", test_set[i][1])
'''
logging.debug(ConfusionMatrix(ref, tagged))
return classifier, train_set, test_set1
u/IAmKindOfCreative Jan 05 '19
/u/pythonHelperBot !reformat
1
u/pythonHelperBot Jan 08 '19
Here's the best I could do:
Hello! I'm a bot! It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python. That said, I am a bot and it is hard to tell. I highly recommend posting your question there. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.
Show /r/learnpython the code you have tried and describe where you are stuck. Be sure to format your code for reddit and include which version of python and what OS you are using.
this bot is written and managed by /u/IAmKindOfCreative | Source | FAQ
This bot is currently under development and experiencing changes to improve its usefulness
def loadAndShuffleCodeSample(returnSize): randomSeed = random.randint(0,1000) flsource = "misc/pyProgramTrainingLines.txt" with open(flsource,'r') as fl: code = fl.readlines() random.Random(randomSeed).shuffle(code) logging.debug("Random Seed for Code Samples Shuffle: " + str(randomSeed)) return [(x, 'code') for x in code[:returnSize]] def lz78(s, D={}, k=4): '''Almost the LZ78 compression scheme ''' s = s.lower() s = s+'\n' s=s*k #print(s) i = 0 word_len = 1 while True: word_len = 1 while s[i:i+word_len] in D: D[s[i:i+word_len]] +=1 word_len += 1 if (i+word_len)>=len(s): break if (i+word_len)<=len(s): D[s[i:i+word_len]] = 1 else: break i = i+1#+word_len #print(i, word_len, D) #if i return D def buildTextCodeClassifier(): randomSeed = random.randint(0,1000) sampleSize = 2000 # Load code samples code = loadAndShuffleCodeSample(returnSize = int(sampleSize/2)) if len(code) < int(sampleSize/2): sampleSize = len(code)*2 logging.warning("Warning: Not enough code. New sample size = " + str(sampleSize)) #print(len(code)) #print(code[:10]) # Load comment samples #comments = [(x.text, 'text') for x in nltk.corpus.nps_chat.xml_posts()[:int(sampleSize/2)]] sents = brown.sents(categories='news') sents = [detokenize(sent) for sent in sents] #print(sents[0]) comments = [(x, 'text') for x in sents[:int(sampleSize/2)]] logging.debug("Shuffling Code") posts = code+comments random.Random(randomSeed).shuffle(posts) #print(posts[:10]) logging.debug("Random Seed for Training Shuffle: " + str(randomSeed)) logging.debug("getting features") featureSets=[(code_text_features(post[0]), post[1]) for post in posts] size = int(len(featureSets) * 0.1) train_set, test_set = featureSets[size:], featureSets[:size] logging.debug("Training Size: " + str( len(train_set))) logging.debug("Testing Size: " + str( len(test_set))) logging.debug(" Training Model") classifier = nltk.NaiveBayesClassifier.train(train_set) logging.debug(" Model Accuracy: " + str(nltk.classify.accuracy(classifier, test_set))) ref = [] tagged = [] ''' for i in range(len(test_set)): c = classifier.classify(test_set[i][0]) tagged.append(c) ref.append(test_set[i][1]) if i < 5: #print("Text:\n", test_set[i][0]) print("Classified: ", c) print("Actually: ", test_set[i][1]) ''' logging.debug(ConfusionMatrix(ref, tagged)) return classifier, train_set, test_setCODE FORMATTING HELP | README | FAQ | this bot is written and managed by /u/IAmKindOfCreative
1
u/pythonHelperBot Jan 08 '19
Here's the best I could do:
Hello! I'm a bot! It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python. That said, I am a bot and it is hard to tell. I highly recommend posting your question there. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.
Show /r/learnpython the code you have tried and describe where you are stuck. Be sure to format your code for reddit and include which version of python and what OS you are using.
this bot is written and managed by /u/IAmKindOfCreative | Source | FAQ
This bot is currently under development and experiencing changes to improve its usefulness
def loadAndShuffleCodeSample(returnSize): randomSeed = random.randint(0,1000) flsource = "misc/pyProgramTrainingLines.txt" with open(flsource,'r') as fl: code = fl.readlines() random.Random(randomSeed).shuffle(code) logging.debug("Random Seed for Code Samples Shuffle: " + str(randomSeed)) return [(x, 'code') for x in code[:returnSize]] def lz78(s, D={}, k=4): '''Almost the LZ78 compression scheme ''' s = s.lower() s = s+'\n' s=s*k #print(s) i = 0 word_len = 1 while True: word_len = 1 while s[i:i+word_len] in D: D[s[i:i+word_len]] +=1 word_len += 1 if (i+word_len)>=len(s): break if (i+word_len)<=len(s): D[s[i:i+word_len]] = 1 else: break i = i+1#+word_len #print(i, word_len, D) #if i return D def buildTextCodeClassifier(): randomSeed = random.randint(0,1000) sampleSize = 2000 # Load code samples code = loadAndShuffleCodeSample(returnSize = int(sampleSize/2)) if len(code) < int(sampleSize/2): sampleSize = len(code)*2 logging.warning("Warning: Not enough code. New sample size = " + str(sampleSize)) #print(len(code)) #print(code[:10]) # Load comment samples #comments = [(x.text, 'text') for x in nltk.corpus.nps_chat.xml_posts()[:int(sampleSize/2)]] sents = brown.sents(categories='news') sents = [detokenize(sent) for sent in sents] #print(sents[0]) comments = [(x, 'text') for x in sents[:int(sampleSize/2)]] logging.debug("Shuffling Code") posts = code+comments random.Random(randomSeed).shuffle(posts) #print(posts[:10]) logging.debug("Random Seed for Training Shuffle: " + str(randomSeed)) logging.debug("getting features") featureSets=[(code_text_features(post[0]), post[1]) for post in posts] size = int(len(featureSets) * 0.1) train_set, test_set = featureSets[size:], featureSets[:size] logging.debug("Training Size: " + str( len(train_set))) logging.debug("Testing Size: " + str( len(test_set))) logging.debug(" Training Model") classifier = nltk.NaiveBayesClassifier.train(train_set) logging.debug(" Model Accuracy: " + str(nltk.classify.accuracy(classifier, test_set))) ref = [] tagged = [] ''' for i in range(len(test_set)): c = classifier.classify(test_set[i][0]) tagged.append(c) ref.append(test_set[i][1]) if i < 5: #print("Text:\n", test_set[i][0]) print("Classified: ", c) print("Actually: ", test_set[i][1]) ''' logging.debug(ConfusionMatrix(ref, tagged)) return classifier, train_set, test_setCODE FORMATTING HELP | README | FAQ | this bot is written and managed by /u/IAmKindOfCreative
1
u/IAmKindOfCreative Jan 08 '19
/u/pythonHelperBot !reformat
1
1
u/pythonHelperBot Jan 08 '19
Here's the best I could do:
Hello! I'm a bot! It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python. That said, I am a bot and it is hard to tell. I highly recommend posting your question there. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.
Show /r/learnpython the code you have tried and describe where you are stuck. Be sure to format your code for reddit and include which version of python and what OS you are using.
this bot is written and managed by /u/IAmKindOfCreative | Source | FAQ
This bot is currently under development and experiencing changes to improve its usefulness
def loadAndShuffleCodeSample(returnSize): randomSeed = random.randint(0,1000) flsource = "misc/pyProgramTrainingLines.txt" with open(flsource,'r') as fl: code = fl.readlines() random.Random(randomSeed).shuffle(code) logging.debug("Random Seed for Code Samples Shuffle: " + str(randomSeed)) return [(x, 'code') for x in code[:returnSize]] def lz78(s, D={}, k=4): '''Almost the LZ78 compression scheme ''' s = s.lower() s = s+'\n' s=s*k #print(s) i = 0 word_len = 1 while True: word_len = 1 while s[i:i+word_len] in D: D[s[i:i+word_len]] +=1 word_len += 1 if (i+word_len)>=len(s): break if (i+word_len)<=len(s): D[s[i:i+word_len]] = 1 else: break i = i+1#+word_len #print(i, word_len, D) #if i return D def buildTextCodeClassifier(): randomSeed = random.randint(0,1000) sampleSize = 2000 # Load code samples code = loadAndShuffleCodeSample(returnSize = int(sampleSize/2)) if len(code) < int(sampleSize/2): sampleSize = len(code)*2 logging.warning("Warning: Not enough code. New sample size = " + str(sampleSize)) #print(len(code)) #print(code[:10]) # Load comment samples #comments = [(x.text, 'text') for x in nltk.corpus.nps_chat.xml_posts()[:int(sampleSize/2)]] sents = brown.sents(categories='news') sents = [detokenize(sent) for sent in sents] #print(sents[0]) comments = [(x, 'text') for x in sents[:int(sampleSize/2)]] logging.debug("Shuffling Code") posts = code+comments random.Random(randomSeed).shuffle(posts) #print(posts[:10]) logging.debug("Random Seed for Training Shuffle: " + str(randomSeed)) logging.debug("getting features") featureSets=[(code_text_features(post[0]), post[1]) for post in posts] size = int(len(featureSets) * 0.1) train_set, test_set = featureSets[size:], featureSets[:size] logging.debug("Training Size: " + str( len(train_set))) logging.debug("Testing Size: " + str( len(test_set))) logging.debug(" Training Model") classifier = nltk.NaiveBayesClassifier.train(train_set) logging.debug(" Model Accuracy: " + str(nltk.classify.accuracy(classifier, test_set))) ref = [] tagged = [] ''' for i in range(len(test_set)): c = classifier.classify(test_set[i][0]) tagged.append(c) ref.append(test_set[i][1]) if i < 5: #print("Text:\n", test_set[i][0]) print("Classified: ", c) print("Actually: ", test_set[i][1]) ''' logging.debug(ConfusionMatrix(ref, tagged)) return classifier, train_set, test_setCode Formatting Help | README | FAQ | this bot is written and managed by /u/IAmKindOfCreative
1
1
u/pythonHelperBot Jan 04 '19
Hello! I'm a bot! It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python. That said, I am a bot and it is hard to tell. I highly recommend posting your question there. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.
Show /r/learnpython the code you have tried and describe where you are stuck. Be sure to format your code for reddit and include which version of python and what OS you are using.
this bot is written and managed by /u/IAmKindOfCreative | Source | FAQ
This bot is currently under development and experiencing changes to improve its usefulness
def loadAndShuffleCodeSample(returnSize): randomSeed = random.randint(0,1000) flsource = "misc/pyProgramTrainingLines.txt" with open(flsource,'r') as fl: code = fl.readlines() random.Random(randomSeed).shuffle(code) logging.debug("Random Seed for Code Samples Shuffle: " + str(randomSeed)) return [(x, 'code') for x in code[:returnSize]] def lz78(s, D={}, k=4): '''Almost the LZ78 compression scheme ''' s = s.lower() s = s+'\n' s=s*k #print(s) i = 0 word_len = 1 while True: word_len = 1 while s[i:i+word_len] in D: D[s[i:i+word_len]] +=1 word_len += 1 if (i+word_len)>=len(s): break if (i+word_len)<=len(s): D[s[i:i+word_len]] = 1 else: break i = i+1#+word_len #print(i, word_len, D) #if i return D def buildTextCodeClassifier(): randomSeed = random.randint(0,1000) sampleSize = 2000 # Load code samples code = loadAndShuffleCodeSample(returnSize = int(sampleSize/2)) if len(code) < int(sampleSize/2): sampleSize = len(code)*2 logging.warning("Warning: Not enough code. New sample size = " + str(sampleSize)) #print(len(code)) #print(code[:10]) # Load comment samples #comments = [(x.text, 'text') for x in nltk.corpus.nps_chat.xml_posts()[:int(sampleSize/2)]] sents = brown.sents(categories='news') sents = [detokenize(sent) for sent in sents] #print(sents[0]) comments = [(x, 'text') for x in sents[:int(sampleSize/2)]] logging.debug("Shuffling Code") posts = code+comments random.Random(randomSeed).shuffle(posts) #print(posts[:10]) logging.debug("Random Seed for Training Shuffle: " + str(randomSeed)) logging.debug("getting features") featureSets=[(code_text_features(post[0]), post[1]) for post in posts] size = int(len(featureSets) * 0.1) train_set, test_set = featureSets[size:], featureSets[:size] logging.debug("Training Size: " + str( len(train_set))) logging.debug("Testing Size: " + str( len(test_set))) logging.debug(" Training Model") classifier = nltk.NaiveBayesClassifier.train(train_set) logging.debug(" Model Accuracy: " + str(nltk.classify.accuracy(classifier, test_set))) ref = [] tagged = [] ''' for i in range(len(test_set)): c = classifier.classify(test_set[i][0]) tagged.append(c) ref.append(test_set[i][1]) if i < 5: #print("Text:\n", test_set[i][0]) print("Classified: ", c) print("Actually: ", test_set[i][1]) ''' logging.debug(ConfusionMatrix(ref, tagged)) return classifier, train_set, test_setHere's the best I could do
CODE FORMATTING HELP | README | FAQ | this bot is written and managed by /u/IAmKindOfCreative
1
u/IAmKindOfCreative Jan 08 '19
/u/pythonHelperBot !Reformat
1
u/IAmKindOfCreative Jan 09 '19
NumPy is the fundamental package needed for scientific computing with Python.
Website (including documentation): https://www.numpy.org Mailing list: https://mail.python.org/mailman/listinfo/numpy-discussion Source: https://github.com/numpy/numpy Bug reports: https://github.com/numpy/numpy/issues It provides:
a powerful N-dimensional array object sophisticated (broadcasting) functions tools for integrating C/C++ and Fortran code useful linear algebra, Fourier transform, and random number capabilities Testing:
NumPy versions ≥ 1.15 require pytest NumPy versions < 1.15 require nose Tests can then be run after installation with:
def build_project(args): """ Build a dev version of the project. Returns ------- site_dir site-packages directory where it was installed """
import distutils.sysconfig root_ok = [os.path.exists(os.path.join(ROOT_DIR, fn)) for fn in PROJECT_ROOT_FILES] if not all(root_ok): print("To build the project, run runtests.py in " "git checkout or unpacked source") sys.exit(1) dst_dir = os.path.join(ROOT_DIR, 'build', 'testenv') env = dict(os.environ) cmd = [sys.executable, 'setup.py'] # Always use ccache, if installed env['PATH'] = os.pathsep.join(EXTRA_PATH + env.get('PATH', '').split(os.pathsep)) cvars = distutils.sysconfig.get_config_vars() compiler = env.get('CC') or cvars.get('CC', '') if 'gcc' in compiler: # Check that this isn't clang masquerading as gcc. if sys.platform != 'darwin' or 'gnu-gcc' in compiler: # add flags used as werrors warnings_as_errors = ' '.join([ # from tools/travis-test.sh '-Werror=vla', '-Werror=nonnull', '-Werror=pointer-arith', '-Wlogical-op', # from sysconfig '-Werror=unused-function', ]) env['CFLAGS'] = warnings_as_errors + ' ' + env.get('CFLAGS', '') # NumPy > 1.16 should be C99 compatible. env['CFLAGS'] = '-std=c99' + ' ' + env.get('CFLAGS', '') if args.debug or args.gcov: # assume everyone uses gcc/gfortran env['OPT'] = '-O0 -ggdb' env['FOPT'] = '-O0 -ggdb' if args.gcov: env['OPT'] = '-O0 -ggdb' env['FOPT'] = '-O0 -ggdb' env['CC'] = cvars['CC'] + ' --coverage' env['CXX'] = cvars['CXX'] + ' --coverage' env['F77'] = 'gfortran --coverage ' env['F90'] = 'gfortran --coverage ' env['LDSHARED'] = cvars['LDSHARED'] + ' --coverage' env['LDFLAGS'] = " ".join(cvars['LDSHARED'].split()[1:]) + ' --coverage'1
u/IAmKindOfCreative Jan 09 '19
/u/pythonHelperBot !reformat
1
u/pythonHelperBot Jan 09 '19
Here's the best I could do:
NumPy is the fundamental package needed for scientific computing with Python.
Website (including documentation): https://www.numpy.org Mailing list: https://mail.python.org/mailman/listinfo/numpy-discussion Source: https://github.com/numpy/numpy Bug reports: https://github.com/numpy/numpy/issues It provides:
a powerful N-dimensional array object sophisticated (broadcasting) functions tools for integrating C/C++ and Fortran code useful linear algebra, Fourier transform, and random number capabilities Testing:
NumPy versions ≥ 1.15 require pytest NumPy versions < 1.15 require nose Tests can then be run after installation with:
def build_project(args): """ Build a dev version of the project. Returns ------- site_dir site-packages directory where it was installed """ import distutils.sysconfig root_ok = [os.path.exists(os.path.join(ROOT_DIR, fn)) for fn in PROJECT_ROOT_FILES] if not all(root_ok): print("To build the project, run runtests.py in " "git checkout or unpacked source") sys.exit(1) dst_dir = os.path.join(ROOT_DIR, 'build', 'testenv') env = dict(os.environ) cmd = [sys.executable, 'setup.py'] # Always use ccache, if installed env['PATH'] = os.pathsep.join(EXTRA_PATH + env.get('PATH', '').split(os.pathsep)) cvars = distutils.sysconfig.get_config_vars() compiler = env.get('CC') or cvars.get('CC', '') if 'gcc' in compiler: # Check that this isn't clang masquerading as gcc. if sys.platform != 'darwin' or 'gnu-gcc' in compiler: # add flags used as werrors warnings_as_errors = ' '.join([ # from tools/travis-test.sh '-Werror=vla', '-Werror=nonnull', '-Werror=pointer-arith', '-Wlogical-op', # from sysconfig '-Werror=unused-function', ]) env['CFLAGS'] = warnings_as_errors + ' ' + env.get('CFLAGS', '') # NumPy > 1.16 should be C99 compatible. env['CFLAGS'] = '-std=c99' + ' ' + env.get('CFLAGS', '') if args.debug or args.gcov: # assume everyone uses gcc/gfortran env['OPT'] = '-O0 -ggdb' env['FOPT'] = '-O0 -ggdb' if args.gcov: env['OPT'] = '-O0 -ggdb' env['FOPT'] = '-O0 -ggdb' env['CC'] = cvars['CC'] + ' --coverage' env['CXX'] = cvars['CXX'] + ' --coverage' env['F77'] = 'gfortran --coverage ' env['F90'] = 'gfortran --coverage ' env['LDSHARED'] = cvars['LDSHARED'] + ' --coverage' env['LDFLAGS'] = " ".join(cvars['LDSHARED'].split()[1:]) + ' --coverage'Code Formatting Help | README | FAQ | this bot is written and managed by /u/IAmKindOfCreative
1
u/IAmKindOfCreative Jan 10 '19
NumPy is the fundamental package needed for scientific computing with Python.
Website (including documentation): https://www.numpy.org Mailing list: https://mail.python.org/mailman/listinfo/numpy-discussion Source: https://github.com/numpy/numpy Bug reports: https://github.com/numpy/numpy/issues It provides:
a powerful N-dimensional array object sophisticated (broadcasting) functions tools for integrating C/C++ and Fortran code useful linear algebra, Fourier transform, and random number capabilities Testing: NumPy versions ≥ 1.15 require pytest NumPy versions < 1.15 require nose Tests can then be run after installation with: def build_project(args): """ Build a dev version of the project. Returns ------- site_dir site-packages directory where it was installed """
import distutils.sysconfig
root_ok = [os.path.exists(os.path.join(ROOT_DIR, fn))
for fn in PROJECT_ROOT_FILES]
if not all(root_ok):
print("To build the project, run runtests.py in "
"git checkout or unpacked source")
sys.exit(1)
dst_dir = os.path.join(ROOT_DIR, 'build', 'testenv')
env = dict(os.environ)
cmd = [sys.executable, 'setup.py']
# Always use ccache, if installed
env['PATH'] = os.pathsep.join(EXTRA_PATH + env.get('PATH', '').split(os.pathsep))
cvars = distutils.sysconfig.get_config_vars()
compiler = env.get('CC') or cvars.get('CC', '')
if 'gcc' in compiler:
# Check that this isn't clang masquerading as gcc.
if sys.platform != 'darwin' or 'gnu-gcc' in compiler:
# add flags used as werrors
warnings_as_errors = ' '.join([
# from tools/travis-test.sh
'-Werror=vla',
'-Werror=nonnull',
'-Werror=pointer-arith',
'-Wlogical-op',
# from sysconfig
'-Werror=unused-function',
])
env['CFLAGS'] = warnings_as_errors + ' ' + env.get('CFLAGS', '')
# NumPy > 1.16 should be C99 compatible.
env['CFLAGS'] = '-std=c99' + ' ' + env.get('CFLAGS', '')
if args.debug or args.gcov:
# assume everyone uses gcc/gfortran
env['OPT'] = '-O0 -ggdb'
env['FOPT'] = '-O0 -ggdb'
if args.gcov:
env['OPT'] = '-O0 -ggdb'
env['FOPT'] = '-O0 -ggdb'
env['CC'] = cvars['CC'] + ' --coverage'
env['CXX'] = cvars['CXX'] + ' --coverage'
env['F77'] = 'gfortran --coverage '
env['F90'] = 'gfortran --coverage '
env['LDSHARED'] = cvars['LDSHARED'] + ' --coverage'
env['LDFLAGS'] = " ".join(cvars['LDSHARED'].split()[1:]) + ' --coverage'1
1
u/IAmKindOfCreative Jan 10 '19
/u/pythonHelperBot !reformat
1
u/pythonHelperBot Jan 10 '19
Here's the best I could do:
NumPy is the fundamental package needed for scientific computing with Python.
Website (including documentation): https://www.numpy.org Mailing list: https://mail.python.org/mailman/listinfo/numpy-discussion Source: https://github.com/numpy/numpy Bug reports: https://github.com/numpy/numpy/issues It provides:
a powerful N-dimensional array object sophisticated (broadcasting) functions tools for integrating C/C++ and Fortran code useful linear algebra, Fourier transform, and random number capabilities Testing: NumPy versions ≥ 1.15 require pytest NumPy versions < 1.15 require nose Tests can then be run after installation with: def build_project(args): """ Build a dev version of the project. Returns ------- site_dir site-packages directory where it was installed """ import distutils.sysconfig root_ok = [os.path.exists(os.path.join(ROOT_DIR, fn)) for fn in PROJECT_ROOT_FILES] if not all(root_ok): print("To build the project, run runtests.py in " "git checkout or unpacked source") sys.exit(1) dst_dir = os.path.join(ROOT_DIR, 'build', 'testenv') env = dict(os.environ) cmd = [sys.executable, 'setup.py'] # Always use ccache, if installed env['PATH'] = os.pathsep.join(EXTRA_PATH + env.get('PATH', '').split(os.pathsep)) cvars = distutils.sysconfig.get_config_vars() compiler = env.get('CC') or cvars.get('CC', '') if 'gcc' in compiler: # Check that this isn't clang masquerading as gcc. if sys.platform != 'darwin' or 'gnu-gcc' in compiler: # add flags used as werrors warnings_as_errors = ' '.join([ # from tools/travis-test.sh '-Werror=vla', '-Werror=nonnull', '-Werror=pointer-arith', '-Wlogical-op', # from sysconfig '-Werror=unused-function', ]) env['CFLAGS'] = warnings_as_errors + ' ' + env.get('CFLAGS', '') # NumPy > 1.16 should be C99 compatible. env['CFLAGS'] = '-std=c99' + ' ' + env.get('CFLAGS', '') if args.debug or args.gcov: # assume everyone uses gcc/gfortran env['OPT'] = '-O0 -ggdb' env['FOPT'] = '-O0 -ggdb' if args.gcov: env['OPT'] = '-O0 -ggdb' env['FOPT'] = '-O0 -ggdb' env['CC'] = cvars['CC'] + ' --coverage' env['CXX'] = cvars['CXX'] + ' --coverage' env['F77'] = 'gfortran --coverage ' env['F90'] = 'gfortran --coverage ' env['LDSHARED'] = cvars['LDSHARED'] + ' --coverage' env['LDFLAGS'] = " ".join(cvars['LDSHARED'].split()[1:]) + ' --coverage'Code Formatting Help | README | FAQ | this bot is written and managed by /u/IAmKindOfCreative
1
0
Dec 15 '18
[deleted]
1
u/IAmKindOfCreative Dec 15 '18
I appreciate the answer! This however was a demo/sample question for a bot to try to parse so I can see which 'almost sentences' it can correctly classify. That said, thank you for answering and helping make programming a better place!
1
u/IAmKindOfCreative Dec 13 '18
Hello! I'm a bot! It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python. That said, I am a bot and it is hard to tell. I highly recommend posting your question there. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.
Show /r/learnpython the code you have tried and describe where you are stuck. Be sure to format your code for reddit and include which version of python and what OS you are using.
this bot is written and managed by /u/IAmKindOfCreative | Source | FAQ
This bot is currently under development and experiencing changes to improve its usefulness