commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
5c41066e9c93c417253cbde325a18079c1c69d1a | scipy/sparse/linalg/isolve/__init__.py | scipy/sparse/linalg/isolve/__init__.py | "Iterative Solvers for Sparse Linear Systems"
#from info import __doc__
from iterative import *
from minres import minres
from lgmres import lgmres
from lsqr import lsqr
__all__ = filter(lambda s:not s.startswith('_'),dir())
from numpy.testing import Tester
test = Tester().test
bench = Tester().bench
| "Iterative Solvers for Sparse Linear Systems"
#from info import __doc__
from iterative import *
from minres import minres
from lgmres import lgmres
from lsqr import lsqr
from lsmr import lsmr
__all__ = filter(lambda s:not s.startswith('_'),dir())
from numpy.testing import Tester
test = Tester().test
bench = Tester().... | Add lsmr to isolve module. | ENH: Add lsmr to isolve module.
| Python | bsd-3-clause | bkendzior/scipy,mikebenfield/scipy,anielsen001/scipy,nonhermitian/scipy,aeklant/scipy,apbard/scipy,jjhelmus/scipy,giorgiop/scipy,sonnyhu/scipy,befelix/scipy,jor-/scipy,gfyoung/scipy,piyush0609/scipy,pbrod/scipy,Shaswat27/scipy,pschella/scipy,chatcannon/scipy,Newman101/scipy,ilayn/scipy,Newman101/scipy,mtrbean/scipy,Sha... | ---
+++
@@ -5,6 +5,7 @@
from minres import minres
from lgmres import lgmres
from lsqr import lsqr
+from lsmr import lsmr
__all__ = filter(lambda s:not s.startswith('_'),dir())
from numpy.testing import Tester |
493cfa88dae90a19a4173deaae5f4af8934b47b5 | datastore/tests/services/test_export.py | datastore/tests/services/test_export.py | from django.test import TestCase
from django.contrib.auth.models import User
from datastore import models, services
class ExportServiceTestCase(TestCase):
def setUp(self):
user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')
project = models.Project.objects.create(
... | Add test of export service | Add test of export service
| Python | mit | impactlab/oeem-energy-datastore,impactlab/oeem-energy-datastore,impactlab/oeem-energy-datastore | ---
+++
@@ -0,0 +1,28 @@
+from django.test import TestCase
+from django.contrib.auth.models import User
+
+from datastore import models, services
+
+class ExportServiceTestCase(TestCase):
+
+ def setUp(self):
+ user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')
+ project... | |
993ada8e5e970399b98b40832b5a3d23874ae7fb | plugins/vetting/ontarget/system_info.py | plugins/vetting/ontarget/system_info.py | #!/usr/bin/env python
'''
Automatron: Fact Finder
Identify facts about a specified host
* Hostname
'''
import os
import json
# pylint: disable=C0103
system_info = {
'hostname' : os.uname()[1],
'os' : os.uname()[0],
'kernel' : os.uname()[2],
}
print json.dumps(system_info)
| #!/usr/bin/env python
'''
Automatron: Fact Finder
Identify facts about a specified host
* Hostname
* Networking
'''
import os
import json
import subprocess
def get_linux_networking():
''' Gather linux networking information '''
interfaces = []
if os.path.isdir("/sys/class/net/"):
interface... | Revert "Revert "Adding ip interface facts"" | Revert "Revert "Adding ip interface facts""
| Python | apache-2.0 | madflojo/automatron,madflojo/automatron,madflojo/automatron,madflojo/automatron | ---
+++
@@ -5,18 +5,51 @@
Identify facts about a specified host
* Hostname
+ * Networking
'''
import os
import json
+import subprocess
-# pylint: disable=C0103
-system_info = {
- 'hostname' : os.uname()[1],
- 'os' : os.uname()[0],
- 'kernel' : os.uname()[2],
-}
+def get_linux_networking():
... |
ff0631c625cda7c1aac3d86cbc7074a996ef0fc1 | powerline/bindings/bar/powerline-bar.py | powerline/bindings/bar/powerline-bar.py | #!/usr/bin/env python
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
import time
from threading import Lock
from argparse import ArgumentParser
from powerline import Powerline
from powerline.lib.monotonic import monotonic
from powerline.l... | #!/usr/bin/env python
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
import time
from threading import Lock
from argparse import ArgumentParser
from powerline import Powerline
from powerline.lib.monotonic import monotonic
from powerline.l... | Make sure powerline class knows that it will use UTF-8 | Make sure powerline class knows that it will use UTF-8
| Python | mit | darac/powerline,darac/powerline,junix/powerline,dragon788/powerline,kenrachynski/powerline,junix/powerline,areteix/powerline,russellb/powerline,seanfisk/powerline,Liangjianghao/powerline,lukw00/powerline,xxxhycl2010/powerline,bezhermoso/powerline,bartvm/powerline,EricSB/powerline,cyrixhero/powerline,DoctorJellyface/pow... | ---
+++
@@ -13,6 +13,21 @@
from powerline.lib.encoding import get_unicode_writer
+class BarPowerline(Powerline):
+ get_encoding = staticmethod(lambda: 'utf-8')
+
+ def init(self):
+ super(BarPowerline, self).init(ext='wm', renderer_module='bar')
+
+
+def render(event=None, data=None, sub=None):
+ global lock
+ ... |
f99a898d66c9f88496dee73ec574c7b9b69e8dc2 | ocds/storage/backends/design/tenders.py | ocds/storage/backends/design/tenders.py | from ocds.storage.helpers import CouchView
class AllDocs(CouchView):
design = 'docs'
@staticmethod
def map(doc):
yield (doc['tenderID'], doc)
class DateView(CouchView):
design = 'dates'
@staticmethod
def map(doc):
yield (doc['dateModified'], doc)
views = [
AllDocs()... | from ocds.storage.helpers import CouchView
class AllDocs(CouchView):
design = 'docs'
@staticmethod
def map(doc):
if 'doc_type' in doc and doc['doc_type'] != 'Tender':
return
yield doc['_id'], doc
class DateView(CouchView):
design = 'dates'
@staticmethod
def m... | Add filter in design docs | Add filter in design docs
| Python | apache-2.0 | yshalenyk/openprocurement.ocds.export,yshalenyk/ocds.export,yshalenyk/openprocurement.ocds.export | ---
+++
@@ -7,7 +7,10 @@
@staticmethod
def map(doc):
- yield (doc['tenderID'], doc)
+ if 'doc_type' in doc and doc['doc_type'] != 'Tender':
+ return
+
+ yield doc['_id'], doc
class DateView(CouchView):
@@ -16,7 +19,10 @@
@staticmethod
def map(doc):
- ... |
d3f33af2fa7d4e7bf9969752e696aaf8120642bc | panoptes/environment/weather_station.py | panoptes/environment/weather_station.py | import datetime
import zmq
from . import monitor
from panoptes.utils import logger, config, messaging, threads
@logger.has_logger
@config.has_config
class WeatherStation(monitor.EnvironmentalMonitor):
"""
This object is used to determine the weather safe/unsafe condition. It inherits
from the monitor.En... | import datetime
import zmq
from . import monitor
from panoptes.utils import logger, config, messaging, threads
@logger.has_logger
@config.has_config
class WeatherStation(monitor.EnvironmentalMonitor):
"""
This object is used to determine the weather safe/unsafe condition. It inherits
from the monitor.En... | Set up weather station to receive updates | Set up weather station to receive updates
| Python | mit | Guokr1991/POCS,fmin2958/POCS,AstroHuntsman/POCS,panoptes/POCS,panoptes/POCS,fmin2958/POCS,Guokr1991/POCS,AstroHuntsman/POCS,AstroHuntsman/POCS,panoptes/POCS,panoptes/POCS,joshwalawender/POCS,Guokr1991/POCS,AstroHuntsman/POCS,fmin2958/POCS,joshwalawender/POCS,joshwalawender/POCS,Guokr1991/POCS | ---
+++
@@ -38,7 +38,6 @@
def monitor(self):
"""
- Reads serial information off the attached weather station and publishes
- message with status
+ Reads serial information off the attached weather station
"""
- self.send_message('UNSAFE')
+ msg = self.socket... |
dc40793ad27704c83dbbd2e923bf0cbcd7cb00ed | polyaxon/event_manager/event_service.py | polyaxon/event_manager/event_service.py | from libs.services import Service
class EventService(Service):
__all__ = ('record', 'setup')
event_manager = None
def can_handle(self, event_type):
return isinstance(event_type, str) and self.event_manager.knows(event_type)
def get_event(self, event_type, instance, **kwargs):
return... | from libs.services import Service
class EventService(Service):
__all__ = ('record', 'setup')
event_manager = None
def can_handle(self, event_type):
return isinstance(event_type, str) and self.event_manager.knows(event_type)
def get_event(self, event_type, event_data=None, instance=None, **k... | Handle both event instanciation from object and from serialized events | Handle both event instanciation from object and from serialized events
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | ---
+++
@@ -9,12 +9,16 @@
def can_handle(self, event_type):
return isinstance(event_type, str) and self.event_manager.knows(event_type)
- def get_event(self, event_type, instance, **kwargs):
+ def get_event(self, event_type, event_data=None, instance=None, **kwargs):
+ if instance or not ... |
38d298a81aa8fcd85b16b3879c1665085e5450be | exercises/control_flow/prime.py | exercises/control_flow/prime.py | #!/bin/python
def is_prime(integer):
"""Determines weather integer is prime, returns a boolean value"""
for i in range(2, integer):
if integer % i == 0:
return False
return True
print("Should be False (0): %r" % is_prime(0))
print("Should be False (1): %r" % is_prime(1))
print("Sho... | #!/bin/python
def is_prime(integer):
"""Determines weather integer is prime, returns a boolean value"""
# add logic here to make sure number < 2 are not prime
for i in range(2, integer):
if integer % i == 0:
return False
return True
print("Should be False (0): %r" % is_prime(0... | Add description where student should add logic | Add description where student should add logic
| Python | mit | introprogramming/exercises,introprogramming/exercises,introprogramming/exercises | ---
+++
@@ -3,6 +3,8 @@
def is_prime(integer):
"""Determines weather integer is prime, returns a boolean value"""
+ # add logic here to make sure number < 2 are not prime
+
for i in range(2, integer):
if integer % i == 0:
return False |
d5b326d8d368d2ac75c6e078572df8c28704c163 | vcs/models.py | vcs/models.py | from django.db import models
class Activity(models.Model):
group = models.CharField(max_length=4)
grouptype = models.TextField()
groupdetail = models.TextField()
details = models.TextField()
disabled = models.BooleanField()
time = models.DecimalField(decimal_places=2, max_digits=10)
unique_... | from django.db import models
class Activity(models.Model):
group = models.CharField(max_length=4)
grouptype = models.TextField()
groupdetail = models.TextField()
details = models.TextField()
disabled = models.BooleanField()
time = models.DecimalField(decimal_places=2, max_digits=10)
unique_... | Use the app string version of foreign keying. It prevents a circular import. | Use the app string version of foreign keying. It prevents a circular import.
| Python | bsd-3-clause | AeroNotix/django-timetracker,AeroNotix/django-timetracker,AeroNotix/django-timetracker | ---
+++
@@ -10,9 +10,8 @@
unique_together = (("group", "grouptype", "disabled", "time"),)
class ActivityEntry(models.Model):
- from timetracker.tracker.models import Tbluser
user = models.ManyToManyField(
- Tbluser,
+ 'tracker.Tbluser',
related_name="user_foreign"
)
ac... |
1163bc40a15eb2461c6ead570db8a8d211f1f5be | web/blueprints/facilities/tables.py | web/blueprints/facilities/tables.py | from web.blueprints.helpers.table import BootstrapTable, Column
class SiteTable(BootstrapTable):
def __init__(self, *a, **kw):
super().__init__(*a, columns=[
Column('site', 'Site', formatter='table.linkFormatter'),
Column('buildings', 'Buildings', formatter='table.multiBtnFormatter... | from web.blueprints.helpers.table import BootstrapTable, Column
class SiteTable(BootstrapTable):
def __init__(self, *a, **kw):
super().__init__(*a, columns=[
Column('site', 'Site', formatter='table.linkFormatter'),
Column('buildings', 'Buildings', formatter='table.multiBtnFormatter... | Sort room table by room name by default | Sort room table by room name by default
| Python | apache-2.0 | agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft | ---
+++
@@ -15,6 +15,7 @@
Column('room', 'Raum', formatter='table.linkFormatter'),
Column('inhabitants', 'Bewohner', formatter='table.multiBtnFormatter'),
], table_args={
+ 'data-sort-name': 'room',
'data-query-params': 'perhaps_all_users_query_params',
... |
1abbca6200fa3da0a3216b18b1385f3575edb49a | registration/__init__.py | registration/__init__.py | from django.utils.version import get_version as django_get_version
VERSION = (0, 9, 0, 'beta', 1)
def get_version():
return django_get_version(VERSION) # pragma: no cover
| VERSION = (0, 9, 0, 'beta', 1)
def get_version():
from django.utils.version import get_version as django_get_version
return django_get_version(VERSION) # pragma: no cover
| Move import of Django's get_version into django-registration's get_version, to avoid dependency-order problems. | Move import of Django's get_version into django-registration's get_version, to avoid dependency-order problems.
| Python | bsd-3-clause | myimages/django-registration,Troyhy/django-registration,futurecolors/django-registration,hacklabr/django-registration,akvo/django-registration,sandipagr/django-registration,futurecolors/django-registration,liberation/django-registration,euanlau/django-registration,tdruez/django-registration,Troyhy/django-registration,g... | ---
+++
@@ -1,8 +1,6 @@
-from django.utils.version import get_version as django_get_version
-
-
VERSION = (0, 9, 0, 'beta', 1)
def get_version():
+ from django.utils.version import get_version as django_get_version
return django_get_version(VERSION) # pragma: no cover |
37d01f6088b1cf5673f66f4532dd51c73a0156f1 | rest_framework/authtoken/serializers.py | rest_framework/authtoken/serializers.py | from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class AuthTokenSerializer(serializers.Serializer):
username = serializers.CharField()
password = serializers.CharField()
def validate(self, attrs):
username... | from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class AuthTokenSerializer(serializers.Serializer):
username = serializers.CharField()
password = serializers.CharField()
def validate(self, attrs):
username... | Fix grammar in login error message | Fix grammar in login error message
| Python | bsd-2-clause | sehmaschine/django-rest-framework,arpheno/django-rest-framework,ajaali/django-rest-framework,adambain-vokal/django-rest-framework,buptlsl/django-rest-framework,aericson/django-rest-framework,YBJAY00000/django-rest-framework,VishvajitP/django-rest-framework,werthen/django-rest-framework,xiaotangyuan/django-rest-framewor... | ---
+++
@@ -22,7 +22,7 @@
attrs['user'] = user
return attrs
else:
- msg = _('Unable to login with provided credentials.')
+ msg = _('Unable to log in with provided credentials.')
raise serializers.ValidationError(msg)
... |
cd9a51ab2fe6b99c0665b8f499363a4d557b4a4d | DataWrangling/CaseStudy/sample_file.py | DataWrangling/CaseStudy/sample_file.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET # Use cElementTree or lxml if too slow
import os
OSM_FILE = "san-francisco-bay_california.osm" # Replace this with your osm file
SAMPLE_FILE = "sample_sfb.osm"
k = 20 # Parameter: take every k-th top level element
def get_element(osm... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET # Use cElementTree or lxml if too slow
import os
OSM_FILE = "san-francisco-bay_california.osm" # Replace this with your osm file
SAMPLE_FILE = "sample_sfb.osm"
k = 20 # Parameter: take every k-th top level element
def get_element(osm... | Modify script which split your region in smaller sample | feat: Modify script which split your region in smaller sample
| Python | mit | aguijarro/DataSciencePython | ---
+++
@@ -34,3 +34,6 @@
output.write(ET.tostring(element, encoding='utf-8'))
output.write('</osm>')
+
+if __name__ == '__main__':
+ main() |
828e75919bd71912baf75a64010efcfcd93d07f1 | library_magic.py | library_magic.py | import sys
import subprocess
import shutil
executable = sys.argv[1]
execfolder = sys.argv[1].rsplit("/",1)[0]
libdir = execfolder+"/lib"
otool_cmd = ["otool", "-L",executable]
# Run otool
otool_out = subprocess.check_output(otool_cmd).split("\n\t")
# Find all the dylib files
for l in otool_out:
s = l.split(".dylib"... | import sys
import subprocess
import shutil
copied = []
def update_libraries(executable):
# Find all the dylib files and recursively add dependencies
print "\nChecking dependencies of " + executable
otool_cmd = ["otool", "-L",executable]
execfolder = executable.rsplit("/",1)[0]
otool_out = subprocess.check_outp... | Update library magic to be recursive | Update library magic to be recursive
| Python | bsd-3-clause | baubie/SpikeDB,baubie/SpikeDB,baubie/SpikeDB,baubie/SpikeDB | ---
+++
@@ -2,20 +2,35 @@
import subprocess
import shutil
-executable = sys.argv[1]
-execfolder = sys.argv[1].rsplit("/",1)[0]
-libdir = execfolder+"/lib"
-otool_cmd = ["otool", "-L",executable]
+copied = []
-# Run otool
-otool_out = subprocess.check_output(otool_cmd).split("\n\t")
+def update_libraries(executa... |
dfa39db42cc5ce2c29da2ec0c388865ec7f41030 | oauth2_provider/forms.py | oauth2_provider/forms.py | from django import forms
class AllowForm(forms.Form):
redirect_uri = forms.URLField(widget=forms.HiddenInput())
scopes = forms.CharField(required=False, widget=forms.HiddenInput())
client_id = forms.CharField(widget=forms.HiddenInput())
state = forms.CharField(required=False, widget=forms.HiddenInput(... | from django import forms
class AllowForm(forms.Form):
allow = forms.BooleanField(required=False)
redirect_uri = forms.URLField(widget=forms.HiddenInput())
scopes = forms.CharField(required=False, widget=forms.HiddenInput())
client_id = forms.CharField(widget=forms.HiddenInput())
state = forms.Char... | Add allow field to form | Add allow field to form
| Python | bsd-2-clause | trbs/django-oauth-toolkit,DeskConnect/django-oauth-toolkit,jensadne/django-oauth-toolkit,vmalavolta/django-oauth-toolkit,JensTimmerman/django-oauth-toolkit,JensTimmerman/django-oauth-toolkit,Gr1N/django-oauth-toolkit,andrefsp/django-oauth-toolkit,jensadne/django-oauth-toolkit,drgarcia1986/django-oauth-toolkit,bleib1dj/... | ---
+++
@@ -2,6 +2,7 @@
class AllowForm(forms.Form):
+ allow = forms.BooleanField(required=False)
redirect_uri = forms.URLField(widget=forms.HiddenInput())
scopes = forms.CharField(required=False, widget=forms.HiddenInput())
client_id = forms.CharField(widget=forms.HiddenInput()) |
11cd074f67668135d606f68dddb66c465ec01756 | opps/core/tags/models.py | opps/core/tags/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from opps.core.models import Date, Slugged
class Tag(Date, Slugged):
name = models.CharField(_(u'Name'), max_length=255, unique=True)
def save(self,... | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from opps.core.models import Date, Slugged
class Tag(Date, Slugged):
name = models.CharField(_(u'Name'), max_length=255, unique=True,
... | Add db index on field tag name | Add db index on field tag name
| Python | mit | jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps,opps/opps,YACOWS/opps,YACOWS/opps,opps/opps,opps/opps,jeanmask/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,williamroot/opps,williamroot/opps | ---
+++
@@ -7,7 +7,8 @@
class Tag(Date, Slugged):
- name = models.CharField(_(u'Name'), max_length=255, unique=True)
+ name = models.CharField(_(u'Name'), max_length=255, unique=True,
+ db_index=True)
def save(self, *args, **kwargs):
if not self.slug:
@@ -19,10 +2... |
38a2d86aed4ea1e94691993c5f49722f9a69ac8d | lisa/__init__.py | lisa/__init__.py | #! /usr/bin/env python3
import warnings
import os
import sys
from lisa.version import __version__
# Raise an exception when a deprecated API is used from within a lisa.*
# submodule. This ensures that we don't use any deprecated APIs internally, so
# they are only kept for external backward compatibility purposes.
... | #! /usr/bin/env python3
import warnings
import os
import sys
from lisa.version import __version__
# Raise an exception when a deprecated API is used from within a lisa.*
# submodule. This ensures that we don't use any deprecated APIs internally, so
# they are only kept for external backward compatibility purposes.
... | Remove Python < 3.6 version check | lisa: Remove Python < 3.6 version check
Since Python >= 3.6 is now mandatory, remove the check and the warning.
| Python | apache-2.0 | ARM-software/lisa,credp/lisa,credp/lisa,credp/lisa,credp/lisa,ARM-software/lisa,ARM-software/lisa,ARM-software/lisa | ---
+++
@@ -34,14 +34,4 @@
if not os.getenv('DISPLAY'):
matplotlib.use('Agg')
-if sys.version_info < (3, 6):
- warnings.warn(
- 'Python 3.6 will soon be required to run LISA, please upgrade from {} to any version higher than 3.6'.format(
- '.'.join(
- map(str, tuple... |
7fd76d87cfda8f02912985cb3cf650ee8ff2e11e | mica/report/tests/test_write_report.py | mica/report/tests/test_write_report.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import tempfile
import os
import shutil
import pytest
from .. import report
try:
import Ska.DBI
with Ska.DBI.DBI(server='sqlsao', dbi='sybase', user='aca_ops', database='axafocat') as db:
assert db.conn._is_connected == 1
HAS_SYBA... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import tempfile
import os
import shutil
import pytest
from .. import report
try:
import Ska.DBI
with Ska.DBI.DBI(server='sqlsao', dbi='sybase', user='aca_ops', database='axafocat') as db:
HAS_SYBASE_ACCESS = True
except:
HAS_SYBASE_AC... | Remove py2 Ska.DBI assert in report test | Remove py2 Ska.DBI assert in report test
| Python | bsd-3-clause | sot/mica,sot/mica | ---
+++
@@ -9,7 +9,6 @@
try:
import Ska.DBI
with Ska.DBI.DBI(server='sqlsao', dbi='sybase', user='aca_ops', database='axafocat') as db:
- assert db.conn._is_connected == 1
HAS_SYBASE_ACCESS = True
except:
HAS_SYBASE_ACCESS = False |
ed0821bd41a10dd00727f09cf9ba82123bd2cf93 | scripts/import_permissions_and_roles.py | scripts/import_permissions_and_roles.py | #!/usr/bin/env python
"""Import permissions, roles, and their relations from a TOML file.
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
import click
from byceps.services.authorization import impex_service
from byceps.util.system import get_config_filename_from... | #!/usr/bin/env python
"""Import permissions, roles, and their relations from a TOML file.
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
import click
from byceps.services.authorization import impex_service
from byceps.util.system import get_config_filename_from... | Fix output of permissions import script | Fix output of permissions import script
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | ---
+++
@@ -19,7 +19,7 @@
def execute(data_file):
permission_count, role_count = impex_service.import_from_file(data_file)
click.secho(
- 'Imported {permission_count} permissions and {role_count} roles.',
+ f'Imported {permission_count} permissions and {role_count} roles.',
fg='green... |
f20c911285cc83f2cfe2b4650ba85f4b82eae43c | plyer/facades/temperature.py | plyer/facades/temperature.py | class Temperature(object):
'''Temperature facade.
Temperature sensor is used to measure the ambient room temperature in degrees Celsius
With method `enable` you can turn on temperature sensor and 'disable'
method stops the sensor.
Use property `temperature` to get ambient air temperature in degree C... | class Temperature(object):
'''Temperature facade.
Temperature sensor is used to measure the ambient room temperature in
degrees Celsius (°C)
With method `enable` you can turn on temperature sensor and 'disable'
method stops the sensor.
Use property `temperature` to get ambient air temperature in... | Improve description about the api | Improve description about the api
| Python | mit | KeyWeeUsr/plyer,kivy/plyer,kivy/plyer,kived/plyer,KeyWeeUsr/plyer,kived/plyer,kivy/plyer,KeyWeeUsr/plyer | ---
+++
@@ -1,6 +1,7 @@
class Temperature(object):
'''Temperature facade.
- Temperature sensor is used to measure the ambient room temperature in degrees Celsius
+ Temperature sensor is used to measure the ambient room temperature in
+ degrees Celsius (°C)
With method `enable` you can turn on temp... |
d6c81135077867283738bcf9cceb0ce8198808d6 | unicornclient/config.py | unicornclient/config.py | import os
import logging
ENV = os.getenv('PYTHONENV', 'prod')
LOG_LEVEL = logging.DEBUG
LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
HOST = 'localhost'
PORT = 8080
SSL_VERIFY = False
DEFAULT_ROUTINES = ['auth', 'ping', 'status', 'system']
if ENV == 'prod':
LOG_LEVEL = logging.INFO
HOST = 'unic... | import os
import logging
ENV = os.getenv('PYTHONENV', 'prod')
LOG_LEVEL = logging.DEBUG
LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
HOST = 'localhost'
PORT = 8080
SSL_VERIFY = False
DEFAULT_ROUTINES = ['auth', 'ping', 'status', 'system']
if ENV == 'prod':
LOG_LEVEL = logging.INFO
HOST = 'unic... | Enable SSL verify for prod | Enable SSL verify for prod
| Python | mit | amm0nite/unicornclient,amm0nite/unicornclient | ---
+++
@@ -16,4 +16,4 @@
if ENV == 'prod':
LOG_LEVEL = logging.INFO
HOST = 'unicorn.ahst.fr'
- #SSL_VERIFY = True
+ SSL_VERIFY = True |
462312c3acf2d6daf7d8cd27f251b8cb92647f5e | pybossa/auth/category.py | pybossa/auth/category.py | from flaskext.login import current_user
def create(app=None):
if current_user.is_authenticated():
if current_user.admin is True:
return True
else:
return False
else:
return False
def read(app=None):
return True
def update(app):
return create(app)
d... | from flaskext.login import current_user
def create(category=None):
if current_user.is_authenticated():
if current_user.admin is True:
return True
else:
return False
else:
return False
def read(category=None):
return True
def update(category):
return ... | Fix a typo in the variable name | Fix a typo in the variable name
| Python | agpl-3.0 | jean/pybossa,geotagx/geotagx-pybossa-archive,OpenNewsLabs/pybossa,stefanhahmann/pybossa,proyectos-analizo-info/pybossa-analizo-info,stefanhahmann/pybossa,proyectos-analizo-info/pybossa-analizo-info,Scifabric/pybossa,geotagx/geotagx-pybossa-archive,geotagx/geotagx-pybossa-archive,OpenNewsLabs/pybossa,harihpr/tweetclicke... | ---
+++
@@ -1,7 +1,7 @@
from flaskext.login import current_user
-def create(app=None):
+def create(category=None):
if current_user.is_authenticated():
if current_user.admin is True:
return True
@@ -11,13 +11,13 @@
return False
-def read(app=None):
+def read(category=None):... |
1ee2e880872c4744f4159df7fc64bb64b3f35632 | pygametemplate/button.py | pygametemplate/button.py | import time
class Button(object):
"""Class representing keyboard keys."""
def __init__(self, game, number):
self.game = game
self.number = number
self.event = None # The last event that caused the button press
self.pressed = 0 # If the button was just pressed
sel... | import time
class Button(object):
"""Class representing keyboard keys."""
def __init__(self, game, number):
self.game = game
self.number = number
self.event = None # The last event that caused the button press
self.pressed = 0 # If the button was just pressed
sel... | Add docstring to Button.time_held() method | Add docstring to Button.time_held() method
| Python | mit | AndyDeany/pygame-template | ---
+++
@@ -27,7 +27,8 @@
self.pressed = 0
self.released = 0
- def time_held(self):
+ def time_held(self) -> float:
+ """Return the amount of time this button has been held for in seconds."""
if self.held:
return time.time() - self.press_time
else: |
6708830ab2bde841bbc3da2befbbe5ab9f3d21aa | ansi_str.py | ansi_str.py | import re
_ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])')
def strip_ansi(value):
return _ansi_re.sub('', value)
def len_exclude_ansi(value):
return len(strip_ansi(value))
class ansi_str(str):
"""A str subclass, specialized for strings containing ANSI escapes.
When you call the ``len`` metho... | import re
_ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])')
def strip_ansi(value):
return _ansi_re.sub('', value)
def len_exclude_ansi(value):
return len(strip_ansi(value))
class ansi_str(str):
"""A str subclass, specialized for strings containing ANSI escapes.
When you call the ``len`` metho... | Put test stuff inside `if __name__ == '__main__'` | Put test stuff inside `if __name__ == '__main__'`
| Python | mit | msabramo/ansi_str | ---
+++
@@ -28,13 +28,15 @@
self._stripped = strip_ansi(self[:])
return len(self._stripped)
-# s = ansi_str('abc')
-# print s
-# print len(s)
-s = ansi_str(u'\x1b[32m\x1b[1mSUCCESS\x1b[0m')
-print s
-print len(s)
-print s.__len__()
-print s.__len__(exclude_ansi=False)
-print(len_exclude_ansi... |
1056c3f489b162d77b6c117fad2b45bfa06beee1 | app/urls.py | app/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
#from . import views
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'app.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', 'app.views.splash', name='... | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
#from . import views
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'app.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', 'app.views.splash', name='sp... | Revert "Added a post view" | Revert "Added a post view"
This reverts commit b1063480e7b2e1128c457e9e65c52f742109d90d.
| Python | unlicense | yourbuddyconner/cs399-social,yourbuddyconner/cs399-social | ---
+++
@@ -2,8 +2,6 @@
from django.contrib import admin
from django.conf import settings
#from . import views
-
-
urlpatterns = patterns('',
# Examples:
@@ -18,8 +16,7 @@
url(r'^dashboard', 'app.views.dashboard', name='dashboard'),
url(r'^login', 'app.views.login', name='login'),
url(r'^log... |
1165c923145be18d40fda1fc4303cac3e1613078 | app/util.py | app/util.py | # Various utility functions
import os
SHOULD_CACHE = os.environ.get('ENV', 'development') == 'production'
def cached_function(func):
data = {}
def wrapper(*args):
if not SHOULD_CACHE:
return func(*args)
cache_key = ' '.join([str(x) for x in args])
if cache_key not in dat... | # Various utility functions
import os
SHOULD_CACHE = os.environ.get('ENV', 'development') == 'production'
def cached_function(func):
data = {}
def wrapper(*args):
if not SHOULD_CACHE:
return func(*args)
cache_key = ' '.join([str(x) for x in args])
if cache_key not in dat... | Update cached_function wrapper to set qualname instead of name | Update cached_function wrapper to set qualname instead of name
| Python | mit | albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com | ---
+++
@@ -16,5 +16,5 @@
data[cache_key] = func(*args)
return data[cache_key]
- wrapper.__name__ = func.__name__
+ wrapper.__qualname__ = func.__qualname__
return wrapper |
4e74723aac53956fb0316ae0d438da623de133d5 | tests/extensions/video/test_renderer.py | tests/extensions/video/test_renderer.py | import pytest
from mfr.core.provider import ProviderMetadata
from mfr.extensions.video import VideoRenderer
@pytest.fixture
def metadata():
return ProviderMetadata('test', '.mp4', 'text/plain', '1234', 'http://wb.osf.io/file/test.mp4?token=1234')
@pytest.fixture
def file_path():
return '/tmp/test.mp4'
@... | import pytest
from mfr.core.provider import ProviderMetadata
from mfr.extensions.video import VideoRenderer
@pytest.fixture
def metadata():
return ProviderMetadata('test', '.mp4', 'text/plain', '1234',
'http://wb.osf.io/file/test.mp4?token=1234')
@pytest.fixture
def file_path():
... | Add and update tests for video renderer | Add and update tests for video renderer
| Python | apache-2.0 | felliott/modular-file-renderer,CenterForOpenScience/modular-file-renderer,felliott/modular-file-renderer,CenterForOpenScience/modular-file-renderer,CenterForOpenScience/modular-file-renderer,CenterForOpenScience/modular-file-renderer,felliott/modular-file-renderer,felliott/modular-file-renderer | ---
+++
@@ -1,13 +1,13 @@
import pytest
from mfr.core.provider import ProviderMetadata
-
from mfr.extensions.video import VideoRenderer
@pytest.fixture
def metadata():
- return ProviderMetadata('test', '.mp4', 'text/plain', '1234', 'http://wb.osf.io/file/test.mp4?token=1234')
+ return ProviderMetadat... |
0b048cef1f0efd190d8bf8f50c69df35c59b91a3 | xdc-plugin/tests/compare_output_json.py | xdc-plugin/tests/compare_output_json.py | #!/usr/bin/env python3
"""
This script extracts the top module cells and their corresponding parameters
from json files produced by Yosys.
The return code of this script is used to check if the output is equivalent.
"""
import sys
import json
def read_cells(json_file):
with open(json_file) as f:
data = j... | #!/usr/bin/env python3
"""
This script extracts the top module cells and their corresponding parameters
from json files produced by Yosys.
The return code of this script is used to check if the output is equivalent.
"""
import sys
import json
parameters = ["IOSTANDARD", "DRIVE", "SLEW", "IN_TERM"]
def read_cells(js... | Add verbosity on JSON compare fail | XDC: Add verbosity on JSON compare fail
Signed-off-by: Tomasz Michalak <a2fdaa543b4cc5e3d6cd8672ec412c0eb393b86e@antmicro.com>
| Python | apache-2.0 | SymbiFlow/yosys-symbiflow-plugins,SymbiFlow/yosys-symbiflow-plugins,SymbiFlow/yosys-f4pga-plugins,SymbiFlow/yosys-symbiflow-plugins,chipsalliance/yosys-f4pga-plugins,antmicro/yosys-symbiflow-plugins,chipsalliance/yosys-f4pga-plugins,antmicro/yosys-symbiflow-plugins,antmicro/yosys-symbiflow-plugins,SymbiFlow/yosys-f4pga... | ---
+++
@@ -9,6 +9,8 @@
import sys
import json
+parameters = ["IOSTANDARD", "DRIVE", "SLEW", "IN_TERM"]
+
def read_cells(json_file):
with open(json_file) as f:
data = json.load(f)
@@ -16,7 +18,10 @@
cells = data['modules']['top']['cells']
cells_parameters = dict()
for cell, opts in c... |
b82f21ea92aad44ca101744a3f5300280f081524 | sweettooth/review/context_processors.py | sweettooth/review/context_processors.py |
from extensions.models import ExtensionVersion
def n_unreviewed_extensions(request):
if not request.user.has_perm("review.can-review-extensions"):
return dict()
return dict(n_unreviewed_extensions=ExtensionVersion.unreviewed().count())
|
from extensions.models import ExtensionVersion
def n_unreviewed_extensions(request):
if not request.user.has_perm("review.can-review-extensions"):
return dict()
return dict(n_unreviewed_extensions=ExtensionVersion.objects.unreviewed().count())
| Fix site when logged in | Fix site when logged in
| Python | agpl-3.0 | GNOME/extensions-web,magcius/sweettooth,GNOME/extensions-web,magcius/sweettooth,GNOME/extensions-web,GNOME/extensions-web | ---
+++
@@ -5,4 +5,4 @@
if not request.user.has_perm("review.can-review-extensions"):
return dict()
- return dict(n_unreviewed_extensions=ExtensionVersion.unreviewed().count())
+ return dict(n_unreviewed_extensions=ExtensionVersion.objects.unreviewed().count()) |
ec7b52b457e749b4b4a1e9110ede221f2f0d5fe9 | data/propaganda2mongo.py | data/propaganda2mongo.py | import bson.json_util
from bson.objectid import ObjectId
import json
import sys
def main():
node_table = {}
while True:
line = sys.stdin.readline()
if not line:
break
record = json.loads(line)
ident = str(record["twitter_id"])
aoid = node_table.get(ident)... | import bson.json_util
from bson.objectid import ObjectId
import json
import sys
def main():
node_table = {}
while True:
line = sys.stdin.readline()
if not line:
break
record = json.loads(line)
ident = str(record["twitter_id"])
aoid = node_table.get(ident)... | Fix fatal error in data processing. | Fix fatal error in data processing.
The wrong identifier was being used as the key to tell whether a propagandist
had been seen before in the dataset, leading to a completely, and incorrectly
disconnected graph.
| Python | apache-2.0 | XDATA-Year-3/clique-propaganda,XDATA-Year-3/clique-propaganda,XDATA-Year-3/clique-propaganda | ---
+++
@@ -29,7 +29,7 @@
for p in record["propagandists_followed"]:
oid = node_table.get(p)
if oid is None:
- node_table[ident] = oid = ObjectId()
+ node_table[p] = oid = ObjectId()
print bson.json_util.dumps({"_id": oid,
... |
5bde6ca1fd62277463156875e874c4c6843923fd | pytest-{{cookiecutter.plugin_name}}/tests/test_{{cookiecutter.plugin_name}}.py | pytest-{{cookiecutter.plugin_name}}/tests/test_{{cookiecutter.plugin_name}}.py | # -*- coding: utf-8 -*-
def test_bar_fixture(testdir):
"""Make sure that pytest accepts our fixture."""
# create a temporary pytest test module
testdir.makepyfile("""
def test_sth(bar):
assert bar == "europython2015"
""")
# run pytest with the following cmd args
result = t... | # -*- coding: utf-8 -*-
def test_bar_fixture(testdir):
"""Make sure that pytest accepts our fixture."""
# create a temporary pytest test module
testdir.makepyfile("""
def test_sth(bar):
assert bar == "europython2015"
""")
# run pytest with the following cmd args
result = t... | Use the correct variable for the test | Use the correct variable for the test
| Python | mit | luzfcb/cookiecutter-pytest-plugin,pytest-dev/cookiecutter-pytest-plugin,s0undt3ch/cookiecutter-pytest-plugin | ---
+++
@@ -22,7 +22,7 @@
# make sure that that we get a '0' exit code for the testsuite
assert result.ret == 0
-
+
def test_help_message(testdir):
result = testdir.runpytest(
@@ -30,6 +30,6 @@
)
# fnmatch_lines does an assertion internally
result.stdout.fnmatch_lines([
- ... |
2549a66b6785d5a0ed0658a4f375a21c486792df | sifr/util.py | sifr/util.py | import datetime
from dateutil import parser
import six
def normalize_time(t):
try:
if isinstance(t, datetime.datetime):
return t
elif isinstance(t, datetime.date):
return datetime.datetime(t.year, t.month, t.day)
elif isinstance(t, (int, float)):
return ... | import datetime
from dateutil import parser
import six
def normalize_time(t):
try:
if isinstance(t, datetime.datetime):
return t
elif isinstance(t, datetime.date):
return datetime.datetime(t.year, t.month, t.day)
elif isinstance(t, (int, float)):
return ... | Raise explicit exception on no type match | Raise explicit exception on no type match
| Python | mit | alisaifee/sifr,alisaifee/sifr | ---
+++
@@ -14,7 +14,7 @@
elif isinstance(t, six.string_types):
return parser.parse(t)
else:
- raise
+ raise TypeError
except: # noqa
raise TypeError(
"time must be represented as either a timestamp (int,float), " |
66d1bce2cb497954749b211a26fd00ae4db6f7e7 | foodsaving/conversations/serializers.py | foodsaving/conversations/serializers.py | from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from rest_framework.exceptions import PermissionDenied
from foodsaving.conversations.models import Conversation, ConversationMessage
class ConversationSerializer(serializers.ModelSerializer):
class Meta:
model ... | from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from rest_framework.exceptions import PermissionDenied
from foodsaving.conversations.models import Conversation, ConversationMessage
class ConversationSerializer(serializers.ModelSerializer):
class Meta:
model ... | Remove random bit of code | Remove random bit of code
I have no idea what that is doing there. It is not called from
what I can tell, and the tests work without it. And it makes no
sense whatsoever, create a message each time you retrieve the
conversation info??!?!?!
| Python | agpl-3.0 | yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core | ---
+++
@@ -13,10 +13,6 @@
'participants',
'created_at'
]
-
- def retrieve(self, validated_data):
- user = self.context['request'].user
- return ConversationMessage.objects.create(author=user, **validated_data)
class ConversationMessageSerializer(serializers.Mo... |
d3847357c446c4a1ac50735b983b20cf57f9c7c6 | malcolm/controllers/countercontroller.py | malcolm/controllers/countercontroller.py | from malcolm.core.controller import Controller
from malcolm.core.attribute import Attribute
from malcolm.core.numbermeta import NumberMeta
from malcolm.core.method import takes
import numpy as np
class CounterController(Controller):
def create_attributes(self):
self.counter = Attribute(NumberMeta("counte... | from malcolm.core.controller import Controller
from malcolm.core.attribute import Attribute
from malcolm.core.numbermeta import NumberMeta
from malcolm.core.method import takes, returns
import numpy as np
class CounterController(Controller):
def create_attributes(self):
self.counter = Attribute(NumberMet... | Fix args and return of CounterController functions | Fix args and return of CounterController functions
Even though they're not used, functions to be wrapped by Methods have to
take arguments and return something (at least an empty dict).
| Python | apache-2.0 | dls-controls/pymalcolm,dls-controls/pymalcolm,dls-controls/pymalcolm | ---
+++
@@ -1,7 +1,7 @@
from malcolm.core.controller import Controller
from malcolm.core.attribute import Attribute
from malcolm.core.numbermeta import NumberMeta
-from malcolm.core.method import takes
+from malcolm.core.method import takes, returns
import numpy as np
@@ -14,9 +14,13 @@
yield self.co... |
270af43ffbe8974698d17ff6d5cae20fbf410f73 | admin/urls.py | admin/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .views import CubeHandler, ConnectionHandler
from .views import ElementHandler, DashboardHandler, APIElementCubeHandler
INCLUDE_URLS = [
(r"/admin/connection/?(?P<slug>[\w-]+)?", ConnectionHandler),
(r"/admin/cube/?(?P<slug>[\w-]+)?", CubeHandler),
(r"/ad... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .views import CubeHandler, ConnectionHandler, DeleteHandler
from .views import ElementHandler, DashboardHandler, APIElementCubeHandler
INCLUDE_URLS = [
(r"/admin/delete/(?P<bucket>[\w-]+)/(?P<slug>[\w-]+)", DeleteHandler),
(r"/admin/connection/?(?P<slug>[\w-]... | Add url enter delete element on riak | Add url enter delete element on riak
| Python | mit | jgabriellima/mining,avelino/mining,chrisdamba/mining,seagoat/mining,avelino/mining,AndrzejR/mining,mlgruby/mining,mlgruby/mining,mining/mining,mlgruby/mining,mining/mining,chrisdamba/mining,AndrzejR/mining,seagoat/mining,jgabriellima/mining | ---
+++
@@ -1,10 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from .views import CubeHandler, ConnectionHandler
+from .views import CubeHandler, ConnectionHandler, DeleteHandler
from .views import ElementHandler, DashboardHandler, APIElementCubeHandler
INCLUDE_URLS = [
+ (r"/admin/delete/(?P<buc... |
4e12aea0a5479bad8289cbf6c9f460931d51f701 | database.py | database.py | import MySQLdb
class database(object):
def __init__(self):
config = {}
execfile("config.py",config)
self.db = MySQLdb.connect(config["host"],config["user"],config["password"],config["database"])
def insert(self,txt):
dbc = self.db.cursor()
try:
dbc.execute("insert into " + txt)
dbc... | import MySQLdb
class database(object):
def __init__(self):
config = {}
execfile("config.py",config)
self.db = MySQLdb.connect(config["host"],config["user"],config["password"],config["database"])
self.db.autocommit(True)
def insert(self,txt):
dbc = self.db.cursor()
try:
dbc.execute("i... | Add autocommit to 1 to avoid select cache ¿WTF? | Add autocommit to 1 to avoid select cache ¿WTF?
| Python | agpl-3.0 | p4u/projecte_frigos,p4u/projecte_frigos,p4u/projecte_frigos,p4u/projecte_frigos | ---
+++
@@ -5,6 +5,7 @@
config = {}
execfile("config.py",config)
self.db = MySQLdb.connect(config["host"],config["user"],config["password"],config["database"])
+ self.db.autocommit(True)
def insert(self,txt):
dbc = self.db.cursor() |
f25e0fe435f334e19fc84a9c9458a1bea4a051f9 | money/parser/__init__.py | money/parser/__init__.py | import csv
from money.models import Movement
def parse_csv(raw_csv, parser, header_lines=0):
reader = csv.reader(raw_csv, delimiter=',', quotechar='"')
rows = []
for row in reader:
if reader.line_num > header_lines and row:
rows.append(parser.parse_row(row))
return rows
def import_movements(data, bank_ac... | import csv
from money.models import Movement
def parse_csv(raw_csv, parser, header_lines=0, reverse_order=False):
reader = csv.reader(raw_csv, delimiter=',', quotechar='"')
rows = []
for row in reader:
if reader.line_num > header_lines and row:
rows.append(parser.parse_row(row))
... | Allow to reverse the order of the CSV for a proper reading | Allow to reverse the order of the CSV for a proper reading
| Python | bsd-3-clause | shakaran/casterly,shakaran/casterly | ---
+++
@@ -3,28 +3,30 @@
from money.models import Movement
-def parse_csv(raw_csv, parser, header_lines=0):
- reader = csv.reader(raw_csv, delimiter=',', quotechar='"')
- rows = []
+def parse_csv(raw_csv, parser, header_lines=0, reverse_order=False):
+ reader = csv.reader(raw_csv, delimiter=',', quotechar='"... |
c4ef7fe24477d9160214c1cd2938aa8f5135d84b | utils/database_setup.py | utils/database_setup.py | import pandas
def load_excel(filepath):
"""
Returns a Pandas datafile that contains the contents of a Microsoft Excel
Spreadsheet
Params:
filepath - A string containing the path to the file
Returns:
A Pandas datafile
"""
return pandas.read_excel(filepath)
def get_column_n... | import pandas
import argparse
def get_excel(filepath):
"""
Returns a Pandas datafile that contains the contents of a Microsoft Excel
Spreadsheet
Params:
filepath - A string containing the path to the file
Returns:
A Pandas datafile
"""
return pandas.read_excel(filepath)
d... | Add other needed method stubs | Add other needed method stubs
| Python | mit | stuy-tetrabyte/graduation-req-tracker | ---
+++
@@ -1,6 +1,7 @@
import pandas
+import argparse
-def load_excel(filepath):
+def get_excel(filepath):
"""
Returns a Pandas datafile that contains the contents of a Microsoft Excel
Spreadsheet
@@ -33,9 +34,45 @@
"""
pass
-def set_up_mysql_schema():
+def is_table_set_up():
"""
-... |
d52c4340a62802bcd0fcbd68516c5ac66fb10436 | ftfy/streamtester/__init__.py | ftfy/streamtester/__init__.py | """
This file defines a general method for evaluating ftfy using data that arrives
in a stream. A concrete implementation of it is found in `twitter_tester.py`.
"""
from __future__ import print_function, unicode_literals
from ftfy.fixes import fix_text_encoding
from ftfy.chardata import possible_encoding
class Stream... | """
This file defines a general method for evaluating ftfy using data that arrives
in a stream. A concrete implementation of it is found in `twitter_tester.py`.
"""
from __future__ import print_function, unicode_literals
from ftfy.fixes import fix_encoding
from ftfy.chardata import possible_encoding
class StreamTeste... | Update function name used in the streamtester | Update function name used in the streamtester
| Python | mit | LuminosoInsight/python-ftfy | ---
+++
@@ -3,7 +3,7 @@
in a stream. A concrete implementation of it is found in `twitter_tester.py`.
"""
from __future__ import print_function, unicode_literals
-from ftfy.fixes import fix_text_encoding
+from ftfy.fixes import fix_encoding
from ftfy.chardata import possible_encoding
@@ -24,7 +24,7 @@
... |
7a786fd031c3faa057256abc5d9cb47618041696 | checks.d/veneur.py | checks.d/veneur.py | import datetime
from urlparse import urljoin
import requests
# project
from checks import AgentCheck
class Veneur(AgentCheck):
VERSION_METRIC_NAME = 'veneur.deployed_version'
BUILDAGE_METRIC_NAME = 'veneur.build_age'
MAX_AGE_CHECK_NAME = 'veneur.build_age.fresh'
# Check that the build is no more th... | import datetime
from urlparse import urljoin
import requests
# project
from checks import AgentCheck
class Veneur(AgentCheck):
VERSION_METRIC_NAME = 'veneur.deployed_version'
BUILDAGE_METRIC_NAME = 'veneur.build_age'
def check(self, instance):
success = 0
host = instance['host']
... | Configure max build age on the monitoring side | Configure max build age on the monitoring side
| Python | mit | stripe/stripe-datadog-checks,stripe/datadog-checks | ---
+++
@@ -9,12 +9,6 @@
VERSION_METRIC_NAME = 'veneur.deployed_version'
BUILDAGE_METRIC_NAME = 'veneur.build_age'
-
- MAX_AGE_CHECK_NAME = 'veneur.build_age.fresh'
-
- # Check that the build is no more than one week old
- MAX_DEPLOYMENT_INTERVAL = 604800
-
def check(self, instance):
... |
859d5ce6553b7651f05f27adec28e8c4330ca9bb | handler/supervisor_to_serf.py | handler/supervisor_to_serf.py | #!/usr/bin/env python
import json
import sys
from utils import serf_event
def write_stdout(s):
sys.stdout.write(s)
sys.stdout.flush()
def write_stderr(s):
sys.stderr.write(s)
sys.stderr.flush()
def main():
while True:
write_stdout('READY\n') # transition from ACKNOWLEDGED to READY
... | #!/usr/bin/env python
import json
import sys
from utils import serf_event
def write_stdout(s):
sys.stdout.write(s)
sys.stdout.flush()
def write_stderr(s):
sys.stderr.write(s)
sys.stderr.flush()
def main():
while True:
write_stdout('READY\n') # transition from ACKNOWLEDGED to READY
... | Add id of node generating the supervisor event | Add id of node generating the supervisor event
| Python | mit | waltermoreira/serfnode,waltermoreira/serfnode,waltermoreira/serfnode | ---
+++
@@ -22,7 +22,8 @@
data = sys.stdin.read(int(headers['len'])) # read the event payload
data_dict = dict(x.split(':') for x in data.split())
data_dict['eventname'] = headers['eventname']
- serf_event('myevent', json.dumps(data_dict))
+ data_dict['node'] = serf('info')['a... |
c136d416c2cb53449e1c175412eeaa46a2f78db1 | zou/app/utils/emails.py | zou/app/utils/emails.py | from flask_mail import Message
from zou.app import mail, app
def send_email(subject, body, recipient_email, html=None):
"""
Send an email with given subject and body to given recipient.
"""
if html is None:
html = body
with app.app_context():
message = Message(
sender=... | from flask_mail import Message
from zou.app import mail, app
def send_email(subject, body, recipient_email, html=None):
"""
Send an email with given subject and body to given recipient.
"""
if html is None:
html = body
with app.app_context():
message = Message(
sender=... | Fix syntax error in email service | Fix syntax error in email service
| Python | agpl-3.0 | cgwire/zou | ---
+++
@@ -11,7 +11,7 @@
html = body
with app.app_context():
message = Message(
- sender="Kitsu Bot <no-reply@cg-wire.com>"
+ sender="Kitsu Bot <no-reply@cg-wire.com>",
body=body,
html=html,
subject=subject, |
020015cccceb3c2391c4764ee2ec29dfc5c461c6 | __init__.py | __init__.py | from . import LayerView
def getMetaData():
return { "name": "LayerView", "type": "View" }
def register(app):
app.getController().addView("LayerView", LayerView.LayerView())
| from . import LayerView
def getMetaData():
return { "name": "LayerView", "type": "View" }
def register(app):
return LayerView.LayerView()
| Update plugin's register functions to return the object instance instead of performing the registration themselves | Update plugin's register functions to return the object instance instead of performing the registration themselves
| Python | agpl-3.0 | Curahelper/Cura,bq/Ultimaker-Cura,ad1217/Cura,bq/Ultimaker-Cura,senttech/Cura,lo0ol/Ultimaker-Cura,quillford/Cura,derekhe/Cura,ynotstartups/Wanhao,markwal/Cura,lo0ol/Ultimaker-Cura,senttech/Cura,DeskboxBrazil/Cura,ynotstartups/Wanhao,totalretribution/Cura,ad1217/Cura,fieldOfView/Cura,quillford/Cura,fxtentacle/Cura,dere... | ---
+++
@@ -4,4 +4,4 @@
return { "name": "LayerView", "type": "View" }
def register(app):
- app.getController().addView("LayerView", LayerView.LayerView())
+ return LayerView.LayerView() |
b186ed26e3250d8b02c94f5bb3b394c35986bcf6 | __init__.py | __init__.py | """
Spyral, an awesome library for making games.
"""
__version__ = '0.1.1'
__license__ = 'MIT'
__author__ = 'Robert Deaton'
import compat
import memoize
import point
import camera
import sprite
import scene
import _lib
import event
import animator
import animation
import pygame
import image
import color
import rect
... | """
Spyral, an awesome library for making games.
"""
__version__ = '0.1.1'
__license__ = 'MIT'
__author__ = 'Robert Deaton'
import compat
import memoize
import point
import camera
import sprite
import scene
import _lib
import event
import animator
import animation
import pygame
import image
import color
import rect
... | Remove an import which snuck in but does not belong. | Remove an import which snuck in but does not belong.
Signed-off-by: Robert Deaton <eb00a885478926d5d594195591fb94a03acb1062@udel.edu>
| Python | lgpl-2.1 | platipy/spyral | ---
+++
@@ -22,7 +22,6 @@
import color
import rect
import signal
-import font
import vector
Scene = scene.Scene |
0ec01e1c5770c87faa5300b80c3b9d6bcb0df41b | tcxparser.py | tcxparser.py | "Simple parser for Garmin TCX files."
from lxml import objectify
__version__ = '0.3.0'
class TcxParser:
def __init__(self, tcx_file):
tree = objectify.parse(tcx_file)
self.root = tree.getroot()
self.activity = self.root.Activities.Activity
@property
def latitude(self):
... | "Simple parser for Garmin TCX files."
from lxml import objectify
__version__ = '0.4.0'
class TcxParser:
def __init__(self, tcx_file):
tree = objectify.parse(tcx_file)
self.root = tree.getroot()
self.activity = self.root.Activities.Activity
@property
def latitude(self):
... | Make sure to return python values, not lxml objects | Make sure to return python values, not lxml objects
Bump version to 0.4.0
| Python | bsd-2-clause | vkurup/python-tcxparser,vkurup/python-tcxparser,SimonArnu/python-tcxparser | ---
+++
@@ -2,7 +2,7 @@
from lxml import objectify
-__version__ = '0.3.0'
+__version__ = '0.4.0'
class TcxParser:
@@ -14,11 +14,11 @@
@property
def latitude(self):
- return self.activity.Lap.Track.Trackpoint.Position.LatitudeDegrees
+ return self.activity.Lap.Track.Trackpoint.Posit... |
3f18e4891b64c45fbda9ae88e9b508b5bc2cb03a | temp2dash.py | temp2dash.py | import json
import requests
import sys
from temperusb import TemperHandler
URL="http://dashing:3030/widgets/inside"
SCALE=1.0
OFFSET=-3.0
th = TemperHandler()
devs = th.get_devices()
if len(devs) != 1:
print "Expected exactly one TEMPer device, found %d" % len(devs)
sys.exit(1)
dev = devs[0]
dev.set_calibr... | import json
import os
import requests
import sys
import time
import traceback
from temperusb import TemperHandler
URL = os.environ['DASHING_URL']
SCALE = float(os.environ['TEMP_SCALE'])
OFFSET = float(os.environ['TEMP_OFFSET'])
SENSOR = int(os.environ['TEMP_SENSOR'])
SLEEP = int(os.environ['SLEEP_TIME'])
th = TemperH... | Add infinite loop; Add env vars | Add infinite loop; Add env vars
| Python | mit | ps-jay/temp2dash | ---
+++
@@ -1,13 +1,16 @@
import json
+import os
import requests
import sys
+import time
+import traceback
from temperusb import TemperHandler
-
-URL="http://dashing:3030/widgets/inside"
-SCALE=1.0
-OFFSET=-3.0
-
+URL = os.environ['DASHING_URL']
+SCALE = float(os.environ['TEMP_SCALE'])
+OFFSET = float(os.enviro... |
5768d1ebcfec46e564c8b420773d911c243327ff | dddp/msg.py | dddp/msg.py | """Django DDP utils for DDP messaging."""
import collections
from django.core.serializers import get_serializer
_SERIALIZER = None
def obj_change_as_msg(obj, msg):
"""Generate a DDP msg for obj with specified msg type."""
global _SERIALIZER
if _SERIALIZER is None:
_SERIALIZER = get_serializer('ddp... | """Django DDP utils for DDP messaging."""
from dddp import THREAD_LOCAL as this
from django.core.serializers import get_serializer
def serializer_factory():
"""Make a new DDP serializer."""
return get_serializer('ddp')()
def obj_change_as_msg(obj, msg):
"""Generate a DDP msg for obj with specified msg t... | Fix non-threadsafe failure in serializer - now using thread local serializer instance. | Fix non-threadsafe failure in serializer - now using thread local serializer instance.
| Python | mit | commoncode/django-ddp,commoncode/django-ddp,commoncode/django-ddp,django-ddp/django-ddp,django-ddp/django-ddp,django-ddp/django-ddp,commoncode/django-ddp,django-ddp/django-ddp | ---
+++
@@ -1,15 +1,17 @@
"""Django DDP utils for DDP messaging."""
-import collections
+from dddp import THREAD_LOCAL as this
from django.core.serializers import get_serializer
-_SERIALIZER = None
+
+def serializer_factory():
+ """Make a new DDP serializer."""
+ return get_serializer('ddp')()
+
def obj_... |
338e2ba155df0759113c65ced6be6714092b9aaf | packages/gtk-quartz-engine.py | packages/gtk-quartz-engine.py | Package ('gtk-quartz-engine', 'master',
sources = [ 'git://github.com/jralls/gtk-quartz-engine.git' ],
override_properties = { 'configure':
'libtoolize --force --copy && '
'aclocal && '
'autoheader && '
'automake --add-missing && '
'autoconf && '
'./configure --prefix=%{prefix}'
}
)
| Package ('gtk-quartz-engine', 'master',
sources = [ 'git://github.com/nirvanai/gtk-quartz-engine.git' ],
override_properties = { 'configure':
'libtoolize --force --copy && '
'aclocal && '
'autoheader && '
'automake --add-missing && '
'autoconf && '
'./configure --prefix=%{prefix}'
}
)
| Use Alex's awesome new version of the GtkQuartz theme engine | Use Alex's awesome new version of the GtkQuartz theme engine
| Python | mit | bl8/bockbuild,bl8/bockbuild,BansheeMediaPlayer/bockbuild,bl8/bockbuild,BansheeMediaPlayer/bockbuild,mono/bockbuild,BansheeMediaPlayer/bockbuild,mono/bockbuild | ---
+++
@@ -1,5 +1,5 @@
Package ('gtk-quartz-engine', 'master',
- sources = [ 'git://github.com/jralls/gtk-quartz-engine.git' ],
+ sources = [ 'git://github.com/nirvanai/gtk-quartz-engine.git' ],
override_properties = { 'configure':
'libtoolize --force --copy && '
'aclocal && ' |
12130cef6c9b08e0928ed856972ace3c2000e6f8 | mooc_aggregator_restful_api/udacity.py | mooc_aggregator_restful_api/udacity.py | '''
This module retrieves the course catalog and overviews of the Udacity API
Link to Documentation:
https://s3.amazonaws.com/content.udacity-data.com/techdocs/UdacityCourseCatalogAPIDocumentation-v0.pdf
'''
import json
import requests
class UdacityAPI(object):
'''
This class defines attributes and method... | '''
This module retrieves the course catalog and overviews of the Udacity API
Link to Documentation:
https://s3.amazonaws.com/content.udacity-data.com/techdocs/UdacityCourseCatalogAPIDocumentation-v0.pdf
'''
import json
import requests
class UdacityAPI(object):
'''
This class defines attributes and method... | Fix error accessing class variable | Fix error accessing class variable
| Python | mit | ueg1990/mooc_aggregator_restful_api | ---
+++
@@ -19,7 +19,7 @@
UDACITY_API_ENDPOINT = 'https://udacity.com/public-api/v0/courses'
def __init__(self):
- self.response = requests.get(UDACITY_API_ENDPOINT)
+ self.response = requests.get(UdacityAPI.UDACITY_API_ENDPOINT)
self.courses = self.response.json()['courses']
... |
f5600008defcd5fe4c9c397c0b7170f6f5e9a5e4 | __init__.py | __init__.py | __author__ = "Justin Kitzes, Mark Wilber, Chloe Lewis"
__copyright__ = "Copyright 2012, Regents of University of California"
__credits__ = []
__license__ = "BSD 2-clause"
__version__ = "0.1"
__maintainer__ = "Justin Kitzes"
__email__ = "jkitzes@berkeley.edu"
__status__ = "Development"
import compare
import data
import... | Add header info and submodule imports to init | Add header info and submodule imports to init
| Python | bsd-2-clause | jkitzes/macroeco | ---
+++
@@ -1 +1,14 @@
+__author__ = "Justin Kitzes, Mark Wilber, Chloe Lewis"
+__copyright__ = "Copyright 2012, Regents of University of California"
+__credits__ = []
+__license__ = "BSD 2-clause"
+__version__ = "0.1"
+__maintainer__ = "Justin Kitzes"
+__email__ = "jkitzes@berkeley.edu"
+__status__ = "Development"
... | |
977cf58125a204010197c95827457843503e2c5b | ideascube/conf/kb_rca_alliancefrancaise.py | ideascube/conf/kb_rca_alliancefrancaise.py | # -*- coding: utf-8 -*-
"""KoomBook conf"""
from .kb import * # noqa
LANGUAGE_CODE = 'fr'
IDEASCUBE_NAME = 'Alliance française de Bangui'
| # -*- coding: utf-8 -*-
"""KoomBook conf"""
from .kb import * # noqa
LANGUAGE_CODE = 'fr'
IDEASCUBE_NAME = 'Alliance française de Bangui'
# Disable BSF Campus for now
HOME_CARDS = [card for card in HOME_CARDS if card['id'] != 'bsfcampus']
| Disable BSF Campus for RCA Alliance Française | Disable BSF Campus for RCA Alliance Française
@barbayellow said so.
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -4,3 +4,6 @@
LANGUAGE_CODE = 'fr'
IDEASCUBE_NAME = 'Alliance française de Bangui'
+
+# Disable BSF Campus for now
+HOME_CARDS = [card for card in HOME_CARDS if card['id'] != 'bsfcampus'] |
cc12728d7160a10f0c182c0cccfde0fd15cadb75 | spicedham/basewrapper.py | spicedham/basewrapper.py |
class BaseWrapper(object):
"""
A base class for backend plugins.
"""
def get_key(self, tag, key, default=None):
"""
Gets the value held by the tag, key composite key. If it doesn't exist,
return default.
"""
raise NotImplementedError()
def get_key_list(sel... |
class BaseWrapper(object):
"""
A base class for backend plugins.
"""
def reset(self, really):
"""
Resets the training data to a blank slate.
"""
if really:
raise NotImplementedError()
def get_key(self, tag, key, default=None):
"""
Gets ... | Add a reset function stub | Add a reset function stub
Also fix a typo.
| Python | mpl-2.0 | mozilla/spicedham,mozilla/spicedham | ---
+++
@@ -3,6 +3,14 @@
"""
A base class for backend plugins.
"""
+
+ def reset(self, really):
+ """
+ Resets the training data to a blank slate.
+ """
+ if really:
+ raise NotImplementedError()
+
def get_key(self, tag, key, default=None):
"""
... |
cf6ddfdac8a56194ad1297921a390be541d773cc | app_info.py | app_info.py | # coding=UTF8
import datetime
name = "Devo"
release_date = datetime.date(2012, 12, 13)
version = (1, 0, 0)
version_string = ".".join(str(x) for x in version)
identifier = "com.iogopro.devo"
copyright = u"Copyright © 2010-2012 Luke McCarthy"
developer = "Developer: Luke McCarthy <luke@iogopro.co.uk>"
company_na... | # coding=UTF8
import datetime
name = "Devo"
release_date = datetime.date(2012, 12, 13)
version = (1, 0, 0)
version_string = ".".join(str(x) for x in (version if version[2] != 0 else version[:2]))
identifier = "com.iogopro.devo"
copyright = u"Copyright © 2010-2012 Luke McCarthy"
developer = "Developer: Luke McCa... | Remove last digit of version number if it's 0. | Remove last digit of version number if it's 0.
| Python | mit | shaurz/devo | ---
+++
@@ -8,7 +8,7 @@
version = (1, 0, 0)
-version_string = ".".join(str(x) for x in version)
+version_string = ".".join(str(x) for x in (version if version[2] != 0 else version[:2]))
identifier = "com.iogopro.devo"
|
0b11bf48989673245adbc89aa6f65c85debafd9f | armstrong/apps/donations/backends.py | armstrong/apps/donations/backends.py | from armstrong.utils.backends import GenericBackend
from billing import get_gateway
from . import forms
class AuthorizeNetBackend(object):
def get_form_class(self):
return forms.CreditCardDonationForm
def purchase(self, donation, form):
authorize = get_gateway("authorize_net")
author... | from armstrong.utils.backends import GenericBackend
from billing import get_gateway
from . import forms
class AuthorizeNetBackend(object):
def get_form_class(self):
return forms.CreditCardDonationForm
def purchase(self, donation, form):
authorize = get_gateway("authorize_net")
author... | Make sure billing/shipping aren't populated if they aren't there | Make sure billing/shipping aren't populated if they aren't there
| Python | apache-2.0 | armstrong/armstrong.apps.donations,armstrong/armstrong.apps.donations | ---
+++
@@ -16,8 +16,9 @@
def get_options(self, donation):
donor = donation.donor
- return {
- "billing_address": {
+ r = {}
+ if donor.address:
+ r["billing_address"] = {
"name": donor.name,
"address1": donor.address.address... |
5efddf26176ac778556a3568bf97c2e70daac866 | anchorhub/settings/default_settings.py | anchorhub/settings/default_settings.py | """
Defaults for all settings used by AnchorHub
"""
WRAPPER = "{ }"
INPUT = "."
OUTPUT = "out-anchorhub"
ARGPARSER = {
"description": "anchorhub parses through Markdown files and precompiles "
"links to specially formatted anchors."
}
ARGPARSE_INPUT = {
"help": "Path of directory tree to b... | """
Defaults for all settings used by AnchorHub
"""
WRAPPER = '{ }'
INPUT = '.'
OUTPUT = 'out-anchorhub'
ARGPARSER = {
'description': "anchorhub parses through Markdown files and precompiles "
"links to specially formatted anchors."
}
ARGPARSE_INPUT = {
'help': "Path of directory tree to b... | Replace many double quotes with single quotes | Replace many double quotes with single quotes
| Python | apache-2.0 | samjabrahams/anchorhub | ---
+++
@@ -2,30 +2,30 @@
Defaults for all settings used by AnchorHub
"""
-WRAPPER = "{ }"
+WRAPPER = '{ }'
-INPUT = "."
-OUTPUT = "out-anchorhub"
+INPUT = '.'
+OUTPUT = 'out-anchorhub'
ARGPARSER = {
- "description": "anchorhub parses through Markdown files and precompiles "
+ 'description': "anchorhub... |
ff90958a0c79936d5056840ba03a5863bcdef099 | formal/test/test_util.py | formal/test/test_util.py | from twisted.trial import unittest
from formal import util
class TestUtil(unittest.TestCase):
def test_validIdentifier(self):
self.assertEquals(util.validIdentifier('foo'), True)
self.assertEquals(util.validIdentifier('_foo'), True)
self.assertEquals(util.validIdentifier('_foo_'), True)
... | from twisted.trial import unittest
from formal import util
class TestUtil(unittest.TestCase):
def test_validIdentifier(self):
self.assertEquals(util.validIdentifier('foo'), True)
self.assertEquals(util.validIdentifier('_foo'), True)
self.assertEquals(util.validIdentifier('_foo_'), True)
... | Mark as test as "todo" for now. | Mark as test as "todo" for now.
| Python | mit | emgee/formal,emgee/formal,emgee/formal | ---
+++
@@ -13,3 +13,5 @@
self.assertEquals(util.validIdentifier(' foo'), False)
self.assertEquals(util.validIdentifier('foo '), False)
self.assertEquals(util.validIdentifier('9'), False)
+ test_validIdentifier.todo = "Fails due to weird import poblem"
+ |
2e7271a33e098d7cdef15207e8caa05e644c3223 | changes/buildfailures/testfailure.py | changes/buildfailures/testfailure.py | from __future__ import absolute_import
from jinja2 import Markup
from changes.buildfailures.base import BuildFailure
class TestFailure(BuildFailure):
def get_html_label(self, build):
link = '/projects/{0}/builds/{1}/tests/?result=failed'.format(build.project.slug, build.id.hex)
try:
... | from __future__ import absolute_import
from jinja2 import Markup
from changes.buildfailures.base import BuildFailure
from changes.utils.http import build_uri
class TestFailure(BuildFailure):
def get_html_label(self, build):
link = build_uri('/projects/{0}/builds/{1}/tests/?result=failed'.format(build.pr... | Use full URI for build failure reasons | Use full URI for build failure reasons
| Python | apache-2.0 | bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,dropbox/changes,dropbox/changes | ---
+++
@@ -3,11 +3,12 @@
from jinja2 import Markup
from changes.buildfailures.base import BuildFailure
+from changes.utils.http import build_uri
class TestFailure(BuildFailure):
def get_html_label(self, build):
- link = '/projects/{0}/builds/{1}/tests/?result=failed'.format(build.project.slug, b... |
4c303007d6418e2a2f1b2e1778d6b7d0c0573c74 | gitfs/views/read_only.py | gitfs/views/read_only.py | import os
from errno import EROFS
from fuse import FuseOSError
from gitfs import FuseMethodNotImplemented
from .view import View
class ReadOnlyView(View):
def getxattr(self, path, fh):
raise FuseMethodNotImplemented
def open(self, path, flags):
return 0
def create(self, path, fh):
... | from errno import EROFS
from fuse import FuseOSError
from gitfs import FuseMethodNotImplemented
from .view import View
class ReadOnlyView(View):
def getxattr(self, path, fh):
raise FuseMethodNotImplemented
def open(self, path, flags):
return 0
def create(self, path, fh):
raise... | Raise read-only fs on touch | Raise read-only fs on touch
| Python | apache-2.0 | bussiere/gitfs,PressLabs/gitfs,PressLabs/gitfs,ksmaheshkumar/gitfs,rowhit/gitfs | ---
+++
@@ -1,4 +1,3 @@
-import os
from errno import EROFS
from fuse import FuseOSError
@@ -38,3 +37,6 @@
def mkdir(self, path, mode):
raise FuseOSError(EROFS)
+
+ def utimens(self, path, times=None):
+ raise FuseOSError(EROFS) |
a307c5fc2555d282dfa6193cdbcfb2d15e185c0c | aq/parsers.py | aq/parsers.py | from collections import namedtuple
import collections
from six import string_types
from aq.errors import QueryParsingError
from aq.select_parser import select_stmt, ParseException
TableId = namedtuple('TableId', ('database', 'table', 'alias'))
QueryMetadata = namedtuple('QueryMetadata', ('tables',))
class SelectP... | import collections
from collections import namedtuple
from six import string_types
from aq.errors import QueryParsingError
from aq.select_parser import select_stmt, ParseException
TableId = namedtuple('TableId', ('database', 'table', 'alias'))
QueryMetadata = namedtuple('QueryMetadata', ('tables',))
class SelectPa... | Allow query without table to run | Allow query without table to run
| Python | mit | lebinh/aq | ---
+++
@@ -1,6 +1,5 @@
+import collections
from collections import namedtuple
-
-import collections
from six import string_types
@@ -21,9 +20,6 @@
parse_result = select_stmt.parseString(query, parseAll=True)
except ParseException as e:
raise QueryParsingError(e)
-
- if... |
583a6319230b89a5f19c26e5bab83e28a5a4792e | pywps/processes/dummyprocess.py | pywps/processes/dummyprocess.py | """
DummyProcess to check the WPS structure
Author: Jorge de Jesus (jorge.de-jesus@jrc.it) as suggested by Kor de Jong
"""
from pywps.Process import WPSProcess
class Process(WPSProcess):
def __init__(self):
# init process
WPSProcess.__init__(self,
i... | """
DummyProcess to check the WPS structure
Author: Jorge de Jesus (jorge.jesus@gmail.com) as suggested by Kor de Jong
"""
from pywps.Process import WPSProcess
import types
class Process(WPSProcess):
def __init__(self):
# init process
WPSProcess.__init__(self,
... | Fix the but There is an error (cannot concatenate str and int objects) when the user does not specify the inputs. | Fix the but There is an error (cannot concatenate str and int objects)
when the user does not specify the inputs. | Python | mit | ricardogsilva/PyWPS,jonas-eberle/pywps,geopython/pywps,ldesousa/PyWPS,bird-house/PyWPS,jachym/PyWPS,tomkralidis/pywps | ---
+++
@@ -1,9 +1,10 @@
"""
DummyProcess to check the WPS structure
-Author: Jorge de Jesus (jorge.de-jesus@jrc.it) as suggested by Kor de Jong
+Author: Jorge de Jesus (jorge.jesus@gmail.com) as suggested by Kor de Jong
"""
-from pywps.Process import WPSProcess
+from pywps.Proces... |
305e54c328cf212e01a3af7cec7b940894044e55 | gen_test.py | gen_test.py | import math
import numpy
import random
from demodulate.cfg import *
def gen_test_data():
pattern = [1,0,1,1,1,0,0,0,0,0,0,0] # morse code 'A'
cycles_per_sample = MORSE_FREQ/SAMPLE_FREQ
radians_per_sample = cycles_per_sample * 2 * math.pi
WPM = random.randint(2,20)
elements_per_second = WPM * 50.0 / 60.0
samples_... | import math
import numpy
import random
from demodulate.cfg import *
def gen_test_data():
pattern = [1,0,1,1,1,0,0,0,0,0,0,0] # morse code 'A'
cycles_per_sample = MORSE_FREQ/SAMPLE_FREQ
radians_per_sample = cycles_per_sample * 2 * math.pi
WPM = random.uniform(2,20)
elements_per_second = WPM * 50.0 / 60.0
samples_... | Use float, not int for random WPM | Use float, not int for random WPM
| Python | mit | nickodell/morse-code | ---
+++
@@ -7,7 +7,7 @@
pattern = [1,0,1,1,1,0,0,0,0,0,0,0] # morse code 'A'
cycles_per_sample = MORSE_FREQ/SAMPLE_FREQ
radians_per_sample = cycles_per_sample * 2 * math.pi
- WPM = random.randint(2,20)
+ WPM = random.uniform(2,20)
elements_per_second = WPM * 50.0 / 60.0
samples_per_element = int(SAMPLE_FREQ... |
454c7d322af3328279582aef629736b92c87e869 | backports/__init__.py | backports/__init__.py | # This file is part of a backport of 'lzma' included with Python 3.3,
# exposed under the namespace of backports.lzma following the conventions
# laid down here: http://pypi.python.org/pypi/backports/1.0
# Backports homepage: http://bitbucket.org/brandon/backports
# A Python "namespace package" http://www.python.org/d... | # This file is part of a backport of 'lzma' included with Python 3.3,
# exposed under the namespace of backports.lzma following the conventions
# laid down here: http://pypi.python.org/pypi/backports/1.0
# Backports homepage: http://bitbucket.org/brandon/backports
# A Python "namespace package" http://www.python.org/d... | Revert "It seems the mechanism to declare a namespace package changed." | Revert "It seems the mechanism to declare a namespace package changed."
This reverts commit 68658fe9a3fee91963944937b80fcdaf3af4c8a1.
Changing the backport to use setuptools namespaces broke all the other
packages using the backports namespace. Switch back to standard python
namespaces.
| Python | bsd-3-clause | peterjc/backports.lzma,peterjc/backports.lzma | ---
+++
@@ -6,9 +6,5 @@
# A Python "namespace package" http://www.python.org/dev/peps/pep-0382/
# This always goes inside of a namespace package's __init__.py
-try:
- import pkg_resources
- pkg_resources.declare_namespace(__name__)
-except ImportError:
- import pkgutil
- __path__ = pkgutil.extend_path... |
d1be7f345529594ba25ed5d0f22e544735a64404 | qubs_data_centre/urls.py | qubs_data_centre/urls.py | from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^api/', include('api.urls')),
url(r'^admin/', admin.site.urls),
]
| from django.conf.urls import url, include
from django.contrib import admin
admin.site.site_header = 'QUBS Data Centre Admin'
urlpatterns = [
url(r'^api/', include('api.urls')),
url(r'^admin/', admin.site.urls),
]
| Add a custom admin site header. | Add a custom admin site header.
| Python | apache-2.0 | qubs/climate-data-api,qubs/climate-data-api,qubs/data-centre,qubs/data-centre | ---
+++
@@ -1,5 +1,8 @@
from django.conf.urls import url, include
from django.contrib import admin
+
+
+admin.site.site_header = 'QUBS Data Centre Admin'
urlpatterns = [
url(r'^api/', include('api.urls')), |
2665aa46702175a0d33ae76cfccdbbbddf42d316 | multi_schema/management/commands/syncdb.py | multi_schema/management/commands/syncdb.py | import os.path
from django.core.management.commands import syncdb
from django.db import models, connection, transaction
try:
from south.management.commands import syncdb
except ImportError:
pass
from ...models import Schema, template_schema
class Command(syncdb.Command):
def handle_noargs(self, **option... | import os.path
from django.core.management.commands import syncdb
from django.db import models, connection, transaction
try:
from south.management.commands import syncdb
except ImportError:
pass
from ...models import Schema, template_schema
class Command(syncdb.Command):
def handle_noargs(self, **option... | Allow for comments in the sql file that do not start the line. | Allow for comments in the sql file that do not start the line.
| Python | bsd-3-clause | luzfcb/django-boardinghouse,luzfcb/django-boardinghouse,luzfcb/django-boardinghouse | ---
+++
@@ -14,7 +14,7 @@
def handle_noargs(self, **options):
# Ensure we have the clone_schema() function
clone_schema_file = os.path.join(os.path.abspath(__file__ + '/../../../'), 'sql', 'clone_schema.sql')
- clone_schema_function = " ".join([x.strip() for x in open(clone_schema_file).... |
bf336d99484cc3804f469631b513a927940ada30 | profile_collection/startup/50-scans.py | profile_collection/startup/50-scans.py | # vim: sw=4 ts=4 sts expandtab smarttab
# HXN step-scan configuration
import hxntools.scans
from bluesky.global_state import get_gs
gs = get_gs()
hxntools.scans.setup()
ct = hxntools.scans.count
ascan = hxntools.scans.absolute_scan
dscan = hxntools.scans.relative_scan
fermat = hxntools.scans.relative_fermat
spiral =... | # vim: sw=4 ts=4 sts expandtab smarttab
# HXN step-scan configuration
import hxntools.scans
from bluesky.global_state import get_gs
gs = get_gs()
hxntools.scans.setup()
ct = hxntools.scans.count
ascan = hxntools.scans.absolute_scan
dscan = hxntools.scans.relative_scan
fermat = hxntools.scans.relative_fermat
spiral =... | Add scan_steps wrapper for scan_nd | Add scan_steps wrapper for scan_nd
| Python | bsd-2-clause | NSLS-II-HXN/ipython_ophyd,NSLS-II-HXN/ipython_ophyd | ---
+++
@@ -16,6 +16,7 @@
dmesh = hxntools.scans.relative_mesh
d2scan = hxntools.scans.d2scan
a2scan = hxntools.scans.a2scan
+scan_steps = hxntools.scans.scan_steps
gs.DETS = [zebra, sclr1, merlin1, xspress3, lakeshore2]
gs.TABLE_COLS = ['sclr1_ch2','sclr1_ch3', 'sclr1_ch4', 'sclr1_ch5_calc', 'ssx', 'ssy', 'ss... |
a619f703b2d259877e30d3e1ede11813c014f3ad | pysc2/env/available_actions_printer.py | pysc2/env/available_actions_printer.py | # Copyright 2017 Google Inc. 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # Copyright 2017 Google Inc. 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Fix the AvailableActionsPrinter to support the new multiplayer action spec. | Fix the AvailableActionsPrinter to support the new multiplayer action spec.
PiperOrigin-RevId: 183247161
| Python | apache-2.0 | deepmind/pysc2 | ---
+++
@@ -26,7 +26,7 @@
def __init__(self, env):
super(AvailableActionsPrinter, self).__init__(env)
self._seen = set()
- self._action_spec = self.action_spec()
+ self._action_spec = self.action_spec()[0]
def step(self, *args, **kwargs):
all_obs = super(AvailableActionsPrinter, self).ste... |
a537f049bfb61488a056333d362d9983e8e9f88d | 2020/10/p1.py | 2020/10/p1.py | # Python 3.8.3
def get_input():
with open('input.txt', 'r') as f:
return set(int(i) for i in f.read().split())
def main():
puzzle = get_input()
last_joltage = 0
one_jolt = 0
three_jolts = 1 # this is bad lmao
while len(puzzle) != 0:
if last_joltage + 1 in puzzle:
... | # Python 3.8.3
def get_input():
with open('input.txt', 'r') as f:
return set(int(i) for i in f.read().split())
def main():
puzzle = get_input()
last_joltage = 0
one_jolt = 0
three_jolts = 1
while len(puzzle) != 0:
if last_joltage + 1 in puzzle:
last_joltage = last_... | Fix minor issues in 2020.10.1 file | Fix minor issues in 2020.10.1 file
The comment about the 1 being bad was incorrect, in fact it was good. I
had forgotten about adding the extra three-jolt difference for the final
adapter in the device, and didn't make the connection between it and the
three-jolt count being one short lol.
| Python | mit | foxscotch/advent-of-code,foxscotch/advent-of-code | ---
+++
@@ -9,7 +9,7 @@
last_joltage = 0
one_jolt = 0
- three_jolts = 1 # this is bad lmao
+ three_jolts = 1
while len(puzzle) != 0:
if last_joltage + 1 in puzzle:
last_joltage = last_joltage + 1
@@ -25,7 +25,6 @@
return one_jolt * three_jolts
-
if __name__ == '... |
77ddff664ad1e10037a43c3ffabd816387c35e42 | rotational-cipher/rotational_cipher.py | rotational-cipher/rotational_cipher.py | import string
UPPER = string.ascii_uppercase
LOWER = string.ascii_lowercase
def rotate(s, n):
rules = shift_rules(n)
return "".join(map(lambda k: rules.get(k, k), s))
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n]
return {k:v for k,v in zip(UPPER+LOWER, shifted)}
| import string
UPPER = string.ascii_uppercase
LOWER = string.ascii_lowercase
def rotate(s, n):
rules = shift_rules(n)
return "".join(rules.get(ch, ch) for ch in s)
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n]
return {k:v for k,v in zip(UPPER+LOWER, shifted)}
| Use a comprehension instead of a lambda function | Use a comprehension instead of a lambda function
| Python | agpl-3.0 | CubicComet/exercism-python-solutions | ---
+++
@@ -7,8 +7,7 @@
def rotate(s, n):
rules = shift_rules(n)
- return "".join(map(lambda k: rules.get(k, k), s))
-
+ return "".join(rules.get(ch, ch) for ch in s)
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n] |
513c7a2f5c5fb5a8c47b3173a8d5854755f7928f | pylab/website/tests/test_about_page.py | pylab/website/tests/test_about_page.py | import datetime
from django_webtest import WebTest
from django.contrib.auth.models import User
from pylab.core.models import Event
class AboutPageTests(WebTest):
def setUp(self):
self.user = User.objects.create(username='u1')
def test_no_events_on_about_page(self):
resp = self.app.get('/ab... | import datetime
from django_webtest import WebTest
from pylab.core.models import Event
from pylab.core.factories import EventFactory
class AboutPageTests(WebTest):
def test_no_events_on_about_page(self):
resp = self.app.get('/about/')
self.assertEqual(resp.status_int, 200)
self.assertTr... | Use factories instead of creating instance from model | Use factories instead of creating instance from model
| Python | agpl-3.0 | python-dirbtuves/website,python-dirbtuves/website,python-dirbtuves/website | ---
+++
@@ -1,15 +1,12 @@
import datetime
from django_webtest import WebTest
-from django.contrib.auth.models import User
from pylab.core.models import Event
+from pylab.core.factories import EventFactory
class AboutPageTests(WebTest):
-
- def setUp(self):
- self.user = User.objects.create(usern... |
1786702388abc4fe737ee73d64ef5864f42f0c3d | chat/query.py | chat/query.py | # Copyright 2017 Oursky Ltd.
#
# 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, ... | # Copyright 2017 Oursky Ltd.
#
# 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, ... | Fix missing offset for Query | Fix missing offset for Query
| Python | apache-2.0 | SkygearIO/chat,SkygearIO/chat | ---
+++
@@ -26,7 +26,7 @@
self.count = count
self.sort = []
self.limit = limit
- self.offset = None
+ self.offset = offset
self.include = include
def add_order(self, key, order): |
270812e89e8e0870bfea01367cf645cf5194a806 | openacademy/model/openacademy_course.py | openacademy/model/openacademy_course.py | # -*- coding: utf-8 -*-
from openerp import models, fields, api
'''
This module create model of Course
'''
class Course(models.Model):
'''This class create model of Course'''
_name = 'openacademy.course' # Model odoo name
name = fields.Char(string='Title', required=True) # field reserved to identified re... | # -*- coding: utf-8 -*-
from openerp import models, fields, api
'''
This module create model of Course
'''
class Course(models.Model):
'''This class create model of Course'''
_name = 'openacademy.course' # Model odoo name
name = fields.Char(string='Title', required=True) # field reserved to identified re... | Add sql constraint identation fixed | [REF] openacademy: Add sql constraint identation fixed
| Python | apache-2.0 | jorgescalona/openacademy-project | ---
+++
@@ -34,10 +34,10 @@
_sql_constraints = [
('name_description_check',
- 'CHECK(name != description)',
- "The title of the course should not be the description"),
+ 'CHECK(name != description)',
+ "The title of the course should not be the description"),
(... |
df6b13a70241b616f49d4dcc25073084c371f5b1 | share/models/creative/base.py | share/models/creative/base.py | from django.db import models
from share.models.base import ShareObject
from share.models.people import Person
from share.models.base import TypedShareObjectMeta
from share.models.creative.meta import Venue, Institution, Funder, Award, Tag
from share.models.fields import ShareForeignKey, ShareManyToManyField
class Ab... | from django.db import models
from share.models.base import ShareObject
from share.models.people import Person
from share.models.base import TypedShareObjectMeta
from share.models.creative.meta import Venue, Institution, Funder, Award, Tag
from share.models.fields import ShareForeignKey, ShareManyToManyField
class Ab... | Swap out license with rights | Swap out license with rights
| Python | apache-2.0 | CenterForOpenScience/SHARE,aaxelb/SHARE,zamattiac/SHARE,zamattiac/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE,aaxelb/SHARE,zamattiac/SHARE,laurenbarker/SHARE,aaxelb/SHARE,laurenbarker/SHARE,laurenbarker/SHARE | ---
+++
@@ -22,8 +22,9 @@
published = models.DateTimeField(null=True)
free_to_read_type = models.URLField(blank=True)
free_to_read_date = models.DateTimeField(null=True)
- rights = models.TextField()
- language = models.TextField()
+
+ rights = models.TextField(blank=True, null=True)
+ lang... |
9f44888c00d29bd1d1a53eb09ab90b61f33c5e05 | awx/main/migrations/0002_v300_changes.py | awx/main/migrations/0002_v300_changes.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER... | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER... | Update existing settings migration with minor field change. | Update existing settings migration with minor field change.
| Python | apache-2.0 | snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx | ---
+++
@@ -26,7 +26,7 @@
('key', models.CharField(unique=True, max_length=255)),
('description', models.TextField()),
('category', models.CharField(max_length=128)),
- ('value', models.TextField()),
+ ('value', models.TextField(blank=Tr... |
18618a56ce674c479a0737dcabd4a47913ae2dde | scripts/compare_dir.py | scripts/compare_dir.py | import os
dropboxFiles = []
localFiles = []
for dirpath, dirnames, filenames in os.walk(
'/media/itto/TOSHIBA EXT/Photos/Dropbox/ITTO/Southeast Asia 2017'):
dropboxFiles += filenames
for dirpath, dirnames, filenames in os.walk(
'/media/itto/TOSHIBA EXT/Photos/Southeast Asia'):
if ('Process' no... | import os
from shutil import copyfile
FOLDER_A = '/media/itto/TOSHIBA EXT/Photos/Southeast Asia'
FOLDER_B = '/media/itto/disk/PRIVATE/AVCHD/BDMV/STREAM'
files_a = []
files_b = []
for dirpath, dirnames, filenames in os.walk(FOLDER_A):
files_a += filenames
for dirpath, dirnames, filenames in os.walk(FOLDER_B):
... | Add functionality to copy any missing files to the other folder | Add functionality to copy any missing files to the other folder
| Python | mit | itko/itko.github.io,itko/itko.github.io,itko/itko.github.io,itko/itko.github.io | ---
+++
@@ -1,23 +1,45 @@
import os
+from shutil import copyfile
-dropboxFiles = []
-localFiles = []
-for dirpath, dirnames, filenames in os.walk(
- '/media/itto/TOSHIBA EXT/Photos/Dropbox/ITTO/Southeast Asia 2017'):
- dropboxFiles += filenames
+FOLDER_A = '/media/itto/TOSHIBA EXT/Photos/Southeast Asia'
... |
31231afea71b3fd9213b39cf1bb32e10b2a9e843 | djangovirtualpos/admin.py | djangovirtualpos/admin.py | # coding=utf-8
from django.contrib import admin
from djangovirtualpos.models import VirtualPointOfSale, VPOSRefundOperation, VPOSCeca, VPOSRedsys, VPOSSantanderElavon, VPOSPaypal
admin.site.register(VirtualPointOfSale)
admin.site.register(VPOSRefundOperation)
admin.site.register(VPOSCeca)
admin.site.register(VPOSReds... | # coding=utf-8
from django.contrib import admin
from djangovirtualpos.models import VirtualPointOfSale, VPOSRefundOperation, VPOSCeca, VPOSRedsys, VPOSSantanderElavon, VPOSPaypal, VPOSBitpay
admin.site.register(VirtualPointOfSale)
admin.site.register(VPOSRefundOperation)
admin.site.register(VPOSCeca)
admin.site.regis... | Add Bitpay config model to Django Admin panel | Add Bitpay config model to Django Admin panel
| Python | mit | intelligenia/django-virtual-pos,intelligenia/django-virtual-pos,intelligenia/django-virtual-pos | ---
+++
@@ -1,7 +1,7 @@
# coding=utf-8
from django.contrib import admin
-from djangovirtualpos.models import VirtualPointOfSale, VPOSRefundOperation, VPOSCeca, VPOSRedsys, VPOSSantanderElavon, VPOSPaypal
+from djangovirtualpos.models import VirtualPointOfSale, VPOSRefundOperation, VPOSCeca, VPOSRedsys, VPOSSantan... |
ef15a8ba699e10b9f2d059669b63af6f4c768d39 | casspy/admin_commands.py | casspy/admin_commands.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Cassoundra: admin-commands
~~~~~~~~~~
Module to handle special commands to control the bot once it is already running.
Created by Joshua Prince, 2017
"""
import discord
from casspy import cassoundra
async def process_input(loop):
while True:
command ... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Cassoundra: admin-commands
~~~~~~~~~~
Module to handle special commands to control the bot once it is already running.
Created by Joshua Prince, 2017
"""
import discord
from casspy import cassoundra
async def process_input(loop):
while True:
command ... | Change to console command prompt | [casspy] Change to console command prompt
| Python | mit | joshuaprince/Cassoundra,joshuaprince/Cassoundra,joshuaprince/Cassoundra | ---
+++
@@ -17,7 +17,7 @@
async def process_input(loop):
while True:
- command = await loop.run_in_executor(None, input, "> ")
+ command = await loop.run_in_executor(None, input)
if str(command).split(" ")[0].lower() == "shutdown":
return
print(await handle(command... |
75c0861608871de2a2b1a6b4f2ea89c800dd8c07 | pava/implementation/__init__.py | pava/implementation/__init__.py | import sys
method_count = 0
def method(argcount, nlocals, stacksize, flags, codestring, constants, names,
varnames, filename, name, firstlineno, lnotab, modules, static):
global method_count
print 'define', name, method_count
method_count += 1
globals_dict = {}
for module_name in modu... | import new
import sys
DEBUG = False
method_count = 0
def method(argcount, nlocals, stacksize, flags, codestring, constants, names,
varnames, filename, name, firstlineno, lnotab, modules, static):
global method_count
if DEBUG:
print 'define', name, method_count
method_count += 1
g... | Make verbose loading messages optional | Make verbose loading messages optional
| Python | mit | laffra/pava,laffra/pava | ---
+++
@@ -1,11 +1,15 @@
+import new
import sys
+
+DEBUG = False
method_count = 0
def method(argcount, nlocals, stacksize, flags, codestring, constants, names,
varnames, filename, name, firstlineno, lnotab, modules, static):
global method_count
- print 'define', name, method_count
+ i... |
7e6dc283dbecf4bf9674559198b4a2c06e9f4c2e | spacy/tests/regression/test_issue1799.py | spacy/tests/regression/test_issue1799.py | '''Test sentence boundaries are deserialized correctly,
even for non-projective sentences.'''
import pytest
import numpy
from ... tokens import Doc
from ... vocab import Vocab
from ... attrs import HEAD, DEP
def test_issue1799():
problem_sentence = 'Just what I was looking for.'
heads_deps = numpy.asarray([[... | '''Test sentence boundaries are deserialized correctly,
even for non-projective sentences.'''
from __future__ import unicode_literals
import pytest
import numpy
from ... tokens import Doc
from ... vocab import Vocab
from ... attrs import HEAD, DEP
def test_issue1799():
problem_sentence = 'Just what I was looking... | Fix unicode import in test | Fix unicode import in test
| Python | mit | aikramer2/spaCy,aikramer2/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,recognai/spaCy,honnibal/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,aikramer2/spaCy,aikramer2/spaCy,spacy-io/spaCy,aikramer2/spaCy,recognai/spaCy,spacy-io/spaCy,aikramer2/... | ---
+++
@@ -1,5 +1,6 @@
'''Test sentence boundaries are deserialized correctly,
even for non-projective sentences.'''
+from __future__ import unicode_literals
import pytest
import numpy |
2cd19b395f4320330b66dff1ef98d149f3a40a31 | ckanext/syndicate/tests/test_plugin.py | ckanext/syndicate/tests/test_plugin.py | from mock import patch
import unittest
import ckan.model as model
from ckan.model.domain_object import DomainObjectOperation
from ckanext.syndicate.plugin import SyndicatePlugin
class TestPlugin(unittest.TestCase):
def test_notify_syndicates_task(self):
entity = model.Package()
entity.extras = ... | from mock import patch
import unittest
import ckan.model as model
from ckan.model.domain_object import DomainObjectOperation
from ckanext.syndicate.plugin import SyndicatePlugin
class TestNotify(unittest.TestCase):
def setUp(self):
super(TestNotify, self).setUp()
self.entity = model.Package()
... | Add test for notify dataset/update | Add test for notify dataset/update
| Python | agpl-3.0 | aptivate/ckanext-syndicate,sorki/ckanext-redmine-autoissues,aptivate/ckanext-syndicate,sorki/ckanext-redmine-autoissues | ---
+++
@@ -8,13 +8,22 @@
from ckanext.syndicate.plugin import SyndicatePlugin
-class TestPlugin(unittest.TestCase):
- def test_notify_syndicates_task(self):
- entity = model.Package()
- entity.extras = {'syndicate': 'true'}
+class TestNotify(unittest.TestCase):
+ def setUp(self):
+ su... |
80a1912ce69fd356d6c54bb00f946fbc7874a9ce | bluecanary/set_cloudwatch_alarm.py | bluecanary/set_cloudwatch_alarm.py | import boto3
from bluecanary.exceptions import NamespaceError
from bluecanary.utilities import throttle
@throttle()
def set_cloudwatch_alarm(identifier, **kwargs):
if not kwargs.get('Dimensions'):
kwargs['Dimensions'] = _get_dimensions(identifier, **kwargs)
if not kwargs.get('AlarmName'):
kw... | import boto3
from bluecanary.exceptions import NamespaceError
from bluecanary.utilities import throttle
@throttle()
def set_cloudwatch_alarm(identifier, **kwargs):
if not kwargs.get('Dimensions'):
kwargs['Dimensions'] = _get_dimensions(identifier, **kwargs)
if not kwargs.get('AlarmName'):
kw... | Allow multiple alarms for same metric type | Allow multiple alarms for same metric type
| Python | mit | voxy/bluecanary | ---
+++
@@ -10,7 +10,13 @@
kwargs['Dimensions'] = _get_dimensions(identifier, **kwargs)
if not kwargs.get('AlarmName'):
- kwargs['AlarmName'] = '{}_{}'.format(identifier, kwargs.get('MetricName'))
+ kwargs['AlarmName'] = '{}_{}'.format(identifier,
+ ... |
7611a4b3e064868c37b9f52778c8fe9f721e86c5 | polyaxon/events/management/commands/monitor_namespace.py | polyaxon/events/management/commands/monitor_namespace.py | import time
from kubernetes.client.rest import ApiException
from django.conf import settings
from clusters.models import Cluster
from events.management.commands._base_monitor import BaseMonitorCommand
from events.monitors import namespace
from polyaxon_k8s.manager import K8SManager
class Command(BaseMonitorCommand... | import time
from kubernetes.client.rest import ApiException
from django.conf import settings
from django.db import InterfaceError, ProgrammingError, OperationalError
from clusters.models import Cluster
from events.management.commands._base_monitor import BaseMonitorCommand
from events.monitors import namespace
from ... | Update namespace monitor with exception handling | Update namespace monitor with exception handling
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | ---
+++
@@ -3,6 +3,7 @@
from kubernetes.client.rest import ApiException
from django.conf import settings
+from django.db import InterfaceError, ProgrammingError, OperationalError
from clusters.models import Cluster
from events.management.commands._base_monitor import BaseMonitorCommand
@@ -13,6 +14,18 @@
cla... |
2a852c3ca1ff30cb02740f7934d97c1fe2da3bbe | compress.py | compress.py | """
compression
"""
class Compress():
"""Compress"""
def encode(self, string):
"""Encodes string to byte representation"""
return b'0'
def decode(self, byteString):
"""Decodes bytes into a text string"""
return ""
| """
compression
"""
import Queue as queue
class HuffmanNode:
"""Node in the Huffman coding tree"""
def __init__(self, symbol, freq):
self.parent = None
self.children = []
self.symbol = symbol
self.freq = freq
def set_parent(self, node):
node.add_child(self)
... | Build tree for huffman coding | Build tree for huffman coding
| Python | apache-2.0 | rylans/text-compression-english | ---
+++
@@ -2,8 +2,64 @@
compression
"""
-class Compress():
+import Queue as queue
+
+class HuffmanNode:
+ """Node in the Huffman coding tree"""
+ def __init__(self, symbol, freq):
+ self.parent = None
+ self.children = []
+
+ self.symbol = symbol
+ self.freq = freq
+
+ def se... |
3b412830710018abadacd148be544b4bfb1ec2f0 | compare_mt/formatting.py | compare_mt/formatting.py | import re
class Formatter(object):
pat_square_open = re.compile("\[")
pat_square_closed = re.compile("\]")
pat_lt = re.compile("<")
pat_gt = re.compile(">")
latex_substitutions = {
pat_square_open: "{[}",
pat_square_closed: "{]}",
pat_lt: r"\\textless",
pat_gt: r... | import re
class Formatter(object):
latex_substitutions = {
re.compile("\["): "{[}",
re.compile("\]"): "{]}",
re.compile("<"): r"\\textless",
re.compile(">"): r"\\textgreater"
}
def __init__(self, decimals=4):
self.set_decimals(decimals)
def set_decimals(self, ... | Move definition of substitution patterns inside the latex_substitutions dictionary | Move definition of substitution patterns inside the latex_substitutions dictionary
| Python | bsd-3-clause | neulab/compare-mt,neulab/compare-mt | ---
+++
@@ -1,15 +1,12 @@
import re
class Formatter(object):
- pat_square_open = re.compile("\[")
- pat_square_closed = re.compile("\]")
- pat_lt = re.compile("<")
- pat_gt = re.compile(">")
+
latex_substitutions = {
- pat_square_open: "{[}",
- pat_square_closed: "{]}",
- ... |
8b598333c06698185762cc98e414853e03c427f2 | src/reviews/resources.py | src/reviews/resources.py | from import_export import fields, resources
from .models import Review
class ReviewResource(resources.ModelResource):
reviewer = fields.Field(
attribute='reviewer__email',
readonly=True,
)
proposal = fields.Field(
attribute='proposal__title',
readonly=True,
)
cla... | from import_export import fields, resources
from .models import Review
class ReviewResource(resources.ModelResource):
reviewer = fields.Field(
attribute='reviewer__email',
readonly=True,
)
proposal = fields.Field(
attribute='proposal__title',
readonly=True,
)
stag... | Mark fields except appropriateness as readonly | Mark fields except appropriateness as readonly
| Python | mit | pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | ---
+++
@@ -11,6 +11,22 @@
)
proposal = fields.Field(
attribute='proposal__title',
+ readonly=True,
+ )
+ stage = fields.Field(
+ attribute='stage',
+ readonly=True,
+ )
+ vote = fields.Field(
+ attribute='vote',
+ readonly=True,
+ )
+ comment = ... |
b355d61edc413f8fd60c7ce3ac37d9c1da7caa67 | tests/nimoy/runner/test_spec_finder.py | tests/nimoy/runner/test_spec_finder.py | import tempfile
import unittest
import os
from nimoy.runner.spec_finder import SpecFinder
class TestSpecFinder(unittest.TestCase):
def setUp(self):
self.temp_spec = tempfile.NamedTemporaryFile(suffix='_spec.py')
def tearDown(self):
os.remove(self.temp_spec.name)
def test_implicit_locatio... | import os
import tempfile
import unittest
from nimoy.runner.spec_finder import SpecFinder
class TestSpecFinder(unittest.TestCase):
def setUp(self):
self.temp_spec = tempfile.NamedTemporaryFile(suffix='_spec.py')
def test_implicit_location(self):
spec_locations = SpecFinder(os.path.dirname(se... | Remove the code cleans up the temp file as temp files are already automatically cleaned | Remove the code cleans up the temp file as temp files are already automatically cleaned
| Python | apache-2.0 | Luftzig/nimoy,browncoat-ninjas/nimoy | ---
+++
@@ -1,15 +1,13 @@
+import os
import tempfile
import unittest
-import os
+
from nimoy.runner.spec_finder import SpecFinder
class TestSpecFinder(unittest.TestCase):
def setUp(self):
self.temp_spec = tempfile.NamedTemporaryFile(suffix='_spec.py')
-
- def tearDown(self):
- os.remov... |
ddce385c22284ec68797b512fade8599c76ce3d1 | datawire/manage.py | datawire/manage.py | from flask.ext.script import Manager
from datawire.core import app, db
from datawire.model import Service
from datawire.views import index
manager = Manager(app)
@manager.command
def create_db():
""" Create the database entities. """
db.create_all()
if __name__ == "__main__":
manager.run()
| from flask.ext.script import Manager
from datawire.core import app, db
from datawire.model import User
from datawire.views import index
manager = Manager(app)
@manager.command
def createdb():
""" Create the database entities. """
db.create_all()
admin_data = {'screen_name': 'admin', 'display_name': 'Sys... | Create an admin user on db initialisation. | Create an admin user on db initialisation. | Python | mit | arc64/datawi.re,arc64/datawi.re,arc64/datawi.re | ---
+++
@@ -1,16 +1,20 @@
from flask.ext.script import Manager
from datawire.core import app, db
-from datawire.model import Service
+from datawire.model import User
from datawire.views import index
manager = Manager(app)
@manager.command
-def create_db():
+def createdb():
""" Create the database en... |
b2ca081fbc10cc4c5d6b02ef2a4f5ce7bcab35e5 | doc/conf.py | doc/conf.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... | Use sphinxdoc html theme, cleaner than alabast. | Use sphinxdoc html theme, cleaner than alabast.
| Python | apache-2.0 | probcomp/bayeslite,probcomp/bayeslite | ---
+++
@@ -27,3 +27,4 @@
version = '0.1.3'
nitpicky = True
+html_theme = 'sphinxdoc' |
bdcdeee5c913f65dc2ea7f611a0ca0882b4e910f | tests/views/test_view.py | tests/views/test_view.py | # Copyright 2014 PressLabs SRL
#
# 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,... | # Copyright 2014 PressLabs SRL
#
# 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,... | Update test for the getattr method. | Update test for the getattr method.
| Python | apache-2.0 | rowhit/gitfs,PressLabs/gitfs,ksmaheshkumar/gitfs,PressLabs/gitfs,bussiere/gitfs | ---
+++
@@ -34,4 +34,4 @@
'st_ctime': "now",
'st_mtime': "now",
}
- assert simple_view.getattr() == asserted_getattr
+ assert simple_view.getattr("/fake/test/path") == asserted_getattr |
c37af8399decdbe3e1303f236891d694985b9040 | consulrest/keyvalue.py | consulrest/keyvalue.py | import json
import re
import requests
class KeyValue(object):
def __init__(self, url):
self._url = "%s/kv" % url
def _get(self, key, recurse=None, keys=None):
url = self._url + '/' + key
params = dict()
if recurse is not None:
params['recurse'] = True
if k... | import json
import re
import requests
class KeyValue(object):
def __init__(self, url):
self._url = "%s/kv" % url
def _get(self, key, recurse=None, keys=None):
url = self._url + '/' + key
params = dict()
if recurse is not None:
params['recurse'] = True
if k... | Allow use of Check-And-Set option and raise exception if status is 4xx or 5xx | Allow use of Check-And-Set option and raise exception if status is 4xx or 5xx
| Python | mit | vcoque/consul-ri | ---
+++
@@ -21,7 +21,7 @@
if r.status_code == 200:
return json.loads(r.text)
else:
- return None
+ r.raise_for_status()
def get(self, key, recurse=None):
return self._get(key, recurse=recurse)
@@ -29,12 +29,20 @@
def list(self, key=''):
... |
244f9ad92683a1b3a3bc8409724fea9c671f38b6 | src/mcedit2/widgets/layout.py | src/mcedit2/widgets/layout.py | from __future__ import absolute_import, division, print_function, unicode_literals
from PySide import QtGui
def _Box(box, *a):
for arg in a:
if isinstance(arg, tuple):
item = arg[0]
else:
item = arg
arg = (item,)
if isinstance(item, QtGui.QLayout):
... | from __future__ import absolute_import, division, print_function, unicode_literals
from PySide import QtGui
def _Box(box, *a):
for arg in a:
if isinstance(arg, tuple):
item = arg[0]
else:
item = arg
arg = (item,)
if isinstance(item, QtGui.QLayout):
... | Check margin keyword to Row/Column is not None | Check margin keyword to Row/Column is not None
| Python | bsd-3-clause | Rubisk/mcedit2,Rubisk/mcedit2,vorburger/mcedit2,vorburger/mcedit2 | ---
+++
@@ -21,13 +21,13 @@
def Row(*a, **kw):
"""
- :rtype: QHBoxLayout
+ :rtype: QtGui.QHBoxLayout
"""
margin = kw.pop('margin', None)
box = QtGui.QHBoxLayout(**kw)
- if margin:
- box.setContentsMargins((margin,) * 4)
_Box(box, *a)
+ if margin is not None:
+ box... |
bd6bb741db3b5403ec8ee590a919b0f9ff29bf14 | plugins/logging.py | plugins/logging.py | import logging
import sublime
PACKAGE_NAME = __package__.split(".", 1)[0]
logging.basicConfig(
level=logging.ERROR,
format="%(name)s [%(levelname)s]: %(message)s"
)
logger = logging.getLogger(PACKAGE_NAME)
def load_logger():
"""
Subscribe to Markdown changes in to get log level from user settings.
... | import logging
import sublime
PACKAGE_NAME = __package__.split(".", 1)[0]
logging.basicConfig(
level=logging.ERROR,
format="%(name)s [%(levelname)s]: %(message)s"
)
logger = logging.getLogger(PACKAGE_NAME)
def load_logger():
"""
Subscribe to Preferences changes in to get log level from user settings... | Read logger config from Preferences | Plugins: Read logger config from Preferences
required due to 9b30d85d1b60fef4f4d7c35868dd406f0c5d94f3
| Python | mit | SublimeText-Markdown/MarkdownEditing | ---
+++
@@ -12,11 +12,11 @@
def load_logger():
"""
- Subscribe to Markdown changes in to get log level from user settings.
+ Subscribe to Preferences changes in to get log level from user settings.
Must be called in plugin_loaded().
"""
- settings = sublime.load_settings("Markdown.sublime... |
c6298a573dc3188b8c57954287d78e7da253483a | lot/urls.py | lot/urls.py | # -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns("",
url(r"^login/(?P<uuid>[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12})/$", views.LOTLogin.as_view(), name="login"),
)
| # -*- coding: utf-8 -*-
from django.conf.urls import url
from . import views
urlpatterns = [
url(r"^login/(?P<uuid>[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12})/$", views.LOTLogin.as_view(), name="login"),
]
| Update to new-style urlpatterns format | Update to new-style urlpatterns format
| Python | bsd-3-clause | ABASystems/django-lot | ---
+++
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from . import views
-urlpatterns = patterns("",
+urlpatterns = [
url(r"^login/(?P<uuid>[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12})/$", views.LOTLogin.as_view(), name="login"),
-)
+] |
d55920576d288e9cb703337c6183cfe071d274ce | cryptography/primitives/block/ciphers.py | cryptography/primitives/block/ciphers.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... | Fix issue mixing %s and format for ValueError in AES | Fix issue mixing %s and format for ValueError in AES
| Python | bsd-3-clause | skeuomorf/cryptography,dstufft/cryptography,dstufft/cryptography,bwhmather/cryptography,kimvais/cryptography,skeuomorf/cryptography,Ayrx/cryptography,sholsapp/cryptography,dstufft/cryptography,kimvais/cryptography,sholsapp/cryptography,dstufft/cryptography,Hasimir/cryptography,sholsapp/cryptography,Ayrx/cryptography,bw... | ---
+++
@@ -25,7 +25,7 @@
# Verify that the key size matches the expected key size
if self.key_size not in self.key_sizes:
- raise ValueError("Invalid key size (%s) for %s".format(
+ raise ValueError("Invalid key size ({0}) for {1}".format(
self.key_size, sel... |
7beecc71b53a14f5515763f551613e381978dd3f | xbob/learn/linear/__init__.py | xbob/learn/linear/__init__.py | from ._library import *
from ._library import __version__, __api_version__
def get_include():
"""Returns the directory containing the C/C++ API include directives"""
return __import__('pkg_resources').resource_filename(__name__, 'include')
def get_config():
"""Returns a string containing the configuration info... | from ._library import *
from . import version
from .version import module as __version__
from .version import api as __api_version__
def get_include():
"""Returns the directory containing the C/C++ API include directives"""
return __import__('pkg_resources').resource_filename(__name__, 'include')
def get_config(... | Make use of the version module | Make use of the version module
| Python | bsd-3-clause | tiagofrepereira2012/bob.learn.linear,tiagofrepereira2012/bob.learn.linear,tiagofrepereira2012/bob.learn.linear | ---
+++
@@ -1,5 +1,7 @@
from ._library import *
-from ._library import __version__, __api_version__
+from . import version
+from .version import module as __version__
+from .version import api as __api_version__
def get_include():
"""Returns the directory containing the C/C++ API include directives""" |
d86144aa09ea0d6a679a661b0b2f887d6a2a725d | examples/python/values.py | examples/python/values.py | #! /usr/bin/env python
#
# values.py
#
"""
An example of using values via Python API
"""
from opencog.atomspace import AtomSpace, TruthValue
from opencog.type_constructors import *
a = AtomSpace()
set_type_ctor_atomspace(a)
a = FloatValue([1.0, 2.0, 3.0])
b = FloatValue([1.0, 2.0, 3.0])
c = FloatValue(1.0)
print('{}... | #! /usr/bin/env python
#
# values.py
#
"""
An example of using values via Python API
"""
from opencog.atomspace import AtomSpace, TruthValue
from opencog.type_constructors import *
a = AtomSpace()
set_type_ctor_atomspace(a)
a = FloatValue([1.0, 2.0, 3.0])
b = FloatValue([1.0, 2.0, 3.0])
c = FloatValue(1.0)
print('{}... | Add example of Value to Python list conversion | Add example of Value to Python list conversion
| Python | agpl-3.0 | rTreutlein/atomspace,AmeBel/atomspace,AmeBel/atomspace,rTreutlein/atomspace,AmeBel/atomspace,rTreutlein/atomspace,rTreutlein/atomspace,AmeBel/atomspace,AmeBel/atomspace,rTreutlein/atomspace | ---
+++
@@ -27,4 +27,8 @@
boundingBox.set_value(featureKey, featureValue)
print('set value to atom: {}'.format(boundingBox))
-print('get value from atom: {}'.format(boundingBox.get_value(featureKey)))
+value = boundingBox.get_value(featureKey)
+print('get value from atom: {}'.format(value))
+
+list = value.to_lis... |
c1fdbcf724ac7cc713cf3f5f3ca3cfca50007e34 | application.py | application.py | #!/usr/bin/env python
import os
from app import create_app
from flask.ext.script import Manager
application = create_app(os.getenv('FLASH_CONFIG') or 'default')
manager = Manager(application)
if __name__ == '__main__':
manager.run()
| #!/usr/bin/env python
import os
from app import create_app
from flask.ext.script import Manager, Server
application = create_app(os.getenv('FLASH_CONFIG') or 'default')
manager = Manager(application)
manager.add_command("runserver", Server(port=5002))
if __name__ == '__main__':
manager.run()
| Update to run on port 5002 | Update to run on port 5002
For development we will want to run multiple apps, so they should each bind to a different port number.
| Python | mit | mtekel/digitalmarketplace-buyer-frontend,mtekel/digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,mtekel/digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmar... | ---
+++
@@ -2,10 +2,11 @@
import os
from app import create_app
-from flask.ext.script import Manager
+from flask.ext.script import Manager, Server
application = create_app(os.getenv('FLASH_CONFIG') or 'default')
manager = Manager(application)
+manager.add_command("runserver", Server(port=5002))
if __name__... |
864f5be90fb31529f8ae9b0cf765fcf77504c0c5 | comics/comics/mortenm.py | comics/comics/mortenm.py | # encoding: utf-8
from comics.aggregator.crawler import BaseComicCrawler
from comics.meta.base import BaseComicMeta
class ComicMeta(BaseComicMeta):
name = 'Morten M (vg.no)'
language = 'no'
url = 'http://www.vg.no/spesial/mortenm/'
start_date = '1978-01-01'
history_capable_days = 120
schedule ... | # encoding: utf-8
from comics.aggregator.crawler import BaseComicCrawler
from comics.meta.base import BaseComicMeta
class ComicMeta(BaseComicMeta):
name = 'Morten M (vg.no)'
language = 'no'
url = 'http://www.vg.no/spesial/mortenm/'
start_date = '1978-01-01'
history_capable_days = 120
schedule ... | Add missing chars in URL for 'Morten M' crawler | Add missing chars in URL for 'Morten M' crawler
| Python | agpl-3.0 | klette/comics,jodal/comics,datagutten/comics,datagutten/comics,klette/comics,datagutten/comics,jodal/comics,jodal/comics,klette/comics,datagutten/comics,jodal/comics | ---
+++
@@ -15,7 +15,7 @@
class ComicCrawler(BaseComicCrawler):
def crawl(self):
- self.url = 'http://static.vg.no/gfx/mortenm/output/%(year)s/%(month)s/%(year)-%(month)s-%(day).jpg' % {
+ self.url = 'http://static.vg.no/gfx/mortenm/output/%(year)s/%(month)s/%(year)s-%(month)s-%(day)s.jpg' % {
... |
07fd8bf23917e18ba419859d788d9f51735f3b39 | conda_gitenv/__init__.py | conda_gitenv/__init__.py | from __future__ import absolute_import, division, print_function, unicode_literals
from distutils.version import StrictVersion
from conda import __version__ as CONDA_VERSION
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
_conda_base = StrictVersion('4.3.0')
_conda_supp... | from __future__ import absolute_import, division, print_function, unicode_literals
from distutils.version import StrictVersion
from conda import __version__ as CONDA_VERSION
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
_conda_base = StrictVersion('4.3.0')
_conda_vers... | Update minimum conda version diagnostic | Update minimum conda version diagnostic
| Python | bsd-3-clause | SciTools/conda-gitenv | ---
+++
@@ -11,7 +11,8 @@
del get_versions
_conda_base = StrictVersion('4.3.0')
-_conda_support = StrictVersion(CONDA_VERSION) >= _conda_base
-assert _conda_support, 'Minimum supported conda version is {}.'.format(_conda_base)
+_conda_version = StrictVersion(CONDA_VERSION)
+_conda_supported = _conda_version >= _c... |
82c1b2c14977040f9e6251ed9616fc0f64a52779 | system/slackhandler.py | system/slackhandler.py | import logging
from slacker import Slacker
import os
class SlackHandler(logging.Handler):
def __init__(self, slack_token):
logging.Handler.__init__(self)
self.slack = Slacker(slack_token)
def emit(self, record):
self.slack.chat.post_message('#leonard', text='ERROR ON {}\n{}'.format(
... | import logging
from slacker import Slacker
import os
class SlackHandler(logging.Handler):
def __init__(self, slack_token):
logging.Handler.__init__(self)
self.slack = Slacker(slack_token)
def emit(self, record):
if record.name != 'Unauthorized':
self.slack.chat.post_messag... | Remove Unauthorized exception logging to slack | Remove Unauthorized exception logging to slack
| Python | mit | sevazhidkov/leonard | ---
+++
@@ -9,7 +9,8 @@
self.slack = Slacker(slack_token)
def emit(self, record):
- self.slack.chat.post_message('#leonard', text='ERROR ON {}\n{}'.format(
- 'DEBUG' if os.environ.get('BOT_DEBUG', '0') == '1' else 'PRODUCTION @channel',
- record
- ), parse='full')
+... |
845aee2341b3beeb6c96c0a2b830e2729f5f30d2 | tests/GrammarCopyTest.py | tests/GrammarCopyTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 16.08.2017 19:16
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import *
class GrammarCopyTest(TestCase):
pass
if __name__ == '__main__':
main()
| #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 16.08.2017 19:16
:Licence GNUv3
Part of grammpy
"""
from copy import deepcopy, copy
from unittest import main, TestCase
from grammpy import *
class A(Nonterminal):
pass
class B(Nonterminal):
pass
class RuleAtoB(Rule):
rule = ([A], [B])
cla... | Add tests for grammar's __clone__ method | Add tests for grammar's __clone__ method
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -7,12 +7,61 @@
"""
+from copy import deepcopy, copy
from unittest import main, TestCase
from grammpy import *
+class A(Nonterminal):
+ pass
+
+
+class B(Nonterminal):
+ pass
+
+
+class RuleAtoB(Rule):
+ rule = ([A], [B])
+
+
class GrammarCopyTest(TestCase):
- pass
+ def __init__(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.