prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | return [(key, self[key]) for key in self] |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, list(self.items())) |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | return self.__class__(self) |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | d = cls()
for key in iterable:
d[key] = value
return d |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | if isinstance(other, OrderedDict):
return all(p==q for p, q in _zip_longest(self.items(), other.items()))
return dict.__eq__(self, other) |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | raise TypeError('expected at most 1 arguments, got %d' % len(args)) |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | self._keys = [] |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | self._keys.append(key) |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | raise KeyError('dictionary is empty') |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | for key in other.keys():
self[key] = other[key] |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | for key, value in other:
self[key] = value |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | raise |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | del self[key]
return value |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | return '%s()' % (self.__class__.__name__,) |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | return all(p==q for p, q in _zip_longest(self.items(), other.items())) |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | _zip_longest |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | sentinel |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | __init__ |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | clear |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | __setitem__ |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | __delitem__ |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | __iter__ |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | __reversed__ |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | popitem |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | __reduce__ |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | setdefault |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | update |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | pop |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | keys |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | values |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | items |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | __repr__ |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | copy |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | fromkeys |
<|file_name|>ordereddict.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
... | __eq__ |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | self.assertEqual(s.get('x.y'), [])
def test_nonexistent_key(self):
s = config.Record() |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | ef setUp(self):
pass
def test_init_with_args(self):
a = config.Record({'foo': 1, 'bar': 'x'})
self.assertEqual(a.get('foo'), 1)
b = config.Record()
b.set('foo', 1)
b.set('bar', 'x')
self.assertEqual(a, b)
def test_setget(self):
s = config.R... |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | ass
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | = config.Record({'foo': 1, 'bar': 'x'})
self.assertEqual(a.get('foo'), 1)
b = config.Record()
b.set('foo', 1)
b.set('bar', 'x')
self.assertEqual(a, b)
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | = config.Record()
s.set('foo', 1)
s.set('bar', 'x')
s.set('x.y', [])
self.assertEqual(s.get('foo'), 1)
self.assertEqual(s.get('bar'), 'x')
self.assertEqual(s.get('x.y'), [])
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | = config.Record()
with self.assertRaises(KeyError):
s.get('foo')
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | = config.Record()
s.set('foo', 1)
s.set('foo.bar', 2)
s.delete('foo')
with self.assertRaises(KeyError):
s.get('foo.bar')
with self.assertRaises(KeyError):
s.get('foo')
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | ata = {
'foo': 1,
'x.y': 'z',
'dict': {'a': 'b'}
}
a = config.Record(**data.copy())
b = config.Record(**data.copy())
self.assertEqual(a, b)
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | = config.Record({
'foo': 1,
'bar.x': 'x',
'bar.y': 'y',
})
y = config.Record({
'x': 'x',
'y': 'y',
})
self.assertEqual(x.sub('bar'), y)
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | = config.Record({
'foo': 1,
'bar.x': 'x',
'bar.y': 'y',
})
self.assertEqual(set(x.children('bar')), set(['x', 'y']))
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | ef test_getset(self):
x = config.RecordAttr({'foo': 1, 'bar': 'x', 'a.b': 2})
self.assertEqual(x.foo, 1)
self.assertEqual(x.a.b, 2)
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | = config.RecordAttr({'foo': 1, 'bar': 'x', 'a.b': 2})
self.assertEqual(x.foo, 1)
self.assertEqual(x.a.b, 2)
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | nittest.main()
|
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | etUp( |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | est_init_with_args( |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | est_setget( |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | est_nonexistent_key( |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | est_delete( |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | est_eq( |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | est_sub( |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | est_children( |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2015 Luis López <luis@cuarentaydos.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either vers... | est_getset( |
<|file_name|>fractions.py<|end_file_name|><|fim▁begin|># Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles backports of the standard library's `fractions.py`.
<|fim▁hole|>This functionality is required by the FITS unit format generator,
since the FITS unit format handles only rational, not decim... | The fractions module in 2.6 does not handle being instantiated using a
float and then calculating an approximate fraction based on that. |
<|file_name|>fractions.py<|end_file_name|><|fim▁begin|># Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles backports of the standard library's `fractions.py`.
The fractions module in 2.6 does not handle being instantiated using a
float and then calculating an approximate fraction based on that.... | from ._fractions_py2 import * |
<|file_name|>fractions.py<|end_file_name|><|fim▁begin|># Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles backports of the standard library's `fractions.py`.
The fractions module in 2.6 does not handle being instantiated using a
float and then calculating an approximate fraction based on that.... | from fractions import * |
<|file_name|>basic_effect.py<|end_file_name|><|fim▁begin|>from razer.client import DeviceManager
from razer.client import constants as razer_constants
# Create a DeviceManager. This is used to get specific devices<|fim▁hole|>device_manager = DeviceManager()
print("Found {} Razer devices".format(len(device_manager.de... | |
<|file_name|>get_data.py<|end_file_name|><|fim▁begin|>from pymacy.db import get_db
from bson.json_util import dumps
db = get_db()
results = []
count = 0<|fim▁hole|> if count > 100:
break
results.append(i)
print(results[0])
with open("Ni.json", 'w') as f:
file = dumps(results)
f.write(file)<|fim... | for i in db.benchmark.find({"element": "Ni"}):
count += 1 |
<|file_name|>get_data.py<|end_file_name|><|fim▁begin|>from pymacy.db import get_db
from bson.json_util import dumps
db = get_db()
results = []
count = 0
for i in db.benchmark.find({"element": "Ni"}):
count += 1
if count > 100:
<|fim_middle|>
results.append(i)
print(results[0])
with open("... | break |
<|file_name|>0003_auto_20150326_1435.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):<|fim▁hole|> dependencies = [
('api', '0002_auto_20150326_1433'),
]
operations = [
... | |
<|file_name|>0003_auto_20150326_1435.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
<|fim_middle|>
<|fim▁end|> | dependencies = [
('api', '0002_auto_20150326_1433'),
]
operations = [
migrations.RemoveField(
model_name='problem',
name='id',
),
migrations.AlterField(
model_name='problem',
name='problemId',
field=models.IntegerFi... |
<|file_name|>string_repalce_by_resub.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
from re import sub
from itertools import islice
<|fim▁hole|>如何调整字符串的文本格式
'''
# 将日志文件中的日期格式转变为美国日期格式mm/dd/yyyy
# 使用正则表达式模块中的sub函数进行替换字符串
with open("./log.log","r") as f:
for line in islice(f,0,None):
#print sub("(\d{... | ''' |
<|file_name|>image-patches-differential-rotation-scale.py<|end_file_name|><|fim▁begin|># Image Patches Differential Optical Flow Rotation/Scale
#
# This example shows off using your OpenMV Cam to measure
# rotation/scale by comparing the current and the previous
# image against each other. Note that only rotation/scale... | #
# NOTE that surfaces need to have some type of "edge" on them for the |
<|file_name|>image-patches-differential-rotation-scale.py<|end_file_name|><|fim▁begin|># Image Patches Differential Optical Flow Rotation/Scale
#
# This example shows off using your OpenMV Cam to measure
# rotation/scale by comparing the current and the previous
# image against each other. Note that only rotation/scale... | rotation_change = displacement.rotation()
zoom_amount = 1.0 + displacement.scale()
pixel_x = x + (BLOCK_W//2) + int(math.sin(rotation_change) * zoom_amount * (BLOCK_W//4))
pixel_y = y + (BLOCK_H//2) + int(math.cos(rotation_change) * zoom_amount * (BLOCK_H/... |
<|file_name|>image-patches-differential-rotation-scale.py<|end_file_name|><|fim▁begin|># Image Patches Differential Optical Flow Rotation/Scale
#
# This example shows off using your OpenMV Cam to measure
# rotation/scale by comparing the current and the previous
# image against each other. Note that only rotation/scale... | img.draw_line((x + BLOCK_W//2, y + BLOCK_H//2, x + BLOCK_W//2, y + BLOCK_H//2), \
color = 0) |
<|file_name|>test_cloud_memorystore_system.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | |
<|file_name|>test_cloud_memorystore_system.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | """
System tests for Google Cloud Memorystore operators
It use a real service.
"""
@provide_gcp_context(GCP_MEMORYSTORE)
def setUp(self):
super().setUp()
self.create_gcs_bucket(GCP_BUCKET_NAME, location="europe-north1")
@provide_gcp_context(GCP_MEMORYSTORE)
def test_ru... |
<|file_name|>test_cloud_memorystore_system.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | super().setUp()
self.create_gcs_bucket(GCP_BUCKET_NAME, location="europe-north1") |
<|file_name|>test_cloud_memorystore_system.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | self.run_dag('gcp_cloud_memorystore_redis', CLOUD_DAG_FOLDER) |
<|file_name|>test_cloud_memorystore_system.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | self.run_dag('gcp_cloud_memorystore_memcached', CLOUD_DAG_FOLDER) |
<|file_name|>test_cloud_memorystore_system.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | self.delete_gcs_bucket(GCP_BUCKET_NAME)
super().tearDown() |
<|file_name|>test_cloud_memorystore_system.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | setUp |
<|file_name|>test_cloud_memorystore_system.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | test_run_example_dag_memorystore_redis |
<|file_name|>test_cloud_memorystore_system.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | test_run_example_dag_memorystore_memcached |
<|file_name|>test_cloud_memorystore_system.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | tearDown |
<|file_name|>jdk_override.py<|end_file_name|><|fim▁begin|>"""
The MIT License (MIT)
Copyright (c) 2016 Louis-Philippe Querel l_querel@encs.concordia.ca
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Soft... |
class JdkOverride(AbstractOverride):
def _get_override_format(self): |
<|file_name|>jdk_override.py<|end_file_name|><|fim▁begin|>"""
The MIT License (MIT)
Copyright (c) 2016 Louis-Philippe Querel l_querel@encs.concordia.ca
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Soft... | def _get_override_format(self):
return 'JAVA_HOME="%s"'
def _get_default_format(self):
return ''
def __init__(self, *args):
AbstractOverride.__init__(self, *args)
self.name = "JDK" |
<|file_name|>jdk_override.py<|end_file_name|><|fim▁begin|>"""
The MIT License (MIT)
Copyright (c) 2016 Louis-Philippe Querel l_querel@encs.concordia.ca
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Soft... | return 'JAVA_HOME="%s"' |
<|file_name|>jdk_override.py<|end_file_name|><|fim▁begin|>"""
The MIT License (MIT)
Copyright (c) 2016 Louis-Philippe Querel l_querel@encs.concordia.ca
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Soft... | return '' |
<|file_name|>jdk_override.py<|end_file_name|><|fim▁begin|>"""
The MIT License (MIT)
Copyright (c) 2016 Louis-Philippe Querel l_querel@encs.concordia.ca
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Soft... | AbstractOverride.__init__(self, *args)
self.name = "JDK" |
<|file_name|>jdk_override.py<|end_file_name|><|fim▁begin|>"""
The MIT License (MIT)
Copyright (c) 2016 Louis-Philippe Querel l_querel@encs.concordia.ca
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Soft... | _get_override_format |
<|file_name|>jdk_override.py<|end_file_name|><|fim▁begin|>"""
The MIT License (MIT)
Copyright (c) 2016 Louis-Philippe Querel l_querel@encs.concordia.ca
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Soft... | _get_default_format |
<|file_name|>jdk_override.py<|end_file_name|><|fim▁begin|>"""
The MIT License (MIT)
Copyright (c) 2016 Louis-Philippe Querel l_querel@encs.concordia.ca
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Soft... | __init__ |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | return True
return False
|
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
<|fim_middle|>
AmmoToDmgPattern.... | visibilitySetting = 'ammoPattern'
def __init__(self):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def display(self, callingWindow, srcContext, mainItem):
if srcContext not in ("marketItemGroup", "marketItemMisc") or self.mainFrame.getActiveFit() is None:
return False... |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | self.mainFrame = gui.mainFrame.MainFrame.getInstance() |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | if srcContext not in ("marketItemGroup", "marketItemMisc") or self.mainFrame.getActiveFit() is None:
return False
if mainItem is None:
return False
for attr in ("emDamage", "thermalDamage", "explosiveDamage", "kineticDamage"):
if mainItem.getAttribute(attr) ... |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | return "Set {} as Damage Pattern".format(itmContext if itmContext is not None else "Item") |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | fitID = self.mainFrame.getActiveFit()
Fit.getInstance().setAsPattern(fitID, mainItem)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,))) |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | return None |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | return False |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | return False |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | return True |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | __init__ |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | display |
<|file_name|>ammoToDmgPattern.py<|end_file_name|><|fim▁begin|># noinspection PyPackageRequirements
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
... | getText |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.