prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>bip65-cltv-p2p.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util ... | setup_network |
<|file_name|>bip65-cltv-p2p.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util ... | run_test |
<|file_name|>bip65-cltv-p2p.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util ... | create_transaction |
<|file_name|>bip65-cltv-p2p.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util ... | get_tests |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":<|fim▁hole|> execute_from_command_line(sys.argv)<|fim▁end|> | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Sharing.settings")
from django.core.management import execute_from_command_line
|
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
<|fim_middle|>
<|fim▁end|> | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Sharing.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
<|file_name|>cloudresourcemanager_v3_generated_tag_keys_get_tag_key_async.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of ... | #
# Generated code. DO NOT EDIT!
# |
<|file_name|>cloudresourcemanager_v3_generated_tag_keys_get_tag_key_async.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of ... | client = resourcemanager_v3.TagKeysAsyncClient()
# Initialize request argument(s)
request = resourcemanager_v3.GetTagKeyRequest(
name="name_value",
)
# Make the request
response = await client.get_tag_key(request=request)
# Handle the response
print(response) |
<|file_name|>cloudresourcemanager_v3_generated_tag_keys_get_tag_key_async.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of ... | sample_get_tag_key |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from rest_framework import serializers
from . import models
<|fim▁hole|> 'id', 'name', 'additional_infos', 'owner',
'creation_date', 'update_date',
)<|fim▁end|> | class Invoice(serializers.ModelSerializer):
class Meta:
model = models.Invoice
fields = ( |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from rest_framework import serializers
from . import models
class Invoice(serializers.ModelSerializer):
<|fim_middle|>
<|fim▁end|> | class Meta:
model = models.Invoice
fields = (
'id', 'name', 'additional_infos', 'owner',
'creation_date', 'update_date',
) |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from rest_framework import serializers
from . import models
class Invoice(serializers.ModelSerializer):
class Meta:
<|fim_middle|>
<|fim▁end|> | model = models.Invoice
fields = (
'id', 'name', 'additional_infos', 'owner',
'creation_date', 'update_date',
) |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | strInt = left
strInt = strNew |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | "Base formatter - simply applies python format strings"
def __init__(self, pattern):
self.pattern = pattern
def format(self, obj):
return self.pattern % obj
def __repr__(self):
return "%s('%s')" % (self.__class__.__name__, self.pattern)
def __call__(self, x):
return s... |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | self.pattern = pattern |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | return self.pattern % obj |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | return "%s('%s')" % (self.__class__.__name__, self.pattern) |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | return self.format(x) |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | """lets you specify how to build a decimal.
A future NumberFormatter class will take Microsoft-style patterns
instead - "$#,##0.00" is WAY easier than this."""
def __init__(self, places=2, decimalSep='.', thousandSep=None, prefix=None, suffix=None):
if places=='auto':
self.calcPlace... |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | if places=='auto':
self.calcPlaces = self._calcPlaces
else:
self.places = places
self.dot = decimalSep
self.comma = thousandSep
self.prefix = prefix
self.suffix = suffix |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | '''called with the full set of values to be formatted so we can calculate places'''
self.places = max([len(_tz_re.sub('',_ld_re.sub('',str(v)))) for v in V]) |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | sign=num<0
if sign:
num = -num
places, sep = self.places, self.dot
strip = places<=0
if places and strip: places = -places
strInt = ('%.' + str(places) + 'f') % num
if places:
strInt, strFrac = strInt.split('.')
strFrac = sep + ... |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | return "%s(places=%d, decimalSep=%s, thousandSep=%s, prefix=%s, suffix=%s)" % (
self.__class__.__name__,
self.places,
repr(self.dot),
repr(self.comma),
repr(self.prefix),
repr(self.suffix)
... |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | f=DecimalFormatter(places,decimalSep,thousandSep,prefix,suffix)
r = f(n)
print("places=%2d dot=%-4s comma=%-4s prefix=%-4s suffix=%-4s result=%10s %s" %(f.places, f.dot, f.comma, f.prefix, f.suffix,r, r==s and 'OK' or 'BAD')) |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | self.calcPlaces = self._calcPlaces |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | self.places = places |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | num = -num |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | places = -places |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | strInt, strFrac = strInt.split('.')
strFrac = sep + strFrac
if strip:
while strFrac and strFrac[-1] in ['0',sep]: strFrac = strFrac[:-1] |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | while strFrac and strFrac[-1] in ['0',sep]: strFrac = strFrac[:-1] |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | strFrac = '' |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | strNew = ''
while strInt:
left, right = strInt[0:-3], strInt[-3:]
if left == '':
#strNew = self.comma + right + strNew
strNew = right + strNew
else:
strNew = self.comma + right + strNew
... |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | strNew = right + strNew |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | strNew = self.comma + right + strNew |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | strBody = '-' + strBody |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | strBody = self.prefix + strBody |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | strBody = strBody + self.suffix |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | def t(n, s, places=2, decimalSep='.', thousandSep=None, prefix=None, suffix=None):
f=DecimalFormatter(places,decimalSep,thousandSep,prefix,suffix)
r = f(n)
print("places=%2d dot=%-4s comma=%-4s prefix=%-4s suffix=%-4s result=%10s %s" %(f.places, f.dot, f.comma, f.prefix, f.suffix,r, r==s and... |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | __init__ |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | format |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | __repr__ |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | __call__ |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | __init__ |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | _calcPlaces |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | format |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | __repr__ |
<|file_name|>formatters.py<|end_file_name|><|fim▁begin|>#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $I... | t |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... |
@staticmethod |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
<|fim_middle|>
<|fim▁end|> | """ A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76
"""
def __init__(self, func):
self.__doc__ = getattr(func, '__doc__')
... |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | self.__doc__ = getattr(func, '__doc__')
self.func = func |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | if obj is None:
return self
propname = self.func.__name__
if not hasattr(obj, '_cached_properties'):
obj._cached_properties = {}
if propname not in obj._cached_properties:
obj._cached_properties[propname] = self.func(obj)
# value = obj._... |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | """clears cache of obj"""
if hasattr(obj, '_cached_properties'):
obj._cached_properties = {} |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | if hasattr(obj, '_cached_properties') and propname in obj._cached_properties:
return True
else:
return False |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | return self |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | obj._cached_properties = {} |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | obj._cached_properties[propname] = self.func(obj)
# value = obj.__dict__[propname] = self.func(obj) |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | obj._cached_properties = {} |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | return True |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | return False |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | __init__ |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | __get__ |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | clear |
<|file_name|>CachedProperty.py<|end_file_name|><|fim▁begin|># NOTE: this should inherit from (object) to function correctly with python 2.7
class CachedProperty(object):
""" A property that is only computed once per instance and
then stores the result in _cached_properties of the object.
Source: https:... | is_cached |
<|file_name|>greedy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 Software without... |
from jdhp.tictactoe.player.abstract import Player
|
<|file_name|>greedy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 Software without... | "
TODO...
"""
def play(self, game, state):
"""
TODO...
"""
action_list = game.getSetOfValidActions(state)
choosen_action = None
# Choose actions that lead to immediate victory...
for action in action_list:
next_state = game.nextState... |
<|file_name|>greedy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 Software without... | "
TODO...
"""
action_list = game.getSetOfValidActions(state)
choosen_action = None
# Choose actions that lead to immediate victory...
for action in action_list:
next_state = game.nextState(state, action, self)
if game.hasWon(self, next_st... |
<|file_name|>greedy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 Software without... | oosen_action = action
break
|
<|file_name|>greedy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 Software without... | oosen_action = random.choice(action_list)
|
<|file_name|>greedy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 Software without... | ay(s |
<|file_name|>test_codec.py<|end_file_name|><|fim▁begin|>import unittest
from elasticmagic.types import Integer, Float, Boolean
from elasticmagic.ext.queryfilter.codec import SimpleCodec
class SimpleCodecTest(unittest.TestCase):
def test_decode(self):
codec = SimpleCodec()
self.assertEqual(
... | }
}
) |
<|file_name|>test_codec.py<|end_file_name|><|fim▁begin|>import unittest
from elasticmagic.types import Integer, Float, Boolean
from elasticmagic.ext.queryfilter.codec import SimpleCodec
class SimpleCodecTest(unittest.TestCase):
<|fim_middle|>
<|fim▁end|> | def test_decode(self):
codec = SimpleCodec()
self.assertEqual(
codec.decode({'country': ['ru', 'ua', 'null']}),
{
'country': {
'exact': [['ru'], ['ua'], [None]],
}
}
)
self.assertEqual(
... |
<|file_name|>test_codec.py<|end_file_name|><|fim▁begin|>import unittest
from elasticmagic.types import Integer, Float, Boolean
from elasticmagic.ext.queryfilter.codec import SimpleCodec
class SimpleCodecTest(unittest.TestCase):
def test_decode(self):
<|fim_middle|>
<|fim▁end|> | codec = SimpleCodec()
self.assertEqual(
codec.decode({'country': ['ru', 'ua', 'null']}),
{
'country': {
'exact': [['ru'], ['ua'], [None]],
}
}
)
self.assertEqual(
codec.decode({'category':... |
<|file_name|>test_codec.py<|end_file_name|><|fim▁begin|>import unittest
from elasticmagic.types import Integer, Float, Boolean
from elasticmagic.ext.queryfilter.codec import SimpleCodec
class SimpleCodecTest(unittest.TestCase):
def <|fim_middle|>(self):
codec = SimpleCodec()
self.assertEqual(
... | test_decode |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | frames[3].showBoundary=False
return frames
def member_list_pdf(request): |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | env = Env()
MEMBERS_PASSWORD = env('MEMBERS_PASSWORD')
# handle form submission
if request.POST:
pw_form = PasswordForm(request.POST)
if pw_form.is_valid() and pw_form.cleaned_data['password'] == MEMBERS_PASSWORD:
request.session['password'] = pw_form.cleaned_data['password... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | password = forms.CharField(max_length=20,
widget=forms.PasswordInput(attrs={
'class': 'form-control',
'placeholder': 'Enter Password',
})) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | frames = []
for i in range(ncols):
f = Frame(x1=(i*((pwidth-30) / ncols)+15),
y1=0,
width=((pwidth-30) / ncols),
height=pheight+2,
leftPadding=15,
rightPadding=15,
topPadding=15,
... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename="memberlist.pdf"'
buffer = BytesIO()
NCOLUMNS = 4
PAGE_WIDTH, PAGE_HEIGHT = landscape(letter)
styles = getSampleStyleSheet()
ptemplate = PageTemplate(frames=build_frames(PAGE_W... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | pw_form = PasswordForm(request.POST)
if pw_form.is_valid() and pw_form.cleaned_data['password'] == MEMBERS_PASSWORD:
request.session['password'] = pw_form.cleaned_data['password']
return redirect('members:member_list')
messages.error(request, "The password you entered w... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | request.session['password'] = pw_form.cleaned_data['password']
return redirect('members:member_list') |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | member_list = Member.objects.all()
return render(request, 'members/member_list.html', {
'member_list': member_list,
}) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | member_list |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | build_frames |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from io import BytesIO
from django import forms
from django.http import HttpResponse
from django.template import Context, Template
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView
from django.views.decorators.http impo... | member_list_pdf |
<|file_name|>test_successor.py<|end_file_name|><|fim▁begin|>from must import MustHavePatterns
from successor import Successor
<|fim▁hole|>class TestSuccessor(object):
@classmethod
def setup_class(cls):
cls.test_patterns = MustHavePatterns(Successor)
def test_successor(self):
try:
... | |
<|file_name|>test_successor.py<|end_file_name|><|fim▁begin|>from must import MustHavePatterns
from successor import Successor
class TestSuccessor(object):
<|fim_middle|>
<|fim▁end|> | @classmethod
def setup_class(cls):
cls.test_patterns = MustHavePatterns(Successor)
def test_successor(self):
try:
self.test_patterns.create(Successor)
raise Exception("Recursive structure did not explode.")
except RuntimeError as re:
assert str(re... |
<|file_name|>test_successor.py<|end_file_name|><|fim▁begin|>from must import MustHavePatterns
from successor import Successor
class TestSuccessor(object):
@classmethod
def setup_class(cls):
<|fim_middle|>
def test_successor(self):
try:
self.test_patterns.create(Successor)
... | cls.test_patterns = MustHavePatterns(Successor) |
<|file_name|>test_successor.py<|end_file_name|><|fim▁begin|>from must import MustHavePatterns
from successor import Successor
class TestSuccessor(object):
@classmethod
def setup_class(cls):
cls.test_patterns = MustHavePatterns(Successor)
def test_successor(self):
<|fim_middle|>
<|fim▁end... | try:
self.test_patterns.create(Successor)
raise Exception("Recursive structure did not explode.")
except RuntimeError as re:
assert str(re).startswith("maximum recursion depth") |
<|file_name|>test_successor.py<|end_file_name|><|fim▁begin|>from must import MustHavePatterns
from successor import Successor
class TestSuccessor(object):
@classmethod
def <|fim_middle|>(cls):
cls.test_patterns = MustHavePatterns(Successor)
def test_successor(self):
try:
self.... | setup_class |
<|file_name|>test_successor.py<|end_file_name|><|fim▁begin|>from must import MustHavePatterns
from successor import Successor
class TestSuccessor(object):
@classmethod
def setup_class(cls):
cls.test_patterns = MustHavePatterns(Successor)
def <|fim_middle|>(self):
try:
self.tes... | test_successor |
<|file_name|>test_bar.py<|end_file_name|><|fim▁begin|>''' This file contains tests for the bar plot.
'''
import matplotlib.pyplot as plt
import pytest
import shap
from .utils import explainer # (pytest fixture do not remove) pylint: disable=unused-import
@pytest.mark.mpl_image_compare
def test_simple_bar(explainer):... | """ Check that the bar plot is unchanged. |
<|file_name|>test_bar.py<|end_file_name|><|fim▁begin|>''' This file contains tests for the bar plot.
'''
import matplotlib.pyplot as plt
import pytest
import shap
from .utils import explainer # (pytest fixture do not remove) pylint: disable=unused-import
@pytest.mark.mpl_image_compare
def test_simple_bar(explainer):... | """ Check that the bar plot is unchanged.
"""
shap_values = explainer(explainer.data)
fig = plt.figure()
shap.plots.bar(shap_values, show=False)
plt.tight_layout()
return fig |
<|file_name|>test_bar.py<|end_file_name|><|fim▁begin|>''' This file contains tests for the bar plot.
'''
import matplotlib.pyplot as plt
import pytest
import shap
from .utils import explainer # (pytest fixture do not remove) pylint: disable=unused-import
@pytest.mark.mpl_image_compare
def <|fim_middle|>(explainer): ... | test_simple_bar |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
# Register your models here.
from rcps.models import *
class IngredientToRecipeInline(admin.TabularInline):
model = Ingredient.recipes.through
verbose_name = 'Ингредиент'
verbose_name_plural = 'Ингредиенты'
class Equipm... | model = Tag.tag_recipes.through
verbose_name = 'Тег'
verbose_name_plural = 'Теги' |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
# Register your models here.
from rcps.models import *
class IngredientToRecipeInline(admin.TabularInline):
<|fim_middle|>
ine(admin.TabularInline):
model = Equipment.equipment_recipes.through
verbose_name = 'Инструмент'
... | model = Ingredient.recipes.through
verbose_name = 'Ингредиент'
verbose_name_plural = 'Ингредиенты'
class EquipmentInl |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
# Register your models here.
from rcps.models import *
class IngredientToRecipeInline(admin.TabularInline):
model = Ingredient.recipes.through
verbose_name = 'Ингредиент'
verbose_name_plural = 'Ингредиенты'
class Equipm... | ipment_recipes.through
verbose_name = 'Инструмент'
verbose_name_plural = 'Инструменты'
class TagInline(admin.TabularInline):
|
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
# Register your models here.
from rcps.models import *
class IngredientToRecipeInline(admin.TabularInline):
model = Ingredient.recipes.through
verbose_name = 'Ингредиент'
verbose_name_plural = 'Ингредиенты'
class Equipm... | e_name = 'Тег'
verbose_name_plural = 'Теги'
class RecipeAdmin(admin.ModelAdmin):
model |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
# Register your models here.
from rcps.models import *
class IngredientToRecipeInline(admin.TabularInline):
model = Ingredient.recipes.through
verbose_name = 'Ингредиент'
verbose_name_plural = 'Ингредиенты'
class Equipm... | pe_link']
inlines = (
IngredientToRecipeInline,
EquipmentInline,
TagInline,
)
class IngredientComponentInAlternativeInline(a |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
# Register your models here.
from rcps.models import *
class IngredientToRecipeInline(admin.TabularInline):
model = Ingredient.recipes.through
verbose_name = 'Ингредиент'
verbose_name_plural = 'Ингредиенты'
class Equipm... |
verbose_name = 'Ингредиент'
verbose_name_plural = 'Ингредиенты'
class IngredientAlternativeAdmin(admin.ModelAdmin):
model = Ing |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
# Register your models here.
from rcps.models import *
class IngredientToRecipeInline(admin.TabularInline):
model = Ingredient.recipes.through
verbose_name = 'Ингредиент'
verbose_name_plural = 'Ингредиенты'
class Equipm... | entInAlternativeInline,
)
admin.site.register(Recipe, RecipeAdmin)
admin.site.register(Ingred |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.