commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
dbe7bfdba6392cb2cc5c8d0e710682c2cb9c2bc5 | cellom2tif/filetypes.py | cellom2tif/filetypes.py | def is_cellomics_image(fn):
"""Determine whether a file is a Cellomics image.
Parameters
----------
fn : string
The filename of the file in question.
Returns
-------
is_cellom : bool
True if the filename points to a Cellomics image.
"""
is_cellom = fn.endswith('.C01... | import os
def fn_has_ext(fn, ext, case_sensitive=False):
"""
Determine whether a file has a particular extension.
Parameters
----------
fn : string
The filename of the query file.
ext : string
The extension being checked.
case_sensitive : bool
Whether or not to tre... | Add DIB files to cellomics file filter | Add DIB files to cellomics file filter
| Python | bsd-3-clause | jni/cellom2tif |
936234e5de71267faec3b081e96d937098ff6d51 | portfolio/tests/__init__.py | portfolio/tests/__init__.py | # from .admin import *
from .models import *
| # Must use absolute imports with ``*`` for Python 2.5.
# from portfolio.tests.admin import *
from portfolio.tests.models import *
| Fix test broken in Python 2.5 by commit 414cdb8b274. | Fix test broken in Python 2.5 by commit 414cdb8b274. | Python | bsd-3-clause | benspaulding/django-portfolio,blturner/django-portfolio,blturner/django-portfolio |
7a85c0da0640c5dc669e1416e6ce76c58343f07a | normandy/recipes/storage.py | normandy/recipes/storage.py | import json
from django.db import transaction
from product_details.storage import PDDatabaseStorage
class ProductDetailsRelationalStorage(PDDatabaseStorage):
"""
Extends the in-database storage for product_details to provide a
database table of locales for other models to have foreign keys to.
"""
... | import json
from django.db import transaction
from product_details.storage import PDDatabaseStorage
class ProductDetailsRelationalStorage(PDDatabaseStorage):
"""
Extends the in-database storage for product_details to provide a
database table of locales for other models to have foreign keys to.
"""
... | Remove obsolete locales during product_details sync. | Remove obsolete locales during product_details sync.
| Python | mpl-2.0 | mozilla/normandy,Osmose/normandy,Osmose/normandy,mozilla/normandy,mozilla/normandy,Osmose/normandy,mozilla/normandy,Osmose/normandy |
60a44ce1fe2fda130ec1cf416accfffa270fcd2e | mycli/packages/special/utils.py | mycli/packages/special/utils.py | import os
import subprocess
def handle_cd_command(arg):
"""Handles a `cd` shell command by calling python's os.chdir."""
CD_CMD = 'cd'
directory = ''
error = False
tokens = arg.split(CD_CMD + ' ')
directory = tokens[-1]
try:
os.chdir(directory)
output = subprocess.check_ou... | import os
import subprocess
def handle_cd_command(arg):
"""Handles a `cd` shell command by calling python's os.chdir."""
CD_CMD = 'cd'
directory = ''
error = False
tokens = arg.split(CD_CMD + ' ')
directory = tokens[-1]
try:
os.chdir(directory)
subprocess.call(['pwd'])
... | Stop using 'check_output' method and start using 'call' method in handler_cd_command | Stop using 'check_output' method and start using 'call' method in handler_cd_command
| Python | bsd-3-clause | mdsrosa/mycli,mdsrosa/mycli |
34ac848cc19477f032a78a4ccbc782d2694d1969 | bluebottle/votes/models.py | bluebottle/votes/models.py | from django.db import models
from django.conf import settings
from django.utils.translation import ugettext as _
from django_extensions.db.fields import CreationDateTimeField
class Vote(models.Model):
"""
Mixin for generating an invoice reference.
"""
created = CreationDateTimeField(_('created'))
... | from django.db import models
from django.conf import settings
from django.utils.translation import ugettext as _
from django_extensions.db.fields import CreationDateTimeField
class Vote(models.Model):
"""
Mixin for generating an invoice reference.
"""
created = CreationDateTimeField(_('created'))
... | Sort votes by created desc | Sort votes by created desc
BB-4430 #resolve
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle |
3f11a637f02b97bc9faaf18d26b6a6910f2302ca | Instanssi/admin_programme/forms.py | Instanssi/admin_programme/forms.py | # -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder
from Instanssi.ext_programme.models import ProgrammeEvent
class ProgrammeEventForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super... | # -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder
from Instanssi.ext_programme.models import ProgrammeEvent
class ProgrammeEventForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super... | Add google+ icon to admin form. | admin_programme: Add google+ icon to admin form.
| Python | mit | Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org |
9dd4da3d62312c5184150a967f7e4a3935c7b94e | moksha/tests/test_clientsockets.py | moksha/tests/test_clientsockets.py | import webtest
import moksha.tests.utils as testutils
from moksha.api.widgets.live import get_moksha_socket
from moksha.middleware import make_moksha_middleware
from tw2.core import make_middleware as make_tw2_middleware
class TestClientSocketDumb:
def _setUp(self):
def kernel(config):
def a... | import webtest
import moksha.tests.utils as testutils
from moksha.api.widgets.live import get_moksha_socket
from moksha.middleware import make_moksha_middleware
from tw2.core import make_middleware as make_tw2_middleware
class TestClientSocketDumb:
def _setUp(self):
def kernel(config):
def a... | Rename test. Fix copy/pasta forgetfulness. | Rename test. Fix copy/pasta forgetfulness.
| Python | apache-2.0 | pombredanne/moksha,mokshaproject/moksha,mokshaproject/moksha,pombredanne/moksha,pombredanne/moksha,mokshaproject/moksha,mokshaproject/moksha,pombredanne/moksha |
43a2cb58df9dc3e4e91370d9b10c62c0d05b8798 | papermill/tests/test_cli.py | papermill/tests/test_cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Test the command line interface """
import pytest
from ..cli import _is_int, _is_float, _resolve_type
@pytest.mark.parametrize("test_input,expected", [
("True", True),
("False", False),
("None", None),
(13.3, 13.3),
(10, 10),
("hello world"... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Test the command line interface """
import pytest
from ..cli import _is_int, _is_float, _resolve_type
@pytest.mark.parametrize("test_input,expected", [
("True", True),
("False", False),
("None", None),
(13.3, 13.3),
("12.51", 12.51),
(10, 1... | Add test to include strings to numbers | Add test to include strings to numbers
| Python | bsd-3-clause | nteract/papermill,nteract/papermill |
7a6fc91b8eafe0cc88d892443ad25b24a94a3ace | cross_service_tempest_plugin/tests/scenario/test_cross_service.py | cross_service_tempest_plugin/tests/scenario/test_cross_service.py | # Copyright 2017 Andrea Frittoli
# 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 ... | # Copyright 2017 Andrea Frittoli
# 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 ... | Fix the skip to match plugins | Fix the skip to match plugins
| Python | apache-2.0 | afrittoli/cross_service_tempest_plugins,afrittoli/cross_service_tempest_plugins |
dd19012ed8bb6ec702d84abe400bc3dec47044f3 | sortedm2m_tests/__init__.py | sortedm2m_tests/__init__.py | # Python
import os
# django-setuptest
import setuptest
TEST_APPS = ['sortedm2m_tests', 'sortedm2m_field', 'sortedm2m_form', 'south_support']
class TestSuite(setuptest.SetupTestSuite):
def resolve_packages(self):
packages = super(TestSuite, self).resolve_packages()
for test_app in TEST_APPS:
... | # Python
import os
# django-setuptest
import setuptest
TEST_APPS = ['sortedm2m_tests', 'sortedm2m_field', 'sortedm2m_form', 'south_support']
class TestSuite(setuptest.SetupTestSuite):
def __init__(self, *args, **kwargs):
os.environ['DJANGO_SETTINGS_MODULE'] = 'test_settings'
from south.managemen... | Fix to allow tests with South migrations to run. | Fix to allow tests with South migrations to run.
| Python | bsd-3-clause | gregmuellegger/django-sortedm2m,fabrique/django-sortedm2m,gradel/django-sortedm2m,MathieuDuponchelle/django-sortedm2m,fabrique/django-sortedm2m,gradel/django-sortedm2m,fabrique/django-sortedm2m,gradel/django-sortedm2m,gregmuellegger/django-sortedm2m,MathieuDuponchelle/django-sortedm2m,gregmuellegger/django-sortedm2m |
44c609cb0cba6e1837a5605f3dd09f7a059d2f14 | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/Synth.py | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/Synth.py | import Axon
from Kamaelia.Apps.Jam.Audio.Polyphony import Polyphoniser
from Kamaelia.Apps.Jam.Audio.Mixer import MonoMixer
class Synth(Axon.Component.component):
polyphony = 8
def __init__(self, voiceGenerator, **argd):
super(Synth, self).__init__(**argd)
polyphoniser = Polyphoniser(polyphony=... | import Axon
from Kamaelia.Apps.Jam.Audio.Polyphony import Polyphoniser
from Kamaelia.Apps.Jam.Audio.Mixer import MonoMixer
class Synth(Axon.Component.component):
polyphony = 8
polyphoniser = Polyphoniser
def __init__(self, voiceGenerator, **argd):
super(Synth, self).__init__(**argd)
polyph... | Add option to change the polyphony component in the synth to allow different behaviours. | Add option to change the polyphony component in the synth to allow different behaviours.
| Python | apache-2.0 | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia |
4261aad86b40d052906b8162263e00aa7b12b5e7 | pritunl_node/call_buffer.py | pritunl_node/call_buffer.py | from constants import *
import collections
import uuid
class CallBuffer():
def __init__(self):
self.waiter = None
self.queue = collections.deque(maxlen=CALL_QUEUE_MAX)
self.call_waiters = {}
def wait_for_calls(self, callback):
if self.waiter:
self.waiter([])
... | from constants import *
import collections
import uuid
class CallBuffer():
def __init__(self):
self.waiter = None
self.queue = collections.deque(maxlen=CALL_QUEUE_MAX)
self.call_waiters = {}
def wait_for_calls(self, callback):
self.stop_waiter()
calls = []
while... | Add stop waiter to call buffer | Add stop waiter to call buffer
| Python | agpl-3.0 | pritunl/pritunl-node,pritunl/pritunl-node |
e5949d11bf2c8b37a4fa583d71a21e2719364f5c | changes/jobs/sync_build.py | changes/jobs/sync_build.py | from datetime import datetime
from flask import current_app
from changes.backends.jenkins.builder import JenkinsBuilder
from changes.config import db, queue
from changes.constants import Status, Result
from changes.models import Build, RemoteEntity
def sync_build(build_id):
try:
build = Build.query.get(b... | import logging
from datetime import datetime
from flask import current_app
from changes.backends.jenkins.builder import JenkinsBuilder
from changes.config import db, queue
from changes.constants import Status, Result
from changes.models import Build, RemoteEntity
logger = logging.getLogger('jobs')
def sync_build(b... | Write exceptions to jobs logger | Write exceptions to jobs logger
| Python | apache-2.0 | bowlofstew/changes,dropbox/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes |
70e4c1fe5faefd87d19fa0067010cfdbeb7576c2 | tests/models.py | tests/models.py | from django.db import models
from enumfields import Enum, EnumField
class MyModel(models.Model):
class Color(Enum):
RED = 'r'
GREEN = 'g'
BLUE = 'b'
color = EnumField(Color, max_length=1)
| from django.db import models
from enum import Enum
from enumfields import EnumField
class MyModel(models.Model):
class Color(Enum):
RED = 'r'
GREEN = 'g'
BLUE = 'b'
color = EnumField(Color, max_length=1)
| Use regular Enums in tests | Use regular Enums in tests
| Python | mit | jessamynsmith/django-enumfields,suutari-ai/django-enumfields,bxm156/django-enumfields,jackyyf/django-enumfields |
7635dd48e94cb1a128b95a5237dc289f1f65964c | django_digest/test/__init__.py | django_digest/test/__init__.py | from __future__ import absolute_import
from __future__ import unicode_literals
import django.test
from django_digest.test.methods.basic import BasicAuth
from django_digest.test.methods.detect import DetectAuth
from django_digest.test.methods.digest import DigestAuth
class Client(django.test.Client):
AUTH_METHODS ... | from __future__ import absolute_import
from __future__ import unicode_literals
import django.test
from django_digest.test.methods.basic import BasicAuth
from django_digest.test.methods.detect import DetectAuth
from django_digest.test.methods.digest import DigestAuth
class Client(django.test.Client):
AUTH_METHODS... | Reset input for second "request" | Reset input for second "request"
| Python | bsd-3-clause | dimagi/django-digest |
100a2ef97d499a87d3fae271f794de050f1c5686 | opps/sitemaps/urls.py | opps/sitemaps/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.contrib.sitemaps import views as sitemap_views
from opps.core.cache import cache_page
from opps.sitemaps.sitemaps import GenericSitemap, InfoDisct
sitemaps = {
'articles': GenericSitemap(InfoDisct(), priority=0.... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.contrib.sitemaps import views as sitemap_views
from opps.core.cache import cache_page
from opps.sitemaps.sitemaps import GenericSitemap, InfoDisct
sitemaps = {
'containers': GenericSitemap(InfoDisct(), priority=... | Add cache in sitemap section | Add cache in sitemap section
| Python | mit | williamroot/opps,opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,jeanmask/opps,opps/opps,opps/opps,opps/opps |
d125a0ff41311be4d0da35a3ebdad51eeed0bc19 | ctypeslib/test/test_dynmodule.py | ctypeslib/test/test_dynmodule.py | # Basic test of dynamic code generation
import unittest
import stdio
from ctypes import POINTER, c_int
class DynModTest(unittest.TestCase):
def test_fopen(self):
self.failUnlessEqual(stdio.fopen.restype, POINTER(stdio.FILE))
self.failUnlessEqual(stdio.fopen.argtypes, [stdio.STRING, stdio.STRING])
... | # Basic test of dynamic code generation
import unittest
import os, glob
import stdio
from ctypes import POINTER, c_int
class DynModTest(unittest.TestCase):
def tearDown(self):
for fnm in glob.glob(stdio._gen_basename + ".*"):
try:
os.remove(fnm)
except IOError:
... | Clean up generated files in the tearDown method. | Clean up generated files in the tearDown method.
| Python | mit | sugarmanz/ctypeslib |
e64b8fcb9854edcc689bf4b8fec5b3c589e7226f | netdisco/discoverables/belkin_wemo.py | netdisco/discoverables/belkin_wemo.py | """ Discovers Belkin Wemo devices. """
from . import SSDPDiscoverable
class Discoverable(SSDPDiscoverable):
""" Adds support for discovering Belkin WeMo platform devices. """
def info_from_entry(self, entry):
""" Returns most important info from a uPnP entry. """
device = entry.description['... | """ Discovers Belkin Wemo devices. """
from . import SSDPDiscoverable
class Discoverable(SSDPDiscoverable):
""" Adds support for discovering Belkin WeMo platform devices. """
def info_from_entry(self, entry):
""" Returns most important info from a uPnP entry. """
device = entry.description['... | Add serialnumber to wemo discovery info tuple | Add serialnumber to wemo discovery info tuple
| Python | mit | sfam/netdisco,brburns/netdisco,balloob/netdisco |
6729515de02ce0678793ffb8faf280e65a4376e2 | run.py | run.py | import sys
from core import KDPVGenerator
def print_help():
print('Usage: python run.py [data.yml]')
def generate(filename):
generator = KDPVGenerator.from_yml(filename)
generator.generate()
def main():
if len(sys.argv) < 2:
filename = 'data.yml'
else:
filename = sys.argv[1]
... | import argparse
import os
from core import KDPVGenerator
def generate(filename):
generator = KDPVGenerator.from_yml(filename)
generator.generate()
def main():
parser = argparse.ArgumentParser(description='KDPV Generator')
parser.add_argument('filename', nargs='?', default='data.yml', help='data file... | Add argparse, handle data file missing | Add argparse, handle data file missing | Python | mit | spbpython/kdpv_generator |
546f4881974af4516cfaaf4e53c0940d90b6d502 | configurations/__init__.py | configurations/__init__.py | # flake8: noqa
from .base import Settings, Configuration
from .decorators import pristinemethod
__version__ = '0.8'
__all__ = ['Configuration', 'pristinemethod', 'Settings']
def load_ipython_extension(ipython):
# The `ipython` argument is the currently active `InteractiveShell`
# instance, which can be used ... | # flake8: noqa
from .base import Settings, Configuration
from .decorators import pristinemethod
__version__ = '0.8'
__all__ = ['Configuration', 'pristinemethod', 'Settings']
def load_ipython_extension(ipython):
# The `ipython` argument is the currently active `InteractiveShell`
# instance, which can be used ... | Add `django.setup()` in `load_ipython_extension` function for django>=1.7 compatibility | Add `django.setup()` in `load_ipython_extension` function for django>=1.7 compatibility
| Python | bsd-3-clause | cato-/django-configurations,blindroot/django-configurations,pombredanne/django-configurations,jezdez/django-configurations,seenureddy/django-configurations,incuna/django-configurations,jazzband/django-configurations,nangia/django-configurations,jazzband/django-configurations,NextHub/django-configurations,gatherhealth/d... |
504c50bd5cf229b5686f398304ab26e707d0cad8 | partner_firstname/exceptions.py | partner_firstname/exceptions.py | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... | Remove subclassing of exception, since there is only one. | Remove subclassing of exception, since there is only one.
| Python | agpl-3.0 | microcom/partner-contact,brain-tec/partner-contact,brain-tec/partner-contact,microcom/partner-contact |
de6f0144f566bc3a8eedb3f7d8f323d2e26f0612 | blender/SearchStrip.py | blender/SearchStrip.py | #=========== MODIFY PARAMETERS HERE =================
search_string="rea-mix-2016-05-13"
#=====================================================
import bpy
seq=bpy.data.scenes[0].sequence_editor.sequences_all
for i in seq:
#print(i.type)
if i.type == 'SOUND' or i.type == 'MOVIE':
if i.filepath.find(... | #=========== MODIFY PARAMETERS HERE =================
search_string="2016-07-25-rea-mix"
#=====================================================
import bpy
seq=bpy.data.scenes[0].sequence_editor.sequences_all
for i in seq:
#print(i.type)
if i.type == 'SOUND':
if i.sound.filepath.find(search_string)!... | Fix Search Strip script again (for sound files) | Fix Search Strip script again (for sound files)
| Python | cc0-1.0 | morevnaproject/scripts,morevnaproject/scripts |
1b673b695cedbb5008db172309de6b4c23ec900f | appengine-experimental/src/models.py | appengine-experimental/src/models.py | from datetime import datetime, timedelta
from google.appengine.ext import db
class CHPIncident(db.Model):
CenterID = db.StringProperty(required=True)
DispatchID = db.StringProperty(required=True)
LogID = db.StringProperty(required=True)
LogTime = db.DateTimeProperty()
LogType = db.StringProperty()
LogTypeID = ... | from datetime import datetime, timedelta
from google.appengine.ext import db
class CHPIncident(db.Model):
CenterID = db.StringProperty(required=True)
DispatchID = db.StringProperty(required=True)
LogID = db.StringProperty(required=True)
LogTime = db.DateTimeProperty()
LogType = db.StringProperty()
LogTypeID = ... | Add a "modified" property that will only be updated when the entity is actually updated. | Add a "modified" property that will only be updated when the entity is actually updated.
| Python | isc | lectroidmarc/SacTraffic,lectroidmarc/SacTraffic |
d2b06462f560f7243dd3f29b67c50d6d6f76f569 | util/generate.py | util/generate.py | #!/usr/bin/python
import os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
for f in os.listdir(TYPESDIR):
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basename.split('_')])
fullpath = os.path.join(TYPESDIR, f)
typepat... | #!/usr/bin/python
import os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
captures = sys.argv[1:]
if not captures:
captures = os.listdir(TYPESDIR)
for f in captures:
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basena... | Allow generating one specific xml file instead of the whole directory. | Allow generating one specific xml file instead of the whole directory.
| Python | apache-2.0 | loganj/foursquared,loganj/foursquared |
54b83d907b5edc5ab4abe81a270acff8cd44cef5 | grader/grader/utils/files.py | grader/grader/utils/files.py | import os
import tarfile
import tempfile
def make_tarball(source, tar_basename, extension=".tar.gz", compression="gz"):
dest = tempfile.mkdtemp()
tar_name = "{}{}".format(tar_basename, extension)
tar_path = os.path.join(dest, tar_name)
mode = "w:{}".format(compression or "")
with tarfile.open(tar... | import os
import tarfile
import tempfile
def make_tarball(source, tar_basename, extension=".tar.gz", compression="gz"):
"""Create a tarball from a source directory, and store it in a
temporary directory.
:param str source: The directory (or file... whatever) that we're
compressing into a tarball.... | Fix folder structure of created tarballs | Fix folder structure of created tarballs
| Python | mit | redkyn/grader,redkyn/grader,grade-it/grader |
d23aab91b69e1b71603afe6c3135cc11ce14a2fc | entity_networks/model_utils.py | entity_networks/model_utils.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import tensorflow as tf
def get_sequence_length(sequence, scope=None):
"""
This is a hacky way of determining the actual length of a sequence that has been padded with zeros.
"""... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import tensorflow as tf
def get_sequence_length(sequence, scope=None):
"""
This is a hacky way of determining the actual length of a sequence that has been padded with zeros.
"""... | Remove get_sequence_mask in favor of simpler embedding mask | Remove get_sequence_mask in favor of simpler embedding mask
| Python | mit | jimfleming/recurrent-entity-networks,mikalyoung/recurrent-entity-networks,mikalyoung/recurrent-entity-networks,jimfleming/recurrent-entity-networks |
1a2e892539cde260934ceffe58d399c5a3222d0c | actions/cloudbolt_plugins/multi_user_approval/two_user_approval.py | actions/cloudbolt_plugins/multi_user_approval/two_user_approval.py | """
Two User Approval
Overrides CloudBolt's standard Order Approval workflow. This Orchestration
Action requires two users to approve an order before it is becomes Active.
"""
from utilities.logger import ThreadLogger
logger = ThreadLogger(__name__)
def run(order, *args, **kwargs):
# Return the order's status ... | """
Two User Approval
Overrides CloudBolt's standard Order Approval workflow. This Orchestration
Action requires two users to approve an order before it becomes Active.
Requires CloudBolt 8.8
"""
def run(order, *args, **kwargs):
# Return the order's status to "PENDING" if fewer than two users have
# approve... | Remove logger and fix typos | Remove logger and fix typos
[DEV-12140]
| Python | apache-2.0 | CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge |
59ec54bbe49013826d2c15ce2162c2e0e335bd57 | modules/module_urlsize.py | modules/module_urlsize.py | """Warns about large files"""
def handle_url(bot, user, channel, url, msg):
if channel == "#wow": return
# inform about large files (over 5MB)
size = getUrl(url).getSize()
contentType = getUrl(url).getHeaders()['content-type']
if not size: return
size = size / 1024
if size > 5:
... | """Warns about large files"""
def handle_url(bot, user, channel, url, msg):
if channel == "#wow": return
# inform about large files (over 5MB)
size = getUrl(url).getSize()
headers = getUrl(url).getHeaders()['content-type']
if 'content-type' in headers:
contentType = headers['content-type'... | Handle cases where the server doesn't return content-type | Handle cases where the server doesn't return content-type
git-svn-id: 056f9092885898c4775d98c479d2d33d00273e45@120 dda364a1-ef19-0410-af65-756c83048fb2
| Python | bsd-3-clause | rnyberg/pyfibot,lepinkainen/pyfibot,lepinkainen/pyfibot,rnyberg/pyfibot,EArmour/pyfibot,nigeljonez/newpyfibot,aapa/pyfibot,huqa/pyfibot,huqa/pyfibot,aapa/pyfibot,EArmour/pyfibot |
1c9fc34d3c022d975b986f81d7947564bfc8462e | stock_ownership_availability_rules/model/stock_change_product_qty.py | stock_ownership_availability_rules/model/stock_change_product_qty.py | # -*- coding: utf-8 -*-
# Β© 2016 Laetitia Gangloff, Acsone SA/NV (http://www.acsone.eu)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models
class StockChangeProductQty(models.TransientModel):
_inherit = "stock.change.product.qty"
@api.model
def _finalize... | # -*- coding: utf-8 -*-
# Β© 2016 Laetitia Gangloff, Acsone SA/NV (http://www.acsone.eu)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models
class StockChangeProductQty(models.TransientModel):
_inherit = "stock.change.product.qty"
@api.model
def _prepare_... | Update PR regarding hook accepted by Odoo | Update PR regarding hook accepted by Odoo
| Python | agpl-3.0 | brain-tec/stock-logistics-workflow,brain-tec/stock-logistics-workflow,open-synergy/stock-logistics-workflow,akretion/stock-logistics-workflow,Eficent/stock-logistics-workflow,open-synergy/stock-logistics-workflow,gurneyalex/stock-logistics-workflow,acsone/stock-logistics-workflow,acsone/stock-logistics-workflow,Eficent... |
1cb0cb3167a9d641c45d034000a9b0f5202c0dde | preferences/models.py | preferences/models.py | from django.db import models
# Create your models here.
| from django.db import models
from opencivicdata.models.people_orgs import Person
class Preferences(models.Model):
representitive = models.ForeignKey(Person, related_name='rep_preferences')
senator = models.ForeignKey(Person, related_name='sen_preferences')
street_line1 = models.CharField(max_length = 10... | Add preferences model with address rep and sen | Add preferences model with address rep and sen
| Python | mit | jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot |
2a34baee8a33c01fcb253cb336144a570c32d5fa | digits/utils/lmdbreader.py | digits/utils/lmdbreader.py | # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import lmdb
class DbReader(object):
"""
Reads a database
"""
def __init__(self, location):
"""
Arguments:
location -- where is the database
"""
self._db = lm... | # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import lmdb
class DbReader(object):
"""
Reads a database
"""
def __init__(self, location):
"""
Arguments:
location -- where is the database
"""
self._db = lm... | Add API to LmdbReader (used by gan_features.py) | Add API to LmdbReader (used by gan_features.py)
| Python | bsd-3-clause | ethantang95/DIGITS-GAN,gheinrich/DIGITS-GAN,ethantang95/DIGITS-GAN,gheinrich/DIGITS-GAN,gheinrich/DIGITS-GAN,gheinrich/DIGITS-GAN,ethantang95/DIGITS-GAN,ethantang95/DIGITS-GAN |
24194cc6d7b4248e3eb10535be43f5bb01f41fe7 | eratosthenes_lambda.py | eratosthenes_lambda.py | from __future__ import print_function
from timeit import default_timer as timer
import json
import datetime
print('Loading function')
def eratosthenes(n):
sieve = [ True for i in range(n+1) ]
def markOff(pv):
for i in range(pv+pv, n+1, pv):
sieve[i] = False
markOff(2)
f... | from __future__ import print_function
from timeit import default_timer as timer
import json
import datetime
print('Loading function')
def eratosthenes(n):
sieve = [ True for i in range(n+1) ]
def markOff(pv):
for i in range(pv+pv, n+1, pv):
sieve[i] = False
markOff(2)
f... | Reformat for easier copy and pasting (needed for usability with AWS Console). | Reformat for easier copy and pasting (needed for usability with AWS Console).
| Python | mit | jconning/lambda-cpu-cost,jconning/lambda-cpu-cost |
318781bca1973f34d3a6b00b5b9253cef5190f58 | skimage/io/tests/test_io.py | skimage/io/tests/test_io.py | import os
from numpy.testing import assert_array_equal, raises, run_module_suite
import numpy as np
import skimage.io as io
from skimage import data_dir
def test_stack_basic():
x = np.arange(12).reshape(3, 4)
io.push(x)
assert_array_equal(io.pop(), x)
@raises(ValueError)
def test_stack_non_array():
... | import os
from numpy.testing import assert_array_equal, raises, run_module_suite
import numpy as np
import skimage.io as io
from skimage.io._plugins.plugin import plugin_store
from skimage import data_dir
def test_stack_basic():
x = np.arange(12).reshape(3, 4)
io.push(x)
assert_array_equal(io.pop(), x)... | Add test that error gets raised when no plugin available | Add test that error gets raised when no plugin available
| Python | bsd-3-clause | bsipocz/scikit-image,emon10005/scikit-image,SamHames/scikit-image,GaZ3ll3/scikit-image,chintak/scikit-image,robintw/scikit-image,warmspringwinds/scikit-image,bennlich/scikit-image,ajaybhat/scikit-image,pratapvardhan/scikit-image,blink1073/scikit-image,michaelpacer/scikit-image,chintak/scikit-image,vighneshbirodkar/scik... |
1ba12783fca76247447d84013d91f5c3073386a4 | web_scraper/core/html_fetchers.py | web_scraper/core/html_fetchers.py | import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import requests
def fetch_html_document(url):
"""Fetch html from url and return html
:param str url: an address to a resource on the Internet
:return no except hit: status code and html of page (if exist... | import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import requests
def fetch_html_document(url, user_agent='python_requests.cli-ws'):
"""Fetch html from url and return html
:param str url: an address to a resource on the Internet
:opt param str user_agen... | Add user-agent field to html_fetcher | Add user-agent field to html_fetcher
| Python | mit | Samuel-L/cli-ws,Samuel-L/cli-ws |
a8f4f7a3d3ecc88a8517221437f1e7b14b3f0a1d | seimas/prototype/helpers.py | seimas/prototype/helpers.py | import yaml
import os.path
from django.http import Http404
from django.conf.urls import url
from django.conf import settings
def get_page(path):
url = ('/%s/' % path) if path else '/'
with (settings.PROJECT_DIR / 'prototype.yml').open() as f:
data = yaml.load(f)
try:
page = data['urls'][u... | import yaml
import os.path
from django.http import Http404
from django.conf.urls import url
from django.conf import settings
def get_page(path):
url = ('/%s/' % path) if path else '/'
with (settings.PROJECT_DIR / 'prototype.yml').open(encoding='utf-8') as f:
data = yaml.load(f)
try:
page ... | Fix prototype template loading error | Fix prototype template loading error
| Python | agpl-3.0 | sirex/manopozicija.lt,sirex/nuomones,sirex/manopozicija.lt,sirex/nuomones,sirex/manopozicija.lt |
2979986e68d2b8c2b3fb4090e258a941d6a56d9e | tests/test_website_flow.py | tests/test_website_flow.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def test_website_can_respond(harness):
harness.fs.www.mk(('index.html.spt', 'Greetings, program!'))
assert harness.client.GET().body == 'Greetings, program!'
| from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def test_website_can_respond(harness):
harness.fs.www.mk(('index.html.spt', 'Greetings, program!'))
assert harness.client.GET().body == 'Greetings, program!'
d... | Add failing test for exception handling regression | Add failing test for exception handling regression
Code coming out of custom error message needs to be the code expected.
| Python | mit | gratipay/aspen.py,gratipay/aspen.py |
23d12b1c4b755c7d35406bf2428eefbd682ef68f | examples/xor-classifier.py | examples/xor-classifier.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Example using the theanets package for learning the XOR relation.'''
import climate
import logging
import numpy as np
import theanets
climate.enable_default_logging()
X = np.array([[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]])
Y = np.array([0, 1, 1, 0, ])
Xi = np... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Example using the theanets package for learning the XOR relation.'''
import climate
import logging
import numpy as np
import theanets
climate.enable_default_logging()
X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype='f')
Y = np.array([[0], [1], [1], [0]], dtype='... | Use rprop for xor example. | Use rprop for xor example.
| Python | mit | lmjohns3/theanets,devdoer/theanets,chrinide/theanets |
94796ca0107e6c676e3905675290bbe147169717 | hoppy/deploy.py | hoppy/deploy.py | from restkit import Resource
from hoppy import api_key
class Deploy(Resource):
def __init__(self, use_ssl=False):
self.api_key = api_key
super(Deploy, self).__init__(self.host, follow_redirect=True)
def check_configuration(self):
if not self.api_key:
raise HoptoadError('AP... | from hoppy.api import HoptoadResource
class Deploy(HoptoadResource):
def __init__(self, use_ssl=False):
from hoppy import api_key
self.api_key = api_key
super(Deploy, self).__init__(use_ssl)
def check_configuration(self):
if not self.api_key:
raise HoptoadError('API... | Test Deploy resource after reworking. | Test Deploy resource after reworking.
| Python | mit | peplin/hoppy |
9066d3e5bdbc95fb347b1a081d9b7db33ab68ea4 | src/autobot/src/stopsign.py | src/autobot/src/stopsign.py | #!/usr/bin/env python
import rospy
class StopStates(object):
NORMAL = 0
FULL_STOP = 1
IGNORE_STOP_SIGNS = 2
class StopSign(object):
def __init__(self):
self.state = StopStates.NORMAL
self.stopDuration = 2
self.ignoreDuration = 2
def stopSignDetected(self):
self... | #!/usr/bin/env python
import rospy
class StopStates(object):
NORMAL = 0
FULL_STOP = 1
IGNORE_STOP_SIGNS = 2
class StopSign(object):
def __init__(self):
self.state = StopStates.NORMAL
self.stopDuration = 2
self.ignoreDuration = 4
def stopSignDetected(self):
self... | Fix state machine using wrong variable | Fix state machine using wrong variable
| Python | mit | atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot |
2c5a1bebf805c9bf5208fc75c32d8998b865eb32 | designate/objects/zone_transfer_request.py | designate/objects/zone_transfer_request.py | # Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Graham Hayes <graham.hayes@hp.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licens... | # Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Graham Hayes <graham.hayes@hp.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licens... | Remove duplicate fields from ZoneTransferRequest object | Remove duplicate fields from ZoneTransferRequest object
The fields id, version, created_at, updated_at are defined in the
PersistentObjectMixin which ZoneTransferRequest extends, so this
patch removes them from ZoneTransferRequest.
Change-Id: Iff20a31b4a208bff0bc879677a9901fedc43226b
Closes-Bug: #1403274
| Python | apache-2.0 | kiall/designate-py3,muraliselva10/designate,openstack/designate,kiall/designate-py3,ramsateesh/designate,kiall/designate-py3,openstack/designate,muraliselva10/designate,cneill/designate,tonyli71/designate,cneill/designate,cneill/designate-testing,cneill/designate-testing,cneill/designate,tonyli71/designate,muraliselva1... |
8441acfd5071e8b63fde816f67e167997045d510 | Lib/misc/setup.py | Lib/misc/setup.py |
import os
from numpy.distutils.misc_util import Configuration
def configuration(parent_package='',top_path=None):
config = Configuration('misc',parent_package, top_path)
config.add_data_files('lena.dat')
print "########", config
return config
if __name__ == '__main__':
from numpy.distutils.core i... |
import os
from numpy.distutils.misc_util import Configuration
def configuration(parent_package='',top_path=None):
config = Configuration('misc',parent_package, top_path)
config.add_data_files('lena.dat')
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(**confi... | Remove extra noise on install. | Remove extra noise on install.
| Python | bsd-3-clause | jseabold/scipy,richardotis/scipy,anntzer/scipy,fredrikw/scipy,behzadnouri/scipy,aman-iitj/scipy,mortada/scipy,njwilson23/scipy,trankmichael/scipy,trankmichael/scipy,apbard/scipy,niknow/scipy,aman-iitj/scipy,behzadnouri/scipy,FRidh/scipy,vanpact/scipy,Eric89GXL/scipy,rmcgibbo/scipy,larsmans/scipy,Shaswat27/scipy,ogrisel... |
758f73e1ecc34f52929595dfcf5db4a3a24fcbc6 | Python/views.py | Python/views.py | import requests
from django.shortcuts import render
from django.conf import settings
def oauthtest(request):
return render(request, 'oauthtest.html', {
'link': '{}o/authorize/?response_type=code&client_id={}&redirect_uri={}{}/oauthdone/'.format(
settings.API_URL,
settings.OAUTH_CLIE... | import requests
from django.shortcuts import render
from django.conf import settings
def oauthtest(request):
return render(request, 'oauthtest.html', {
'link': '{}o/authorize/?response_type=code&client_id={}&redirect_uri={}{}/oauthdone/'.format(
settings.API_URL,
settings.OAUTH_CLIE... | Fix redirect URI in oauthdone | Fix redirect URI in oauthdone
| Python | apache-2.0 | SchoolIdolTomodachi/SchoolIdolAPIOAuthExample,SchoolIdolTomodachi/SchoolIdolAPIOAuthExample,SchoolIdolTomodachi/SchoolIdolAPIOAuthExample |
68a1877bcd4511008aeff977cb45fa9edb5e9a8b | fusekiutils/__init__.py | fusekiutils/__init__.py | __author__ = 'adam'
import time
from subprocess import Popen
import shlex
import os
import urllib
def LaunchFuseki():
fuseki_url = "http://localhost:3030"
fuseki_dir = os.getcwd() + "/jena-fuseki"
fuseki_executable = fuseki_dir + "/fuseki-server"
f_log = open("fuseki.log","w")
fuseki = Popen( arg... | __author__ = 'adam'
import time
from subprocess import Popen
import shlex
import os
import urllib
import sys
def LaunchFuseki():
fuseki_dir = os.path.join(os.path.abspath(os.getcwd()), 'jena-fuseki')
if sys.platform == 'win32':
fuseki_executable = os.path.join(fuseki_dir, 'fuseki-server.bat')
els... | Support both windows and shell environments when launching fuseki | Support both windows and shell environments when launching fuseki
| Python | lgpl-2.1 | adamnagel/qudt-for-domain-tools,adamnagel/qudt-for-domain-tools,adamnagel/qudt-for-domain-tools |
94ff1527fb16c7a3557112f6e30cded4de99dda8 | fabtastic/fabric/commands/c_supervisord.py | fabtastic/fabric/commands/c_supervisord.py | from fabric.api import *
from fabtastic.fabric.util import _current_host_has_role
def supervisord_restart_all(roles='webapp_servers'):
"""
Restarts all of supervisord's managed programs.
"""
if _current_host_has_role(roles):
print("=== RESTARTING SUPERVISORD PROGRAMS ===")
with cd(env.R... | from fabric.api import *
from fabtastic.fabric.util import _current_host_has_role
def supervisord_restart_all(roles='webapp_servers'):
"""
Restarts all of supervisord's managed programs.
"""
if _current_host_has_role(roles):
print("=== RESTARTING SUPERVISORD PROGRAMS ===")
with cd(env.R... | Fix arg order for supervisord_restart_prog | Fix arg order for supervisord_restart_prog
| Python | bsd-3-clause | duointeractive/django-fabtastic |
86008628f7bff187c956273fbf6f15376ab861d1 | src/sgeparse/query.py | src/sgeparse/query.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess as sp
from .parser import JobsParser
def get_jobs():
xml_text = fetch_xml()
parser = JobsParser(xml_text)
return parser.jobs
def fetch_xml(user=None):
cmd = ['qstat', '-xml']
if user is not None:
cmd.extend(['-u', user])
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess as sp
from .parser import JobsParser
def get_jobs(user=None):
xml_text = fetch_xml(user=user)
parser = JobsParser(xml_text)
return parser.jobs
def fetch_xml(user=None):
cmd = ['qstat', '-xml']
if user is not None:
cmd.exte... | Add user argument to get_jobs | Add user argument to get_jobs
| Python | mit | mindriot101/sgeparse |
43a209bd122329d5a70e5f0bdc2066e952676c6a | tests/unit/output/yaml_out_test.py | tests/unit/output/yaml_out_test.py | # -*- coding: utf-8 -*-
'''
unittests for yaml outputter
'''
# Import Python Libs
from __future__ import absolute_import
from StringIO import StringIO
import sys
# Import Salt Testing Libs
from salttesting import TestCase
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt Li... | # -*- coding: utf-8 -*-
'''
unittests for yaml outputter
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import TestCase
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt Libs
from salt.output import yaml_out as ya... | Remove unused imports for lint | Remove unused imports for lint | Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt |
b970f230864b40eaddb8e5faa76538c9f8e5c59c | txircd/modules/rfc/cmd_userhost.py | txircd/modules/rfc/cmd_userhost.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
class UserhostCommand(ModuleData, Command):
implements(IPlugin, IModuleData, ICommand)
name = "UserhostCommand"
core = Tru... | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
class UserhostCommand(ModuleData, Command):
implements(IPlugin, IModuleData, ICommand)
name = "UserhostCommand"
core = Tru... | Add affected users to userhasoperpermission call in USERHOST | Add affected users to userhasoperpermission call in USERHOST
| Python | bsd-3-clause | Heufneutje/txircd,ElementalAlchemist/txircd |
4c58426a88ba056841b1d1b44536f2f85de120cc | pythonx/completers/javascript/__init__.py | pythonx/completers/javascript/__init__.py | # -*- coding: utf-8 -*-
import json
import os.path
import re
from completor import Completor
from completor.compat import to_unicode
dirname = os.path.dirname(__file__)
class Tern(Completor):
filetype = 'javascript'
daemon = True
ident = re.compile(r"""(\w+)|(('|").+)""", re.U)
trigger = r"""\w+$|[... | # -*- coding: utf-8 -*-
import json
import os.path
import re
from completor import Completor
from completor.compat import to_unicode
dirname = os.path.dirname(__file__)
class Tern(Completor):
filetype = 'javascript'
daemon = True
ident = re.compile(r"""(\w+)|(["'][^"']*)""", re.U)
trigger = r"""\w+... | Fix regex for tern complete_strings plugin | Fix regex for tern complete_strings plugin
| Python | mit | maralla/completor.vim,maralla/completor.vim |
bad65df528da18293d38b0f50dbbb16390af465e | sphinx/source/docs/user_guide/source_examples/plotting_label.py | sphinx/source/docs/user_guide/source_examples/plotting_label.py | from bokeh.plotting import figure, show, output_file
from bokeh.models import ColumnDataSource, Range1d, Label
output_file("label.html", title="label.py example")
source = ColumnDataSource(data=dict(height=[66, 71, 72, 68, 58, 62],
weight=[165, 189, 220, 141, 260, 174],
... | from bokeh.plotting import figure, show, output_file
from bokeh.models import ColumnDataSource, Range1d, Label
output_file("label.html", title="label.py example")
source = ColumnDataSource(data=dict(height=[66, 71, 72, 68, 58, 62],
weight=[165, 189, 220, 141, 260, 174],
... | Include example of css render_mode | Include example of css render_mode
| Python | bsd-3-clause | clairetang6/bokeh,Karel-van-de-Plassche/bokeh,mindriot101/bokeh,aiguofer/bokeh,rs2/bokeh,Karel-van-de-Plassche/bokeh,KasperPRasmussen/bokeh,dennisobrien/bokeh,draperjames/bokeh,bokeh/bokeh,quasiben/bokeh,KasperPRasmussen/bokeh,philippjfr/bokeh,stonebig/bokeh,justacec/bokeh,KasperPRasmussen/bokeh,phobson/bokeh,phobson/b... |
c6cdf543f6bfd0049594eeb530551371bf21bae4 | test/test_scraping.py | test/test_scraping.py | from datetime import datetime
import sys
import unittest
import btceapi
class TestScraping(unittest.TestCase):
def test_scrape_main_page(self):
mainPage = btceapi.scrapeMainPage()
for message in mainPage.messages:
msgId, user, time, text = message
self.assertIs(type(time),... | from datetime import datetime
import sys
import unittest
import btceapi
class TestScraping(unittest.TestCase):
def test_scrape_main_page(self):
mainPage = btceapi.scrapeMainPage()
for message in mainPage.messages:
msgId, user, time, text = message
assert type(time) is date... | Fix for assertIs method not being present in Python 2.6. | Fix for assertIs method not being present in Python 2.6.
| Python | mit | lromanov/tidex-api,CodeReclaimers/btce-api,alanmcintyre/btce-api |
96076567bac3329cba55b61c59781c7670c7a02b | anybox/recipe/odoo/runtime/patch_odoo.py | anybox/recipe/odoo/runtime/patch_odoo.py | """Necessary monkey patches to make Odoo work in the buildout context.
"""
import subprocess
def do_patch(gevent_script_path):
"""
Patch odoo prefork so that --workers execute the correct gevent script.
This monkey patch could be safer, if the script path determination could be
isolated from the act... | """Necessary monkey patches to make Odoo work in the buildout context.
"""
import subprocess
def do_patch(gevent_script_path):
"""
Patch odoo prefork so that --workers execute the correct gevent script.
This monkey patch could be safer, if the script path determination could be
isolated from the act... | Maintain compatilbility with <10 version | Maintain compatilbility with <10 version | Python | agpl-3.0 | anybox/anybox.recipe.odoo |
3cc3c0b90714bbf7a2638b16faec69aba82a4050 | op_robot_tests/tests_files/brokers/openprocurement_client_helper.py | op_robot_tests/tests_files/brokers/openprocurement_client_helper.py | from openprocurement_client.client import Client
import sys
def prepare_api_wrapper(key='', host_url="https://api-sandbox.openprocurement.org", api_version='0.8' ):
return Client(key, host_url, api_version )
def get_internal_id(get_tenders_function, date):
result = get_tenders_function({"offset": date, "opt_fiel... | from openprocurement_client.client import Client
import sys
def prepare_api_wrapper(key='', host_url="https://api-sandbox.openprocurement.org", api_version='0.8'):
return Client(key, host_url, api_version)
def get_internal_id(get_tenders_function, date):
result = get_tenders_function({"offset": date, "opt_f... | Improve PEP8 compliance in op_client_helper.py | Improve PEP8 compliance in op_client_helper.py
| Python | apache-2.0 | SlaOne/robot_tests,kosaniak/robot_tests,selurvedu/robot_tests,Leits/robot_tests,cleardevice/robot_tests,VadimShurhal/robot_tests.broker.aps,mykhaly/robot_tests,Rzaporozhets/robot_tests,bubanoid/robot_tests,openprocurement/robot_tests |
27c54cfd5eaf180595e671c80bd7c39406c8a24c | databroker/__init__.py | databroker/__init__.py | # Import intake to run driver discovery first and avoid circular import issues.
import intake
del intake
import warnings
import logging
logger = logging.getLogger(__name__)
from ._core import (Broker, BrokerES, Header, ALL,
lookup_config, list_configs, describe_configs, temp_config,
... | # Import intake to run driver discovery first and avoid circular import issues.
import intake
del intake
import warnings
import logging
logger = logging.getLogger(__name__)
from .v1 import Broker, Header, ALL, temp, temp_config
from .utils import (lookup_config, list_configs, describe_configs,
... | Move top-level imports from v0 to v1. | Move top-level imports from v0 to v1.
| Python | bsd-3-clause | ericdill/databroker,ericdill/databroker |
685116d1a2799399819ed780679403e7576e67b5 | keystone/tests/unit/common/test_manager.py | keystone/tests/unit/common/test_manager.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 t... | # 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 t... | Correct test to support changing N release name | Correct test to support changing N release name
oslo.log is going to change to use Newton rather than N so this test
should not make an assumption about the way that
versionutils.deprecated is calling report_deprecated_feature.
Change-Id: I06aa6d085232376811f73597b2d84b5174bc7a8d
Closes-Bug: 1561121
(cherry picked fr... | Python | apache-2.0 | openstack/keystone,openstack/keystone,cernops/keystone,klmitch/keystone,mahak/keystone,mahak/keystone,rajalokan/keystone,ilay09/keystone,openstack/keystone,ilay09/keystone,ilay09/keystone,cernops/keystone,klmitch/keystone,mahak/keystone,rajalokan/keystone,rajalokan/keystone |
74bd9ffd412f22671232cb301b3762660a73d912 | lot/landmapper/urls.py | lot/landmapper/urls.py | from django.urls import include, re_path, path
from landmapper.views import *
urlpatterns = [
# What is difference between re_path and path?
# re_path(r'',
# home, name='landmapper-home'),
path('', home, name="home"),
path('/identify/', identify, name="identify"),
path('/report/', report, n... | from django.urls import include, re_path, path
from landmapper.views import *
urlpatterns = [
# What is difference between re_path and path?
# re_path(r'',
# home, name='landmapper-home'),
path('', home, name="home"),
path('/identify', identify, name="identify"),
path('/report', report, nam... | Fix get taxlot url and remove trailing slashes | Fix get taxlot url and remove trailing slashes
| Python | bsd-3-clause | Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner |
789b33f8c6d4ddad4c46e7a3815d9f9543485caa | usb/blueprints/api.py | usb/blueprints/api.py | from flask import Blueprint, jsonify, request
from usb.models import db, Redirect, DeviceType
from usb.shortener import get_short_id, get_short_url
api = Blueprint('api', __name__)
@api.route('/links')
def get_links():
return jsonify({}), 200
@api.route('/links', methods=['POST'])
def shorten_url():
short... | from flask import Blueprint, jsonify, request
from usb.models import db, Redirect, DeviceType
from usb.shortener import get_short_id, get_short_url
api = Blueprint('api', __name__)
@api.route('/links')
def get_links():
return jsonify({}), 200
@api.route('/links', methods=['POST'])
def shorten_url():
short... | Return short URL if it's already exists | Return short URL if it's already exists
| Python | mit | dizpers/usb |
9b4e7a06932d6ed6a5a9032619fa433629187d69 | utilkit/stringutil.py | utilkit/stringutil.py | """
String/unicode helper functions
"""
def safe_unicode(obj, *args):
""" return the unicode representation of obj """
try:
return unicode(obj, *args) # pylint:disable=undefined-variable
except UnicodeDecodeError:
# obj is byte string
ascii_text = str(obj).encode('string_escape')
... | """
String/unicode helper functions
"""
def safe_unicode(obj, *args):
""" return the unicode representation of obj """
try:
return unicode(obj, *args) # noqa for undefined-variable
except UnicodeDecodeError:
# obj is byte string
ascii_text = str(obj).encode('string_escape')
... | Disable error-checking that assumes Python 3 for these Python 2 helpers, landscape.io style | Disable error-checking that assumes Python 3 for these Python 2 helpers,
landscape.io style
| Python | mit | aquatix/python-utilkit |
8995cbf71454e3424e15913661ee659c48f7b8fa | volunteer_planner/settings/local_mysql.py | volunteer_planner/settings/local_mysql.py | # coding: utf-8
from volunteer_planner.settings.local import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'volunteer_planner',
'PASSWORD': os.environ.get('DATABASE_PW', 'volunteer_planner'),
'USER': os.environ.get('DB_USER', 'vp')
}
}
| # coding: utf-8
from volunteer_planner.settings.local import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': os.environ.get('DATABASE_NAME', 'volunteer_planner'),
'PASSWORD': os.environ.get('DATABASE_PW', 'volunteer_planner'),
'USER': os.environ.get('DB_U... | Make local mysql db name overridable with DATABASE_NAME environment variable | Make local mysql db name overridable with DATABASE_NAME environment variable
| Python | agpl-3.0 | christophmeissner/volunteer_planner,christophmeissner/volunteer_planner,coders4help/volunteer_planner,klinger/volunteer_planner,klinger/volunteer_planner,pitpalme/volunteer_planner,pitpalme/volunteer_planner,pitpalme/volunteer_planner,coders4help/volunteer_planner,pitpalme/volunteer_planner,coders4help/volunteer_planne... |
7fb1b95205de32ec27b4e5428928b1bba417c9c8 | build/fbcode_builder/specs/fbthrift.py | build/fbcode_builder/specs/fbthrift.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.folly as folly
import specs.fizz as fizz
import specs.rsocket as rsocket
import spec... | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.folly as folly
import specs.fizz as fizz
import specs.rsocket as rsocket
import spec... | Cut fbcode_builder dep for thrift on krb5 | Cut fbcode_builder dep for thrift on krb5
Summary: [Thrift] Cut `fbcode_builder` dep for `thrift` on `krb5`. In the past, Thrift depended on Kerberos and the `krb5` implementation for its transport-layer security. However, Thrift has since migrated fully to Transport Layer Security for its transport-layer security and... | Python | unknown | ReactiveSocket/reactivesocket-cpp,ReactiveSocket/reactivesocket-cpp,phoad/rsocket-cpp,phoad/rsocket-cpp,rsocket/rsocket-cpp,phoad/rsocket-cpp,rsocket/rsocket-cpp,rsocket/rsocket-cpp,ReactiveSocket/reactivesocket-cpp,rsocket/rsocket-cpp,phoad/rsocket-cpp,phoad/rsocket-cpp |
6ec13485a475aeabf8a7fc461b160bbc4a453a00 | windmill/server/__init__.py | windmill/server/__init__.py | # Copyright (c) 2006-2007 Open Source Applications Foundation
# Copyright (c) 2008-2009 Mikeal Rogers <mikeal.rogers@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | # Copyright (c) 2006-2007 Open Source Applications Foundation
# Copyright (c) 2008-2009 Mikeal Rogers <mikeal.rogers@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | Stop forwarding flash by default, it breaks more than it doesn't. | Stop forwarding flash by default, it breaks more than it doesn't.
git-svn-id: 87d19257dd11500985d055ec4730e446075a5f07@1279 78c7df6f-8922-0410-bcd3-9426b1ad491b
| Python | apache-2.0 | ept/windmill,ept/windmill,ept/windmill |
c57910adc6e907881a99e092837fc35e5f45518b | survey_creation/config/de_17.py | survey_creation/config/de_17.py | """
Config file specific to uk to create automated survey
"""
class config:
# To modify, just add the keys of the dictionary
header_to_modify = [{'class': 'S', 'name': 'sid', 'text': '421498'},
{'class': 'S', 'name': 'admin_email', 'text': 'olivier.philippe@soton.ac.uk'}]
# Same as... | """
Config file specific to uk to create automated survey
"""
class config:
# To modify, just add the keys of the dictionary
header_to_modify = [{'class': 'S', 'name': 'sid', 'text': '421498'},
{'class': 'S', 'name': 'admin_email', 'text': 'olivier.philippe@soton.ac.uk'}]
# Same as... | Fix issue with headers about additional language in description rather than header | Fix issue with headers about additional language in description rather than header
| Python | bsd-3-clause | softwaresaved/international-survey |
bed671bdd7dc221e55b5f60c4f9daca3c338a737 | artists/views.py | artists/views.py | from django.shortcuts import get_object_or_404
from rest_framework import permissions, viewsets
from similarities.utils import get_similar
from .models import Artist
from similarities.models import UserSimilarity
from .serializers import ArtistSerializer, SimilaritySerializer
class ArtistViewSet(viewsets.ModelViewSe... | from django.shortcuts import get_object_or_404
from rest_framework import permissions, viewsets
from similarities.utils import get_similar
from .models import Artist
from similarities.models import UserSimilarity, Similarity, update_similarities
from .serializers import ArtistSerializer, SimilaritySerializer
class A... | Update cumulative similarities on save | Update cumulative similarities on save
| Python | bsd-3-clause | FreeMusicNinja/api.freemusic.ninja |
42560625d8f83a60320e111503521a9a17d8ae09 | mollie/api/objects/list.py | mollie/api/objects/list.py | from .base import Base
class List(Base):
def __init__(self, result, object_type):
Base.__init__(self, result)
self.object_type = object_type
def get_resource_name(self):
return self.object_type.__name__.lower() + 's'
def __iter__(self):
for item in self['_embedded'][self.... | from .base import Base
class List(Base):
def __init__(self, result, object_type):
Base.__init__(self, result)
self.object_type = object_type
def get_object_name(self):
return self.object_type.__name__.lower() + 's'
def __iter__(self):
for item in self['_embedded'][self.ge... | Rename method to be more logical | Rename method to be more logical
| Python | bsd-2-clause | mollie/mollie-api-python |
616d92fed79bbfe6ea70ed7e053622819d99088d | python/getmonotime.py | python/getmonotime.py | import getopt, sys
if __name__ == '__main__':
sippy_path = None
try:
opts, args = getopt.getopt(sys.argv[1:], 's:S:i:o:b')
except getopt.GetoptError:
usage()
for o, a in opts:
if o == '-S':
sippy_path = a.strip()
continue
if sippy_path != None:
... | import getopt, sys
if __name__ == '__main__':
sippy_path = None
try:
opts, args = getopt.getopt(sys.argv[1:], 'rS:')
except getopt.GetoptError:
usage()
out_realtime = False
for o, a in opts:
if o == '-S':
sippy_path = a.strip()
continue
if o... | Add an option to also output realtime along with monotime. | Add an option to also output realtime along with monotime.
| Python | bsd-2-clause | sippy/rtp_cluster,sippy/rtp_cluster |
ff45b8c21f99b20ed044e8b194bc84f21f4f15d7 | httpserver_with_post.py | httpserver_with_post.py | # Adapted from http://stackoverflow.com/questions/10017859/how-to-build-a-simple-http-post-server
# Thank you!
import sys
import BaseHTTPServer
import cgi
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_POST(self):
ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
... | # Adapted from http://stackoverflow.com/questions/10017859/how-to-build-a-simple-http-post-server
# Thank you!
import sys
import BaseHTTPServer
import cgi
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_POST(self):
ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
... | Print client-POSTed data, more verbose error handling | Print client-POSTed data, more verbose error handling
And less fiddling with the returned header. For the time being,
I don't care about correcting the bugs in that part of the code.
| Python | unlicense | aaaaalbert/repy-doodles |
5b54df50752b3f661ad43f2086734f90a8d1a11e | src/ggrc/migrations/versions/20150205020509_5254f4f31427_system_editable_object_state.py | src/ggrc/migrations/versions/20150205020509_5254f4f31427_system_editable_object_state.py |
"""System editable object state
Revision ID: 5254f4f31427
Revises: 512c71e4d93b
Create Date: 2015-02-05 02:05:09.351265
"""
# revision identifiers, used by Alembic.
revision = '5254f4f31427'
down_revision = '512c71e4d93b'
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from alembic import op
from ... |
"""System editable object state
Revision ID: 5254f4f31427
Revises: 512c71e4d93b
Create Date: 2015-02-05 02:05:09.351265
"""
# revision identifiers, used by Alembic.
revision = '5254f4f31427'
down_revision = '512c71e4d93b'
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from alembic import op
from ... | Fix db_downgrade for "System editable object state" | Fix db_downgrade for "System editable object state"
| Python | apache-2.0 | jmakov/ggrc-core,edofic/ggrc-core,uskudnik/ggrc-core,plamut/ggrc-core,vladan-m/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,VinnieJohns/ggrc-core,hasanalom/ggrc-core,uskudnik/ggrc-core,j0gurt/ggr... |
877a3470044c98d3a938633479d38df6df6d26bd | boltiot/urls.py | boltiot/urls.py | #Creating a key value store for all the urls
BASE_URL = 'http://cloud.boltiot.com/remote/'
url_list = {
'digitalWrite' : '{}/digitalWrite?pin={}&state={}&deviceName={}',
'digitalRead' : '{}/digitalRead?pin={}&deviceName={}',
'analogWrite' : '{}/analogWrite?pin=1&value={}&state={}&deviceName={}',
'analo... | #Creating a key value store for all the urls
BASE_URL = 'http://cloud.boltiot.com/remote/'
url_list = {
'digitalWrite' : '{}/digitalWrite?pin={}&state={}&deviceName={}',
'digitalRead' : '{}/digitalRead?pin={}&deviceName={}',
'analogWrite' : '{}/analogWrite?pin={}&value={}&deviceName={}',
'analogRead' :... | Remove the static pin fir analog read | Remove the static pin fir analog read
| Python | mit | Inventrom/bolt-api-python |
ab5d570b92aca2c598d12fcdb0b063782ad4c871 | templates/root/appfiles/urls.py | templates/root/appfiles/urls.py | """template URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | """template URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | Fix Import error as a result of answering No to include Login | Fix Import error as a result of answering No to include Login
| Python | mit | dfurtado/generator-djangospa,dfurtado/generator-djangospa,dfurtado/generator-djangospa |
115615a2a183684eed4f11e98a7da12190059fb1 | armstrong/core/arm_layout/utils.py | armstrong/core/arm_layout/utils.py | # Here for backwards compatibility (deprecated)
from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
from armstrong.utils.backends import GenericBackend
render_model = (GenericBackend("ARMSTRONG_RENDER_MODEL_BACKEND",
defaults="armstrong.core.arm_layout.backends.Ba... | import warnings
from armstrong.utils.backends import GenericBackend
render_model = (GenericBackend("ARMSTRONG_RENDER_MODEL_BACKEND",
defaults="armstrong.core.arm_layout.backends.BasicRenderModelBackend")
.get_backend())
# DEPRECATED: To be removed in ArmLayout 1.4. Here for backwards compatibility
from d... | Throw deprecation warnings for these imports, which will be removed in the next version. They've been deprecated for two years so we can make it happen. | Throw deprecation warnings for these imports, which will be removed in the next version. They've been deprecated for two years so we can make it happen.
| Python | apache-2.0 | armstrong/armstrong.core.arm_layout,armstrong/armstrong.core.arm_layout |
4753dffc6a1672dfa99a5a5da8f082d6554bbb8f | http_request_translator/templates/bash_template.py | http_request_translator/templates/bash_template.py | begin_code = """
#!/usr/bin/env bash
curl -s --request """
request_header = """ --header "{header} : {header_value}" """
code_search = " | egrep --color ' {search_string} |$' "
code_simple = "{method} {url} {headers} --include "
proxy_code = "-x {proxy}"
body_code = " --data '{body}' "
| begin_code = """
#!/usr/bin/env bash
curl"""
request_header = """ --header "{header} : {header_value}" """
code_search = " | egrep --color ' {search_string} |$'"
code_simple = " -s --request {method} {url} {headers} --include"
proxy_code = " -x {proxy}"
body_code = " --data '{body}'"
| Fix whitespace in bash script code template | Fix whitespace in bash script code template
Signed-off-by: Arun Sori <e3bf7af6e125f7de61de92cd66a64411bed42bee@gmail.com>
| Python | bsd-3-clause | owtf/http-request-translator,dhruvagarwal/http-request-translator |
f1760fe01ae82289d8de2bb9323271edb80d4c08 | f8a_jobs/graph_sync.py | f8a_jobs/graph_sync.py | """Functions to retrieve pending list and invoke Graph Sync."""
import f8a_jobs.defaults as configuration
import requests
import traceback
import logging
logger = logging.getLogger(__name__)
def _api_call(url, params={}):
url = "%s%s" % (configuration.DATA_IMPORTER_ENDPOINT, "/api/v1/pending")
try:
... | """Functions to retrieve pending list and invoke Graph Sync."""
import f8a_jobs.defaults as configuration
import requests
import traceback
import logging
logger = logging.getLogger(__name__)
def _api_call(url, params={}):
try:
logger.info("API Call for url: %s, params: %s" % (url, params))
r = ... | Use url from the parameters | Use url from the parameters
| Python | apache-2.0 | fabric8-analytics/fabric8-analytics-jobs,fabric8-analytics/fabric8-analytics-jobs |
d3af229c5c692fdb52c211cd8785bcb7c869090b | reobject/query.py | reobject/query.py | from reobject.utils import signed_attrgetter
class QuerySet(list):
def __init__(self, *args, **kwargs):
super(QuerySet, self).__init__(*args, **kwargs)
def count(self):
return len(self)
def delete(self):
for item in self:
item.delete()
def exists(self):
re... | from reobject.utils import signed_attrgetter
class QuerySet(list):
def __init__(self, *args, **kwargs):
super(QuerySet, self).__init__(*args, **kwargs)
def count(self):
return len(self)
def delete(self):
for item in self:
item.delete()
def exists(self):
re... | Allow QuerySet objects to be reversed | Allow QuerySet objects to be reversed
| Python | apache-2.0 | onyb/reobject,onyb/reobject |
06c5f27c04de9fa62f6ac4834e0a920349c27084 | rules/binutils.py | rules/binutils.py | import xyz
import os
import shutil
class Binutils(xyz.BuildProtocol):
pkg_name = 'binutils'
supported_targets = ['arm-none-eabi']
def check(self, builder):
if builder.target not in self.supported_targets:
raise xyz.UsageError("Invalid target ({}) for {}".format(builder.target, self.pkg... | import xyz
import os
import shutil
class Binutils(xyz.BuildProtocol):
pkg_name = 'binutils'
supported_targets = ['arm-none-eabi']
def check(self, builder):
if builder.target not in self.supported_targets:
raise xyz.UsageError("Invalid target ({}) for {}".format(builder.target, self.pkg... | Remove man pages post-install (for now) | Remove man pages post-install (for now)
| Python | mit | BreakawayConsulting/xyz |
9c0d88ba1681949c02f2cd136efc0de1c23d170d | simuvex/procedures/libc___so___6/fileno.py | simuvex/procedures/libc___so___6/fileno.py | import simuvex
from simuvex.s_type import SimTypeFd
import logging
l = logging.getLogger("simuvex.procedures.fileno")
######################################
# memset
######################################
class fileno(simuvex.SimProcedure):
#pylint:disable=arguments-differ
def run(self, f):
self.arg... | import simuvex
from simuvex.s_type import SimTypeFd, SimTypeTop
from . import io_file_data_for_arch
import logging
l = logging.getLogger("simuvex.procedures.fileno")
######################################
# fileno
######################################
class fileno(simuvex.SimProcedure):
#pylint:disable=argum... | Add logic for grabbing file descriptor from FILE struct | Add logic for grabbing file descriptor from FILE struct
| Python | bsd-2-clause | chubbymaggie/angr,angr/angr,schieb/angr,tyb0807/angr,axt/angr,f-prettyland/angr,axt/angr,iamahuman/angr,angr/angr,iamahuman/angr,axt/angr,iamahuman/angr,f-prettyland/angr,chubbymaggie/angr,schieb/angr,angr/angr,tyb0807/angr,tyb0807/angr,chubbymaggie/angr,f-prettyland/angr,angr/simuvex,schieb/angr |
6664d075b4037ae40a91267afaca5731aa73ed3c | bluebottle/utils/widgets.py | bluebottle/utils/widgets.py | from __future__ import unicode_literals
from urlparse import urlparse
from django.contrib.admin.widgets import AdminURLFieldWidget
from django.forms.widgets import CheckboxFieldRenderer, CheckboxSelectMultiple, CheckboxChoiceInput
from django.utils.html import format_html
class NiceCheckboxChoiceInput(CheckboxChoic... | from __future__ import unicode_literals
from urlparse import urlparse
from django.contrib.admin.widgets import AdminURLFieldWidget
from django.forms.widgets import CheckboxFieldRenderer, CheckboxSelectMultiple, CheckboxChoiceInput
from django.utils.html import format_html
class NiceCheckboxChoiceInput(CheckboxChoic... | Fix url fields when no value is set | Fix url fields when no value is set
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle |
bfe45a24800817e7445fa12e7cd859679e6452c3 | porchlightapi/views.py | porchlightapi/views.py | # -*- coding: utf-8 -*-
from django.shortcuts import render
# Create your views here.
import django_filters
from rest_framework import viewsets
from rest_framework import filters
from porchlightapi.models import Repository, ValueDataPoint
from porchlightapi.serializers import RepositorySerializer, ValueDataPointSer... | # -*- coding: utf-8 -*-
from django.shortcuts import render
# Create your views here.
from rest_framework import viewsets
from rest_framework import filters
from porchlightapi.models import Repository, ValueDataPoint
from porchlightapi.serializers import RepositorySerializer, ValueDataPointSerializer
class Reposito... | Use DRF's built-in search filter | Use DRF's built-in search filter
| Python | cc0-1.0 | cfpb/porchlight,cfpb/porchlight,cfpb/porchlight |
1ecbd06083ac65a9520bcf0f87c5f5f1b4a4e532 | helloworld.py | helloworld.py |
#This is my hello world program
str1='Hello'
str2='Tarun'
print str1 +' '+ str2
# this is my hello world program
print 'Hello World!'
#This is my Hello world program
str1='Hello'
str2='Akash'
print str1 + ' ' + str2 + '!'
#this is a comment
str1='Hello'
str2='Priyanka'
print str1+' '+str2 |
print "helloworld" | Add strings to print hello world | Add strings to print hello world
| Python | apache-2.0 | ctsit/J.O.B-Training-Repo-1 |
d1928f0b1c98093b977ae208613c2b7eeb9a3ce5 | carepoint/tests/models/cph/test_address.py | carepoint/tests/models/cph/test_address.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Dave Lasley <dave@laslabs.com>
# Copyright: 2015 LasLabs, Inc [https://laslabs.com]
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affe... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Dave Lasley <dave@laslabs.com>
# Copyright: 2015 LasLabs, Inc [https://laslabs.com]
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affe... | Add instance assertion to table | Add instance assertion to table
| Python | mit | laslabs/Python-Carepoint |
8fc274021a8c0813f3fc3568d1d7984112952b9c | pytilemap/qtsupport.py | pytilemap/qtsupport.py |
import sys
import sip
import qtpy
__all__ = [
'getQVariantValue',
'wheelAngleDelta',
]
try:
if qtpy.PYQT5:
QVARIANT_API = 2
else:
QVARIANT_API = sip.getapi('QVariant')
except ValueError:
QVARIANT_API = 1
if QVARIANT_API == 1:
def getQVariantValue(variant):
return ... |
import sys
import sip
import qtpy
__all__ = [
'getQVariantValue',
'wheelAngleDelta',
]
try:
if qtpy.PYQT5:
QVARIANT_API = 2
else:
QVARIANT_API = sip.getapi('QVariant')
except ValueError:
QVARIANT_API = 1
if QVARIANT_API == 1:
def getQVariantValue(variant):
return ... | Use Cache location instead of temp folder | Use Cache location instead of temp folder
| Python | mit | allebacco/PyTileMap |
06b99c4415a6605cbd6123271d44af96585fbb9d | conda_env/exceptions.py | conda_env/exceptions.py | class CondaEnvException(Exception):
pass
class EnvironmentFileNotFound(CondaEnvException):
def __init__(self, filename, *args, **kwargs):
msg = '{} file not found'.format(filename)
self.filename = filename
super(EnvironmentFileNotFound, self).__init__(msg, *args, **kwargs)
| class CondaEnvException(Exception):
pass
class EnvironmentFileNotFound(CondaEnvException):
def __init__(self, filename, *args, **kwargs):
msg = '{} file not found'.format(filename)
self.filename = filename
super(EnvironmentFileNotFound, self).__init__(msg, *args, **kwargs)
class Envi... | Add environment not found exception | Add environment not found exception
| Python | bsd-3-clause | nicoddemus/conda-env,mikecroucher/conda-env,dan-blanchard/conda-env,conda/conda-env,dan-blanchard/conda-env,phobson/conda-env,conda/conda-env,ESSS/conda-env,mikecroucher/conda-env,asmeurer/conda-env,nicoddemus/conda-env,ESSS/conda-env,phobson/conda-env,isaac-kit/conda-env,asmeurer/conda-env,isaac-kit/conda-env |
484f42b6fc1a8129a53480bc6e7913c5c7d58f46 | froide/foirequest/search_indexes.py | froide/foirequest/search_indexes.py | from haystack import indexes
from celery_haystack.indexes import CelerySearchIndex
from .models import FoiRequest
class FoiRequestIndex(CelerySearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
title = indexes.CharField(model_attr='title')
description = index... | from haystack import indexes
from celery_haystack.indexes import CelerySearchIndex
from .models import FoiRequest
class FoiRequestIndex(CelerySearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
title = indexes.CharField(model_attr='title')
description = index... | Index only FoiRequests marked is_foi | Index only FoiRequests marked is_foi | Python | mit | fin/froide,CodeforHawaii/froide,catcosmo/froide,okfse/froide,LilithWittmann/froide,stefanw/froide,catcosmo/froide,catcosmo/froide,okfse/froide,fin/froide,ryankanno/froide,stefanw/froide,CodeforHawaii/froide,okfse/froide,LilithWittmann/froide,CodeforHawaii/froide,ryankanno/froide,ryankanno/froide,stefanw/froide,LilithWi... |
50442966938b532cc759089692ffb52e94c6e89b | config_example.py | config_example.py | """Example config.py"""
webhook_urls = ["DISCORD WEBHOOK", "DISCORD WEBHOOK"] # Used to update webhooks on Discord
key_path = "/path/to/key/in/format/of/file.pem" # Private key to sign the file
file_path = "/path/to/folder" # Path to save the file to
lzss_path = "/path/to/lzss" # Path to lzss
production = None # Use p... | """Example config.py"""
webhook_urls = ["DISCORD WEBHOOK", "DISCORD WEBHOOK"] # Used to update webhooks on Discord
key_path = "/path/to/key/in/format/of/file.pem" # Private key to sign the file
file_path = "/path/to/folder" # Path to save the file to
lzss_path = "/path/to/lzss" # Path to lzss
production = None # ... | Fix PEP 8 coding violations | Fix PEP 8 coding violations
| Python | agpl-3.0 | RiiConnect24/File-Maker,RiiConnect24/File-Maker |
b085d519da9869be8c4bc4f56cb0e040a6b1525b | build/combine.py | build/combine.py | import os, sys, re
from simplejson import load as json
from simplejson import dumps as dump
from glob import glob
VERSION = 0.1
all = []
for p in glob("../plugins/*.json"):
fp = open(p, "r")
x = json(fp, "utf-8")
x['date'] = int(os.path.getmtime(p) * 1000)
fp.close()
all += x,
fp = open(... | import os, sys, re
try:
from simplejson import load as json
from simplejson import dumps as dump
except:
from json import load as json
from json import dumps as dump
from glob import glob
VERSION = 0.1
all = []
for p in glob("../plugins/*.json"):
fp = open(p, "r")
x = json(fp, "utf-8")
... | Use json standard module if simplejson is not present | Use json standard module if simplejson is not present | Python | mpl-2.0 | marianocarrazana/anticontainer,downthemall/anticontainer,downthemall/anticontainer,marianocarrazana/anticontainer,downthemall/anticontainer,marianocarrazana/anticontainer |
aaa7da2b43ab08758456c972cd2bd727082c835d | build/release.py | build/release.py | #!/usr/bin/env python
import os
import sys
import shutil
import subprocess
from zipfile import ZipFile
if len(sys.argv) != 2:
print 'Usage: release.py version-number'
sys.exit(1)
version = sys.argv[1]
work_dir = 'minified'
name = 'goo-' + version
# Root directory inside zip file
zip_root = name + '/'
prin... | #!/usr/bin/env python
import os
import sys
import shutil
import subprocess
from zipfile import ZipFile
def prepend(filename, to_prepend):
"""Prepends a string to a file
"""
with open(filename, 'r') as stream:
content = stream.read()
with open(filename, 'w') as stream:
stream.write(to_prepend)
stream.write... | Add version number and copyright to goo.js | Add version number and copyright to goo.js
This is useful to keep track of which engine version the tool uses, story #294
| Python | mit | GooTechnologies/goojs,GooTechnologies/goojs,GooTechnologies/goojs |
1c3f89110ede8998b63831c181c44e92709481b6 | demo/widgy.py | demo/widgy.py | from __future__ import absolute_import
from widgy.site import WidgySite
class DemoWidgySite(WidgySite):
def valid_parent_of(self, parent, child_class, obj=None):
if isinstance(parent, I18NLayout):
return True
else:
return super(DemoWidgySite, self).valid_parent_of(parent, ... | from __future__ import absolute_import
from widgy.site import ReviewedWidgySite
class DemoWidgySite(ReviewedWidgySite):
def valid_parent_of(self, parent, child_class, obj=None):
if isinstance(parent, I18NLayout):
return True
else:
return super(DemoWidgySite, self).valid_pa... | Enable the review queue on the demo site | Enable the review queue on the demo site
| Python | apache-2.0 | j00bar/django-widgy,j00bar/django-widgy,j00bar/django-widgy |
ea09470ebdd69af2fa1d7d07d7b04fe3ff857987 | raffle.py | raffle.py | """
St. George Game
raffle.py
Sage Berg
Created: 9 Dec 2014
"""
from random import randint
class Raffle(object):
"""
Raffle contains a list of action objects, one of which
will be chosen and shown to the player.
"""
def __init__(self):
self.options = dict() # Maps options to weights
... | """
St. George Game
raffle.py
Sage Berg
Created: 9 Dec 2014
"""
from random import randint
class Raffle(object):
"""
Raffle contains a list of action objects, one of which
will be chosen and shown to the player.
"""
def __init__(self):
self.options = dict() # Maps options to weights
... | Add length method to Raffle | Add length method to Raffle
| Python | apache-2.0 | SageBerg/St.GeorgeGame,SageBerg/St.GeorgeGame,SageBerg/St.GeorgeGame,SageBerg/St.GeorgeGame |
616e9727397853e8d8f8de5b2c040c99c91e4a50 | gen_settings.py | gen_settings.py | import os
settings = os.path.join(os.path.dirname(__file__),'lib','mapnik_settings.js')
# this goes into a mapnik_settings.js file beside the C++ _mapnik.node
settings_template = """
module.exports.paths = {
'fonts': %s,
'input_plugins': %s
};
"""
def write_mapnik_settings(fonts='undefined',input_plugins='un... | import os
settings = os.path.join(os.path.dirname(__file__),'lib','mapnik_settings.js')
# this goes into a mapnik_settings.js file beside the C++ _mapnik.node
settings_template = """
module.exports.paths = {
'fonts': %s,
'input_plugins': %s
};
"""
def write_mapnik_settings(fonts='undefined',input_plugins='un... | Revert "stop reading fonts/input plugins from environ as we now have a working mapnik-config.bat on windows" | Revert "stop reading fonts/input plugins from environ as we now have a working mapnik-config.bat on windows"
This reverts commit d87c71142ba7bcc0d99d84886f3534dea7617b0c.
| Python | bsd-3-clause | mapnik/node-mapnik,langateam/node-mapnik,mojodna/node-mapnik,CartoDB/node-mapnik,CartoDB/node-mapnik,MaxSem/node-mapnik,gravitystorm/node-mapnik,tomhughes/node-mapnik,mojodna/node-mapnik,tomhughes/node-mapnik,CartoDB/node-mapnik,Uli1/node-mapnik,mojodna/node-mapnik,stefanklug/node-mapnik,CartoDB/node-mapnik,langateam/n... |
bd3473a8514e6d323dd03174ce65ecf278fa3772 | groups/admin.py | groups/admin.py | from django.contrib import admin
from .models import Discussion, Group
class GroupAdmin(admin.ModelAdmin):
filter_horizontal = ('moderators', 'watchers', 'members_if_private')
class Meta:
model = Group
class DiscussionAdmin(admin.ModelAdmin):
filter_horizontal = ('subscribers', 'ignorers')
... | from django.contrib import admin
from .models import Discussion, Group
@admin.register(Group)
class GroupAdmin(admin.ModelAdmin):
filter_horizontal = ('moderators', 'watchers', 'members_if_private')
class Meta:
model = Group
@admin.register(Discussion)
class DiscussionAdmin(admin.ModelAdmin):
... | Use a decorator for slickness. | Use a decorator for slickness.
| Python | bsd-2-clause | incuna/incuna-groups,incuna/incuna-groups |
b9cf2145097f8d1c702183a09bf2d54f669e2218 | skimage/filter/__init__.py | skimage/filter/__init__.py | from .lpi_filter import inverse, wiener, LPIFilter2D
from .ctmf import median_filter
from ._canny import canny
from .edges import (sobel, hsobel, vsobel, scharr, hscharr, vscharr, prewitt,
hprewitt, vprewitt, roberts , roberts_positive_diagonal,
roberts_negative_diagonal)
from ._... | from .lpi_filter import inverse, wiener, LPIFilter2D
from .ctmf import median_filter
from ._canny import canny
from .edges import (sobel, hsobel, vsobel, scharr, hscharr, vscharr, prewitt,
hprewitt, vprewitt, roberts , roberts_positive_diagonal,
roberts_negative_diagonal)
from ._... | Add filter.rank to __all__ of filter package | Add filter.rank to __all__ of filter package
| Python | bsd-3-clause | michaelpacer/scikit-image,oew1v07/scikit-image,vighneshbirodkar/scikit-image,michaelpacer/scikit-image,chriscrosscutler/scikit-image,juliusbierk/scikit-image,chintak/scikit-image,GaZ3ll3/scikit-image,warmspringwinds/scikit-image,ajaybhat/scikit-image,robintw/scikit-image,keflavich/scikit-image,chintak/scikit-image,jwig... |
98a2b7e11eb3e0d5ddc89a4d40c3d10586e400ab | website/filters/__init__.py | website/filters/__init__.py | import hashlib
import urllib
# Adapted from https://github.com/zzzsochi/Flask-Gravatar/blob/master/flaskext/gravatar.py
def gravatar(user, use_ssl=False, d=None, r=None, size=None):
if use_ssl:
base_url = 'https://secure.gravatar.com/avatar/'
else:
base_url = 'http://www.gravatar.com/avatar/'
... | import hashlib
import urllib
# Adapted from https://github.com/zzzsochi/Flask-Gravatar/blob/master/flaskext/gravatar.py
def gravatar(user, use_ssl=False, d=None, r=None, size=None):
if use_ssl:
base_url = 'https://secure.gravatar.com/avatar/'
else:
base_url = 'http://www.gravatar.com/avatar/'
... | Fix ordering of query params | Fix ordering of query params
3rd time's a charm
| Python | apache-2.0 | mluke93/osf.io,binoculars/osf.io,leb2dg/osf.io,caseyrygt/osf.io,samanehsan/osf.io,cwisecarver/osf.io,petermalcolm/osf.io,kwierman/osf.io,emetsger/osf.io,mluo613/osf.io,wearpants/osf.io,samchrisinger/osf.io,amyshi188/osf.io,jnayak1/osf.io,TomHeatwole/osf.io,petermalcolm/osf.io,TomBaxter/osf.io,amyshi188/osf.io,TomHeatwo... |
774b64779b18ff0d8fba048ab4c4cae53662628a | ummeli/vlive/auth/middleware.py | ummeli/vlive/auth/middleware.py | from django.contrib.auth.middleware import RemoteUserMiddleware
class VodafoneLiveUserMiddleware(RemoteUserMiddleware):
header = 'HTTP_X_UP_CALLING_LINE_ID'
class VodafoneLiveInfo(object):
pass
class VodafoneLiveInfoMiddleware(object):
"""
Friendlier access to device / request info that Vodafone Liv... | from django.contrib.auth.middleware import RemoteUserMiddleware
class VodafoneLiveUserMiddleware(RemoteUserMiddleware):
header = 'HTTP_X_UP_CALLING_LINE_ID'
class VodafoneLiveInfo(object):
pass
class VodafoneLiveInfoMiddleware(object):
"""
Friendlier access to device / request info that Vodafone Liv... | Revert "printing META for troubleshooting" | Revert "printing META for troubleshooting"
This reverts commit 42d15d528da14866f2f0479da6462c17a02d8c84.
| Python | bsd-3-clause | praekelt/ummeli,praekelt/ummeli,praekelt/ummeli |
de1baa49fc34f8ecf4f7df4c723456348281df69 | splunk_handler/__init__.py | splunk_handler/__init__.py | import logging
import socket
import traceback
from threading import Thread
import requests
class SplunkHandler(logging.Handler):
"""
A logging handler to send events to a Splunk Enterprise instance
"""
def __init__(self, host, port, username, password, index):
logging.Handler.__init__(self... | import logging
import socket
import traceback
from threading import Thread
import requests
class SplunkHandler(logging.Handler):
"""
A logging handler to send events to a Splunk Enterprise instance
"""
def __init__(self, host, port, username, password, index):
logging.Handler.__init__(self... | Add code to silence requests logger in the handler | Add code to silence requests logger in the handler
| Python | mit | zach-taylor/splunk_handler,sullivanmatt/splunk_handler |
d9abb2f56720480169d394a2cadd3cb9a77ac4f6 | app/main/views/frameworks.py | app/main/views/frameworks.py | from flask import jsonify
from sqlalchemy.types import String
from sqlalchemy import func
import datetime
from .. import main
from ...models import db, Framework, DraftService, Service, User, Supplier, SelectionAnswers, AuditEvent
@main.route('/frameworks', methods=['GET'])
def list_frameworks():
frameworks = Fr... | from flask import jsonify
from sqlalchemy.types import String
from sqlalchemy import func
import datetime
from .. import main
from ...models import db, Framework, DraftService, Service, User, Supplier, SelectionAnswers, AuditEvent
@main.route('/frameworks', methods=['GET'])
def list_frameworks():
frameworks = Fr... | Use one query with group_by for service status | Use one query with group_by for service status
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api |
a0903bb9fd988662269e9f2ef7e38acd877a63d5 | src/nodeconductor_saltstack/saltstack/handlers.py | src/nodeconductor_saltstack/saltstack/handlers.py | from __future__ import unicode_literals
import logging
from .log import event_logger
logger = logging.getLogger(__name__)
def log_saltstack_property_created(sender, instance, created=False, **kwargs):
if created:
event_logger.saltstack_property.info(
'%s {property_name} has been created.' %... | from __future__ import unicode_literals
import logging
from .log import event_logger
logger = logging.getLogger(__name__)
def log_saltstack_property_created(sender, instance, created=False, **kwargs):
if created:
event_logger.saltstack_property.info(
'%s {property_name} has been created in ... | Add more details to event logs for property CRUD | Add more details to event logs for property CRUD
| Python | mit | opennode/nodeconductor-saltstack |
18318b3bb431c8a5ec9261d6dd190997613cf1ed | src/pytest_django_casperjs/tests/test_fixtures.py | src/pytest_django_casperjs/tests/test_fixtures.py | from __future__ import with_statement
import django
import pytest
from django.conf import settings as real_settings
from django.utils.encoding import force_text
from django.test.client import Client, RequestFactory
from .app.models import Item
from pytest_django_casperjs.compat import urlopen
django # Avoid pyfl... | from __future__ import with_statement
import django
import pytest
from django.conf import settings as real_settings
from django.utils.encoding import force_text
from django.test.client import Client, RequestFactory
from .app.models import Item
from pytest_django_casperjs.compat import urlopen
django # Avoid pyfl... | Remove more irrelevant tests, those will be replaced with proper casperjs tests | Remove more irrelevant tests, those will be replaced with proper casperjs tests
| Python | bsd-3-clause | EnTeQuAk/pytest-django-casperjs |
8696885e9f1535bdfb8dbc0e285c67d1e6d41a95 | datasets/admin.py | datasets/admin.py | from django.contrib import admin
from datasets.models import Dataset, Sound, Annotation, Vote, Taxonomy, DatasetRelease, TaxonomyNode
admin.site.register(Dataset)
admin.site.register(Sound)
admin.site.register(Annotation)
admin.site.register(Vote)
admin.site.register(Taxonomy)
admin.site.register(DatasetRelease)
admin... | from django.contrib import admin
from datasets.models import Dataset, Sound, Annotation, Vote, Taxonomy, DatasetRelease, TaxonomyNode
class TaxonomyNodeAdmin(admin.ModelAdmin):
fields = ('node_id', 'name', 'description', 'citation_uri', 'faq')
admin.site.register(Dataset)
admin.site.register(Sound)
admin.site.r... | Add custom Admin model TaxonomyNode, hide freesound ex | Add custom Admin model TaxonomyNode, hide freesound ex
| Python | agpl-3.0 | MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets |
a14256e715d51728ad4c2bde7ec52f13def6b2a6 | director/views.py | director/views.py | from django.shortcuts import redirect
from django.urls import reverse
from django.views.generic import View
class HomeView(View):
def get(self, *args, **kwargs):
if self.request.user.is_authenticated:
return redirect(reverse('project_list'))
else:
return redirect(reverse('... | from django.shortcuts import redirect
from django.urls import reverse
from accounts.views import BetaTokenView
class HomeView(BetaTokenView):
"""
Home page view.
Care needs to be taken that this view returns a 200 response (not a redirect)
for unauthenticated users. This is because GCP load balancer... | Fix home view so it returns 200 for unauthenticated health check | Fix home view so it returns 200 for unauthenticated health check
| Python | apache-2.0 | stencila/hub,stencila/hub,stencila/hub,stencila/hub,stencila/hub |
bb88b1d2e2c4d3eb482c3cf32d1a53c9e89f94cf | conftest.py | conftest.py | # -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.db import connection
def pytest_report_header(config):
with connection.cursor() as cursor:
cursor.execute("SELECT VERSION()")
version = cursor.fetchone()[0]
return "MySQL version: {}".format(version)
| # -*- coding:utf-8 -*-
from __future__ import unicode_literals
import django
from django.db import connection
def pytest_report_header(config):
dot_version = '.'.join(str(x) for x in django.VERSION)
header = "Django version: " + dot_version
if hasattr(connection, '_nodb_connection'):
with connec... | Fix pytest version report when database does not exist, add Django version header | Fix pytest version report when database does not exist, add Django version header
| Python | mit | nickmeharry/django-mysql,arnau126/django-mysql,arnau126/django-mysql,nickmeharry/django-mysql,adamchainz/django-mysql |
aaf7cb7ecc1a74fb2b222fd21aea7116dac2ca98 | contribs.py | contribs.py |
# Get Contribution Count
import urllib
import datetime
import HTMLParser
class ContribParser(HTMLParser.HTMLParser):
today = datetime.date.today().isoformat()
def handle_starttag(self, tag, attrs):
if tag == 'rect' and self.is_today(attrs):
self.count = self.get_count(attrs)
de... |
# Get Contribution Count
import urllib
import datetime
import HTMLParser
class ContribParser(HTMLParser.HTMLParser):
def __init__(self):
self.today = datetime.date.today().isoformat()
HTMLParser.HTMLParser.__init__(self)
def handle_starttag(self, tag, attrs):
if tag == 'rect' an... | Fix date issue (I think) | Fix date issue (I think)
| Python | mit | chrisfosterelli/commitwatch |
22be6bb3593f948893ab3f797d34e20e66fff841 | example.py | example.py | import discord
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
if message.content.startswith('!test'):
counter = 0
tmp = aw... | import discord
import asyncio
import os
#Set up Client State
CLIENT_TOKEN=os.environ['TOKEN']
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
if message.... | Use env value for client token | Use env value for client token
| Python | mit | gryffon/SusumuTakuan,gryffon/SusumuTakuan |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.