function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def calculate_all(request, course_slug, activity_slug):
course = get_object_or_404(CourseOffering, slug=course_slug)
activity = get_object_or_404(CalNumericActivity, slug=activity_slug, offering=course, deleted=False) | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def calculate_all_lettergrades(request, course_slug, activity_slug):
course = get_object_or_404(CourseOffering, slug=course_slug)
activity = get_object_or_404(CalLetterActivity, slug=activity_slug, offering=course, deleted=False) | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def calculate_individual_ajax(request, course_slug, activity_slug):
"""
Ajax way to calculate individual numeric grade.
This ajav view function is called in the activity_info page.
"""
if request.method == 'POST':
userid = request.POST.get('userid')
if userid == None: ... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def _create_activity_formdatadict(activity):
if not [activity for activity_type in ACTIVITY_TYPES if isinstance(activity, activity_type)]:
return
data = dict()
data['name'] = activity.name
data['short_name'] = activity.short_name
data['status'] = activity.status
data['due_date'] = activi... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def _semester_date_warning(request, activity):
"""
Generate warnings for this request if activity due date is outside semester boundaries.
"""
if not activity.due_date:
return
# don't warn for 24 hours after the last day of classes (start of last day + 48 hours)
if activity.due_date > d... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def edit_activity(request, course_slug, activity_slug):
course = get_object_or_404(CourseOffering, slug=course_slug)
activities = all_activities_filter(slug=activity_slug, offering=course)
numact_choices = [(na.pk, na.name) for na in NumericActivity.objects.filter(offering=course, deleted=False)]
exama... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def delete_activity(request, course_slug, activity_slug):
"""
Flag activity as deleted
"""
course = get_object_or_404(CourseOffering, slug=course_slug)
activity = get_object_or_404(Activity, slug=activity_slug, offering=course)
if request.method == 'POST':
if not Member.objects.filter(o... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def release_activity(request, course_slug, activity_slug):
"""
Bump activity status: INVI -> URLS, URLS -> RLS.
"""
course = get_object_or_404(CourseOffering, slug=course_slug)
activity = get_object_or_404(Activity, slug=activity_slug, offering=course, deleted=False)
if request.method == 'POST':... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def add_letter_activity(request, course_slug):
course = get_object_or_404(CourseOffering, slug=course_slug) | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def all_grades(request, course_slug):
course = get_object_or_404(CourseOffering, slug=course_slug)
activities = all_activities_filter(offering=course)
students = Member.objects.filter(offering=course, role="STUD").select_related('person', 'offering') | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def _all_grades_output(response, course):
activities = all_activities_filter(offering=course)
students = Member.objects.filter(offering=course, role="STUD").select_related('person')
# get grade data into a format we can work with
labtut = course.labtut
grades = {}
for a in activities:
g... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def all_grades_csv(request, course_slug):
course = get_object_or_404(CourseOffering, slug=course_slug) | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def grade_history(request, course_slug):
"""
Dump all GradeHistory for the offering to a CSV
"""
offering = get_object_or_404(CourseOffering, slug=course_slug)
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'inline; filename="%s-history.csv"' % (course_slug,)... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def class_list(request, course_slug):
course = get_object_or_404(CourseOffering, slug=course_slug)
members = Member.objects.filter(offering=course, role="STUD").select_related('person', 'offering') | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def has_photo_agreement(user):
configs = UserConfig.objects.filter(user=user, key='photo-agreement')
return bool(configs and configs[0].value['agree']) | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def photo_list(request, course_slug, style='horiz'):
if style not in PHOTO_LIST_STYLES:
raise Http404
user = get_object_or_404(Person, userid=request.user.username)
if not has_photo_agreement(user):
url = reverse('config:photo_agreement') + '?return=' + urllib.parse.quote(request.path)
... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def student_photo(request, emplid):
# confirm user's photo agreement
user = get_object_or_404(Person, userid=request.user.username)
can_access = False
if Role.objects_fresh.filter(person=user, role__in=['ADVS', 'ADVM']):
can_access = True
else:
if not has_photo_agreement(user):
... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def new_message(request, course_slug):
offering = get_object_or_404(CourseOffering, slug=course_slug)
staff = get_object_or_404(Person, userid=request.user.username)
default_message = NewsItem(user=staff, author=staff, course=offering, source_app="dashboard")
if request.method =='POST':
form = M... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def student_search(request, course_slug):
course = get_object_or_404(CourseOffering, slug=course_slug)
if request.method == 'POST':
# find the student if we can and redirect to info page
form = StudentSearchForm(request.POST)
if not form.is_valid():
messages.add_message(reque... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def student_info(request, course_slug, userid):
course = get_object_or_404(CourseOffering, slug=course_slug)
member = get_object_or_404(Member, ~Q(role='DROP'), find_member(userid), offering__slug=course_slug)
requestor = get_object_or_404(Member, ~Q(role='DROP'), person__userid=request.user.username, offer... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def export_all(request, course_slug):
"""
Export everything we can about this offering
"""
import io, tempfile, zipfile, os, json
from django.http import StreamingHttpResponse
from wsgiref.util import FileWrapper
from marking.views import _mark_export_data, _DecimalEncoder
from discuss.m... | sfu-fas/coursys | [
61,
17,
61,
39,
1407368110
] |
def to_representation(self, instance):
if not instance:
return
return "{}{}".format(SITE_URL, thumbnail_url(instance, "thumbnail_240")) | hzlf/openbroadcast.org | [
9,
2,
9,
44,
1413831364
] |
def get_release_display(self, obj, **kwargs):
return obj.release.name if obj.release else None | hzlf/openbroadcast.org | [
9,
2,
9,
44,
1413831364
] |
def get_assets(self, obj, **kwargs):
# TODO: propperly serialize assets
stream_url = reverse_lazy(
"mediaasset-format",
kwargs={"media_uuid": obj.uuid, "quality": "default", "encoding": "mp3"},
)
waveform_url = reverse_lazy(
"mediaasset-waveform", kw... | hzlf/openbroadcast.org | [
9,
2,
9,
44,
1413831364
] |
def get_items(self, obj, **kwargs):
items = []
for media in obj.get_media():
serializer = MediaSerializer(
media, context={"request": self.context["request"]}
)
items.append({"content": serializer.data})
return items | hzlf/openbroadcast.org | [
9,
2,
9,
44,
1413831364
] |
def to_representation(self, value):
"""
Serialize tagged objects to a simple textual representation.
"""
if isinstance(value, Media):
# return 'Media: {}'.format(value.pk)
serializer = MediaSerializer(
value, context={"request": self.context["reque... | hzlf/openbroadcast.org | [
9,
2,
9,
44,
1413831364
] |
def get_content(self, obj, **kwargs):
# TODO: implement for `Jingle`
if isinstance(obj.item.content_object, Media):
serializer = MediaSerializer(
instance=Media.objects.get(pk=obj.item.content_object.pk),
many=False,
context={"request": self.c... | hzlf/openbroadcast.org | [
9,
2,
9,
44,
1413831364
] |
def get_user(self, obj):
if not (obj.user and getattr(obj.user, "profile")):
return
return ProfileSerializer(obj.user.profile, context=self.context).data | hzlf/openbroadcast.org | [
9,
2,
9,
44,
1413831364
] |
def get_dayparts(self, obj, **kwargs):
return [
{"day": dp.day, "start": dp.time_start, "end": dp.time_end}
for dp in obj.dayparts.active()
] | hzlf/openbroadcast.org | [
9,
2,
9,
44,
1413831364
] |
def __init__(self, developer_key, client_id, client_secret):
self.CLIENT_ID = client_id
self.CLIENT_SECRET = client_secret
self.DEVELOPER_KEY = developer_key | Spoken-tutorial/spoken-website | [
9,
44,
9,
83,
1393308162
] |
def setup_http_request_object(self):
self.headers = {
"GData-Version": "2",
"X-GData-Key": "key=%s" % self.DEVELOPER_KEY
}
self.http = self.credentials.authorize(httplib2.Http()) | Spoken-tutorial/spoken-website | [
9,
44,
9,
83,
1393308162
] |
def set_caption_language_title(self, language='', title=''):
self.CAPTIONS_LANGUAGE_CODE = language
self.CAPTIONS_TITLE = title | Spoken-tutorial/spoken-website | [
9,
44,
9,
83,
1393308162
] |
def readme():
""" open readme for long_description """
try:
with open('README.md') as fle:
return fle.read()
except IOError:
return '' | rh-marketingops/dwm | [
11,
4,
11,
9,
1471874052
] |
def _exception_detail(exc):
# this is what stdlib module traceback does
try:
return str(exc)
except:
return '<unprintable %s object>' % type(exc).__name__ | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __init__(self, stream, descriptions, verbosity, config=None,
errorClasses=None):
if errorClasses is None:
errorClasses = {}
self.errorClasses = errorClasses
if config is None:
config = Config()
self.config = config
_Text... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def addError(self, test, err):
"""Overrides normal addError to add support for
errorClasses. If the exception is a registered class, the
error will be added to the list for that class, not errors.
"""
stream = getattr(self, 'stream', None)
ec, ev, tb = err
try:
... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def printSummary(self, start, stop):
"""Called by the test runner to print the final summary of test
run results.
"""
write = self.stream.write
writeln = self.stream.writeln
taken = float(stop - start)
run = self.testsRun
plural = run != 1 and "s" or "" | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def wasSuccessful(self):
"""Overrides to check that there are no errors in errorClasses
lists that are marked as errors and should cause a run to
fail.
"""
if self.errors or self.failures:
return False
for cls in self.errorClasses.keys():
storage, ... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def _exc_info_to_string(self, err, test=None):
# 2.3/2.4 -- 2.4 passes test, 2.3 does not
try:
return _TextTestResult._exc_info_to_string(self, err, test)
except TypeError:
# 2.3: does not take test arg
return _TextTestResult._exc_info_to_string(self, err) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __init__(self):
"""
Constructor...
"""
self.platformName = "Streakgaming"
self.tags = ["social", "news", "gaming"]
########################
# Defining valid modes #
########################
self.isValidMode = {}
self.isVa... | i3visio/osrframework | [
751,
229,
751,
66,
1419991203
] |
def lockfile() -> CoursierResolvedLockfile:
# Calculate transitive deps
transitive_ = {(i, k) for i, j in direct.items() for k in j}
while True:
old_len = len(transitive_)
transitive_ |= {(i, k) for i, j in transitive_ for k in direct[j]}
if old_len == len(transitive_):
... | pantsbuild/pants | [
2553,
518,
2553,
833,
1355765944
] |
def test_filter_non_transitive_includes_direct_deps(lockfile: CoursierResolvedLockfile) -> None:
filtered = filter(coord2, lockfile, False)
assert filtered == [coord2, coord3] | pantsbuild/pants | [
2553,
518,
2553,
833,
1355765944
] |
def vs_to_130(data):
data['attributes'].append({
'varname': 'bl_Vertex',
'type': gpu.CD_ORCO,
'datatype': gpu.GPU_DATA_4F
})
data['attributes'].append({
'varname': 'bl_Normal',
'type': -1,
'datatype': gpu.GPU_DATA_3F
})
data['uniforms'].append({
... | Kupoman/blendergltf | [
314,
50,
314,
14,
1455166435
] |
def vs_to_web(data):
src = data['vertex']
precision_block = '\n'
for data_type in ('float', 'int'):
precision_block += 'precision mediump {};\n'.format(data_type)
src = src.replace('#version 130', '#version 100\n' + precision_block)
src = re.sub(r'\bin\b', 'attribute', src)
src = re.su... | Kupoman/blendergltf | [
314,
50,
314,
14,
1455166435
] |
def to_130(data):
vs_to_130(data)
fs_to_130(data) | Kupoman/blendergltf | [
314,
50,
314,
14,
1455166435
] |
def export_material(self, state, material):
shader_data = gpu.export_shader(bpy.context.scene, material)
if state['settings']['asset_profile'] == 'DESKTOP':
to_130(shader_data)
else:
to_web(shader_data)
if self.settings.embed_shaders is True:
fs_bytes... | Kupoman/blendergltf | [
314,
50,
314,
14,
1455166435
] |
def fit(funct, data, err=None, **kwargs):
"""Generic function fitter.
Fit data to a given function.
TODO
----
* Dictionary support for funct to submit user data..
Parameters
----------
funct: callable
Function with the first argmument as data space, e.g., x, t, f, Nr. ..
... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def __init__(self, fop=None, fw=None, data=None, **kwargs):
"""Constructor."""
self._fop = fop
self._fw = fw
# we hold our own copy of the data
self._verbose = kwargs.pop('verbose', False)
self._debug = kwargs.pop('debug', False)
self.data = None
if data ... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def verbose(self):
return self._verbose | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def verbose(self, v):
self._verbose = v
self.fw.verbose = self._verbose | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def debug(self):
return self._debug | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def debug(self, v):
self._debug = v
self.fw.debug = self._debug | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def fw(self):
return self._fw | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def fop(self):
return self.fw.fop | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def inv(self):
return self.fw | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def model(self):
return self.fw.model | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def _initForwardOperator(self, **kwargs):
"""Initialize or re-initialize the forward operator.
Called once in the constructor to force the manager to create the
necessary forward operator member. Can be recalled if you need to
changed the mangers own forward operator object. If you want... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def _initInversionFramework(self, **kwargs):
"""Initialize or re-initialize the inversion framework.
Called once in the constructor to force the manager to create the
necessary Framework instance.
"""
self._fw = self.createInversionFramework(**kwargs)
if self.fw is None... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def load(self, fileName):
"""API, overwrite in derived classes."""
pg.critical('API, overwrite in derived classes', fileName) | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def simulate(self, model, **kwargs):
# """Run a simulation aka the forward task."""
ra = self.fop.response(par=model)
noiseLevel = kwargs.pop('noiseLevel', 0.0)
if noiseLevel > 0:
err = self.estimateError(ra, errLevel=noiseLevel)
ra *= 1. + pg.randn(ra.size(), s... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def applyData(self, data):
""" """
self.fop.data = data | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def _ensureData(self, data):
"""Check data validity"""
if data is None:
data = self.fw.dataVals
vals = self.checkData(data)
if vals is None:
pg.critical("There are no data values.")
if abs(min(vals)) < 1e-12:
print(min(vals), max(vals))
... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def _ensureError(self, err, dataVals=None):
"""Check error validity"""
if err is None:
err = self.fw.errorVals
vals = self.checkError(err, dataVals)
if vals is None:
pg.warn('No data error given, set Fallback set to 1%')
vals = np.ones(len(dataVals))... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def postRun(self, *args, **kwargs):
"""Called just after the inversion run."""
pass | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def showModel(self, model, ax=None, **kwargs):
"""Show a model.
Draw model into a given axes or show inversion result from last run.
Forwards on default to the self.fop.drawModel function
of the modelling operator.
If there is no function given, you have to override this method.... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def showResult(self, model=None, ax=None, **kwargs):
"""Show the last inversion result.
TODO
----
DRY: decide showModel or showResult
Parameters
----------
ax : mpl axes
Axes object to draw into. Create a new if its not given.
model : itera... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def showResultAndFit(self, **kwargs):
"""Calls showResults and showFit."""
fig = pg.plt.figure()
ax = fig.add_subplot(1, 2, 1)
self.showResult(ax=ax, model=self.model, **kwargs)
ax1 = fig.add_subplot(2, 2, 2)
ax2 = fig.add_subplot(2, 2, 4)
self.showFit(axs=[ax1... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def createArgParser(dataSuffix='dat'):
"""Create default argument parser.
TODO move this to some kind of app class
Create default argument parser for the following options:
-Q, --quiet
-R, --robustData: options.robustData
-B, --blockyModel: options.blockyModel
... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def __init__(self, funct=None, fop=None, **kwargs):
"""Constructor."""
if fop is not None:
if not isinstance(fop, pg.frameworks.ParameterModelling):
pg.critical("We need a fop if type ",
pg.frameworks.ParameterModelling)
elif funct is not N... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def invert(self, data=None, err=None, **kwargs):
"""
Parameters
----------
limits: {str: [min, max]}
Set limits for parameter by parameter name.
startModel: {str: startModel}
Set the start value for parameter by parameter name.
"""
dataSpac... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def __init__(self, fop=None, **kwargs):
"""Constructor."""
super(MethodManager1d, self).__init__(fop, **kwargs) | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def invert(self, data=None, err=None, **kwargs):
""" """
return super(MethodManager1d, self).invert(data=data, err=err,
**kwargs) | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def __init__(self, **kwargs):
"""Constructor.
Attribute
---------
mesh: pg.Mesh
Copy of the main mesh to be distributed to inversion and the fop.
You can overwrite it with invert(mesh=mesh).
"""
super(MeshMethodManager, self).__init__(**kwargs)
... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def paraDomain(self):
return self.fop.paraDomain | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def createMesh(self, data=None, **kwargs):
"""API, implement in derived classes."""
pg.critical('no default mesh generation defined .. implement in '
'derived class') | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def applyMesh(self, mesh, ignoreRegionManager=False, **kwargs):
""" """
if ignoreRegionManager:
mesh = self.fop.createRefinedFwdMesh(mesh, **kwargs)
self.fop.setMesh(mesh, ignoreRegionManager=ignoreRegionManager) | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def showFit(self, axs=None, **kwargs):
"""Show data and the inversion result model response."""
orientation = 'vertical'
if axs is None:
fig, axs = pg.plt.subplots(nrows=1, ncols=2)
orientation = 'horizontal'
self.showData(data=self.inv.dataVals,
... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def standardizedCoverage(self, threshhold=0.01):
"""Return standardized coverage vector (0|1) using thresholding.
"""
return 1.0*(abs(self.coverage()) > threshhold) | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def __init__(self, petro, mgr=None, **kwargs):
"""Initialize instance with manager and petrophysical relation."""
petrofop = kwargs.pop('petrofop', None)
if petrofop is None:
fop = kwargs.pop('fop', None)
if fop is None and mgr is not None:
# Check! why ... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def __init__(self, petros, mgrs):
"""Initialize with lists of managers and transformations"""
self.mgrs = mgrs
self.fops = [pg.frameworks.PetroModelling(m.fop, p)
for p, m in zip(petros, mgrs)]
super().__init__(fop=pg.frameworks.JointModelling(self.fops))
... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def checkData(self, data):
"""Collect data values."""
if len(data) != len(self.mgrs):
pg.critical("Please provide data for all managers")
self.dataTrans.clear()
vals = pg.Vector(0)
for i, mgr in enumerate(self.mgrs):
self.dataTrans.add(mgr.inv.dataTrans,... | gimli-org/gimli | [
257,
109,
257,
13,
1378329047
] |
def connect(server=None, url=None, ip=None, port=None, https=None, verify_ssl_certificates=None, auth=None,
proxy=None, cookies=None, verbose=True, config=None):
"""
Connect to an existing H2O server, remote or local.
There are two ways to connect to a server: either pass a `server` parameter c... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def connection():
"""Return the current :class:`H2OConnection` handler."""
return h2oconn | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def init(url=None, ip=None, port=None, name=None, https=None, insecure=None, username=None, password=None,
cookies=None, proxy=None, start_h2o=True, nthreads=-1, ice_root=None, log_dir=None, log_level=None,
enable_assertions=True, max_mem_size=None, min_mem_size=None, strict_version_check=None, ignore... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def _import_multi(paths, pattern):
assert_is_type(paths, [str])
assert_is_type(pattern, str, None)
j = api("POST /3/ImportFilesMulti", {"paths": paths, "pattern": pattern})
if j["fails"]: raise ValueError("ImportFiles of '" + ".".join(paths) + "' failed on " + str(j["fails"]))
return j["destination_... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def import_file(path=None, destination_frame=None, parse=True, header=0, sep=None, col_names=None, col_types=None,
na_strings=None, pattern=None, skipped_columns=None):
"""
Import a dataset that is already on the cluster.
The path to the data must be a valid path for each node in the H2O cl... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def import_sql_select(connection_url, select_query, username, password, optimize=True, fetch_mode=None):
"""
Import the SQL table that is the result of the specified SQL query to H2OFrame in memory.
Creates a temporary SQL table from the specified sql_query.
Runs multiple SELECT SQL queries on the temp... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def parse_raw(setup, id=None, first_line_is_header=0):
"""
Parse dataset using the parse setup structure.
:param setup: Result of ``h2o.parse_setup()``
:param id: an id for the frame.
:param first_line_is_header: -1, 0, 1 if the first line is to be used as the header
:returns: an :class:`H2OFr... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def deep_copy(data, xid):
"""
Create a deep clone of the frame ``data``.
:param data: an H2OFrame to be cloned
:param xid: (internal) id to be assigned to the new frame.
:returns: new :class:`H2OFrame` which is the clone of the passed frame.
"""
assert_is_type(data, H2OFrame)
assert_is_... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def get_grid(grid_id):
"""
Return the specified grid.
:param grid_id: The grid identification in h2o
:returns: an :class:`H2OGridSearch` instance.
"""
assert_is_type(grid_id, str)
grid_json = api("GET /99/Grids/%s" % grid_id)
models = [get_model(key["name"]) for key in grid_json["model... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def no_progress():
"""
Disable the progress bar from flushing to stdout.
The completed progress bar is printed when a job is complete so as to demarcate a log file.
"""
H2OJob.__PROGRESS_BAR__ = False | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def enable_expr_optimizations(flag):
"""Enable expression tree local optimizations."""
ExprNode.__ENABLE_EXPR_OPTIMIZATIONS__ = flag | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def log_and_echo(message=""):
"""
Log a message on the server-side logs.
This is helpful when running several pieces of work one after the other on a single H2O
cluster and you want to make a notation in the H2O server side log where one piece of
work ends and the next piece of work begins.
Se... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def remove_all():
"""Remove all objects from H2O."""
api("DELETE /3/DKV") | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def ls():
"""List keys on an H2O Cluster."""
return H2OFrame._expr(expr=ExprNode("ls")).as_data_frame(use_pandas=True) | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def frames():
"""
Retrieve all the Frames.
:returns: Meta information on the frames
"""
return api("GET /3/Frames") | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def download_csv(data, filename):
"""
Download an H2O data set to a CSV file on the local disk.
Warning: Files located on the H2O server may be very large! Make sure you have enough
hard drive space to accommodate the entire file.
:param data: an H2OFrame object to be downloaded.
:param filena... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def save_model(model, path="", force=False):
"""
Save an H2O Model object to disk. (Note that ensemble binary models can now be saved using this method.)
:param model: The model object to save.
:param path: a path to save the model at (hdfs, s3, local)
:param force: if True overwrite destination di... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def export_file(frame, path, force=False, parts=1):
"""
Export a given H2OFrame to a path on the machine this python session is currently connected to.
:param frame: the Frame to save to disk.
:param path: the path to the save point on disk.
:param force: if True, overwrite any preexisting file wit... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
def create_frame(frame_id=None, rows=10000, cols=10, randomize=True,
real_fraction=None, categorical_fraction=None, integer_fraction=None,
binary_fraction=None, time_fraction=None, string_fraction=None,
value=0, real_range=100, factors=100, integer_range=100,
... | h2oai/h2o-dev | [
6169,
1943,
6169,
208,
1393862887
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.