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 |
|---|---|---|---|---|---|---|---|---|
d1a93e356cc410a46495e239f7646d9171c1961e | Update config.py | fadhiilrachman/line-py | linepy/config.py | linepy/config.py | # -*- coding: utf-8 -*-
from akad.ttypes import ApplicationType
import re
class Config(object):
LINE_HOST_DOMAIN = 'https://legy-jp.line.naver.jp'
LINE_OBS_DOMAIN = 'https://obs-sg.line-apps.com'
LINE_TIMELINE_API = 'https://legy-jp.line.naver.jp/mh/api'
LINE_TIMELINE_M... | # -*- coding: utf-8 -*-
from akad.ttypes import ApplicationType
import re
class Config(object):
LINE_HOST_DOMAIN = 'https://gd2.line.naver.jp'
LINE_OBS_DOMAIN = 'https://obs-sg.line-apps.com'
LINE_TIMELINE_API = 'https://gd2.line.naver.jp/mh/api'
LINE_TIMELINE_MH ... | bsd-3-clause | Python |
8b2efb3e77b2a034db29767439f1530eeebe93e1 | Add onload and DOM content-load time to loading benchmark. | timopulkkinen/BubbleFish,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk,jaruba/chromium.src,Just-D/chromium-1,Just-D/chromium-1,ChromiumWebApps/chromium,ltilve/chromium,Chilledheart/chromium,mohamed--abdel-maksoud/chromium.src,markYoungH/chromium.src,timopulkkinen/BubbleFish,jaruba/chromium.src,dushu1203/ch... | tools/perf/perf_tools/loading_benchmark.py | tools/perf/perf_tools/loading_benchmark.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
from telemetry import multi_page_benchmark
class LoadingBenchmark(multi_page_benchmark.MultiPageBenchmark):
@property
def result... | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
from telemetry import multi_page_benchmark
class LoadingBenchmark(multi_page_benchmark.MultiPageBenchmark):
@property
def result... | bsd-3-clause | Python |
0d81d4308ddd6255d2bc4ec83a00c458e24a3ae1 | format is not always best to use | geometalab/osmaxx,geometalab/drf-utm-zone-info,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/drf-utm-zone-info,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx | conversion_service/converters/gis_converter/extract/db_to_format/extract.py | conversion_service/converters/gis_converter/extract/db_to_format/extract.py | import subprocess
import os
from converters.converter_settings import OSMAXX_CONVERSION_SERVICE
FORMATS = {
'fgdb': {
'ogr_name': 'FileGDB',
'extension': '.gdb',
'extraction_options': [],
},
'gpkg': {
'ogr_name': 'GPKG',
'extension': '.gpkg',
'extraction_op... | import subprocess
import os
from converters.converter_settings import OSMAXX_CONVERSION_SERVICE
FORMATS = {
'fgdb': {
'ogr_name': 'FileGDB',
'extension': '.gdb',
'extraction_options': [],
},
'gpkg': {
'ogr_name': 'GPKG',
'extension': '.gpkg',
'extraction_op... | mit | Python |
8aa1bfeb8182b5c4d2cb07c090a93264d343b413 | Bump to version 0.42.4 | reubano/tabutils,reubano/tabutils,reubano/meza,reubano/tabutils,reubano/meza,reubano/meza | meza/__init__.py | meza/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza
~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.
DEF... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza
~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.
DEF... | mit | Python |
38cfbf4a98300d5489e4d03584a44e77610e483f | Bump version | l04m33/moses,l04m33/moses | moses/version.py | moses/version.py | __version__ = '0.10.0'
__all__ = ['__version__']
| __version__ = '0.9.0'
__all__ = ['__version__']
| mit | Python |
92c864bd43277ab4290b2d143eb7dc8708f6d878 | Add width parameter to figure and figsize utilities. | tonysyu/mpltools,matteoicardi/mpltools | mpltools/util.py | mpltools/util.py | import matplotlib.pyplot as plt
__all__ = ['figure', 'figsize']
def figure(aspect_ratio=1.3, scale=1, width=None, *args, **kwargs):
"""Return matplotlib figure window.
Parameters
----------
aspect_ratio : float
Aspect ratio, width / height, of figure.
scale : float
Scale default... | import matplotlib.pyplot as plt
__all__ = ['figure', 'figsize']
def figure(aspect_ratio=1.3, scale=1, *args, **kwargs):
"""Return matplotlib figure window.
Parameters
----------
aspect_ratio : float
Aspect ratio, width / height, of figure.
scale : float
Scale default size of the... | bsd-3-clause | Python |
10e3ff7c77e80f8680d44713332bfcf9745f7320 | fix typo in _compat | jmgc/myhdl-numeric,jmgc/myhdl-numeric,jmgc/myhdl-numeric | myhdl/_compat.py | myhdl/_compat.py | import sys
PY2 = sys.version_info[0] == 2
if not PY2:
string_types = (str, unicode)
integer_types = (int,)
long = int
import builtins
else:
string_types = (str,)
integer_types = (int, long)
long = long
import __builtin__ as builtins
| import sys
PY2 = sys.version_info[0] == 2
if not PY2:
string_types = (str, unicode)
integer_types = (int,)
long = int
import builtins
else:
str_types = (str,)
integer_types = (int, long)
long = long
import __builtin__ as builtins
| lgpl-2.1 | Python |
f604979e94fab59eb1b422d4e62ad62d3360c2ac | Use admin interface by default | on-server/on-server-api,on-server/on-server-api | onserver/urls.py | onserver/urls.py | # -*- coding: utf-8 -*-
"""onserver URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.ho... | # -*- coding: utf-8 -*-
"""onserver URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.ho... | mit | Python |
11843011c8cacc4295c944ff98054d32b12edf08 | Print out only ball data | vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah | ookoobah/core.py | ookoobah/core.py | class Grid(dict):
pass
class Block(object):
def act(self, ball):
raise NotImplemented
class Wall(Block):
def act(self, ball):
ball.direction = (
-ball.direction[0],
-ball.direction[1],
)
class Mirror(Block):
SLOPE_BACKWARD = 1
SLOPE_FORWARD = -1
... | class Grid(dict):
pass
class Block(object):
def act(self, ball):
raise NotImplemented
class Wall(Block):
def act(self, ball):
ball.direction = (
-ball.direction[0],
-ball.direction[1],
)
class Mirror(Block):
SLOPE_BACKWARD = 1
SLOPE_FORWARD = -1
... | mit | Python |
77c1d778856874b09b087b4d90fd9ac35163340c | include aliased internal_council_id in station object | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/api/pollingstations.py | polling_stations/api/pollingstations.py | from rest_framework.decorators import list_route
from rest_framework.mixins import ListModelMixin
from rest_framework.serializers import CharField
from rest_framework.viewsets import GenericViewSet
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from pollingstations.models import PollingStation
c... | from rest_framework.decorators import list_route
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(GeoFeatureModelSeri... | bsd-3-clause | Python |
97650cec66dc5779fac38d127b8c9449f1fc5eaf | Add a script for cleaning crawled price data. | eliangcs/pystock-crawler,hsd315/pystock-crawler | scripts/cleanup.py | scripts/cleanup.py | #!/usr/bin/env python
import argparse
import csv
def parse_args():
parser = argparse.ArgumentParser(description='Clean up the crawled CSV file.')
parser.add_argument('data_type', metavar='DATA_TYPE', type=unicode,
choices=('reports', 'prices'),
help="what's in t... | #!/usr/bin/env python
import argparse
import csv
def parse_args():
parser = argparse.ArgumentParser(description='Clean up the crawled CSV file.')
parser.add_argument('input_file', metavar='INPUT_FILE', type=unicode,
help='input CSV file')
parser.add_argument('-o', metavar='OUTPUT_F... | mit | Python |
1268477f607adee2da29f74a07c3420d64b47d92 | print calendars | ndd365/showup,ndd365/showup,ndd365/showup | scrapers/print_calendars.py | scrapers/print_calendars.py | from apiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
from oauth2client.service_account import ServiceAccountCredentials
import pprint
scopes = 'https://www.googleapis.com/auth/calendar'
credentials = ServiceAccountCredentials.from_json_keyfile_name(
'client_... | mit | Python | |
de844267e778df896bc536b98b123e27d9934feb | load key from env | piccolbo/rightload,piccolbo/rightload | feature_extraction.py | feature_extraction.py | from content_extraction import get_text
from basilica import Connection
from joblib import Memory
from nltk.data import load as nltk_load
from numpy import array
from os import environ
_sent_detector = nltk_load("tokenizers/punkt/english.pickle")
_memory = Memory(cachedir="feature-cache-basilica", verbose=1, bytes_l... | from content_extraction import get_text
from basilica import Connection
from joblib import Memory
from nltk.data import load as nltk_load
from numpy import array
_sent_detector = nltk_load("tokenizers/punkt/english.pickle")
_memory = Memory(cachedir="feature-cache-basilica", verbose=1, bytes_limit=10 ** 9)
_memory.r... | agpl-3.0 | Python |
0db58f77e2c14eadc66403f666b39d3402461a06 | Add utils module | fedora-infra/python-fedora | fedora/tg/__init__.py | fedora/tg/__init__.py | '''
Functions and classes to help build a Fedora Service.
'''
__all__ = ('client', 'json', 'tg1utils', 'tg2utils', 'widgets',
'identity', 'utils', 'visit')
| '''
Functions and classes to help build a Fedora Service.
'''
__all__ = ('client', 'json', 'tg1utils', 'tg2utils', 'widgets',
'identity', 'visit')
| lgpl-2.1 | Python |
ab58a28f9b56a90df0d623c4381ea4e0e55373ef | extend installation script to create an empty histogram in there is not already a histogram present. | benjiyo/computer_usage_statistics,benjiyo/computer_usage_statistics | installation.py | installation.py | # installation.py
# Replaces all occurences of "PATH_TO_REPOSITORY/" with the path to the current working folder.
import os
cwd = os.getcwd() # Current Working Directory
# Set up the paths
for filename in ["bash_script", "python_script.py", "print_to_terminal.py"]:
print filename
with open(filename, 'r') as... | # installation.py
# Replaces all occurences of "PATH_TO_REPOSITORY/" with the path to the current working folder.
import os
cwd = os.getcwd()
for filename in ["bash_script", "python_script.py", "print_to_terminal.py"]:
print filename
with open(filename, 'r') as myfile:
text = myfile.read()
print... | mit | Python |
e5c6b9ccd6969828c8d69c7655df71aed9cea2eb | Fix demo models. | novafloss/django-mail-factory,novafloss/django-mail-factory | demo/demo/demo_app/models.py | demo/demo/demo_app/models.py | from django.contrib.auth.models import User
from django.db import models
# Create your models here.
class Article(models.Model):
user = models.ForeignKey(User)
content = models.CharField('text', max_length=100)
| from django.contrib.auth.models import User
from django.db import models
# Create your models here.
class Article(models.Model):
user = models.ForeignKey(User)
content = models.CharField('text')
| bsd-3-clause | Python |
0241e253c68ca6862a3da26d29a649f65c27ae36 | Use compat for unicode import | Dallinger/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger | demos/chatroom/experiment.py | demos/chatroom/experiment.py | """Coordination chatroom game."""
import dallinger as dlgr
from dallinger.compat import unicode
from dallinger.config import get_config
config = get_config()
def extra_settings():
config.register('network', unicode)
config.register('n', int)
class CoordinationChatroom(dlgr.experiments.Experiment):
"""... | """Coordination chatroom game."""
import dallinger as dlgr
from dallinger.config import get_config
try:
unicode = unicode
except NameError: # Python 3
unicode = str
config = get_config()
def extra_settings():
config.register('network', unicode)
config.register('n', int)
class CoordinationChatroom... | mit | Python |
bfea2c419e01daffa79d8c267f09a464c88942bf | remove call to deprecated tostring method. | EichlerLab/pacbio_variant_caller,EichlerLab/pacbio_variant_caller,EichlerLab/pacbio_variant_caller,EichlerLab/pacbio_variant_caller,EichlerLab/pacbio_variant_caller | scripts/AnnotateGapBed.py | scripts/AnnotateGapBed.py | #!/usr/bin/env python
import sys
import argparse
from Bio import SeqIO
from Bio import Seq
from Bio import SeqRecord
if (len(sys.argv) < 3):
print "usage: AnnotateGapBed.py bedIn bedOut annotation.out"
sys.exit(0)
ap = argparse.ArgumentParser(description="Print gap sequences to fasta files.")
ap.add_argument... | #!/usr/bin/env python
import sys
import argparse
from Bio import SeqIO
from Bio import Seq
from Bio import SeqRecord
if (len(sys.argv) < 3):
print "usage: AnnotateGapBed.py bedIn bedOut annotation.out"
sys.exit(0)
ap = argparse.ArgumentParser(description="Print gap sequences to fasta files.")
ap.add_argument... | mit | Python |
8033b00ebbcb8e294f47ee558e76ee260ec18d2b | Remove libfreetype2, which should have been omitted and was breaking the scripts | servo/servo-org-stats,servo/servo-org-stats,servo/servo-org-stats | orglog-config.py | orglog-config.py | org = "servo"
ignore_repos = ["skia", "skia-snapshots", "cairo", "libpng", "libcss",
"libhubbub", "libparserutils", "libwapcaplet", "pixman",
"libfreetype2"]
count_forks = ["glutin","rust-openssl"]
# Path to where we'll dump the bare checkouts. Must end in /
clones_dir = "repos/"
# P... | org = "servo"
ignore_repos = ["skia", "skia-snapshots", "cairo", "libpng", "libcss",
"libhubbub", "libparserutils", "libwapcaplet", "pixman"]
count_forks = ["glutin","rust-openssl"]
# Path to where we'll dump the bare checkouts. Must end in /
clones_dir = "repos/"
# Path to the concatenated log
log_... | mit | Python |
8f29d63b782e7a4c9b53210b0518af0ee95beea8 | Fix thanks to Joel for spotting it | bliksemlabs/rrrr | web-uwsgi.py | web-uwsgi.py | import uwsgi
import zmq
import struct
COMMON_HEADERS = [('Content-Type', 'text/plain'), ('Access-Control-Allow-Origin', '*'), ('Access-Control-Allow-Headers', 'Requested-With,Content-Type')]
context = zmq.Context()
def light(environ, start_response):
if environ['PATH_INFO'] in ['/favicon.ico']:
start_res... | import uwsgi
import zmq
import struct
COMMON_HEADERS = [('Content-Type', 'text/plain'), ('Access-Control-Allow-Origin', '*'), ('Access-Control-Allow-Headers', 'Requested-With,Content-Type')]
context = zmq.Context()
def light(environ, start_response):
if environ['PATH_INFO'] in ['/favicon.ico']:
start_res... | bsd-2-clause | Python |
1dfff48a5ddb910b4abbcf8e477b3dda9d606a49 | Allow splitting by a particular component (by index) | bxlab/bx-python,bxlab/bx-python,bxlab/bx-python | scripts/maf_split_by_src.py | scripts/maf_split_by_src.py | #!/usr/bin/env python2.3
"""
Read a MAF from stdin and break into a set of mafs containing
no more than a certain number of columns
"""
usage = "usage: %prog"
import sys, string
import bx.align.maf
from optparse import OptionParser
import psyco_full
INF="inf"
def __main__():
# Parse command line arguments
... | #!/usr/bin/env python2.3
"""
Read a MAF from stdin and break into a set of mafs containing
no more than a certain number of columns
"""
usage = "usage: %prog"
import sys, string
import bx.align.maf
from optparse import OptionParser
import psyco_full
INF="inf"
def __main__():
# Parse command line arguments
... | mit | Python |
ead9192b4c2acb21df917dfe116785343e9a59a6 | Fix spec issue with Transfer::Server ProtocolDetails | cloudtools/troposphere,cloudtools/troposphere | scripts/patches/transfer.py | scripts/patches/transfer.py | patches = [
{
"op": "move",
"from": "/ResourceTypes/AWS::Transfer::Server/Properties/Protocols/ItemType",
"path": "/ResourceTypes/AWS::Transfer::Server/Properties/Protocols/PrimitiveItemType",
},
{
"op": "replace",
"path": "/ResourceTypes/AWS::Transfer::Server/Propert... | patches = [
{
"op": "move",
"from": "/ResourceTypes/AWS::Transfer::Server/Properties/Protocols/ItemType",
"path": "/ResourceTypes/AWS::Transfer::Server/Properties/Protocols/PrimitiveItemType",
},
{
"op": "replace",
"path": "/ResourceTypes/AWS::Transfer::Server/Propert... | bsd-2-clause | Python |
4fe19797ba2fb12239ae73da60bb3e726b23ffe9 | Fix bug in admin user editing | uppercounty/uppercounty,uppercounty/uppercounty,uppercounty/uppercounty | web/forms.py | web/forms.py | from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from .models import UniqueEmailUser
class UniqueEmailUserCreationForm(UserCreationForm):
"""
A form that creates a UniqueEmailUser.
"""
class Meta:
model = UniqueEmailUser
fields = ("email",)
class UniqueEmailUs... | from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from .models import UniqueEmailUser
class UniqueEmailUserCreationForm(UserCreationForm):
"""
A form that creates a UniqueEmailUser.
"""
def __init__(self, *args, **kargs):
super(UniqueEmailUserCreationForm, self).__init__... | mit | Python |
735c39128f42220bfd5fd6a5d4320530e561c08f | increase version | flux3dp/fluxghost,flux3dp/fluxghost,flux3dp/fluxghost,flux3dp/fluxghost | fluxghost/__init__.py | fluxghost/__init__.py |
__version__ = "0.5b7"
DEBUG = False
|
__version__ = "0.5b6"
DEBUG = False
| agpl-3.0 | Python |
1c14cc322e7b972f95e1b4ff181f934388bf0e41 | Fix debug output for SSLMiddleware X-Forwarded-Proto | openstack/murano,openstack/murano | murano/api/middleware/ssl.py | murano/api/middleware/ssl.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
# d... | # 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
# d... | apache-2.0 | Python |
5cfd242d7f67f920830f0b525cd058804f15467d | Add error CanNotDetermineEndPointIP | Fiware/ops.Fuel-main-dev,stackforge/fuel-main,eayunstack/fuel-main,ddepaoli3/fuel-main-dev,zhaochao/fuel-web,AnselZhangGit/fuel-main,SmartInfrastructures/fuel-web-dev,prmtl/fuel-web,SmartInfrastructures/fuel-main-dev,SergK/fuel-main,koder-ua/nailgun-fcert,nebril/fuel-web,huntxu/fuel-web,AnselZhangGit/fuel-main,prmtl/fu... | nailgun/nailgun/errors/__init__.py | nailgun/nailgun/errors/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... | # -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... | apache-2.0 | Python |
f1e015555f26b083238551e87f14b988b6a25083 | bump version 2.16.9 | saydulk/newfies-dialer,romonzaman/newfies-dialer,Star2Billing/newfies-dialer,Star2Billing/newfies-dialer,newfies-dialer/newfies-dialer,romonzaman/newfies-dialer,saydulk/newfies-dialer,newfies-dialer/newfies-dialer,saydulk/newfies-dialer,saydulk/newfies-dialer,newfies-dialer/newfies-dialer,Star2Billing/newfies-dialer,ro... | newfies/newfies_dialer/__init__.py | newfies/newfies_dialer/__init__.py | # -*- coding: utf-8 -*-
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2015 Star2Bi... | # -*- coding: utf-8 -*-
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2015 Star2Bi... | mpl-2.0 | Python |
871dd9e2b17bf45a30f04767555620f9dfd0f511 | Allow measurement channels to be specified for tomography | rmcgurrin/PyQLab,Plourde-Research-Lab/PyQLab,BBN-Q/PyQLab,calebjordan/PyQLab | QGL/Tomography.py | QGL/Tomography.py | '''
Helper functions for adding tomography routines.
Copyright 2013 Raytheon BBN Technologies
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 ... | '''
Helper functions for adding tomography routines.
Copyright 2013 Raytheon BBN Technologies
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 ... | apache-2.0 | Python |
ef537ff146661ce16775f6c2abe97a010af24bc7 | return response on send | conbus/fbmq,conbus/fbmq | fbmq/__init__.py | fbmq/__init__.py | __version__ = '2.0.1'
from .fbmq import *
from . import attachment as Attachment
from . import template as Template | __version__ = '2.0.0'
from .fbmq import *
from . import attachment as Attachment
from . import template as Template | mit | Python |
7b941ece0edd086f8bca21fd76ddcb882f7ae028 | Add missing import | scriptotek/otsrdflib | otsrdflib/ots.py | otsrdflib/ots.py | from rdflib.plugins.serializers.turtle import TurtleSerializer
from rdflib.namespace import Namespace, FOAF, SKOS, RDF
from rdflib import BNode
import re
class OrderedTurtleSerializer(TurtleSerializer):
short_name = "ots"
def __init__(self, store):
super(OrderedTurtleSerializer, self).__init__(store... | from rdflib.plugins.serializers.turtle import TurtleSerializer
from rdflib.namespace import Namespace, FOAF, SKOS, RDF
from rdflib import BNode
class OrderedTurtleSerializer(TurtleSerializer):
short_name = "ots"
def __init__(self, store):
super(OrderedTurtleSerializer, self).__init__(store)
... | mit | Python |
53972cb11ae4825b2ae7b59b2a31d2d89d253cb5 | Add test cases | derekmpham/interview-prep,derekmpham/interview-prep | fib-seq-recur.py | fib-seq-recur.py | # Implement fibonacci sequence function using recursion
def get_fib(position):
if position < 2: # base case
return position
else:
return get_fib(position-1) + get_fib(position-2) # add two previous numbers
# test cases
print get_fib(9) # returns 34
print get_fib(11) # returns 89
print get_fib(0) # returns 0
| # Implement fibonacci sequence function using recursion
def get_fib(position):
if position < 2: # base case
return position
else:
return get_fib(position-1) + get_fib(position-2) # add two previous numbers
| mit | Python |
8448a83aba82379be96b135a835572ac2853665a | Update example so it works under Python 3. | Kami/python-yubico-client | demo/example.py | demo/example.py | import sys
from yubico_client import Yubico
from yubico_client import yubico_exceptions
from yubico_client.py3 import PY3
if PY3:
raw_input = input
client_id = raw_input('Enter your client id: ')
secret_key = raw_input('Enter your secret key (optional): ')
use_https = raw_input('Use secure connection (https)? [y... | import sys
from yubico_client import Yubico
from yubico_client import yubico_exceptions
client_id = raw_input('Enter your client id: ')
secret_key = raw_input('Enter your secret key (optional): ')
use_https = raw_input('Use secure connection (https)? [y/n]: ')
token = raw_input('Enter OTP token: ')
if not secret_key:... | bsd-3-clause | Python |
89225ed0c7ec627ee32fd973d5f1fb95da173be2 | Remove pointless `_cache` attribute on MemcacheLock class. | potatolondon/djangae,potatolondon/djangae | djangae/contrib/locking/memcache.py | djangae/contrib/locking/memcache.py | import random
import time
from datetime import datetime
from django.core.cache import cache
class MemcacheLock(object):
def __init__(self, identifier, unique_value):
self.identifier = identifier
self.unique_value = unique_value
@classmethod
def acquire(cls, identifier, wait=True, steal_a... | import random
import time
from datetime import datetime
from django.core.cache import cache
class MemcacheLock(object):
def __init__(self, identifier, cache, unique_value):
self.identifier = identifier
self._cache = cache
self.unique_value = unique_value
@classmethod
def acquire(... | bsd-3-clause | Python |
8709d89e78d224beb6b86c689492ab303602b8ed | Handle authentication of non-existant users, see ticket #384. | galaxor/Nodewatcher,galaxor/Nodewatcher,galaxor/Nodewatcher,galaxor/Nodewatcher | nodewatcher/wlanlj/account/auth.py | nodewatcher/wlanlj/account/auth.py | from django.contrib.auth.models import User
from django.contrib.auth.models import check_password
from crypt import crypt
if crypt('', '$1$DIF16...$Xzh7aN9GPHrZPK9DgggUK/') != '$1$DIF16...$Xzh7aN9GPHrZPK9DgggUK/':
# crypt does not support MD5 hashed passwords, we will use Python implementation
from md5crypt import... | from django.contrib.auth.models import User
from django.contrib.auth.models import check_password
from crypt import crypt
if crypt('', '$1$DIF16...$Xzh7aN9GPHrZPK9DgggUK/') != '$1$DIF16...$Xzh7aN9GPHrZPK9DgggUK/':
# crypt does not support MD5 hashed passwords, we will use Python implementation
from md5crypt import... | agpl-3.0 | Python |
13de116871c24e0a462299c7466305d1aff9772b | Fix tab/space mess | johnner/mercurial-jira-commit-message-hook | jirakeycheck.py | jirakeycheck.py | #coding: utf-8
import re
#If the hook returns True - hook fails
BAD_COMMIT = True
OK = False
def checkCommitMessage(ui, repo, **kwargs):
"""
Checks commit message for matching commit rule:
Every commit message must include JIRA issue key
Example:
PRJ-42 - added meaning of life
Include thi... | #coding: utf-8
import re
#If the hook returns True - hook fails
BAD_COMMIT = True
OK = False
def checkCommitMessage(ui, repo, **kwargs):
"""
Checks commit message for matching commit rule:
Every commit message must include JIRA issue key
Example:
PRJ-42 - added meaning of life
Include this hook in .hg/... | mit | Python |
73d96935e04ef3c75536cf8ba273ab00e951b1a8 | Make the simple demo jump around less. | jhartford/pybo,mwhoffman/pybo | demos/simple.py | demos/simple.py | import numpy as np
import matplotlib.pyplot as pl
import pygp as pg
import pybo.models as pbm
import pybo.policies as pbp
def run_model(Model, sn, ell, sf, T):
model = Model(0.2)
gp = pg.BasicGP(sn, ell, sf)
policy = pbp.Thompson(gp, model.bounds)
xmin = model.bounds[0,0]
xmax = model.bounds[0,1... | import numpy as np
import matplotlib.pyplot as pl
import pygp as pg
import pybo.models as pbm
import pybo.policies as pbp
def run_model(Model, sn, ell, sf, T):
model = Model(0.2)
gp = pg.BasicGP(sn, ell, sf)
policy = pbp.Thompson(gp, model.bounds)
xmin = model.bounds[0,0]
xmax = model.bounds[0,1... | bsd-2-clause | Python |
9cb668e41fc3a240dd6e1c0d625dc7f6e38e14d2 | Change deploy to project path | timsavage/denim | denim/system.py | denim/system.py | # -*- encoding:utf8 -*-
from fabric.api import env, settings, hide
from fabric.contrib import files
from denim import paths, utils
def user_exists(user=None):
"""
Check if a user exists.
:param user: name of the user to check; defaults to the deploy_user.
"""
if not user:
user = env.dep... | # -*- encoding:utf8 -*-
from fabric.api import env, settings, hide
from fabric.contrib import files
from denim import paths, utils
def user_exists(user=None):
"""
Check if a user exists.
:param user: name of the user to check; defaults to the deploy_user.
"""
if not user:
user = env.depl... | bsd-2-clause | Python |
b2431315ed3fefc8a57cb9b3c6571116024beb00 | bump version | czpython/djangocms-text-ckeditor,czpython/djangocms-text-ckeditor,yakky/djangocms-text-ckeditor,czpython/djangocms-text-ckeditor,vxsx/djangocms-text-ckeditor,vxsx/djangocms-text-ckeditor,yakky/djangocms-text-ckeditor,vxsx/djangocms-text-ckeditor,divio/djangocms-text-ckeditor,divio/djangocms-text-ckeditor,yakky/djangocm... | djangocms_text_ckeditor/__init__.py | djangocms_text_ckeditor/__init__.py | # -*- coding: utf-8 -*-
__version__ = "2.8.0"
default_app_config = 'djangocms_text_ckeditor.apps.TextCkeditorConfig'
| # -*- coding: utf-8 -*-
__version__ = "2.7.0"
default_app_config = 'djangocms_text_ckeditor.apps.TextCkeditorConfig'
| bsd-3-clause | Python |
93d12d4e8adad57d679386342c07ff3936eb114d | Bump version to 0.2.1 | xrmx/django-skebby | django_skebby/__init__.py | django_skebby/__init__.py | __version__ = '0.2.1'
| __version__ = '0.2.0'
| bsd-3-clause | Python |
a715821c75521e25172805c98d204fc4e24a4641 | Solve Code Fights circle of numbers problem | HKuz/Test_Code | CodeFights/circleOfNumbers.py | CodeFights/circleOfNumbers.py | #!/usr/local/bin/python
# Code Fights Circle of Numbers Problem
def circleOfNumbers(n, firstNumber):
mid = n / 2
return (mid + firstNumber if firstNumber < mid else firstNumber - mid)
def main():
tests = [
[10, 2, 7],
[10, 7, 2],
[4, 1, 3],
[6, 3, 0]
]
for t in t... | #!/usr/local/bin/python
# Code Fights Circle of Numbers Problem
def circleOfNumbers(n, firstNumber):
pass
def main():
tests = [
["crazy", "dsbaz"],
["z", "a"]
]
for t in tests:
res = circleOfNumbers(t[0], t[1])
if t[2] == res:
print("PASSED: circleOfNumbe... | mit | Python |
94c5e5c6531a0f000377ee18f66ffc4c25f59bc1 | extend to 100 the number of tested hdus | desihub/desispec,desihub/desispec | py/desispec/io/fiberflat_vs_humidity.py | py/desispec/io/fiberflat_vs_humidity.py | import numpy as np
import fitsio
import astropy.io.fits as fits
from desiutil.log import get_logger
from .meta import findfile
from .util import native_endian
def get_humidity(night,expid,camera) :
log=get_logger()
raw_filename=findfile("raw",night=night,expid=expid)
table=fitsio.read(raw_filename,"SPECTCO... | import numpy as np
import fitsio
import astropy.io.fits as fits
from desiutil.log import get_logger
from .meta import findfile
from .util import native_endian
def get_humidity(night,expid,camera) :
log=get_logger()
raw_filename=findfile("raw",night=night,expid=expid)
table=fitsio.read(raw_filename,"SPECTCO... | bsd-3-clause | Python |
c906188a42125785d4de4a341eed436d659e83f1 | Bump version. | amigrave/pudb,albfan/pudb,amigrave/pudb,albfan/pudb | pudb/__init__.py | pudb/__init__.py | VERSION = "0.91.5"
CURRENT_DEBUGGER = [None]
def set_trace():
if CURRENT_DEBUGGER[0] is None:
from pudb.debugger import Debugger
dbg = Debugger()
CURRENT_DEBUGGER[0] = dbg
import sys
dbg.set_trace(sys._getframe().f_back)
def post_mortem(t):
p = Debugger()
p.r... | VERSION = "0.91.4"
CURRENT_DEBUGGER = [None]
def set_trace():
if CURRENT_DEBUGGER[0] is None:
from pudb.debugger import Debugger
dbg = Debugger()
CURRENT_DEBUGGER[0] = dbg
import sys
dbg.set_trace(sys._getframe().f_back)
def post_mortem(t):
p = Debugger()
p.r... | mit | Python |
7dcc8b0946d08f0ab491311b15454d8bcd6e51e9 | fix problem when using south's orm freezer. | anentropic/django-denorm,simas/django-denorm,PetrDlouhy/django-denorm,Eksmo/django-denorm,kennknowles/django-denorm,heinrich5991/django-denorm,incuna/django-denorm,miracle2k/django-denorm,lechup/django-denorm,Kronuz/django-denorm,mjtamlyn/django-denorm,victorvde/django-denorm,gerdemb/django-denorm,larsbijl/django-denor... | denorm/helpers.py | denorm/helpers.py | from django.db import models
def find_fk(from_model, to_model, foreign_key=None):
if foreign_key:
if not isinstance(foreign_key, (str, unicode)):
foreign_key = foreign_key.attname
fkeys = filter(lambda x: isinstance(x, models.ForeignKey)
and x.rel.to._me... | from django.db import models
def find_fk(from_model, to_model, foreign_key=None):
if foreign_key:
if not isinstance(foreign_key, (str, unicode)):
foreign_key = foreign_key.attname
fkeys = filter(lambda x: isinstance(x, models.ForeignKey)
and x.rel.to == ... | bsd-3-clause | Python |
167afdb96c4cc89109b26cf9793938b143578b47 | fix problem | h2rd/ppxml | pxml/__init__.py | pxml/__init__.py | #!/usr/bin/env python
# unicode: utf-8
import sys
from pygments import highlight
from pygments.formatters import TerminalFormatter
from pygments.lexers import XmlLexer
from xml.dom.minidom import parseString
INDENT=' '*2
def format_code(data):
body = ''
if data.startswith('HTTP'):
end = data.find("\r\n\r\... | #!/usr/bin/env python
# unicode: utf-8
import sys
from pygments import highlight
from pygments.formatters import TerminalFormatter
from pygments.lexers import XmlLexer
from xml.dom.minidom import parseString
INDENT=' '*2
def format_code(data):
body = ''
if data.startswith('HTTP'):
end = data.find("\r\n\r\... | mit | Python |
111ed982ed2182448ea5e80c2065514c51217be1 | update restfulAPI | EtienneChuang/etiennechuang.github.io,EtienneChuang/etiennechuang.github.io | py/restfulAPI.py | py/restfulAPI.py | from flask import Flask
from flask_restful import Resource, Api
import json
from flask_jsonpify import jsonify
from flask_cors import CORS
import urllib
import ssl
import requests
import csv
import sys
app = Flask(__name__)
CORS(app)
api = Api(app)
encoding = "utf-8"
def fetchCsvData(url):
try:
response = requests.... | from flask import Flask
from flask_restful import Resource, Api
import json
from flask_jsonpify import jsonify
from flask_cors import CORS
import urllib
import ssl
import requests
import csv
import sys
app = Flask(__name__)
CORS(app)
api = Api(app)
encoding = "utf-8"
def fetchCsvData(url):
try:
response = requests.... | mit | Python |
9ac662557d6313190621c0c84a2c6923e0e9fa72 | Update event context instead of replace (NC-529) | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/logging/middleware.py | nodeconductor/logging/middleware.py | from __future__ import unicode_literals
import threading
_locals = threading.local()
def get_event_context():
return getattr(_locals, 'context', None)
def set_event_context(context):
_locals.context = context
def reset_event_context():
if hasattr(_locals, 'context'):
del _locals.context
de... | from __future__ import unicode_literals
import threading
_locals = threading.local()
def get_event_context():
return getattr(_locals, 'context', None)
def set_event_context(context):
_locals.context = context
def reset_event_context():
if hasattr(_locals, 'context'):
del _locals.context
de... | mit | Python |
c5be1820f87de3b6b80faa7296354b0391a73240 | Update template-argparse_v2.py | csiu/tokens,csiu/tokens,csiu/tokens,csiu/tokens,csiu/tokens,csiu/tokens | python/template/template-argparse_v2.py | python/template/template-argparse_v2.py | #!/usr/bin/env python
# Author: Celia
# Created:
import argparse
import sys
import os
usage = """
"""
def main():
print "Hello world"
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=usage, formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('-i', '--infile', dest=... | #!/usr/bin/env python
# Author: Celia
# Created:
import argparse
import sys
import os
usage = """ %s [options] -i INFILE
""" % (__file__)
def main():
print "Hello world"
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=usage, formatter_class=argparse.RawTextHelpFormatter)
parser.... | mit | Python |
11921dd2d3e305a2ec014bf8fd13e5d57774fb95 | Add proper docstring to get_real_id.py, add example usage | kastden/nanagogo | bin/get_real_id.py | bin/get_real_id.py | #!/usr/bin/env python3
"""Get a 755 user's real talkId from their public ID on the website.
As an example, the ID for Furuhata Nao's page is
Xe8jJ0D40_aWkVIvojdMdG== (http://7gogo.jp/lp/Xe8jJ0D40_aWkVIvojdMdG==), but her
real talkId (for use with the API) is MqsG1FLTi-_9GtN76wEuUm==.
Example usage and output:
$ pyth... | #!/usr/bin/env python3
import re
import yaml
import sys
import requests
''' Get a 755 user's real talkId.
As an example, the ID for Furuhata Nao's page is
Xe8jJ0D40_aWkVIvojdMdG== (http://7gogo.jp/lp/Xe8jJ0D40_aWkVIvojdMdG==),
but her real talkId (for use with the API) is MqsG1FLTi-_9GtN76wEuUm==.'''
def get_rea... | mit | Python |
5b62eae4e2a295e6b167f4e035a9e663278c22b5 | Update uploadFTP.py | sniemi/SamPy,sniemi/SamPy,sniemi/SamPy,sniemi/SamPy,sniemi/SamPy,sniemi/SamPy,sniemi/SamPy,sniemi/SamPy,sniemi/SamPy,sniemi/SamPy | smnIO/uploadFTP.py | smnIO/uploadFTP.py | """
This module contains functions related to FTP file transfer protocol.
:Author: Sami-Matias Niemi
:contact: smn2@mssl.ucl.ac.uk
:version: 0.2
"""
import ftplib, os, glob
def upload(ftp, file):
"""
Upload files to a server using FTP protocol.
:param ftp: instance to the FTP server
:type ftp: ftpl... | """
This module contains functions related to FTP file transfer protocol.
:Author: Sami-Matias Niemi
:contact: smn2@mssl.ucl.ac.uk
:version: 0.2
"""
import ftplib, os, glob
def upload(ftp, file):
"""
Upload files to a server using FTP protocol.
:param ftp: instance to the FTP server
:type ftp: ftpl... | bsd-2-clause | Python |
93a95afe231910d9f683909994692fadaf107057 | Make md.render have the same API as rst.render | pypa/readme,pypa/readme_renderer | readme_renderer/markdown.py | readme_renderer/markdown.py | # Copyright 2014 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | # Copyright 2014 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 | Python |
0dcd5d1b5de5aeeeb653ea6cb6fdc04a931518b6 | SPeed up donate admin | wanghaven/readthedocs.org,raven47git/readthedocs.org,jerel/readthedocs.org,sils1297/readthedocs.org,emawind84/readthedocs.org,michaelmcandrew/readthedocs.org,GovReady/readthedocs.org,dirn/readthedocs.org,tddv/readthedocs.org,kenshinthebattosai/readthedocs.org,atsuyim/readthedocs.org,davidfischer/readthedocs.org,attakei... | readthedocs/donate/admin.py | readthedocs/donate/admin.py | from django.contrib import admin
from .models import Supporter
class SupporterAdmin(admin.ModelAdmin):
model = Supporter
raw_id_fields = ('user',)
list_display = ('name', 'email', 'dollars', 'public')
list_filter = ('name', 'email', 'dollars', 'public')
admin.site.register(Supporter, SupporterAdmin)
| from django.contrib import admin
from .models import Supporter
admin.site.register(Supporter)
| mit | Python |
d209e5318eb148176edf8b63b0a02731b80d1ff7 | replace stop_area_id by destination_stop_area_id | is06/navitia,lrocheWB/navitia,francois-vincent/navitia,CanalTP/navitia,xlqian/navitia,antoine-de/navitia,kinnou02/navitia,CanalTP/navitia,prhod/navitia,Tisseo/navitia,pbougue/navitia,prhod/navitia,ballouche/navitia,patochectp/navitia,VincentCATILLON/navitia,xlqian/navitia,pbougue/navitia,fueghan/navitia,francois-vincen... | source/sql/alembic/versions/12660cd87568_main_destination_for_route.py | source/sql/alembic/versions/12660cd87568_main_destination_for_route.py | """main destination for route
Revision ID: 12660cd87568
Revises: 29fc422c56cb
Create Date: 2015-05-05 13:47:06.507810
"""
# revision identifiers, used by Alembic.
revision = '12660cd87568'
down_revision = '13673746db16'
from alembic import op
import sqlalchemy as sa
import geoalchemy2 as ga
from sqlalchemy.dialects... | """main destination for route
Revision ID: 12660cd87568
Revises: 29fc422c56cb
Create Date: 2015-05-05 13:47:06.507810
"""
# revision identifiers, used by Alembic.
revision = '12660cd87568'
down_revision = '29fc422c56cb'
from alembic import op
import sqlalchemy as sa
import geoalchemy2 as ga
from sqlalchemy.dialects... | agpl-3.0 | Python |
06ae20b428bc92790bcaae9636200e427d99abd9 | Bump version number for Python 3.2-matching release | harlowja/pythonfutures,plucury/pythonfutures,startover/pythonfutures | python2/setup.py | python2/setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='futures',
version='2.0',
description='Java-style futures implementation in Python 2.x',
author='Brian Quinlan',
author_email='brian@sweetapp.com',
url='http://code.google.com/p/pythonfutures',
download_url='http://p... | #!/usr/bin/env python
from distutils.core import setup
setup(name='futures',
version='1.0',
description='Java-style futures implementation in Python 2.x',
author='Brian Quinlan',
author_email='brian@sweetapp.com',
url='http://code.google.com/p/pythonfutures',
download_url='http://p... | bsd-2-clause | Python |
2e30d22ad8b6e35cfffed6a883bf959009707d73 | Make more readable error msg on quantum client authentication failure | badock/nova,CloudServer/nova,mandeepdhami/nova,apporc/nova,dawnpower/nova,felixma/nova,gspilio/nova,LoHChina/nova,shail2810/nova,mgagne/nova,sebrandon1/nova,affo/nova,BeyondTheClouds/nova,cloudbase/nova-virtualbox,CCI-MOC/nova,isyippee/nova,takeshineshiro/nova,orbitfp7/nova,citrix-openstack-build/nova,mahak/nova,luogan... | nova/network/quantumv2/__init__.py | nova/network/quantumv2/__init__.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 OpenStack Foundation
# 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.apach... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 OpenStack Foundation
# 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.apach... | apache-2.0 | Python |
20e846e849e53e6f3b5d82b2a3e9f9db310a68a4 | Bump version number | timxx/gitc,timxx/gitc | qgitc/version.py | qgitc/version.py | # -*- coding: utf-8 -*-
VERSION_MAJOR = 3
VERSION_MINOR = 0
VERSION_PATCH = 0
VERSION = "{}.{}.{}".format(VERSION_MAJOR,
VERSION_MINOR,
VERSION_PATCH)
| # -*- coding: utf-8 -*-
VERSION_MAJOR = 2
VERSION_MINOR = 1
VERSION_PATCH = 0
VERSION = "{}.{}.{}".format(VERSION_MAJOR,
VERSION_MINOR,
VERSION_PATCH)
| apache-2.0 | Python |
188fa155b9f421b980c6db048c0e1a235d8967ab | fix 10 files at a time | crateio/crate.web,crateio/crate.web | crate_project/apps/crate/management/commands/fix_missing_files.py | crate_project/apps/crate/management/commands/fix_missing_files.py | from django.core.management.base import BaseCommand
from packages.models import ReleaseFile
from pypi.processor import PyPIPackage
class Command(BaseCommand):
def handle(self, *args, **options):
i = 0
for rf in ReleaseFile.objects.filter(digest="").distinct("release")[:10]:
print rf.... | from django.core.management.base import BaseCommand
from packages.models import ReleaseFile
from pypi.processor import PyPIPackage
class Command(BaseCommand):
def handle(self, *args, **options):
i = 0
for rf in ReleaseFile.objects.filter(digest="").distinct("release")[:1]:
print rf.r... | bsd-2-clause | Python |
9d1f0bb4b332cbf3775408336fd09cd56c478554 | Fix formatting | amolenaar/gaphor,amolenaar/gaphor | gaphor/ui/__init__.py | gaphor/ui/__init__.py | """
This module contains user interface related code, such as the
main screen and diagram windows.
"""
from gi.repository import Gtk, Gdk
import pkg_resources
import os.path
icon_theme = Gtk.IconTheme.get_default()
icon_theme.append_search_path(
os.path.abspath(pkg_resources.resource_filename("gaphor.ui", "pixmap... | """
This module contains user interface related code, such as the
main screen and diagram windows.
"""
from gi.repository import Gtk, Gdk
import pkg_resources
import os.path
icon_theme = Gtk.IconTheme.get_default()
icon_theme.append_search_path(
os.path.abspath(pkg_resources.resource_filename("gaphor.ui", "pixmap... | lgpl-2.1 | Python |
7d3f69d2ce8a55480573c5ff044a2d0565661b89 | improve user lookup and docs (#33) | lock8/django-rest-framework-jwt-refresh-token | refreshtoken/permissions.py | refreshtoken/permissions.py | from rest_framework import permissions
class IsOwnerOrAdmin(permissions.BasePermission):
"""
Only admins or owners are allowed.
"""
def has_permission(self, request, view):
user = request.user
return user and user.is_authenticated
def has_object_permission(self, request, view, obj... | from rest_framework import permissions
class IsOwnerOrAdmin(permissions.BasePermission):
"""
Only admins or owners can have permission
"""
def has_permission(self, request, view):
return request.user and request.user.is_authenticated
def has_object_permission(self, request, view, obj):
... | mit | Python |
2b9566814e085023a9b5ef0f8e5b15dcd932f6c0 | Load pep8 package lazily | tk0miya/flake8-coding | flake8_coding.py | flake8_coding.py | # -*- coding: utf-8 -*-
import re
__version__ = '1.1.1'
class CodingChecker(object):
name = 'flake8_coding'
version = __version__
def __init__(self, tree, filename):
self.filename = filename
@classmethod
def add_options(cls, parser):
parser.add_option(
'--accept-enc... | # -*- coding: utf-8 -*-
import re
import pep8
__version__ = '1.1.1'
class CodingChecker(object):
name = 'flake8_coding'
version = __version__
def __init__(self, tree, filename):
self.filename = filename
@classmethod
def add_options(cls, parser):
parser.add_option(
'... | apache-2.0 | Python |
2fe2ca16f2074a8674ceef43f4731e164156a9b2 | refactor and comments | cgoldberg/pageloadtimer | pageloadtimer.py | pageloadtimer.py | #!/usr/bin/env python
#
# Copyright (c) 2015 Corey Goldberg
# License: MIT
import collections
import textwrap
from selenium import webdriver
class PageLoadTimer:
def __init__(self, driver):
"""
takes:
driver: webdriver instance from selenium package.
this should... | #!/usr/bin/env python
#
# Copyright (c) 2015 Corey Goldberg
# License: MIT
import collections
import logging
import textwrap
from pyvirtualdisplay import Display
from selenium import webdriver
class PageLoadTimer:
def __init__(self, driver):
self.driver = driver
self.jscript = textwrap.dedent... | mit | Python |
e88f1694d3c7e01f701ae91d472b75731799acdf | Fix ckan PR'ing - Caused by plague006's 12e44142 commit | EIREXE/SpaceDock,EIREXE/SpaceDock,EIREXE/SpaceDock,EIREXE/SpaceDock | KerbalStuff/ckan.py | KerbalStuff/ckan.py | from KerbalStuff.config import _cfg
from github import Github
from flask import url_for
import subprocess
import json
import os
import re
# TODO(Thomas): Make this modular
def send_to_ckan(mod):
if not _cfg("netkan_repo_path"):
return
if not mod.ckan:
return
json_blob = {
'spec_vers... | from KerbalStuff.config import _cfg
from github import Github
from flask import url_for
import subprocess
import json
import os
import re
# TODO(Thomas): Make this modular
def send_to_ckan(mod):
if not _cfg("netkan_repo_path"):
return
if not mod.ckan:
return
json_blob = {
'spec_vers... | mit | Python |
aa164b92e0a3d00c18dd7ad4aecb067ad2bc9bb0 | bump to 1.3.0 | fireeye/flare-floss,fireeye/flare-floss | floss/version.py | floss/version.py | __version__ = '1.3.0'
| __version__ = '1.2.0'
| apache-2.0 | Python |
345ccc9d503e6e55fe46d7813958c0081cc1cffe | Fix issues with importing the Login form | Mirantis/mos-horizon,endorphinl/horizon,RudoCris/horizon,davidcusatis/horizon,Daniex/horizon,watonyweng/horizon,tqtran7/horizon,sandvine/horizon,openstack/horizon,mdavid/horizon,davidcusatis/horizon,maestro-hybrid-cloud/horizon,VaneCloud/horizon,CiscoSystems/avos,Dark-Hacker/horizon,luhanhan/horizon,RudoCris/horizon,fr... | openstack_dashboard/views.py | openstack_dashboard/views.py | # Copyright 2012 Nebula, 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 agree... | # Copyright 2012 Nebula, 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 agree... | apache-2.0 | Python |
1e1f84d8b9303ee88a901f9440187b77cd06e464 | Update to Support SoftwareUpdater | Salandora/octoprint-customControl,Salandora/octoprint-customControl,Salandora/octoprint-customControl | octoprint_customControl/__init__.py | octoprint_customControl/__init__.py | # coding=utf-8
from __future__ import absolute_import
__author__ = "Marc Hannappel <salandora@gmail.com>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
from octoprint.settings import settings
import octoprint.plugin
class CustomControlPlugin(octoprint.plugin.SettingsPlugin,... | # coding=utf-8
from __future__ import absolute_import
__author__ = "Marc Hannappel <sunpack@web.de>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
from octoprint.settings i... | agpl-3.0 | Python |
33abd340a824b16f084472987a93dd34f9af359d | Add missing USER_LIMIT field validations | philanthropy-u/edx-platform,philanthropy-u/edx-platform,philanthropy-u/edx-platform,philanthropy-u/edx-platform | openedx/features/partners/models.py | openedx/features/partners/models.py | from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from jsonfield.fields import JSONField
from model_utils import Choices
from model_utils.models import TimeStampedModel
from .constants import PARTNER_USER_STATUS_WAITING, PARTNER_USER_STATUS_APPR... | from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from jsonfield.fields import JSONField
from model_utils import Choices
from model_utils.models import TimeStampedModel
from .constants import PARTNER_USER_STATUS_WAITING, PARTNER_USER_STATUS_APPR... | agpl-3.0 | Python |
a74df5851ea211be5bb29caeb03179be70f488cc | fix bug: conf to redis_conf | alone-walker/BlogSpider,hack4code/BlogSpider,hack4code/BlogSpider,wartalker/BlogSpider,wartalker/BlogSpider,hack4code/BlogSpider,wartalker/BlogSpider,hack4code/BlogSpider,alone-walker/BlogSpider,alone-walker/BlogSpider,alone-walker/BlogSpider,wartalker/BlogSpider | spider/mydm/extensions/stats.py | spider/mydm/extensions/stats.py | # -*- coding: utf-8 -*-
import logging
from redis.exceptions import ConnectionError
import redis
from scrapy import signals
from ..util import parse_redis_url
logger = logging.getLogger(__name__)
class ExtensionStats:
def __init__(self, stats, settings):
self.stats = stats
self.redis_conf =... | # -*- coding: utf-8 -*-
import logging
from redis.exceptions import ConnectionError
import redis
from scrapy import signals
from ..util import parse_redis_url
logger = logging.getLogger(__name__)
class ExtensionStats:
def __init__(self, stats, settings):
self.stats = stats
self.redis_conf =... | mit | Python |
d520b36f88099a9bc0986824d919cd854b6ff5e1 | Add start and end layer info to layer parser | ulikoehler/PCBCheck,ulikoehler/PCBCheck | ODB/Layers.py | ODB/Layers.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Parser for the ODB++ PCB matrix file
"""
import os.path
from collections import namedtuple
from .StructuredTextParser import *
from .Structures import polarity_map
from enum import Enum
__all__ = ["Layer", "LayerSet", "LayerType", "parse_layers", "read_layers"]
# sta... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Parser for the ODB++ PCB matrix file
"""
import os.path
from collections import namedtuple
from .StructuredTextParser import *
from .Structures import polarity_map
from enum import Enum
__all__ = ["Layer", "LayerSet", "LayerType", "parse_layers", "read_layers"]
Layer... | apache-2.0 | Python |
aa2006626743e0c1add50aae36e462d151034259 | Create list of 3-tuples `(label, length, hashname)` | ryuslash/DisPass | dispass/labelfile.py | dispass/labelfile.py | # Copyright (c) 2011-2012 Benjamin Althues <benjamin@babab.nl>
#
# 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 SOFTWARE IS PROVIDED "AS IS" AND T... | # Copyright (c) 2011-2012 Benjamin Althues <benjamin@babab.nl>
#
# 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 SOFTWARE IS PROVIDED "AS IS" AND T... | isc | Python |
2279aa0c450d53b04f774d9441e4fc0647466581 | Send platform name to defaul template context | rougeth/bottery | bottery/message.py | bottery/message.py | import os
from datetime import datetime
import attr
from jinja2 import Environment, FileSystemLoader, select_autoescape
@attr.s
class Message:
id = attr.ib()
platform = attr.ib()
user = attr.ib()
text = attr.ib()
timestamp = attr.ib()
raw = attr.ib()
@property
def datetime(self):
... | import os
from datetime import datetime
import attr
from jinja2 import Environment, FileSystemLoader, select_autoescape
@attr.s
class Message:
id = attr.ib()
platform = attr.ib()
user = attr.ib()
text = attr.ib()
timestamp = attr.ib()
raw = attr.ib()
@property
def datetime(self):
... | mit | Python |
119c3101d17627b359382738afe059e6be204636 | disable Notice of Election scraper | DemocracyClub/EveryElection,DemocracyClub/EveryElection,DemocracyClub/EveryElection | every_election/apps/election_snooper/management/commands/snoop.py | every_election/apps/election_snooper/management/commands/snoop.py | from django.core.management.base import BaseCommand
from election_snooper.snoopers.aldc import ALDCScraper
# from election_snooper.snoopers.customsearch import CustomSearchScraper
from election_snooper.snoopers.lib_dem_newbies import LibDemNewbiesScraper
class Command(BaseCommand):
# def add_arguments(self, pa... | from django.core.management.base import BaseCommand
from election_snooper.snoopers.aldc import ALDCScraper
from election_snooper.snoopers.customsearch import CustomSearchScraper
from election_snooper.snoopers.lib_dem_newbies import LibDemNewbiesScraper
class Command(BaseCommand):
# def add_arguments(self, parse... | bsd-3-clause | Python |
6afad2e2b6b0e2fe9ce1ba55c6ed7dd000c9d4ca | correct handling of input flag | shuggiefisher/brain4k,wkal/brain4k | brain4k/brain4k.py | brain4k/brain4k.py | import os
import logging
from argparse import ArgumentParser
from pipeline import execute_pipeline
logging.basicConfig(level=logging.DEBUG)
class Brain4kArgumentParser(ArgumentParser):
def __init__(self, *args, **kwargs):
super(Brain4kArgumentParser, self).__init__(*args, **kwargs)
self.add_ar... | import os
import logging
from argparse import ArgumentParser
from pipeline import execute_pipeline
logging.basicConfig(level=logging.DEBUG)
class Brain4kArgumentParser(ArgumentParser):
def __init__(self, *args, **kwargs):
super(Brain4kArgumentParser, self).__init__(*args, **kwargs)
self.add_ar... | apache-2.0 | Python |
22b697729d1ee43d322aa1187b3a5f6101f836a5 | Remove Python 2.6 backwards compatibility | python-odin/odin | odin/__init__.py | odin/__init__.py | # Disable logging if an explicit handler is not added
import logging
logging.getLogger('odin.registration').addHandler(logging.NullHandler())
__authors__ = "Tim Savage"
__author_email__ = "tim@savage.company"
__copyright__ = "Copyright (C) 2014 Tim Savage"
__version__ = "1.0"
from odin.fields import * # noqa
from od... | __authors__ = "Tim Savage"
__author_email__ = "tim@savage.company"
__copyright__ = "Copyright (C) 2014 Tim Savage"
__version__ = "1.0"
# Disable logging if an explicit handler is not added
try:
import logging
logging.getLogger('odin').addHandler(logging.NullHandler())
except AttributeError:
pass # Fallbac... | bsd-3-clause | Python |
99d82aac2ed1a4ff8b87a30e18beea2731de1d4a | Remove project from modules and steps in admin. | patrickbeeson/diy-trainer | diytrainer/projects/admin.py | diytrainer/projects/admin.py | from django.contrib import admin
from sorl.thumbnail.admin import AdminImageMixin
from .models import Project, Feedback, DetailLevel, Step, Module
class StepInline(AdminImageMixin, admin.StackedInline):
model = Step
class StepAdmin(admin.ModelAdmin):
list_display = ('sanitized_title', 'detail_level', 'ran... | from django.contrib import admin
from sorl.thumbnail.admin import AdminImageMixin
from .models import Project, Feedback, DetailLevel, Step, Module
class StepInline(AdminImageMixin, admin.StackedInline):
model = Step
class StepAdmin(admin.ModelAdmin):
list_display = ('sanitized_title', 'detail_level', 'ran... | mit | Python |
c452d12add3eb71215d449019282d2e30552d5be | Fix bug in HUME test. | johnbachman/belpy,johnbachman/indra,pvtodorov/indra,pvtodorov/indra,johnbachman/belpy,pvtodorov/indra,sorgerlab/indra,pvtodorov/indra,bgyori/indra,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,sorgerlab/indra,sorgerlab/belpy,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,johnbachman/indra,bgyori/indra | indra/tests/test_hume.py | indra/tests/test_hume.py | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import unittest
from indra.statements import *
from indra.sources.hume.api import *
# Path to the HUME test files
path_this = os.path.dirname(os.path.abspath(__file__))
test_file_simple = os.path.join(pa... | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import unittest
from indra.statements import *
from indra.sources.hume.api import *
# Path to the HUME test files
path_this = os.path.dirname(os.path.abspath(__file__))
test_file_simple = os.path.join(pa... | bsd-2-clause | Python |
7a593b9f4e6b05a276b58d14143e9df3fb7a603e | Update int test function | ForestPride/rail-problem | request_integer_in_range.py | request_integer_in_range.py | """ Prompts user to provide integer within a range """
def request_integer_in_range(prompt, lowest, highest):
"""
Purpose: prompts user for an integer, tests that an integer was
provided, and verifies the integer is within an acceptable range.
Inputs:
prompt (str): request to present to us... | """ Prompts user to provide integer within a range """
def request_integer_in_range(prompt, lowest, highest):
"""
Purpose: prompts user for an integer, tests that an integer was
provided, and verifies the integer is within an acceptable range.
Inputs:
prompt (str): request to present to us... | mit | Python |
fe5db566be15f50813b6e76fe727e94488249bd3 | bump version | gipit/gippy,gipit/gippy | gippy/version.py | gippy/version.py | #!/usr/bin/env python
################################################################################
# GIPPY: Geospatial Image Processing library for Python
#
# AUTHOR: Matthew Hanson
# EMAIL: matt.a.hanson@gmail.com
#
# Copyright (C) 2015 Applied Geosolutions
#
# Licensed under the Apache License, Ve... | #!/usr/bin/env python
################################################################################
# GIPPY: Geospatial Image Processing library for Python
#
# AUTHOR: Matthew Hanson
# EMAIL: matt.a.hanson@gmail.com
#
# Copyright (C) 2015 Applied Geosolutions
#
# Licensed under the Apache License, Ve... | apache-2.0 | Python |
fcdd05392ba5d2bd19d05abdd944021f385edfc1 | Update configuration parser, write commented default configuration file | manuelbua/gitver,manuelbua/gitver,manuelbua/gitver | gitver/config.py | gitver/config.py | #!/usr/bin/env python2
# coding=utf-8
"""
The default per-repository configuration
"""
import json
import string
from os.path import exists, dirname
from gitver.defines import CFGFILE
default_config_text = """{
# automatically generated configuration file
#
# These defaults implements Semantic Versioning... | #!/usr/bin/env python2
# coding=utf-8
"""
The default per-repository configuration
"""
import json
from os.path import exists, dirname
from gitver.defines import CFGFILE
default_config = {
'next_suffix': 'NEXT',
'next_custom_suffix': 'SNAPSHOT'
}
def init_or_load_user_config():
# try load user configur... | apache-2.0 | Python |
c440b460090410400971e8377b6d4ec564fc5215 | fix for Py3.6: override cls in json_kwargs of Django’s JSON serializer | nimbis/django-shop,nimbis/django-shop,awesto/django-shop,nimbis/django-shop,divio/django-shop,divio/django-shop,awesto/django-shop,nimbis/django-shop,divio/django-shop,awesto/django-shop | shop/money/serializers.py | shop/money/serializers.py | # -*- coding: utf-8 -*-
"""
Override django.core.serializers.json.Serializer which renders our MoneyType as float.
"""
from __future__ import unicode_literals
import json
from django.core.serializers.json import DjangoJSONEncoder, Serializer as DjangoSerializer
from django.core.serializers.json import Deserializer
fro... | # -*- coding: utf-8 -*-
"""
Override django.core.serializers.json.Serializer which renders our MoneyType as float.
"""
from __future__ import unicode_literals
import json
from django.core.serializers.json import DjangoJSONEncoder, Serializer as DjangoSerializer
from django.core.serializers.json import Deserializer
fro... | bsd-3-clause | Python |
129a4d6dbade887ad4d21629b2909a9ce41124b8 | Update static db auto mkdir of db | galileo-project/Galileo-gpm | gpm/utils/sdb.py | gpm/utils/sdb.py | from gpm.utils.operation import LocalOperation
from gpm.const import GPM_DB, DB_SF
import os
try:
import cPickle as pickle
except:
import pickle
class StaticDB(object):
def __init__(self):
self.__path = os.path.join(GPM_DB, "%s.%s" % (self.__class__.__name__, DB_SF))
self.__data = {}
... | from gpm.utils.operation import LocalOperation
from gpm.const import GPM_DB, DB_SF
import os
try:
import cPickle as pickle
except:
import pickle
class StaticDB(object):
def __init__(self):
self.__path = os.path.join(GPM_DB, "%s.%s" % (self.__class__.__name__, DB_SF))
self.__data = {}
... | mit | Python |
19fa0b053cf9a7dfd54312dfef409c64d6642b5c | update version | CoolerVoid/Vision | Vision-cpe.py | Vision-cpe.py | #!/usr/bin/python
import sys, os.path
from parse import parsers
def banner_vision():
print """ ..::: VISION v0.2 :::...
Nmap\'s XML result parser and NVD's CPE correlation to search CVE
Example:
python vision.py result_scan.xml 3 txt > log_result.txt
argv 1 = Nmap scanner results in XML
argv 2 =... | #!/usr/bin/python
import sys, os.path
from parse import parsers
def banner_vision():
print """ ..::: VISION v0.1 :::...
Nmap\'s XML result parser and NVD's CPE correlation to search CVE
Example:
python vision.py result_scan.xml 3 txt > log_result.txt
argv 1 = Nmap scanner results in XML
argv 2 =... | bsd-3-clause | Python |
8e1b85e1b38c96d9798eb378f224f0dfbb5cdb45 | Update dev settings | praekelt/nurseconnect,praekelt/nurseconnect,praekelt/nurseconnect | nurseconnect/settings/dev.py | nurseconnect/settings/dev.py | from .base import * # noqa
DEBUG = True
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
# WAGTAILSEARCH_BACKENDS = {
# "default": {
# "BACKEND": ("molo.core.wagtailsearch.backends.elasticsearch"),
# "INDEX": "base",
# "URLS": ["http://localhost:9200"],
# "TIMEOU... | from .base import * # noqa
DEBUG = True
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
# WAGTAILSEARCH_BACKENDS = {
# "default": {
# "BACKEND": ("molo.core.wagtailsearch.backends.elasticsearch"),
# "INDEX": "base",
# "URLS": ["http://localhost:9200"],
# "TIMEOU... | bsd-2-clause | Python |
9fc5c310ce1430097d1efd781c9951405373e001 | Make User's __eq__ case-insensitive. | ayust/kitnirc | kitnirc/user.py | kitnirc/user.py | def split_hostmask(hostmask):
"""Splits a nick@host string into nick and host."""
nick, _, host = hostmask.partition('@')
nick, _, user = nick.partition('!')
return nick, user or None, host or None
class User(object):
"""A user on an IRC network."""
def __init__(self, hostmask):
self.... | def split_hostmask(hostmask):
"""Splits a nick@host string into nick and host."""
nick, _, host = hostmask.partition('@')
nick, _, user = nick.partition('!')
return nick, user or None, host or None
class User(object):
"""A user on an IRC network."""
def __init__(self, hostmask):
self.... | mit | Python |
77ea926c854d89768e992fdce628663f21fa7dab | Add __repr__ to TSS | konrad/kufpybio | kufpybio/tss.py | kufpybio/tss.py | class TSS(object):
def __init__(self, seq_id, pos, strand, extra=None):
"""A transcription start site
seq_id - identifier of the harboring chromosome, plasmid, etc.
pos - position of the
strand - the strand (+ or -)
extra - any other information that should be assoc... | class TSS(object):
def __init__(self, seq_id, pos, strand, extra=None):
"""A transcription start site
seq_id - identifier of the harboring chromosome, plasmid, etc.
pos - position of the
strand - the strand (+ or -)
extra - any other information that should be assoc... | isc | Python |
ddd23068a84b1bdf7e3284b1e6bebea3c2b362e9 | format literal tests | metasmile/transync | strsync/strsync_playground.py | strsync/strsync_playground.py | # -*- coding: utf-8 -*-
import googletrans
from googletrans import Translator
from googletrans.constants import DEFAULT_USER_AGENT, LANGCODES, LANGUAGES, SPECIAL_CASES
translator = Translator()
# print googletrans.LANGCODES
# print googletrans.constants
# print [l.text for l in translator.translate(['hi','you'], src=... | # -*- coding: utf-8 -*-
import googletrans
from googletrans import Translator
from googletrans.constants import DEFAULT_USER_AGENT, LANGCODES, LANGUAGES, SPECIAL_CASES
translator = Translator()
# print googletrans.LANGCODES
# print googletrans.constants
# print [l.text for l in translator.translate(['hi','you'], src=... | mit | Python |
e8c999cfbe88907a2a90d6b49b2d771cb3c94f54 | sort in ES | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/enikshay/data_store.py | custom/enikshay/data_store.py | import pytz
from django.utils.dateparse import parse_datetime
from corehq.apps.es import filters
from corehq.apps.userreports.models import StaticDataSourceConfiguration
from corehq.apps.userreports.util import get_indicator_adapter
from custom.enikshay.const import DOSE_KNOWN_INDICATORS
from dimagi.utils.decorators.... | import pytz
from django.utils.dateparse import parse_datetime
from corehq.apps.es import filters
from corehq.apps.userreports.models import StaticDataSourceConfiguration
from corehq.apps.userreports.util import get_indicator_adapter
from custom.enikshay.const import DOSE_KNOWN_INDICATORS
from dimagi.utils.decorators.... | bsd-3-clause | Python |
2a2d3f8ffcbc709e94e054bd426ccd7452b8f029 | Remove I as symbol for imaginary unit | mph-/lcapy | lcapy/config.py | lcapy/config.py | # SymPy symbols to exclude.
exclude = ('I', 'C', 'O', 'S', 'N', 'E', 'E1', 'Q', 'beta', 'gamma', 'zeta')
# Aliases for SymPy symbols
aliases = {'delta': 'DiracDelta', 'step': 'Heaviside', 'u': 'Heaviside',
'j': 'I'}
# String replacements when printing as LaTeX. For example, SymPy uses
# theta for Heavisi... | # SymPy symbols to exclude.
exclude = ('C', 'O', 'S', 'N', 'E', 'E1', 'Q', 'beta', 'gamma', 'zeta')
# Aliases for SymPy symbols
aliases = {'delta': 'DiracDelta', 'step': 'Heaviside', 'u': 'Heaviside',
'j': 'I'}
# String replacements when printing as LaTeX. For example, SymPy uses
# theta for Heaviside's ... | lgpl-2.1 | Python |
bd47f378e0a02aeed88793eeec182e7b280dc2d2 | Bump Zen version | zepheira/zenpub,zepheira/zenpub,zepheira/zenpub,zepheira/zenpub | lib/__init__.py | lib/__init__.py | #freemixlib
__version__ = '0.9.3.3'
#Mapping from service ID URI too URL template and/or callable
SERVICES = {}
def register_service(s):
'''
info - either a callable, which has its URL as the serviceid attribute
or a tuple of (serviceid, callable)
Note: rgistration of remote services is done i... | #freemixlib
__version__ = '0.9.3.2'
#Mapping from service ID URI too URL template and/or callable
SERVICES = {}
def register_service(s):
'''
info - either a callable, which has its URL as the serviceid attribute
or a tuple of (serviceid, callable)
Note: rgistration of remote services is done i... | apache-2.0 | Python |
21b56cea2ffa8ba74b2be1903e786cb2619905f1 | Convert Slack @ mentions to usernames | laneshetron/monopoly | monopoly/Bank/Slack.py | monopoly/Bank/Slack.py | from Bank.Base import Base
import re
class Bank(Base):
def __init__(self, team):
self.users = {}
self.channels = {}
if 'users' in team:
for user in team['users']:
self.users[user['id']] = user
if 'channels' in team:
for channel in team['chann... | from Bank.Base import Base
class Bank(Base):
def __init__(self, team):
self.users = {}
self.channels = {}
if 'users' in team:
for user in team['users']:
self.users[user['id']] = user
if 'channels' in team:
for channel in team['channels']:
... | mit | Python |
1c6e81052927dd2e9d5ef1fc31432f8bf1fff7dc | update durations for tablature notation | msbmsb/wordstrument,msbmsb/wordstrument | lib/duration.py | lib/duration.py | """
duration.py:
Given a string, calculate the duration of the corresponding note.
The average English word is roughly 5 characters long, based on that:
# of characters note duration
0-1 1/16th
2-3 1/8th
4-6 1/4
7-8 1/2
9-10 1
11+ ... | """
duration.py:
Given a string, calculate the duration of the corresponding note.
The average English word is roughly 5 characters long, based on that:
# of characters note duration
0-1 1/16th
2-3 1/8th
4-6 1/4
7-8 1/2
9-10 1
11+ ... | mit | Python |
381c75be231cdc3338596df50d81970ffe8fb322 | Add `filters` to the list of imports. | nanshe-org/nanshe,DudLab/nanshe,DudLab/nanshe,nanshe-org/nanshe,jakirkham/nanshe,jakirkham/nanshe | nanshe/imp/__init__.py | nanshe/imp/__init__.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Apr 14, 2014 20:37:08 EDT$"
__all__ = [
"advanced_image_processing", "binary_image_processing", "denoising",
"filters", # "neuron_matplotlib_viewer",
"registration", "simple_image_processing", "wavelet_transform"
]
import advanced_image... | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Apr 14, 2014 20:37:08 EDT$"
__all__ = [
"advanced_image_processing", "binary_image_processing", "denoising",
# "neuron_matplotlib_viewer",
"registration", "simple_image_processing", "wavelet_transform"
]
import advanced_image_processing
... | bsd-3-clause | Python |
59daf205869c42b3797aa9dbaaa97930cbca2417 | Add function to check if nbserverproxy is running | nanshe-org/nanshe_workflow,DudLab/nanshe_workflow | nanshe_workflow/ipy.py | nanshe_workflow/ipy.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Nov 10, 2015 17:09$"
import json
import re
try:
from IPython.utils.shimmodule import ShimWarning
except ImportError:
class ShimWarning(Warning):
"""Warning issued by IPython 4.x regarding deprecated API."""
pass
import warn... | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Nov 10, 2015 17:09$"
try:
from IPython.utils.shimmodule import ShimWarning
except ImportError:
class ShimWarning(Warning):
"""Warning issued by IPython 4.x regarding deprecated API."""
pass
import warnings
with warnings.cat... | apache-2.0 | Python |
2fc8b7e98594c0a3a8c2e4c285dcf3923f247b92 | allow reuse address | cenkalti/kuyruk,cenkalti/kuyruk | kuyruk/manager/server.py | kuyruk/manager/server.py | import Queue
from pprint import pformat
from functools import total_ordering
from SocketServer import ThreadingTCPServer, BaseRequestHandler
from kuyruk.manager.messaging import message_loop
class ManagerServer(ThreadingTCPServer):
daemon_threads = True
allow_reuse_address = True
def __init__(self, hos... | import Queue
from pprint import pformat
from functools import total_ordering
from SocketServer import ThreadingTCPServer, BaseRequestHandler
from kuyruk.manager.messaging import message_loop
class ManagerServer(ThreadingTCPServer):
daemon_threads = True
def __init__(self, host, port):
self.clients ... | mit | Python |
97744ad54911e25210a89bb9fc92fab23dbfde2a | add test. what happens when company name does not match anything | kern3020/opportunity,kern3020/opportunity | opportunity/tracker/tests.py | opportunity/tracker/tests.py | from django.utils import unittest
from models import Company
from views import populateCompany
class FetchFromCrunch(unittest.TestCase):
def test_normal(self):
'''
The simpliest case is a single token with no special characters
which matches a specific company in crunchbase.
'''
... | from django.utils import unittest
from models import Company
from views import populateCompany
class FetchFromCrunch(unittest.TestCase):
def test_normal(self):
'''
The simpliest case is a single token with no special characters
which matches a specific company in crunchbase.
'''
... | mit | Python |
47ca06c56096225b0cb92ead9459186dcb3a182f | add blank=true at manager | bungoume/labobooks,bungoume/labobooks | labobooks/core/models.py | labobooks/core/models.py | from django.db import models
# class Library(models.Model):
# ...
# class BookShelf(models.Model):
# name = models.CharField("研究室名", max_length=191)
class MyBook(models.Model):
book_info = models.ForeignKey('BookInfo')
buy_date = models.DateField("購入日", null=True)
buy_user = models.CharField("購... | from django.db import models
# class Library(models.Model):
# ...
# class BookShelf(models.Model):
# name = models.CharField("研究室名", max_length=191)
class MyBook(models.Model):
book_info = models.ForeignKey('BookInfo')
buy_date = models.DateField("購入日", null=True)
buy_user = models.CharField("購... | mit | Python |
39904e39f1ac163ee17c293372ab97af48a1b37e | Add time/space complexity | bowen0701/algorithms_data_structures | lc118_pascal_triangle.py | lc118_pascal_triangle.py | """Leetcode 118. Pascal's Triangle
Easy
Given a non-negative integer numRows, generate the first numRows of Pascal's triangle.
In Pascal's triangle, each number is the sum of the two numbers directly above it.
Example:
Input: 5
Output:
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
]
"""
class Solutio... | """Leetcode 118. Pascal's Triangle
Easy
Given a non-negative integer numRows, generate the first numRows of Pascal's triangle.
In Pascal's triangle, each number is the sum of the two numbers directly above it.
Example:
Input: 5
Output:
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
]
"""
class Solutio... | bsd-2-clause | Python |
2be92936ca87dbacb5c1c2b4e4b0103b741f005c | Add comments on checking left pos is target | bowen0701/algorithms_data_structures | lc0034_find_first_and_last_position_of_element_in_sorted_array.py | lc0034_find_first_and_last_position_of_element_in_sorted_array.py | """Leetcode 34. Find left and right Position of Element in Sorted Array
Medium
URL: https://leetcode.com/problems/find-left-and-right-position-of-element-in-sorted-array
Given an array of integers nums sorted in ascending order,
find the starting and ending position of a given target value.
Your algorithm's runtime... | """Leetcode 34. Find left and right Position of Element in Sorted Array
Medium
URL: https://leetcode.com/problems/find-left-and-right-position-of-element-in-sorted-array
Given an array of integers nums sorted in ascending order,
find the starting and ending position of a given target value.
Your algorithm's runtime... | bsd-2-clause | Python |
04302fd46ec1fc2b5e8846983642f0663bc3d73c | Add failed upload status | TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary | src/tmlib/models/status.py | src/tmlib/models/status.py | class FileUploadStatus(object):
'''Upload status of a file.'''
#: The file is registered, but upload not yet started
WAITING = 'WAITING'
#: Upload is ongoing
UPLOADING = 'UPLOADING'
#: Upload is complete
COMPLETE = 'COMPLETE'
#: Upload has failed
FAILED = 'FAILED'
| class FileUploadStatus(object):
'''Upload status of a file.'''
#: The file is registered, but upload not yet started
WAITING = 'WAITING'
#: Upload is ongoing
UPLOADING = 'UPLOADING'
#: Upload is complete
COMPLETE = 'COMPLETE'
| agpl-3.0 | Python |
cbb62604b0cd495ec9d0fd64ca96d1d50e48df2f | use sure for signals tests | Amoki/Amoki-Music,Amoki/Amoki-Music,Amoki/Amoki-Music | player/tests/test_signals.py | player/tests/test_signals.py | from utils.testcase import TestCase
from player.models import Events, Room
import sure
class TestSignals(TestCase):
def test_update_token_on_password_change(self):
first_token = self.r.token
self.r.password = 'b'
self.r.save()
self.r.token.should_not.eql(first_token)
def te... | from utils.testcase import TestCase
from player.models import Events, Room
class TestSignals(TestCase):
def test_update_token_on_password_change(self):
first_token = self.r.token
self.r.password = 'b'
self.r.save()
self.assertNotEqual(self.r.token, first_token)
def test_crea... | mit | Python |
bca2c3eed387125296f14d7544ba9887065bf1d8 | use 4-space indentation | zmwangx/you-get,xyuanmu/you-get,zmwangx/you-get,smart-techs/you-get,cnbeining/you-get,qzane/you-get,xyuanmu/you-get,cnbeining/you-get,qzane/you-get,smart-techs/you-get | src/you_get/util/strings.py | src/you_get/util/strings.py | try:
# py 3.4
from html import unescape as unescape_html
except ImportError:
import re
from html.entities import entitydefs
def unescape_html(string):
'''HTML entity decode'''
string = re.sub(r'&#[^;]+;', _sharp2uni, string)
string = re.sub(r'&[^;]+;', lambda m: entitydefs[m... | try:
# py 3.4
from html import unescape as unescape_html
except ImportError:
import re
from html.entities import entitydefs
def unescape_html(string):
'''HTML entity decode'''
string = re.sub(r'&#[^;]+;', _sharp2uni, string)
string = re.sub(r'&[^;]+;', lambda m: entitydefs[m.group(0)[1:-1]], stri... | mit | Python |
98db64a4b505572c5b1db8a0d3f4623752daaefa | update East Herts import script for parl.2017-06-08 (closes #945) | chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_east_hertfordshire.py | polling_stations/apps/data_collection/management/commands/import_east_hertfordshire.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000242'
addresses_name = 'parl.2017-06-08/Version 1/East Herts Democracy_Club__08June2017.tsv'
stations_name = 'parl.2017-06-08/Version 1/East Herts Democra... | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000242'
addresses_name = 'Democracy_Club__04May2017 (5).CSV'
stations_name = 'Democracy_Club__04May2017 (5).CSV'
elections = ['parl.2017-06-08']
de... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.