prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>override_autoescaped.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
templatetricks.override_autoescaped<|fim▁hole|>
Override which templates are autoescaped
http://flask.pocoo.org/snippets/41/
"""
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirn... | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
<|file_name|>override_autoescaped.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
templatetricks.override_autoescaped
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Override which templates are autoescaped
http://flask.pocoo.org/snippets/41/
"""
import os
import sys
sys.path.insert(0, os.path.dirname... | def select_jinja_autoescape(self, filename):
if filename.endswith('.jhtml'):
return True
return Flask.select_jinja_autoescape(self, filename) |
<|file_name|>override_autoescaped.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
templatetricks.override_autoescaped
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Override which templates are autoescaped
http://flask.pocoo.org/snippets/41/
"""
import os
import sys
sys.path.insert(0, os.path.dirname... | if filename.endswith('.jhtml'):
return True
return Flask.select_jinja_autoescape(self, filename) |
<|file_name|>override_autoescaped.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
templatetricks.override_autoescaped
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Override which templates are autoescaped
http://flask.pocoo.org/snippets/41/
"""
import os
import sys
sys.path.insert(0, os.path.dirname... | return True |
<|file_name|>override_autoescaped.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
templatetricks.override_autoescaped
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Override which templates are autoescaped
http://flask.pocoo.org/snippets/41/
"""
import os
import sys
sys.path.insert(0, os.path.dirname... | select_jinja_autoescape |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
"""Basic exception for errors raised by Phylotyper modules"""
def __init__(self, subtype, msg=None):
if msg is None:
msg = "An error occured for s... | def __init__(self, subtype, data, msg=None):
m = "Database is missing data {} for {}".format(data, subtype)
super(PhylotyperError, self).__init__(subtype, m)
self.data = data |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
<|fim_middle|>
class ValuesError(PhylotyperError):
"""Unknown subtype"""
def __init__(self, subtype, msg=None):
super(PhylotyperError, self).__init__(
... | """Basic exception for errors raised by Phylotyper modules"""
def __init__(self, subtype, msg=None):
if msg is None:
msg = "An error occured for subtype {}".format(subtype)
super(PhylotyperError, self).__init__(msg)
self.subtype = subtype |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
"""Basic exception for errors raised by Phylotyper modules"""
def __init__(self, subtype, msg=None):
<|fim_middle|>
class ValuesError(PhylotyperError):
... | if msg is None:
msg = "An error occured for subtype {}".format(subtype)
super(PhylotyperError, self).__init__(msg)
self.subtype = subtype |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
"""Basic exception for errors raised by Phylotyper modules"""
def __init__(self, subtype, msg=None):
if msg is None:
msg = "An error occured for s... | """Unknown subtype"""
def __init__(self, subtype, msg=None):
super(PhylotyperError, self).__init__(
subtype, msg="Unrecognized subtype {}".format(subtype)) |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
"""Basic exception for errors raised by Phylotyper modules"""
def __init__(self, subtype, msg=None):
if msg is None:
msg = "An error occured for s... | super(PhylotyperError, self).__init__(
subtype, msg="Unrecognized subtype {}".format(subtype)) |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
"""Basic exception for errors raised by Phylotyper modules"""
def __init__(self, subtype, msg=None):
if msg is None:
msg = "An error occured for s... | """Missing data in Database"""
def __init__(self, subtype, data, msg=None):
m = "Database is missing data {} for {}".format(data, subtype)
super(PhylotyperError, self).__init__(subtype, m)
self.data = data |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
"""Basic exception for errors raised by Phylotyper modules"""
def __init__(self, subtype, msg=None):
if msg is None:
msg = "An error occured for s... | m = "Database is missing data {} for {}".format(data, subtype)
super(PhylotyperError, self).__init__(subtype, m)
self.data = data |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
"""Basic exception for errors raised by Phylotyper modules"""
def __init__(self, subtype, msg=None):
if msg is None:
<|fim_middle|>
... | msg = "An error occured for subtype {}".format(subtype) |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
"""Basic exception for errors raised by Phylotyper modules"""
def <|fim_middle|>(self, subtype, msg=None):
if msg is None:
msg = "An error occured... | __init__ |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
"""Basic exception for errors raised by Phylotyper modules"""
def __init__(self, subtype, msg=None):
if msg is None:
msg = "An error occured for s... | __init__ |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>"""Custom Exception Classes for Phylotyper Module
"""
class PhylotyperError(Exception):
"""Basic exception for errors raised by Phylotyper modules"""
def __init__(self, subtype, msg=None):
if msg is None:
msg = "An error occured for s... | __init__ |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def test_scheme():
# does not raise NotImplementedError
UrlPath('/dev/null').touch()
def test_scheme_not_supported():
with pytest.raises(NotImplementedError):
UrlPath('ht... | UrlPath('https://localhost/test').exists() |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def test_scheme():
# does not raise NotImplementedError
<|fim_middle|>
def test_scheme_not_supported():
with pytest.raises(NotImplementedError):
UrlPath('http:///tmp/tes... | UrlPath('/dev/null').touch() |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def test_scheme():
# does not raise NotImplementedError
UrlPath('/dev/null').touch()
def test_scheme_not_supported():
<|fim_middle|>
def test_scheme_not_listed():
with py... | with pytest.raises(NotImplementedError):
UrlPath('http:///tmp/test').touch() |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def test_scheme():
# does not raise NotImplementedError
UrlPath('/dev/null').touch()
def test_scheme_not_supported():
with pytest.raises(NotImplementedError):
UrlPath('ht... | with pytest.raises(NotImplementedError):
UrlPath('test:///tmp/test').touch() |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def test_scheme():
# does not raise NotImplementedError
UrlPath('/dev/null').touch()
def test_scheme_not_supported():
with pytest.raises(NotImplementedError):
UrlPath('ht... | assert UrlPath('.').resolve() == UrlPath.cwd() |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def test_scheme():
# does not raise NotImplementedError
UrlPath('/dev/null').touch()
def test_scheme_not_supported():
with pytest.raises(NotImplementedError):
UrlPath('ht... | with pytest.raises(urllib.error.URLError):
UrlPath('https://localhost/test').exists() |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def <|fim_middle|>():
# does not raise NotImplementedError
UrlPath('/dev/null').touch()
def test_scheme_not_supported():
with pytest.raises(NotImplementedError):
UrlPath(... | test_scheme |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def test_scheme():
# does not raise NotImplementedError
UrlPath('/dev/null').touch()
def <|fim_middle|>():
with pytest.raises(NotImplementedError):
UrlPath('http:///tmp/t... | test_scheme_not_supported |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def test_scheme():
# does not raise NotImplementedError
UrlPath('/dev/null').touch()
def test_scheme_not_supported():
with pytest.raises(NotImplementedError):
UrlPath('ht... | test_scheme_not_listed |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def test_scheme():
# does not raise NotImplementedError
UrlPath('/dev/null').touch()
def test_scheme_not_supported():
with pytest.raises(NotImplementedError):
UrlPath('ht... | test_file_additional |
<|file_name|>test_dispatch.py<|end_file_name|><|fim▁begin|>import pytest
import urllib.error
from urlpathlib import UrlPath
def test_scheme():
# does not raise NotImplementedError
UrlPath('/dev/null').touch()
def test_scheme_not_supported():
with pytest.raises(NotImplementedError):
UrlPath('ht... | test_scheme_alias |
<|file_name|>test_edalizer.py<|end_file_name|><|fim▁begin|># Copyright FuseSoC contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause
def test_generators():
import os
import tempfile
from fusesoc.config import Config
from fusesoc.corem... | core = cm.get_core(Vlnv("::generate"))
|
<|file_name|>test_edalizer.py<|end_file_name|><|fim▁begin|># Copyright FuseSoC contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause
def test_generators():
<|fim_middle|>
<|fim▁end|> | import os
import tempfile
from fusesoc.config import Config
from fusesoc.coremanager import CoreManager
from fusesoc.edalizer import Edalizer
from fusesoc.librarymanager import Library
from fusesoc.vlnv import Vlnv
tests_dir = os.path.dirname(__file__)
cores_dir = os.path.join(test... |
<|file_name|>test_edalizer.py<|end_file_name|><|fim▁begin|># Copyright FuseSoC contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause
def <|fim_middle|>():
import os
import tempfile
from fusesoc.config import Config
from fusesoc.corema... | test_generators |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
from indico.core import signals
from indi... | __all__ = ['require_oauth']
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
from indico.core import signals
from indi... | if app.debug or app.testing:
os.environ['AUTHLIB_INSECURE_TRANSPORT'] = '1' |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
from indico.core import signals
from indi... | target_app_links = {link.application: link for link in target.oauth_app_links}
for source_link in source.oauth_app_links.all():
try:
target_link = target_app_links[source_link.application]
except KeyError:
logger.info('merge: reassigning %r to %r', source_link, target)
... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
from indico.core import signals
from indi... | os.environ['AUTHLIB_INSECURE_TRANSPORT'] = '1' |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
from indico.core import signals
from indi... | logger.info('merge: merging %r into %r', source_link, target_link)
target_link.update_scopes(set(source_link.scopes))
target_link.tokens.extend(source_link.tokens)
db.session.delete(source_link) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
from indico.core import signals
from indi... | _no_ssl_required_on_debug |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
from indico.core import signals
from indi... | _delete_merged_user_tokens |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | score_total = 0.00 |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | def __init__(self, evals=None):
self.evals = evals
self.courses = None
self.location = None
self.daily_weights = {"M": {}, "T": {}, "W": {}, "R": {}, "F": {} ,"S": {}}
self.daily_totals = {"M": {}, "T": {}, "W": {}, "R": {}, "F": {} ,"S": {}}
self.final_weight... |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | self.evals = evals
self.courses = None
self.location = None
self.daily_weights = {"M": {}, "T": {}, "W": {}, "R": {}, "F": {} ,"S": {}}
self.daily_totals = {"M": {}, "T": {}, "W": {}, "R": {}, "F": {} ,"S": {}}
self.final_weighted = 0
self.weight_rank = ... |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | for day in ["M", "T", "W", "R", "F", "S"]:
self.daily_weights[day] = 0
self.daily_totals[day] = 0 |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | return self.daily_weights[day_of_week] |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | value = self.final_weighted
value -= minimum
if maximum - minimum > 0:
value /= ( maximum - minimum )
else:
value = 0
self.weight_rank = "{0:.2f}".format(value * 10) |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | score_sum = 0.00
score_total = 0.00
#reset daily stuff
self.reset_daily_weights()
for course, score in self.courses:
days = course.rec["DAYS_OF_WEEK"]
#score_sum += score.get_weighted_score(course)
score_total += 1.00
for day ... |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | max_score = 1.00
if totals >= FULL_HOURS: # 8 Hours or more, give slight boost to score
weights *= 1.15 # 15% Boost
elif totals >= PARTIAL_HOURS: # Small Penalty
weights *= (PARTIAL_HOURS/FULL_HOURS)
elif totals >= HALF_HOURS: # Medium Penalty
... |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | return self.location |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | for course, score in self.courses:
location = str( course.rec["BUILDING"] )+ " " + str( course.rec["ROOM"] )
# just need to find the first one, so break after this happens
break
return location |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | return self.final_weighted |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | return self.weight_rank |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | return self.evals |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | self.courses = self.evals.get_records()
self.location = self.find_location()
self.final_weighted = self.calculate_final_weighted_score() |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | value /= ( maximum - minimum ) |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | value = 0 |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | self.daily_weights[day] += score.get_weighted_score(course)
self.daily_totals[day] += 1 |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | self.daily_weights[day] /= self.daily_totals[day]
self.daily_weights[day] = self.adjust_utilization(self.daily_weights[day],self.daily_totals[day])
score_sum += self.daily_weights[day] |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | self.daily_weights[day] = 0 |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | weights *= 1.15 # 15% Boost |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | weights *= (PARTIAL_HOURS/FULL_HOURS) |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | weights *= (HALF_HOURS/FULL_HOURS) |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | weights *= (SPARSE_HOURS/FULL_HOURS) |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | weights *= (1.00/FULL_HOURS) |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | __init__ |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | reset_daily_weights |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | get_daily_weight |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | normalize_final_weighted_score |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | calculate_final_weighted_score |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | adjust_utilization |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | get_location |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | find_location |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | get_final_weighted_score |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | get_score_rank |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>from rec import CourseRecord
from score import RoomScore
from evaluation import ScheduleEvaluation
FULL_HOURS = 8 # 8:00AM - 4:00PM utilization
PARTIAL_HOURS = FULL_HOURS * 0.75 #75%
HALF_HOURS = FULL_HOURS * 0.50 #50%
SPARSE_HOURS = FULL_HOURS * 0.25 #25%
... | get_evals |
<|file_name|>recursive_auto_encoder.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging, os
logging.basicConfig(level=logging.INFO)
from deepy.networks import RecursiveAutoEncoder
from deepy.trainers import SGDTrainer, LearningRateAnnealer
from util import get_data, VECTOR_SI... | model = RecursiveAutoEncoder(input_dim=VECTOR_SIZE, rep_dim=10) |
<|file_name|>recursive_auto_encoder.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging, os
logging.basicConfig(level=logging.INFO)
from deepy.networks import RecursiveAutoEncoder
from deepy.trainers import SGDTrainer, LearningRateAnnealer
from util import get_data, VECTOR_SI... | model = RecursiveAutoEncoder(input_dim=VECTOR_SIZE, rep_dim=10)
trainer = SGDTrainer(model)
annealer = LearningRateAnnealer()
trainer.run(get_data(), epoch_controllers=[annealer])
model.save_params(model_path) |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
<|fim▁hole|>
@pytest.fixture
def average_list():
... | @pytest.fixture
def reverse_list():
return [i for i in xrange(9, -1, -1)] |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
<|fim_middle|>
@pytest.fixture
def reverse_list():
return [i for i in xrange(... | return [i for i in xrange(10)] |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
<|fim_middl... | return [i for i in xrange(9, -1, -1)] |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | return [5, 9, 2, 4, 1, 6, 8, 7, 0, 3] |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | insertion_sort(sorted_list)
assert sorted_list == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | insertion_sort(reverse_list)
assert reverse_list == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | insertion_sort(average_list)
assert average_list == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | l = [3, 6, 7, 3, 9, 5, 2, 7]
insertion_sort(l)
assert l == [2, 3, 3, 5, 6, 7, 7, 9] |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | l = [3, 'foo', 2.8, True, []]
# python 2 sorting is crazy
insertion_sort(l)
assert l == [True, 2.8, 3, [], 'foo'] |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def <|fim_middle|>():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [... | sorted_list |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def <|fim_middle|>():
return [i... | reverse_list |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | average_list |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | test_sorted |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | test_worst |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | test_average |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | test_repeats |
<|file_name|>test_insertion_sort.py<|end_file_name|><|fim▁begin|># -*- coding utf-8 -*-
from __future__ import unicode_literals
import pytest
from structures.insertion_sort import insertion_sort
@pytest.fixture
def sorted_list():
return [i for i in xrange(10)]
@pytest.fixture
def reverse_list():
return [i f... | test_multiple_types |
<|file_name|>test_util.py<|end_file_name|><|fim▁begin|>import unittest
import numpy as np
from bayesnet.image.util import img2patch, patch2img
class TestImg2Patch(unittest.TestCase):
def test_img2patch(self):
img = np.arange(16).reshape(1, 4, 4, 1)
patch = img2patch(img, size=3, step=1)
e... |
if __name__ == '__main__':
unittest.main() |
<|file_name|>test_util.py<|end_file_name|><|fim▁begin|>import unittest
import numpy as np
from bayesnet.image.util import img2patch, patch2img
class TestImg2Patch(unittest.TestCase):
<|fim_middle|>
class TestPatch2Img(unittest.TestCase):
def test_patch2img(self):
img = np.arange(16).reshape(1, 4,... | def test_img2patch(self):
img = np.arange(16).reshape(1, 4, 4, 1)
patch = img2patch(img, size=3, step=1)
expected = np.asarray([
[img[0, 0:3, 0:3, 0], img[0, 0:3, 1:4, 0]],
[img[0, 1:4, 0:3, 0], img[0, 1:4, 1:4, 0]]
])
expected = expected[None, ..., No... |
<|file_name|>test_util.py<|end_file_name|><|fim▁begin|>import unittest
import numpy as np
from bayesnet.image.util import img2patch, patch2img
class TestImg2Patch(unittest.TestCase):
def test_img2patch(self):
<|fim_middle|>
class TestPatch2Img(unittest.TestCase):
def test_patch2img(self):
... | img = np.arange(16).reshape(1, 4, 4, 1)
patch = img2patch(img, size=3, step=1)
expected = np.asarray([
[img[0, 0:3, 0:3, 0], img[0, 0:3, 1:4, 0]],
[img[0, 1:4, 0:3, 0], img[0, 1:4, 1:4, 0]]
])
expected = expected[None, ..., None]
self.assertTrue((p... |
<|file_name|>test_util.py<|end_file_name|><|fim▁begin|>import unittest
import numpy as np
from bayesnet.image.util import img2patch, patch2img
class TestImg2Patch(unittest.TestCase):
def test_img2patch(self):
img = np.arange(16).reshape(1, 4, 4, 1)
patch = img2patch(img, size=3, step=1)
e... | def test_patch2img(self):
img = np.arange(16).reshape(1, 4, 4, 1)
patch = img2patch(img, size=2, step=2)
self.assertTrue((img == patch2img(patch, (2, 2), (1, 4, 4, 1))).all())
patch = img2patch(img, size=3, step=1)
expected = np.arange(0, 32, 2).reshape(1, 4, 4, 1)
ex... |
<|file_name|>test_util.py<|end_file_name|><|fim▁begin|>import unittest
import numpy as np
from bayesnet.image.util import img2patch, patch2img
class TestImg2Patch(unittest.TestCase):
def test_img2patch(self):
img = np.arange(16).reshape(1, 4, 4, 1)
patch = img2patch(img, size=3, step=1)
e... | img = np.arange(16).reshape(1, 4, 4, 1)
patch = img2patch(img, size=2, step=2)
self.assertTrue((img == patch2img(patch, (2, 2), (1, 4, 4, 1))).all())
patch = img2patch(img, size=3, step=1)
expected = np.arange(0, 32, 2).reshape(1, 4, 4, 1)
expected[0, 0, 0, 0] /= 2
... |
<|file_name|>test_util.py<|end_file_name|><|fim▁begin|>import unittest
import numpy as np
from bayesnet.image.util import img2patch, patch2img
class TestImg2Patch(unittest.TestCase):
def test_img2patch(self):
img = np.arange(16).reshape(1, 4, 4, 1)
patch = img2patch(img, size=3, step=1)
e... | unittest.main() |
<|file_name|>test_util.py<|end_file_name|><|fim▁begin|>import unittest
import numpy as np
from bayesnet.image.util import img2patch, patch2img
class TestImg2Patch(unittest.TestCase):
def <|fim_middle|>(self):
img = np.arange(16).reshape(1, 4, 4, 1)
patch = img2patch(img, size=3, step=1)
e... | test_img2patch |
<|file_name|>test_util.py<|end_file_name|><|fim▁begin|>import unittest
import numpy as np
from bayesnet.image.util import img2patch, patch2img
class TestImg2Patch(unittest.TestCase):
def test_img2patch(self):
img = np.arange(16).reshape(1, 4, 4, 1)
patch = img2patch(img, size=3, step=1)
e... | test_patch2img |
<|file_name|>read_job.py<|end_file_name|><|fim▁begin|># JoeTraffic - Web-Log Analysis Application utilizing the JoeAgent Framework.
# Copyright (C) 2004 Rhett Garber
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by th... | self._log_size))
except log_parser.EndOfLogException, e:
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.