prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>mallet_lda_tags.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import logging
import traceback
import mallet_lda
class MalletTagTopics(mallet_lda.MalletLDA):
"""
Topic modeling with separation based on tags
"""
def _basic_params(self):
... | post_setup |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""course_discovery URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to u... | login = RedirectView.as_view(url=reverse_lazy('social:begin', args=['edx-oidc']), permanent=False, query_string=True) |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""course_discovery URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to u... | import debug_toolbar # pylint: disable=import-error
urlpatterns.append(url(r'^__debug__/', include(debug_toolbar.urls))) |
<|file_name|>opening_a_file.py<|end_file_name|><|fim▁begin|>#
# Place a file called test.txt in the same directory as you place this program... <|fim▁hole|>#
f = open('test.txt')
s = f.read()
print(s)<|fim▁end|> | |
<|file_name|>KPassivePopupMessageHandler.py<|end_file_name|><|fim▁begin|># encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
imp... | def __init__(self, *args, **kwargs): # real signature unknown |
<|file_name|>KPassivePopupMessageHandler.py<|end_file_name|><|fim▁begin|># encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
imp... | def message(self, *args, **kwargs): # real signature unknown
pass
def __init__(self, *args, **kwargs): # real signature unknown
pass |
<|file_name|>KPassivePopupMessageHandler.py<|end_file_name|><|fim▁begin|># encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
imp... | pass |
<|file_name|>KPassivePopupMessageHandler.py<|end_file_name|><|fim▁begin|># encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
imp... | pass |
<|file_name|>KPassivePopupMessageHandler.py<|end_file_name|><|fim▁begin|># encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
imp... | message |
<|file_name|>KPassivePopupMessageHandler.py<|end_file_name|><|fim▁begin|># encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
imp... | __init__ |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | # autoit.control_send(bot.title, '', '{F8}', 0)
# counter = 0
counter += 1
print 'cnt ' + str(counter) |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
<|fim_middle|>
if __name__ == '__main__':
main()
<|fim▁end|> | bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonUse = 0
cycle = True
fullCounter = 0
while cycle:
hpstatus = bot.checkOwnHp()
print 'hp ' + str(hpstatus)
if hpstatus == 0:
autoit.control_send(bot.title, '', '{F9}', 0)
bot.sleep(0.3,... |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | autoit.control_send(bot.title, '', '{F9}', 0)
bot.sleep(0.3,0.6)
print 'Dead'
cv2.imwrite('Dead' + str(int(time.time())) + '.png',bot.getScreen(leftCornerx,leftCornery,x2,fullY2))
cycle = False |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | if poitonUse == 0:
autoit.control_send(bot.title, '', '{F10}', 0)
poitonUse += 1
if poitonUse > 5:
poitonUse = 0 |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | autoit.control_send(bot.title, '', '{F10}', 0) |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | poitonUse = 0 |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | poitonUse = 0 |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | fullCounter += 1
print 'fc ' + str(fullCounter)
autoit.control_send(bot.title, '', '{F1}', 0) |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | fullCounter = 0 |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | autoit.control_send(bot.title, '', '{ESC}', 0)
bot.sleep(0.3,0.6)
autoit.control_send(bot.title, '', '{F3}', 0)
bot.sleep(0.1,0.3)
autoit.control_send(bot.title, '', '{F1}', 0)
# bot.mouseRotate()
fullCounter = 0 |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | autoit.control_send(bot.title, '', '{F1}', 0)
counter = 0
if res == 1 or res == 3:
bot.sleep(0.3,0.6)
if res > 1 and res < 3:
bot.sleep(1,3)
if res == 1:
autoit.control_send(bot.title, '', '{F3}', 0)
... |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | bot.sleep(0.3,0.6) |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | bot.sleep(1,3) |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | autoit.control_send(bot.title, '', '{F3}', 0)
bot.sleep(0.3,0.6)
autoit.control_send(bot.title, '', '{F2}', 0)
bot.sleep(0.3,0.6)
autoit.control_send(bot.title, '', '{F1}', 0) |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | fullCounter = 0
if counter < 3:
autoit.control_send(bot.title, '', '{F3}', 0)
bot.sleep(0.5,0.8)
autoit.control_send(bot.title, '', '{F1}', 0)
print 'F3'
if counter > 2:
# bot.findTarget()
... |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | autoit.control_send(bot.title, '', '{F3}', 0)
bot.sleep(0.5,0.8)
autoit.control_send(bot.title, '', '{F1}', 0)
print 'F3' |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | autoit.control_send(bot.title, '', '{F7}', 0) |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonU... | main() |
<|file_name|>wl.py<|end_file_name|><|fim▁begin|>import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def <|fim_middle|>():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
... | main |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|> print('Docker Service Module')
if __name__ == '__main__':
main()<|fim▁end|> | def main():
"""Instantiate a DockerStats object and collect stats.""" |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>def main():
<|fim_middle|>
if __name__ == '__main__':
main()
<|fim▁end|> | """Instantiate a DockerStats object and collect stats."""
print('Docker Service Module') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>def main():
"""Instantiate a DockerStats object and collect stats."""
print('Docker Service Module')
if __name__ == '__main__':
<|fim_middle|>
<|fim▁end|> | main() |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>def <|fim_middle|>():
"""Instantiate a DockerStats object and collect stats."""
print('Docker Service Module')
if __name__ == '__main__':
main()
<|fim▁end|> | main |
<|file_name|>frontend-results.py<|end_file_name|><|fim▁begin|>@app.route('/job/<name>')
def results(name):
job = saliweb.frontend.get_completed_job(name,
flask.request.args.get('passwd'))
# Determine whether the job completed successfully<|fim▁hole|> template ... | if os.path.exists(job.get_path('output.pdb')): |
<|file_name|>frontend-results.py<|end_file_name|><|fim▁begin|>@app.route('/job/<name>')
def results(name):
<|fim_middle|>
<|fim▁end|> | job = saliweb.frontend.get_completed_job(name,
flask.request.args.get('passwd'))
# Determine whether the job completed successfully
if os.path.exists(job.get_path('output.pdb')):
template = 'results_ok.html'
else:
template = 'results_failed.ht... |
<|file_name|>frontend-results.py<|end_file_name|><|fim▁begin|>@app.route('/job/<name>')
def results(name):
job = saliweb.frontend.get_completed_job(name,
flask.request.args.get('passwd'))
# Determine whether the job completed successfully
if os.path.exists(job.ge... | template = 'results_ok.html' |
<|file_name|>frontend-results.py<|end_file_name|><|fim▁begin|>@app.route('/job/<name>')
def results(name):
job = saliweb.frontend.get_completed_job(name,
flask.request.args.get('passwd'))
# Determine whether the job completed successfully
if os.path.exists(job.ge... | template = 'results_failed.html' |
<|file_name|>frontend-results.py<|end_file_name|><|fim▁begin|>@app.route('/job/<name>')
def <|fim_middle|>(name):
job = saliweb.frontend.get_completed_job(name,
flask.request.args.get('passwd'))
# Determine whether the job completed successfully
if os.path.exists... | results |
<|file_name|>keys.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
__all__ = (
'Key',
'Keys',
)
class Key(object):
def __init__(self, name):
#: Descriptive way of writing keys in configuration files. e.g. <C-A>
#: for ``Control-A``.
self.name = name
de... | ControlA = Key('<C-A>')
ControlB = Key('<C-B>') |
<|file_name|>keys.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
__all__ = (
'Key',
'Keys',
)
class Key(object):
<|fim_middle|>
class Keys(object):
Escape = Key('<Escape>')
ControlA = Key('<C-A>')
ControlB = Key('<C-B>')
ControlC = Key('<C-C>')
ControlD = ... | def __init__(self, name):
#: Descriptive way of writing keys in configuration files. e.g. <C-A>
#: for ``Control-A``.
self.name = name
def __repr__(self):
return '%s(%r)' % (self.__class__.__name__, self.name) |
<|file_name|>keys.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
__all__ = (
'Key',
'Keys',
)
class Key(object):
def __init__(self, name):
#: Descriptive way of writing keys in configuration files. e.g. <C-A>
#: for ``Control-A``.
<|fim_middle|>
def... | self.name = name |
<|file_name|>keys.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
__all__ = (
'Key',
'Keys',
)
class Key(object):
def __init__(self, name):
#: Descriptive way of writing keys in configuration files. e.g. <C-A>
#: for ``Control-A``.
self.name = name
de... | return '%s(%r)' % (self.__class__.__name__, self.name) |
<|file_name|>keys.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
__all__ = (
'Key',
'Keys',
)
class Key(object):
def __init__(self, name):
#: Descriptive way of writing keys in configuration files. e.g. <C-A>
#: for ``Control-A``.
self.name = name
de... | Escape = Key('<Escape>')
ControlA = Key('<C-A>')
ControlB = Key('<C-B>')
ControlC = Key('<C-C>')
ControlD = Key('<C-D>')
ControlE = Key('<C-E>')
ControlF = Key('<C-F>')
ControlG = Key('<C-G>')
ControlH = Key('<C-H>')
ControlI = Key('<C-I>') # Tab
ControlJ = Key('<C-J>') # ... |
<|file_name|>keys.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
__all__ = (
'Key',
'Keys',
)
class Key(object):
def <|fim_middle|>(self, name):
#: Descriptive way of writing keys in configuration files. e.g. <C-A>
#: for ``Control-A``.
self.name = name
... | __init__ |
<|file_name|>keys.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
__all__ = (
'Key',
'Keys',
)
class Key(object):
def __init__(self, name):
#: Descriptive way of writing keys in configuration files. e.g. <C-A>
#: for ``Control-A``.
self.name = name
de... | __repr__ |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
<|fi... |
class ObjectPermissionsModelAdminMixin(object):
def has_change_permission(self, request, obj=None):
opts = self.opts |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
<|fim_middle|>
class ObjectPermissionsModelAdminMixin... | return '%s_%s' % (action, opts.object_name.lower()) |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | def has_change_permission(self, request, obj=None):
opts = self.opts
codename = get_permission_codename('change', opts)
return request.user.has_perm('%s.%s' % (opts.app_label, codename), obj)
def has_delete_permission(self, request, obj=None):
opts = self.opts
codename =... |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | opts = self.opts
codename = get_permission_codename('change', opts)
return request.user.has_perm('%s.%s' % (opts.app_label, codename), obj) |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | opts = self.opts
codename = get_permission_codename('delete', opts)
return request.user.has_perm('%s.%s' % (opts.app_label, codename), obj) |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | def has_change_permission(self, request, obj=None): # pragma: no cover
opts = self.opts
if opts.auto_created:
for field in opts.fields:
if field.rel and field.rel.to != self.parent_model:
opts = field.rel.to._meta
break
cod... |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | opts = self.opts
if opts.auto_created:
for field in opts.fields:
if field.rel and field.rel.to != self.parent_model:
opts = field.rel.to._meta
break
codename = get_permission_codename('change', opts)
return request.user.... |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | if self.opts.auto_created:
return self.has_change_permission(request, obj)
return super(ObjectPermissionsInlineModelAdminMixin, self).has_delete_permission(request, obj) |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | pass |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | pass |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | pass |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | for field in opts.fields:
if field.rel and field.rel.to != self.parent_model:
opts = field.rel.to._meta
break |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | opts = field.rel.to._meta
break |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | return self.has_change_permission(request, obj) |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def <|fim_middle|>(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
class Objec... | get_permission_codename |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | has_change_permission |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | has_delete_permission |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | has_change_permission |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
try:
from django.contrib.auth import get_permission_codename
except ImportError: # pragma: no cover
# Django < 1.6
def get_permission_codename(action, opts):
return '%s_%s' % (action, opts.object_name.lower())
cl... | has_delete_permission |
<|file_name|>hook-carchive.py<|end_file_name|><|fim▁begin|># Copyright (C) 2005, Giovanni Bajo
# Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published... | |
<|file_name|>hook-carchive.py<|end_file_name|><|fim▁begin|># Copyright (C) 2005, Giovanni Bajo
# Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published... | if sys.version[0] > '1':
for i in range(len(mod.imports)-1, -1, -1):
if mod.imports[i][0] == 'strop':
del mod.imports[i]
return mod |
<|file_name|>hook-carchive.py<|end_file_name|><|fim▁begin|># Copyright (C) 2005, Giovanni Bajo
# Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published... | for i in range(len(mod.imports)-1, -1, -1):
if mod.imports[i][0] == 'strop':
del mod.imports[i] |
<|file_name|>hook-carchive.py<|end_file_name|><|fim▁begin|># Copyright (C) 2005, Giovanni Bajo
# Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published... | del mod.imports[i] |
<|file_name|>hook-carchive.py<|end_file_name|><|fim▁begin|># Copyright (C) 2005, Giovanni Bajo
# Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published... | hook |
<|file_name|>keys.py<|end_file_name|><|fim▁begin|>Alchemy sentiment analysis: fb12d2c55fff36e1e268584e261b6b010b37279f
<|fim▁hole|>
Africa Is Talking: 676dbd926bbb04fa69ce90ee81d3f5ffee2692aaf80eb5793bd70fe93e77dc2e<|fim▁end|> | |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------<|fim▁hole|># Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces... | |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | def __init__(self):
pass
def fit(self,array,errarray,param,xmin=0,xmax=0, fitAxes=[]):
"""return the data that is needed for plotting the fitting result"""
"""0...a, 1...xc, 2...k, 3...y0"""
self.params = [Parameter(v) for v in param]
def f(x): return self.params[0... |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | pass |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | """return the data that is needed for plotting the fitting result"""
"""0...a, 1...xc, 2...k, 3...y0"""
self.params = [Parameter(v) for v in param]
def f(x): return self.params[0]()/(1+np.exp(-(x-self.params[1]())/self.params[2]()))+self.params[3]()
self.simpleFitAllAxe... |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | return self.params[0]()/(1+np.exp(-(x-self.params[1]())/self.params[2]()))+self.params[3]() |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | """find the best initial values and return them"""
dx = np.abs(data[0,0] - data[0,-1])
mi = np.amin(data[1,:])
ma = np.amax(data[1,:])
xc = (np.amax(data[0,:])-np.amin(data[0,:]))/2+np.amin(data[0,:])
return [ma-mi,xc,dx*2,mi] |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | """return the fit parameters"""
return np.array(["a","xc","dx","y0"]) |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | """return a string of the implemented fitting model, i.e. 'linear fit (y=A*x +B)'"""
return "Sigmoidal" |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | """return a special result, i.e. 'Frequency = blabla'"""
return "nothing fitted" |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | __init__ |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | fit |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | f |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | getInitialParameters |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | getParameters |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | getFitModelStr |
<|file_name|>pluginFitSigmoidal.py<|end_file_name|><|fim▁begin|>#--------------------------------------------------
# Revision = $Rev: 20 $
# Date = $Date: 2011-08-05 20:42:24 +0200 (Fri, 05 Aug 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import Plu... | getResultStr |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | self.logout()
self.assertFalse(csrf.token_is_valid(token)) |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | class TestHandler(csrf.CsrfHandler):
"""A handler for testing whether or not requests are CSRF protected."""
def get(self):
self.response.write('CSRF Token:%s' % self.csrf_token)
def post(self):
pass
def put(self):
pass
def delete(self)... |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | """A handler for testing whether or not requests are CSRF protected."""
def get(self):
self.response.write('CSRF Token:%s' % self.csrf_token)
def post(self):
pass
def put(self):
pass
def delete(self):
pass |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | self.response.write('CSRF Token:%s' % self.csrf_token) |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | pass |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | pass |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | pass |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | super(CsrfTests, self).setUp()
# The CSRF library uses the time, so we mock it out.
self.time_mock = mock.Mock()
csrf.time = self.time_mock
self.time_mock.time = mock.Mock(return_value=MOCKED_TIME)
# The handler tests need a WSGIApplication.
app = webapp2.WSGIAppl... |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | first_key = csrf._get_secret_key()
self.assertEqual(len(first_key), 32)
second_key = csrf._get_secret_key()
self.assertEqual(first_key, second_key) |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | self.assertFalse(csrf._tokens_are_equal('a', 'ab'))
# It should fail if the tokens are different.
self.assertFalse(csrf._tokens_are_equal('abcde', 'abcdf'))
# It should succeed if the tokens are the same.
self.assertTrue(csrf._tokens_are_equal('abcde', 'abcde')) |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | self.login()
# It should get the current time.
token1 = csrf.make_token()
self.assertEqual(token1.split()[-1], str(MOCKED_TIME))
# It should use the provided time.
token2 = csrf.make_token(token_time='456')
self.assertEqual(token2.split()[-1], '456')
# Dif... |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | token1 = csrf.make_token()
self.assertIsNone(token1)
self.login()
token2 = csrf.make_token()
self.assertIsNotNone(token2) |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | self.login()
# It should get the current path.
self.testbed.setup_env(PATH_INFO='/action/1', overwrite=True)
token1 = csrf.make_token(token_time='123')
self.testbed.setup_env(PATH_INFO='/action/23', overwrite=True)
token2 = csrf.make_token(token_time='123')
token3... |
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper."""
import unittest
import mock
import webapp2
import webtest
from ctc.helpers import csrf
from ctc.testing import testutil
MOCKED_TIME = 123
# Tests don't need docstrings, so pylint: disable=C0111
# Tests can test protected memb... | self.login()
# Token is required.
self.assertFalse(csrf.token_is_valid(None))
# Token needs to have a timestamp on it.
self.assertFalse(csrf.token_is_valid('hello'))
# The timestamp needs to be within the current date range.
self.time_mock.time = mock.Mock(return_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.