prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>session_recording.py<|end_file_name|><|fim▁begin|># Source Generated with Decompyle++ # File: session_recording.pyc (Python 2.5) from __future__ import absolute_import from pushbase.session_recording_component import FixedLengthSessionRecordingComponent class SessionRecordingComponent(FixedLengthSessionR...
_on_record_button_pressed
<|file_name|>session_recording.py<|end_file_name|><|fim▁begin|># Source Generated with Decompyle++ # File: session_recording.pyc (Python 2.5) from __future__ import absolute_import from pushbase.session_recording_component import FixedLengthSessionRecordingComponent class SessionRecordingComponent(FixedLengthSessionR...
_on_record_button_released
<|file_name|>runtests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ This script is used to run tests, create a coverage report and output the statistics at the end of the tox run. To run this script just execute ``tox`` """ import re from fabric.api import local, warn from fabric.colors import green, red ...
total_line = local('grep -n pc_cov coverage/index.html', capture=True) percentage = float(re.findall(r'(\d+)%', total_line)[-1]) if percentage < 100:
<|file_name|>runtests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ This script is used to run tests, create a coverage report and output the statistics at the end of the tox run. To run this script just execute ``tox`` """ import re from fabric.api import local, warn from fabric.colors import green, red ...
deprecated_files = '*utils_email*,*utils_log*' local('flake8 --ignore=E126 --ignore=W391 --statistics' ' --exclude=submodules,migrations,build .') local('coverage run --source="django_libs" manage.py test -v 2' ' --traceback --failfast --settings=django_libs.tests.settings' ' ...
<|file_name|>runtests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ This script is used to run tests, create a coverage report and output the statistics at the end of the tox run. To run this script just execute ``tox`` """ import re from fabric.api import local, warn from fabric.colors import green, red ...
warn(red('Coverage is {0}%'.format(percentage)))
<|file_name|>runtests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ This script is used to run tests, create a coverage report and output the statistics at the end of the tox run. To run this script just execute ``tox`` """ import re from fabric.api import local, warn from fabric.colors import green, red ...
print(green('Coverage is {0}%'.format(percentage)))
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
'oauth_token_secret': 'KO7YIFMKWKaYTtz2zEyaSy044ixj5kIbWrDtZZL96ly0H'} # Common colors
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
global g_terms global g_scope # Create fonts font_mode = pygame.font.Font(None, 68) font_title_1 = pygame.font.Font(None, 68) font_title_2 = pygame.font.Font(None, 68) font_instr_1 = pygame.font.Font(None, 36) font_instr_2 = pygame.font.Font(None, 36) font_ent_title = pygame.font.Fo...
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
global g_terms for term in g_terms: if ''.join(['#', entry]) == term: return True return False
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
global g_bet_loop global g_scope global g_terms # Setup Twitter streamer tf = twit_feed.TwitFeed(AUTH) #tf = tf_test_02.TwitFeed(AUTH) # Tweet that we are accepting bets # Start streamer to search for terms tf.start_track_streamer(BET_TERM) # Setup display pygame.init() ...
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
ent_str = ''.join([ent_str, g_terms[i]])
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
return True
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
g_bet_loop = False
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
if event.key == pygame.K_q or event.key == pygame.K_ESCAPE: g_bet_loop = False
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
g_bet_loop = False
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
g_terms.append(''.join(['#', entry])) print len(g_terms) if len(g_terms) >= MAX_ENTRIES: print 'breaking' g_bet_loop = False
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
print 'breaking' g_bet_loop = False
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
draw_starting_screen
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
is_in_terms
<|file_name|>wager_test_01.py<|end_file_name|><|fim▁begin|>import os import sys import pygame import signal import time import ConfigParser from twython import TwythonStreamer #----------------------------------------------------------------------------- # Import custom modules #---------------------------------------...
main
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): <|fim_middle|> <|f...
def __init__(self,viewer, parent): super(FeatureSelectionDialog, self).__init__(parent) self.resize(800,600) self.viewer = viewer self.layout = QtGui.QVBoxLayout() self.setLayout(self.layout) self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok|...
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
super(FeatureSelectionDialog, self).__init__(parent) self.resize(800,600) self.viewer = viewer self.layout = QtGui.QVBoxLayout() self.setLayout(self.layout) self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok|QtGui.QDialogButtonBox.Cancel) ...
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
return { 'name': name, 'type': 'bool', 'value': val, #'tip': "This is a checkbox", }
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
print("tree changes:") for param, change, data in changes: path = self.p.childPath(param) if path is not None: childName = '.'.join(path) else: childName = param.name() print(' parameter: %s'...
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
self.hide() self.viewer.onClickedComputeFeaturesImpl(self.p)
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
if event.key() == QtCore.Qt.Key_Escape: self.hide() event.accept() else: super(QtGui.QDialog, self).keyPressEvent(event)
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
childName = '.'.join(path)
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
childName = param.name()
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
self.hide() event.accept()
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
super(QtGui.QDialog, self).keyPressEvent(event)
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def <|fim_middle|>(...
__init__
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
makeCheckBox
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
change
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
onPressAccepted
<|file_name|>bv_feature_selection.py<|end_file_name|><|fim▁begin|>import pyqtgraph as pg from pyqtgraph.Qt import QtGui, QtCore import numpy# from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType class FeatureSelectionDialog(QtGui.QDialog): def __init__(self,v...
keyPressEvent
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from django.contrib.gis.geoip2 import GeoIP2 from geoip2.errors import GeoIP2Error from ipware import get_client_ip def get_location_from_ip(request): client_ip, is_routable = get_client_ip(request) if client_ip is not None: g = GeoIP2() try:...
city = record.get('city') or '' country = record.get('country') or ''
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from django.contrib.gis.geoip2 import GeoIP2 from geoip2.errors import GeoIP2Error from ipware import get_client_ip def get_location_from_ip(request): <|fim_middle|> <|fim▁end|>
client_ip, is_routable = get_client_ip(request) if client_ip is not None: g = GeoIP2() try: record = g.city(client_ip) except GeoIP2Error: return None if record: city = record.get('city') or '' country = record.get('country') or '' ...
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from django.contrib.gis.geoip2 import GeoIP2 from geoip2.errors import GeoIP2Error from ipware import get_client_ip def get_location_from_ip(request): client_ip, is_routable = get_client_ip(request) if client_ip is not None: <|fim_middle|> ...
g = GeoIP2() try: record = g.city(client_ip) except GeoIP2Error: return None if record: city = record.get('city') or '' country = record.get('country') or '' delimeter = ', ' if city and country else '' return f'{cit...
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from django.contrib.gis.geoip2 import GeoIP2 from geoip2.errors import GeoIP2Error from ipware import get_client_ip def get_location_from_ip(request): client_ip, is_routable = get_client_ip(request) if client_ip is not None: g = GeoIP2() try:...
city = record.get('city') or '' country = record.get('country') or '' delimeter = ', ' if city and country else '' return f'{city}{delimeter}{country}'
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from django.contrib.gis.geoip2 import GeoIP2 from geoip2.errors import GeoIP2Error from ipware import get_client_ip def <|fim_middle|>(request): client_ip, is_routable = get_client_ip(request) if client_ip is not None: g = GeoIP2() try: ...
get_location_from_ip
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
def _on_synaptic_exit(self, pid, condition, (tempf, deferred)): if tempf: tempf.close()
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
"""Make use of Synaptic to install and remove packages.""" def _run_synaptic(self, xid, opt, tempf, interaction): deferred = Deferred() if tempf: opt.extend(["--set-selections-file", "%s" % tempf.name]) #FIXME: Take interaction into account opt.extend(["-o", "Synapti...
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
deferred = Deferred() if tempf: opt.extend(["--set-selections-file", "%s" % tempf.name]) #FIXME: Take interaction into account opt.extend(["-o", "Synaptic::closeZvt=true"]) if xid: opt.extend(["--parent-window-id", "%s" % (xid)]) cmd = ["/usr/bin/g...
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
if tempf: tempf.close() if condition == 0: deferred.callback() else: deferred.errback(sessioninstaller.errors.ModifyFailed())
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
opt = [] # custom progress strings #opt.append("--progress-str") #opt.append("%s" % _("Please wait, this can take some time.")) #opt.append("--finish-str") #opt.append("%s" % _("Update is complete")) tempf = tempfile.NamedTemporaryFile() for pkg_name in p...
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
opt = [] # custom progress strings #opt.append("--progress-str") #opt.append("%s" % _("Please wait, this can take some time.")) #opt.append("--finish-str") #opt.append("%s" % _("Update is complete")) tempf = tempfile.NamedTemporaryFile() for pkg_name in p...
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
raise NotImplemented
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
opt.extend(["--set-selections-file", "%s" % tempf.name])
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
opt.extend(["--parent-window-id", "%s" % (xid)])
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
tempf.close()
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
deferred.callback()
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
deferred.errback(sessioninstaller.errors.ModifyFailed())
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
_run_synaptic
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
_on_synaptic_exit
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
remove_packages
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
install_packages
<|file_name|>synaptic.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- """Make use of synaptic as backend.""" # Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de> # Copyright (C) 2005-2007 Canonical # # Licensed under the GNU General Public License Version 2 # # This program is f...
install_package_files
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
# we can use the Allars label too
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
concept = {'uri': row['c']['value'], 'pref': row['pref']['value'], 'ysapref': row['ysapref']['value'], 'allarspref': row['allarspref']['value']} if 'alts' in row: concept['alts'] = row['alts']['value'] return concept
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
sparql = SPARQLWrapper(FINTO_ENDPOINT) sparql.setQuery(""" PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX ysometa: <http://www.yso.fi/onto/yso-meta/> SELECT ?c ?pref (GROUP_CONCAT(?alt) AS ?alts) ?ysapref ?allarspref WHERE { GRAPH <http://www.yso.fi/on...
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
r = requests.get(FINNA_API_SEARCH, params=params, headers={'User-agent': 'annif 0.1'}) return r.json()
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
texts = [] for rec in records: if 'title' in rec: texts.append(rec['title']) if 'summary' in rec: for summary in rec['summary']: texts.append(summary) return texts
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
labels = [concept['pref']] if lang == 'fi': # we can use the YSA label too labels.append(concept['ysapref']) if lang == 'sv': # we can use the Allars label too labels.append(concept['allarspref']) if 'alts' in concept: labels.append(concept['alts']) label...
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
concept['alts'] = row['alts']['value']
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
texts.append(rec['title'])
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
for summary in rec['summary']: texts.append(summary)
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
labels.append(concept['ysapref'])
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
labels.append(concept['allarspref'])
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
labels.append(concept['alts'])
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
texts += records_to_texts(response['records'])
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
texts += records_to_texts(response['records'])
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
texts += records_to_texts(response['records'])
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
continue
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
print("Failed looking up concept %s, exiting" % concept['uri']) sys.exit(1)
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
row_to_concept
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
get_concepts
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
search_finna
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
records_to_texts
<|file_name|>create_corpus_yso_finna.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from SPARQLWrapper import SPARQLWrapper, JSON import requests import re import os import os.path import time import sys FINTO_ENDPOINT='http://api.dev.finto.fi/sparql' FINNA_API_SEARCH='https://api.finna.fi/v1/search' lang = ...
generate_text
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
def setUp(self): registry._reset() def testT2TModelRegistration(self): @registry.register_model class MyModel1(t2t_model.T2TModel): pass model = registry.model("my_model1") self.assertTrue(model is MyModel1) def testNamedRegistration(self): @registry.register_model("model2") ...
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
registry._reset()
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
@registry.register_model class MyModel1(t2t_model.T2TModel): pass model = registry.model("my_model1") self.assertTrue(model is MyModel1)
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
pass
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
@registry.register_model("model2") class MyModel1(t2t_model.T2TModel): pass model = registry.model("model2") self.assertTrue(model is MyModel1)
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
pass
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
@registry.register_model def model_fn(): pass model = registry.model("model_fn") self.assertTrue(model is model_fn)
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
pass
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
with self.assertRaisesRegexp(LookupError, "never registered"): registry.model("not_registered")
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
@registry.register_model def m1(): pass with self.assertRaisesRegexp(LookupError, "already registered"): @registry.register_model("m1") def m2(): pass
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
pass
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
pass
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
@registry.register_model def m1(): pass @registry.register_model def m2(): pass self.assertSetEqual(set(["m1", "m2"]), set(registry.list_models()))
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
pass
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
pass
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
convert = registry._convert_camel_to_snake self.assertEqual("typical_camel_case", convert("TypicalCamelCase")) self.assertEqual("numbers_fuse2gether", convert("NumbersFuse2gether")) self.assertEqual("numbers_fuse2_gether", convert("NumbersFuse2Gether")) self.assertEqual("lstm_seq2_seq", convert("LS...
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
def setUp(self): registry._reset() def testHParamSet(self): @registry.register_hparams def my_hparams_set(): pass @registry.register_ranged_hparams def my_hparams_range(_): pass self.assertTrue(registry.hparams("my_hparams_set") is my_hparams_set) self.assertTrue( ...
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
registry._reset()
<|file_name|>registry_test.py<|end_file_name|><|fim▁begin|># coding=utf-8 # Copyright 2017 The DLT2T Authors. # # 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 # # http://www.apache.org/lic...
@registry.register_hparams def my_hparams_set(): pass @registry.register_ranged_hparams def my_hparams_range(_): pass self.assertTrue(registry.hparams("my_hparams_set") is my_hparams_set) self.assertTrue( registry.ranged_hparams("my_hparams_range") is my_hparams_range)