commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
8c48a0d301573f4f11b1119488136a9090d15141 | fix mod name | mamaddeveloper/teleadmin,mamaddeveloper/telegrambot,mamaddeveloper/teleadmin,mamaddeveloper/telegrambot | modules/mod_bad.py | modules/mod_bad.py | from modules.module_base import ModuleBase
from tools import bad
class ModuleBaguette(ModuleBase):
NUMBER_REPORT_MESSAGES = 5 + 1
def __init__(self, bot):
ModuleBase.__init__(self, bot)
self.name = "ModuleBadWords"
self.bad = bad.Bad("modules/resources/bad.txt")
def notify_text(se... | from modules.module_base import ModuleBase
from tools import bad
class ModuleBaguette(ModuleBase):
NUMBER_REPORT_MESSAGES = 5 + 1
def __init__(self, bot):
ModuleBase.__init__(self, bot)
self.name = "ModuleBaguette"
self.bad = bad.Bad("modules/resources/bad.txt")
def notify_text(se... | mit | Python |
d66b0eec56ae5285bfac5fae9f40a1230cb481ae | Allow for re-installing the hook and set the executable bit | EliRibble/mothermayi | mothermayi/hook.py | mothermayi/hook.py | import logging
import os
import stat
LOGGER = logging.getLogger(__name__)
class NoRepoFoundError(Exception):
pass
class PreCommitExists(Exception):
pass
def find_git_repo():
location = os.path.abspath('.')
while location != '/':
check = os.path.join(location, '.git')
if os.path.exist... | import logging
import os
LOGGER = logging.getLogger(__name__)
class NoRepoFoundError(Exception):
pass
class PreCommitExists(Exception):
pass
def find_git_repo():
location = os.path.abspath('.')
while location != '/':
check = os.path.join(location, '.git')
if os.path.exists(check) and... | mit | Python |
34960bee4b2f8aa42061a9a12eb2c31aac50967d | Add talk type to admin panel | CarlFK/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CTPUG/wafer | wafer/talks/admin.py | wafer/talks/admin.py | from django.contrib import admin
from wafer.talks.models import TalkType, Talk, TalkUrl
class TalkUrlInline(admin.TabularInline):
model = TalkUrl
class TalkAdmin(admin.ModelAdmin):
list_display = ('title', 'get_author_name', 'get_author_contact',
'talk_type', 'get_in_schedule', 'status')... | from django.contrib import admin
from wafer.talks.models import TalkType, Talk, TalkUrl
class TalkUrlInline(admin.TabularInline):
model = TalkUrl
class TalkAdmin(admin.ModelAdmin):
list_display = ('title', 'get_author_name', 'get_author_contact',
'get_in_schedule', 'status')
list_edi... | isc | Python |
321d0a9fa77fd54f7f8ea237117ab387e6a874aa | Check against user, not profile, in the edit profile case | CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CarlFK/wafer,CTPUG/wafer | wafer/users/views.py | wafer/users/views.py | from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.views.generic import DetailView, UpdateView
from django.views.generic.list import ListView
from wafer.users.forms import UserForm, UserProfileForm
from wafer.users.mo... | from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.views.generic import DetailView, UpdateView
from django.views.generic.list import ListView
from wafer.users.forms import UserForm, UserProfileForm
from wafer.users.mo... | isc | Python |
e14b3fad26dce8dad3ca97c06e624f1d6b0764f9 | Set default encoding to fix unicode errors | synw/django-mqueue,synw/django-mqueue,synw/django-mqueue | mqueue/__init__.py | mqueue/__init__.py | __version__ = '0.5.5'
default_app_config = 'mqueue.apps.MqueueConfig'
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
| __version__ = '0.5.5'
default_app_config = 'mqueue.apps.MqueueConfig'
| mit | Python |
0ba2716ec42c49c0102028f17f66d330ad5178e8 | Correct typo in docstring | NIEHS/muver | muver/reference.py | muver/reference.py | from wrappers import bowtie2, picard, samtools
def create_reference_indices(ref_fn):
'''
For a given reference FASTA file, generate several indices.
'''
bowtie2.build(ref_fn)
samtools.faidx_index(ref_fn)
picard.create_sequence_dictionary(ref_fn)
def read_chrom_sizes(reference_ass... | from wrappers import bowtie2, picard, samtools
def create_reference_indices(ref_fn):
'''
For a given refere FASTA file, generate several indices.
'''
bowtie2.build(ref_fn)
samtools.faidx_index(ref_fn)
picard.create_sequence_dictionary(ref_fn)
def read_chrom_sizes(reference_assemb... | mit | Python |
75f45a3619d908f5a6e7c0829ac6ee767401f488 | Fix param argument parsing. | wamonite/packermate | wamopacker/script.py | wamopacker/script.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import sys
import argparse
from .config import Config, ConfigException
from .command import Builder, BuilderException
from .process import ProcessException
from collections import OrderedDict
DEFAULT_CONFIG_FILE_NAM... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import sys
import argparse
from .config import Config, ConfigException
from .command import Builder, BuilderException
from .process import ProcessException
from collections import OrderedDict
COMMAND_LOOKUP = Ordere... | mit | Python |
6c16714d3739d98c8228d02f01c1db705c25ee6e | Resolve relative config file paths | rmed/wat-bridge | wat_bridge/static.py | wat_bridge/static.py | # -*- coding: utf-8 -*-
#
# wat-bridge
# https://github.com/rmed/wat-bridge
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Rafael Medina García <rafamedgar@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software")... | # -*- coding: utf-8 -*-
#
# wat-bridge
# https://github.com/rmed/wat-bridge
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Rafael Medina García <rafamedgar@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software")... | mit | Python |
50836f606c5bdb9aa4472d109f0dc40e2f0f8dc6 | Fix for renamed module util -> utils | wkentaro/fcn | examples/apc2016/download_dataset.py | examples/apc2016/download_dataset.py | #!/usr/bin/env python
import os.path as osp
import chainer
import fcn
def main():
dataset_dir = chainer.dataset.get_dataset_directory('apc2016')
path = osp.join(dataset_dir, 'APC2016rbo.tgz')
fcn.data.cached_download(
url='https://drive.google.com/uc?id=0B9P1L--7Wd2vSV9oLTd1U2I3TDg',
p... | #!/usr/bin/env python
import os.path as osp
import chainer
import fcn.data
import fcn.util
def main():
dataset_dir = chainer.dataset.get_dataset_directory('apc2016')
path = osp.join(dataset_dir, 'APC2016rbo.tgz')
fcn.data.cached_download(
url='https://drive.google.com/uc?id=0B9P1L--7Wd2vSV9oL... | mit | Python |
65b358f718d7d7c035850dced32afb55729d9102 | remove raw string formatting | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/darwin_pkgutil.py | salt/modules/darwin_pkgutil.py | # -*- coding: utf-8 -*-
'''
Installer support for OS X.
Installer is the native .pkg/.mpkg package manager for OS X.
'''
# Import Python libs
from __future__ import absolute_import
import os.path
# Import 3rd-party libs
from salt.ext.six.moves import urllib # pylint: disable=import-error
# Import salt libs
import ... | # -*- coding: utf-8 -*-
'''
Installer support for OS X.
Installer is the native .pkg/.mpkg package manager for OS X.
'''
# Import Python libs
from __future__ import absolute_import
import os.path
# Import 3rd-party libs
from salt.ext.six.moves import urllib # pylint: disable=import-error
# Don't shadow built-in's.... | apache-2.0 | Python |
d2085c0158c4885f60da53e605eb74bfc26cacf3 | add TTi example | SiLab-Bonn/basil,SiLab-Bonn/basil,MarcoVogt/basil | examples/lab_devices/scpi_devices.py | examples/lab_devices/scpi_devices.py | #
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
''' Example how to use different laboratory devices (Sourcemeter, pulsers, etc.) that understand SCPI.
... | #
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
''' Example how to use different laboratory devices (Sourcemeter, pulsers, etc.) that understand SCPI.
... | bsd-3-clause | Python |
ee2f6189de63b40758a4e8029499b0b212cc0504 | Fix send_message to support passing generic data. | bogdal/django-gcm,johnofkorea/django-gcm,bogdal/django-gcm,johnofkorea/django-gcm | gcm/models.py | gcm/models.py | from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.utils.translation import ugettext_lazy as _
from . import conf
from .api import send_gcm_message
from .utils import load_object
def get_device_model():
return load_object(conf.GCM_DEVICE_MODEL)
def get_api_key():
... | from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.utils.translation import ugettext_lazy as _
from . import conf
from .api import send_gcm_message
from .utils import load_object
def get_device_model():
return load_object(conf.GCM_DEVICE_MODEL)
def get_api_key():
... | bsd-2-clause | Python |
96412405bd3235e1b506afcffb89ae44f857e205 | add select | 256481788jianghao/share_test | select.py | select.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 6 09:28:17 2017
@author: Administrator
"""
import pandas as pd
import ToolModule as tm
#import datetime
import FilterDataModule as fd
def getData(code=None,startDate=None,endDate=None,ft=None):
data_list = []
code_list = []
turnover_rate_list = []
if co... | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 6 09:28:17 2017
@author: Administrator
"""
import pandas as pd
import ToolModule as tm
#import datetime
import FilterDataModule as fd
def getData(code=None,startDate=None,endDate=None,ft=None):
data_list = []
code_list = []
turnover_rate_list = []
if co... | apache-2.0 | Python |
cf55ca51881f4364774fde03fb5446f027cb0d74 | Fix clean path expansion to expand env vars | anishathalye/dotbot,anishathalye/dotbot | dotbot/plugins/clean.py | dotbot/plugins/clean.py | import os, dotbot
class Clean(dotbot.Plugin):
'''
Cleans broken symbolic links.
'''
_directive = 'clean'
def can_handle(self, directive):
return directive == self._directive
def handle(self, directive, data):
if directive != self._directive:
raise ValueError('Clea... | import os, dotbot
class Clean(dotbot.Plugin):
'''
Cleans broken symbolic links.
'''
_directive = 'clean'
def can_handle(self, directive):
return directive == self._directive
def handle(self, directive, data):
if directive != self._directive:
raise ValueError('Clea... | mit | Python |
b0f3efa5945cba4f4698461826c2cc3406a41d78 | Fix bug in rendering | numenta/htmresearch,ThomasMiconi/nupic.research,mrcslws/htmresearch,subutai/htmresearch,ywcui1990/nupic.research,chanceraine/nupic.research,neuroidss/nupic.research,mrcslws/htmresearch,marionleborgne/nupic.research,ywcui1990/nupic.research,mrcslws/htmresearch,marionleborgne/nupic.research,BoltzmannBrain/nupic.research,... | drive/drive/graphics.py | drive/drive/graphics.py | class Graphics(object):
def __init__(self, field, vehicle, scorer, model, size=(400, 600)):
import pygame
self.field = field
self.vehicle = vehicle
self.scorer = scorer
self.model = model
self.size = size
self.pygame = pygame
self.currentKey = None
self.currentLeftClick = None
... | class Graphics(object):
def __init__(self, field, vehicle, scorer, model, size=(400, 600)):
import pygame
self.field = field
self.vehicle = vehicle
self.scorer = scorer
self.model = model
self.size = size
self.pygame = pygame
self.currentKey = None
self.currentLeftClick = None
... | agpl-3.0 | Python |
76af0ca6cbccfe185edecf5a5145922ccb938fe0 | Update server.py | johntsams/CoD_NASA_bot | server.py | server.py | import socket # Import socket module
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Create a socket object
host = socket.gethostname() # Get local machine name ip addr
port = 12345 # Reserve a port for your service.
s.bind((host, port)) # Bind to the port
... | import socket # Import socket module
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Create a socket object
host = socket.gethostname() # Get local machine name ip addr
port = 12345 # Reserve a port for your service.
s.bind((host, port)) # Bind to the port
... | apache-2.0 | Python |
f554af7bd4198a2cc350813c3adb342767f6bf6b | Update generate script for Java/static analysis queries | FTSRG/ingraph,FTSRG/ingraph,FTSRG/ingraph,FTSRG/ingraph,FTSRG/ingraph | queries/static-analysis-java/generate.py | queries/static-analysis-java/generate.py | #!/usr/bin/env python3
import glob
import re
import sys
import xml.etree.ElementTree as ET
for xmlFileName in glob.glob("../../../jqa-java-plugin/src/main/resources/META-INF/jqassistant-rules/*.xml"):
tree = ET.parse(xmlFileName)
root = tree.getroot()
for child in root:
queryName = child.attrib['... | #!/usr/bin/env python3
import sys
import xml.etree.ElementTree as ET
import glob
for xmlFileName in glob.glob("../../../jqa-java-plugin/src/main/resources/META-INF/jqassistant-rules/*.xml"):
tree = ET.parse(xmlFileName)
root = tree.getroot()
for child in root:
queryName = child.attrib['id'].repla... | epl-1.0 | Python |
fb00f2f885f4c1b6a31996465abf97f4667486d4 | update dev version after 5.6.0 tag [skip ci] | desihub/fiberassign,desihub/fiberassign,desihub/fiberassign,desihub/fiberassign | py/fiberassign/_version.py | py/fiberassign/_version.py | __version__ = '5.6.0.dev3458'
| __version__ = '5.6.0'
| bsd-3-clause | Python |
4993355885855b4c8bc5c7f0201740bfef10cbaa | Improve get_quadrule. | BrianVermeire/PyFR,tjcorona/PyFR,tjcorona/PyFR,tjcorona/PyFR,iyer-arvind/PyFR,Aerojspark/PyFR | pyfr/quadrules/__init__.py | pyfr/quadrules/__init__.py | # -*- coding: utf-8 -*-
import re
from pyfr.quadrules.base import BaseQuadRule, BaseTabulatedQuadRule
from pyfr.quadrules.line import BaseLineQuadRule
from pyfr.quadrules.tri import BaseTriQuadRule
from pyfr.util import subclass_map
def get_quadrule(basecls, rule, npts):
# See if rule looks like the name of a s... | # -*- coding: utf-8 -*-
from pyfr.quadrules.base import BaseQuadRule
from pyfr.quadrules.line import BaseLineQuadRule
from pyfr.quadrules.tri import BaseTriQuadRule
from pyfr.util import subclass_map
def get_quadrule(basecls, name, npts):
rule_map = subclass_map(basecls, 'name')
return rule_map[name](np... | bsd-3-clause | Python |
c1e169e67636db93e930f1a45521c4133901824f | Update the Borland style (ticket #240) | aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygmen... | pygments/styles/borland.py | pygments/styles/borland.py | # -*- coding: utf-8 -*-
"""
pygments.styles.borland
~~~~~~~~~~~~~~~~~~~~~~~
Style similar to the style used in the Borland IDEs.
:copyright: 2006-2007 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Com... | # -*- coding: utf-8 -*-
"""
pygments.styles.borland
~~~~~~~~~~~~~~~~~~~~~~~
Style similar to the style used in the borland ides.
:copyright: 2006-2007 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Com... | bsd-2-clause | Python |
5c54020f81299adc85121d09d438986c1e1081b5 | add keppca to test_imports | christinahedges/PyKE,gully/PyKE | pyke/tests/test_imports.py | pyke/tests/test_imports.py | HAS_MDP = True
try:
import mdp
except:
HAS_MDP = False
def test_import():
from .. import kepio
from .. import kepmask
from .. import kepmsg
from .. import kepkey
from .. import kepplot
from .. import kepstat
from .. import kepfunc
from .. import keparray
from .. import keppr... | def test_import():
from .. import kepio
from .. import kepmask
from .. import kepmsg
from .. import kepkey
from .. import kepplot
from .. import kepstat
from .. import kepfunc
from .. import keparray
from .. import kepprf
from .. import kepfit
from .. import kepfold
from ... | mit | Python |
f850562a37564a085eba5c8e26fd34f67c4b1504 | Add newline to end of enrichment files. | asarnow/pubs-analysis | enrichment.py | enrichment.py | #!/usr/bin/env python2.7
from intensities import *
import os.path
def enrich(df, col, upper, lower):
upreg = df[
(df[col] > upper) &
np.isfinite(df[col])].index
downreg = df[
(df[col] < lower) &
np.isfinite(df[col])].index
return upreg, downreg
enrichdir = 'data/enrichmen... | #!/usr/bin/env python2.7
from intensities import *
import os.path
def enrich(df, col, upper, lower):
upreg = df[
(df[col] > upper) &
np.isfinite(df[col])].index
downreg = df[
(df[col] < lower) &
np.isfinite(df[col])].index
return upreg, downreg
enrichdir = 'data/enrichmen... | agpl-3.0 | Python |
f354e056dfdc729b047451d3355a715f55bee4b6 | remove obsolete code | cboling/xos,cboling/xos,cboling/xos,cboling/xos,cboling/xos | xos/api/utility/sshkeys.py | xos/api/utility/sshkeys.py | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
from rest_framework import generics
from rest_framework.views import APIView
from core.models import *
from django.forms import widgets
from djang... | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
from rest_framework import generics
from rest_framework.views import APIView
from core.models import *
from django.forms import widgets
from djang... | apache-2.0 | Python |
bae8ea62ff6e1bfe905d9c47b7d912cb6b7bd78a | add project metadata to init | davejmac/django-easypost | easypost/__init__.py | easypost/__init__.py | from __future__ import unicode_literals
__title__ = "django-easypost"
__summary__ = "A django wrapper for the python easypost library"
__uri__ = "https://github.com/davejmac/django-easypost"
__version__ = "0.0.1"
__author__ = "Dave McNamara"
__email__ = "david.mcnamara@outlook.com"
__license__ = "MIT"
__license__ ... | __version__ = '0.1.0'
| mit | Python |
84532337e4b45bb7752cce7790edf2737c204991 | Bump postrelease | mar10/fabulist | fabulist/__init__.py | fabulist/__init__.py | from .fabulist import Fabulist # noqa
__version__ = "1.2.1.dev0"
| from .fabulist import Fabulist # noqa
__version__ = "1.2.0"
| mit | Python |
0bc850af3561d237055180046df9c1b62582b58e | make error messages equal | backpacker69/pypeerassets,PeerAssets/pypeerassets | pypeerassets/peerassets.py | pypeerassets/peerassets.py |
'''contains main protocol logic like assembly of proof-of-timeline and parsing deck info'''
from . import paproto
def parse_deckspawn_metainfo(protobuf):
deck = paproto.DeckSpawn()
deck.ParseFromString(protobuf)
assert deck.version > 0, {"error": "Deck metainfo incomplete, version can't be 0."}
ass... |
'''contains main protocol logic like assembly of proof-of-timeline and parsing deck info'''
from . import paproto
def parse_deckspawn_metainfo(protobuf):
deck = paproto.DeckSpawn()
deck.ParseFromString(protobuf)
deck.DiscardUnknownFields() # discard fields not defined by protocol
assert deck.versio... | bsd-3-clause | Python |
080e2f0c00453f05b2c17f182afe8cae86b5be9c | Fix spacing around operator | ma8ma/yanico | yanico/command/__init__.py | yanico/command/__init__.py | """Command entry point."""
# Copyright 2015 Masayuki Yamamoto
#
# 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 a... | """Command entry point."""
# Copyright 2015 Masayuki Yamamoto
#
# 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 a... | apache-2.0 | Python |
cb0670cc5e733f989eca3a4a30e844dfbecedc52 | Add load function | ma8ma/yanico | yanico/session/__init__.py | yanico/session/__init__.py | # Copyright 2015-2016 Masayuki Yamamoto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | # Copyright 2015-2016 Masayuki Yamamoto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | apache-2.0 | Python |
96203f16a4211226a7df72af770cfbfdc159d47f | raise TypeError inside __new__ | ciappi/Yaranullin | yaranullin/weakcallback.py | yaranullin/weakcallback.py | # yaranullin/weakcallback.py
#
# Copyright (c) 2012 Marco Scopesi <marco.scopesi@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTW... | # yaranullin/weakcallback.py
#
# Copyright (c) 2012 Marco Scopesi <marco.scopesi@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTW... | isc | Python |
5467619e0a1e5c4963e640cb06ff96cc4c54a57b | Replace OneToOneField by FK for revision in message log | freevoid/yawf | yawf/message_log/models.py | yawf/message_log/models.py | import logging
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from yawf import serialize_utils as json
from yawf.utils import memoizible_property
logger = logging.getLogger(__name__)
class MessageLog(models.Model):
class... | import logging
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from yawf import serialize_utils as json
from yawf.utils import memoizible_property
logger = logging.getLogger(__name__)
class MessageLog(models.Model):
class... | mit | Python |
102accc393acb29ce707c55205e036705ddab238 | Add loop to generate instances automatically | michaelsouza/network,michaelsouza/network,michaelsouza/network | python/create_instances.py | python/create_instances.py | import pandas as pd
import numpy as np
problem = 'porto'
MAX_DIST = {50, 100, 250, 500}
ALPHA = {0.1, 0.2, 0.5, 0.7, 1.0}
RANK = {'btw_id', 'voc_id'}
for alpha in ALPHA:
for max_dist in MAX_DIST:
for rank in RANK:
if problem == 'porto':
fid_tab = 'table_porto_0_10.csv'
... | import pandas as pd
import numpy as np
problem = 'porto'
max_dist = 100
alpha = 0.5;
rank = 'btw_id'
if problem == 'porto':
fid_tab = 'table_porto_0_10.csv'
# load table of ranks
print('Reading table of ranks')
table = pd.read_csv(fid_tab)
table_gid = table['gid'].as_matrix()
table_dij = table['dij_km'].as_... | mit | Python |
da6935f820339ff304b09af53ae441eef21b14a8 | enhance doc for pywincffi.core | opalmer/pywincffi,opalmer/pywincffi,opalmer/pywincffi,opalmer/pywincffi | pywincffi/core/__init__.py | pywincffi/core/__init__.py | """
Core
====
The core package used internally by pywincffi. This package contains
wrappers for :class:`cffi.api.FFI`, a logger and some basic code used
by the unittests.
"""
| """
Core
====
The core package used internally by pywincffi.
"""
| mit | Python |
e0646346a3e2a374982088185c121c078f014b99 | change version | gdementen/numexpr-numba,gdementen/numexpr-numba | numexpr/version.py | numexpr/version.py | ###################################################################
# Numexpr - Fast numerical array expression evaluator for NumPy.
#
# License: MIT
# Author: See AUTHORS.txt
#
# See LICENSE.txt and LICENSES/*.txt for details about copyright and
# rights to use.
##########################################... | ###################################################################
# Numexpr - Fast numerical array expression evaluator for NumPy.
#
# License: MIT
# Author: See AUTHORS.txt
#
# See LICENSE.txt and LICENSES/*.txt for details about copyright and
# rights to use.
##########################################... | mit | Python |
4277eccd0022e59da975f5dc319f9fc37ea71322 | fix flake8 | EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi | emgcli/middleware.py | emgcli/middleware.py | import logging
from django.conf import settings
from django.middleware.common import BrokenLinkEmailsMiddleware
from django.utils.encoding import force_text
logger = logging.getLogger(__name__)
try:
from django_slack import slack_message
except ImportError:
logger.error("Cannot resolve 'django_slack.log.Sla... | import logging
logger = logging.getLogger(__name__)
try:
from django_slack import slack_message
except:
logger.error("Cannot resolve 'django_slack.log.SlackExceptionHandler':"
" No module named django_slack")
from django.conf import settings
from django.middleware.common import BrokenLinkEma... | apache-2.0 | Python |
2dfc7aaa184983001350cef2cfc56b7d344c1e8b | Increase version number | brianmckinneyrocks/django-social-auth,sk7/django-social-auth,brianmckinneyrocks/django-social-auth,omab/django-social-auth,caktus/django-social-auth,duoduo369/django-social-auth,beswarm/django-social-auth,dongguangming/django-social-auth,krvss/django-social-auth,lovehhf/django-social-auth,getsentry/django-social-auth,a... | social_auth/__init__.py | social_auth/__init__.py | """
Django-social-auth application, allows OpenId or OAuth user
registration/authentication just adding a few configurations.
"""
version = (0, 1, 3)
__version__ = '.'.join(map(str, version))
| """
Django-social-auth application, allows OpenId or OAuth user
registration/authentication just adding a few configurations.
"""
version = (0, 1, 2)
__version__ = '.'.join(map(str, version))
| bsd-3-clause | Python |
85454874fecd2fa5bd8ecf1375fbad864f6c5d1e | Update isBalanced.py | Souloist/Projects,Souloist/Projects,Souloist/Projects,Souloist/Projects,Souloist/Projects | solutions/isBalanced.py | solutions/isBalanced.py | def isBalanced(parenthesis):
# if the length of the string is odd, there cannot be pairs of parenthesis
if len(parenthesis)%2 == 1:
return False
# Python arrays can be used as stacks due to append() and pop()
stack = []
for symbol in parenthesis:
# Push to stack every opening parenthesis
if symbol in ... | def isBalanced(parenthesis):
# Python arrays can be used as stacks due to append() and pop()
stack = []
for symbol in parenthesis:
# Push to stack every opening parenthesis
if symbol in "({[":
stack.append(symbol)
else:
# If stack is empty, that means there is an extra closing parenthesis
if len(s... | mit | Python |
d388c52be32ea72f0d72e71d40a85af844e21c5d | Update run-time dependencies for PySparkling | h2oai/sparkling-water,h2oai/sparkling-water,h2oai/sparkling-water,h2oai/sparkling-water | py/setup.py | py/setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
# Get the versio... | #!/usr/bin/env python
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
# Get the versio... | apache-2.0 | Python |
3b53568532037bf4a36a1205be7e1ba77b9f48b1 | update dependency google-cloud-monitoring to >=0.31.1, <0.35 (#9904) | GoogleCloudPlatform/gcloud-python,GoogleCloudPlatform/gcloud-python,tswast/google-cloud-python,googleapis/google-cloud-python,googleapis/google-cloud-python,tswast/google-cloud-python,tswast/google-cloud-python | irm/setup.py | irm/setup.py | # -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | # -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 | Python |
be3a67b9c53be7f1abf1e212b8062e34e6d1a1d6 | add on_delete positional arg to related fields | pydanny/django-admin2,pydanny/django-admin2 | example/polls/models.py | example/polls/models.py | # -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals
import datetime
from django.db import models
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible... | # -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals
import datetime
from django.db import models
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible... | bsd-3-clause | Python |
4917a6e818fe71296ca4800df6492c9fdea08c82 | bump to 0.72.0 | dmpetrov/dataversioncontrol,efiop/dvc,efiop/dvc,dmpetrov/dataversioncontrol | dvc/version.py | dvc/version.py | # Used in setup.py, so don't pull any additional dependencies
#
# Based on:
# - https://github.com/python/mypy/blob/master/mypy/version.py
# - https://github.com/python/mypy/blob/master/mypy/git.py
import os
import subprocess
_BASE_VERSION = "0.72.0"
def _generate_version(base_version):
"""Generate a versio... | # Used in setup.py, so don't pull any additional dependencies
#
# Based on:
# - https://github.com/python/mypy/blob/master/mypy/version.py
# - https://github.com/python/mypy/blob/master/mypy/git.py
import os
import subprocess
_BASE_VERSION = "0.71.0"
def _generate_version(base_version):
"""Generate a versio... | apache-2.0 | Python |
57aa56555e3d018ba4f0f997d224cd81a8fb7be6 | Fix image compare issue | xcgspring/AXUI,xcgspring/AXUI,xcgspring/AXUI | AXUI/image/image_compare.py | AXUI/image/image_compare.py |
from itertools import izip
from PIL import Image
from AXUI.logger import LOGGER
def image_compare(image1, image2):
'''compare two images, return difference percentage
#code from http://rosettacode.org/wiki/Percentage_difference_between_images#Python
'''
i1 = Image.open(image1)
i2 = Image.open(im... |
from itertools import izip
from PIL import Image
from AXUI.logger import LOGGER
def image_compare(image1, image2):
'''compare two images, return difference percentage
#code from http://rosettacode.org/wiki/Percentage_difference_between_images#Python
'''
i1 = Image.open("image1.jpg")
i2 = Image.o... | apache-2.0 | Python |
3a032328f24debbebaaf47c0fc1c937cb8e1a50f | Handle the menus app conditionally in the SecureController as well. | mokshaproject/moksha,pombredanne/moksha,mokshaproject/moksha,mokshaproject/moksha,mokshaproject/moksha,pombredanne/moksha,pombredanne/moksha,pombredanne/moksha | moksha/controllers/secure.py | moksha/controllers/secure.py | # -*- coding: utf-8 -*-
# This file is part of Moksha.
# Copyright (C) 2008-2010 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | # -*- coding: utf-8 -*-
# This file is part of Moksha.
# Copyright (C) 2008-2010 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | apache-2.0 | Python |
5ad5981ff324cd086d0ff27975ffb9c81524e5ff | set version to 0.16.0 for release | dannyroberts/eulxml,emory-libraries/eulxml | eulxml/__init__.py | eulxml/__init__.py | # file eulxml/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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-... | # file eulxml/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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-... | apache-2.0 | Python |
08d61a114a1416455b263826382bab6628db68d1 | add diff() | jwiggins/keyenst,jwiggins/keyenst | enstaller/history.py | enstaller/history.py | import re
import sys
import time
from os.path import isfile, join
from collections import defaultdict
import egginst
history_path = join(sys.prefix, 'enpkg.hist')
def init():
if isfile(history_path):
return
fo = open(history_path, 'w')
fo.write(time.strftime("==> %Y-%m-%d %H:%M:%S %Z <==\n"))
... | import re
import sys
import time
from os.path import isfile, join
from collections import defaultdict
import egginst
history_path = join(sys.prefix, 'enpkg.hist')
def init():
if isfile(history_path):
return
fo = open(history_path, 'w')
fo.write(time.strftime("==> %Y-%m-%d %H:%M:%S %Z <==\n"))
... | bsd-3-clause | Python |
3caab02c5e0ca0ebc57f57c77ed550b7e3fc55d2 | Add helper functions for loading data | JustinShenk/sensei | analyze.py | analyze.py | import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
from glob import glob
from datetime import datetime
def load_data(data_path):
'''Return dictionary `data` from string `data_path`
'''
os.path.join(data_path, '1.dat')
data = pickle.load(open(data_path, 'rb'))
return data
... | import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
def load_data(data_path):
'''Return dictionary `data` from string `data_path`
'''
os.path.join(data_path, '1.dat')
data = pickle.load(open(data_path, 'rb'))
return data
def get_baseline(data... | mit | Python |
8ea84935a9103c3079579b3d9b9db85e12710af2 | Refactor map read function. | d6e/emotion | emote/emote.py | emote/emote.py | """ A simple CLI tool for quickly copying common emoticon/emoji to your
clipboard. """
import pyperclip
import argparse
import json
import sys
import os
def read_emote_mappings(json_obj_files=[]):
""" Reads the contents of a list of files of json objects and combines
them into one large json object. """
su... | """ A simple CLI tool for quickly copying common emoticon/emoji to your
clipboard. """
import pyperclip
import argparse
import json
import sys
import os
def read_emote_mappings(filename="mapping.json"):
emotes = {}
for fname in [filename, os.path.expanduser("~/.emotes.json")]:
with open(fname) as f:
... | mit | Python |
8daae094f24592d3603e3791388e0e53ad80ca42 | bump version | sphinx-doc/sphinx-intl | sphinx_intl/__init__.py | sphinx_intl/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.9.3'
| # -*- coding: utf-8 -*-
__version__ = '0.9.3dev'
| bsd-2-clause | Python |
7f31064d52bf25c484b7b0bda0384955c8ce171c | 更新 ELO model admin 選單,增加 metadata 以及 version 資訊 | yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo | commonrepo/elos/admin.py | commonrepo/elos/admin.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from .models import ELO, ELOType
class ELOAdmin(admin.ModelAdmin):
fieldsets = [
('ELO Info', {'fields': ['name', 'fullname', 'author', 'uuid']}),
('ELO Metadata', {'field... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from .models import ELO, ELOType
class ELOAdmin(admin.ModelAdmin):
fieldsets = [
('ELO Info', {'fields': ['name', 'fullname', 'author']}),
('ELO Type', {'fields': ['or... | apache-2.0 | Python |
6b1bc73c54e367b931ad666b957e7c9915023617 | Update version to 1.0.0 | andreleblanc-wf/furious,mattsanders-wf/furious,mattsanders-wf/furious,beaulyddon-wf/furious,beaulyddon-wf/furious,Workiva/furious,rosshendrickson-wf/furious,Workiva/furious,andreleblanc-wf/furious,rosshendrickson-wf/furious | furious/_pkg_meta.py | furious/_pkg_meta.py | version_info = (1, 0, 0)
version = '.'.join(map(str, version_info))
| version_info = (0, 9, 5)
version = '.'.join(map(str, version_info))
| apache-2.0 | Python |
fcf1fd16c0d204a4b886e3323ad006e0ad6ca9b3 | Bump tensorflow in /solutionbox/ml_workbench/tensorflow (#726) | googledatalab/pydatalab,googledatalab/pydatalab,googledatalab/pydatalab | solutionbox/ml_workbench/tensorflow/setup.py | solutionbox/ml_workbench/tensorflow/setup.py | # Copyright 2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | # Copyright 2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | apache-2.0 | Python |
8b3983b25b12fceeed120d408578d12a21fe72e0 | add suffixes | brentp/bwa-meth,brentp/bwa-meth,PeteHaitch/bwa-parclip,PeteHaitch/bwa-parclip,PeteHaitch/bwa-parclip,dariober/bwa-meth,brentp/bwa-meth,dariober/bwa-meth,dariober/bwa-meth | compare/src/fix-names.py | compare/src/fix-names.py | import itertools as it
import sys
fh1 = open(sys.argv[1])
fh2 = open(sys.argv[2])
out1 = open('sim_R1.fastq', 'w')
out2 = open('sim_R2.fastq', 'w')
it1 = it.izip(*[fh1] * 4)
it2 = it.izip(*[fh2] * 4)
for r1, r2 in it.izip(it1, it2):
rn1 = r1[0].split(":")
rn2 = r2[0].split(":")
n = "@%s__%s" % (":".jo... | import itertools as it
import sys
fh1 = open(sys.argv[1])
fh2 = open(sys.argv[2])
out1 = open('sim_R1.fastq', 'w')
out2 = open('sim_R2.fastq', 'w')
it1 = it.izip(*[fh1] * 4)
it2 = it.izip(*[fh2] * 4)
for r1, r2 in it.izip(it1, it2):
rn1 = r1[0].split(":")
rn2 = r2[0].split(":")
n = "@%s__%s" % (":".jo... | mit | Python |
4babc25f28a085627717936bf804e49009a3185a | Fix wsa namespace. | kmillet/crabpytest,OnroerendErfgoed/crabpy,kmillet/crabpytest | crabpy/wsa.py | crabpy/wsa.py | from suds.sudsobject import Object
from suds.sax.element import Element
import uuid
wsa = ('wsa', 'http://schemas.xmlsoap.org/ws/2004/08/addressing')
class Action(Object):
def __init__(self, action):
Object.__init__(self)
self.action = action
def xml(self):
action... | from suds.sudsobject import Object
from suds.sax.element import Element
import uuid
wsa = ('wsa', 'http://www.w3.org/2005/08/addressing')
class Action(Object):
def __init__(self, action):
Object.__init__(self)
self.action = action
def xml(self):
action = Element('... | mit | Python |
400d23fb7f9976862921643761fe140428ced5c5 | Refactor unit test for metric 'new contributors of issues' | OSSHealth/ghdata,OSSHealth/ghdata,OSSHealth/ghdata | augur/datasources/augur_db/test_augur_db.py | augur/datasources/augur_db/test_augur_db.py | import os
import pytest
import pandas as pd
@pytest.fixture(scope="module")
def augur_db():
import augur
augur_app = augur.Application()
return augur_app['augur_db']()
# def test_repoid(augur_db):
# assert ghtorrent.repoid('rails', 'rails') >= 1000
# def test_userid(augur_db):
# assert ghtorrent.... | import os
import pytest
import pandas as pd
@pytest.fixture(scope="module")
def augur_db():
import augur
augur_app = augur.Application()
return augur_app['augur_db']()
# def test_repoid(augur_db):
# assert ghtorrent.repoid('rails', 'rails') >= 1000
# def test_userid(augur_db):
# assert ghtorrent.... | mit | Python |
b72632daaa8f49ef1f4380eafaf3ab1faa337e94 | fix display for job show | Huawei/OpenStackClient_VBS | vbclient/v1/resource.py | vbclient/v1/resource.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 l... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 l... | apache-2.0 | Python |
38313210583c14c48cee501f3687a4914b4308ae | remove pyqt5 dependency | rr-/dotfiles,rr-/dotfiles,rr-/dotfiles | opt/panel/setup.py | opt/panel/setup.py | from setuptools import setup, find_packages
setup(
author='rr-',
author_email='rr-@sakuya.pl',
name='panel',
long_description='lemonbar on heavy steroids',
packages=find_packages(),
entry_points={'console_scripts': ['panel = panel.__main__:main']},
package_dir={'panel': 'panel'},
packa... | from setuptools import setup, find_packages
setup(
author='rr-',
author_email='rr-@sakuya.pl',
name='panel',
long_description='lemonbar on heavy steroids',
packages=find_packages(),
entry_points={'console_scripts': ['panel = panel.__main__:main']},
package_dir={'panel': 'panel'},
packa... | mit | Python |
f1d66a1d9cfb941bc2d742642fc6e1cc2f4cf5da | Update an example | thombashi/SimpleSQLite,thombashi/SimpleSQLite | sample/select_as_dataframe.py | sample/select_as_dataframe.py | #!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
from simplesqlite import SimpleSQLite
con = SimpleSQLite("sample.sqlite", "w", profile=True)
con.create_table_from_data_matrix(
table_name="sample_table",
attr_name_list=["a", "b", "c", "d", "e"],
data_matrix=[
[1, 1.... | #!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
from simplesqlite import SimpleSQLite
con = SimpleSQLite("sample.sqlite", "w", profile=True)
header_list = ["a", "b", "c", "d", "e"]
con.create_table_from_data_matrix(
table_name="sample_table",
attr_name_list=header_list,
da... | mit | Python |
974677301eeeb6ad6224da5d9f0de851809e24e9 | use new exceptions | bkonkle/update-ip | update_ip/services/nfsn.py | update_ip/services/nfsn.py | from update_ip.services.base import BaseDNSService, DNSServiceError
try:
from pynfsn import pynfsn
except ImportError:
raise ImportError("This service requires the pynfsn package. You can find it on pypi or github")
def split_domain(domain):
'''splits a complete domain into a pair of (subdomain, domain)'''... | from update_ip.services.base import BaseDNSService
try:
from pynfsn import pynfsn
except ImportError:
raise ImportError("This service requires the pynfsn package. You can find it on pypi or github")
def split_domain(domain):
'''splits a complete domain into a pair of (subdomain, domain)'''
s= domain.sp... | bsd-3-clause | Python |
48b7769e0ba59d7121b03973301be5416202a535 | use FLASK_HOST/PORT and DEBUG config when starting default app instance | jasinner/victims-web,victims/victims-web,jasinner/victims-web,victims/victims-web | victims/web/__init__.py | victims/web/__init__.py | # This file is part of victims-web.
#
# Copyright (C) 2013 The Victims Project
#
# 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 version 3 of the License, or
# (at your option) any... | # This file is part of victims-web.
#
# Copyright (C) 2013 The Victims Project
#
# 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 version 3 of the License, or
# (at your option) any... | agpl-3.0 | Python |
92706b2ab0c5e07116a45bd46868c47ff04736bf | edit main() | likit/BioUtils,likit/BioUtils | remove_seq_with_barcode.py | remove_seq_with_barcode.py | '''Remove sequences containing a barcode in input_barcode
input_barcode can be a barcode sequence or a file containing a list of
barcodes.
The script works with output sequences from split_seqs.py in Mothur.
'''
import sys
import os
def read_barcode(input_barcode, is_file=False):
barcodes = set()
if is_f... | '''Remove sequences containing a barcode in input_barcode
input_barcode can be a barcode sequence or a file containing a list of
barcodes.
The script assume input sequences in FASTA format with one line per sequence.
'''
import sys
import os
def read_barcode(input_barcode, is_file=False):
barcodes = set()
... | bsd-2-clause | Python |
70d7bc0683fb9f57b57a172dbd9eaf0a5006bae5 | Fix processing of function name in search expression | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | mythril/ether/ethcontract.py | mythril/ether/ethcontract.py | from mythril.disassembler.disassembly import Disassembly
from ethereum import utils
import persistent
import re
class ETHContract(persistent.Persistent):
def __init__(self, code, creation_code="", name="Unknown"):
self.creation_code = creation_code
self.name = name
# Workaround: We curr... | from mythril.disassembler.disassembly import Disassembly
from ethereum import utils
import persistent
import re
class ETHContract(persistent.Persistent):
def __init__(self, code, creation_code="", name="Unknown"):
self.creation_code = creation_code
self.name = name
# Workaround: We curr... | mit | Python |
6a54a824b4388d8377b828fb3e86d9e6e2f57803 | update mlp_training.py | romansavrulin/AutoRCCar,hamuchiwa/AutoRCCar,hamuchiwa/AutoRCCar | computer/mlp_training.py | computer/mlp_training.py | __author__ = 'zhengwang'
import cv2
import numpy as np
import glob
from sklearn.cross_validation import train_test_split
print 'Loading training data...'
e0 = cv2.getTickCount()
# load training data
image_array = np.zeros((1, 38400))
label_array = np.zeros((1, 4), 'float')
training_data = glob.glob('training_data/*.... | __author__ = 'zhengwang'
import cv2
import numpy as np
import glob
print 'Loading training data...'
e0 = cv2.getTickCount()
# load training data
image_array = np.zeros((1, 38400))
label_array = np.zeros((1, 4), 'float')
training_data = glob.glob('training_data/*.npz')
for single_npz in training_data:
with np.lo... | bsd-2-clause | Python |
e63868bd2c210194fb1ff946ff646d3482d20a0d | Update __init__.py | F5Networks/f5-common-python,F5Networks/f5-common-python | f5/__init__.py | f5/__init__.py | # Copyright 2016 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | # Copyright 2016 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | apache-2.0 | Python |
4374380d6bb321e55edf1086cd56c0394fa4eed2 | delete ScreenShotUI redundant code | NTUTVisualScript/Visual_Script,NTUTVisualScript/Visual_Script,NTUTVisualScript/Visual_Script,NTUTVisualScript/Visual_Script | src/GUI/ScreenshotUI.py | src/GUI/ScreenshotUI.py | from tkinter import *
import threading
import Controller.ScreenShotController as SSCtrl
from Controller.Mouse import Mouse
class ScreenshotUI(Canvas):
__single = None
def __init__(self, parent=None, *args, **kwargs):
Canvas.__init__(self, parent, *args, **kwargs, height=800, width=450, borderwidth=-... | from tkinter import *
import threading
import Controller.ScreenShotController as SSCtrl
class ScreenshotUI(Canvas):
__single = None
def __init__(self, parent=None, *args, **kwargs):
from Controller.Mouse import Mouse
Canvas.__init__(self, parent, *args, **kwargs, height=800, width=450, borde... | mit | Python |
70c99033a91904b247b24ca006f6e35a4f8c99aa | Fix typo + URL | kyl191/nginx-specs,kyl191/nginx-specs,kyl191/nginx-mainline,kyl191/nginx-mainline,kyl191/nginx-mainline | copr_build.py | copr_build.py | #!/usr/bin/env python3
import os
import sys
import requests
api_url = "https://copr.fedorainfracloud.org/api_2"
api_login = os.environ["copr_login"]
api_token = os.environ["copr_token"]
project_id = int(os.environ["copr_projectid"])
r = requests.get("%s/projects/%s/chroots" % (api_url, project_id))
if not r.ok:
pr... | #!/usr/bin/env python3
import os
import sys
import requests
api_url = "https://copr-fedorainfracloud-org-fc31565c3414.runscope.net/api_2"
api_login = os.environ["copr_login"]
api_token = os.environ["copr_token"]
project_id = int(os.environ["copr_projectid"])
r = requests.get("%s/projects/%s/chroots" % (api_url, projec... | mit | Python |
772d139ec9911b2690564255792f04e264def6a9 | Define reward_to_value. | colinmorris/openai-gym-sandbox | metropolis.py | metropolis.py | # Sampling better models using the Metropolis algorithms.
import gym
import logging
import math
import random
import sys
class OneActionAgent(object):
def __init__(self, action):
self.action = action
def act(self):
return self.action
class OneActionModel(object):
def __init__(self, env):... | import gym
import logging
import sys
class RandNonLearner:
LEARNER = RandNonLearner
def run_one_episode(env, model):
agent = model.new_agent()
last_observation = env.reset()
env.render()
done = False
total_reward = 0.0
while not done:
last_observation, reward, done, unused = env.... | mit | Python |
7e4a523d073e6b3ffcc2e1b5d9839b9776ac38b2 | Add post verb to the metrics handler | praekelt/go-metrics-api,praekelt/go-metrics-api | go_metrics/server.py | go_metrics/server.py | from urlparse import parse_qs as _parse_qs
from twisted.internet.defer import maybeDeferred
from confmodel import Config
from confmodel.fields import ConfigDict
from go_api.cyclone.handlers import ApiApplication, BaseHandler
from go_metrics.metrics.base import MetricsBackendError, BadMetricsQueryError
from go_metri... | from urlparse import parse_qs as _parse_qs
from twisted.internet.defer import maybeDeferred
from confmodel import Config
from confmodel.fields import ConfigDict
from go_api.cyclone.handlers import ApiApplication, BaseHandler
from go_metrics.metrics.base import MetricsBackendError, BadMetricsQueryError
from go_metri... | bsd-3-clause | Python |
47a80d937638db7034ff0630b7aa6b8cc6e364d5 | remove useless env | N402/NoahsArk,N402/NoahsArk | ark/app.py | ark/app.py | import os
from flask import Flask
from ark.utils._time import friendly_time, format_datetime
from ark.utils.filters import gender
from ark.master.views import master_app
from ark.account.views import account_app
from ark.goal.views import goal_app
from ark.oauth.views import oauth_app
from ark.dashboard.views import ... | import os
from flask import Flask
from ark.utils._time import friendly_time, format_datetime
from ark.utils.filters import gender
from ark.master.views import master_app
from ark.account.views import account_app
from ark.goal.views import goal_app
from ark.oauth.views import oauth_app
from ark.dashboard.views import ... | mit | Python |
336615c6bb74802cccf7b0c0be95d9c8360611db | Allow empty podspec.yaml. | grow/grow,grow/pygrow,denmojo/pygrow,denmojo/pygrow,grow/pygrow,grow/pygrow,denmojo/pygrow,grow/grow,denmojo/pygrow,grow/grow,grow/grow | grow/pods/podspec.py | grow/pods/podspec.py | # TODO(jeremydw): Implement.
from grow.pods import locales
class Podspec(object):
def __init__(self, yaml, pod):
yaml = yaml or {}
self.yaml = yaml
self.flags = yaml.get('flags', {})
self.pod = pod
self.grow_version = yaml.get('grow_version')
self.root_path = self.flags.get('root_path', '')... | # TODO(jeremydw): Implement.
from grow.pods import locales
class Podspec(object):
def __init__(self, yaml, pod):
self.yaml = yaml
self.flags = yaml.get('flags', {})
self.pod = pod
self.grow_version = yaml.get('grow_version')
self.root_path = self.flags.get('root_path', '').lstrip('/').rstrip('/... | mit | Python |
48bff7b66e351e1f6307b261d9429b2c3af06993 | Add logging handling of errors on process.call | eiginn/passpie,marcwebbie/passpie,scorphus/passpie,scorphus/passpie,marcwebbie/passpie,eiginn/passpie | passpie/process.py | passpie/process.py | import logging
import os
from subprocess import Popen, PIPE
DEVNULL = open(os.devnull, 'w')
class Proc(Popen):
def communicate(self, **kwargs):
if kwargs.get('input') and isinstance(kwargs['input'], basestring):
kwargs['input'] = kwargs['input'].encode('utf-8')
return super(Proc, se... | from subprocess import Popen, PIPE
from ._compat import *
class Proc(Popen):
def communicate(self, **kwargs):
if kwargs.get('input') and isinstance(kwargs['input'], basestring):
kwargs['input'] = kwargs['input'].encode('utf-8')
return super(Proc, self).communicate(**kwargs)
def ... | mit | Python |
56855d89e03dfae17acfc8134451a6770ab642a9 | switch to next/previous N image | afunTW/moth-graphcut | src/actions/keyboard.py | src/actions/keyboard.py | """
Defined callback functions of keyboard event
"""
import logging
import sys
sys.path.append('../')
from src.view.template import MothViewerTemplate
from src.support.profiling import func_profiling
LOGGER = logging.getLogger(__name__)
class MothKeyboardHandler(MothViewerTemplate):
def __init__(self):
s... | """
Defined callback functions of keyboard event
"""
import logging
import sys
sys.path.append('../')
from src.view.template import MothViewerTemplate
from src.support.profiling import func_profiling
LOGGER = logging.getLogger(__name__)
class MothKeyboardHandler(MothViewerTemplate):
def __init__(self):
s... | mit | Python |
ebe6a24f048092eb43361b96c62eb88a13f4d4e8 | fix bug | yanlookwatchsee/odoo_management_script | periodic_backup.py | periodic_backup.py | #!/usr/bin/python
def bypass(f):
def nf(*a, **ka):
return None
return nf
import syslog
import dpsync
c = dpsync.DpClient()
#@bypass
def msg(s):
syslog.syslog(s)
def fake(f):
def nf(*a, **ka):
msg('Fake invoke: %(command)s'%locals()['ka'])
return nf
import time
metadata = dict (
PATH = '/home/ubuntu/odo... | #!/usr/bin/python
def bypass(f):
def nf(*a, **ka):
return None
return nf
import syslog
import dpsync
c = dpsync.DpClient()
#@bypass
def msg(s):
syslog.syslog(s)
def fake(f):
def nf(*a, **ka):
msg('Fake invoke: %(command)s'%locals()['ka'])
return nf
import time
metadata = dict (
PATH = '/home/ubuntu/odo... | apache-2.0 | Python |
8f18ccf735fd74fe72004557c821feca55720638 | fix another empty input bug | PermutaTriangle/PermStruct | permstruct/main.py | permstruct/main.py | from __future__ import print_function
from permuta import Permutation
from permstruct import StructSettings, StructLogger, AvoiderInput, exhaustive
from permstruct.dag import taylor_dag, SubPatternType
def struct(patts, size=None, perm_bound=None, verify_bound=None, subpatts_len=None, subpatts_num=None, subpatts_type=... | from __future__ import print_function
from permuta import Permutation
from permstruct import StructSettings, StructLogger, AvoiderInput, exhaustive
from permstruct.dag import taylor_dag, SubPatternType
def struct(patts, size=None, perm_bound=None, verify_bound=None, subpatts_len=None, subpatts_num=None, subpatts_type=... | bsd-3-clause | Python |
e340d8f3c36a026fb3b3f13d8f47dc9dc1b325ef | Move some code from serve view to build_asset function | gears/django-gears,juliomenendez/django-gears,gears/django-gears,juliomenendez/django-gears,juliomenendez/django-gears,wiserthanever/django-gears,juliomenendez/django-gears,gears/django-gears,wiserthanever/django-gears,wiserthanever/django-gears,wiserthanever/django-gears | gears/views.py | gears/views.py | import mimetypes
import posixpath
import urllib
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.contrib.staticfiles.views import serve as staticfiles_serve
from django.http import HttpResponse
from .asset_attributes import AssetAttributes
from .assets import Asset,... | import mimetypes
import posixpath
import urllib
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.contrib.staticfiles.views import serve as staticfiles_serve
from django.http import HttpResponse
from .asset_attributes import AssetAttributes
from .assets import Asset,... | isc | Python |
123df240531e3d8170c9f357f0fd77d7029fecac | remove stray tracer print | jda/unifi-tools | gen-minrssi.py | gen-minrssi.py | #!/usr/bin/env python
from pymongo import MongoClient
import json
import sys
# print message and die
def msgDie(msg):
print msg
sys.exit(2)
if len(sys.argv) != 4:
msgDie("usage: unifi-minder.py config.json site-name minSNR")
# load config
cfgFile = sys.argv[1]
siteName = sys.argv[2]
minSNR = sys.argv[3]
with ope... | #!/usr/bin/env python
from pymongo import MongoClient
import json
import sys
# print message and die
def msgDie(msg):
print msg
sys.exit(2)
if len(sys.argv) != 4:
msgDie("usage: unifi-minder.py config.json site-name minSNR")
# load config
cfgFile = sys.argv[1]
siteName = sys.argv[2]
minSNR = sys.argv[3]
with ope... | mit | Python |
ee4344c4ff7b8979753c699d5907a322968018e7 | remove print | JustinAzoff/packer-brobuntu-12.04,JustinAzoff/packer-brobuntu-12.04 | get_fileset.py | get_fileset.py | #!/usr/bin/env python
import os
import sys
import json
import subprocess
def get_fileset(fs):
if not os.path.exists(fs["dir"]):
subprocess.check_call(["git", "clone", fs["repo"], fs["dir"]])
os.chdir(fs["dir"])
subprocess.check_call(["git", "pull"])
subprocess.check_call(["git", "annex", "merge... | #!/usr/bin/env python
import os
import sys
import json
import subprocess
def get_fileset(fs):
print fs
if not os.path.exists(fs["dir"]):
subprocess.check_call(["git", "clone", fs["repo"], fs["dir"]])
os.chdir(fs["dir"])
subprocess.check_call(["git", "pull"])
subprocess.check_call(["git", "a... | mit | Python |
1ff37bb7117c9ce92df8c1b279207fd0bcf1d998 | Fix [ci skip] | devzero-xyz/Andromeda,devzero-xyz/Andromeda | plugins/plugins.py | plugins/plugins.py | from threading import Thread
from utils import add_cmd
from time import sleep
import re
import utils
import os
import requests
plugin_sources = {
"https://github.com/devzero-xyz/Andromeda/tree/master/plugins": {}, # wil contain plugin names and raw url
"https://github.com/devzero-xyz/Andromeda-Plugins": {},
}
... | from threading import Thread
from utils import add_cmd
from time import sleep
import re
import utils
import os
import requests
plugin_sources = {
"https://github.com/devzero-xyz/Andromeda/tree/master/plugins": {}, # wil contain plugin names and raw url
"https://github.com/devzero-xyz/Andromeda-Plugins": {},
}
... | mit | Python |
1b7ca924ab2916e59af3d86bf5a4b1d46142ca09 | Use double quote for docstrings. | mishbahr/staticgen-fwdform,mishbahr/staticgen-fwdform,mishbahr/staticgen-fwdform | config/settings/local.py | config/settings/local.py | # -*- coding: utf-8 -*-
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... | # -*- coding: utf-8 -*-
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... | bsd-3-clause | Python |
64e4ac255c215bff17e56d31e1ffb5eaf97e3ef2 | Update Bisection_Method.py | CleverChuk/Numerical-Analysis,CleverChuk/Numerical-Analysis,CleverChuk/Numerical-Analysis | Python/Bisection_Method.py | Python/Bisection_Method.py | """
Bisection-Method
Formula:
Given two guesses: [a,b]
find the mid-point
c = (b+a)/2
evaluation f(a), f(b) and f(c)
if:
f(a) is +ve and f(b) is -ve and f(c) is +ve
then replace a = c
"""
from Nu_Meth import *
class Bisection_Method(N... | """
Bisection-Method
Formula:
Given two guesses: [a,b]
find the mid-point
c = (b+a)/2
evaluation f(a), f(b) and f(c)
if:
f(a) is +ve and f(b) is -ve and f(c) is +ve
then replace a = c
"""
from Nu_Meth import *
class Bisection_Method(N... | mit | Python |
841affdd62a82ff81ca28a914a06f31deea98808 | Update graph-valid-tree.py | jaredkoontz/leetcode,githubutilities/LeetCode,githubutilities/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,githubutilities/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/... | Python/graph-valid-tree.py | Python/graph-valid-tree.py | # Time: O(|V| + |E|)
# Space: O(|V| + |E|)
# BFS solution.
class Solution:
# @param {integer} n
# @param {integer[][]} edges
# @return {boolean}
def validTree(self, n, edges):
if len(edges) != n - 1:
return False
visited_from, neighbors = 0, 1
nodes = {} # A struc... | # Time: O(|V| + |E|)
# Space: O(|V|)
# BFS solution.
class Solution:
# @param {integer} n
# @param {integer[][]} edges
# @return {boolean}
def validTree(self, n, edges):
if len(edges) != n - 1:
return False
visited_from, neighbors = 0, 1
nodes = {} # A structure t... | mit | Python |
b030809230f7945121c5523d081cb3d15d2d6473 | fix doc test | papousek/spiderpig | spiderpig/func.py | spiderpig/func.py | LAMBDA = lambda: 0
def is_lambda(fun):
"""
Check whether the given function is a lambda function.
>>> def not_lambda_fun():
... return None
...
>>> lambda_fun = lambda: None
...
>>> print(
... is_lambda(not_lambda_fun),
... is_lambda... | LAMBDA = lambda: 0
def is_lambda(fun):
"""
Check whether the given function is a lambda function.
.. testsetup::
from spiderpig.func import is_lambda
.. testcode::
def not_lambda_fun(): ------------------------------------------------------------------------------------------------... | mit | Python |
37af9a5473620652f4243e57d555249bfa6a5eb0 | Use updated PlatformBase class | yanbe/platform-espressif8266 | platform.py | platform.py | # Copyright 2014-present Ivan Kravets <me@ikravets.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | # Copyright 2014-present Ivan Kravets <me@ikravets.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 | Python |
f4cff9a311524041008d1e7a8f4ef3e43c8329a9 | add docstrings and comments and remove redundant code | SanketDG/gitdl | gitdl/gitdl.py | gitdl/gitdl.py | import requests
import json
import os
import zipfile
API_TOKEN = os.environ.get('GITHUB_API_TOKEN')
params = {'API_TOKEN': API_TOKEN} # create a dict to be passed by the request
url = "https://api.github.com/search/repositories?q={}".format(input())
def urlretrieve(url, path):
"""Retrieves a zipfile and writes... | import requests
import json
import os
import zipfile
API_TOKEN = os.environ.get('GITHUB_API_TOKEN')
params = {'API_TOKEN': API_TOKEN}
url = "https://api.github.com/search/repositories?q={}".format(input())
def urlretrieve(url, path):
with open(path, 'wb') as f:
r = requests.get(url, stream=True)
... | mit | Python |
89d582746c7098ba5a52344749134c2a06c62ce5 | correct test output | Nimdraug/booklet | booklet.py | booklet.py | # booklet -p 0-99 -s 5
# -p Pages (default all)
# -s Sheets per "page group" (find correct term) (default auto = as many as is required to fit all pages)
def test_pagegroups():
assert pagegroups( 1 ) == 1
assert pagegroups( 2 ) == 1
assert pagegroups( 3 ) == 1
assert pagegroups( 4 ) == 1
assert pagegroups( 5 ) =... | # booklet -p 0-99 -s 5
# -p Pages (default all)
# -s Sheets per "page group" (find correct term) (default auto = as many as is required to fit all pages)
def test_pagegroups():
assert pagegroups( 1 ) == 1
assert pagegroups( 2 ) == 1
assert pagegroups( 3 ) == 1
assert pagegroups( 4 ) == 1
assert pagegroups( 5 ) =... | mit | Python |
8f268ba5186216d8e2c862117c2e6b32f2f3e949 | add template tag for displaying a case by id | dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare... | casexml/apps/case/templatetags/case_tags.py | casexml/apps/case/templatetags/case_tags.py | import types
from datetime import date, datetime
from django import template
from django.utils.html import escape
from casexml.apps.case.models import CommCareCase
from django.template.loader import render_to_string
register = template.Library()
@register.simple_tag
def render_case(case):
if isinstance(case, base... | import types
from datetime import date, datetime
from django import template
from django.utils.html import escape
from casexml.apps.case.models import CommCareCase
from django.template.loader import render_to_string
register = template.Library()
@register.simple_tag
def render_case(case):
if isinstance(case, base... | bsd-3-clause | Python |
ba21327d5e1573dc56448c53b67e16cfd4a5f18b | convert /pollingstations to a geojson endpoint | DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/api/pollingstations.py | polling_stations/api/pollingstations.py | from rest_framework.serializers import HyperlinkedModelSerializer
from rest_framework.viewsets import ReadOnlyModelViewSet
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from pollingstations.models import PollingStation
from .fields import PointField
class PollingStationDataSerializer(Hyperlinke... | from rest_framework.serializers import HyperlinkedModelSerializer
from rest_framework.viewsets import ReadOnlyModelViewSet
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from pollingstations.models import PollingStation
from .fields import PointField
class PollingStationDataSerializer(Hyperlinke... | bsd-3-clause | Python |
a95f2acb5639337c89aa35be6e4d0dbe09c8d8d6 | remove pollingstations detail endpoint | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/api/pollingstations.py | polling_stations/api/pollingstations.py | from rest_framework.mixins import ListModelMixin
from rest_framework.viewsets import GenericViewSet
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from pollingstations.models import PollingStation
class PollingStationSerializer(GeoFeatureModelSerializer):
class Meta:
model = Polling... | from rest_framework.serializers import HyperlinkedModelSerializer
from rest_framework.viewsets import ReadOnlyModelViewSet
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from pollingstations.models import PollingStation
class PollingStationSerializer(GeoFeatureModelSerializer):
class Meta:
... | bsd-3-clause | Python |
9f5f77b46b5b47674ab2c7a56fb0423ced6660f9 | Update master | akretion/ebaypyt | examples/api_test.py | examples/api_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
_
"""
import os, os.path
import sys
import uuid
# from datetime import date
from lxml import etree
from lxml import objectify
# ADAPT YOUR PATH HERE
sys.path.append('/home/dav/dvp/py/ebay/ebaypyt/lib')
from ebaypyt import EbayWebService
# ADAPT YOUR PATH HERE
sys.pa... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
import os, os.path
import sys
import uuid
# from datetime import date
from lxml import etree
from lxml import objectify
# ADAPT YOUR PATH HERE
sys.path.append('/home/dav/dvp/py/ebay/ebaypyt/lib')
from ebaypyt import EbayWebService
# ADAPT YOUR PATH HERE
sys.pat... | agpl-3.0 | Python |
53b03a619b91b2cc602cfe0c03b53dda51b95547 | Update API example | Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org | examples/api_example.py | examples/api_example.py | # -*- coding: utf-8 -*-
from requests_oauthlib import OAuth2Session
from oauthlib.oauth2 import BackendApplicationClient
import requests
import os
import json
# REMOVE THIS IN PRODUCTION! Allows testing locally.
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
# API URL (https for real instanssi site)
API_ADDR = "htt... | # -*- coding: utf-8 -*-
from requests_oauthlib import OAuth2Session
from oauthlib.oauth2 import BackendApplicationClient
import requests
import os
import json
# REMOVE THIS IN PRODUCTION! Allows testing locally.
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
# Test client ID and secret. Insert your own here.
CLIENT... | mit | Python |
82457741a352602f6ef946e387070c77eb50781c | Print a serving message in the example app | nickfrostatx/malt | examples/macallan.py | examples/macallan.py | # -*- coding: utf-8 -*-
from malt import Malt, Response, json
from wsgiref.simple_server import make_server
app = Malt()
@app.get('/')
def hello(request):
return Response(request.url + '\n')
@app.post('/users')
def hello(request):
return Response('Creating new user\n')
@app.get('/tasks')
def hello(reque... | # -*- coding: utf-8 -*-
from malt import Malt, Response, json
from wsgiref.simple_server import make_server
app = Malt()
@app.get('/')
def hello(request):
return Response(request.url + '\n')
@app.post('/users')
def hello(request):
return Response('Creating new user\n')
@app.get('/tasks')
def hello(reque... | mit | Python |
2c0c89b692e333a320f6fd3ea7d1a44ac9aa77f5 | Clean time field on invoive_payments call | hivelocity/python-ubersmith,hivelocity/python-ubersmith,jasonkeene/python-ubersmith,jasonkeene/python-ubersmith | ubersmith/calls/client.py | ubersmith/calls/client.py | """Client call classes.
These classes implement any response cleaning and validation needed. If a
call class isn't defined for a given method then one is created using
ubersmith.calls.BaseCall.
"""
from ubersmith.calls import BaseCall, GroupCall
from ubersmith.utils import prepend_base
__all__ = [
'GetCall',
... | """Client call classes.
These classes implement any response cleaning and validation needed. If a
call class isn't defined for a given method then one is created using
ubersmith.calls.BaseCall.
"""
from ubersmith.calls import BaseCall, GroupCall
from ubersmith.utils import prepend_base
__all__ = [
'GetCall',
... | mit | Python |
a091db3e5d51da339ab3853f9188495a23410598 | Reduce default resoution for example project | Contraz/demosys-py | examples/settings.py | examples/settings.py | import os
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
SCREENSHOT_PATH = None
OPENGL = {
"version": (3, 3),
}
WINDOW = {
"class": "demosys.context.pyqt.Window",
"size": (1280, 720),
"aspect_ratio": 16 / 9,
"fullscreen": False,
"resizable": False,
"title": "Examples",
"vsyn... | import os
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
SCREENSHOT_PATH = None
OPENGL = {
"version": (3, 3),
}
WINDOW = {
"class": "demosys.context.pyqt.Window",
"size": (1920, 1080),
"aspect_ratio": 16 / 9,
"fullscreen": False,
"resizable": False,
"title": "Examples",
"vsy... | isc | Python |
a3d65892ef572b115de919f62929e093dfb27400 | Make example use random color scheme | pyQode/pyqode.json,pyQode/pyqode.json | examples/json_editor.py | examples/json_editor.py | """
This is a very basic usage example of the JSONCodeEdit.
The interface is minimalist, it will open a test file. You can open other
documents by pressing Ctrl+O
"""
import logging
import os
import random
import sys
from pyqode.qt import QtWidgets
from pyqode.core import api, modes
from pyqode.json.widgets import JSO... | """
This is a very basic usage example of the JSONCodeEdit.
The interface is minimalist, it will open a test file. You can open other
documents by pressing Ctrl+O
"""
import logging
import os
import sys
from pyqode.qt import QtWidgets
from pyqode.json.widgets import JSONCodeEdit
class Window(QtWidgets.QMainWindow):
... | mit | Python |
c742737595680c8a3726a1bbfe6f49769330c915 | Tweak to AC3D API. | UASLab/ImageAnalysis | scripts/2e-gen-direct-ac3d.py | scripts/2e-gen-direct-ac3d.py | #!/usr/bin/python
import sys
sys.path.insert(0, "/usr/local/opencv-2.4.11/lib/python2.7/site-packages/")
import argparse
import commands
import cv2
import fnmatch
import numpy as np
import os.path
import random
import navpy
import simplekml
sys.path.append('../lib')
import AC3D
import Pose
import ProjectMgr
import ... | #!/usr/bin/python
import sys
sys.path.insert(0, "/usr/local/opencv-2.4.11/lib/python2.7/site-packages/")
import argparse
import commands
import cv2
import fnmatch
import numpy as np
import os.path
import random
import navpy
import simplekml
sys.path.append('../lib')
import AC3D
import Pose
import ProjectMgr
import ... | mit | Python |
aef3bcca18356adeaf56ff1b4859d3bf5fb70f5e | correct indentation | Mayo-QIN/grunt,Mayo-QIN/grunt,blezek/grunt,blezek/grunt,Mayo-QIN/grunt | docker/_kmeansseg.py | docker/_kmeansseg.py | #!/usr/bin/env python
from time import time
import numpy as np
from sklearn.cluster import KMeans
import argparse
import nibabel as nib
from sklearn.preprocessing import StandardScaler
np.random.seed(42)
def kmeansseg(imageA, imageB,n_clusters,output):
t0 = time()
try:
imageA_=nib.load(imageA)
imageAdata=imageA... | #!/usr/bin/env python
from time import time
import numpy as np
from sklearn.cluster import KMeans
import argparse
import nibabel as nib
from sklearn.preprocessing import StandardScaler
np.random.seed(42)
def kmeansseg(imageA, imageB,n_clusters,output):
t0 = time()
try:
imageA_=nib.load(imageA)
imageAdata=imageA... | mit | Python |
10508c660c800bb8c9f35c4284bb2b0f22f4df79 | Bump provision version | noironetworks/aci-containers,noironetworks/aci-containers | provision/setup.py | provision/setup.py | from setuptools import setup, find_packages
setup(
name='acc_provision',
version='1.7.0',
description='Tool to provision ACI for ACI Containers Controller',
author="Cisco Systems, Inc.",
author_email="apicapi@noironetworks.com",
url='http://github.com/noironetworks/aci-containers/',
license... | from setuptools import setup, find_packages
setup(
name='acc_provision',
version='1.0.6',
description='Tool to provision ACI for ACI Containers Controller',
author="Cisco Systems, Inc.",
author_email="apicapi@noironetworks.com",
url='http://github.com/noironetworks/aci-containers/',
license... | apache-2.0 | Python |
83dde045e9bbda41ab175580f44d9e29ca59461c | Remove whitespace | guyfawcus/ArchMap,guyfawcus/ArchMap,maelstrom59/ArchMap,maelstrom59/ArchMap,guyfawcus/ArchMap | archmap.py | archmap.py | #!/usr/bin/env python3
from urllib.request import urlopen
from geojson import Feature, Point, FeatureCollection, dumps
def get_users():
"""This funtion parses users from the ArchWiki and writes it to users.txt"""
# Open and decode the ArchWiki page containing the list of users.
wiki = urlopen("https://w... | #!/usr/bin/env python3
from urllib.request import urlopen
from geojson import Feature, Point, FeatureCollection, dumps
def get_users():
"""This funtion parses users from the ArchWiki and writes it to users.txt"""
# Open and decode the ArchWiki page containing the list of users.
wiki = urlopen("https://w... | unlicense | Python |
b9f1601d9d8df72f2cfa0edad67918bbd1e447a0 | fix outdated function name in build_search_index | rspeer/solvertools,rspeer/solvertools,rspeer/solvertools,rspeer/solvertools | scripts/build_search_index.py | scripts/build_search_index.py | from solvertools.normalize import slugify
from solvertools.util import data_path, corpus_path
from whoosh.fields import Schema, ID, TEXT, KEYWORD, NUMERIC
from whoosh.analysis import StemmingAnalyzer
from whoosh.index import create_in
from nltk.corpus import wordnet
import nltk
import os
get_synset = wordnet._synset_fr... | from solvertools.normalize import alpha_slug
from solvertools.util import data_path, corpus_path
from whoosh.fields import Schema, ID, TEXT, KEYWORD, NUMERIC
from whoosh.analysis import StemmingAnalyzer
from whoosh.index import create_in
from nltk.corpus import wordnet
import nltk
import os
get_synset = wordnet._synset... | mit | Python |
94437c36b20be573151f4fd3d9e5534bf9937607 | Use pathlib to read ext.conf | woutervanwijk/Mopidy-MusicBox-Webclient,pimusicbox/mopidy-musicbox-webclient,pimusicbox/mopidy-musicbox-webclient,pimusicbox/mopidy-musicbox-webclient,woutervanwijk/Mopidy-MusicBox-Webclient,woutervanwijk/Mopidy-MusicBox-Webclient | mopidy_musicbox_webclient/__init__.py | mopidy_musicbox_webclient/__init__.py | import pathlib
import pkg_resources
from mopidy import config, ext
__version__ = pkg_resources.get_distribution(
"Mopidy-MusicBox-Webclient"
).version
class Extension(ext.Extension):
dist_name = "Mopidy-MusicBox-Webclient"
ext_name = "musicbox_webclient"
version = __version__
def get_default_... | import os
import pkg_resources
from mopidy import config, ext
__version__ = pkg_resources.get_distribution(
"Mopidy-MusicBox-Webclient"
).version
class Extension(ext.Extension):
dist_name = "Mopidy-MusicBox-Webclient"
ext_name = "musicbox_webclient"
version = __version__
def get_default_confi... | apache-2.0 | Python |
ca70320758215b35ddb6a7358006964a2773a584 | Change to Response middleware so that it can intercept cached entries | saulshanabrook/django-url-tracker | url_tracker/middleware.py | url_tracker/middleware.py | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django import http
from url_tracker.models import OldURL
class URLChangePermanentRedirectMiddleware(object):
def __init__(self):
if 'url_tracker' not in settings.INSTALLED_APPS:
raise ImproperlyConfi... | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django import http
from url_tracker.models import OldURL
class URLChangePermanentRedirectMiddleware(object):
def __init__(self):
if 'url_tracker' not in settings.INSTALLED_APPS:
raise ImproperlyConfi... | bsd-3-clause | Python |
c02ff08c2d236f4f1aea8e064a697c72b92a490f | Change the default executor to btreewithuncle. | vmthunder/volt | volt/executor/__init__.py | volt/executor/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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
#
# htt... | # -*- coding: utf-8 -*-
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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
#
# htt... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.