commit stringlengths 40 40 | old_file stringlengths 5 117 | new_file stringlengths 5 117 | old_contents stringlengths 0 1.93k | new_contents stringlengths 19 3.3k | subject stringlengths 17 320 | message stringlengths 18 3.28k | lang stringclasses 1
value | license stringclasses 13
values | repos stringlengths 7 42.4k | completion stringlengths 152 6.66k | prompt stringlengths 21 3.65k |
|---|---|---|---|---|---|---|---|---|---|---|---|
b77e8f9a081517701cccf9f177c81eaca877e8c7 | pombola/images/admin.py | pombola/images/admin.py | from django.contrib import admin
from django.contrib.contenttypes.generic import GenericTabularInline
from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.admin import AdminImageMixin
from pombola.images import models
class ImageAdmin(AdminImageMixin, admin.ModelAdmin):
list_display = [ 'thumbnail',... | from django.contrib import admin
from django.contrib.contenttypes.generic import GenericTabularInline
from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.admin import AdminImageMixin
from pombola.images import models
class ImageAdmin(AdminImageMixin, admin.ModelAdmin):
list_display = [ 'thumbnail',... | Handle entries that have no image associated with them | Handle entries that have no image associated with them
| Python | agpl-3.0 | ken-muturi/pombola,mysociety/pombola,geoffkilpin/pombola,hzj123/56th,ken-muturi/pombola,patricmutwiri/pombola,geoffkilpin/pombola,ken-muturi/pombola,mysociety/pombola,ken-muturi/pombola,mysociety/pombola,hzj123/56th,mysociety/pombola,patricmutwiri/pombola,patricmutwiri/pombola,geoffkilpin/pombola,hzj123/56th,ken-muturi... | <INSERT> if obj.image:
<INSERT_END> <INSERT> <INSERT_END> <INSERT> else:
return "NO IMAGE FOUND"
<INSERT_END> <|endoftext|> from django.contrib import admin
from django.contrib.contenttypes.generic import GenericTabularInline
from sorl.thumbnail import get_thumbnail
from sorl.thumbn... | Handle entries that have no image associated with them
from django.contrib import admin
from django.contrib.contenttypes.generic import GenericTabularInline
from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.admin import AdminImageMixin
from pombola.images import models
class ImageAdmin(AdminImageMix... |
aaaaad4ea3109406268471b6605eb6078848db0d | falcom/api/uri/fake_mapping.py | falcom/api/uri/fake_mapping.py | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
class FakeMappingThatRecordsAccessions:
def __init__ (self):
self.__set = set()
def __getitem__ (self, key):
self._... | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
class FakeMappingThatRecordsAccessions:
def __init__ (self):
self.__set = set()
def __getitem__ (self, key):
self._... | Write function for getting expected args | Write function for getting expected args
| Python | bsd-3-clause | mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation | <REPLACE_OLD> format_str.format_map(self)
<REPLACE_NEW> format_str.format_map(self)
def get_expected_args_from_format_str (format_str):
mapping = FakeMappingThatRecordsAccessions()
format_str.format_map(mapping)
return mapping.get_set()
<REPLACE_END> <|endoftext|> # Copyright (c) 2017 The Regents of the... | Write function for getting expected args
# Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
class FakeMappingThatRecordsAccessions:
def __init__ (self):
self.__set = set()
d... |
6fe0966cc6c0532ee6d0076ff6306ceda3418928 | bluebottle/homepage/model.py | bluebottle/homepage/model.py | from bluebottle.slides.models import Slide
from bluebottle.projects import get_project_model
from bluebottle.quotes.models import Quote
PROJECT_MODEL = get_project_model()
class HomePage(object):
def get(self, language):
self.id = 1
self.quotes = Quote.objects.published().filter(language=language... | from bluebottle.slides.models import Slide
from bluebottle.projects import get_project_model
from bluebottle.quotes.models import Quote
PROJECT_MODEL = get_project_model()
class HomePage(object):
def get(self, language):
# FIXME: Hack to make sure quotes and slides load.
if language == 'en-us':
... | Fix Slides & Quotes for home | Fix Slides & Quotes for home
| Python | bsd-3-clause | jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle | <INSERT> # FIXME: Hack to make sure quotes and slides load.
if language == 'en-us':
language = 'en_US'
<INSERT_END> <REPLACE_OLD> PROJECT_MODEL.objects.filter(status__viewable=True, favorite=True).order_by('?')
<REPLACE_NEW> PROJECT_MODEL.objects.filter(status__viewable=True).order_by('?')
... | Fix Slides & Quotes for home
from bluebottle.slides.models import Slide
from bluebottle.projects import get_project_model
from bluebottle.quotes.models import Quote
PROJECT_MODEL = get_project_model()
class HomePage(object):
def get(self, language):
self.id = 1
self.quotes = Quote.objects.publis... |
0ae360b675f2dd0b3607af1bc7b72864e43236b2 | userreport/settings_local.EXAMPLE.py | userreport/settings_local.EXAMPLE.py | # Fill in this file and save as settings_local.py
PROJECT_NAME = 'SuperTuxKart'
PROJECT_URL = 'http://supertuxkart.net/'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
# Add the name/ip of the server that is running the stats server
ALLOWED_HOSTS = ["api.stkaddo... | # Fill in this file and save as settings_local.py
PROJECT_NAME = 'SuperTuxKart'
PROJECT_URL = 'http://supertuxkart.net/'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
# Add the name/ip of the server that is running the stats server
ALLOWED_HOSTS = ["addons.supe... | Change default example for allowed hosts | Change default example for allowed hosts
| Python | mit | leyyin/stk-stats,supertuxkart/stk-stats,leyyin/stk-stats,supertuxkart/stk-stats | <REPLACE_OLD> ["api.stkaddons.net"]
ADMINS <REPLACE_NEW> ["addons.supertuxkart.net"]
ADMINS <REPLACE_END> <|endoftext|> # Fill in this file and save as settings_local.py
PROJECT_NAME = 'SuperTuxKart'
PROJECT_URL = 'http://supertuxkart.net/'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = T... | Change default example for allowed hosts
# Fill in this file and save as settings_local.py
PROJECT_NAME = 'SuperTuxKart'
PROJECT_URL = 'http://supertuxkart.net/'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
# Add the name/ip of the server that is running the ... |
f6013aa29fddf9883f8f0bea4b7733718b9d8846 | core/admin/migrations/versions/3f6994568962_.py | core/admin/migrations/versions/3f6994568962_.py | """ Add keep as an option in fetches
Revision ID: 3f6994568962
Revises: 2335c80a6bc3
Create Date: 2017-02-02 22:31:00.719703
"""
# revision identifiers, used by Alembic.
revision = '3f6994568962'
down_revision = '2335c80a6bc3'
from alembic import op
import sqlalchemy as sa
from mailu import app
fetch_table = sa.... | """ Add keep as an option in fetches
Revision ID: 3f6994568962
Revises: 2335c80a6bc3
Create Date: 2017-02-02 22:31:00.719703
"""
# revision identifiers, used by Alembic.
revision = '3f6994568962'
down_revision = '2335c80a6bc3'
from alembic import op
import sqlalchemy as sa
fetch_table = sa.Table(
'fetch',
... | Fix an old migration that was reading configuration before migrating | Fix an old migration that was reading configuration before migrating
| Python | mit | kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io | <REPLACE_OLD> sa
from mailu import app
fetch_table <REPLACE_NEW> sa
fetch_table <REPLACE_END> <DELETE> connection = op.get_bind()
<DELETE_END> <REPLACE_OLD> server_default=sa.sql.expression.false()))
# also apply the current config value if set
if app.config.get("FETCHMAIL_KEEP", "False") == "True":
... | Fix an old migration that was reading configuration before migrating
""" Add keep as an option in fetches
Revision ID: 3f6994568962
Revises: 2335c80a6bc3
Create Date: 2017-02-02 22:31:00.719703
"""
# revision identifiers, used by Alembic.
revision = '3f6994568962'
down_revision = '2335c80a6bc3'
from alembic import... |
b69f69b0e89a49b427292ec179e12bdee6fb4743 | samples/web/content/testrtc/testrtc.py | samples/web/content/testrtc/testrtc.py | #!/usr/bin/python2.4
#
# Copyright 2014 Google Inc. All Rights Reserved.
"""WebRTC Test
This module serves the WebRTC Test Page.
"""
import cgi
import logging
import os
import jinja2
import webapp2
jinja_environment = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
class MainPage... | #!/usr/bin/python2.4
#
# Copyright 2014 Google Inc. All Rights Reserved.
"""WebRTC Test
This module serves the WebRTC Test Page.
"""
import cgi
import logging
import random
import os
import jinja2
import webapp2
jinja_environment = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
... | Add ability to download a random file with a given size from any domain. | Add ability to download a random file with a given size from any domain.
| Python | bsd-3-clause | xdumaine/adapter,mulyoved/samples,ralic/testrtc,82488059/apprtc,mauricionr/samples,smayoorans/samples,shelsonjava/testrtc,4lejandrito/adapter,TribeMedia/testrtc,YouthAndra/apprtc,JiYou/apprtc,fetterov/samples,82488059/apprtc,webrtc/samples,TribeMedia/samples,dengshaodong/docker-apprtc,4lejandrito/adapter,diddie06/webrt... | <INSERT> random
import <INSERT_END> <REPLACE_OLD> loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
class <REPLACE_NEW> loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
# Generate 10 kilobytes of random data and create a 10MB buffer from it.
random_file = bytearray([random.randint(0,127) for i in x... | Add ability to download a random file with a given size from any domain.
#!/usr/bin/python2.4
#
# Copyright 2014 Google Inc. All Rights Reserved.
"""WebRTC Test
This module serves the WebRTC Test Page.
"""
import cgi
import logging
import os
import jinja2
import webapp2
jinja_environment = jinja2.Environment(
... |
18ade96032dbbeaee6f96ff364cb3dc8726970da | tests/test_q_function.py | tests/test_q_function.py | import unittest
import random
import numpy as np
import q_function
class TestQFunction(unittest.TestCase):
def setUp(self):
pass
def test_sample(self):
q_func = q_function.FCSIQFunction(1, 2, 10, 2)
N = 1000
greedy_count = 0
for _ in xrange(N):
random_st... | Add a test for QFunction | Add a test for QFunction
| Python | mit | toslunar/chainerrl,toslunar/chainerrl | <REPLACE_OLD> <REPLACE_NEW> import unittest
import random
import numpy as np
import q_function
class TestQFunction(unittest.TestCase):
def setUp(self):
pass
def test_sample(self):
q_func = q_function.FCSIQFunction(1, 2, 10, 2)
N = 1000
greedy_count = 0
for _ in xra... | Add a test for QFunction
| |
4dfc0c49cec86f3c03b90fa66e1fc9de2ac665e6 | samples/migrations/0012_auto_20170512_1138.py | samples/migrations/0012_auto_20170512_1138.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-12 14:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('samples', '0011_fluvaccine_date_applied'),
]
operations = [
migrations.AlterF... | Add migration file (fix fields) | :rocket: Add migration file (fix fields)
| Python | mit | gems-uff/labsys,gems-uff/labsys,gems-uff/labsys | <INSERT> # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-12 14:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<INSERT_END> <INSERT> dependencies = [
('samples', '0011_fluvaccine_date_applied'),
]
operations... | :rocket: Add migration file (fix fields)
| |
ea20424f2645f1157c0a7ea76b32a4f834c1e27b | pythonect/internal/__init__.py | pythonect/internal/__init__.py | # Copyright (c) 2012-2013, Itzik Kotler
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of condit... | # Copyright (c) 2012-2013, Itzik Kotler
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of condit... | Delete blank line at end of file | Delete blank line at end of file
| Python | bsd-3-clause | ikotler/pythonect,fr34k8/pythonect,fr34k8/pythonect,TOSPIO/pythonect,ikotler/pythonect | <REPLACE_OLD> DAMAGE.
<REPLACE_NEW> DAMAGE.
<REPLACE_END> <|endoftext|> # Copyright (c) 2012-2013, Itzik Kotler
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sour... | Delete blank line at end of file
# Copyright (c) 2012-2013, Itzik Kotler
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
#... |
921977589a6837575ab7aadaa6238b20d0771ae2 | mesonbuild/dependencies/platform.py | mesonbuild/dependencies/platform.py | # Copyright 2013-2017 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... | # Copyright 2013-2017 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... | Set is_found in AppleFrameworks constructor | Set is_found in AppleFrameworks constructor
Set is_found in AppleFrameworks constructor, rather than overriding the
found() method, as other superclass methods may access is_found.
| Python | apache-2.0 | QuLogic/meson,pexip/meson,QuLogic/meson,pexip/meson,QuLogic/meson,pexip/meson,becm/meson,jeandet/meson,pexip/meson,becm/meson,pexip/meson,becm/meson,jpakkane/meson,pexip/meson,jeandet/meson,mesonbuild/meson,jeandet/meson,MathieuDuponchelle/meson,mesonbuild/meson,QuLogic/meson,jeandet/meson,mesonbuild/meson,jeandet/meso... | <REPLACE_OLD> def found(self):
return <REPLACE_NEW> self.is_found = <REPLACE_END> <|endoftext|> # Copyright 2013-2017 The Meson development team
# 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 th... | Set is_found in AppleFrameworks constructor
Set is_found in AppleFrameworks constructor, rather than overriding the
found() method, as other superclass methods may access is_found.
# Copyright 2013-2017 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
41795bf65f6d834007c7f352fd079084f5ed940f | calc.py | calc.py | # -*- coding: utf-8 -*-
def add(x, y):
"""
引数xとyを加算した結果を返す
>>> add(2, 3)
5
"""
return x + y
| Implement sample module and doctest | Implement sample module and doctest
| Python | mit | raimon49/python-local-wheels-sample | <INSERT> # -*- coding: utf-8 -*-
def add(x, y):
<INSERT_END> <INSERT> """
引数xとyを加算した結果を返す
>>> add(2, 3)
5
"""
return x + y
<INSERT_END> <|endoftext|> # -*- coding: utf-8 -*-
def add(x, y):
"""
引数xとyを加算した結果を返す
>>> add(2, 3)
5
"""
return x + y
| Implement sample module and doctest
| |
cfec967be4602dff636adb951b582d1db114f578 | tensorflow_datasets/scripts/document_dataset_version.py | tensorflow_datasets/scripts/document_dataset_version.py | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | Add single dataset doc gen | Add single dataset doc gen
| Python | apache-2.0 | tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets | <INSERT> # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# <INSERT_END> <INSERT> http://www.apache.org/licenses/LICENSE-2... | Add single dataset doc gen
| |
ee61dab40c4c3eaa1553397091a17a3292dcf9d6 | grako/ast.py | grako/ast.py | from collections import OrderedDict, Mapping
import json
class AST(Mapping):
def __init__(self, **kwargs):
self._elements = OrderedDict(**kwargs)
def add(self, key, value):
previous = self._elements.get(key, None)
if previous is None:
self._elements[key] = [value]
e... | from collections import OrderedDict, Mapping
import json
__all__ = ['AST']
class AST(Mapping):
def __init__(self, **kwargs):
self._elements = OrderedDict(**kwargs)
def add(self, key, value):
previous = self._elements.get(key, None)
if previous is None:
self._elements[key] ... | Allow to set items in AST. | Allow to set items in AST.
| Python | bsd-2-clause | frnknglrt/grako,vmuriart/grako | <REPLACE_OLD> json
class <REPLACE_NEW> json
__all__ = ['AST']
class <REPLACE_END> <INSERT> __setitem__(self, key, value):
self._elements[key] = value
def <INSERT_END> <|endoftext|> from collections import OrderedDict, Mapping
import json
__all__ = ['AST']
class AST(Mapping):
def __init__(self, **k... | Allow to set items in AST.
from collections import OrderedDict, Mapping
import json
class AST(Mapping):
def __init__(self, **kwargs):
self._elements = OrderedDict(**kwargs)
def add(self, key, value):
previous = self._elements.get(key, None)
if previous is None:
self._eleme... |
7fde39b0d4a41e8119893254d38460cf6914f028 | bashhub/view/status.py | bashhub/view/status.py | import dateutil.parser
import datetime
import humanize
status_view = """\
=== Bashhub Status
https://bashhub.com/u/{0}
Total Commands: {1}
Total Sessions: {2}
Total Systems: {3}
===
Session PID {4} Started {5}
Commands In Session: {6}
Commands Today: {7}
"""
def build_status_view(model):
date = datetime.datetime... | import dateutil.parser
import datetime
import humanize
status_view = """\
=== Bashhub Status
https://bashhub.com/{0}
Total Commands: {1}
Total Sessions: {2}
Total Systems: {3}
===
Session PID {4} Started {5}
Commands In Session: {6}
Commands Today: {7}
"""
def build_status_view(model):
date = datetime.datetime.f... | Remove /u/ from username path | Remove /u/ from username path
| Python | apache-2.0 | rcaloras/bashhub-client,rcaloras/bashhub-client | <REPLACE_OLD> Status
https://bashhub.com/u/{0}
Total <REPLACE_NEW> Status
https://bashhub.com/{0}
Total <REPLACE_END> <|endoftext|> import dateutil.parser
import datetime
import humanize
status_view = """\
=== Bashhub Status
https://bashhub.com/{0}
Total Commands: {1}
Total Sessions: {2}
Total Systems: {3}
===
Sessio... | Remove /u/ from username path
import dateutil.parser
import datetime
import humanize
status_view = """\
=== Bashhub Status
https://bashhub.com/u/{0}
Total Commands: {1}
Total Sessions: {2}
Total Systems: {3}
===
Session PID {4} Started {5}
Commands In Session: {6}
Commands Today: {7}
"""
def build_status_view(model... |
351815d8da1dc1b2227e8fd832e690f8aee47747 | setup.py | setup.py | import codecs
from setuptools import setup
lines = codecs.open('README', 'r', 'utf-8').readlines()[3:]
lines.extend(codecs.open('CHANGES', 'r', 'utf-8').readlines()[1:])
desc = ''.join(lines).lstrip()
import translitcodec
version = translitcodec.__version__
setup(name='translitcodec',
version=version,
d... | import codecs
from setuptools import setup
lines = codecs.open('README', 'r', 'utf-8').readlines()[3:]
lines.append('\n')
lines.extend(codecs.open('CHANGES', 'r', 'utf-8').readlines()[1:])
desc = ''.join(lines).lstrip()
import translitcodec
version = translitcodec.__version__
setup(name='translitcodec',
versi... | Add blank line between README and CHANGES in long_description | Add blank line between README and CHANGES in long_description
| Python | mit | claudep/translitcodec,claudep/translitcodec | <REPLACE_OLD> 'utf-8').readlines()[3:]
lines.extend(codecs.open('CHANGES', <REPLACE_NEW> 'utf-8').readlines()[3:]
lines.append('\n')
lines.extend(codecs.open('CHANGES', <REPLACE_END> <INSERT> long_description_content_type='text/x-rst',
<INSERT_END> <|endoftext|> import codecs
from setuptools import setup
lines ... | Add blank line between README and CHANGES in long_description
import codecs
from setuptools import setup
lines = codecs.open('README', 'r', 'utf-8').readlines()[3:]
lines.extend(codecs.open('CHANGES', 'r', 'utf-8').readlines()[1:])
desc = ''.join(lines).lstrip()
import translitcodec
version = translitcodec.__versio... |
685fa68b79b4d21f69fe55f66724191d30bbbaa8 | contact/views.py | contact/views.py | from rest_framework import serializers
from rest_framework.views import APIView
from rest_framework.response import Response
from django import http
from .tasks import send_contact_form_inquiry
# Serializers define the API representation.
class ContactSerializer(serializers.Serializer):
email = serializers.Email... | from rest_framework import serializers
from rest_framework.views import APIView
from rest_framework.response import Response
from django import http
from .tasks import send_contact_form_inquiry
# Serializers define the API representation.
class ContactSerializer(serializers.Serializer):
email = serializers.Email... | Remove all permisson for contact API | Remove all permisson for contact API
| Python | mit | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | <INSERT> authentication_classes = []
<INSERT_END> <REPLACE_OLD> ()
<REPLACE_NEW> []
<REPLACE_END> <|endoftext|> from rest_framework import serializers
from rest_framework.views import APIView
from rest_framework.response import Response
from django import http
from .tasks import send_contact_form_inquiry
# S... | Remove all permisson for contact API
from rest_framework import serializers
from rest_framework.views import APIView
from rest_framework.response import Response
from django import http
from .tasks import send_contact_form_inquiry
# Serializers define the API representation.
class ContactSerializer(serializers.Seri... |
8baf08fd22a0e66734e927607aaab9b1a0bdd7f4 | time-complexity/time_complexity.py | time-complexity/time_complexity.py | #Comparison of different time complexities.
#####################
#constant time - O(1)
#####################
def constant(n):
result = n * n
return result
##############################
#Logarithmic time - O(log(n))
##############################
def logarithmic(n):
result = 0
while n > 1:
... | Add time-complexity: basic python examples | Add time-complexity: basic python examples
| Python | cc0-1.0 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | <INSERT> #Comparison of different time complexities.
#####################
#constant time - O(1)
#####################
def constant(n):
<INSERT_END> <INSERT> result = n * n
return result
##############################
#Logarithmic time - O(log(n))
##############################
def logarithmic(n):
result... | Add time-complexity: basic python examples
| |
bab5a974c78a2b7042de449c6d3b01f9297809f1 | src/python/utexas/tools/generate_ddl.py | src/python/utexas/tools/generate_ddl.py | """
utexas/tools/generate_ddl.py
Print or apply the research data schema.
@author: Bryan Silverthorn <bcs@cargo-cult.org>
"""
if __name__ == "__main__":
from utexas.tools.generate_ddl import main
raise SystemExit(main())
from cargo.flags import (
Flag,
Flags,
)
module_flags = \
Flags(
... | Add a standalone DDL print/reflection tool. | Add a standalone DDL print/reflection tool.
| Python | mit | borg-project/borg | <REPLACE_OLD> <REPLACE_NEW> """
utexas/tools/generate_ddl.py
Print or apply the research data schema.
@author: Bryan Silverthorn <bcs@cargo-cult.org>
"""
if __name__ == "__main__":
from utexas.tools.generate_ddl import main
raise SystemExit(main())
from cargo.flags import (
Flag,
Flags,
)
mod... | Add a standalone DDL print/reflection tool.
| |
1fac10d27f00322e34c3b89527c32b1dcb02decd | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jack Brewer
# Copyright (c) 2015 Jack Brewer
#
# License: MIT
"""This module exports the Stylint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Stylint(NodeLinter):
"""Provides an inte... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jack Brewer
# Copyright (c) 2015 Jack Brewer
#
# License: MIT
"""This module exports the Stylint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Stylint(NodeLinter):
"""Provides an inte... | Support Stylus blocks in Vue single-file components | Support Stylus blocks in Vue single-file components
| Python | mit | jackbrewer/SublimeLinter-contrib-stylint | <REPLACE_OLD> 'stylus'
<REPLACE_NEW> ('stylus', 'vue')
selectors = {'vue': 'source.stylus.embedded.html'}
<REPLACE_END> <|endoftext|> #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jack Brewer
# Copyright (c) 2015 Jack Brewer
#
# License: MIT
"""This module... | Support Stylus blocks in Vue single-file components
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jack Brewer
# Copyright (c) 2015 Jack Brewer
#
# License: MIT
"""This module exports the Stylint plugin class."""
from SublimeLinter.lint import NodeLinter, util
... |
91c35078c7a8aad153d9aabe0b02fc3c48cfc76a | hesiod.py | hesiod.py | #!/usr/bin/env python
from _hesiod import bind, resolve
| #!/usr/bin/env python
"""
Present both functional and object-oriented interfaces for executing
lookups in Hesiod, Project Athena's service name resolution protocol.
"""
from _hesiod import bind, resolve
from pwd import struct_passwd
class HesiodParseError(Exception):
pass
class Lookup(object):
"""
A Ge... | Add object-oriented-style lookups for filsys, passwd, and uid lookups | Add object-oriented-style lookups for filsys, passwd, and uid lookups
The filsys entry parsing code is taken from pyHesiodFS and was explicitly
relicensed under the MIT license by Quentin Smith <quentin@mit.edu>
| Python | mit | ebroder/python-hesiod | <REPLACE_OLD> python
from <REPLACE_NEW> python
"""
Present both functional and object-oriented interfaces for executing
lookups in Hesiod, Project Athena's service name resolution protocol.
"""
from <REPLACE_END> <REPLACE_OLD> resolve
<REPLACE_NEW> resolve
from pwd import struct_passwd
class HesiodParseError(Exce... | Add object-oriented-style lookups for filsys, passwd, and uid lookups
The filsys entry parsing code is taken from pyHesiodFS and was explicitly
relicensed under the MIT license by Quentin Smith <quentin@mit.edu>
#!/usr/bin/env python
from _hesiod import bind, resolve
|
6a36df252e5f7c17cb2dfc63062472c65645ad2f | unleashed/api.py | unleashed/api.py | import requests
from auth import UnleashedAuth
class UnleashedApi(object):
"""
Unleashed API client library.
"""
def __init__(self, api_url, api_id, api_key):
self.api_url = api_url
self.auth = UnleashedAuth(api_id, api_key)
def _get_request(self, method, params=None):
p... | Add basic API which can make GET and POST requests | Add basic API which can make GET and POST requests
| Python | mit | jsok/unleashed | <REPLACE_OLD> <REPLACE_NEW> import requests
from auth import UnleashedAuth
class UnleashedApi(object):
"""
Unleashed API client library.
"""
def __init__(self, api_url, api_id, api_key):
self.api_url = api_url
self.auth = UnleashedAuth(api_id, api_key)
def _get_request(self, me... | Add basic API which can make GET and POST requests
| |
32f4c67cda624f1840b1ab92d1d1afc826f13dd5 | examples/plot_gmm_pdf.py | examples/plot_gmm_pdf.py | """
=================================
Gaussian Mixture Model Ellipsoids
=================================
Plot the confidence ellipsoids of a mixture of two gaussians.
"""
import numpy as np
from scikits.learn import gmm
import itertools
import pylab as pl
import matplotlib as mpl
import matplotlib.pyplot as plt
n... | Add an example with probability distribution estimates using GMM. | Add an example with probability distribution estimates using GMM.
This is a work in progress. Also, the .eval() function from GMM
might very likely change it's return type in the future.
| Python | bsd-3-clause | mayblue9/scikit-learn,qifeigit/scikit-learn,rrohan/scikit-learn,shusenl/scikit-learn,jseabold/scikit-learn,huobaowangxi/scikit-learn,frank-tancf/scikit-learn,shangwuhencc/scikit-learn,Srisai85/scikit-learn,RPGOne/scikit-learn,appapantula/scikit-learn,raghavrv/scikit-learn,hdmetor/scikit-learn,yask123/scikit-learn,xyguo... | <INSERT> """
=================================
Gaussian Mixture Model Ellipsoids
=================================
Plot the confidence ellipsoids of a mixture of two gaussians.
"""
import numpy as np
from scikits.learn import gmm
import itertools
import pylab as pl
import matplotlib as mpl
import matplotlib.pyplot ... | Add an example with probability distribution estimates using GMM.
This is a work in progress. Also, the .eval() function from GMM
might very likely change it's return type in the future.
| |
36716fe51800a19567c49e734d320b38d441054e | zerver/migrations/0003_custom_indexes.py | zerver/migrations/0003_custom_indexes.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('zerver', '0002_django_1_8'),
]
operations = [
migrations.RunSQL("CREATE INDEX upper_subject_idx ON zerver_message ((upper(su... | Add remaining custom indexes that were created by South migrations | Add remaining custom indexes that were created by South migrations
(imported from commit 9798afa8161af4ae6b3fa0c5f4894a3211b77cd4)
| Python | apache-2.0 | punchagan/zulip,yocome/zulip,bluesea/zulip,armooo/zulip,zacps/zulip,vabs22/zulip,Juanvulcano/zulip,hj3938/zulip,zwily/zulip,grave-w-grave/zulip,dxq-git/zulip,LeeRisk/zulip,so0k/zulip,jerryge/zulip,technicalpickles/zulip,guiquanz/zulip,alliejones/zulip,firstblade/zulip,Drooids/zulip,xuanhan863/zulip,praveenaki/zulip,Aps... | <INSERT> # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
<INSERT_END> <INSERT> dependencies = [
('zerver', '0002_django_1_8'),
]
operations = [
migrations.RunSQL("CREATE INDEX upper_subject_id... | Add remaining custom indexes that were created by South migrations
(imported from commit 9798afa8161af4ae6b3fa0c5f4894a3211b77cd4)
| |
115a71995f2ceae667c05114da8e8ba21c25c402 | syncplay/__init__.py | syncplay/__init__.py | version = '1.6.5'
revision = ' release'
milestone = 'Yoitsu'
release_number = '86'
projectURL = 'https://syncplay.pl/'
| version = '1.6.6'
revision = ' development'
milestone = 'Yoitsu'
release_number = '87'
projectURL = 'https://syncplay.pl/'
| Move to 1.6.6 dev for further development | Move to 1.6.6 dev for further development | Python | apache-2.0 | alby128/syncplay,alby128/syncplay,Syncplay/syncplay,Syncplay/syncplay | <REPLACE_OLD> '1.6.5'
revision <REPLACE_NEW> '1.6.6'
revision <REPLACE_END> <REPLACE_OLD> release'
milestone <REPLACE_NEW> development'
milestone <REPLACE_END> <REPLACE_OLD> '86'
projectURL <REPLACE_NEW> '87'
projectURL <REPLACE_END> <|endoftext|> version = '1.6.6'
revision = ' development'
milestone = 'Yoitsu'
release... | Move to 1.6.6 dev for further development
version = '1.6.5'
revision = ' release'
milestone = 'Yoitsu'
release_number = '86'
projectURL = 'https://syncplay.pl/'
|
5d0be01926950fe4d693adec824aaed8495f3f65 | rnacentral/rnacentral/local_settings_default.py | rnacentral/rnacentral/local_settings_default.py | """
Copyright [2009-2014] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | """
Copyright [2009-2014] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | Set a maximum database connection age, works in django >= 1.6 | Set a maximum database connection age, works in django >= 1.6
| Python | apache-2.0 | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | <INSERT> 'CONN_MAX_AGE': 600,
<INSERT_END> <|endoftext|> """
Copyright [2009-2014] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apach... | Set a maximum database connection age, works in django >= 1.6
"""
Copyright [2009-2014] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.... |
998586b575149ae549b755067c831f8b066c1845 | digi/migrations/0002_theme_page_add_body_and_blog_category.py | digi/migrations/0002_theme_page_add_body_and_blog_category.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-04 11:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-04 11:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
... | Use exact version instead of latest in the migration dependencies | Use exact version instead of latest in the migration dependencies
Changed to use the latest migration of wagtail-blog v1.6.9.
Refs
https://github.com/thelabnyc/wagtail_blog/blob/5147d8129127102009c9bd63b1886e7665f6ccfb/blog/migrations/0005_auto_20151019_1121.py
| Python | mit | City-of-Helsinki/digihel,City-of-Helsinki/digihel,City-of-Helsinki/digihel,City-of-Helsinki/digihel | <REPLACE_OLD> '__latest__'),
<REPLACE_NEW> '0005_auto_20151019_1121'),
<REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-04 11:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import wagtail.wagtailcore.block... | Use exact version instead of latest in the migration dependencies
Changed to use the latest migration of wagtail-blog v1.6.9.
Refs
https://github.com/thelabnyc/wagtail_blog/blob/5147d8129127102009c9bd63b1886e7665f6ccfb/blog/migrations/0005_auto_20151019_1121.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on ... |
71088ebbed3f6060def0455814036185c70ba194 | shopify_auth/context_processors.py | shopify_auth/context_processors.py | import shopify
def current_shop(request):
if not shopify.ShopifyResource.site:
return {'current_shop': None}
return {'current_shop': shopify.Shop.current()} | from django.conf import settings
import shopify
def shopify_context(request):
return {
'shopify_current_shop': shopify.Shop.current() if shopify.ShopifyResource.site else None,
'shopify_app_api_key': settings.SHOPIFY_APP_API_KEY,
} | Rename `current_shop` context processor to `shopify_context`, and add a little more useful Shopify information. | Rename `current_shop` context processor to `shopify_context`, and add a little more useful Shopify information. | Python | mit | funkybob/django-shopify-auth,RafaAguilar/django-shopify-auth,discolabs/django-shopify-auth,RafaAguilar/django-shopify-auth,discolabs/django-shopify-auth,funkybob/django-shopify-auth | <INSERT> from django.conf <INSERT_END> <INSERT> settings
import <INSERT_END> <REPLACE_OLD> current_shop(request):
<REPLACE_NEW> shopify_context(request):
<REPLACE_END> <REPLACE_OLD> if not shopify.ShopifyResource.site:
<REPLACE_NEW> return {
<REPLACE_END> <REPLACE_OLD> return {'current_shop': None}
<REPLACE_NEW> '... | Rename `current_shop` context processor to `shopify_context`, and add a little more useful Shopify information.
import shopify
def current_shop(request):
if not shopify.ShopifyResource.site:
return {'current_shop': None}
return {'current_shop': shopify.Shop.current()} |
5b3a001af9ff992d061f880d6350292250fd8687 | apps/explorer/tests/test_views.py | apps/explorer/tests/test_views.py | from django.core.urlresolvers import reverse
from apps.core.factories import PIXELER_PASSWORD, PixelerFactory
from apps.core.tests import CoreFixturesTestCase
from apps.core.management.commands.make_development_fixtures import (
make_development_fixtures
)
class PixelSetListViewTestCase(CoreFixturesTestCase):
... | Add tests for the pixelset list view | Add tests for the pixelset list view
| Python | bsd-3-clause | Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel | <REPLACE_OLD> <REPLACE_NEW> from django.core.urlresolvers import reverse
from apps.core.factories import PIXELER_PASSWORD, PixelerFactory
from apps.core.tests import CoreFixturesTestCase
from apps.core.management.commands.make_development_fixtures import (
make_development_fixtures
)
class PixelSetListViewTestC... | Add tests for the pixelset list view
| |
ffbc35a0c19083a53a25aee71b74e06da0aa0a4b | timepiece/contracts/admin.py | timepiece/contracts/admin.py | from django.contrib import admin
from timepiece.contracts.models import ProjectContract, ContractHour,\
ContractAssignment, HourGroup
class ContractAssignmentInline(admin.TabularInline):
model = ContractAssignment
raw_id_fields = ('user',)
def queryset(self, request):
qs = super(Contract... | from django.contrib import admin
from timepiece.contracts.models import ProjectContract, ContractHour,\
ContractAssignment, HourGroup
class ContractAssignmentInline(admin.TabularInline):
model = ContractAssignment
raw_id_fields = ('user',)
def get_queryset(self, request):
qs = super(Cont... | Update Python/Django: Admin queryset -> get_queryset | Update Python/Django: Admin queryset -> get_queryset
| Python | mit | arbitrahj/django-timepiece,caktus/django-timepiece,caktus/django-timepiece,BocuStudio/django-timepiece,arbitrahj/django-timepiece,arbitrahj/django-timepiece,BocuStudio/django-timepiece,BocuStudio/django-timepiece,caktus/django-timepiece | <REPLACE_OLD> queryset(self, <REPLACE_NEW> get_queryset(self, <REPLACE_END> <REPLACE_OLD> self).queryset(request)
<REPLACE_NEW> self).get_queryset(request)
<REPLACE_END> <|endoftext|> from django.contrib import admin
from timepiece.contracts.models import ProjectContract, ContractHour,\
ContractAssignment, H... | Update Python/Django: Admin queryset -> get_queryset
from django.contrib import admin
from timepiece.contracts.models import ProjectContract, ContractHour,\
ContractAssignment, HourGroup
class ContractAssignmentInline(admin.TabularInline):
model = ContractAssignment
raw_id_fields = ('user',)
de... |
9310e94a1406102bba109416f781f9d6330d0028 | tests/test_itunes.py | tests/test_itunes.py | """
test_itunes.py
Copyright © 2015 Alex Danoff. All Rights Reserved.
2015-08-02
This file tests the functionality provided by the itunes module.
"""
import unittest
from datetime import datetime
from itunes.itunes import parse_value
class ITunesTests(unittest.TestCase):
"""
Test cases for iTunes functiona... | """
test_itunes.py
Copyright © 2015 Alex Danoff. All Rights Reserved.
2015-08-02
This file tests the functionality provided by the itunes module.
"""
import unittest
from datetime import datetime
from itunes.itunes import parse_value, run_applescript
from itunes.exceptions import AppleScriptError
class ITunesTests... | Add test to make sure `run_applescript` throws on bad script | Add test to make sure `run_applescript` throws on bad script
| Python | mit | adanoff/iTunesTUI | <REPLACE_OLD> parse_value
class <REPLACE_NEW> parse_value, run_applescript
from itunes.exceptions import AppleScriptError
class <REPLACE_END> <REPLACE_OLD> datetime.fromtimestamp(1268517742))
<REPLACE_NEW> datetime.fromtimestamp(1268517742))
def test_run_applescript(self):
self.assertRaises(AppleScriptE... | Add test to make sure `run_applescript` throws on bad script
"""
test_itunes.py
Copyright © 2015 Alex Danoff. All Rights Reserved.
2015-08-02
This file tests the functionality provided by the itunes module.
"""
import unittest
from datetime import datetime
from itunes.itunes import parse_value
class ITunesTests(u... |
45db81042b58c72da04193cdcdc6d400b5370c18 | convert_quotes_json_to_sqlite.py | convert_quotes_json_to_sqlite.py | #!/usr/bin/env python3
# Convert legacy JSON quotes format to SQLite3 format
# It non-destructively reads in "quotes.json"
# and writes out a new file "quotes.sqlite3".
# It will prompt if "quotes.sqlite3" exists
# and will ask if you want to merge the quotes.
# "quotes.sqlite3" modifications will not be committed un... | Add conversion script for quotes database | Add conversion script for quotes database
Figured I'd keep this around for a while just in case. Maybe remove it
in some future cleanup and declare the old format dead.
| Python | mit | TAOTheCrab/CrabBot | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python3
# Convert legacy JSON quotes format to SQLite3 format
# It non-destructively reads in "quotes.json"
# and writes out a new file "quotes.sqlite3".
# It will prompt if "quotes.sqlite3" exists
# and will ask if you want to merge the quotes.
# "quotes.sqlite3" modificat... | Add conversion script for quotes database
Figured I'd keep this around for a while just in case. Maybe remove it
in some future cleanup and declare the old format dead.
| |
1fd73a2c07ce66a8dba0ef08210612a2535538ea | jesusmtnez/python/koans/koans/about_decorating_with_functions.py | jesusmtnez/python/koans/koans/about_decorating_with_functions.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutDecoratingWithFunctions(Koan):
def addcowbell(fn):
fn.wow_factor = 'COWBELL BABY!'
return fn
@addcowbell
def mediocre_song(self):
return "o/~ We all live in a broken submarine o/~"
def test_de... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutDecoratingWithFunctions(Koan):
def addcowbell(fn):
fn.wow_factor = 'COWBELL BABY!'
return fn
@addcowbell
def mediocre_song(self):
return "o/~ We all live in a broken submarine o/~"
def test_de... | Complete 'About Decorating with functions' koans | [Python] Complete 'About Decorating with functions' koans
| Python | mit | JesusMtnez/devexperto-challenge,JesusMtnez/devexperto-challenge | <REPLACE_OLD> __)
<REPLACE_NEW> "o/~ We all live in a broken submarine o/~")
<REPLACE_END> <REPLACE_OLD> self.assertEqual(__, <REPLACE_NEW> self.assertEqual("COWBELL BABY!", <REPLACE_END> <REPLACE_OLD> self.assertEqual(__, <REPLACE_NEW> self.assertEqual("<llama/>", <REPLACE_END> <|endoftext|> #!/usr/bin/env python
# ... | [Python] Complete 'About Decorating with functions' koans
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutDecoratingWithFunctions(Koan):
def addcowbell(fn):
fn.wow_factor = 'COWBELL BABY!'
return fn
@addcowbell
def mediocre_song(self):
return "... |
1c231a8ef54af82d8ec03b828856ddac619fd345 | knights/compat/django.py | knights/compat/django.py | import ast
from knights.library import Library
register = Library()
@register.tag
def static(parser, token):
src = parser.parse_expression(token)
return ast.Yield(value=ast.BinOp(
left=ast.Str(s='/static/%s'),
op=ast.Mod(),
right=src,
))
@register.tag(name='include')
def do_inc... | import ast
from knights.library import Library
register = Library()
@register.tag
def static(parser, token):
src = parser.parse_expression(token)
return ast.Yield(value=ast.BinOp(
left=ast.Str(s='/static/%s'),
op=ast.Mod(),
right=src,
))
@register.tag(name='include')
def do_inc... | Add a dummy safe filter for Django compat | Add a dummy safe filter for Django compat
| Python | mit | funkybob/knights-templater,funkybob/knights-templater | <REPLACE_OLD> token))
<REPLACE_NEW> token))
@register.helper
def safe(value):
return str(value)
<REPLACE_END> <|endoftext|> import ast
from knights.library import Library
register = Library()
@register.tag
def static(parser, token):
src = parser.parse_expression(token)
return ast.Yield(value=ast.Bin... | Add a dummy safe filter for Django compat
import ast
from knights.library import Library
register = Library()
@register.tag
def static(parser, token):
src = parser.parse_expression(token)
return ast.Yield(value=ast.BinOp(
left=ast.Str(s='/static/%s'),
op=ast.Mod(),
right=src,
))... |
dd2d5e96672fc7870434f030ca63f6d7111642f9 | resources/launchers/alfanousDesktop.py | resources/launchers/alfanousDesktop.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import alfanousDesktop.Gui
alfanousDesktop.Gui.main()
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
# The paths should be generated by setup script
sys.argv.extend(
'-i', '/usr/share/alfanous-indexes/',
'-l', '/usr/locale/',
'-c', '/usr/share/alfanous-config/')
from alfanousDesktop.Gui import *
main()
| Add resource paths to python launcher script (proxy) | Add resource paths to python launcher script (proxy)
Former-commit-id: 7d20874c43637f1236442333f60a88ec653f53f2 | Python | agpl-3.0 | muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous | <REPLACE_OLD> alfanousDesktop.Gui
alfanousDesktop.Gui.main()
<REPLACE_NEW> sys
# The paths should be generated by setup script
sys.argv.extend(
'-i', '/usr/share/alfanous-indexes/',
'-l', '/usr/locale/',
'-c', '/usr/share/alfanous-config/')
from alfanousDesktop.Gui import *
main()
<REPLACE_END> <|endoftext|> #... | Add resource paths to python launcher script (proxy)
Former-commit-id: 7d20874c43637f1236442333f60a88ec653f53f2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import alfanousDesktop.Gui
alfanousDesktop.Gui.main()
|
3a2b536f24eee711a1329daf7403bd92840a87e3 | gpxpandas/gpxreader.py | gpxpandas/gpxreader.py | __author__ = 'max'
import gpxpy
import pandas as pd
def parse_gpx(gpx_file_name):
return gpxpy.parse(gpx_file_name)
def data_frame_for_track_segment(segment):
seg_dict = {}
for point in segment.points:
seg_dict[point.time] = [point.latitude, point.longitude,
poi... | __author__ = 'max'
import gpxpy
import pandas as pd
def parse_gpx(gpx_file_name):
return gpxpy.parse(gpx_file_name)
def data_frame_for_track_segment(segment):
seg_dict = {}
for point in segment.points:
seg_dict[point.time] = [point.latitude, point.longitude,
poi... | Use gpx.name as index to gpx data_frame | Use gpx.name as index to gpx data_frame
| Python | mit | komax/gpx-pandas | <INSERT> assert gpx.name
<INSERT_END> <REPLACE_OLD> tracks_frame.unstack() <REPLACE_NEW> pd.DataFrame({gpx.name:tracks_frame.unstack()}) <REPLACE_END> <|endoftext|> __author__ = 'max'
import gpxpy
import pandas as pd
def parse_gpx(gpx_file_name):
return gpxpy.parse(gpx_file_name)
def data_frame_for_track_s... | Use gpx.name as index to gpx data_frame
__author__ = 'max'
import gpxpy
import pandas as pd
def parse_gpx(gpx_file_name):
return gpxpy.parse(gpx_file_name)
def data_frame_for_track_segment(segment):
seg_dict = {}
for point in segment.points:
seg_dict[point.time] = [point.latitude, point.longi... |
0f3704a73ec54f015bff9a391d3a6dabc34368cd | palette/core/palette_selection.py | palette/core/palette_selection.py | # -*- coding: utf-8 -*-
## @package palette.core.palette_selection
#
# Implementation of automatic color palette selection.
# @author tody
# @date 2015/08/20
| # -*- coding: utf-8 -*-
## @package palette.core.palette_selection
#
# Implementation of automatic color palette selection.
# @author tody
# @date 2015/08/20
import os
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib.animation as animation
impo... | Add initial plaette selection code. | Add initial plaette selection code.
| Python | mit | tody411/PaletteSelection | <REPLACE_OLD> 2015/08/20
<REPLACE_NEW> 2015/08/20
import os
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import cv2
from palette.datasets.google_image import dataFile
from palette.cv.image import to32F
from palette.io_util.image ... | Add initial plaette selection code.
# -*- coding: utf-8 -*-
## @package palette.core.palette_selection
#
# Implementation of automatic color palette selection.
# @author tody
# @date 2015/08/20
|
a24b2b303c1cd5e9f43353d55cc6b9d07b37b7f4 | ephemeral-cluster.py | ephemeral-cluster.py | #!/usr/bin/env python
import subprocess
import sys
import uuid
usage = """\
Run a command using a temporary docker-compose cluster, removing all containers \
and images after command completion (regardless of success or failure.)
Generally, this would be used with the ``run`` command to provide a clean room \
testin... | #!/usr/bin/env python
import subprocess
import sys
import uuid
usage = """\
Run a command using a temporary docker-compose cluster, removing all containers \
and associated volumes after command completion (regardless of success or \
failure.)
Generally, this would be used with the ``run`` command to provide a clean... | Fix forwarding ephemeral cluster exit code. | Fix forwarding ephemeral cluster exit code.
Summary: Also improves logging a little bit.
Test Plan:
$ python ephemeral-cluster.py run --rm --entrypoint=bash pgshovel -c "exit 10"
$ test $? -eq 10
Reviewers: jeff, tail
Reviewed By: tail
Differential Revision: http://phabricator.local.disqus.net/D19564
| Python | apache-2.0 | fuziontech/pgshovel,disqus/pgshovel,fuziontech/pgshovel,fuziontech/pgshovel,disqus/pgshovel | <REPLACE_OLD> images <REPLACE_NEW> associated volumes <REPLACE_END> <REPLACE_OLD> failure.)
Generally, <REPLACE_NEW> \
failure.)
Generally, <REPLACE_END> <REPLACE_OLD> uuid.uuid1().hex
sys.stderr.write('Starting <REPLACE_NEW> uuid.uuid1().hex
sys.stderr.write('Setting up <REPLACE_END> <REPLACE_OLD> cluster: {0}\n'.fo... | Fix forwarding ephemeral cluster exit code.
Summary: Also improves logging a little bit.
Test Plan:
$ python ephemeral-cluster.py run --rm --entrypoint=bash pgshovel -c "exit 10"
$ test $? -eq 10
Reviewers: jeff, tail
Reviewed By: tail
Differential Revision: http://phabricator.local.disqus.net/D19564
#!/u... |
f69a2dc9530fef44e5b67d64496bcec9eceaf0e4 | config.py | config.py | import os
import datetime
register_title_api = os.environ['REGISTER_TITLE_API']
login_api = os.environ['LOGIN_API']
logging_config_file_path = os.environ['LOGGING_CONFIG_FILE_PATH']
google_analytics_api_key = os.environ['GOOGLE_ANALYTICS_API_KEY']
secret_key = os.environ['APPLICATION_SECRET_KEY']
session_cookie_secure... | import os
import datetime
register_title_api = os.environ['REGISTER_TITLE_API']
login_api = os.environ['LOGIN_API']
logging_config_file_path = os.environ['LOGGING_CONFIG_FILE_PATH']
google_analytics_api_key = os.environ['GOOGLE_ANALYTICS_API_KEY']
secret_key = os.environ['APPLICATION_SECRET_KEY']
session_cookie_secure... | Make the secure session cookie setting case-insensitive | Make the secure session cookie setting case-insensitive
| Python | mit | LandRegistry/digital-register-frontend,LandRegistry/digital-register-frontend,LandRegistry/digital-register-frontend,LandRegistry/digital-register-frontend | <REPLACE_OLD> os.environ['SESSION_COOKIE_SECURE'] <REPLACE_NEW> os.environ['SESSION_COOKIE_SECURE'].lower() <REPLACE_END> <REPLACE_OLD> 'False'
CONFIG_DICT <REPLACE_NEW> 'false'
CONFIG_DICT <REPLACE_END> <|endoftext|> import os
import datetime
register_title_api = os.environ['REGISTER_TITLE_API']
login_api = os.envi... | Make the secure session cookie setting case-insensitive
import os
import datetime
register_title_api = os.environ['REGISTER_TITLE_API']
login_api = os.environ['LOGIN_API']
logging_config_file_path = os.environ['LOGGING_CONFIG_FILE_PATH']
google_analytics_api_key = os.environ['GOOGLE_ANALYTICS_API_KEY']
secret_key = o... |
6adfd6ee8f673a601a3d118a45d21d2941b1e0aa | buildlet/utils/hashutils.py | buildlet/utils/hashutils.py | import hashlib
def hexdigest(strings):
m = hashlib.md5()
for s in strings:
m.update(s)
return m.hexdigest()
| import hashlib
def hexdigest(strings):
m = hashlib.md5()
for s in strings:
m.update(s.encode())
return m.hexdigest()
| Fix TypeError in Python 3 | Fix TypeError in Python 3
| Python | bsd-3-clause | tkf/buildlet | <REPLACE_OLD> m.update(s)
<REPLACE_NEW> m.update(s.encode())
<REPLACE_END> <|endoftext|> import hashlib
def hexdigest(strings):
m = hashlib.md5()
for s in strings:
m.update(s.encode())
return m.hexdigest()
| Fix TypeError in Python 3
import hashlib
def hexdigest(strings):
m = hashlib.md5()
for s in strings:
m.update(s)
return m.hexdigest()
|
5adaa6ec7b1c379d0fcbf7b488cc48e183739f0e | timed/tests/test_serializers.py | timed/tests/test_serializers.py | from datetime import timedelta
import pytest
from rest_framework_json_api.serializers import DurationField, IntegerField
from timed.serializers import PkDictSerializer
class MyPkDictSerializer(PkDictSerializer):
test_duration = DurationField()
test_nr = IntegerField()
class Meta:
pk_key = 'test... | Add unit test for pk dict serializer | Add unit test for pk dict serializer
| Python | agpl-3.0 | adfinis-sygroup/timed-backend,adfinis-sygroup/timed-backend,adfinis-sygroup/timed-backend | <REPLACE_OLD> <REPLACE_NEW> from datetime import timedelta
import pytest
from rest_framework_json_api.serializers import DurationField, IntegerField
from timed.serializers import PkDictSerializer
class MyPkDictSerializer(PkDictSerializer):
test_duration = DurationField()
test_nr = IntegerField()
class... | Add unit test for pk dict serializer
| |
cbd90060410108877d068913a4dfc681b81d6956 | galera_consistency.py | galera_consistency.py | import optparse
import subprocess
def table_checksum(user, password, host):
args = ['/usr/bin/pt-table-checksum', '-u', user, '-p', password]
if host:
args.extend(['-h', host])
proc = subprocess.Popen(args, stderr=subprocess.PIPE)
(out, err) = proc.communicate()
return (proc.return_code, ... | Use pt-table-checksum to check for galera consistency | Use pt-table-checksum to check for galera consistency
| Python | apache-2.0 | jpmontez/rpc-openstack,cfarquhar/rpc-maas,miguelgrinberg/rpc-openstack,xeregin/rpc-openstack,mancdaz/rpc-openstack,nrb/rpc-openstack,stevelle/rpc-openstack,claco/rpc-openstack,BjoernT/rpc-openstack,npawelek/rpc-maas,shannonmitchell/rpc-openstack,rcbops/rpc-openstack,robb-romans/rpc-openstack,mattt416/rpc-openstack,andy... | <INSERT> import optparse
import subprocess
def table_checksum(user, password, host):
<INSERT_END> <INSERT> args = ['/usr/bin/pt-table-checksum', '-u', user, '-p', password]
if host:
args.extend(['-h', host])
proc = subprocess.Popen(args, stderr=subprocess.PIPE)
(out, err) = proc.communicate()
... | Use pt-table-checksum to check for galera consistency
| |
3d2f19ff097cf144efd9135c52e4d584193f9ddb | tohu/v7/custom_generator/tohu_items_class.py | tohu/v7/custom_generator/tohu_items_class.py | import attr
__all__ = ["make_tohu_items_class"]
def make_tohu_items_class(clsname, field_names):
"""
Parameters
----------
clsname: string
Name of the class to be created.
field_names: list of strings
Names of the field attributes of the class to be created.
"""
item_cls ... | import attr
__all__ = ["make_tohu_items_class"]
def make_tohu_items_class(clsname, field_names):
"""
Parameters
----------
clsname: string
Name of the class to be created.
field_names: list of strings
Names of the field attributes of the class to be created.
"""
item_cls ... | Add attribute 'is_unset' so that the interface is consistent with MissingTohuItemsCls | Add attribute 'is_unset' so that the interface is consistent with MissingTohuItemsCls
| Python | mit | maxalbert/tohu | <INSERT> item_cls.is_unset = False
<INSERT_END> <|endoftext|> import attr
__all__ = ["make_tohu_items_class"]
def make_tohu_items_class(clsname, field_names):
"""
Parameters
----------
clsname: string
Name of the class to be created.
field_names: list of strings
Names of the ... | Add attribute 'is_unset' so that the interface is consistent with MissingTohuItemsCls
import attr
__all__ = ["make_tohu_items_class"]
def make_tohu_items_class(clsname, field_names):
"""
Parameters
----------
clsname: string
Name of the class to be created.
field_names: list of strings
... |
60edf2f1534e02a6da9aa715662a0e4ea8922191 | mk/get_config_dir.py | mk/get_config_dir.py | #!/usr/bin/env python
import os
component = os.getenv("COMPONENT")
if component == "ocaml":
print "/repos/xen-dist-ocaml.hg"
if component == "api-libs":
print "/repos/xen-api-libs-rpm-buildroot"
| #!/usr/bin/env python
import os
component = os.getenv("COMPONENT")
if component == "ocaml":
print "/repos/xen-dist-ocaml.hg"
if component == "api-libs":
print "/repos/xen-api-libs-specs"
| Change name of config repo for api-libs component | Change name of config repo for api-libs component
Signed-off-by: Jon Ludlam <e7e3380887a8f95cc9dc4f0d51dedc7e849a287a@eu.citrix.com>
| Python | lgpl-2.1 | simonjbeaumont/planex,jonludlam/planex,euanh/planex-cleanhistory,jonludlam/planex,djs55/planex,djs55/planex,djs55/planex,simonjbeaumont/planex,jonludlam/planex,euanh/planex-cleanhistory,euanh/planex-cleanhistory,simonjbeaumont/planex | <REPLACE_OLD> "/repos/xen-api-libs-rpm-buildroot"
<REPLACE_NEW> "/repos/xen-api-libs-specs"
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
import os
component = os.getenv("COMPONENT")
if component == "ocaml":
print "/repos/xen-dist-ocaml.hg"
if component == "api-libs":
print "/repos/xen-api-libs-specs... | Change name of config repo for api-libs component
Signed-off-by: Jon Ludlam <e7e3380887a8f95cc9dc4f0d51dedc7e849a287a@eu.citrix.com>
#!/usr/bin/env python
import os
component = os.getenv("COMPONENT")
if component == "ocaml":
print "/repos/xen-dist-ocaml.hg"
if component == "api-libs":
print "/repos/xen-api... |
2560ca287e81cbefb6037e5688bfa4ef74d85149 | clock.py | clock.py | from __future__ import print_function
from apscheduler.schedulers.blocking import BlockingScheduler
import logging
import subprocess
logging.basicConfig()
scheduler = BlockingScheduler()
@scheduler.scheduled_job('interval', minutes=1)
def timed_job_min1():
print("Run notifier")
subprocess.run(
"notif... | from __future__ import print_function
from apscheduler.schedulers.blocking import BlockingScheduler
import logging
import subprocess
logging.basicConfig()
scheduler = BlockingScheduler()
@scheduler.scheduled_job('interval', minutes=1)
def timed_job_min1():
print("Run notifier")
subprocess.check_call(
... | Change call method for Python2.7 | Change call method for Python2.7
| Python | mit | oinume/lekcije,oinume/dmm-eikaiwa-fft,oinume/lekcije,oinume/dmm-eikaiwa-fft,oinume/lekcije,oinume/dmm-eikaiwa-fft,oinume/lekcije,oinume/lekcije,oinume/lekcije,oinume/dmm-eikaiwa-fft | <REPLACE_OLD> subprocess.run(
<REPLACE_NEW> subprocess.check_call(
<REPLACE_END> <REPLACE_OLD> shell=True,
check=True)
# <REPLACE_NEW> shell=True)
# <REPLACE_END> <|endoftext|> from __future__ import print_function
from apscheduler.schedulers.blocking import BlockingScheduler
import logging
import subproc... | Change call method for Python2.7
from __future__ import print_function
from apscheduler.schedulers.blocking import BlockingScheduler
import logging
import subprocess
logging.basicConfig()
scheduler = BlockingScheduler()
@scheduler.scheduled_job('interval', minutes=1)
def timed_job_min1():
print("Run notifier")
... |
149c1257f4af4c6962c61e74bddbdddfcc741524 | cbagent/collectors/libstats/psstats.py | cbagent/collectors/libstats/psstats.py | from cbagent.collectors.libstats.remotestats import RemoteStats, parallel_task
class PSStats(RemoteStats):
METRICS = (
("rss", 1024), # kB -> B
("vsize", 1024),
)
PS_CMD = "ps -eo pid,rss,vsize,comm | " \
"grep {} | grep -v grep | sort -n -k 2 | tail -n 1"
TOP_CMD = "top ... | from cbagent.collectors.libstats.remotestats import RemoteStats, parallel_task
class PSStats(RemoteStats):
METRICS = (
("rss", 1024), # kB -> B
("vsize", 1024),
)
PS_CMD = "ps -eo pid,rss,vsize,comm | " \
"grep {} | grep -v grep | sort -n -k 2 | tail -n 1"
TOP_CMD = "top ... | Use more precise grep expression | Use more precise grep expression
Otherwise we match wrong lines when memory stats contain PID.
Change-Id: I924c1b151ddaad8209445a514bf02a7af5d2e0e0
Reviewed-on: http://review.couchbase.org/79848
Reviewed-by: Pavel Paulau <dd88eded64e90046a680e3a6c0828ceb8fe8a0e7@gmail.com>
Tested-by: Pavel Paulau <dd88eded64e90046a68... | Python | apache-2.0 | couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner | <REPLACE_OLD> {0}"
<REPLACE_NEW> ^{0}"
<REPLACE_END> <|endoftext|> from cbagent.collectors.libstats.remotestats import RemoteStats, parallel_task
class PSStats(RemoteStats):
METRICS = (
("rss", 1024), # kB -> B
("vsize", 1024),
)
PS_CMD = "ps -eo pid,rss,vsize,comm | " \
"... | Use more precise grep expression
Otherwise we match wrong lines when memory stats contain PID.
Change-Id: I924c1b151ddaad8209445a514bf02a7af5d2e0e0
Reviewed-on: http://review.couchbase.org/79848
Reviewed-by: Pavel Paulau <dd88eded64e90046a680e3a6c0828ceb8fe8a0e7@gmail.com>
Tested-by: Pavel Paulau <dd88eded64e90046a68... |
3ceb39e4bbc4c5de7cbcce9c1ecfe94daa57266e | zhihudaily/models.py | zhihudaily/models.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from peewee import Model, IntegerField, CharField
from zhihudaily.configs import Config
class BaseModel(Model):
class Meta:
database = Config.database
class Zhihudaily(BaseModel):
date = Integer... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from peewee import Model, IntegerField, CharField
from zhihudaily.configs import Config
class BaseModel(Model):
class Meta:
database = Config.database
class Zhihudaily(BaseModel):
date = Integer... | Fix bug when create the datebase table | Fix bug when create the datebase table
| Python | mit | lord63/zhihudaily,lord63/zhihudaily,lord63/zhihudaily | <REPLACE_OLD> database.connect()
<REPLACE_NEW> Config.database.connect()
<REPLACE_END> <REPLACE_OLD> database.create_tables([Zhihudaily])
<REPLACE_NEW> Config.database.create_tables([Zhihudaily])
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unico... | Fix bug when create the datebase table
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from peewee import Model, IntegerField, CharField
from zhihudaily.configs import Config
class BaseModel(Model):
class Meta:
database = Config.database
class Z... |
ab41dfa53325ee90032c4ed1b2e6e3c90b808ecf | contact/views.py | contact/views.py | import binascii
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messages
from django.db import IntegrityError, transaction
from django.conf import settings
from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.core.urlresolve... | import binascii
from django.shortcuts import render
from django.contrib import messages
from django.core.mail import send_mail
from contact.forms import ContactForm
# Create your views here.
def contact(request):
form_init = {
'username': request.user.username,
'ip_address': request.ME... | Clean up import, pre-fill email address | Clean up import, pre-fill email address
If user is logged in, their email address is automatically filled in for them.
Also fixed an error with the messages usage, namely I forgot to pass in the request object.
| Python | mit | Kromey/akwriters,Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters | <REPLACE_OLD> render, redirect, get_object_or_404
from <REPLACE_NEW> render
from <REPLACE_END> <DELETE> django.db import IntegrityError, transaction
from django.conf import settings
from django.template.loader import render_to_string
from <DELETE_END> <REPLACE_OLD> send_mail
from django.core.urlresolvers import reverse... | Clean up import, pre-fill email address
If user is logged in, their email address is automatically filled in for them.
Also fixed an error with the messages usage, namely I forgot to pass in the request object.
import binascii
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib imp... |
3c0ce6a3e4e16ff3991a838009c42efa2f5b237d | tviit/admin.py | tviit/admin.py | from django.contrib import admin
from .models import Tviit
admin.site.register(Tviit) | from django.contrib import admin
from .models import Tviit
class TviitAdmin(admin.ModelAdmin):
readonly_fields=('uuid',)
admin.site.register(Tviit, TviitAdmin) | Add uuid to be readable in Admin-panel | Add uuid to be readable in Admin-panel
| Python | mit | DeWaster/Tviserrys,DeWaster/Tviserrys | <REPLACE_OLD> Tviit
admin.site.register(Tviit) <REPLACE_NEW> Tviit
class TviitAdmin(admin.ModelAdmin):
readonly_fields=('uuid',)
admin.site.register(Tviit, TviitAdmin) <REPLACE_END> <|endoftext|> from django.contrib import admin
from .models import Tviit
class TviitAdmin(admin.ModelAdmin):
readonly_fields=(... | Add uuid to be readable in Admin-panel
from django.contrib import admin
from .models import Tviit
admin.site.register(Tviit) |
d47abe23bf1c88520ee6ecf954dadaae42142366 | src/engine/SCons/Tool/javacTests.py | src/engine/SCons/Tool/javacTests.py | #
# __COPYRIGHT__
#
# 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 restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicen... | Add unit tests for SCons.Tool.javac (pathopt class only). This carefully avoids known bugs in order to have passing tests. | Add unit tests for SCons.Tool.javac (pathopt class only).
This carefully avoids known bugs in order to have passing tests.
| Python | mit | Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons | <REPLACE_OLD> <REPLACE_NEW> #
# __COPYRIGHT__
#
# 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 restriction, including
# without limitation the rights to use, copy, modify, merge, pu... | Add unit tests for SCons.Tool.javac (pathopt class only).
This carefully avoids known bugs in order to have passing tests.
| |
f9c7a911411429972929bb4372b370192bd4cf8a | altair/examples/interactive_layered_crossfilter.py | altair/examples/interactive_layered_crossfilter.py | """
Interactive Crossfilter
=======================
This example shows a multi-panel view of the same data, where you can interactively
select a portion of the data in any of the panels to highlight that portion in any
of the other panels.
"""
# category: interactive charts
import altair as alt
from vega_datasets impor... | """
Interactive Crossfilter
=======================
This example shows a multi-panel view of the same data, where you can interactively
select a portion of the data in any of the panels to highlight that portion in any
of the other panels.
"""
# category: interactive charts
import altair as alt
from vega_datasets impor... | Update crossfilter to gray/blue scheme | Update crossfilter to gray/blue scheme
Same as in https://vega.github.io/editor/#/examples/vega-lite/interactive_layered_crossfilter | Python | bsd-3-clause | altair-viz/altair,jakevdp/altair | <REPLACE_OLD> blue <REPLACE_NEW> gray <REPLACE_END> <REPLACE_OLD> base.add_selection(brush)
# yellow <REPLACE_NEW> base.encode(
color=alt.value('#ddd')
).add_selection(brush)
# blue <REPLACE_END> <REPLACE_OLD> base.encode(
color=alt.value('goldenrod')
).transform_filter(brush)
# <REPLACE_NEW> base.transform_... | Update crossfilter to gray/blue scheme
Same as in https://vega.github.io/editor/#/examples/vega-lite/interactive_layered_crossfilter
"""
Interactive Crossfilter
=======================
This example shows a multi-panel view of the same data, where you can interactively
select a portion of the data in any of the panels ... |
2efe1364a1e37f06dc26f1a3a122c544437d914e | collector/classes/service.py | collector/classes/service.py | # -*- coding: utf-8 -*-
import string
def sanitise_string(messy_str):
"""Whitelist characters in a string"""
valid_chars = ' {0}{1}'.format(string.ascii_letters, string.digits)
return u''.join(char for char in messy_str if char in valid_chars).strip()
class Service(object):
def __init__(self, numeri... | # -*- coding: utf-8 -*-
import string
def sanitise_string(messy_str):
"""Whitelist characters in a string"""
valid_chars = ' {0}{1}'.format(string.ascii_letters, string.digits)
return u''.join(char for char in messy_str if char in valid_chars).strip()
class Service(object):
def __init__(self, numeri... | Add log message if data we can't parse appears | Add log message if data we can't parse appears
If the datum isn't numeric and doesn't match the 'no data' pattern,
something has gone horribly wrong.
| Python | mit | alphagov/backdrop-transactions-explorer-collector,alphagov/backdrop-transactions-explorer-collector | <INSERT> print "Data from the spreadsheet doesn't look numeric: <{0}> (from {1})".format(datum, self.identifier())
<INSERT_END> <|endoftext|> # -*- coding: utf-8 -*-
import string
def sanitise_string(messy_str):
"""Whitelist characters in a string"""
valid_chars = ' {0}{1}'.format(string.ascii_let... | Add log message if data we can't parse appears
If the datum isn't numeric and doesn't match the 'no data' pattern,
something has gone horribly wrong.
# -*- coding: utf-8 -*-
import string
def sanitise_string(messy_str):
"""Whitelist characters in a string"""
valid_chars = ' {0}{1}'.format(string.ascii_lette... |
85f8d0662901047115f2d852489a3a5be1a01226 | datafilters/views.py | datafilters/views.py | try:
from django.views.generic.base import ContextMixin as mixin_base
except ImportError:
mixin_base = object
__all__ = ('FilterFormMixin',)
class FilterFormMixin(mixin_base):
"""
Mixin that adds filtering behaviour for Class Based Views.
Changed in a way that can play nicely with other CBV simpl... | from django.views.generic.list import MultipleObjectMixin
__all__ = ('FilterFormMixin',)
class FilterFormMixin(MultipleObjectMixin):
"""
Mixin that adds filtering behaviour for Class Based Views.
Changed in a way that can play nicely with other CBV simply by overriding the get_queryset(self) and
get_... | Set base class for view mixin to MultipleObjectMixin | Set base class for view mixin to MultipleObjectMixin
| Python | mit | freevoid/django-datafilters,zorainc/django-datafilters,zorainc/django-datafilters | <DELETE> try:
<DELETE_END> <REPLACE_OLD> django.views.generic.base <REPLACE_NEW> django.views.generic.list <REPLACE_END> <REPLACE_OLD> ContextMixin as mixin_base
except ImportError:
mixin_base = object
__all__ <REPLACE_NEW> MultipleObjectMixin
__all__ <REPLACE_END> <REPLACE_OLD> FilterFormMixin(mixin_base):
... | Set base class for view mixin to MultipleObjectMixin
try:
from django.views.generic.base import ContextMixin as mixin_base
except ImportError:
mixin_base = object
__all__ = ('FilterFormMixin',)
class FilterFormMixin(mixin_base):
"""
Mixin that adds filtering behaviour for Class Based Views.
Chan... |
8fb8a77dcad4aa657b7ddb637459a6279a21755e | alexandria/drivers.py | alexandria/drivers.py | # coding=utf-8
import types
import config
class Driver(object):
def __init__(self):
self.driver_type = self.__class__.__name__
# Get credentials from conf files for CMDB
pass
def get_driver_type(self):
return self.driver_type
def get_ci(self,ci):
pass
d... | # coding=utf-8
import types
import pprint
import config
class Driver(object):
def __init__(self):
self.driver_type = self.__class__.__name__
# Get credentials from conf files for CMDB
pass
def get_driver_type(self):
return self.driver_type
def get_ci(self,ci):
... | Copy reference object example. This commit is just implemented to validate the medhod. But this is not conveniant, because reference models must not be changed. So next step is to make them private attributes. | Copy reference object example.
This commit is just implemented to validate the medhod.
But this is not conveniant, because reference models must not be
changed.
So next step is to make them private attributes.
| Python | apache-2.0 | sl4shme/alexandria,sl4shme/alexandria,sl4shme/alexandria,uggla/alexandria | <INSERT> pprint
import <INSERT_END> <REPLACE_OLD> config.alexandria.model.Manager
class <REPLACE_NEW> config.alexandria.model.Manager.copy()
if ci.data is config.alexandria.model.Manager:
print "identical"
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(ci.data)
c... | Copy reference object example.
This commit is just implemented to validate the medhod.
But this is not conveniant, because reference models must not be
changed.
So next step is to make them private attributes.
# coding=utf-8
import types
import config
class Driver(object):
def __init__(self):
self.driv... |
dfcac1268a46a879cb1c387fa8b33f450860038c | setup.py | setup.py | import os
import sys
import setuptools
if sys.version_info[0] < 3:
from codecs import open
def local_file(name):
return os.path.relpath(os.path.join(os.path.dirname(__file__), name))
README = local_file("README.rst")
with open(local_file("src/stratis_cli/_version.py")) as o:
exec(o.read())
setuptool... | import os
import sys
import setuptools
if sys.version_info[0] < 3:
from codecs import open
def local_file(name):
return os.path.relpath(os.path.join(os.path.dirname(__file__), name))
README = local_file("README.rst")
with open(local_file("src/stratis_cli/_version.py")) as o:
exec(o.read())
setuptool... | Make stratis an installable script. | Make stratis an installable script.
Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
| Python | apache-2.0 | stratis-storage/stratis-cli,stratis-storage/stratis-cli | <INSERT> scripts=['bin/stratis']
<INSERT_END> <|endoftext|> import os
import sys
import setuptools
if sys.version_info[0] < 3:
from codecs import open
def local_file(name):
return os.path.relpath(os.path.join(os.path.dirname(__file__), name))
README = local_file("README.rst")
with open(local_file("src/st... | Make stratis an installable script.
Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
import os
import sys
import setuptools
if sys.version_info[0] < 3:
from codecs import open
def local_file(name):
return os.path.relpath(os.path.join(os.path.dirname(__file__), name))
README = loc... |
054b0bf9cacef4e55fb8167fb5f2611e2ce39b43 | hw3/hw3_2a.py | hw3/hw3_2a.py | import sympy
x1, x2 = sympy.symbols('x1 x2')
f = 100*(x2 - x1**2)**2 + (1-x1)**2
df_dx1 = sympy.diff(f,x1)
df_dx2 = sympy.diff(f,x2)
H = sympy.hessian(f, (x1, x2))
xs = sympy.solve([df_dx1, df_dx2], [x1, x2])
H_xs = H.subs([(x1,xs[0][0]), (x2,xs[0][1])])
flag = True
for i in H_xs.eigenvals().keys():
if i.evalf... | import sympy
x1, x2 = sympy.symbols('x1 x2')
f = 100*(x2 - x1**2)**2 + (1-x1)**2
df_dx1 = sympy.diff(f,x1)
df_dx2 = sympy.diff(f,x2)
H = sympy.hessian(f, (x1, x2))
xs = sympy.solve([df_dx1, df_dx2], [x1, x2])
H_xs = H.subs([(x1,xs[0][0]), (x2,xs[0][1])])
lambda_xs = H_xs.eigenvals()
count = 0
for i in lambda_xs.ke... | Fix decision about minima, maxima and saddle point | Fix decision about minima, maxima and saddle point
| Python | bsd-2-clause | escorciav/amcs211,escorciav/amcs211 | <REPLACE_OLD> (x2,xs[0][1])])
flag <REPLACE_NEW> (x2,xs[0][1])])
lambda_xs <REPLACE_END> <REPLACE_OLD> True
for <REPLACE_NEW> H_xs.eigenvals()
count = 0
for <REPLACE_END> <REPLACE_OLD> H_xs.eigenvals().keys():
<REPLACE_NEW> lambda_xs.keys():
<REPLACE_END> <REPLACE_OLD> flag = False
break
if flag:
<REPLACE... | Fix decision about minima, maxima and saddle point
import sympy
x1, x2 = sympy.symbols('x1 x2')
f = 100*(x2 - x1**2)**2 + (1-x1)**2
df_dx1 = sympy.diff(f,x1)
df_dx2 = sympy.diff(f,x2)
H = sympy.hessian(f, (x1, x2))
xs = sympy.solve([df_dx1, df_dx2], [x1, x2])
H_xs = H.subs([(x1,xs[0][0]), (x2,xs[0][1])])
flag = T... |
ea48f0fbe09fbcce843b6d380743ee65a31aa8f8 | app/evolver.py | app/evolver.py | import app.selector as selector
import app.applier as applier
from app.rules import rules
def rule_representation(rule):
'''Takes a Rule and returns a list of strings which represent it, in the
form [name, target, replacement, environment]'''
return [rule.name, rule.target, rule.replacement, rule.environ... | import app.selector as selector
import app.applier as applier
from app.rules import rules
def rule_representation(rule):
'''Takes a Rule and returns a list of strings which represent it, in the
form [name, target, replacement, environment]'''
return [rule.name, rule.target, rule.replacement, rule.environ... | Add transcription to and from IPA | Add transcription to and from IPA
| Python | mit | kdelwat/LangEvolve,kdelwat/LangEvolve,kdelwat/LangEvolve | <INSERT> rewrite(words, rewrite_rules, to='ipa'):
'''Rewrite a list of words according to a list of tuple rules of form
(plain, ipa), in direction given by target.'''
modified = []
for word in words:
for rule in rewrite_rules:
if to == 'ipa':
word = word.replace(rule... | Add transcription to and from IPA
import app.selector as selector
import app.applier as applier
from app.rules import rules
def rule_representation(rule):
'''Takes a Rule and returns a list of strings which represent it, in the
form [name, target, replacement, environment]'''
return [rule.name, rule.tar... |
2ca3f28b4423fc8ecd19591a039b7a5c814ab25b | webserver/codemanagement/validators.py | webserver/codemanagement/validators.py | from django.core.validators import RegexValidator
sha1_validator = RegexValidator(regex="^[a-f0-9]{40}$",
message="Must be valid sha1 sum")
tag_validator = RegexValidator(regex="^[A-Za-z][\w\-\.]+[A-Za-z]$",
message="Must be letters and numbers" +
... | from django.core.validators import RegexValidator
from django.core.exceptions import ValidationError
from dulwich.repo import check_ref_format
import re
sha1_validator = RegexValidator(regex="^[a-f0-9]{40}$",
message="Must be valid sha1 sum")
tag_regex = re.compile(r'^[A-Za-z][\w\-\.]+... | Make dulwich check the tag. | Make dulwich check the tag.
| Python | bsd-3-clause | siggame/webserver,siggame/webserver,siggame/webserver | <REPLACE_OLD> RegexValidator
sha1_validator <REPLACE_NEW> RegexValidator
from django.core.exceptions import ValidationError
from dulwich.repo import check_ref_format
import re
sha1_validator <REPLACE_END> <REPLACE_OLD> sum")
tag_validator <REPLACE_NEW> sum")
tag_regex <REPLACE_END> <REPLACE_OLD> RegexValidator(regex... | Make dulwich check the tag.
from django.core.validators import RegexValidator
sha1_validator = RegexValidator(regex="^[a-f0-9]{40}$",
message="Must be valid sha1 sum")
tag_validator = RegexValidator(regex="^[A-Za-z][\w\-\.]+[A-Za-z]$",
message="Must be le... |
310a7fd5024e49f82504410bf40647b7c8d14207 | tricircle/tests/unit/common/test_utils.py | tricircle/tests/unit/common/test_utils.py |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# 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... | Add utils's check_string_length test case | Add utils's check_string_length test case
1. What is the problem
Tricircle does not have utils module's test case
2. What is the solution to the problem
Implement related test case
3. What the features need to be implemented to the Tricircle
No new features
Change-Id: I42e54cfe310349578ae0605789249acbc349f5e4
| Python | apache-2.0 | stackforge/tricircle,openstack/tricircle,openstack/tricircle,stackforge/tricircle | <REPLACE_OLD> <REPLACE_NEW>
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the L... | Add utils's check_string_length test case
1. What is the problem
Tricircle does not have utils module's test case
2. What is the solution to the problem
Implement related test case
3. What the features need to be implemented to the Tricircle
No new features
Change-Id: I42e54cfe310349578ae0605789249acbc349f5e4
| |
d9024e4db0489b141fec9b96913c94a5d583f086 | backend/scripts/mktemplate.py | backend/scripts/mktemplate.py | #!/usr/bin/env python
import json
import rethinkdb as r
import sys
import optparse
if __name__ == "__main__":
parser = optparse.OptionParser()
parser.add_option("-p", "--port", dest="port",
help="rethinkdb port", default=30815)
parser.add_option("-f", "--file", dest="filename",
... | #!/usr/bin/env python
import json
import rethinkdb as r
import sys
import optparse
if __name__ == "__main__":
parser = optparse.OptionParser()
parser.add_option("-p", "--port", dest="port",
help="rethinkdb port", default=30815)
parser.add_option("-f", "--file", dest="filename",
... | Update script to show which file it is loading. | Update script to show which file it is loading.
| Python | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | <INSERT> print "Loading template file: %s" % (options.filename)
<INSERT_END> <|endoftext|> #!/usr/bin/env python
import json
import rethinkdb as r
import sys
import optparse
if __name__ == "__main__":
parser = optparse.OptionParser()
parser.add_option("-p", "--port", dest="port",
hel... | Update script to show which file it is loading.
#!/usr/bin/env python
import json
import rethinkdb as r
import sys
import optparse
if __name__ == "__main__":
parser = optparse.OptionParser()
parser.add_option("-p", "--port", dest="port",
help="rethinkdb port", default=30815)
parser.... |
f325b02c66810cff9e3ace8b31e7f3a7b410342f | awx/wsgi.py | awx/wsgi.py | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import logging
from django.core.wsgi import get_wsgi_application
from awx import prepare_env
from awx import __version__ as tower_version
"""
WSGI config for AWX project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more... | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import logging
from awx import __version__ as tower_version
# Prepare the AWX environment.
from awx import prepare_env
prepare_env()
from django.core.wsgi import get_wsgi_application
"""
WSGI config for AWX project.
It exposes the WSGI callable as a module-... | Fix import error by calling prepare_env first | Fix import error by calling prepare_env first
| Python | apache-2.0 | wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,snahelou/awx,wwitzel3/awx,snahelou/awx | <DELETE> django.core.wsgi import get_wsgi_application
from awx import prepare_env
from <DELETE_END> <REPLACE_OLD> tower_version
"""
WSGI <REPLACE_NEW> tower_version
# Prepare the AWX environment.
from awx import prepare_env
prepare_env()
from django.core.wsgi import get_wsgi_application
"""
WSGI <REPLACE_END> <REPL... | Fix import error by calling prepare_env first
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import logging
from django.core.wsgi import get_wsgi_application
from awx import prepare_env
from awx import __version__ as tower_version
"""
WSGI config for AWX project.
It exposes the WSGI callable as a module-... |
5dd5d4e6ac93ad3867f98bd35412de11dd6b1dc2 | tests/test_generalwords.py | tests/test_generalwords.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_generalwords
----------------------------------
All the tests for the generalword module. Simple module, simple tests.
"""
import unittest
from generalwords import get_word
class TestGeneralwords(unittest.TestCase):
def setUp(self):
pass
def ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_generalwords
----------------------------------
All the tests for the generalword module. Simple module, simple tests.
"""
import unittest
from generalwords import get_word
class TestGeneralwords(unittest.TestCase):
def setUp(self):
pass
def ... | Remove set-comprehensions so that tests will pass on 2.6 | Remove set-comprehensions so that tests will pass on 2.6
| Python | bsd-3-clause | petrilli/generalwords | <REPLACE_OLD> {get_word() <REPLACE_NEW> set(get_word() <REPLACE_END> <REPLACE_OLD> range(sample_size)}
<REPLACE_NEW> range(sample_size))
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_generalwords
----------------------------------
All the tests for the generalword module. Simple... | Remove set-comprehensions so that tests will pass on 2.6
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_generalwords
----------------------------------
All the tests for the generalword module. Simple module, simple tests.
"""
import unittest
from generalwords import get_word
class TestGeneralwords(unitt... |
7e166ba983bd1470f6eac6776107a64539c38581 | animal_spharm/test/test_animal_spharm.py | animal_spharm/test/test_animal_spharm.py | import numpy as np
import pytest
import xray
from aospy_user import SpharmInterface
@pytest.fixture
def compute_vrtdiv(u, v):
sphint = SpharmInterface(u, v)
sphint.make_vectorwind()
sphint.make_spharmt()
vort, divg = sphint.vectorwind.vrtdiv()
return sphint.to_xray(vort), sphint.to_xray(divg)
... | Copy over tests from aospy-obj-lib | Copy over tests from aospy-obj-lib
| Python | apache-2.0 | spencerahill/animal-spharm | <REPLACE_OLD> <REPLACE_NEW> import numpy as np
import pytest
import xray
from aospy_user import SpharmInterface
@pytest.fixture
def compute_vrtdiv(u, v):
sphint = SpharmInterface(u, v)
sphint.make_vectorwind()
sphint.make_spharmt()
vort, divg = sphint.vectorwind.vrtdiv()
return sphint.to_xray(v... | Copy over tests from aospy-obj-lib
| |
a0392d693c238cb4548fa6aa2b7f10b6c818b648 | currencies/utils.py | currencies/utils.py | from decimal import *
from django.conf import settings
from currencies.models import Currency
def calculate_price(price, currency):
try:
factor = Currency.objects.get(code__exact=currency).factor
except Currency.DoesNotExist:
if settings.DEBUG:
raise Currency.DoesNotExist
e... | from decimal import *
from django.conf import settings
from currencies.models import Currency
def calculate_price(price, currency):
try:
factor = Currency.objects.get(code__exact=currency).factor
except Currency.DoesNotExist:
if settings.DEBUG:
raise
else:
facto... | Simplify a raise in debug mode | Simplify a raise in debug mode
| Python | bsd-3-clause | marcosalcazar/django-currencies,jmp0xf/django-currencies,bashu/django-simple-currencies,mysociety/django-currencies,mysociety/django-currencies,racitup/django-currencies,panosl/django-currencies,ydaniv/django-currencies,pathakamit88/django-currencies,marcosalcazar/django-currencies,racitup/django-currencies,bashu/djang... | <REPLACE_OLD> raise Currency.DoesNotExist
<REPLACE_NEW> raise
<REPLACE_END> <|endoftext|> from decimal import *
from django.conf import settings
from currencies.models import Currency
def calculate_price(price, currency):
try:
factor = Currency.objects.get(code__exact=currency).factor
except Currenc... | Simplify a raise in debug mode
from decimal import *
from django.conf import settings
from currencies.models import Currency
def calculate_price(price, currency):
try:
factor = Currency.objects.get(code__exact=currency).factor
except Currency.DoesNotExist:
if settings.DEBUG:
raise... |
cbf4d85092232051cd7643d74e003b86f24ba571 | feincms/templatetags/feincms_admin_tags.py | feincms/templatetags/feincms_admin_tags.py | from django import template
register = template.Library()
@register.filter
def post_process_fieldsets(fieldset):
"""
Removes a few fields from FeinCMS admin inlines, those being
``id``, ``DELETE`` and ``ORDER`` currently.
"""
process = fieldset.model_admin.verbose_name_plural.startswith('Feincm... | from django import template
register = template.Library()
@register.filter
def post_process_fieldsets(fieldset):
"""
Removes a few fields from FeinCMS admin inlines, those being
``id``, ``DELETE`` and ``ORDER`` currently.
"""
excluded_fields = ('id', 'DELETE', 'ORDER')
fieldset.fields = [f ... | Fix post_process_fieldsets: This filter is only called for FeinCMS inlines anyway | Fix post_process_fieldsets: This filter is only called for FeinCMS inlines anyway
Thanks to mjl for the report and help in fixing the issue.
| Python | bsd-3-clause | matthiask/django-content-editor,matthiask/feincms2-content,joshuajonah/feincms,matthiask/feincms2-content,matthiask/django-content-editor,mjl/feincms,feincms/feincms,nickburlett/feincms,mjl/feincms,nickburlett/feincms,feincms/feincms,pjdelport/feincms,pjdelport/feincms,mjl/feincms,nickburlett/feincms,michaelkuty/feincm... | <DELETE> process = fieldset.model_admin.verbose_name_plural.startswith('Feincms_Inline:')
if process:
# Exclude special fields and the primary key
<DELETE_END> <DELETE> <DELETE_END> <|endoftext|> from django import template
register = template.Library()
@register.filter
def post_process_fiel... | Fix post_process_fieldsets: This filter is only called for FeinCMS inlines anyway
Thanks to mjl for the report and help in fixing the issue.
from django import template
register = template.Library()
@register.filter
def post_process_fieldsets(fieldset):
"""
Removes a few fields from FeinCMS admin inlines,... |
223b58cb0f9c63543a4d23f75db4450ce93ab86d | readthedocs/builds/forms.py | readthedocs/builds/forms.py | import logging
from django import forms
from readthedocs.builds.models import VersionAlias, Version
from readthedocs.core.utils import trigger_build
from readthedocs.projects.models import Project
from readthedocs.projects.tasks import clear_artifacts
log = logging.getLogger(__name__)
class AliasForm(forms.ModelF... | import logging
from django import forms
from readthedocs.builds.models import VersionAlias, Version
from readthedocs.core.utils import trigger_build
from readthedocs.projects.models import Project
from readthedocs.projects.tasks import clear_artifacts
log = logging.getLogger(__name__)
class AliasForm(forms.ModelF... | Handle built state tracking on versions | Handle built state tracking on versions | Python | mit | espdev/readthedocs.org,pombredanne/readthedocs.org,espdev/readthedocs.org,stevepiercy/readthedocs.org,rtfd/readthedocs.org,davidfischer/readthedocs.org,istresearch/readthedocs.org,davidfischer/readthedocs.org,rtfd/readthedocs.org,safwanrahman/readthedocs.org,davidfischer/readthedocs.org,rtfd/readthedocs.org,tddv/readth... | <REPLACE_OLD> clear_artifacts.delay(version_pk=[self.instance.pk])
<REPLACE_NEW> clear_artifacts.delay(version_pk=self.instance.pk)
self.instance.built = False
<REPLACE_END> <|endoftext|> import logging
from django import forms
from readthedocs.builds.models import VersionAlias, Version
from readthe... | Handle built state tracking on versions
import logging
from django import forms
from readthedocs.builds.models import VersionAlias, Version
from readthedocs.core.utils import trigger_build
from readthedocs.projects.models import Project
from readthedocs.projects.tasks import clear_artifacts
log = logging.getLogger(... |
0527cea9db518b5b8fb63fe2bb3792a806fa421d | src/python/setup.py | src/python/setup.py | __author__ = 'tom'
from setuptools import setup
# Makes use of the sphinx and sphinx-pypi-upload packages. To build for local development
# use 'python setup.py develop'. To upload a version to pypi use 'python setup.py clean sdist upload'.
# To build docs use 'python setup.py build_sphinx' and to upload docs to pytho... | __author__ = 'tom'
from setuptools import setup
# Makes use of the sphinx and sphinx-pypi-upload packages. To build for local development
# use 'python setup.py develop'. To upload a version to pypi use 'python setup.py clean sdist upload'.
# To build docs use 'python setup.py build_sphinx' and to upload docs to pytho... | Change to use evdev 0.6.4 | Change to use evdev 0.6.4
Signed-off-by: tom <3abfbc22eec6ecd173d744487905db1fa6a502d5@gmail.com>
| Python | apache-2.0 | ApproxEng/approxeng.input | <REPLACE_OLD> install_requires=['evdev==0.5.0'],
<REPLACE_NEW> install_requires=['evdev==0.6.4'],
<REPLACE_END> <|endoftext|> __author__ = 'tom'
from setuptools import setup
# Makes use of the sphinx and sphinx-pypi-upload packages. To build for local development
# use 'python setup.py develop'. To upload a version ... | Change to use evdev 0.6.4
Signed-off-by: tom <3abfbc22eec6ecd173d744487905db1fa6a502d5@gmail.com>
__author__ = 'tom'
from setuptools import setup
# Makes use of the sphinx and sphinx-pypi-upload packages. To build for local development
# use 'python setup.py develop'. To upload a version to pypi use 'python setup.py... |
ae600fdf602d12f1a2f8082df49693117fba2596 | test/test_cxx_imports.py | test/test_cxx_imports.py | def test_cxx_import():
from microscopes.mixture.model import \
state, fixed_state, \
bind, bind_fixed, \
initialize, initialize_fixed, \
deserialize, deserialize_fixed
assert state and fixed_state
assert bind and bind_fixed
assert initialize and initialize_fixed
asser... | def test_cxx_import():
from microscopes.mixture.model import \
state, \
bind, \
initialize, \
deserialize
assert state
assert bind
assert initialize
assert deserialize
| Remove fixed references from test_cxx.py | Remove fixed references from test_cxx.py
| Python | bsd-3-clause | datamicroscopes/mixturemodel,datamicroscopes/mixturemodel,datamicroscopes/mixturemodel | <DELETE> fixed_state, <DELETE_END> <DELETE> bind_fixed, <DELETE_END> <DELETE> initialize_fixed, <DELETE_END> <REPLACE_OLD> deserialize, deserialize_fixed
<REPLACE_NEW> deserialize
<REPLACE_END> <REPLACE_OLD> state and fixed_state
<REPLACE_NEW> state
<REPLACE_END> <REPLACE_OLD> bind and bind_fixed
<REPLACE_NEW> bin... | Remove fixed references from test_cxx.py
def test_cxx_import():
from microscopes.mixture.model import \
state, fixed_state, \
bind, bind_fixed, \
initialize, initialize_fixed, \
deserialize, deserialize_fixed
assert state and fixed_state
assert bind and bind_fixed
assert... |
0f40869157ef56df0ff306fb510be4401b5cbe5d | test/low_level/test_frame_identifiers.py | test/low_level/test_frame_identifiers.py | import inspect
from pyinstrument.low_level import stat_profile as stat_profile_c
from pyinstrument.low_level import stat_profile_python
class AClass:
def get_frame_identfier_for_a_method(self, getter_function):
frame = inspect.currentframe()
assert frame
return getter_function(frame)
... | import inspect
from pyinstrument.low_level import stat_profile as stat_profile_c
from pyinstrument.low_level import stat_profile_python
class AClass:
def get_frame_identifier_for_a_method(self, getter_function):
frame = inspect.currentframe()
assert frame
return getter_function(frame)
... | Add test for a cell variable | Add test for a cell variable
| Python | bsd-3-clause | joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument | <REPLACE_OLD> get_frame_identfier_for_a_method(self, <REPLACE_NEW> get_frame_identifier_for_a_method(self, <REPLACE_END> <INSERT> def get_frame_identifier_with_cell_variable(self, getter_function):
frame = inspect.currentframe()
assert frame
def an_inner_function():
# reference self... | Add test for a cell variable
import inspect
from pyinstrument.low_level import stat_profile as stat_profile_c
from pyinstrument.low_level import stat_profile_python
class AClass:
def get_frame_identfier_for_a_method(self, getter_function):
frame = inspect.currentframe()
assert frame
retu... |
0983715cd2ee4eb3ac411e1ff24fa2e49df54eb5 | src/manage.py | src/manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
# Browsers doesn't use content negotiation using ETags with HTTP 1.0 servers
# Force Django to use HTTP 1.1 when using the runserver command
from wsgiref import simple_server
simple_server.ServerHandler.http_version = "1.1"
os.... | Allow to tests ETags when using the runserver command | Allow to tests ETags when using the runserver command
| Python | agpl-3.0 | jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud | <INSERT> # Browsers doesn't use content negotiation using ETags with HTTP 1.0 servers
# Force Django to use HTTP 1.1 when using the runserver command
from wsgiref import simple_server
simple_server.ServerHandler.http_version = "1.1"
<INSERT_END> <|endoftext|> #!/usr/bin/env python
import os
import sys
... | Allow to tests ETags when using the runserver command
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
10ddda3e230aa72889c81cd69792122b265010fe | rental/views/rental_state_view.py | rental/views/rental_state_view.py | from django.http import HttpResponseForbidden
from django.shortcuts import redirect, get_object_or_404
from django.views import View
from rental.state_transitions import allowed_transitions
from rental.models import Rental
class RentalStateView(View):
"""
Change the state of a given rental
If given an in... | from django.http import HttpResponseForbidden
from django.shortcuts import redirect, get_object_or_404
from django.views import View
from rental.availability import Availability
from rental.state_transitions import allowed_transitions
from rental.models import Rental
class RentalStateView(View):
"""
Change th... | Check availability when approving rental request | Check availability when approving rental request
| Python | agpl-3.0 | verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool | <INSERT> rental.availability import Availability
from <INSERT_END> <INSERT> check_availability(self, rental):
availability = Availability(rental.start_date, rental.return_date, rental.depot_id)
for item_rental in rental.itemrental_set:
intervals = availability.get_availability_intervals(ite... | Check availability when approving rental request
from django.http import HttpResponseForbidden
from django.shortcuts import redirect, get_object_or_404
from django.views import View
from rental.state_transitions import allowed_transitions
from rental.models import Rental
class RentalStateView(View):
"""
Chan... |
fda634ca2457716c33842cd0d285c20a0478601a | bugle_project/configs/development/settings.py | bugle_project/configs/development/settings.py | from bugle_project.configs.settings import *
FAYE_URL = None
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'bugle'
DATABASE_USER = 'bugle'
| from bugle_project.configs.settings import *
FAYE_ENABLED = False
FAYE_URL = None
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'bugle'
DATABASE_USER = 'bugle'
| Disable Faye on development, for now. | Disable Faye on development, for now.
| Python | bsd-2-clause | devfort/bugle,devfort/bugle,devfort/bugle | <REPLACE_OLD> *
FAYE_URL <REPLACE_NEW> *
FAYE_ENABLED = False
FAYE_URL <REPLACE_END> <|endoftext|> from bugle_project.configs.settings import *
FAYE_ENABLED = False
FAYE_URL = None
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'bugle'
DATABASE_USER = 'bugle'
| Disable Faye on development, for now.
from bugle_project.configs.settings import *
FAYE_URL = None
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'bugle'
DATABASE_USER = 'bugle'
|
3a3cb923babfbba4234e646dc40c0a9b6364d207 | apps/announcements/management/commands/tweetannouncements.py | apps/announcements/management/commands/tweetannouncements.py | """
Management command to cross-publish announcements on Twitter.
"""
from django.core.management.base import NoArgsCommand
from ...models import AnnouncementTwitterCrossPublication
class Command(NoArgsCommand):
"""
A management command which cross-publish on Twitter any pending announcements
currently ... | """
Management command to cross-publish announcements on Twitter.
"""
from django.core.management.base import NoArgsCommand
from apps.dbmutex import MutexLock,AlreadyLockedError, LockTimeoutError
from ...models import AnnouncementTwitterCrossPublication
class Command(NoArgsCommand):
"""
A management comman... | Add mutex to the "tweetannouncement" management command. | Add mutex to the "tweetannouncement" management command.
| Python | agpl-3.0 | TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker | <INSERT> apps.dbmutex import MutexLock,AlreadyLockedError, LockTimeoutError
from <INSERT_END> <REPLACE_OLD> job.
<REPLACE_NEW> job. Use the ``dbmutex`` app to avoid concurrent
execution of the code.
<REPLACE_END> <REPLACE_OLD> """
AnnouncementTwitterCrossPublication.objects.publish_pending_announcements(... | Add mutex to the "tweetannouncement" management command.
"""
Management command to cross-publish announcements on Twitter.
"""
from django.core.management.base import NoArgsCommand
from ...models import AnnouncementTwitterCrossPublication
class Command(NoArgsCommand):
"""
A management command which cross-p... |
a4cffc0e74f9dd972357eb9dc49a57e10f1fe944 | core/forms.py | core/forms.py | from collections import namedtuple
from django import forms
IMAGE = "img"
UploadType = namedtuple("UploadType", ["directory", "label"])
FILE_TYPE_CHOICES = (
UploadType(directory=IMAGE, label="Image"),
UploadType(directory="thumb", label="Thumbnail"),
UploadType(directory="doc", label="Document"),
U... | from collections import namedtuple
from django import forms
IMAGE = "img"
UploadType = namedtuple("UploadType", ["directory", "label"])
FILE_TYPE_CHOICES = (
UploadType(directory=IMAGE, label="Image"),
UploadType(directory="thumb", label="Thumbnail"),
UploadType(directory="doc", label="Document"),
U... | Check names of files for spaces | Check names of files for spaces
| Python | bsd-3-clause | ahernp/DMCM,ahernp/DMCM,ahernp/DMCM | <REPLACE_OLD> initial=IMAGE)
<REPLACE_NEW> initial=IMAGE)
def clean_upload_file(self):
data = self.cleaned_data["upload_file"]
if " " in data.name:
raise forms.ValidationError("Spaces in filename not allowed")
return data
<REPLACE_END> <|endoftext|> from collections import nam... | Check names of files for spaces
from collections import namedtuple
from django import forms
IMAGE = "img"
UploadType = namedtuple("UploadType", ["directory", "label"])
FILE_TYPE_CHOICES = (
UploadType(directory=IMAGE, label="Image"),
UploadType(directory="thumb", label="Thumbnail"),
UploadType(director... |
c0d2550e4cfb647b21e6fdde9705fe6e4a76a2df | Lambda/Functions/TagEC2Dependencies/tag_ec2_dependencies.py | Lambda/Functions/TagEC2Dependencies/tag_ec2_dependencies.py | '''
Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
except in compliance with the License. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompanying t... | Add tag EC2 dependencies Lambda Python code. | Add tag EC2 dependencies Lambda Python code.
| Python | apache-2.0 | rsavordelli/aws-support-tools,rsavordelli/aws-support-tools,rsavordelli/aws-support-tools,rsavordelli/aws-support-tools,rsavordelli/aws-support-tools,rsavordelli/aws-support-tools | <REPLACE_OLD> <REPLACE_NEW> '''
Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
except in compliance with the License. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the ... | Add tag EC2 dependencies Lambda Python code.
| |
e01ec3b6c877bc76ffa2e93d97d706036a90405c | test/on_yubikey/cli_piv/test_misc.py | test/on_yubikey/cli_piv/test_misc.py | import unittest
from ..framework import cli_test_suite
from .util import DEFAULT_MANAGEMENT_KEY
@cli_test_suite
def additional_tests(ykman_cli):
class Misc(unittest.TestCase):
def setUp(self):
ykman_cli('piv', 'reset', '-f')
def test_info(self):
output = ykman_cli('piv',... | import unittest
from ..framework import cli_test_suite
from .util import DEFAULT_MANAGEMENT_KEY
@cli_test_suite
def additional_tests(ykman_cli):
class Misc(unittest.TestCase):
def setUp(self):
ykman_cli('piv', 'reset', '-f')
def test_info(self):
output = ykman_cli('piv',... | Test that repeated read/write-object cycles do not change the data | Test that repeated read/write-object cycles do not change the data
| Python | bsd-2-clause | Yubico/yubikey-manager,Yubico/yubikey-manager | <INSERT> data = 'test data'
for i in range(0, 3):
<INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <REPLACE_OLD> input='test data')
output <REPLACE_NEW> input=data)
data <REPLACE_END> <REPLACE_OLD> self.assertEqual('test d... | Test that repeated read/write-object cycles do not change the data
import unittest
from ..framework import cli_test_suite
from .util import DEFAULT_MANAGEMENT_KEY
@cli_test_suite
def additional_tests(ykman_cli):
class Misc(unittest.TestCase):
def setUp(self):
ykman_cli('piv', 'reset', '-f')... |
53c9b988d2ccda253080deaa35b70d814309a4aa | src/algorithms/simple_hybrid.py | src/algorithms/simple_hybrid.py | def predict(predictions_vector_0, predictions_vector_1, mixing_variable=0.5, num_partitions=30):
"""Apply a simple linear hybrid recommender.
This function implements the simple linear hybrid recommender Zhou et. al:
"Solving the apparent diversity-accuracy dilemma of recommender systems"
http://arxiv... | Add a simple hybrid recommender from Zhou et. al | Add a simple hybrid recommender from Zhou et. al
| Python | apache-2.0 | tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes | <REPLACE_OLD> <REPLACE_NEW> def predict(predictions_vector_0, predictions_vector_1, mixing_variable=0.5, num_partitions=30):
"""Apply a simple linear hybrid recommender.
This function implements the simple linear hybrid recommender Zhou et. al:
"Solving the apparent diversity-accuracy dilemma of recommen... | Add a simple hybrid recommender from Zhou et. al
| |
9bda75b5200790bb2c68e256207d8fc5d45a76c6 | setup.py | setup.py | from setuptools import setup
from setuptools import find_packages
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '2.5.5'
setup(
# Basic package information.
name='twython',
version=__version__,
packages=find_packages(),
# Packaging options.
include_package_data=True,
# ... | from setuptools import setup
from setuptools import find_packages
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '2.5.5'
setup(
# Basic package information.
name='twython',
version=__version__,
packages=find_packages(),
# Packaging options.
include_package_data=True,
# ... | Allow versions of requests between 1.0.0 and 2.0.0 | Allow versions of requests between 1.0.0 and 2.0.0
Requests is semantically versioned, so minor version changes are expected to be compatible.
| Python | mit | Oire/twython,joebos/twython,akarambir/twython,Fueled/twython,fibears/twython,ryanmcgrath/twython,vivek8943/twython,Hasimir/twython,Devyani-Divs/twython,ping/twython | <REPLACE_OLD> 'requests==1.1.0', <REPLACE_NEW> 'requests>=1.0.0, <2.0.0', <REPLACE_END> <|endoftext|> from setuptools import setup
from setuptools import find_packages
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '2.5.5'
setup(
# Basic package information.
name='twython',
version=__ver... | Allow versions of requests between 1.0.0 and 2.0.0
Requests is semantically versioned, so minor version changes are expected to be compatible.
from setuptools import setup
from setuptools import find_packages
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '2.5.5'
setup(
# Basic package informa... |
20ef91b51230811cab0e4edb426993cfb1c63a1a | osf/management/commands/checkmigrations.py | osf/management/commands/checkmigrations.py | """
Return a non-zero exit code if there are unapplied migrations.
"""
import sys
from django.db import connections, DEFAULT_DB_ALIAS
from django.db.migrations.executor import MigrationExecutor
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
... | Add a management command to check for unapplied migrations. | Add a management command to check for unapplied migrations.
[PLAT-972]
| Python | apache-2.0 | brianjgeiger/osf.io,erinspace/osf.io,CenterForOpenScience/osf.io,CenterForOpenScience/osf.io,cslzchen/osf.io,aaxelb/osf.io,erinspace/osf.io,Johnetordoff/osf.io,adlius/osf.io,HalcyonChimera/osf.io,erinspace/osf.io,CenterForOpenScience/osf.io,cslzchen/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,felliott/osf.io,aax... | <INSERT> """
Return a non-zero exit code if there are unapplied migrations.
"""
import sys
from django.db import connections, DEFAULT_DB_ALIAS
from django.db.migrations.executor import MigrationExecutor
from django.core.management.base import BaseCommand
class Command(BaseCommand):
<INSERT_END> <INSERT> def handl... | Add a management command to check for unapplied migrations.
[PLAT-972]
| |
871ec80a78ef2caaaea8882e9c2846b064eb7b96 | trytond_nereid/tests/__init__.py | trytond_nereid/tests/__init__.py | # -*- coding: utf-8 -*-
"""
__init__
Nereid Tryton module test cases
:copyright: (c) 2011 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
from unittest import TestSuite
from .configuration import suite as configuration_test_suite
from .test_currency ... | Add a consolidated test suite which could be imported by the tryton test suite | Add a consolidated test suite which could be imported by the tryton test suite
| Python | bsd-3-clause | fulfilio/nereid,usudaysingh/nereid,prakashpp/nereid,riteshshrv/nereid,riteshshrv/nereid,usudaysingh/nereid,fulfilio/nereid,prakashpp/nereid | <INSERT> # -*- coding: utf-8 -*-
"""
<INSERT_END> <INSERT> __init__
Nereid Tryton module test cases
:copyright: (c) 2011 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
from unittest import TestSuite
from .configuration import suite as configuration_t... | Add a consolidated test suite which could be imported by the tryton test suite
| |
418b1e1176f4b4d286983f69cf4e5c1deacd4afb | sympy/core/tests/test_cache.py | sympy/core/tests/test_cache.py | from sympy.core.cache import cacheit
def test_cacheit_doc():
@cacheit
def testfn():
"test docstring"
pass
assert testfn.__doc__ == "test docstring"
assert testfn.__name__ == "testfn"
| Add a test for the @cachit decorator. | Add a test for the @cachit decorator.
Make sure that the caching decorator correctly
copies over the function docstring and function name.
This fixes issue #744 from the issue tracker.
Signed-off-by: Jochen Voss <1dcd5c846f3eb4984f0655fb5407be7c9e0c9079@seehuhn.de>
Signed-off-by: Ondrej Certik <b816faa87b7d35274d2e5... | Python | bsd-3-clause | madan96/sympy,hargup/sympy,Gadal/sympy,cswiercz/sympy,sampadsaha5/sympy,Shaswat27/sympy,fperez/sympy,atreyv/sympy,lidavidm/sympy,Davidjohnwilson/sympy,AkademieOlympia/sympy,beni55/sympy,Mitchkoens/sympy,beni55/sympy,jbbskinny/sympy,pbrady/sympy,shikil/sympy,kmacinnis/sympy,shikil/sympy,Curious72/sympy,toolforger/sympy,... | <INSERT> from sympy.core.cache import cacheit
def test_cacheit_doc():
<INSERT_END> <INSERT> @cacheit
def testfn():
"test docstring"
pass
assert testfn.__doc__ == "test docstring"
assert testfn.__name__ == "testfn"
<INSERT_END> <|endoftext|> from sympy.core.cache import cacheit
def tes... | Add a test for the @cachit decorator.
Make sure that the caching decorator correctly
copies over the function docstring and function name.
This fixes issue #744 from the issue tracker.
Signed-off-by: Jochen Voss <1dcd5c846f3eb4984f0655fb5407be7c9e0c9079@seehuhn.de>
Signed-off-by: Ondrej Certik <b816faa87b7d35274d2e5... | |
a013af88adad469782d2f05a0b882c2f5500b6b8 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(
name='gallerize',
version='0.3.1',
description='Create a static HTML/CSS image gallery from a bunch of images.',
author='Jochen Kupperschmidt',
author_email='homework@nwsnet.de',
url='http://homework.nwsnet.de/releases/cc0e/#gallerize'... | # -*- coding: utf-8 -*-
from setuptools import setup
def read_readme():
with open('README.rst') as f:
return f.read()
setup(
name='gallerize',
version='0.3.1',
description='Create a static HTML/CSS image gallery from a bunch of images.',
long_description=read_readme(),
license='MIT'... | Include README as long package description. Specified license. | Include README as long package description. Specified license.
| Python | mit | TheLady/gallerize,TheLady/gallerize | <REPLACE_OLD> #!/usr/bin/env python
from <REPLACE_NEW> # -*- coding: utf-8 -*-
from <REPLACE_END> <REPLACE_OLD> setup
setup(
<REPLACE_NEW> setup
def read_readme():
with open('README.rst') as f:
return f.read()
setup(
<REPLACE_END> <INSERT> long_description=read_readme(),
license='MIT',
<IN... | Include README as long package description. Specified license.
#!/usr/bin/env python
from setuptools import setup
setup(
name='gallerize',
version='0.3.1',
description='Create a static HTML/CSS image gallery from a bunch of images.',
author='Jochen Kupperschmidt',
author_email='homework@nwsnet.d... |
b16016994f20945a8a2bbb63b9cb920d856ab66f | web/attempts/migrations/0008_add_submission_date.py | web/attempts/migrations/0008_add_submission_date.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-05-09 09:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('attempts', '0007_auto_20161004_0927'),
]
operations = [
migrations.AddField(... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-05-09 09:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('attempts', '0007_auto_20161004_0927'),
]
operations = [
migrations.AddField(... | Revert "Make migration SQLite compatible" | Revert "Make migration SQLite compatible"
This reverts commit 768d85cccb17c8757dd8d14dad220d0b87568264.
| Python | agpl-3.0 | ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo | <INSERT> subquery.submission_date
FROM <INSERT_END> <DELETE> <DELETE_END> <REPLACE_OLD> max(history_date)
<REPLACE_NEW> user_id, part_id, max(history_date) AS submission_date
<REPLACE_END> <INSERT> GROUP BY user_id, part_id
) AS subquery
<INSERT_END> <REPLACE_OLD> us... | Revert "Make migration SQLite compatible"
This reverts commit 768d85cccb17c8757dd8d14dad220d0b87568264.
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-05-09 09:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies =... |
d565786278eaf32761957dd1e064a5d549ef3ab4 | praw/models/reddit/mixins/savable.py | praw/models/reddit/mixins/savable.py | """Provide the SavableMixin class."""
from ....const import API_PATH
class SavableMixin(object):
"""Interface for RedditBase classes that can be saved."""
def save(self, category=None):
"""Save the object.
:param category: The category to save to (Default: None).
"""
self._r... | """Provide the SavableMixin class."""
from ....const import API_PATH
class SavableMixin(object):
"""Interface for RedditBase classes that can be saved."""
def save(self, category=None):
"""Save the object.
:param category: (Gold) The category to save to (Default:
None). If your u... | Clarify that category is a gold feature for saving an item | Clarify that category is a gold feature for saving an item
| Python | bsd-2-clause | 13steinj/praw,RGood/praw,RGood/praw,darthkedrik/praw,darthkedrik/praw,leviroth/praw,gschizas/praw,leviroth/praw,gschizas/praw,praw-dev/praw,nmtake/praw,praw-dev/praw,nmtake/praw,13steinj/praw | <INSERT> (Gold) <INSERT_END> <REPLACE_OLD> (Default: None).
<REPLACE_NEW> (Default:
None). If your user does not have gold this value is ignored by
Reddit.
<REPLACE_END> <|endoftext|> """Provide the SavableMixin class."""
from ....const import API_PATH
class SavableMixin(object):
"""In... | Clarify that category is a gold feature for saving an item
"""Provide the SavableMixin class."""
from ....const import API_PATH
class SavableMixin(object):
"""Interface for RedditBase classes that can be saved."""
def save(self, category=None):
"""Save the object.
:param category: The categ... |
146832fe1eba0bc22125ade183f34621de5625fa | apps/bluebottle_utils/fields.py | apps/bluebottle_utils/fields.py | from decimal import Decimal
from django.db import models
class MoneyField(models.DecimalField):
def __init__(self, *args, **kwargs):
kwargs.setdefault('max_digits', 9)
kwargs.setdefault('decimal_places', 2)
super(MoneyField, self).__init__(*args, default=Decimal('0.00'), **kwargs)
| from decimal import Decimal
from django.db import models
class MoneyField(models.DecimalField):
def __init__(self, *args, **kwargs):
kwargs.setdefault('max_digits', 9)
kwargs.setdefault('decimal_places', 2)
kwargs.setdefault('default', Decimal('0.00'))
super(MoneyField, self).__ini... | Add south introspection rule for MoneyField. | Add south introspection rule for MoneyField.
| Python | bsd-3-clause | onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site | <INSERT> kwargs.setdefault('default', Decimal('0.00'))
<INSERT_END> <REPLACE_OLD> default=Decimal('0.00'), **kwargs)
<REPLACE_NEW> **kwargs)
# If south is installed, ensure that MoneyField will be introspected just like a normal DecimalField
try:
from south.modelsinspector import add_introspection_rules
... | Add south introspection rule for MoneyField.
from decimal import Decimal
from django.db import models
class MoneyField(models.DecimalField):
def __init__(self, *args, **kwargs):
kwargs.setdefault('max_digits', 9)
kwargs.setdefault('decimal_places', 2)
super(MoneyField, self).__init__(*arg... |
fae9990c2cd12ebc65abb9cbabe1b53fde9b4eec | wtforms/ext/i18n/form.py | wtforms/ext/i18n/form.py | import warnings
from wtforms import form
from wtforms.ext.i18n.utils import get_translations
translations_cache = {}
class Form(form.Form):
"""
Base form for a simple localized WTForms form.
This will use the stdlib gettext library to retrieve an appropriate
translations object for the language, by ... | import warnings
from wtforms import form
from wtforms.ext.i18n.utils import get_translations
translations_cache = {}
class Form(form.Form):
"""
Base form for a simple localized WTForms form.
**NOTE** this class is now un-necessary as the i18n features have
been moved into the core of WTForms, but it... | Make documentation more explicit for WTForms deprecation. | Make documentation more explicit for WTForms deprecation.
| Python | bsd-3-clause | cklein/wtforms,jmagnusson/wtforms,crast/wtforms,pawl/wtforms,subyraman/wtforms,Aaron1992/wtforms,hsum/wtforms,wtforms/wtforms,Xender/wtforms,skytreader/wtforms,pawl/wtforms,Aaron1992/wtforms | <INSERT> **NOTE** this class is now un-necessary as the i18n features have
been moved into the core of WTForms, but it will be kept for
compatibility reasons until WTForms 1.2.
<INSERT_END> <REPLACE_OLD> warnings.warn('wtforms.ext.i18n <REPLACE_NEW> warnings.warn('i18n is now in core, wtforms.ext.i18n <REP... | Make documentation more explicit for WTForms deprecation.
import warnings
from wtforms import form
from wtforms.ext.i18n.utils import get_translations
translations_cache = {}
class Form(form.Form):
"""
Base form for a simple localized WTForms form.
This will use the stdlib gettext library to retrieve a... |
2e40bccd158d0dd3a8e741704f055dbe7a04e3a5 | heat/db/sqlalchemy/migrate_repo/manage.py | heat/db/sqlalchemy/migrate_repo/manage.py | #!/usr/bin/env python
from migrate.versioning.shell import main
if __name__ == '__main__':
main(debug='False')
| #!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | Add Apache 2.0 license to source file | Add Apache 2.0 license to source file
As per OpenStack licensing guide lines [1]:
[H102 H103] Newly contributed Source Code should be licensed under
the Apache 2.0 license.
[H104] Files with no code shouldn't contain any license header nor
comments, and must be left completely empty.
[1] http://docs.openstack.org/dev... | Python | apache-2.0 | openstack/heat,noironetworks/heat,openstack/heat,noironetworks/heat | <REPLACE_OLD> python
from <REPLACE_NEW> python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Add Apache 2.0 license to source file
As per OpenStack licensing guide lines [1]:
[H102 H103] Newly contributed Source Code should be licensed under
the Apache 2.0 license.
[H104] Files with no code shouldn't contain any license header nor
comments, and must be left completely empty.
[1] http://docs.openstack.org/dev... |
91c620e228ad73e2e34efbd60813ed35b3f9ef46 | tests/test_dtool_dataset_freeze.py | tests/test_dtool_dataset_freeze.py | """Test the ``dtool dataset create`` command."""
import os
import shutil
from click.testing import CliRunner
from dtoolcore import DataSet
from . import chdir_fixture, tmp_dir_fixture # NOQA
from . import SAMPLE_FILES_DIR
def test_dataset_freeze_functional(chdir_fixture): # NOQA
from dtool_create.dataset im... | """Test the ``dtool dataset create`` command."""
import os
import shutil
from click.testing import CliRunner
from dtoolcore import DataSet, ProtoDataSet
from . import chdir_fixture, tmp_dir_fixture # NOQA
from . import SAMPLE_FILES_DIR
def test_dataset_freeze_functional(chdir_fixture): # NOQA
from dtool_cre... | Fix the freeze functional test | Fix the freeze functional test
| Python | mit | jic-dtool/dtool-create | <REPLACE_OLD> DataSet
from <REPLACE_NEW> DataSet, ProtoDataSet
from <REPLACE_END> <INSERT> create, <INSERT_END> <DELETE> # Create an empty dataset
<DELETE_END> <REPLACE_OLD> dataset <REPLACE_NEW> result <REPLACE_END> <REPLACE_OLD> DataSet(dataset_name, data_directory="data")
<REPLACE_NEW> runner.invoke(create, [... | Fix the freeze functional test
"""Test the ``dtool dataset create`` command."""
import os
import shutil
from click.testing import CliRunner
from dtoolcore import DataSet
from . import chdir_fixture, tmp_dir_fixture # NOQA
from . import SAMPLE_FILES_DIR
def test_dataset_freeze_functional(chdir_fixture): # NOQA
... |
5a641736faf6bb3ce335480848464a1f22fab040 | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
from contextlib import nested
from fabric.api import *
def prepare_project():
u"""
Enters the directory and sources environment configuration.
I know ``nested`` is deprecated, but what a nice shortcut it is here ;)
"""
return nested(
cd(PROJECT_PATH),
pre... | # -*- coding: utf-8 -*-
from contextlib import nested
from fabric.api import *
def prepare_project():
u"""
Enters the directory and sources environment configuration.
I know ``nested`` is deprecated, but what a nice shortcut it is here ;)
"""
return nested(
cd(PROJECT_PATH),
pre... | Make Fabric honor .ssh/config settings | Make Fabric honor .ssh/config settings
| Python | mit | zsiciarz/variablestars.net,zsiciarz/variablestars.net,zsiciarz/variablestars.net | <INSERT> True
env.use_ssh_config = <INSERT_END> <|endoftext|> # -*- coding: utf-8 -*-
from contextlib import nested
from fabric.api import *
def prepare_project():
u"""
Enters the directory and sources environment configuration.
I know ``nested`` is deprecated, but what a nice shortcut it is here ;)
... | Make Fabric honor .ssh/config settings
# -*- coding: utf-8 -*-
from contextlib import nested
from fabric.api import *
def prepare_project():
u"""
Enters the directory and sources environment configuration.
I know ``nested`` is deprecated, but what a nice shortcut it is here ;)
"""
return neste... |
923ae01ab8beadfd73c5275f0c954510d3a13832 | coherence/__init__.py | coherence/__init__.py | import platform
import sys
__version_info__ = (0, 6, 7)
__version__ = '.'.join(map(str, __version_info__))
SERVER_ID = ','.join([platform.system(),
platform.release(),
'UPnP/1.0,Coherence UPnP framework',
__version__])
try:
from twisted import ve... | import platform
import sys
__version__ = "0.6.7.dev0"
SERVER_ID = ','.join([platform.system(),
platform.release(),
'UPnP/1.0,Coherence UPnP framework',
__version__])
try:
from twisted import version as twisted_version
from twisted.web import ... | Switch to PEP 440 compliant version string and bump to 0.6.7.dev0. | Switch to PEP 440 compliant version string and bump to 0.6.7.dev0.
| Python | mit | coherence-project/Coherence,coherence-project/Coherence | <REPLACE_OLD> sys
__version_info__ <REPLACE_NEW> sys
__version__ <REPLACE_END> <REPLACE_OLD> (0, 6, 7)
__version__ = '.'.join(map(str, __version_info__))
SERVER_ID <REPLACE_NEW> "0.6.7.dev0"
SERVER_ID <REPLACE_END> <|endoftext|> import platform
import sys
__version__ = "0.6.7.dev0"
SERVER_ID = ','.join([platform.... | Switch to PEP 440 compliant version string and bump to 0.6.7.dev0.
import platform
import sys
__version_info__ = (0, 6, 7)
__version__ = '.'.join(map(str, __version_info__))
SERVER_ID = ','.join([platform.system(),
platform.release(),
'UPnP/1.0,Coherence UPnP framework',
... |
92622b83b1b191fec22655fa727fbd87c5af211f | spelling_ru.py | spelling_ru.py |
def pl_1(order):
"""2, 3, 4"""
return (order == 'тысяча') and 'тысячи' or order + 'а'
def pl_2(order):
"""5 и больше"""
return (order == 'тысяча') and 'тысяч' or order + 'ов'
RU_PASSES = """
^ 1 <order> = <order>
1 <thousand> = одна тысяча
2 <thousand> = две тысячи
<2_to_4> <order> = <order, pl_1>
<n... | Add preliminary Russian spelling definitions | Add preliminary Russian spelling definitions | Python | mit | alco/numspell,alco/numspell | <INSERT>
def pl_1(order):
<INSERT_END> <INSERT> """2, 3, 4"""
return (order == 'тысяча') and 'тысячи' or order + 'а'
def pl_2(order):
"""5 и больше"""
return (order == 'тысяча') and 'тысяч' or order + 'ов'
RU_PASSES = """
^ 1 <order> = <order>
1 <thousand> = одна тысяча
2 <thousand> = две тысячи
<2_to... | Add preliminary Russian spelling definitions
| |
a1e18385c2c5df9db8390b2da4d5baa2465f150e | webcomix/tests/test_comic_availability.py | webcomix/tests/test_comic_availability.py | import pytest
from webcomix.comic import Comic
from webcomix.supported_comics import supported_comics
from webcomix.util import check_first_pages
@pytest.mark.slow
def test_supported_comics():
for comic_name, comic_info in supported_comics.items():
comic = Comic(comic_name, *comic_info)
first_pag... | import pytest
from webcomix.comic import Comic
from webcomix.supported_comics import supported_comics
from webcomix.util import check_first_pages
@pytest.mark.slow
@pytest.mark.parametrize("comic_name", list(supported_comics.keys()))
def test_supported_comics(comic_name):
comic = Comic(comic_name, *supported_com... | Test comic availability of all supported comics independently through parametrization | Test comic availability of all supported comics independently through parametrization
| Python | mit | J-CPelletier/webcomix,J-CPelletier/WebComicToCBZ,J-CPelletier/webcomix | <REPLACE_OLD> check_first_pages
@pytest.mark.slow
def test_supported_comics():
for comic_name, comic_info in supported_comics.items():
<REPLACE_NEW> check_first_pages
@pytest.mark.slow
@pytest.mark.parametrize("comic_name", list(supported_comics.keys()))
def test_supported_comics(comic_name):
<REPLACE_END... | Test comic availability of all supported comics independently through parametrization
import pytest
from webcomix.comic import Comic
from webcomix.supported_comics import supported_comics
from webcomix.util import check_first_pages
@pytest.mark.slow
def test_supported_comics():
for comic_name, comic_info in sup... |
9249f1f2fce010cb0378080b5b7fef55235eefea | rnacentral/portal/migrations/0010_add_precomputed_rna_type.py | rnacentral/portal/migrations/0010_add_precomputed_rna_type.py | from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('portal', '0007_add_precomputed_rna_table'),
]
operations = [
# rna_type is a / seperated field that represents the set of rna_types
# for a ... | from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('portal', '0007_add_precomputed_rna_table'),
]
operations = [
# rna_type is a / seperated field that represents the set of rna_types
# for a ... | Drop size of rna_type column to 40 | Drop size of rna_type column to 40
Largest rna_type is 32 so 40 should give us plenty of buffer space as
per Anton's suggestion.
| Python | apache-2.0 | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | <REPLACE_OLD> models.CharField(max_length=250))
<REPLACE_NEW> models.CharField(max_length=40))
<REPLACE_END> <|endoftext|> from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('portal', '0007_add_precomputed_rna_table... | Drop size of rna_type column to 40
Largest rna_type is 32 so 40 should give us plenty of buffer space as
per Anton's suggestion.
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('portal', '0007_add_precomputed_rna... |
a506d8d45d0824b9b70af35831c1bde69906617e | test/test_soft.py | test/test_soft.py |
import os
import base64
import struct
import tempfile
import unittest
from u2flib_host.soft import SoftU2FDevice
from u2flib_host.constants import INS_ENROLL, INS_SIGN
CLIENT_PARAM = b'clientABCDEFGHIJKLMNOPQRSTUVWXYZ' # 32 bytes
APP_PARAM = b'test_SoftU2FDevice0123456789ABCD' # 32 bytes
class TestSoftU2FDevice(... | Add rudimentary unit test for SoftU2FDevice | Add rudimentary unit test for SoftU2FDevice
| Python | bsd-2-clause | Yubico/python-u2flib-host | <REPLACE_OLD> <REPLACE_NEW>
import os
import base64
import struct
import tempfile
import unittest
from u2flib_host.soft import SoftU2FDevice
from u2flib_host.constants import INS_ENROLL, INS_SIGN
CLIENT_PARAM = b'clientABCDEFGHIJKLMNOPQRSTUVWXYZ' # 32 bytes
APP_PARAM = b'test_SoftU2FDevice0123456789ABCD' # 32 by... | Add rudimentary unit test for SoftU2FDevice
| |
fcffabef406cd0d983e4754c58c76760f0204357 | pywikibot/families/commons_family.py | pywikibot/families/commons_family.py | # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
# The Wikimedia Commons family
class Family(family.WikimediaFamily):
def __init__(self):
super(Family, self).__init__()
self.name = 'commons'
self.langs = {
'commons': 'commons.wikimedia.org',
... | # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
# The Wikimedia Commons family
class Family(family.WikimediaFamily):
def __init__(self):
super(Family, self).__init__()
self.name = 'commons'
self.langs = {
'commons': 'commons.wikimedia.org',
... | Enable Wikidata for Wikimedia Commons | Enable Wikidata for Wikimedia Commons
Change-Id: Ibc8734f65dcd97dc7af9674efe8655fe01dc61d3
| Python | mit | smalyshev/pywikibot-core,Darkdadaah/pywikibot-core,npdoty/pywikibot,jayvdb/pywikibot-core,magul/pywikibot-core,VcamX/pywikibot-core,h4ck3rm1k3/pywikibot-core,wikimedia/pywikibot-core,hasteur/g13bot_tools_new,darthbhyrava/pywikibot-local,wikimedia/pywikibot-core,hasteur/g13bot_tools_new,Darkdadaah/pywikibot-core,emijrp/... | <REPLACE_OLD> "/wikipedia/commons"
<REPLACE_NEW> "/wikipedia/commons"
def shared_data_repository(self, code, transcluded=False):
return ('wikidata', 'wikidata')
<REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
# The Wikimedia Commons family
class ... | Enable Wikidata for Wikimedia Commons
Change-Id: Ibc8734f65dcd97dc7af9674efe8655fe01dc61d3
# -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
# The Wikimedia Commons family
class Family(family.WikimediaFamily):
def __init__(self):
super(Family, self).__init__()
self.nam... |
8fa1cae882c0ff020c0b9c3c2fac9e4248d46ce4 | deploy/common/sqlite_wrapper.py | deploy/common/sqlite_wrapper.py | import sqlite3
class SQLiteWrapper:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cursor = self.conn.cursor()
self.cursor.execute("PRAGMA cache_size=-16000")
self.cursor.execute("PRAGMA synchronous=OFF")
self.conn.commit()
def query(self, sql, params=None, iterator=False, fetch_one=False, m... | import sqlite3
class SQLiteWrapper:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cursor = self.conn.cursor()
self.cursor.execute("PRAGMA page_size=4096")
self.cursor.execute("PRAGMA cache_size=-16000")
self.cursor.execute("PRAGMA synchronous=NORMAL")
self.conn.commit()
def query(self, sq... | Use PRAGMA synchronous=NORMAL instead of OFF, and set page_size to 4096. | Use PRAGMA synchronous=NORMAL instead of OFF, and set page_size to 4096.
| Python | mit | mikispag/bitiodine | <INSERT> page_size=4096")
self.cursor.execute("PRAGMA <INSERT_END> <REPLACE_OLD> synchronous=OFF")
self.conn.commit()
def <REPLACE_NEW> synchronous=NORMAL")
self.conn.commit()
def <REPLACE_END> <|endoftext|> import sqlite3
class SQLiteWrapper:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self... | Use PRAGMA synchronous=NORMAL instead of OFF, and set page_size to 4096.
import sqlite3
class SQLiteWrapper:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cursor = self.conn.cursor()
self.cursor.execute("PRAGMA cache_size=-16000")
self.cursor.execute("PRAGMA synchronous=OFF")
self.conn.commi... |
1d555c184a10ae4fd84d758105e19b10828543c2 | q2_feature_classifier/tests/__init__.py | q2_feature_classifier/tests/__init__.py | # ----------------------------------------------------------------------------
# Copyright (c) 2016--, Ben Kaehler
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------... | # ----------------------------------------------------------------------------
# Copyright (c) 2016--, Ben Kaehler
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------... | Update import location of TestPluginBase | TST: Update import location of TestPluginBase
| Python | bsd-3-clause | BenKaehler/q2-feature-classifier | <REPLACE_OLD> q2_types.testing <REPLACE_NEW> qiime.plugin.testing <REPLACE_END> <|endoftext|> # ----------------------------------------------------------------------------
# Copyright (c) 2016--, Ben Kaehler
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distr... | TST: Update import location of TestPluginBase
# ----------------------------------------------------------------------------
# Copyright (c) 2016--, Ben Kaehler
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------... |
594869bca15b93a8e583e29b1a65496bd6c058f2 | config.py | config.py | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = 'f63f65a3f7274455bfd49edf9c6b36bd'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///... | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = 'f63f65a3f7274455bfd49edf9c6b36bd'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = Tru... | Add SQLALCHEMY_TRACK_MODIFICATION to supress warnings | Add SQLALCHEMY_TRACK_MODIFICATION to supress warnings
| Python | mit | fernando24164/flask_api,fernando24164/flask_api | <REPLACE_OLD> True
<REPLACE_NEW> True
SQLALCHEMY_TRACK_MODIFICATIONS = False
<REPLACE_END> <|endoftext|> import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = 'f63f65a3f7274455bfd49edf9c6b36bd'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS ... | Add SQLALCHEMY_TRACK_MODIFICATION to supress warnings
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = 'f63f65a3f7274455bfd49edf9c6b36bd'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
... |
e75aecc3e8606559fa722f7ffb081e2df258b60f | py/search-in-rotated-sorted-array.py | py/search-in-rotated-sorted-array.py | class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if len(nums) == 1:
return 0 if nums[0] == target else -1
if target >= nums[0]:
L, U = -1, len(nums)
while L ... | Add py solution for Search in Rotated Sorted Array | Add py solution for Search in Rotated Sorted Array
Search in Rotated Sorted Array: https://leetcode.com/problems/search-in-rotated-sorted-array/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | <REPLACE_OLD> <REPLACE_NEW> class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if len(nums) == 1:
return 0 if nums[0] == target else -1
if target >= nums[0]:
L, U = -1, l... | Add py solution for Search in Rotated Sorted Array
Search in Rotated Sorted Array: https://leetcode.com/problems/search-in-rotated-sorted-array/
| |
8514d379ac3a9d75722b3ccccd0a9da40d2c5819 | __openerp__.py | __openerp__.py | # -*- coding: utf-8 -*-
{
'name': "l10n_fr_ebics",
'summary': """Implementation of the EBICS banking protocol""",
'description': """
This module provides an interface to echanges files with banks. It's curently a beta version.
This program is distributed in the hope that it will be useful, b... | # -*- coding: utf-8 -*-
{
'name': "l10n_fr_ebics",
'summary': """Implementation of the EBICS banking protocol""",
'description': """
This module provides an interface to echanges files with banks. It's curently a beta version.
This module isbased on the library ebicsPy. It maps Odoo with the eb... | Add EbicsPy Launchpad repository url | Add EbicsPy Launchpad repository url
| Python | agpl-3.0 | yuntux/l10n_fr_ebics | <REPLACE_OLD> version.
This <REPLACE_NEW> version.
This module isbased on the library ebicsPy. It maps Odoo with the ebicspy API.
https://code.launchpad.net/~aurelien-dumaine/+junk/ebicspy
This <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
{
'name': "l10n_fr_ebics",
'summary': """Implementat... | Add EbicsPy Launchpad repository url
# -*- coding: utf-8 -*-
{
'name': "l10n_fr_ebics",
'summary': """Implementation of the EBICS banking protocol""",
'description': """
This module provides an interface to echanges files with banks. It's curently a beta version.
This program is distributed... |
4e84dc31d52412a9d58d5f0c54f5514c0eac5137 | console.py | console.py | from dumpster import Dumpster
import os
i = input('\r>')
if i == 'list':
cwd = os.getcwd()
lcd = os.listdir()
dump = ''
for file in lcd:
if '.dmp' in file:
dump+= ' '+file
print(dump)
| from dumpster import Dumpster
import os
running = True
selected = ''
while running:
#cwd = os.getcwd()
i = input('\r%s>'%(selected))
if i == 'exit':
running = False
if i[0:6] == 'create':
name = i[7:]
Dumpster(name).write_to_dump()
if i == 'list':
if selected is... | Select and Create and List | Select and Create and List
| Python | apache-2.0 | SirGuyOfGibson/source-dump | <REPLACE_OLD> os
i = input('\r>')
if <REPLACE_NEW> os
running = True
selected = ''
while running:
#cwd = os.getcwd()
<REPLACE_END> <INSERT> = input('\r%s>'%(selected))
if i == 'exit':
running = False
if i[0:6] == 'create':
name = i[7:]
Dumpster(name).write_to_dump()
i... | Select and Create and List
from dumpster import Dumpster
import os
i = input('\r>')
if i == 'list':
cwd = os.getcwd()
lcd = os.listdir()
dump = ''
for file in lcd:
if '.dmp' in file:
dump+= ' '+file
print(dump)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.