prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>sleep_schedule.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta from time import sleep from random import uniform class SleepSchedule(object): """Pauses the execution of the bot every day for some time Simulates the user going to sleep every day for some time, the sleep t...
__init__
<|file_name|>sleep_schedule.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta from time import sleep from random import uniform class SleepSchedule(object): """Pauses the execution of the bot every day for some time Simulates the user going to sleep every day for some time, the sleep t...
work
<|file_name|>sleep_schedule.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta from time import sleep from random import uniform class SleepSchedule(object): """Pauses the execution of the bot every day for some time Simulates the user going to sleep every day for some time, the sleep t...
_process_config
<|file_name|>sleep_schedule.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta from time import sleep from random import uniform class SleepSchedule(object): """Pauses the execution of the bot every day for some time Simulates the user going to sleep every day for some time, the sleep t...
_schedule_next_sleep
<|file_name|>sleep_schedule.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta from time import sleep from random import uniform class SleepSchedule(object): """Pauses the execution of the bot every day for some time Simulates the user going to sleep every day for some time, the sleep t...
_calculate_current_sleep
<|file_name|>sleep_schedule.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta from time import sleep from random import uniform class SleepSchedule(object): """Pauses the execution of the bot every day for some time Simulates the user going to sleep every day for some time, the sleep t...
_should_sleep_now
<|file_name|>sleep_schedule.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta from time import sleep from random import uniform class SleepSchedule(object): """Pauses the execution of the bot every day for some time Simulates the user going to sleep every day for some time, the sleep t...
_get_next_sleep_schedule
<|file_name|>sleep_schedule.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta from time import sleep from random import uniform class SleepSchedule(object): """Pauses the execution of the bot every day for some time Simulates the user going to sleep every day for some time, the sleep t...
_get_next_duration
<|file_name|>sleep_schedule.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta from time import sleep from random import uniform class SleepSchedule(object): """Pauses the execution of the bot every day for some time Simulates the user going to sleep every day for some time, the sleep t...
_get_random_offset
<|file_name|>sleep_schedule.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta from time import sleep from random import uniform class SleepSchedule(object): """Pauses the execution of the bot every day for some time Simulates the user going to sleep every day for some time, the sleep t...
_sleep
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
def addInit(cls, init): """ Adds the `init` method to the list of extensions of the `MainWindow.__init__`. """
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): <|fim_middle|> <|fim▁end|>
__inits = [] def __init__(self): super(MainWindow, self).__init__() self.tabs = QtGui.QTabWidget(self) self.tabs.setTabsClosable(False) self.tabs.setIconSize(QtCore.QSize(32, 32)) self.tabs.currentChanged.connect(self.onCurrentTabChanged) ...
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): <|fim_middle|> ...
super(MainWindow, self).__init__() self.tabs = QtGui.QTabWidget(self) self.tabs.setTabsClosable(False) self.tabs.setIconSize(QtCore.QSize(32, 32)) self.tabs.currentChanged.connect(self.onCurrentTabChanged) self.toolbar = self.addToolBar('Base') ...
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
""" Loads the toolbar actions, restore toolbar state, and restore window geometry. """ mwState = cbpos.config['mainwindow', 'state'] mwGeom = cbpos.config['mainwindow', 'geometry'] for act in cbpos.menu.actions: # TODO: Remember to load an icon with...
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
""" Load the menu root items and items into the QTabWidget with the appropriate pages. """ show_empty_root_items = cbpos.config['menu', 'show_empty_root_items'] show_disabled_items = cbpos.config['menu', 'show_disabled_items'] hide_tab_bar = not cbpos.config['menu',...
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
if tabs is None: tabs = self.tabs widget = tabs.widget(index) try: signal = widget.shown except AttributeError: pass else: signal.emit()
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
""" Returns the appropriate window to be placed in the main QTabWidget, depending on the number of children of a root menu item. """ count = len(items) if count == 0: # If there are no child items, just return an empty widget widget = QtGui....
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
""" Saves the main window state (position, size, toolbar positions) """ mwState = self.saveState().toBase64() mwGeom = self.saveGeometry().toBase64() cbpos.config['mainwindow', 'state'] = unicode(mwState) cbpos.config['mainwindow', 'geometry'] = unicode(m...
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
""" Perform necessary operations before closing the window. """ self.saveWindowState() #do any other thing before closing... event.accept()
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
""" Adds the `init` method to the list of extensions of the `MainWindow.__init__`. """ cls.__inits.append(init)
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
""" Handle calls to `__init__` methods of extensions of the MainWindow. """ for init in self.__inits: init(self)
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
self.restoreState( QtCore.QByteArray.fromBase64(mwState) )
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
self.restoreGeometry( QtCore.QByteArray.fromBase64(mwGeom) )
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
self.setGeometry(0, 0, 800, 600)
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
self.tabs.tabBar().hide() # This pre-supposes that the menu items will come after the actions self.toolbar.addSeparator()
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
continue
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
children = root.children
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
children = [i for i in root.children if i.enabled]
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
continue
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
action = QtGui.QAction(QtGui.QIcon(icon), root.label, self) action.onTrigger = lambda n=index: self.tabs.setCurrentIndex(n) action.triggered.connect(action.onTrigger) self.toolbar.addAction(action)
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
tabs = self.tabs
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
signal.emit()
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
widget = QtGui.QWidget() widget.setEnabled(False) return widget
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
logger.debug('Loading menu page for %s', items[0].name) widget = items[0].page() widget.setEnabled(items[0].enabled) return widget
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
tabs = QtGui.QTabWidget() tabs.currentChanged.connect(lambda i, t=tabs: self.onCurrentTabChanged(i, t)) for item in items: logger.debug('Loading menu page for %s', item.name) widget = item.page() icon = QtGui.QI...
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def <|fim_middle|>(self): super(MainWin...
__init__
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
loadToolbar
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
loadMenu
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
onCurrentTabChanged
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
getTabWidget
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
saveWindowState
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
closeEvent
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
addInit
<|file_name|>window.py<|end_file_name|><|fim▁begin|>from pydispatch import dispatcher from PySide import QtCore, QtGui import cbpos logger = cbpos.get_logger(__name__) from .page import BasePage class MainWindow(QtGui.QMainWindow): __inits = [] def __init__(self): super(MainWindow, s...
callInit
<|file_name|>settings.py<|end_file_name|><|fim▁begin|>""" Django settings for apps project. Generated by 'django-admin startproject' using Django 1.9.7. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djang...
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
<|file_name|>pyunit_link_functions_tweedie_basicGLM.py<|end_file_name|><|fim▁begin|>import sys sys.path.insert(1, "../../../") import h2o def link_functions_tweedie_basic(ip,port): # Connect to h2o h2o.init(ip,port) print "Read in prostate data." hdf = h2o.upload_file(h2o.locate("smalldata/prostate/pr...
model_h2o_tweedie = h2o.glm(x=hdf[x], y=hdf[y], family="tweedie", link="tweedie", alpha=[0.5], Lambda = [0])
<|file_name|>pyunit_link_functions_tweedie_basicGLM.py<|end_file_name|><|fim▁begin|>import sys sys.path.insert(1, "../../../") import h2o def link_functions_tweedie_basic(ip,port): # Connect to h2o <|fim_middle|> if __name__ == "__main__": h2o.run_test(sys.argv, link_functions_tweedie_basic) <|fim▁end|...
h2o.init(ip,port) print "Read in prostate data." hdf = h2o.upload_file(h2o.locate("smalldata/prostate/prostate_complete.csv.zip")) print "Testing for family: TWEEDIE" print "Set variables for h2o." y = "CAPSULE" x = ["AGE","RACE","DCAPS","PSA","VOL","DPROS","GLEASON"] print "Create mo...
<|file_name|>pyunit_link_functions_tweedie_basicGLM.py<|end_file_name|><|fim▁begin|>import sys sys.path.insert(1, "../../../") import h2o def link_functions_tweedie_basic(ip,port): # Connect to h2o h2o.init(ip,port) print "Read in prostate data." hdf = h2o.upload_file(h2o.locate("smalldata/prostate/pr...
h2o.run_test(sys.argv, link_functions_tweedie_basic)
<|file_name|>pyunit_link_functions_tweedie_basicGLM.py<|end_file_name|><|fim▁begin|>import sys sys.path.insert(1, "../../../") import h2o def <|fim_middle|>(ip,port): # Connect to h2o h2o.init(ip,port) print "Read in prostate data." hdf = h2o.upload_file(h2o.locate("smalldata/prostate/prostate_complet...
link_functions_tweedie_basic
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
if QtGui.QMessageBox.warning(self, self.tr("Replace User"), self.tr("Are you sure you want to overwrite \"{0}\" user?")\
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
"""This class provides a add user dialog feature to users page of LTMT""" def __init__(self, configparser, parent=None): """Init method @param self A AddUser instance @param parent Parent QtGui.QWidget object """ self.configparser = configparser self.parent = parent QtGui.QDialog.__init__(self) se...
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
"""Init method @param self A AddUser instance @param parent Parent QtGui.QWidget object """ self.configparser = configparser self.parent = parent QtGui.QDialog.__init__(self) self.ui = Ui_AddUser() self.ui.setupUi(self) self.parseDefaults() self.ui.detailsWid.hide()
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
"""Parse some default values for new user accounts @param self A AddUser instance """ with open("/etc/default/useradd", 'r') as ua: for l in ua: L = l.strip().split('=') if len(L) >= 2: if L[0] == "GROUP": self.group = L[1] elif L[0] == "HOME": self.home = L[1] elif L[0] ...
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
"""Slot called when user name was changed, updating entries @param self A AddUser instance @param username String username """ self.ui.initGLine.setText(self.group) self.ui.homeLine.setText(os.path.join(self.home, username)) self.ui.shellLine.setText(self.shell)
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
"""Reimplemented method QtGui.QDialog.accept Add user to configparser before accept dialog @param self A AddUser instance """ user = self.ui.nameLine.text() print("__accepted__", user) if user in self.configparser.getUsersList(): if QtGui.QMessageBox.warning(self, self.tr("Replace User"), self.tr...
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
if L[0] == "GROUP": self.group = L[1] elif L[0] == "HOME": self.home = L[1] elif L[0] == "SHELL": self.shell = L[1]
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
self.group = L[1]
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
self.home = L[1]
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
self.shell = L[1]
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
if QtGui.QMessageBox.warning(self, self.tr("Replace User"), self.tr("Are you sure you want to overwrite \"{0}\" user?")\ .format(user), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) == QtGui.QMessageBox.Yes: self.configparser.delUser(user) else: return
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
self.configparser.delUser(user)
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
return
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
self.configparser.setUserSync(user, passwd=self.ui.pwLine.text(), uid=self.ui.uidSpin.text(), init_group=self.ui.initGLine.text(), groups=[g.strip() for g in self.ui.groupsLine.text().split(',')], home=self.ui.homeLine.text(), shell=self.ui.shellLine.text())
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
__init__
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
parseDefaults
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
userChanged
<|file_name|>addUser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # # # # This file is part of librix-thinclient. # # librix-thinclient is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
accept
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>from rest_framework import status<|fim▁hole|> def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid errors when the OSF is loaded without Django from rest...
from rest_framework.exceptions import APIException, ParseError
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def json_api_exception_handler(exc, context): <|fim_middle|> # Custom Exceptions the Django Rest Framework does not support class Gone(APIException): sta...
""" Custom exception handler that returns errors object as an array """ # Import inside method to avoid errors when the OSF is loaded without Django from rest_framework.views import exception_handler response = exception_handler(exc, context) # Error objects may have the following members. Title r...
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid error...
status_code = status.HTTP_410_GONE default_detail = ('The requested resource is no longer available.')
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid error...
"""Raised when client passes an invalid filter in the querystring.""" default_detail = 'Querystring contains an invalid filter.'
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid error...
message = response.data if isinstance(message, dict): for error_key, error_description in message.iteritems(): if error_key in top_level_error_keys: errors.append({error_key: error_description}) else: if isinstance(erro...
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid error...
for error_key, error_description in message.iteritems(): if error_key in top_level_error_keys: errors.append({error_key: error_description}) else: if isinstance(error_description, basestring): error_description =...
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid error...
errors.append({error_key: error_description})
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid error...
if isinstance(error_description, basestring): error_description = [error_description] errors.extend([{'source': {'pointer': '/data/attributes/' + error_key}, 'detail': reason} for reason in error_description])
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid error...
error_description = [error_description]
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid error...
if isinstance(message, basestring): message = [message] errors.extend([{'detail': error} for error in message])
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid error...
message = [message]
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|> from rest_framework import status from rest_framework.exceptions import APIException, ParseError def <|fim_middle|>(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid errors when the O...
json_api_exception_handler
<|file_name|>mobile_uploader.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at<|fim▁hole|># Unless required by applicable law or agre...
# # https://www.apache.org/licenses/LICENSE-2.0 #
<|file_name|>mobile_uploader.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # ...
def get_list_definition(self, account_config: AccountConfig, destination_metadata: List[str]) -> Dict[str, Any]: list_name = destination_metadata[0] app_id = account_config.app_id #overwrite app_id from default to custom if len(destination_metadata) >=4 and len(destination_metadata[3]) > 0: ...
<|file_name|>mobile_uploader.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # ...
list_name = destination_metadata[0] app_id = account_config.app_id #overwrite app_id from default to custom if len(destination_metadata) >=4 and len(destination_metadata[3]) > 0: app_id = destination_metadata[3] return { 'membership_status': 'OPEN', 'name': list_name, ...
<|file_name|>mobile_uploader.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # ...
return ['mobile_id']
<|file_name|>mobile_uploader.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # ...
return DestinationType.ADS_CUSTOMER_MATCH_MOBILE_DEVICE_ID_UPLOAD
<|file_name|>mobile_uploader.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # ...
app_id = destination_metadata[3]
<|file_name|>mobile_uploader.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # ...
get_list_definition
<|file_name|>mobile_uploader.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # ...
get_row_keys
<|file_name|>mobile_uploader.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # ...
get_action_type
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|>
from opencvBuilder import exists,generate
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|>from . import config from django.shortcuts import render from mwoauth import ConsumerToken, Handshaker, tokens def requests_handshaker(): consumer_key = config.OAUTH_CONSUMER_KEY consumer_secret = config.OAUTH_CONSUMER_SECRET<|fim▁hole|>def get_usern...
consumer_token = ConsumerToken(consumer_key, consumer_secret) return Handshaker("https://meta.wikimedia.org/w/index.php", consumer_token)
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|>from . import config from django.shortcuts import render from mwoauth import ConsumerToken, Handshaker, tokens def requests_handshaker(): <|fim_middle|> def get_username(request): handshaker = requests_handshaker() if 'access_token_key' in req...
consumer_key = config.OAUTH_CONSUMER_KEY consumer_secret = config.OAUTH_CONSUMER_SECRET consumer_token = ConsumerToken(consumer_key, consumer_secret) return Handshaker("https://meta.wikimedia.org/w/index.php", consumer_token)
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|>from . import config from django.shortcuts import render from mwoauth import ConsumerToken, Handshaker, tokens def requests_handshaker(): consumer_key = config.OAUTH_CONSUMER_KEY consumer_secret = config.OAUTH_CONSUMER_SECRET consumer_token = Con...
handshaker = requests_handshaker() if 'access_token_key' in request.session: access_key = request.session['access_token_key'].encode('utf-8') access_secret = request.session['access_token_secret'].encode('utf-8') access_token = tokens.AccessToken(key=access_key, secret=access_secret) ...
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|>from . import config from django.shortcuts import render from mwoauth import ConsumerToken, Handshaker, tokens def requests_handshaker(): consumer_key = config.OAUTH_CONSUMER_KEY consumer_secret = config.OAUTH_CONSUMER_SECRET consumer_token = Con...
access_key = request.session['access_token_key'].encode('utf-8') access_secret = request.session['access_token_secret'].encode('utf-8') access_token = tokens.AccessToken(key=access_key, secret=access_secret) return handshaker.identify(access_token)['username']
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|>from . import config from django.shortcuts import render from mwoauth import ConsumerToken, Handshaker, tokens def requests_handshaker(): consumer_key = config.OAUTH_CONSUMER_KEY consumer_secret = config.OAUTH_CONSUMER_SECRET consumer_token = Con...
return None
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|>from . import config from django.shortcuts import render from mwoauth import ConsumerToken, Handshaker, tokens def <|fim_middle|>(): consumer_key = config.OAUTH_CONSUMER_KEY consumer_secret = config.OAUTH_CONSUMER_SECRET consumer_token = Consumer...
requests_handshaker
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|>from . import config from django.shortcuts import render from mwoauth import ConsumerToken, Handshaker, tokens def requests_handshaker(): consumer_key = config.OAUTH_CONSUMER_KEY consumer_secret = config.OAUTH_CONSUMER_SECRET consumer_token = Con...
get_username
<|file_name|>media_operations.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # a...
def decode_metadata(metadata): return dict((k.lower(), decode_val(v)) for k, v in metadata.items())
<|file_name|>media_operations.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # a...
buf = afile.read(blocksize) while len(buf) > 0: hasher.update(buf) buf = afile.read(blocksize) return hasher.hexdigest()
<|file_name|>media_operations.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # a...
return hash_file(file, hashlib.sha256())
<|file_name|>media_operations.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # a...
rv = requests.get(url, timeout=15) if rv.status_code not in (200, 201): raise SuperdeskApiError.internalError('Failed to retrieve file from URL: %s' % url) mime = magic.from_buffer(rv.content, mime=True).decode('UTF-8') ext = mime.split('/')[1] name = 'stub.' + ext return BytesIO(rv.con...