title stringclasses 1
value | text stringlengths 46 1.11M | id stringlengths 27 30 |
|---|---|---|
doc/ext/docscrape.py/indent
def indent(str, indent=4):
indent_str = ' '*indent
if str is None:
return indent_str
lines = str.split('\n')
return '\n'.join(indent_str + l for l in lines) | negative_train_query0_00199 | |
doc/ext/docscrape.py/dedent_lines
def dedent_lines(lines):
"""Deindent a list of lines maximally"""
return textwrap.dedent("\n".join(lines)).split("\n") | negative_train_query0_00200 | |
doc/ext/docscrape.py/header
def header(text, style='-'):
return text + '\n' + style*len(text) + '\n' | negative_train_query0_00201 | |
doc/ext/docscrape.py/inspect_getmembers
def inspect_getmembers(object, predicate=None):
"""
Return all members of an object as (name, value) pairs sorted by name.
Optionally, only return members that satisfy a given predicate.
"""
results = []
for key in dir(object):
try:
val... | negative_train_query0_00202 | |
doc/ext/docscrape.py/_is_show_member
def _is_show_member(self, name):
if self.show_inherited_members:
return True # show all class members
if name not in self._cls.__dict__:
return False # class member is inherited, we do not show it
return True | negative_train_query0_00203 | |
doc/ext/docscrape.py/is_unindented
def is_unindented(line):
return (line.strip() and (len(line.lstrip()) == len(line))) | negative_train_query0_00204 | |
doc/ext/docscrape.py/parse_item_name
def parse_item_name(text):
"""Match ':role:`name`' or 'name'"""
m = self._name_rgx.match(text)
if m:
g = m.groups()
if g[1] is None:
return g[3], None
else:
... | negative_train_query0_00205 | |
doc/ext/docscrape.py/push_item
def push_item(name, rest):
if not name:
return
name, role = parse_item_name(name)
items.append((name, list(rest), role))
del rest[:] | negative_train_query0_00206 | |
doc/ext/docscrape.py/strip_each_in
def strip_each_in(lst):
return [s.strip() for s in lst] | negative_train_query0_00207 | |
doc/ext/docscrape.py/splitlines_x
def splitlines_x(s):
if not s:
return []
else:
return s.splitlines() | negative_train_query0_00208 | |
doc/ext/docscrape.py/Reader/__init__
class Reader: def __init__(self, data):
"""
Parameters
----------
data : str
String with lines separated by '\n'.
"""
if isinstance(data, list):
self._str = data
else:
self._str = data.spl... | negative_train_query0_00209 | |
doc/ext/docscrape.py/Reader/__getitem__
class Reader: def __getitem__(self, n):
return self._str[n] | negative_train_query0_00210 | |
doc/ext/docscrape.py/Reader/reset
class Reader: def reset(self):
self._l = 0 # current line nr | negative_train_query0_00211 | |
doc/ext/docscrape.py/Reader/read
class Reader: def read(self):
if not self.eof():
out = self[self._l]
self._l += 1
return out
else:
return '' | negative_train_query0_00212 | |
doc/ext/docscrape.py/Reader/seek_next_non_empty_line
class Reader: def seek_next_non_empty_line(self):
for l in self[self._l:]:
if l.strip():
break
else:
self._l += 1 | negative_train_query0_00213 | |
doc/ext/docscrape.py/Reader/eof
class Reader: def eof(self):
return self._l >= len(self._str) | negative_train_query0_00214 | |
doc/ext/docscrape.py/Reader/read_to_condition
class Reader: def read_to_condition(self, condition_func):
start = self._l
for line in self[start:]:
if condition_func(line):
return self[start:self._l]
self._l += 1
if self.eof():
return... | negative_train_query0_00215 | |
doc/ext/docscrape.py/Reader/read_to_next_empty_line
class Reader: def read_to_next_empty_line(self):
self.seek_next_non_empty_line()
def is_empty(line):
return not line.strip()
return self.read_to_condition(is_empty) | negative_train_query0_00216 | |
doc/ext/docscrape.py/Reader/read_to_next_unindented_line
class Reader: def read_to_next_unindented_line(self):
def is_unindented(line):
return (line.strip() and (len(line.lstrip()) == len(line)))
return self.read_to_condition(is_unindented) | negative_train_query0_00217 | |
doc/ext/docscrape.py/Reader/peek
class Reader: def peek(self, n=0):
if self._l + n < len(self._str):
return self[self._l + n]
else:
return '' | negative_train_query0_00218 | |
doc/ext/docscrape.py/Reader/is_empty
class Reader: def is_empty(self):
return not ''.join(self._str).strip() | negative_train_query0_00219 | |
doc/ext/docscrape.py/NumpyDocString/__init__
class NumpyDocString: def __init__(self, docstring, config={}):
docstring = textwrap.dedent(docstring).split('\n')
self._doc = Reader(docstring)
self._parsed_data = {
'Signature': '',
'Summary': [''],
'Extended ... | negative_train_query0_00220 | |
doc/ext/docscrape.py/NumpyDocString/__getitem__
class NumpyDocString: def __getitem__(self, key):
return self._parsed_data[key] | negative_train_query0_00221 | |
doc/ext/docscrape.py/NumpyDocString/__setitem__
class NumpyDocString: def __setitem__(self, key, val):
if key not in self._parsed_data:
self._other_keys.append(key)
self._parsed_data[key] = val | negative_train_query0_00222 | |
doc/ext/docscrape.py/NumpyDocString/__iter__
class NumpyDocString: def __iter__(self):
return iter(self._parsed_data) | negative_train_query0_00223 | |
doc/ext/docscrape.py/NumpyDocString/__len__
class NumpyDocString: def __len__(self):
return len(self._parsed_data) | negative_train_query0_00224 | |
doc/ext/docscrape.py/NumpyDocString/_is_at_section
class NumpyDocString: def _is_at_section(self):
self._doc.seek_next_non_empty_line()
if self._doc.eof():
return False
l1 = self._doc.peek().strip() # e.g. Parameters
if l1.startswith('.. index::'):
return T... | negative_train_query0_00225 | |
doc/ext/docscrape.py/NumpyDocString/_strip
class NumpyDocString: def _strip(self, doc):
i = 0
j = 0
for i, line in enumerate(doc):
if line.strip():
break
for j, line in enumerate(doc[::-1]):
if line.strip():
break
retur... | negative_train_query0_00226 | |
doc/ext/docscrape.py/NumpyDocString/_read_to_next_section
class NumpyDocString: def _read_to_next_section(self):
section = self._doc.read_to_next_empty_line()
while not self._is_at_section() and not self._doc.eof():
if not self._doc.peek(-1).strip(): # previous line was empty
... | negative_train_query0_00227 | |
doc/ext/docscrape.py/NumpyDocString/_read_sections
class NumpyDocString: def _read_sections(self):
while not self._doc.eof():
data = self._read_to_next_section()
name = data[0].strip()
if name.startswith('..'): # index section
yield name, data[1:]
... | negative_train_query0_00228 | |
doc/ext/docscrape.py/NumpyDocString/_parse_param_list
class NumpyDocString: def _parse_param_list(self, content):
r = Reader(content)
params = []
while not r.eof():
header = r.read().strip()
if ' : ' in header:
arg_name, arg_type = header.split(' : ')[:... | negative_train_query0_00229 | |
doc/ext/docscrape.py/NumpyDocString/_parse_see_also
class NumpyDocString: def _parse_see_also(self, content):
"""
func_name : Descriptive text
continued text
another_func_name : Descriptive text
func_name1, func_name2, :meth:`func_name`, func_name3
"""
ite... | negative_train_query0_00230 | |
doc/ext/docscrape.py/NumpyDocString/_parse_index
class NumpyDocString: def _parse_index(self, section, content):
"""
.. index: default
:refguide: something, else, and more
"""
def strip_each_in(lst):
return [s.strip() for s in lst]
out = {}
sec... | negative_train_query0_00231 | |
doc/ext/docscrape.py/NumpyDocString/_parse_summary
class NumpyDocString: def _parse_summary(self):
"""Grab signature (if given) and summary"""
if self._is_at_section():
return
# If several signatures present, take the last one
while True:
summary = self._doc.r... | negative_train_query0_00232 | |
doc/ext/docscrape.py/NumpyDocString/_parse
class NumpyDocString: def _parse(self):
self._doc.reset()
self._parse_summary()
sections = list(self._read_sections())
section_names = set([section for section, content in sections])
has_returns = 'Returns' in section_names
... | negative_train_query0_00233 | |
doc/ext/docscrape.py/NumpyDocString/_str_header
class NumpyDocString: def _str_header(self, name, symbol='-'):
return [name, len(name)*symbol] | negative_train_query0_00234 | |
doc/ext/docscrape.py/NumpyDocString/_str_indent
class NumpyDocString: def _str_indent(self, doc, indent=4):
out = []
for line in doc:
out += [' '*indent + line]
return out | negative_train_query0_00235 | |
doc/ext/docscrape.py/NumpyDocString/_str_signature
class NumpyDocString: def _str_signature(self):
if self['Signature']:
return [self['Signature'].replace('*', '\*')] + ['']
else:
return [''] | negative_train_query0_00236 | |
doc/ext/docscrape.py/NumpyDocString/_str_summary
class NumpyDocString: def _str_summary(self):
if self['Summary']:
return self['Summary'] + ['']
else:
return [] | negative_train_query0_00237 | |
doc/ext/docscrape.py/NumpyDocString/_str_extended_summary
class NumpyDocString: def _str_extended_summary(self):
if self['Extended Summary']:
return self['Extended Summary'] + ['']
else:
return [] | negative_train_query0_00238 | |
doc/ext/docscrape.py/NumpyDocString/_str_param_list
class NumpyDocString: def _str_param_list(self, name):
out = []
if self[name]:
out += self._str_header(name)
for param, param_type, desc in self[name]:
if param_type:
out += ['%s : %s' % (p... | negative_train_query0_00239 | |
doc/ext/docscrape.py/NumpyDocString/_str_section
class NumpyDocString: def _str_section(self, name):
out = []
if self[name]:
out += self._str_header(name)
out += self[name]
out += ['']
return out | negative_train_query0_00240 | |
doc/ext/docscrape.py/NumpyDocString/_str_see_also
class NumpyDocString: def _str_see_also(self, func_role):
if not self['See Also']:
return []
out = []
out += self._str_header("See Also")
last_had_desc = True
for func, desc, role in self['See Also']:
if... | negative_train_query0_00241 | |
doc/ext/docscrape.py/NumpyDocString/_str_index
class NumpyDocString: def _str_index(self):
idx = self['index']
out = []
out += ['.. index:: %s' % idx.get('default', '')]
for section, references in idx.items():
if section == 'default':
continue
o... | negative_train_query0_00242 | |
doc/ext/docscrape.py/NumpyDocString/__str__
class NumpyDocString: def __str__(self, func_role=''):
out = []
out += self._str_signature()
out += self._str_summary()
out += self._str_extended_summary()
for param_list in ('Parameters', 'Returns', 'Yields',
... | negative_train_query0_00243 | |
doc/ext/docscrape.py/FunctionDoc/__init__
class FunctionDoc: def __init__(self, func, role='func', doc=None, config={}):
self._f = func
self._role = role # e.g. "func" or "meth"
if doc is None:
if func is None:
raise ValueError("No function or docstring given")
... | negative_train_query0_00244 | |
doc/ext/docscrape.py/FunctionDoc/get_func
class FunctionDoc: def get_func(self):
func_name = getattr(self._f, '__name__', self.__class__.__name__)
if inspect.isclass(self._f):
func = getattr(self._f, '__call__', self._f.__init__)
else:
func = self._f
return fun... | negative_train_query0_00245 | |
doc/ext/docscrape.py/FunctionDoc/__str__
class FunctionDoc: def __str__(self):
out = ''
func, func_name = self.get_func()
signature = self['Signature'].replace('*', '\*')
roles = {'func': 'function',
'meth': 'method'}
if self._role:
if self._rol... | negative_train_query0_00246 | |
doc/ext/docscrape.py/ClassDoc/__init__
class ClassDoc: def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc,
config={}):
if not inspect.isclass(cls) and cls is not None:
raise ValueError("Expected a class or None, but got %r" % cls)
self._cls = cls
... | negative_train_query0_00247 | |
doc/ext/docscrape.py/ClassDoc/methods
class ClassDoc: def methods(self):
if self._cls is None:
return []
return [name for name, func in inspect_getmembers(self._cls)
if ((not name.startswith('_')
or name in self.extra_public_methods)
... | negative_train_query0_00248 | |
doc/ext/docscrape.py/ClassDoc/properties
class ClassDoc: def properties(self):
if self._cls is None:
return []
return [name for name, func in inspect_getmembers(self._cls)
if not name.startswith('_') and func is None] | negative_train_query0_00249 | |
doc/ext/sympylive.py/builder_inited
def builder_inited(app):
if not app.config.sympylive_url:
raise ExtensionError('sympylive_url config value must be set'
' for the sympylive extension to work')
app.add_javascript(app.config.sympylive_url + '/static/utilities.js')
app.... | negative_train_query0_00250 | |
doc/ext/sympylive.py/setup
def setup(app):
app.add_config_value('sympylive_url', 'http://live.sympy.org', False)
app.connect('builder-inited', builder_inited) | negative_train_query0_00251 | |
.ci/parse_durations_log.py/read_log
def read_log():
start_token = '= slowest test durations ='
start_token_seen = False
for line in open(os.path.join(ci_folder, 'durations.log')):
if start_token_seen:
try:
dur, kind, test_id = line.split()
except:
... | negative_train_query0_00252 | |
.ci/parse_durations_log.py/main
def main(ref_timing, limits=(10, .1)):
"""
parses durations.log (made by generate_durations_log.sh)
"""
groupings = [defaultdict(list) for _ in range(len(limits))]
accumul_n = [0 for _ in range(len(limits))]
accumul_t = [0.0 for _ in range(len(limits))]
for te... | negative_train_query0_00253 | |
.ci/parse_durations_log.py/slow_function
def slow_function():
t = time.time()
a = 0
for i in range(5):
a += sum([x**.3 - x**i for x in range(1000000) if x % 3 == 0])
return time.time() - t | negative_train_query0_00254 | |
release/fabfile.py/full_path_split
def full_path_split(path):
"""
Function to do a full split on a path.
"""
# Based on http://stackoverflow.com/a/13505966/161801
rest, tail = os.path.split(path)
if not rest or rest == os.path.sep:
return (tail,)
return full_path_split(rest) + (tail,... | negative_train_query0_00255 | |
release/fabfile.py/use_venv
def use_venv(pyversion):
"""
Change make_virtualenv to use a given cmd
pyversion should be '2' or '3'
"""
pyversion = str(pyversion)
if pyversion == '2':
yield
elif pyversion == '3':
oldvenv = env.virtualenv
env.virtualenv = 'virtualenv -p... | negative_train_query0_00256 | |
release/fabfile.py/prepare
def prepare():
"""
Setup the VM
This only needs to be run once. It downloads all the necessary software,
and a git cache. To reset this, use vagrant destroy and vagrant up. Note,
this may take a while to finish, depending on your internet connection
speed.
"""
... | negative_train_query0_00257 | |
release/fabfile.py/prepare_apt
def prepare_apt():
"""
Download software from apt
Note, on a slower internet connection, this will take a while to finish,
because it has to download many packages, include latex and all its
dependencies.
"""
sudo("apt-get -qq update")
sudo("apt-get -y ins... | negative_train_query0_00258 | |
release/fabfile.py/remove_userspace
def remove_userspace():
"""
Deletes (!) the SymPy changes. Use with great care.
This should be run between runs to reset everything.
"""
run("rm -rf repos")
if os.path.exists("release"):
error("release directory already exists locally. Remove it to co... | negative_train_query0_00259 | |
release/fabfile.py/checkout_cache
def checkout_cache():
"""
Checkout a cache of SymPy
This should only be run once. The cache is use as a --reference for git
clone. This makes deleting and recreating the SymPy a la
remove_userspace() and gitrepos() and clone very fast.
"""
run("rm -rf symp... | negative_train_query0_00260 | |
release/fabfile.py/gitrepos
def gitrepos(branch=None, fork='sympy'):
"""
Clone the repo
fab vagrant prepare (namely, checkout_cache()) must be run first. By
default, the branch checked out is the same one as the one checked out
locally. The master branch is not allowed--use a release branch (see th... | negative_train_query0_00261 | |
release/fabfile.py/get_sympy_version
def get_sympy_version(version_cache=[]):
"""
Get the full version of SymPy being released (like 0.7.3.rc1)
"""
if version_cache:
return version_cache[0]
if not exists("/home/vagrant/repos/sympy"):
gitrepos()
with cd("/home/vagrant/repos/sympy"... | negative_train_query0_00262 | |
release/fabfile.py/get_sympy_short_version
def get_sympy_short_version():
"""
Get the short version of SymPy being released, not including any rc tags
(like 0.7.3)
"""
version = get_sympy_version()
parts = version.split('.')
non_rc_parts = [i for i in parts if i.isdigit()]
return '.'.joi... | negative_train_query0_00263 | |
release/fabfile.py/test_sympy
def test_sympy():
"""
Run the SymPy test suite
"""
with cd("/home/vagrant/repos/sympy"):
run("./setup.py test") | negative_train_query0_00264 | |
release/fabfile.py/test_tarball
def test_tarball(release='2'):
"""
Test that the tarball can be unpacked and installed, and that sympy
imports in the install.
"""
if release not in {'2', '3'}: # TODO: Add win32
raise ValueError("release must be one of '2', '3', not %s" % release)
venv =... | negative_train_query0_00265 | |
release/fabfile.py/release
def release(branch=None, fork='sympy'):
"""
Perform all the steps required for the release, except uploading
In particular, it builds all the release files, and puts them in the
release/ directory in the same directory as this one. At the end, it
prints some things that ... | negative_train_query0_00266 | |
release/fabfile.py/source_tarball
def source_tarball():
"""
Build the source tarball
"""
with cd("/home/vagrant/repos/sympy"):
run("git clean -dfx")
run("./setup.py clean")
run("./setup.py sdist --keep-temp")
run("./setup.py bdist_wininst")
run("mv dist/{win32-ori... | negative_train_query0_00267 | |
release/fabfile.py/build_docs
def build_docs():
"""
Build the html and pdf docs
"""
with cd("/home/vagrant/repos/sympy"):
run("mkdir -p dist")
venv = "/home/vagrant/docs-virtualenv"
make_virtualenv(venv, dependencies=['sphinx==1.1.3', 'numpy', 'mpmath'])
with virtualenv(v... | negative_train_query0_00268 | |
release/fabfile.py/copy_release_files
def copy_release_files():
"""
Move the release files from the VM to release/ locally
"""
with cd("/home/vagrant/repos/sympy"):
run("mkdir -p /vagrant/release")
run("cp dist/* /vagrant/release/") | negative_train_query0_00269 | |
release/fabfile.py/show_files
def show_files(file, print_=True):
"""
Show the contents of a tarball.
The current options for file are
source: The source tarball
win: The Python 2 Windows installer (Not yet implemented!)
html: The html docs zip
Note, this runs locally, not in vagrant.
... | negative_train_query0_00270 | |
release/fabfile.py/compare_tar_against_git
def compare_tar_against_git():
"""
Compare the contents of the tarball against git ls-files
"""
with hide("commands"):
with cd("/home/vagrant/repos/sympy"):
git_lsfiles = set([i.strip() for i in run("git ls-files").split("\n")])
tar_... | negative_train_query0_00271 | |
release/fabfile.py/md5
def md5(file='*', print_=True):
"""
Print the md5 sums of the release files
"""
out = local("md5sum release/" + file, capture=True)
# Remove the release/ part for printing. Useful for copy-pasting into the
# release notes.
out = [i.split() for i in out.strip().split('\... | negative_train_query0_00272 | |
release/fabfile.py/size
def size(file='*', print_=True):
"""
Print the sizes of the release files
"""
out = local("du -h release/" + file, capture=True)
out = [i.split() for i in out.strip().split('\n')]
out = '\n'.join(["%s\t%s" % (i, os.path.split(j)[1]) for i, j in out])
if print_:
... | negative_train_query0_00273 | |
release/fabfile.py/table
def table():
"""
Make an html table of the downloads.
This is for pasting into the GitHub releases page. See GitHub_release().
"""
# TODO: Add the file size
tarball_formatter_dict = tarball_formatter()
shortversion = get_sympy_short_version()
tarball_formatter_... | negative_train_query0_00274 | |
release/fabfile.py/get_tarball_name
def get_tarball_name(file):
"""
Get the name of a tarball
file should be one of
source-orig: The original name of the source tarball
source-orig-notar: The name of the untarred directory
source: The source tarball (after renaming)
win32-... | negative_train_query0_00275 | |
release/fabfile.py/tarball_formatter
def tarball_formatter():
return {name: get_tarball_name(name) for name in tarball_name_types} | negative_train_query0_00276 | |
release/fabfile.py/get_previous_version_tag
def get_previous_version_tag():
"""
Get the version of the previous release
"""
# We try, probably too hard, to portably get the number of the previous
# release of SymPy. Our strategy is to look at the git tags. The
# following assumptions are made a... | negative_train_query0_00277 | |
release/fabfile.py/get_authors
def get_authors():
"""
Get the list of authors since the previous release
Returns the list in alphabetical order by last name. Authors who
contributed for the first time for this release will have a star appended
to the end of their names.
Note: it's a good idea... | negative_train_query0_00278 | |
release/fabfile.py/print_authors
def print_authors():
"""
Print authors text to put at the bottom of the release notes
"""
authors, authorcount, newauthorcount = get_authors()
print(blue("Here are the authors to put at the bottom of the release "
"notes.", bold=True))
print()
print(... | negative_train_query0_00279 | |
release/fabfile.py/check_tag_exists
def check_tag_exists():
"""
Check if the tag for this release has been uploaded yet.
"""
version = get_sympy_version()
tag = 'sympy-' + version
with cd("/home/vagrant/repos/sympy"):
all_tags = run("git ls-remote --tags origin")
return tag in all_ta... | negative_train_query0_00280 | |
release/fabfile.py/update_websites
def update_websites():
"""
Update various websites owned by SymPy.
So far, supports the docs and sympy.org
"""
update_docs()
update_sympy_org() | negative_train_query0_00281 | |
release/fabfile.py/get_location
def get_location(location):
"""
Read/save a location from the configuration file.
"""
locations_file = os.path.expanduser('~/.sympy/sympy-locations')
config = ConfigParser.SafeConfigParser()
config.read(locations_file)
the_location = config.has_option("Locatio... | negative_train_query0_00282 | |
release/fabfile.py/update_docs
def update_docs(docs_location=None):
"""
Update the docs hosted at docs.sympy.org
"""
docs_location = docs_location or get_location("docs")
print("Docs location:", docs_location)
# Check that the docs directory is clean
local("cd {docs_location} && git diff -... | negative_train_query0_00283 | |
release/fabfile.py/update_sympy_org
def update_sympy_org(website_location=None):
"""
Update sympy.org
This just means adding an entry to the news section.
"""
website_location = website_location or get_location("sympy.github.com")
# Check that the website directory is clean
local("cd {webs... | negative_train_query0_00284 | |
release/fabfile.py/upload
def upload():
"""
Upload the files everywhere (PyPI and GitHub)
"""
distutils_check()
GitHub_release()
pypi_register()
pypi_upload()
test_pypi(2)
test_pypi(3) | negative_train_query0_00285 | |
release/fabfile.py/distutils_check
def distutils_check():
"""
Runs setup.py check
"""
with cd("/home/vagrant/repos/sympy"):
run("python setup.py check")
run("python3 setup.py check") | negative_train_query0_00286 | |
release/fabfile.py/pypi_register
def pypi_register():
"""
Register a release with PyPI
This should only be done for the final release. You need PyPI
authentication to do this.
"""
with cd("/home/vagrant/repos/sympy"):
run("python setup.py register") | negative_train_query0_00287 | |
release/fabfile.py/pypi_upload
def pypi_upload():
"""
Upload files to PyPI. You will need to enter a password.
"""
with cd("/home/vagrant/repos/sympy"):
run("twine upload dist/*.tar.gz")
run("twine upload dist/*.exe") | negative_train_query0_00288 | |
release/fabfile.py/test_pypi
def test_pypi(release='2'):
"""
Test that the sympy can be pip installed, and that sympy imports in the
install.
"""
# This function is similar to test_tarball()
version = get_sympy_version()
release = str(release)
if release not in {'2', '3'}: # TODO: Add... | negative_train_query0_00289 | |
release/fabfile.py/GitHub_release_text
def GitHub_release_text():
"""
Generate text to put in the GitHub release Markdown box
"""
shortversion = get_sympy_short_version()
htmltable = table()
out = """\
See https://github.com/sympy/sympy/wiki/release-notes-for-{shortversion} for the release notes... | negative_train_query0_00290 | |
release/fabfile.py/GitHub_release
def GitHub_release(username=None, user='sympy', token=None,
token_file_path="~/.sympy/release-token", repo='sympy', draft=False):
"""
Upload the release files to GitHub.
The tag must be pushed up first. You can test on another repo by changing
user and repo.
""... | negative_train_query0_00291 | |
release/fabfile.py/GitHub_check_authentication
def GitHub_check_authentication(urls, username, password, token):
"""
Checks that username & password is valid.
"""
query_GitHub(urls.api_url, username, password, token) | negative_train_query0_00292 | |
release/fabfile.py/GitHub_authenticate
def GitHub_authenticate(urls, username, token=None):
_login_message = """\
Enter your GitHub username & password or press ^C to quit. The password
will be kept as a Python variable as long as this script is running and
https to authenticate with GitHub, otherwise not saved any... | negative_train_query0_00293 | |
release/fabfile.py/generate_token
def generate_token(urls, username, password, OTP=None, name="SymPy Release"):
enc_data = json.dumps(
{
"scopes": ["public_repo"],
"note": name
}
)
url = urls.authorize_url
rep = query_GitHub(url, username=username, password=passw... | negative_train_query0_00294 | |
release/fabfile.py/save_token_file
def save_token_file(token):
token_file = raw_input("> Enter token file location [~/.sympy/release-token] ")
token_file = token_file or "~/.sympy/release-token"
token_file_expand = os.path.expanduser(token_file)
token_file_expand = os.path.abspath(token_file_expand)
... | negative_train_query0_00295 | |
release/fabfile.py/load_token_file
def load_token_file(path="~/.sympy/release-token"):
print("> Using token file %s" % path)
path = os.path.expanduser(path)
path = os.path.abspath(path)
if os.path.isfile(path):
try:
with open(path) as f:
token = f.readline()
... | negative_train_query0_00296 | |
release/fabfile.py/query_GitHub
def query_GitHub(url, username=None, password=None, token=None, data=None,
OTP=None, headers=None, params=None, files=None):
"""
Query GitHub API.
In case of a multipage result, DOES NOT query the next page.
"""
headers = headers or {}
if OTP:
heade... | negative_train_query0_00297 | |
release/fabfile.py/vagrant
def vagrant():
"""
Run commands using vagrant
"""
vc = get_vagrant_config()
# change from the default user to 'vagrant'
env.user = vc['User']
# connect to the port-forwarded ssh
env.hosts = ['%s:%s' % (vc['HostName'], vc['Port'])]
# use vagrant ssh key
... | negative_train_query0_00298 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.