prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>generate.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
"""Download GTFS file and generate JSON file.
Author: Panu Ranta, panu.ranta@iki.fi, https://14142.net/kartalla/about.html
"""
import argparse
import datetime
import hashlib
import json
import logging
import os
import resource
import shutil... | _generate_json |
<|file_name|>generate.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
"""Download GTFS file and generate JSON file.
Author: Panu Ranta, panu.ranta@iki.fi, https://14142.net/kartalla/about.html
"""
import argparse
import datetime
import hashlib
import json
import logging
import os
import resource
import shutil... | _create_base_output_file |
<|file_name|>generate.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
"""Download GTFS file and generate JSON file.
Author: Panu Ranta, panu.ranta@iki.fi, https://14142.net/kartalla/about.html
"""
import argparse
import datetime
import hashlib
import json
import logging
import os
import resource
import shutil... | _rename_existing_file |
<|file_name|>generate.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
"""Download GTFS file and generate JSON file.
Author: Panu Ranta, panu.ranta@iki.fi, https://14142.net/kartalla/about.html
"""
import argparse
import datetime
import hashlib
import json
import logging
import os
import resource
import shutil... | _get_now_timestamp |
<|file_name|>scrollbar_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2014, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, t... | top.add_style("right: 0px")
top.add_color("background", "background") |
<|file_name|>scrollbar_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2014, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, t... | def get_display(my):
top = my.top
top.add_style("width: 600px")
top.add_style("height: 400px")
return top |
<|file_name|>scrollbar_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2014, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, t... | top = my.top
top.add_style("width: 600px")
top.add_style("height: 400px")
return top |
<|file_name|>scrollbar_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2014, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, t... | def get_display(my):
top = my.top
top.add_class("spt_scrollbar_top")
content = my.kwargs.get("content")
content_class = my.kwargs.get("content_class")
if not content_class:
content_class = "spt_content"
width = 8
top.add_style("width: %s" % wi... |
<|file_name|>scrollbar_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2014, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, t... | top = my.top
top.add_class("spt_scrollbar_top")
content = my.kwargs.get("content")
content_class = my.kwargs.get("content_class")
if not content_class:
content_class = "spt_content"
width = 8
top.add_style("width: %s" % width)
top.add_style... |
<|file_name|>scrollbar_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2014, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, t... | return r'''
spt.scrollbar = {};
spt.scrollbar.mouse_start_y = null;
spt.scrollbar.el_start_y = null;
spt.scrollbar.top = null;
spt.scrollbar.content = null;
spt.scrollbar.drag_setup = function(evt, bvr, mouse_411) {
spt.scrollbar.mouse_start_y = mouse_411.curr_y;
var src_el = spt.behavior.get_bvr_src... |
<|file_name|>scrollbar_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2014, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, t... | content_class = "spt_content" |
<|file_name|>scrollbar_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2014, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, t... | get_display |
<|file_name|>scrollbar_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2014, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, t... | get_display |
<|file_name|>scrollbar_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2014, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, t... | get_onload_js |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request... | def get_headers(request): |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
<|fim_middle|>
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return reques... | return request |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
<|fim_middle|>
def get_form(request):
return request.form
def get_body(request):
return request.dat... | return request.args |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
<|fim_middle|>
def get_body(request):
return request.dat... | return request.form |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
<|fim_middle|>... | return request.data |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request... | return request.headers |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request... | return request.cookies |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request... | return request.method |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request... | content_type = headers.get('Content-Type')
if content_type != 'application/json':
return
data = body.decode('utf8')
try:
return json.loads(data)
except ValueError:
raise BadJSON |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request... | return |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def <|fim_middle|>(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return requ... | get_request |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def <|fim_middle|>(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return re... | get_query |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def <|fim_middle|>(request):
return request.form
def get_body(request):
return r... | get_form |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def <|fim_middle|>(request):
return r... | get_body |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request... | get_headers |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request... | get_cookies |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request... | get_method |
<|file_name|>default_exts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request... | get_json |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... |
finally:
return ide_asset
|
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
<|fim_middle|>
def handle_release_assets(assets):
assets = [ asset for asset in assets if re.match(r'redhawk-ide.+?(?=... | asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
if os.path.exists(asset_path):
# Skip downloading
asset_path = None
else:
if not os.path.exists(path):
os.makedirs(path)
... |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | assets = [ asset for asset in assets if re.match(r'redhawk-ide.+?(?=x86_64)', asset['name'])]
if not assets:
sys.exit('Failed to find the IDE asset')
elif len(assets) > 1:
sys.exit('Found too many IDE assets matching that description...?')
return download_asset('downloads', assets[0]['br... |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | RELEASES_URL = 'http://api.github.com/repos/RedhawkSDR/redhawk/releases'
ide_asset = ''
try:
releases = json.loads(urllib2.urlopen(RELEASES_URL).read())
releases = [r for r in releases if r['tag_name'] == pv]
if releases:
ide_asset = handle_release_assets(releases[0]['ass... |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | asset_path = None |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | if not os.path.exists(path):
os.makedirs(path)
f = urllib2.urlopen(url)
with open(asset_path, "wb") as local_file:
local_file.write(f.read()) |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | os.makedirs(path) |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | sys.exit('Failed to find the IDE asset') |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | sys.exit('Found too many IDE assets matching that description...?') |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | ide_asset = handle_release_assets(releases[0]['assets']) |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | sys.exit('Failed to find the release: {0}'.format(pv)) |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | asset = run(sys.argv[1])
print asset |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def <|fim_middle|>(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | download_asset |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | handle_release_assets |
<|file_name|>ide-fetcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
... | run |
<|file_name|>key_loader.py<|end_file_name|><|fim▁begin|>def load_keys(filepath):
"""
Loads the Twitter API keys into a dict.
:param filepath: file path to config file with Twitter API keys.
:return: keys_dict
:raise: IOError<|fim▁hole|> keys = {}
for line in keys_file:
key... | """
try:
keys_file = open(filepath, 'rb') |
<|file_name|>key_loader.py<|end_file_name|><|fim▁begin|>def load_keys(filepath):
<|fim_middle|>
<|fim▁end|> | """
Loads the Twitter API keys into a dict.
:param filepath: file path to config file with Twitter API keys.
:return: keys_dict
:raise: IOError
"""
try:
keys_file = open(filepath, 'rb')
keys = {}
for line in keys_file:
key, value = line.split('=')
... |
<|file_name|>key_loader.py<|end_file_name|><|fim▁begin|>def <|fim_middle|>(filepath):
"""
Loads the Twitter API keys into a dict.
:param filepath: file path to config file with Twitter API keys.
:return: keys_dict
:raise: IOError
"""
try:
keys_file = open(filepath, 'rb')
keys... | load_keys |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
<|fim_middle|>
<|fim▁end|> | def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__,
'''\
Parameter(value, output=False)
Explicitly define a parameter for :py:meth:`.callproc`,
:py:meth:`.execute`, or :py:meth:`.executemany`. This is necessary
to indicate whether a parameter is *SQL* `OUTPUT` or `INPU... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
<|fim_middle|>
def test_parameter(self):
... | self.assertEqual(
ctds.Parameter.__doc__,
'''\
Parameter(value, output=False)
Explicitly define a parameter for :py:meth:`.callproc`,
:py:meth:`.execute`, or :py:meth:`.executemany`. This is necessary
to indicate whether a parameter is *SQL* `OUTPUT` or `INPUT/OUTPUT`
parameter.
:param... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | param1 = ctds.Parameter(b'123', output=True)
self.assertEqual(param1.value, b'123')
self.assertTrue(isinstance(param1, ctds.Parameter))
param2 = ctds.Parameter(b'123')
self.assertEqual(param1.value, b'123')
self.assertEqual(type(param1), type(param2))
self.assert... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | for parameter, expected in (
(
ctds.Parameter(b'123', output=True),
"ctds.Parameter(b'123', output=True)" if PY3 else "ctds.Parameter('123', output=True)"
),
(
ctds.Parameter(unicode_('123'), output=False... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | cases = (
(ctds.Parameter(b'1234'), ctds.Parameter(b'123')),
(ctds.Parameter(b'123'), ctds.Parameter(b'123')),
(ctds.Parameter(b'123'), ctds.Parameter(b'123', output=True)),
(ctds.Parameter(b'123'), ctds.Parameter(b'1234')),
(ctds.Parameter(b'123'), b'... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | self._test__cmp__(
lambda left, right: left == right,
(
False,
True,
True,
False,
True,
False,
not PY3,
False,
False,
False,
... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | self._test__cmp__(
lambda left, right: left != right,
(
True,
False,
False,
True,
False,
True,
PY3,
True,
True,
True,
... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | self._test__cmp__(
lambda left, right: left < right,
(
False,
False,
False,
True,
False,
TypeError if PY3 else False,
TypeError if PY3 else False,
TypeError if ... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | self._test__cmp__(
lambda left, right: left <= right,
(
False,
True,
True,
True,
True,
TypeError if PY3 else False,
TypeError if PY3 else True,
TypeError if PY3... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | self._test__cmp__(
lambda left, right: left > right,
(
True,
False,
False,
False,
False,
TypeError if PY3 else True,
TypeError if PY3 else False,
TypeError if P... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | self._test__cmp__(
lambda left, right: left >= right,
(
True,
True,
True,
False,
True,
TypeError if PY3 else True,
TypeError if PY3 else True,
TypeError if PY3 ... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | for case in (None, object(), 123, 'foobar'):
self.assertRaises(TypeError, ctds.Parameter, case, b'123')
self.assertRaises(TypeError, ctds.Parameter)
self.assertRaises(TypeError, ctds.Parameter, output=False)
for case in (None, object(), 123, 'foobar'):
self.asse... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | with self.connect() as connection:
with connection.cursor() as cursor:
for value in (
None,
123456,
unicode_('hello world'),
b'some bytes',
):
for outpu... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | try:
__cmp__(*args)
except TypeError as ex:
regex = (
r"'{0}' not supported between instances of '[^']+' and '[^']+'".format(oper)
if not PY3 or PY36
else
... |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | self.fail('{0} did not fail as expected'.format(operation)) # pragma: nocover |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | self.assertEqual(__cmp__(*args), expected[index], operation) |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def <|fim_middle|>(self):
self.assertEqual(
ctds.Parameter.__doc... | test___doc__ |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | test_parameter |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | test___repr__ |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | _test__cmp__ |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | test___cmp__eq |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | test___cmp__ne |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | test___cmp__lt |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | test___cmp__le |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | test___cmp__gt |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | test___cmp__ge |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | test_typeerror |
<|file_name|>test_tds_parameter.py<|end_file_name|><|fim▁begin|>import re
import warnings
import ctds
from .base import TestExternalDatabase
from .compat import PY3, PY36, unicode_
class TestTdsParameter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Parameter.__doc__... | test_reuse |
<|file_name|>run_tests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
import sys
import os
sys.path.append(os.path.realpath("."))
import unittest
import cleanstream
import tagger
import pretransfer
import transfer
import interchunk
import postchunk
import adaptdocx
if __name__ == "__main__":
os.chdir(os... | transfer, |
<|file_name|>run_tests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
import sys
import os
sys.path.append(os.path.realpath("."))
import unittest
import cleanstream
import tagger
import pretransfer
import transfer
import interchunk
import postchunk
import adaptdocx
if __name__ == "__main__":
<|fim_m... | os.chdir(os.path.dirname(__file__))
failures = 0
for module in [tagger,
pretransfer,
transfer,
interchunk,
postchunk,
adaptdocx,
cleanstream]:
suite = unittest.TestLoader().loadTestsFrom... |
<|file_name|>run_tests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
import sys
import os
sys.path.append(os.path.realpath("."))
import unittest
import cleanstream
import tagger
import pretransfer
import transfer
import interchunk
import postchunk
import adaptdocx
if __name__ == "__main__":
os.chdir(os... | failures += 1 |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | from spectrumwars.testbed import TestbedBase, RadioBase, RadioTimeout, RadioError, TestbedError, RadioPacket
log = logging.getLogger(__name__) |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | RECEIVE_TIMEOUT = 2.
def __init__(self, addr, dispatcher, send_delay):
super(Radio, self).__init__()
self.addr = addr
self.neighbor = None
self.dispatcher = dispatcher
self.q = Queue.Queue()
self.frequency = 0
self.bandwidth = 0
self.send_delay = send_delay
def _recv(self, addr, bindata, frequen... |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | super(Radio, self).__init__()
self.addr = addr
self.neighbor = None
self.dispatcher = dispatcher
self.q = Queue.Queue()
self.frequency = 0
self.bandwidth = 0
self.send_delay = send_delay |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | if self.frequency == frequency and self.bandwidth == bandwidth and self.addr == addr:
self.q.put(bindata) |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | self.frequency = frequency
self.bandwidth = bandwidth |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | self.dispatcher(self.neighbor, bindata, self.frequency, self.bandwidth)
time.sleep(self.send_delay) |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | if timeout is None:
timeout = self.RECEIVE_TIMEOUT
try:
bindata = self.q.get(True, timeout)
except Queue.Empty:
raise RadioTimeout
else:
return bindata |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | RADIO_CLASS = Radio
def __init__(self, send_delay=.1, frequency_range=64, bandwidth_range=10, power_range=10, packet_size=1024):
self.send_delay = float(send_delay)
self.frequency_range = int(frequency_range)
self.bandwidth_range = int(bandwidth_range)
self.power_range = int(power_range)
self.RADIO_CLASS.... |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | self.send_delay = float(send_delay)
self.frequency_range = int(frequency_range)
self.bandwidth_range = int(bandwidth_range)
self.power_range = int(power_range)
self.RADIO_CLASS.PACKET_SIZE = int(packet_size) + 1
self.radios = []
# for each channel, we keep the timestamp of the last
# transmission. we... |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | r = Radio(self.i, self._dispatcher, self.send_delay)
self.radios.append(r)
self.i += 1
return r |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | now = self.time()
has_collision = (now - self.channels[frequency]) > self.send_delay
self.channels[frequency] = now
if has_collision:
# note that when packets collide, the first one goes
# through while the later ones fail. this is different
# than in reality: all should fail. But this would
# be ... |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | dst = self._get_radio()
src = self._get_radio()
dst.neighbor = src.addr
src.neighbor = dst.addr
return dst, src |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | spectrum = []
now = self.time()
for time in self.channels:
if now - time < .5:
p = random.randint(-40, -20)
else:
p = random.randint(-90, -80)
spectrum.append(p)
return tuple(spectrum) |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | return self.frequency_range |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | return self.bandwidth_range |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | return self.power_range |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | self.q.put(bindata) |
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, tomaz.solc@ijs.si
#
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
... | timeout = self.RECEIVE_TIMEOUT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.