commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
7cd3c0449b05e75ffbe5ba346bab3ff389f63b9d | clean up map_async_bench | hazelcast/hazelcast-python-client,hazelcast/hazelcast-python-client,cangencer/hazelcast-python-client | tests/benchmark/map_async_bench.py | tests/benchmark/map_async_bench.py | import threading
import random
import time
import logging
import sys
from os.path import dirname
sys.path.append(dirname(dirname(dirname(__file__))))
import hazelcast
REQ_COUNT = 50000
ENTRY_COUNT = 10 * 1000
VALUE_SIZE = 10000
GET_PERCENTAGE = 40
PUT_PERCENTAGE = 40
logging.basicConfig(format='%(asctime)s%(msecs... | import threading
import random
import time
import logging
import sys
from os.path import dirname
sys.path.append(dirname(dirname(dirname(__file__))))
import hazelcast
REQ_COUNT = 20000
ENTRY_COUNT = 10 * 1000
VALUE_SIZE = 10000
GET_PERCENTAGE = 40
PUT_PERCENTAGE = 40
logging.basicConfig(format='%(asctime)s%(msecs... | apache-2.0 | Python |
29315213a8503de018a76badc71da3737d2b54c7 | Fix spiffsgen example test | espressif/esp-idf,espressif/esp-idf,espressif/esp-idf,espressif/esp-idf | examples/storage/spiffsgen/example_test.py | examples/storage/spiffsgen/example_test.py | from __future__ import print_function
import os
import hashlib
import ttfw_idf
@ttfw_idf.idf_example_test(env_tag='Example_GENERIC')
def test_examples_spiffsgen(env, extra_data):
# Test with default build configurations
dut = env.get_dut('spiffsgen', 'examples/storage/spiffsgen', dut_class=ttfw_idf.ESP32DUT)... | from __future__ import print_function
import os
import hashlib
import ttfw_idf
@ttfw_idf.idf_example_test(env_tag='Example_GENERIC')
def test_examples_spiffsgen(env, extra_data):
# Test with default build configurations
dut = env.get_dut('spiffsgen', 'examples/storage/spiffsgen', dut_class=ttfw_idf.ESP32DUT)... | apache-2.0 | Python |
7c762733311c6a52f0a7605a9495f8234c1d6ff2 | put portLo..Hi as arg | tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj | predictor/server/server.py | predictor/server/server.py | #!/usr/bin/python
import sys
from datetime import datetime
from server_thread import ServerThread as Server
def main(argv):
if len(sys.argv)!=4:
print 'USAGE: phyton prediction_server.py [serverId] [portLo] [portHi]'
return
host = '127.0.0.1'
serverId = argv[1]
portLo,portHi = int(arg... | #!/usr/bin/python
import sys
from datetime import datetime
from server_thread import ServerThread as Server
from config import serverConfig as scfg
def main():
if len(sys.argv)!=2:
print 'USAGE: phyton prediction_server.py [serverId]'
return
serverId = sys.argv[1]
if serverId not in scfg[... | mit | Python |
87ca8475f58b057e8043f8b398bd76123a89a733 | Revert "parsing html" | karlcow/webcompat,karlcow/webcompat | moz/minutes/helpers.py | moz/minutes/helpers.py | #!/usr/bin/env python
# encoding: utf-8
"""
helpers.py
Some modules to help with this project
Created by Karl Dubost on 2016-02-24.
Copyright (c) 2016 La Grange. All rights reserved.
MIT License
"""
import requests
def fetch_content(uri):
'''Fetch the URI and returns the raw content and its encoding'''
conten... | #!/usr/bin/env python
# encoding: utf-8
"""
helpers.py
Some modules to help with this project
Created by Karl Dubost on 2016-02-24.
Copyright (c) 2016 La Grange. All rights reserved.
MIT License
"""
import io
import sys
import lxml.html
import requests
def fetch_content(uri):
'''Fetch the URI and returns the ... | mit | Python |
8ecc26cffabb5a4c80b9a5574b102cc5c63312d3 | Update accounts.py | uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw | myuw/views/accounts.py | myuw/views/accounts.py | from myuw.views.page import page
from myuw.util.page_view import page_view
@page_view
def accounts(request):
return page(request, {}, template='accounts.html')
| from myuw.views.page import page
from myuw.util.page_view import page_view
@page_view
def accounts(request):
return page(request, {}, template='accounts.html') | apache-2.0 | Python |
9eebf1d43b93a6e1001186693d3a15ce2b5d568e | Add Bank and BankAccount models, add some fields to Supplier model | coyotevz/nobix-app | nbs/models/supplier.py | nbs/models/supplier.py | # -*- coding: utf-8 -*-
from nbs.models import db
from nbs.models.entity import Entity
from nbs.models.misc import FiscalDataMixin
class Supplier(Entity, FiscalDataMixin):
__tablename__ = 'supplier'
__mapper_args__ = {'polymorphic_identity': u'supplier'}
FREIGHT_SUPPLIER = 'FREIGHT_SUPPLIER'
FREIGHT... | # -*- coding: utf-8 -*-
from nbs.models import db
from nbs.models.entity import Entity
from nbs.models.misc import FiscalDataMixin
class Supplier(Entity, FiscalDataMixin):
__tablename__ = 'supplier'
__mapper_args__ = {'polymorphic_identity': u'supplier'}
supplier_id = db.Column(db.Integer, db.ForeignKey... | mit | Python |
f57294c59e197c989536638776738b0ed0bcee1d | disable scheduler.tough_pepper_cases | Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,axinging/chromium-crosswalk,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,hgl888/chromium... | tools/perf/benchmarks/scheduler.py | tools/perf/benchmarks/scheduler.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import benchmark
from measurements import smoothness
import page_sets
class SchedulerToughSchedulingCases(benchmark.Benchmark):
"""Measure... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import benchmark
from measurements import smoothness
import page_sets
class SchedulerToughSchedulingCases(benchmark.Benchmark):
"""Measure... | bsd-3-clause | Python |
4fb1ad11add4436395f775a12f0d4e90b99d6594 | add ignore filtering | naver/hubblemon,naver/hubblemon,naver/hubblemon | psutil_mon/psutil_alarm.py | psutil_mon/psutil_alarm.py |
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER Corp.
#
# 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
#
# U... |
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER Corp.
#
# 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
#
# U... | apache-2.0 | Python |
5cd9499fcc0c1f9b48216aeca11a7adcd8995a47 | Fix for MRV failing to enter enable mode | ktbyers/netmiko,ktbyers/netmiko | netmiko/mrv/mrv_ssh.py | netmiko/mrv/mrv_ssh.py | """MRV Communications Driver (OptiSwitch)."""
from __future__ import unicode_literals
import time
import re
from netmiko.cisco_base_connection import CiscoSSHConnection
class MrvOptiswitchSSH(CiscoSSHConnection):
"""MRV Communications Driver (OptiSwitch)."""
def session_preparation(self):
"""Prepare ... | """MRV Communications Driver (OptiSwitch)."""
from __future__ import unicode_literals
import time
import re
from netmiko.cisco_base_connection import CiscoSSHConnection
class MrvOptiswitchSSH(CiscoSSHConnection):
"""MRV Communications Driver (OptiSwitch)."""
def session_preparation(self):
"""Prepare ... | mit | Python |
d24a8db471cc9a415e3e2081e702199990bd6ac4 | Add option to configure plot's linewidth | kinverarity1/pyexperiment,duerrp/pyexperiment,DeercoderResearch/pyexperiment,kinverarity1/pyexperiment,DeercoderResearch/pyexperiment,shaunstanislaus/pyexperiment,duerrp/pyexperiment,shaunstanislaus/pyexperiment,DeercoderResearch/pyexperiment,duerrp/pyexperiment,shaunstanislaus/pyexperiment,shaunstanislaus/pyexperiment... | pyexperiment/utils/plot.py | pyexperiment/utils/plot.py | """Provides setup for matplotlib figures
Written by Peter Duerr.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import matplotlib
from matplotlib import pyplot as plt
def setup_matplotlib(font_size=14,
... | """Provides setup for matplotlib figures
Written by Peter Duerr.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import matplotlib
from matplotlib import pyplot as plt
def setup_matplotlib(font_size=14,
... | mit | Python |
9c40fa22c395b3d1dba800f0826606ecf314ddb2 | test update | miketheman/opencomparison,nanuxbe/djangopackages,benracine/opencomparison,QLGu/djangopackages,benracine/opencomparison,pydanny/djangopackages,pydanny/djangopackages,audreyr/opencomparison,pydanny/djangopackages,nanuxbe/djangopackages,QLGu/djangopackages,QLGu/djangopackages,miketheman/opencomparison,audreyr/opencomparis... | apps/pypi/tests/test_slurper.py | apps/pypi/tests/test_slurper.py | from django.template.defaultfilters import slugify
from django.test import TestCase
from package.models import Package, Version
from pypi.slurper import Slurper
TEST_PACKAGE_NAME = 'Django'
TEST_PACKAGE_VERSION = '1.3'
TEST_PACKAGE_REPO_NAME = 'django-uni-form'
class SlurpAllTests(TestCase):
def tes... | from django.template.defaultfilters import slugify
from django.test import TestCase
from package.models import Package, Version
from pypi.slurper import Slurper
TEST_PACKAGE_NAME = 'Django'
TEST_PACKAGE_VERSION = '1.2.5'
TEST_PACKAGE_REPO_NAME = 'django-uni-form'
class SlurpAllTests(TestCase):
def t... | mit | Python |
a961e11c5b3666f2504cf2a0d46028b5957cb9bf | Fix doctest | mabuchilab/QNET | qnet/misc/testing_tools.py | qnet/misc/testing_tools.py | """Collection of routines needed for testing. This includes proto-fixtures,
i.e. routines that should be imported and then turned into a fixture with the
pytest.fixture decorator.
See <https://pytest.org/latest/fixture.html>
"""
import os
from glob import glob
from collections import OrderedDict
from distutils import ... | """Collection of routines needed for testing. This includes proto-fixtures,
i.e. routines that should be imported and then turned into a fixture with the
pytest.fixture decorator.
See <https://pytest.org/latest/fixture.html>
"""
import os
from glob import glob
from collections import OrderedDict
from distutils import ... | mit | Python |
a6b49b92bd942655c0fe9a1c745e53ea19e070b5 | create a new django custom tag to replace a substring in a global string | muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous | src/alfanous-django/wui/templatetags/custom_filters.py | src/alfanous-django/wui/templatetags/custom_filters.py | '''
Created on Dec 29, 2012
@author: assem
'''
from django.template import Library
register = Library()
@register.filter
def get_range( value ):
""" make a range from a number starting of 1 """
return range( 1, value + 1 )
@register.filter
def space_split( str ):
""" split a string counting on spaces """
r... | '''
Created on Dec 29, 2012
@author: assem
'''
from django.template import Library
register = Library()
@register.filter
def get_range( value ):
""" make a range from a number starting of 1 """
return range( 1, value + 1 )
@register.filter
def space_split( str ):
""" split a string counting on spaces """
r... | agpl-3.0 | Python |
728cfe8e3c40ecd4e0128030d1d66864816626c8 | use single pipe to avoid problems with Jenkins reading them concurrently (#552) | ros-infrastructure/ros_buildfarm,ros-infrastructure/ros_buildfarm,ros-infrastructure/ros_buildfarm | ros_buildfarm/catkin_workspace.py | ros_buildfarm/catkin_workspace.py | # Copyright 2014-2016 Open Source Robotics Foundation, Inc.
#
# 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 applicabl... | # Copyright 2014-2016 Open Source Robotics Foundation, Inc.
#
# 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 applicabl... | apache-2.0 | Python |
8369d189e822fa7496864cac4ddc906bf7c05fe3 | Convert gaphor/UML/classes/tests/test_interface.py to pytest | amolenaar/gaphor,amolenaar/gaphor | gaphor/UML/classes/tests/test_interface.py | gaphor/UML/classes/tests/test_interface.py | """Test classes."""
from gaphor import UML
from gaphor.UML.classes.interface import Folded, InterfaceItem
class TestInterface:
def test_interface_creation(self, case):
"""Test interface creation."""
iface = case.create(InterfaceItem, UML.Interface)
assert isinstance(iface.subject, UML.Int... | """Test classes."""
from gaphor import UML
from gaphor.tests import TestCase
from gaphor.UML.classes.interface import Folded, InterfaceItem
class InterfaceTestCase(TestCase):
def test_interface_creation(self):
"""Test interface creation."""
iface = self.create(InterfaceItem, UML.Interface)
... | lgpl-2.1 | Python |
a842439edb47524b64345d3a893199f3b92f2b14 | Fix top-level domain extraction from site name. | OSSystems/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server | google_analytics/templatetags/analytics.py | google_analytics/templatetags/analytics.py | from django import template
from django.db import models
from django.contrib.sites.models import Site
from django.template import Context, loader
register = template.Library()
Analytics = models.get_model('google_analytics', 'analytic')
def do_get_analytics(parser, token):
try:
# split_contents() knows ... | from django import template
from django.db import models
from django.contrib.sites.models import Site
from django.template import Context, loader
register = template.Library()
Analytics = models.get_model('google_analytics', 'analytic')
def do_get_analytics(parser, token):
try:
# split_contents() knows ... | agpl-3.0 | Python |
0d2f35ddc27cf4c7155a4d1648c0bbfe0ff3a528 | Fix the bool name in the array API namespace | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | numpy/_array_api/dtypes.py | numpy/_array_api/dtypes.py | from .. import int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64
# Note: This name is changed
from .. import bool_ as bool
__all__ = ['int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'bool']
| from .. import int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64, bool
__all__ = ['int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'bool']
| mit | Python |
ff268941bfc588e21a2f460c034e3c0a99837d23 | Fix migration order (post-rebase) | OmeGak/indico,ThiefMaster/indico,DirkHoffmann/indico,indico/indico,mic4ael/indico,DirkHoffmann/indico,pferreir/indico,mvidalgarcia/indico,mvidalgarcia/indico,mic4ael/indico,DirkHoffmann/indico,OmeGak/indico,ThiefMaster/indico,pferreir/indico,OmeGak/indico,indico/indico,ThiefMaster/indico,indico/indico,pferreir/indico,O... | migrations/versions/201502111317_233928da84b2_create_video_conference_rooms.py | migrations/versions/201502111317_233928da84b2_create_video_conference_rooms.py | """Create video conference rooms
Revision ID: 233928da84b2
Revises: 50c2b5ee2726
Create Date: 2015-02-11 13:17:44.365589
"""
import sqlalchemy as sa
from alembic import op
from indico.core.db.sqlalchemy import PyIntEnum
from indico.core.db.sqlalchemy import UTCDateTime
from indico.modules.vc.models.vc_rooms import VC... | """Create video conference rooms
Revision ID: 233928da84b2
Revises: 50c2b5ee2726
Create Date: 2015-02-11 13:17:44.365589
"""
import sqlalchemy as sa
from alembic import op
from indico.core.db.sqlalchemy import PyIntEnum
from indico.core.db.sqlalchemy import UTCDateTime
from indico.modules.vc.models.vc_rooms import VC... | mit | Python |
8d40cd3dab606d558806fa00b0ed5df73c457045 | Fix for issue #2. | marcioreyes/bgui,Moguri/bgui,Remwrath/bgui,Moguri/bgui | bgui/frame.py | bgui/frame.py | from .gl_utils import *
from .widget import Widget, BGUI_DEFAULT
class Frame(Widget):
"""Frame for storing other widgets"""
theme_section = 'Frame'
theme_options = {
'Color1': (0, 0, 0, 0),
'Color2': (0, 0, 0, 0),
'Color3': (0, 0, 0, 0),
'Color4': (0, 0, 0, 0),
'BorderSize': 0,
'BorderColor... | from .gl_utils import *
from .widget import Widget, BGUI_DEFAULT
class Frame(Widget):
"""Frame for storing other widgets"""
theme_section = 'Frame'
theme_options = {
'Color1': (0, 0, 0, 0),
'Color2': (0, 0, 0, 0),
'Color3': (0, 0, 0, 0),
'Color4': (0, 0, 0, 0),
'BorderSize': 0,
'BorderColor... | mit | Python |
7a0560d8bd9dcb421b54522df92618d439941e69 | Change bill detail page to use session and identifier | jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot | bills/urls.py | bills/urls.py | from . import views
from django.conf.urls import url
urlpatterns = [
url(r'^by_topic/', views.bill_list_by_topic),
url(r'^by_location', views.bill_list_by_location),
url(r'^latest_activity/', views.latest_bill_activity),
url(r'^latest/', views.latest_bill_actions),
url(r'^detail/(?P<bill_session>(... | from . import views
from django.conf.urls import url
urlpatterns = [
url(r'^by_topic/', views.bill_list_by_topic),
url(r'^by_location', views.bill_list_by_location),
url(r'^latest_activity/', views.latest_bill_activity),
url(r'^latest/', views.latest_bill_actions),
url(r'^detail/(?P<bill_id>(.*))/... | mit | Python |
14e2d2282b7c95a1bb6d475faa6d827d90609e16 | Define PostAdmin list_display. | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 | blog/admin.py | blog/admin.py | from django.contrib import admin
from .models import Post
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ('title', 'pub_date')
| from django.contrib import admin
from .models import Post
admin.site.register(Post)
| bsd-2-clause | Python |
0d389018353f03d79332a1b40d6dc1881df91cd0 | Fix sorting of items in RSS feed | thelabnyc/wagtail_blog,thelabnyc/wagtail_blog | blog/views.py | blog/views.py | from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from .models import BlogIndexPage, BlogPage, BlogCategory
from django.shortcuts import get_object_or_404
from django.conf import settings
def tag_view(request, tag):
index = BlogIndexPage.objects.first()
return ... | from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from .models import BlogIndexPage, BlogPage, BlogCategory
from django.shortcuts import get_object_or_404
from django.conf import settings
def tag_view(request, tag):
index = BlogIndexPage.objects.first()
return ... | apache-2.0 | Python |
3e2cbd52a916b767473335427702ecf3bae5a51d | create dir if image_filter not exist | ttchin/FaceDetected | CapturePictures.py | CapturePictures.py | #!/usr/bin/env python
import cv2
import os
import argparse
def capturePicturesByCamera(num = 300, saveDir = "./image_filter/"):
"""
Capture pictures with faces detected.
Args:
num (int): The number of pictures to capture. Default: 300.
saveDir (str): The directory to save the captured pi... | #!/usr/bin/env python
import cv2
import sys
import argparse
def capturePicturesByCamera(num = 300, saveDir = "./image_filter/"):
"""
Capture pictures with faces detected.
Args:
num (int): The number of pictures to capture. Default: 300.
saveDir (str): The directory to save the captured p... | mit | Python |
d9f623baaa8e1d1075f9132108ed7bb11eea39b0 | Replace dask.get from core.get to async.get_sync | vikhyat/dask,cowlicks/dask,ContinuumIO/dask,blaze/dask,ContinuumIO/dask,mraspaud/dask,mrocklin/dask,cpcloud/dask,jakirkham/dask,chrisbarber/dask,jakirkham/dask,blaze/dask,mikegraham/dask,pombredanne/dask,gameduell/dask,pombredanne/dask,dask/dask,dask/dask,vikhyat/dask,mrocklin/dask,jcrist/dask,mraspaud/dask,jcrist/dask | dask/__init__.py | dask/__init__.py | from __future__ import absolute_import, division, print_function
from .core import istask
from .context import set_options
from .async import get_sync as get
try:
from .imperative import do, value
except ImportError:
pass
__version__ = '0.7.3'
| from __future__ import absolute_import, division, print_function
from .core import istask, get
from .context import set_options
try:
from .imperative import do, value
except ImportError:
pass
__version__ = '0.7.3'
| bsd-3-clause | Python |
de4f02fff4b23a442abe3062c2da4c52d8823627 | Fix spurious deprecation warning for fatal_warnings (#6237) | benjyw/pants,twitter/pants,wisechengyi/pants,tdyas/pants,tdyas/pants,jsirois/pants,jsirois/pants,wisechengyi/pants,twitter/pants,pantsbuild/pants,twitter/pants,wisechengyi/pants,pantsbuild/pants,pantsbuild/pants,wisechengyi/pants,twitter/pants,tdyas/pants,wisechengyi/pants,tdyas/pants,wisechengyi/pants,tdyas/pants,benj... | src/python/pants/backend/jvm/subsystems/zinc_language_mixin.py | src/python/pants/backend/jvm/subsystems/zinc_language_mixin.py | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import object
from pants.base.deprecated import deprecated
class ZincLan... | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import object
from pants.base.deprecated import deprecated
class ZincLan... | apache-2.0 | Python |
93b752a251b43c268a6becb53ab298e958a46aeb | add Category Field in template | manducku/awesomepose,manducku/awesomepose,manducku/awesomepose,manducku/awesomepose | awesomepose/posts/forms/post.py | awesomepose/posts/forms/post.py | from django import forms
from django.forms import ModelMultipleChoiceField
from django_summernote.widgets import SummernoteWidget, SummernoteInplaceWidget
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Field, Fieldset, Button, Div
from crispy_forms.bootstrap import (
Prep... | from django import forms
from django_summernote.widgets import SummernoteWidget, SummernoteInplaceWidget
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Field, Fieldset, Button
from crispy_forms.bootstrap import (
PrependedText, PrependedAppendedText, FormActions)
from po... | mit | Python |
ad2944a49b357494ff09a729b468f2fb19934909 | remove vertically-aligned assignments, per PEP8 | anl-mcampos/GuestBook,anl-mcampos/GuestBook | guestbook/__init__.py | guestbook/__init__.py | # coding: utf-8
import shelve
from datetime import datetime
from flask import Flask, request, render_template, redirect, escape, Markup
application = Flask(__name__)
DATA_FILE = 'guestbook.dat'
def save_data(name, comment, create_at):
database = shelve.open(DATA_FILE)
if 'greeting_list' not in database:
... | # coding: utf-8
import shelve
from datetime import datetime
from flask import Flask, request, render_template, redirect, escape, Markup
application = Flask(__name__)
DATA_FILE = 'guestbook.dat'
def save_data(name, comment, create_at):
database = shelve.open(DATA_FILE)
if 'greeting_list' not in database:
... | mit | Python |
f6efb0ff31ae8d0db5682cd7ad5b0921e3a4e924 | Bump version for new release. | promptworks/django_openstack_auth,promptworks/django_openstack_auth,gabrielhurley/django_openstack_auth,redhat-openstack/django_openstack_auth,jamielennox/django_openstack_auth,dan1/django_openstack_auth_proto,gabrielhurley/django_openstack_auth,redhat-openstack/django_openstack_auth,onsoku/codereview,onsoku/codereview... | openstack_auth/__init__.py | openstack_auth/__init__.py | # following PEP 386
__version__ = "1.0.7"
| # following PEP 386
__version__ = "1.0.6"
| apache-2.0 | Python |
7a99ade694c5844727ca33461dd3ad5271b61f14 | Improve q_n tests. | Duke-QCD/hic,jbernhard/hic | hic/test/test_flow.py | hic/test/test_flow.py | # -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
from .. import flow
def test_qn(seed=1248):
# q_n(0) = 1
q = flow.qn(2, 0)
assert q == 1+0j, \
'Incorrect single-particle q_n ({} != 1).'.format(q)
# q_3(uniform phi) = -1
q = flow.qn(3, np.arange(-np.pi, np.pi,... | # -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
from .. import flow
def test_qn():
assert flow.qn(2, 0) == 1+0j, \
'Single-particle q_n.'
assert np.allclose(flow.qn(3, np.arange(-np.pi, np.pi, 10)), -1+0j), \
'Isotropic q_n.'
def test_flow_cumulant():
pass
| mit | Python |
7c10feeed640f4d1a66bb3207ade980733409ad9 | improve unit test | bitsteller/witica,bitsteller/witica,bitsteller/witica | witica/test_source.py | witica/test_source.py | # coding=utf-8
import os
import unittest
import pkg_resources
from witica.source import Source, SourceItemList
from witica.log import *
from witica.metadata import extractor
class TestSourceItemList(unittest.TestCase):
def setUp(self):
Logger.start(verbose=False)
self.resource_path = pkg_resources.resource_fi... | # coding=utf-8
import os
import unittest
import pkg_resources
from witica.source import Source, SourceItemList
from witica.log import *
from witica.metadata import extractor
class TestSourceItemList(unittest.TestCase):
def setUp(self):
Logger.start(verbose=False)
self.resource_path = pkg_resources.resource_fi... | mit | Python |
1b7e6d41a6832ef7a8f9dafe0cd8580356f8e9da | check regex match before access in flickr module | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo/data/flickr.py | mygpo/data/flickr.py | #
# This file is part of gpodder.net.
#
# my.gpodder.org is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# my.gpodder.org is d... | #
# This file is part of gpodder.net.
#
# my.gpodder.org is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# my.gpodder.org is d... | agpl-3.0 | Python |
81d01175a7403b3e627738056ef9436e8172e51e | Enforce python 3.6 | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | shared_infra/lambdas/common/setup.py | shared_infra/lambdas/common/setup.py | import os
from setuptools import find_packages, setup
def local_file(name):
return os.path.relpath(os.path.join(os.path.dirname(__file__), name))
SOURCE = local_file('src')
setup(
name='wellcome_lambda_utils',
packages=find_packages(SOURCE),
package_dir={'': SOURCE},
version='1.0.0',
insta... | import os
from setuptools import find_packages, setup
def local_file(name):
return os.path.relpath(os.path.join(os.path.dirname(__file__), name))
SOURCE = local_file('src')
setup(
name='wellcome_lambda_utils',
packages=find_packages(SOURCE),
package_dir={'': SOURCE},
version='1.0.0',
insta... | mit | Python |
3abe25d2272e2a0111511b68407da0ef3c53f59e | Use wizard settings during samba provision | exekias/droplet,exekias/droplet,exekias/droplet | nazs/samba/module.py | nazs/samba/module.py | from nazs import module
from nazs.commands import run
from nazs.sudo import root
import os
import logging
from .models import DomainSettings
logger = logging.getLogger(__name__)
class Samba(module.Module):
"""
Samba 4 module, it deploys samba AD and file server
"""
ETC_FILE = '/etc/samba/smb.conf'... | from nazs import module
from nazs.commands import run
from nazs.sudo import root
import os
import logging
logger = logging.getLogger(__name__)
class Samba(module.Module):
"""
Samba 4 module, it deploys samba AD and file server
"""
ETC_FILE = '/etc/samba/smb.conf'
install_wizard = 'samba:instal... | agpl-3.0 | Python |
2383497f25e400aa27c600d3a30526d118e2a6dc | fix scan, follow new scan chain | SiLab-Bonn/pyBAR | host/test_register.py | host/test_register.py | from scan.scan import ScanBase
class TestRegisters(ScanBase):
def __init__(self, config_file, definition_file = None, bit_file = None, device = None, scan_identifier = "test_register", scan_data_path = None):
super(TestRegisters, self).__init__(config_file = config_file, definition_file = definition_fi... | from scan.scan import ScanBase
class TestRegisters(ScanBase):
def __init__(self, config_file, definition_file = None, bit_file = None, device = None, scan_identifier = "test_register", scan_data_path = None):
super(TestRegisters, self).__init__(config_file = config_file, definition_file = definition_fi... | bsd-3-clause | Python |
63ed4199e5cb3f8eb9a6b294ac8c6df12f9b5f56 | Add last_request function to httprequest module | Multiposting/HTTPretty,Multiposting/HTTPretty,letolab/HTTPretty,gabrielfalcao/HTTPretty,demianbrecht/HTTPretty,xgess/HTTPretty,pxg/HTTPretty,andresriancho/HTTPretty,paylogic/HTTPretty,BenjamenMeyer/HTTPretty,codepython/HTTPretty,xgess/HTTPretty,BenjamenMeyer/HTTPretty,pxg/HTTPretty,demianbrecht/HTTPretty,BenjamenMeyer/... | httpretty/__init__.py | httpretty/__init__.py | # #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <HTTPretty - HTTP client mock for Python>
# Copyright (C) <2011-2013> Gabriel Falcão <gabriel@nacaolivre.org>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to d... | # #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <HTTPretty - HTTP client mock for Python>
# Copyright (C) <2011-2013> Gabriel Falcão <gabriel@nacaolivre.org>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to d... | mit | Python |
2e4a934203b4d736a4180a970cacca508400ea7e | Update runcrons Command() to timezone.now() | Tivix/django-cron,philippeowagner/django-cronium,mozillazg/django-cron,eriktelepovsky/django-cron | django_cron/management/commands/runcrons.py | django_cron/management/commands/runcrons.py | from django.core.management.base import BaseCommand
from django.conf import settings
from django.core.cache import cache
from django.utils import timezone
from django_cron import CronJobManager
from datetime import datetime
from optparse import make_option
DEFAULT_LOCK_TIME = 15*60
def get_class( kls ):
"""TODO:... | from django.core.management.base import BaseCommand
from django.conf import settings
from django.core.cache import cache
from django_cron import CronJobManager
from datetime import datetime
from optparse import make_option
DEFAULT_LOCK_TIME = 15*60
def get_class( kls ):
"""TODO: move to django-common app.
C... | mit | Python |
abbe9b391ed32a07c5e912e3683ff7668e12eeb5 | bump to new version | karec/oct-browser,karec/oct-browser | octbrowser/__init__.py | octbrowser/__init__.py | __version__ = '0.4.1'
| __version__ = '0.4'
| mit | Python |
1d2ea0c72d8700687761125e4eaf90ec52f419be | Fix ORM call and add progress check | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/icds_reports/management/commands/update_aadhar_date.py | custom/icds_reports/management/commands/update_aadhar_date.py | from __future__ import absolute_import, print_function
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from django.db import connections
from corehq.apps.locations.models import SQLLocation
from corehq.sql_db.routers import db_for_read_write
from custom.icds_reports.model... | from __future__ import absolute_import, print_function
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from django.db import connections
from corehq.apps.locations.models import SQLLocation
from corehq.sql_db.routers import db_for_read_write
from custom.icds_reports.model... | bsd-3-clause | Python |
e2d8a32590c0865b2a8339d86af4eb9b34ea5d20 | Update __init__.py | r0h4n/node-agent,Tendrl/node_agent,Tendrl/node_agent,r0h4n/node-agent,Tendrl/node-agent,Tendrl/node-agent,r0h4n/node-agent,Tendrl/node-agent | tendrl/node_agent/objects/cluster_message/__init__.py | tendrl/node_agent/objects/cluster_message/__init__.py | from tendrl.commons import etcdobj
from tendrl.commons.message import Message as message
from tendrl.commons import objects
class ClusterMessage(objects.BaseObject, message):
internal = True
def __init__(self, **cluster_message):
self._defs = {}
message.__init__(self, **cluster_message)
... | from tendrl.commons import etcdobj
from tendrl.commons.message import Message as message
from tendrl.commons import objects
class ClusterMessage(objects.BaseObject, message):
internal = True
def __init__(self, **cluster_message):
self._defs = {}
message.__init__(self, **cluster_message)
... | lgpl-2.1 | Python |
724b4c382015aa933659a24f7be3bd2cabbcb5eb | Add flag --exclusive setting whether to run as exclusive or not | RKBK/gpaw-customize-files,RKBK/gpaw-customize-files | sherlock.stanford.edu.run_gpaw.py | sherlock.stanford.edu.run_gpaw.py | #!/usr/bin/env python
from sys import argv
import os
job = argv[1]
nodes = argv[2]
time = argv[3] + ":00"
if '--exclusive' in argv:
is_exclusive = True
argv.remove('--exclusive')
else:
is_exclusive = False
if len(argv) > 4:
gpaw_options = ' '.join(argv[4:])
else:
gpaw_options = ' '
#options = '-l... | """This is the submission script for GPAW on Sherlock at Stanford"""
#!/usr/bin/env python
from sys import argv
import os
job = argv[1]
nodes = argv[2]
time = argv[3] + ":00"
if len(argv) > 4:
gpaw_options = ' '.join(argv[4:])
else:
gpaw_options = ' '
#options = '-l nodes=' + nodes +':ppn=2' + ' -l' +' wallti... | mit | Python |
5952c372ae01672bfce450aec924628faecd3654 | bump version for release | GoodgameStudios/crossbar,RaitoBezarius/crossbar,w1z2g3/crossbar,w1z2g3/crossbar,erhuabushuo/crossbar,erhuabushuo/crossbar,erhuabushuo/crossbar,RaitoBezarius/crossbar,RaitoBezarius/crossbar,GoodgameStudios/crossbar,erhuabushuo/crossbar,RaitoBezarius/crossbar,NinjaMSP/crossbar,GoodgameStudios/crossbar,RaitoBezarius/cross... | crossbar/crossbar/__init__.py | crossbar/crossbar/__init__.py | ###############################################################################
##
## Copyright (C) 2011-2015 Tavendo GmbH
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License, version 3,
## as published by the Free Software Founda... | ###############################################################################
##
## Copyright (C) 2011-2015 Tavendo GmbH
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License, version 3,
## as published by the Free Software Founda... | agpl-3.0 | Python |
0b4fb3dd59ce0940026b1cf212adcf6d17bca7a0 | Refactor build_update_query (2) | AntoineToubhans/MongoTs | mongots/query.py | mongots/query.py | from datetime import datetime
AGGREGATION_KEYS = [
'',
'months.{month}.',
'months.{month}.days.{day}.',
'months.{month}.days.{day}.hours.{hour}.',
]
DATETIME_KEY = 'datetime'
def build_filter_query(timestamp, tags=None):
filters = tags or {}
filters[DATETIME_KEY] = datetime(timestamp.year, 1... | from datetime import datetime
AGGREGATION_KEYS = [
'',
'months.{month}.',
'months.{month}.days.{day}.',
'months.{month}.days.{day}.hours.{hour}.',
]
DATETIME_KEY = 'datetime'
def build_filter_query(timestamp, tags=None):
filters = tags or {}
filters[DATETIME_KEY] = datetime(timestamp.year, 1... | mit | Python |
51432aa92e233ba3c9db500e4e3d55b7067e906c | Add latest version of py-jinja2 (#13311) | iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-jinja2/package.py | var/spack/repos/builtin/packages/py-jinja2/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyJinja2(PythonPackage):
"""Jinja2 is a template engine written in pure Python. It provide... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyJinja2(PythonPackage):
"""Jinja2 is a template engine written in pure Python. It provide... | lgpl-2.1 | Python |
77f155fec48c808724eff1b2631035d2526c170f | add version 2.11.3 (#23698) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-jinja2/package.py | var/spack/repos/builtin/packages/py-jinja2/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyJinja2(PythonPackage):
"""Jinja2 is a template engine written in pure Python. It provide... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyJinja2(PythonPackage):
"""Jinja2 is a template engine written in pure Python. It provide... | lgpl-2.1 | Python |
5b6445e519fa9c03d703144462004ac27b9079ba | Add latest version of joblib (#11495) | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-joblib/package.py | var/spack/repos/builtin/packages/py-joblib/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyJoblib(PythonPackage):
"""Python function as pipeline jobs"""
homepage = "http://pa... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyJoblib(PythonPackage):
"""Python function as pipeline jobs"""
homepage = "http://pa... | lgpl-2.1 | Python |
350a5422ed1f874e7b2780348663f320a1af6676 | Update py-theano dependencies (#14015) | iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-theano/package.py | var/spack/repos/builtin/packages/py-theano/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyTheano(PythonPackage):
"""Optimizing compiler for evaluating mathematical expressions on... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyTheano(PythonPackage):
"""Optimizing compiler for evaluating mathematical expressions on... | lgpl-2.1 | Python |
38199ce9cfb69b21e45e679d3a6604a72da7cc5b | add version 0.5.0 to r-forcats (#20972) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-forcats/package.py | var/spack/repos/builtin/packages/r-forcats/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RForcats(RPackage):
"""Tools for Working with Categorical Variables (Factors)
Helpers... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RForcats(RPackage):
"""Helpers for reordering factor levels (including moving specified le... | lgpl-2.1 | Python |
c4d809a3b8ccb24d684c489925dd6c9634dbdf55 | Remove use of DesiredCapabilities object, use Options object instead (#981) | cobrateam/splinter,cobrateam/splinter,cobrateam/splinter | splinter/driver/webdriver/firefox.py | splinter/driver/webdriver/firefox.py | # -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from splinter.driver.webdri... | # -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from selenium.webdriver import DesiredCapabilities, Firefox
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from s... | bsd-3-clause | Python |
546b55248457055c4803d7ea65c21b92276309bd | Reformat and update copyright. | uw-it-aca/spotseeker_server,uw-it-aca/spotseeker_server,uw-it-aca/spotseeker_server | spotseeker_server/views/add_image.py | spotseeker_server/views/add_image.py | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
""" Changes
=================================================================
sbutler1@illinois.edu: adapt to a simplier RESTDispatch framework.
"""
from spotseeker_server.views.rest_dispatch import RESTDispatch, RESTExcep... | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
""" Copyright 2012, 2013 UW Information Technology, University of Washington
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtai... | apache-2.0 | Python |
99241ab49a0a76472bb6f107a078248782af9626 | fix string_types in _compat | jmgc/myhdl-numeric,jmgc/myhdl-numeric,jmgc/myhdl-numeric | myhdl/_compat.py | myhdl/_compat.py | import sys
PY2 = sys.version_info[0] == 2
if not PY2:
string_types = (str,)
integer_types = (int,)
long = int
import builtins
else:
string_types = (str, unicode)
integer_types = (int, long)
long = long
import __builtin__ as builtins
| import sys
PY2 = sys.version_info[0] == 2
if not PY2:
string_types = (str, unicode)
integer_types = (int,)
long = int
import builtins
else:
string_types = (str,)
integer_types = (int, long)
long = long
import __builtin__ as builtins
| lgpl-2.1 | Python |
aa9ce7092801e7ed8f3f86df0d1067279d13784d | Add armv7 support to create_ios_framework script (#4942) | jason-simmons/flutter_engine,Hixie/sky_engine,devoncarew/engine,chinmaygarde/sky_engine,Hixie/sky_engine,cdotstout/sky_engine,krisgiesing/sky_engine,mikejurka/engine,flutter/engine,cdotstout/sky_engine,jamesr/sky_engine,chinmaygarde/flutter_engine,jason-simmons/sky_engine,chinmaygarde/flutter_engine,jamesr/sky_engine,d... | sky/tools/create_ios_framework.py | sky/tools/create_ios_framework.py | #!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import subprocess
import shutil
import sys
import os
def main():
parser = argparse.ArgumentParser(description='Crea... | #!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import subprocess
import shutil
import sys
import os
def main():
parser = argparse.ArgumentParser(description='Crea... | bsd-3-clause | Python |
a9cfd2bc842631431e20b6c13d3d98535b643b3b | Fix mispelling | infoxchange/ixdjango | ixdjango/management/commands/copystatic.py | ixdjango/management/commands/copystatic.py | """
Copy static files to nginx location
.. moduleauthor:: Infoxchange Development Team <development@infoxchange.net.au>
"""
import logging
import os
from shutil import copy2, copystat
from django.conf import settings
from django.core.management.base import NoArgsCommand
LOGGER = logging.getLogger(__name__)
def co... | """
Copy static files to nginx location
.. moduleauthor:: Infoxchange Development Team <development@infoxchange.net.au>
"""
import logging
import os
from shutil import copy2, copystat
from django.conf import settings
from django.core.management.base import NoArgsCommand
LOGGER = logging.getLogger(__name__)
def co... | mit | Python |
df85906e8e2a872ca99002b26af6ea5d495b23ca | fix wrong document string | schubergphilis/data-migrator,iheitlager/data-migrator | data_migrator/emitters/__init__.py | data_migrator/emitters/__init__.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
This module contains all classes for models, managers and fields
* :class:`BaseEmitter`
* :class:`MySQLEmitter`
* ...
"""
from .mysql import MySQLEmitter
from .csv import CSVEmitter
| #!/usr/bin/python
# -*- coding: UTF-8 -*-
from .mysql import MySQLEmitter
from .csv import CSVEmitter
"""
This module contains all classes for models, managers and fields
* :class:`BaseEmitter`
* :class:`MySQLEmitter`
* ...
"""
| mit | Python |
0a05e6479ee907c3702cc895c5a180cd816a5433 | Build interdependencies. | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | d1_common_python/src/setup.py | d1_common_python/src/setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`setup`
====================
:Synopsis: Create egg.
:Author: DataONE (Dahl)
"""
from setuptools import setup, find_packages
import d1_common
setup(
name='DataONE_Common',
version=d1_common.__version__,
author='DataONE Project',
author_email='developers@d... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`setup`
====================
:Synopsis: Create egg.
:Author: DataONE (Dahl)
"""
from setuptools import setup, find_packages
setup(
name='Python DataONE Common',
#version=d1_client.__version__,
description='Contains functionality common to projects that int... | apache-2.0 | Python |
9664f6e6bf64e10fe0ce6fbfc3bbf20d4775cdb6 | Update MotorsControlFile.py | VitorHugoAguiar/ProBot,VitorHugoAguiar/ProBot,VitorHugoAguiar/ProBot,VitorHugoAguiar/ProBot | ProBot_BeagleBone/MotorsControlFile.py | ProBot_BeagleBone/MotorsControlFile.py | #!/usr/bin/python
# Python Standart Library Imports
import SabertoothFile
import PWMFile
import ProBotConstantsFile
# Initialization of classes from local files
Sabertooth = SabertoothFile.SabertoothClass()
PWM = PWMFile.PWMClass()
Pconst = ProBotConstantsFile.Constants()
class MotorsControlClass():
def Mo... | #!/usr/bin/python
import SabertoothFile
import PWMFile
import ProBotConstantsFile
# Initialization of classes from local files
Sabertooth = SabertoothFile.SabertoothClass()
PWM = PWMFile.PWMClass()
Pconst = ProBotConstantsFile.Constants()
class MotorsControlClass():
def MotorsControl(self,rightMotor, leftM... | agpl-3.0 | Python |
50b19958b531cd94b537f3d911ce9b0c0b7f1ea2 | add ordereddictionary to store information about file .rooms loaded | develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms | trunk/editor/structdata/project.py | trunk/editor/structdata/project.py | #!/usr/bin/env python
try:
from collections import OrderedDict
except ImportError:
from misc.dict import OrderedDict
from subject import Subject
class Project(Subject):
def __init__(self):
super(Project, self).__init__()
self.data = OrderedDict()
self.data['world'] = None
... | #!/usr/bin/env python
try:
from collections import OrderedDict
except ImportError:
from misc.dict import OrderedDict
from subject import Subject
class Project(Subject):
def __init__(self):
super(Project, self).__init__()
self.informations = None
self.images = {}
self.items... | mit | Python |
01e9fa344259faa6eeb7f0480975547d375e132f | add function to change and image. The function remove the image from the dictionary and add an image with the new key and new path to file | develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms | trunk/editor/structdata/project.py | trunk/editor/structdata/project.py | #!/usr/bin/env python
from misc.odict import OrderedDict
from subject import Subject
class Project(Subject):
def __init__(self):
super(Project, self).__init__()
self.data = OrderedDict()
self.data['world'] = None
self.data['images'] = {}
self.data['items'] = OrderedDict()... | #!/usr/bin/env python
from misc.odict import OrderedDict
from subject import Subject
class Project(Subject):
def __init__(self):
super(Project, self).__init__()
self.data = OrderedDict()
self.data['world'] = None
self.data['images'] = {}
self.data['items'] = OrderedDict()... | mit | Python |
b04693387be08c1ead880d0e7472026ed76dad80 | Fix django.conf.urls.defaults imports | ging/django_openstack_auth,promptworks/django_openstack_auth,ashokkumarprajapati/openstack_auth_remote,jamielennox/django_openstack_auth,dan1/django_openstack_auth_proto,dan1/django_openstack_auth_proto,redhat-openstack/django_openstack_auth,ging/django_openstack_auth,promptworks/django_openstack_auth,redhat-openstack/... | openstack_auth/urls.py | openstack_auth/urls.py | # 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, software
# distributed under the... | # 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, software
# distributed under the... | apache-2.0 | Python |
78705f598e7e3325e871bd17ff353a31c71bc399 | Extend all admin form to Container Admin Form (json field) | opps/opps,YACOWS/opps,williamroot/opps,williamroot/opps,YACOWS/opps,opps/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,opps/opps,jeanmask/opps,williamroot/opps | opps/articles/forms.py | opps/articles/forms.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from opps.core.widgets import OppsEditor
from opps.containers.forms import ContainerAdminForm
from .models import Post, Album, Link
class PostAdminForm(ContainerAdminForm):
multiupload_link = '/fileupload/image/'
class Meta:
model = Post
widgets ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from .models import Post, Album, Link
from opps.core.widgets import OppsEditor
from opps.db.models.fields.jsonf import JSONFormField
from opps.fields.widgets import JSONField
from opps.fields.models import Field, FieldOption
class PostAdminForm... | mit | Python |
67a7a3f5bc05265690a831dea7c4310af66870a8 | add channel obj on set_context_data * long_slug * level | jeanmask/opps,YACOWS/opps,opps/opps,opps/opps,williamroot/opps,YACOWS/opps,opps/opps,williamroot/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,opps/opps,jeanmask/opps,YACOWS/opps | opps/articles/utils.py | opps/articles/utils.py | # -*- coding: utf-8 -*-
from django.utils import timezone
from opps.articles.models import ArticleBox, Article
def set_context_data(self, SUPER, **kwargs):
context = super(SUPER, self).get_context_data(**kwargs)
article = Article.objects.filter(
site=self.site,
channel_long_slug__in=self.cha... | # -*- coding: utf-8 -*-
from django.utils import timezone
from opps.articles.models import ArticleBox, Article
def set_context_data(self, SUPER, **kwargs):
context = super(SUPER, self).get_context_data(**kwargs)
article = Article.objects.filter(
site=self.site,
channel_long_slug__in=self.cha... | mit | Python |
7b016e61f5f7218aaddbad12050d357357c5f3df | sort tests functions in bench_bgra2rgb.py | BoboTiG/python-mss | tests/bench_bgra2rgb.py | tests/bench_bgra2rgb.py | # coding: utf-8
"""
2018-03-19.
Maximum screenshots in 1 second by computing BGRA raw values to RGB.
GNU/Linux
pil_frombytes 139
mss_rgb 119
pil_frombytes_rgb 51
numpy_flip 31
numpy_slice 29
macOS
pil_frombytes 209
mss_rgb 174
pil_frombytes_rgb 113
numpy_fl... | # coding: utf-8
"""
2018-03-19.
Maximum screenshots in 1 second by computing BGRA raw values to RGB.
GNU/Linux
pil_frombytes_rgb 51
pil_frombytes 139
mss_rgb 119
numpy_flip 31
numpy_slice 29
macOS
pil_frombytes_rgb 113
pil_frombytes 209
mss_rgb 174
numpy_fl... | mit | Python |
9a83ec4c80bec0cec45904a8998cd82a99a9b1b2 | Save `resources` as extra data in its entirety | python-social-auth/social-core,python-social-auth/social-core | social_core/backends/atlassian.py | social_core/backends/atlassian.py | from social_core.backends.oauth import BaseOAuth2
class AtlassianOAuth2(BaseOAuth2):
name = 'atlassian'
AUTHORIZATION_URL = 'https://accounts.atlassian.com/authorize'
ACCESS_TOKEN_METHOD = 'POST'
ACCESS_TOKEN_URL = 'https://api.atlassian.com/oauth/token'
DEFAULT_SCOPE = ['read:jira-user', 'offline... | from social_core.backends.oauth import BaseOAuth2
class AtlassianOAuth2(BaseOAuth2):
name = 'atlassian'
AUTHORIZATION_URL = 'https://accounts.atlassian.com/authorize'
ACCESS_TOKEN_METHOD = 'POST'
ACCESS_TOKEN_URL = 'https://api.atlassian.com/oauth/token'
DEFAULT_SCOPE = ['read:jira-user', 'offline... | bsd-3-clause | Python |
e66178cc0521426036d4c9166bf76e9379bc62ef | disable Run tests temporarily | cloudruninc/cloudrun-python | cloudrun/tests.py | cloudrun/tests.py | import pytest
import uuid
from .cloudrun import Cloudrun
from .run import Run
token = uuid.uuid4().hex
id = uuid.uuid4().hex
def test_cloudrun_init():
assert type(Cloudrun(token)) is Cloudrun
assert Cloudrun(token).token == token
#def test_run_init():
# assert type(Run(token,id)) is Run
# assert Run(to... | import pytest
import uuid
from .cloudrun import Cloudrun
from .run import Run
token = uuid.uuid4().hex
id = uuid.uuid4().hex
def test_cloudrun_init():
assert type(Cloudrun(token)) is Cloudrun
assert Cloudrun(token).token == token
def test_run_init():
assert type(Run(token,id)) is Run
assert Run(token... | mit | Python |
5af29cfa071360265b1c31538f89e806ae4eabc4 | Fix #142: Testrunner and SOUTH_TESTS_MIGRATE broken on 1.1. | nimnull/django-south,RaD/django-south,RaD/django-south,nimnull/django-south,philipn/django-south,philipn/django-south,RaD/django-south | south/management/commands/test.py | south/management/commands/test.py | from django.core import management
from django.core.management.commands import test
from django.core.management.commands import syncdb
from django.conf import settings
from syncdb import Command as SyncDbCommand
class MigrateAndSyncCommand(SyncDbCommand):
option_list = SyncDbCommand.option_list
for opt in op... | from django.core import management
from django.core.management.commands import test
from django.core.management.commands import syncdb
from django.conf import settings
class Command(test.Command):
def handle(self, *args, **kwargs):
if not hasattr(settings, "SOUTH_TESTS_MIGRATE") or not settings.SOUTH_... | apache-2.0 | Python |
39874a0ddb65582a04ea32fa2b05bacc968f56f3 | Update max-chunks-to-make-sorted-ii.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode | Python/max-chunks-to-make-sorted-ii.py | Python/max-chunks-to-make-sorted-ii.py | # Time: O(nlogn)
# Space: O(n)
# This question is the same as "Max Chunks to Make Sorted"
# except the integers of the given array are not necessarily distinct,
# the input array could be up to length 2000, and the elements could be up to 10**8.
#
# Given an array arr of integers (not necessarily distinct),
# we spli... | # Time: O(nlogn)
# Space: O(n)
class Solution(object):
def maxChunksToSorted(self, arr):
"""
:type arr: List[int]
:rtype: int
"""
def compare(i1, i2):
return arr[i1]-arr[i2] if arr[i1] != arr[i2] else i1-i2
idxs = [i for i in xrange(len(arr))]
... | mit | Python |
5c20418b8e5f6dc033d1a7c515d30d5e9b026db5 | Fix sampleproject view | JungDev/django-telegrambot,JungDev/django-telegrambot | sampleproject/bot/views.py | sampleproject/bot/views.py | from django.shortcuts import render
from django.conf import settings
from django_telegrambot.apps import DjangoTelegramBot
# Create your views here.
def index(request):
bot_list = DjangoTelegramBot.bots
context = {'bot_list': bot_list, 'update_mode':settings.DJANGO_TELEGRAMBOT['MODE']}
return render(reques... | from django.shortcuts import render
from django.conf import settings
from django_telegrambot.apps import DjangoTelegramBot
# Create your views here.
def index(request):
bot_list = DjangoTelegramBot.bots
context = {'bot_list': bot_list, 'update_mode':settings.TELEGRAM_BOT_MODE}
return render(request, 'bot/i... | bsd-3-clause | Python |
f0f31ea0a86620b77073b5da0dca386b337b98da | update prop2part tests | necozay/tulip-control,tulip-control/tulip-control,necozay/tulip-control,necozay/tulip-control,tulip-control/tulip-control,tulip-control/tulip-control,tulip-control/tulip-control,necozay/tulip-control,necozay/tulip-control | tests/prop2part_test.py | tests/prop2part_test.py | #!/usr/bin/env python
"""
Tests for abstract.prop2partition
"""
from tulip.abstract import prop2part
import tulip.polytope as pc
import numpy as np
def prop2part_test():
state_space = pc.Polytope.from_box(np.array([[0., 2.],[0., 2.]]))
cont_props = []
A = []
b = []
A.append(np.array([[1.... | #!/usr/bin/env python
"""
Tests for abstract.prop2partition
"""
from tulip.abstract import prop2part
import tulip.polytope as pc
import numpy as np
def prop2part_test():
state_space = pc.Polytope.from_box(np.array([[0., 2.],[0., 2.]]))
cont_props = []
A = []
b = []
A.append(np.array([[1.... | bsd-3-clause | Python |
d32b2494c1a72d040a651bbb2f0abb7a94c1d2db | remove stray line | jplusplus/statscraper | tests/test-datatypes.py | tests/test-datatypes.py | """Test datatypes."""
from statscraper.datatypes import Datatype
from statscraper import Dimension, DimensionValue
def test_allowed_values():
"""Datatypes shuold have allowed values."""
dt = Datatype("region")
assert("Ale kommun" in dt.allowed_values)
def test_b():
"""Dimension values should be tran... | """Test datatypes."""
from statscraper.datatypes import Datatype
from statscraper import Dimension, DimensionValue
def test_allowed_values():
"""Datatypes shuold have allowed values."""
dt = Datatype("region")
assert("Ale kommun" in dt.allowed_values)
def test_b():
"""Dimension values should be tran... | mit | Python |
e8cffceecf79b42790ccab1c61a2da06ae6529cd | comment no longer relevant. dealt with 2FA already | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/sso/backends.py | corehq/apps/sso/backends.py | from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from corehq.apps.sso.models import IdentityProvider, AuthenticatedEmailDomain
from corehq.apps.sso.utils.user_helpers import get_email_domain_from_username
class SsoBackend(ModelBackend):
"""
Authenticates again... | from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from corehq.apps.sso.models import IdentityProvider, AuthenticatedEmailDomain
from corehq.apps.sso.utils.user_helpers import get_email_domain_from_username
class SsoBackend(ModelBackend):
"""
Authenticates again... | bsd-3-clause | Python |
52c3981b8880085d060f874eb8feace6ac125411 | Replace exact equality assert with isclose in bands cli | Z2PackDev/TBmodels,Z2PackDev/TBmodels | tests/test_cli_bands.py | tests/test_cli_bands.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Dominik Gresch <greschd@gmx.ch>
import os
import pytest
import tempfile
import numpy as np
import bandstructure_utils as bs
from click.testing import CliRunner
import tbmodels
from tbmodels._cli import cli
from parameters import SAMPLES_DIR
def test_cli_ban... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Dominik Gresch <greschd@gmx.ch>
import os
import pytest
import tempfile
import bandstructure_utils as bs
from click.testing import CliRunner
import tbmodels
from tbmodels._cli import cli
from parameters import SAMPLES_DIR
def test_cli_bands():
samples_d... | apache-2.0 | Python |
8b4b5eb2506feed164b69efa66b4cdae159182c3 | Fix pre-commit issues in the cli_parse tests. | Z2PackDev/TBmodels,Z2PackDev/TBmodels | tests/test_cli_parse.py | tests/test_cli_parse.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""Tests for the 'parse' CLI command."""
import tempfile
import pytest
from click.testing import CliRunner
import tbmodels
from tbmodels._cli import cli
@pytest.ma... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
import pytest
import tempfile
from click.testing import CliRunner
import tbmodels
from tbmodels._cli import cli
@pytest.mark.parametrize('pos_kind', ['wannier', 'ne... | apache-2.0 | Python |
78434bafbcc60ba7207d63481d3179474ae939ed | change to using scontrol for getting job state by default | timothydmorton/lsst-utils,timothydmorton/lsst-utils | pipeline/pipeline/batch.py | pipeline/pipeline/batch.py | import os, re
import subprocess
import time
def write_slurm_script(filename, cmd, **batch_options):
with open(filename, 'w') as fout:
fout.write('#!/bin/bash\n')
for opts in batch_options.items():
fout.write('#SBATCH --{0}={1}\n'.format(*opts))
fout.write('\n')
... | import os, re
import subprocess
import time
def write_slurm_script(filename, cmd, **batch_options):
with open(filename, 'w') as fout:
fout.write('#!/bin/bash\n')
for opts in batch_options.items():
fout.write('#SBATCH --{0}={1}\n'.format(*opts))
fout.write('\n')
... | mit | Python |
8e5ffc7ed1db1d17e55cf538fc9858705ecc9dd2 | Bump version to 1.20.4 | platformio/platformio-api | platformio_api/__init__.py | platformio_api/__init__.py | # Copyright 2014-present Ivan Kravets <me@ikravets.com>
#
# 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... | # Copyright 2014-present Ivan Kravets <me@ikravets.com>
#
# 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... | apache-2.0 | Python |
d81c6e4ce44b0ee63fa116cb69efce17b8bb2c3f | test getting message via POP | mbdevpl/maildaemon,mbdevpl/maildaemon | test/test_pop_connection.py | test/test_pop_connection.py | """Tests for POP connection handling."""
import os
import pathlib
import unittest
from maildaemon.config import load_config
from maildaemon.pop_connection import POPConnection
_HERE = pathlib.Path(__file__).parent
_TEST_CONFIG_PATH = _HERE.joinpath('maildaemon_test_config.json')
@unittest.skipUnless(os.environ.get... | """Tests for POP connection handling."""
import os
import pathlib
import unittest
from maildaemon.config import load_config
from maildaemon.pop_connection import POPConnection
_HERE = pathlib.Path(__file__).parent
_TEST_CONFIG_PATH = _HERE.joinpath('maildaemon_test_config.json')
@unittest.skipUnless(os.environ.get... | apache-2.0 | Python |
39a1c6c8c3795775dc8811e8e195feaa4e973cd8 | remove comments | RockefellerArchiveCenter/DACSspace | tests/test_validator.py | tests/test_validator.py | # from unittest.mock import patch
import json
import unittest
from dacsspace.validator import Validator
class TestValidator(unittest.TestCase):
def test_validator(self):
json_file = "/Users/aberish/Documents/GitHub/DACSspace/fixtures/resource.json"
with open(json_file, 'r') as f:
js... | # from unittest.mock import patch
import json
import unittest
from dacsspace.validator import Validator
class TestValidator(unittest.TestCase):
def test_validator(self):
json_file = "/Users/aberish/Documents/GitHub/DACSspace/fixtures/resource.json"
with open(json_file, 'r') as f:
js... | mit | Python |
c2b55844bff3de39ac9a0a4bd8860306da731662 | fix for testing 401 after redirection | inveniosoftware/invenio-communities,inveniosoftware/invenio-communities,inveniosoftware/invenio-communities,inveniosoftware/invenio-communities | testsuite/test_views.py | testsuite/test_views.py | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... | mit | Python |
77199b8c6b06054c7741433ec2fadd654a636677 | add hour var | pjdufour/tilejet-logs,tilejet/tilejet-logs | tilejetlogs/tilelogs.py | tilejetlogs/tilelogs.py | def buildTileRequestDocument(tileorigin, tilesource, x, y, z, status, datetime, ip):
r = {
'ip': ip,
'origin': tileorigin if tileorigin else "",
'source': tilesource,
'location': z+'/'+x+'/'+y,
'z': z,
'status': status,
'year': datetime.strftime('%Y'),
... | def buildTileRequestDocument(tileorigin, tilesource, x, y, z, status, datetime, ip):
r = {
'ip': ip,
'origin': tileorigin if tileorigin else "",
'source': tilesource,
'location': z+'/'+x+'/'+y,
'z': z,
'status': status,
'year': datetime.strftime('%Y'),
... | mit | Python |
d8556707aa3ab0bc89878e0b5daaaeb7b54616ae | Disable images | grave-w-grave/zulip,andersk/zulip,eeshangarg/zulip,hj3938/zulip,zorojean/zulip,willingc/zulip,qq1012803704/zulip,ericzhou2008/zulip,dxq-git/zulip,RobotCaleb/zulip,ahmadassaf/zulip,kou/zulip,bitemyapp/zulip,dawran6/zulip,bowlofstew/zulip,jackrzhang/zulip,showell/zulip,ericzhou2008/zulip,Batterfii/zulip,Gabriel0402/zulip... | zephyr/lib/bugdown.py | zephyr/lib/bugdown.py | import re
import markdown
class Bugdown(markdown.Extension):
def extendMarkdown(self, md, md_globals):
del md.inlinePatterns['image_link']
del md.inlinePatterns['image_reference']
# We need to re-initialize the markdown engine every 30 messages
# due to some sort of performance leak in the markdow... | import re
import markdown
# We need to re-initialize the markdown engine every 30 messages
# due to some sort of performance leak in the markdown library.
MAX_MD_ENGINE_USES = 30
_md_engine = None
_use_count = 0
# A link starts after whitespace, and cannot contain spaces,
# end parentheses, or end brackets (which wo... | apache-2.0 | Python |
c8a280d6466623b8d76fa01c12ebf295151d35d6 | remove primary key constraint | DarioValocchi/son-sp-infrabstract,skolome/son-sp-infrabstract,DarioValocchi/son-sp-infrabstract,DarioValocchi/son-sp-infrabstract,skolome/son-sp-infrabstract,skolome/son-sp-infrabstract | wim-adaptor/vtn-api/database/sqlalchemy_declaritive.py | wim-adaptor/vtn-api/database/sqlalchemy_declaritive.py | import os
import sys
from sqlalchemy import create_engine, Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Connectivity(Base):
__tablename__ = 'connectivity'
# define the columns for the table
s... | import os
import sys
from sqlalchemy import create_engine, Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Connectivity(Base):
__tablename__ = 'connectivity'
# define the columns for the table
s... | apache-2.0 | Python |
f984db30c4d4cab1377d21a73ec0b802590f8a51 | Update sqlalchemy migrate scripts for postgres | changsimon/trove,redhat-openstack/trove,cp16net/trove,zhangg/trove,zhangg/trove,zhujzhuo/openstack-trove,cp16net/trove,zhujzhuo/openstack-trove,hplustree/trove,redhat-openstack/trove,redhat-openstack/trove,fabian4/trove,mmasaki/trove,changsimon/trove,changsimon/trove,fabian4/trove,mmasaki/trove,zhujzhuo/openstack-trove... | trove/db/sqlalchemy/migrate_repo/versions/014_update_instance_flavor_id.py | trove/db/sqlalchemy/migrate_repo/versions/014_update_instance_flavor_id.py | # Copyright 2012 OpenStack Foundation
#
# 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 ... | # Copyright 2012 OpenStack Foundation
#
# 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 ... | apache-2.0 | Python |
dbe1ac7fda9188e59479ff4716141651d627f76c | Fix cheroot.test.test_errors doc spelling | cherrypy/cheroot | cheroot/test/test_errors.py | cheroot/test/test_errors.py | """Test suite for ``cheroot.errors``."""
import pytest
from cheroot import errors
from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS
@pytest.mark.parametrize(
'err_names,err_nums',
(
(('', 'some-nonsense-name'), []),
(
(
'EPROTOTYPE', 'EAGAIN', 'EWOULDBLOCK',
... | """Test suite for ``cheroot.errors``."""
import pytest
from cheroot import errors
from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS
@pytest.mark.parametrize(
'err_names,err_nums',
(
(('', 'some-nonsense-name'), []),
(
(
'EPROTOTYPE', 'EAGAIN', 'EWOULDBLOCK',
... | bsd-3-clause | Python |
423a15d7c8841b40bddbd129b2abfb1135f0b7c0 | fix date parsing in logsearch | hs-jenkins-bot/Singularity,HubSpot/Singularity,grepsr/Singularity,hs-jenkins-bot/Singularity,grepsr/Singularity,HubSpot/Singularity,grepsr/Singularity,HubSpot/Singularity,grepsr/Singularity,andrhamm/Singularity,andrhamm/Singularity,grepsr/Singularity,HubSpot/Singularity,andrhamm/Singularity,hs-jenkins-bot/Singularity,a... | scripts/logfetch/search.py | scripts/logfetch/search.py | import os
import re
import sys
import fnmatch
import logfetch_base
from termcolor import colored
def find_cached_logs(args):
matching_logs = []
log_fn_match = get_matcher(args)
for filename in os.listdir(args.dest):
if fnmatch.fnmatch(filename, log_fn_match) and in_date_range(args, filename):
... | import os
import re
import sys
import fnmatch
import logfetch_base
from termcolor import colored
def find_cached_logs(args):
matching_logs = []
log_fn_match = get_matcher(args)
for filename in os.listdir(args.dest):
if fnmatch.fnmatch(filename, log_fn_match) and in_date_range(args, filename):
... | apache-2.0 | Python |
fc1d468d6602022405d4959ea8d12c825a1916f0 | Add AuthToken model | Kromey/fbxnano,Kromey/fbxnano,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters,Kromey/akwriters,Kromey/akwriters | passwordless/models.py | passwordless/models.py | from datetime import timedelta
import uuid
from django.db import models
from django.utils import timezone
# Create your models here.
class User(models.Model):
"""
User model
This User model eschews passwords, relying instead on emailed OTP tokens.
"""
username = models.CharField(max_length=30,... | from django.db import models
# Create your models here.
class User(models.Model):
"""
User model
This User model eschews passwords, relying instead on emailed OTP tokens.
"""
username = models.CharField(max_length=30, unique=True)
email = models.EmailField(null=True)
is_active = models.B... | mit | Python |
5114bf3960b944c193c37ef8ecbcac50ae098d02 | Add InvalidLengthError class | thombashi/pathvalidate | pathvalidate/_error.py | pathvalidate/_error.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import unicode_literals
class NullNameError(ValueError):
"""
Raised when a name is empty.
"""
class InvalidCharError(ValueError):
"""
Raised when includes in... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import unicode_literals
class NullNameError(ValueError):
"""
Raised when a name is empty.
"""
class InvalidCharError(ValueError):
"""
Raised when includes in... | mit | Python |
042edce052d5307fff8dfbce8c08b72fb72af7f1 | Remove some noise | okfn/ckanext-groupadmin,okfn/ckanext-groupadmin,okfn/ckanext-groupadmin | ckanext/groupadmin/authz.py | ckanext/groupadmin/authz.py | '''This module monkey patches functions in ckan/authz.py and replaces the
default roles with custom roles and decorates
has_user_permission_for_group_org_org to allow a GroupAdmin to admin groups.
GroupAdmins can manage all organizations/groups, but have no other sysadmin
powers.
'''
from ckan import authz, model
from ... | '''This module monkey patches functions in ckan/authz.py and replaces the
default roles with custom roles and decorates
has_user_permission_for_group_org_org to allow a GroupAdmin to admin groups.
GroupAdmins can manage all organizations/groups, but have no other sysadmin
powers.
'''
from ckan import authz, model
from ... | agpl-3.0 | Python |
afb400e16c1335531f259218a8b9937de48644e9 | Update stream health health api url | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/checks/streams.py | polyaxon/checks/streams.py | from checks.base import Check
from checks.results import Result
from libs.api import get_settings_ws_api_url
from libs.http import safe_request
class StreamsCheck(Check):
@classmethod
def run(cls):
response = safe_request('{}/_health'.format(get_settings_ws_api_url()), 'GET')
status_code = re... | from checks.base import Check
from checks.results import Result
from libs.api import get_settings_ws_api_url
from libs.http import safe_request
class StreamsCheck(Check):
@classmethod
def run(cls):
response = safe_request(get_settings_ws_api_url(), 'GET')
status_code = response.status_code
... | apache-2.0 | Python |
35f9f3b3a1ca9174194975e5281682c2712b653f | add get_absolute_url to article categories too | GISAElkartea/bidasoamedia,GISAElkartea/bidasoamedia,GISAElkartea/bidasoamedia | project/articles/models.py | project/articles/models.py | from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
from markitup.fields import MarkupField
from autoslug import AutoSlugField
from sorl.thumbnail import ImageField
class Category(models.Model):
class Meta:
verbose_name = _('Category')
... | from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
from markitup.fields import MarkupField
from autoslug import AutoSlugField
from sorl.thumbnail import ImageField
class Category(models.Model):
class Meta:
verbose_name = _('Category')
... | agpl-3.0 | Python |
edb04d8e0ae03c9244b7d934fd713efbb94d5a58 | Add api url to album and link | williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,opps/opps,williamroot/opps,jeanmask/opps,opps/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps | opps/api/urls.py | opps/api/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url, include
from tastypie.api import Api
from opps.containers.api import Container
from opps.articles.api import Post, Album, Link
from .conf import settings
_api = Api(api_name=settings.OPPS_API_NAME)
_api.register(Container())
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url, include
from tastypie.api import Api
from opps.containers.api import Container
from opps.articles.api import Post
from .conf import settings
_api = Api(api_name=settings.OPPS_API_NAME)
_api.register(Container())
_api.register... | mit | Python |
e82d477194393ff3142f6c25c5db4c7b7f2a98a5 | Call ConsoleViewer init | simpleai-team/simpleai,iamaziz/simpleai,printedheart/simpleai,emoron/simpleai,emoron/simpleai,printedheart/simpleai,matuu/simpleai,iamaziz/simpleai,printedheart/simpleai,simpleai-team/simpleai,simpleai-team/simpleai,emoron/simpleai,matuu/simpleai,iamaziz/simpleai,matuu/simpleai | simpleai/search/viewers.py | simpleai/search/viewers.py | # coding: utf-8
from os import path
from threading import Thread
from time import sleep
class DummyViewer(object):
def start(self):
pass
def new_iteration(self, fringe):
pass
def chosen_node(self, node, is_goal):
pass
def expanded(self, node, successors):
pass
clas... | # coding: utf-8
from os import path
from threading import Thread
from time import sleep
class DummyViewer(object):
def start(self):
pass
def new_iteration(self, fringe):
pass
def chosen_node(self, node, is_goal):
pass
def expanded(self, node, successors):
pass
clas... | mit | Python |
cfa8b88e3d86e560415260eb596dd3bbdab52736 | Fix test of auto_backup_download | VitalPet/addons-onestein,VitalPet/addons-onestein,VitalPet/addons-onestein | auto_backup_download/tests/test_auto_backup_download.py | auto_backup_download/tests/test_auto_backup_download.py | # -*- coding: utf-8 -*-
# Copyright 2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
from odoo.exceptions import Warning
class TestAutoBackupDownload(common.TransactionCase):
def test_01_create_not_existing(self):
... | # -*- coding: utf-8 -*-
# Copyright 2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
from odoo.exceptions import Warning
class TestAutoBackupDownload(common.TransactionCase):
def test_01_create_not_existing(self):
... | agpl-3.0 | Python |
c3996af1f7b201355d1cbcd6ef4c8fe420c8b67e | Fix lint | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr... | solutions/uri/1028/1028.py | solutions/uri/1028/1028.py | def gcd(a, b):
while b > 0:
a, b = b, a % b
return a
n = int(input())
for line in range(n):
a, b = map(int, input().split())
print(gcd(a, b))
| import sys
def gcd(a, b):
while b > 0:
a, b = b, a % b
return a
n = int(input())
for line in range(n):
a, b = map(int, input().split())
print(gcd(a, b))
| mit | Python |
5fd1f7cbe9534a47c4dc837773f22f6f177fdcf5 | Update affineHacker: fixed imports and typo | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter15/affineHacker.py | books/CrackingCodesWithPython/Chapter15/affineHacker.py | # Affine Cipher Hacker
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
from books.CrackingCodesWithPython.pyperclip import copy
from books.CrackingCodesWithPython.Chapter14.affineCipher import decryptMessage, SYMBOLS, getKeyParts
from books.CrackingCodesWithPython.Chapter13.cryptomath import gcd
from books.Cr... | # Affine Cipher Hacker
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import pyperclip, affineCipher, detectEnglish, cryptomath
SILENT_MODE = False
def main():
# You might want to copy & paste this text from the source code at
# https://www.nostarch.com/crackingcodes/.
myMessage = """5QG9ol3La6... | mit | Python |
d607de07ae3aaa2a245b8eb90cb42ca3e29f6e33 | add lambda sample | r569594043/PythonBeginner | 05.Function.py | 05.Function.py | #-*- encoding: utf-8 -*-
# Error
#def func():
def func():
pass
def func(num, num1=1, num2=2):
print(num, num1, num2)
func(1, 3, 4) # 1 3 4
func(5) # 5 1 2
# Error
#func()
def func(**args):
for k, v in args.items():
print('key: ' + k, 'value: ' + v)
for k in args.keys():
print('key... | #-*- encoding: utf-8 -*-
# Error
#def func():
def func():
pass
def func(num, num1=1, num2=2):
print(num, num1, num2)
func(1, 3, 4) # 1 3 4
func(5) # 5 1 2
# Error
#func()
def func(**args):
for k, v in args.items():
print('key: ' + k, 'value: ' + v)
for k in args.keys():
print('key... | apache-2.0 | Python |
b439017a21ac01ee7fda275753effaf5d103a120 | Change IP. | Scifabric/pybossa,geotagx/pybossa,geotagx/pybossa,Scifabric/pybossa,PyBossa/pybossa,PyBossa/pybossa | pybossa/signer/__init__.py | pybossa/signer/__init__.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2015 SciFabric LTD.
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | agpl-3.0 | Python |
54d39aaf8c31a5827ae7338fefe7a1d6a19d52cf | Add missing docstring. | 40323230/Pyslvs-PyQt5,KmolYuan/Pyslvs-PyQt5,KmolYuan/Pyslvs-PyQt5 | pyslvs_ui/info/__init__.py | pyslvs_ui/info/__init__.py | # -*- coding: utf-8 -*-
"""'info' module contains Pyslvs program information."""
__all__ = [
'KERNELS',
'SYS_INFO',
'ARGUMENTS',
'HAS_SLVS',
'Kernel',
'check_update',
'PyslvsAbout',
'html',
'logger',
'XStream',
'size_format',
]
__author__ = "Yuan Chang"
__copyright__ = "Cop... | # -*- coding: utf-8 -*-
"""'info' module contains Pyslvs program information."""
__all__ = [
'KERNELS',
'SYS_INFO',
'ARGUMENTS',
'HAS_SLVS',
'Kernel',
'check_update',
'PyslvsAbout',
'html',
'logger',
'XStream',
'size_format',
]
__author__ = "Yuan Chang"
__copyright__ = "Cop... | agpl-3.0 | Python |
7b19611d30dfc9091823ae3d960ab2790dfe9cfc | Apply a blur filter automatically for each detected face | symisc/pixlab,symisc/pixlab,symisc/pixlab | python/blur_human_faces.py | python/blur_human_faces.py | import requests
import json
imgUrl = 'https://pixlab.io/images/m3.jpg' # Target picture we want to blur any face on
# Detect all human faces in a given image via /facedetect first and blur all of them later via /mogrify.
# https://pixlab.io/cmd?id=facedetect and https://pixlab.io/cmd?id=mogrify for additional informa... | import requests
import json
imgUrl = 'https://pixlab.io/images/m3.jpg' # Target picture we want to blur any face on
# Detect all human faces in a given image via /facedetect first and blur all of them later via /mogrify.
# https://pixlab.io/cmd?id=facedetect and https://pixlab.io/cmd?id=mogrify for additional informa... | bsd-2-clause | Python |
8a950dbfb1281216ed270bf6363c7a71d857133f | Make datetime and time +00:00 handling behavior consistent. Fix #3. | pydanny/webhooks | webhooks/encoders.py | webhooks/encoders.py | """
Serialize data to/from JSON
Inspired by https://github.com/django/django/blob/master/django/core/serializers/json.py
"""
# Avoid shadowing the standard library json module
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import decimal
import json
class WebHooksJSON... | """
Serialize data to/from JSON
Inspired by https://github.com/django/django/blob/master/django/core/serializers/json.py
"""
# Avoid shadowing the standard library json module
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import decimal
import json
class WebHooksJSON... | bsd-3-clause | Python |
8120b641ccb66b088fa70c028e5be542bf561dfd | Update lex_attrs.py (#5608) | spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,honnibal/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy | spacy/lang/hy/lex_attrs.py | spacy/lang/hy/lex_attrs.py | # coding: utf8
from __future__ import unicode_literals
from ...attrs import LIKE_NUM
_num_words = [
"զրո",
"մեկ",
"երկու",
"երեք",
"չորս",
"հինգ",
"վեց",
"յոթ",
"ութ",
"ինը",
"տասը",
"տասնմեկ",
"տասներկու",
"տասներեք",
"տասնչորս",
"տասնհինգ",
"տա... | # coding: utf8
from __future__ import unicode_literals
from ...attrs import LIKE_NUM
_num_words = [
"զրօ",
"մէկ",
"երկու",
"երեք",
"չորս",
"հինգ",
"վեց",
"յոթ",
"ութ",
"ինը",
"տասը",
"տասնմեկ",
"տասներկու",
"տասներեք",
"տասնչորս",
"տասնհինգ",
"տա... | mit | Python |
cd8024c762bf5bae8caf210b9224548bee55ee04 | Bump version to 6.1.5a3 | platformio/platformio-core,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
12c22ebdf3c7e84f5f9c6b32329f343c8317f11b | Correct comments | owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus | python/dbtools/__init__.py | python/dbtools/__init__.py | '''
This library provides database access routines.
It's based on the re-usable parts of tailoredstats.
Owain Kenway
'''
'''
Generally abstract away DB queries, such that all complexity is replaced with:
dbtools.dbquery(db, query)
'''
def dbquery(db, query, mysqlhost="mysql.external.... | '''
This library provides database access routines.
It's based on the re-usable parts of tailoredstats.
Owain Kenway
'''
'''
Generally abstract away DB queries, such that all complexity is replaced with:
dbtools.dbquery(db, query)
'''
def dbquery(db, query, mysqlhost="mysql.external.... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.