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 |
|---|---|---|---|---|---|---|---|---|
3f087a69e3e907e68fe99030bb191f9c5b089de7 | Add space after UNZIP command. | rasmus-toftdahl-olesen/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,micronpn/sequanto-automation,seqzap/sequanto-automation,seqzap/sequanto-automation,micronpn/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,micronpn/sequanto-automation,micronpn/sequanto-automation,rasmus-toftdahl-olese... | test_qmake_build.py | test_qmake_build.py | #!/usr/bin/python
import sys
import subprocess
import os
from os import path
import shutil
def call ( cmdline ):
retcode = subprocess.call ( cmdline, shell = True )
assert ( retcode == 0 )
CMAKE = 'cmake'
GENERATORARGS = ''
MAKE = 'make -j 2 '
UNZIP = 'unzip'
MV = 'mv'
if sys.platform == 'win32':
CMAKE =... | #!/usr/bin/python
import sys
import subprocess
import os
from os import path
import shutil
def call ( cmdline ):
retcode = subprocess.call ( cmdline, shell = True )
assert ( retcode == 0 )
CMAKE = 'cmake'
GENERATORARGS = ''
MAKE = 'make -j 2 '
UNZIP = 'unzip'
MV = 'mv'
if sys.platform == 'win32':
CMAKE =... | apache-2.0 | Python |
c67d650d7d72068694d94f1190a0b8c215ee25ca | fix a bug with funcarg setup and remove XXX comment because "scope=module" now would work but leaving it as session for now. | pytest-dev/execnet,alfredodeza/execnet | testing/conftest.py | testing/conftest.py | import py
def pytest_generate_tests(metafunc):
if 'gw' in metafunc.funcargnames:
if hasattr(metafunc.cls, 'gwtype'):
gwtypes = [metafunc.cls.gwtype]
else:
gwtypes = ['popen', 'socket', 'ssh']
for gwtype in gwtypes:
metafunc.addcall(id=gwtype, param=gwtype... | import py
def pytest_generate_tests(metafunc):
if 'gw' in metafunc.funcargnames:
if hasattr(metafunc.cls, 'gwtype'):
gwtypes = [metafunc.cls.gwtype]
else:
gwtypes = ['popen', 'socket', 'ssh']
for gwtype in gwtypes:
metafunc.addcall(id=gwtype, param=gwtype... | mit | Python |
fe35867409af3bdf9898b68ce356ef00b865ff29 | Change version to 1.0.2 (stable) | xcgd/account_credit_transfer | __openerp__.py | __openerp__.py | # -*- coding: utf-8 -*-
{
"name": "Account Credit Transfer",
"version": "1.0.2",
"author": "XCG Consulting",
"website": "http://www.openerp-experts.com",
"category": 'Accounting',
"description": """Account Voucher Credit Transfer Payment.
You need to set up some things before using it.
... | # -*- coding: utf-8 -*-
{
"name": "Account Credit Transfer",
"version": "1.0.1",
"author": "XCG Consulting",
"website": "http://www.openerp-experts.com",
"category": 'Accounting',
"description": """Account Voucher Credit Transfer Payment.
You need to set up some things before using it.
... | agpl-3.0 | Python |
2ebe62217f646ede745f5e148902d8570dba09dd | add tests for games and players methods | danielwillgeorge/ESPN-fantasy-football-analytics | tests/basic_test.py | tests/basic_test.py | import unittest
import sys
import pandas as pd
import espnfantasyfootball
from espnfantasyfootball.api import teams
#sys.path.append("/Users/daniel.george/Desktop/github/ESPN-fantasy-football-analytics/fantasy-football-analytics")
#from api import teams
"""Tests for ESPN-fantasy-football-analytics."""
class BasicT... | import unittest
import sys
import pandas as pd
sys.path.append("/Users/daniel.george/Desktop/github/ESPN-fantasy-football-analytics/fantasy-football-analytics")
import espnfantasyfootball
from espnfantasyfootball.api import teams
#from api import teams
"""Tests for ESPN-fantasy-football-analytics."""
class BasicT... | mit | Python |
563f2e153437e7f78e05ed9dade1bd1690bef6a5 | Add session_timeout to ReservationAdmin list_display | Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet | karspexet/ticket/admin.py | karspexet/ticket/admin.py | from django.contrib import admin
from karspexet.ticket.models import Account, Reservation, Ticket, Voucher, PricingModel
class ReservationAdmin(admin.ModelAdmin):
list_display = ('show', 'total', 'finalized', 'reservation_code', 'session_timeout', 'tickets')
list_filter = ('finalized', 'show')
class Ticket... | from django.contrib import admin
from karspexet.ticket.models import Account, Reservation, Ticket, Voucher, PricingModel
class ReservationAdmin(admin.ModelAdmin):
list_display = ('show', 'total', 'finalized', 'reservation_code', 'tickets')
list_filter = ('finalized', 'show')
class TicketAdmin(admin.ModelAd... | mit | Python |
5f1715307587a3ac429bea716919ed52b8550934 | add a import line for fasta | schae234/LocusPocus,LinkageIO/LocusPocus | locuspocus/__init__.py | locuspocus/__init__.py | __version__ = '0.1.0'
__all__ = ['Locus']
#import pyximport
#pyximport.install()
from .Locus import Locus
from .Loci import Loci
from .Fasta import Fasta
| __version__ = '0.1.0'
__all__ = ['Locus']
#import pyximport
#pyximport.install()
from .Locus import Locus
from .Loci import Loci
| mit | Python |
ec3d9798994453c1e15f9bab072318a518de26b7 | Fix py-llvmlite (#14083) | LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-llvmlite/package.py | var/spack/repos/builtin/packages/py-llvmlite/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyLlvmlite(PythonPackage):
"""A lightweight LLVM python binding for writing JIT compilers"... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyLlvmlite(PythonPackage):
"""A lightweight LLVM python binding for writing JIT compilers"... | lgpl-2.1 | Python |
d8dbbe04b00452274016f6938400010ea9103bcc | change the "rules" in policy to 'object' type | darren-wang/ks3,darren-wang/ks3 | keystone/policy/schema.py | keystone/policy/schema.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | apache-2.0 | Python |
f932504ad5fb4e4973e54260a8ce97ee2a3e096a | Allow runtable to print compact view | tamasgal/km3pipe,tamasgal/km3pipe | km3pipe/utils/runtable.py | km3pipe/utils/runtable.py | # Filename: runtable.py
"""
Prints the run table for a given detector ID.
Usage:
runtable [options] DET_ID
runtable (-h | --help)
runtable --version
Options:
-h --help Show this screen.
-c Compact view.
-n RUNS Number of runs.
-s REGEX Regu... | # Filename: runtable.py
"""
Prints the run table for a given detector ID.
Usage:
runtable [-n RUNS] [-s REGEX] DET_ID
runtable (-h | --help)
runtable --version
Options:
-h --help Show this screen.
-n RUNS Number of runs.
-s REGEX Regular expression to filter th... | mit | Python |
a38efe3fe3a717d9ad91bfc6aacab90989cd04a4 | Bump develop version [ci skip] | nephila/djangocms-page-meta,nephila/djangocms-page-meta | djangocms_page_meta/__init__.py | djangocms_page_meta/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
__version__ = '0.8.5.post1'
__author__ = 'Iacopo Spalletti <i.spalletti@nephila.it>'
default_app_config = 'djangocms_page_meta.apps.PageMetaConfig'
| # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
__version__ = '0.8.5'
__author__ = 'Iacopo Spalletti <i.spalletti@nephila.it>'
default_app_config = 'djangocms_page_meta.apps.PageMetaConfig'
| bsd-3-clause | Python |
3b1482b3e61f8de2e64c336bb12d24318037323b | adjust migration script path not found | Ouranosinc/Magpie,Ouranosinc/Magpie,Ouranosinc/Magpie | run_migration.py | run_migration.py | import os
curr_dir = os.path.dirname(__file__)
if curr_dir == '':
curr_dir = os.path.abspath('.')
alembic_ini = '{}/alembic.ini'.format(curr_dir)
os.system('alembic -c {} upgrade heads'.format(alembic_ini))
| import os
curr_dir = os.path.dirname(__file__)+'/alembic.ini'
os.system('alembic -c {} upgrade heads'.format(curr_dir)) | apache-2.0 | Python |
919c9a9fe9a4bbced0a460a0cd1cfa05e427eef2 | Fix recursive init | stencila/hub,stencila/hub,stencila/hub,stencila/hub,stencila/hub | director/general/custom_storages.py | director/general/custom_storages.py | '''
Allow for one S3 bucket with different roots for static and "media" (user uploads)
See:
http://stackoverflow.com/questions/10390244/how-to-set-up-a-django-project-with-django-storages-and-amazon-s3-but-with-diff
https://gist.github.com/defrex/82680e858281d3d3e6e4
http://www.laurii.info/2013/05/improve-s3boto-dj... | '''
Allow for one S3 bucket with different roots for static and "media" (user uploads)
See:
http://stackoverflow.com/questions/10390244/how-to-set-up-a-django-project-with-django-storages-and-amazon-s3-but-with-diff
https://gist.github.com/defrex/82680e858281d3d3e6e4
http://www.laurii.info/2013/05/improve-s3boto-dj... | apache-2.0 | Python |
2bb618031134358240132fdcf6f67b746dc38109 | update styling of evaluation metrics | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | disaggregator/evaluation_metrics.py | disaggregator/evaluation_metrics.py | import numpy as np
import math
import scipy
def sum_error(truth,prediction):
'''
Given a numpy array of truth values and prediction values, returns the
absolute value of the difference between their sums.
'''
return math.fabs(truth.sum()-prediction.sum())
def rss(truth,prediction):
'''Sum of s... | import numpy as np
import math
import scipy
def sum_error(truth,prediction):
'''For a numpy array of truth values and prediction values returns the absolute value of the difference between their sums'''
return math.fabs(truth.sum()-prediction.sum())
def rss(truth,prediction):
'''Sum of squared residuals''... | mit | Python |
c7355960600312c624cdfa919894684a9952753a | fix vocab2lex | phsmit/iwclul2016-scripts,phsmit/iwclul2016-scripts,phsmit/iwclul2016-scripts | 02_amtraining/base_scripts/vocab2lex.py | 02_amtraining/base_scripts/vocab2lex.py | #!/usr/bin/env python3
import sys
def main(phone_map, abbreviations):
phone_map = {v[0]: v[1].strip()
for v in (l.split(None, 1)
for l in open(phone_map, encoding='utf-8'))}
abbr_map = {v[0]: v[1].strip().split(',')
for v in (l.split(None, 1)
... | #!/usr/bin/env python3
import sys
def main(phone_map, abbreviations):
phone_map = {v[0]: v[1].strip()
for v in (l.split(None, 1)
for l in open(phone_map, encoding='utf-8'))}
abbr_map = {v[0]: v[1].strip().split(',')
for v in (l.split(None, 1)
... | bsd-3-clause | Python |
4fe4a32442e2b54abec73b4e9913ca50b851875c | Add import exception for docker-py | DimensionDataCBUSydney/mist.io,kelonye/mist.io,johnnyWalnut/mist.io,munkiat/mist.io,munkiat/mist.io,DimensionDataCBUSydney/mist.io,DimensionDataCBUSydney/mist.io,zBMNForks/mist.io,Lao-liu/mist.io,afivos/mist.io,DimensionDataCBUSydney/mist.io,Lao-liu/mist.io,munkiat/mist.io,johnnyWalnut/mist.io,kelonye/mist.io,munkiat/m... | src/mist/io/tests/helpers/docker_utils.py | src/mist/io/tests/helpers/docker_utils.py | try:
import docker
from mist.io.tests.settings import docker_nodes
except ImportError:
pass
def select_docker():
"""
Choose the container with the minimum load
"""
nodes = []
for node in docker_nodes:
nodes.append(docker.Client(base_url=node, version='1.10'))
if len(nodes)... | import docker
from mist.io.tests.settings import docker_nodes
def select_docker():
"""
Choose the container with the minimum load
"""
nodes = []
for node in docker_nodes:
nodes.append(docker.Client(base_url=node, version='1.10'))
if len(nodes) == 1:
chosen_node = nodes[0]
... | agpl-3.0 | Python |
f0adb9022408dbcfdbe7e83dc0633d560be4f533 | Use HTML5 date inputs for due_date | shacker/django-todo,shacker/django-todo,shacker/django-todo | todo/forms.py | todo/forms.py | from django import forms
from django.forms import ModelForm
from django.contrib.auth.models import Group
from todo.models import Item, List
from django.contrib.auth import get_user_model
class AddListForm(ModelForm):
# The picklist showing allowable groups to which a new list can be added
# determines which g... | from django import forms
from django.forms import ModelForm
from django.contrib.auth.models import Group
from todo.models import Item, List
from django.contrib.auth import get_user_model
class AddListForm(ModelForm):
# The picklist showing allowable groups to which a new list can be added
# determines which g... | bsd-3-clause | Python |
4a0b5197b24e91413f3770c91dd460db25848df2 | Add a unit test for the default command | Sakshisaraswat/todoman,rimshaakhan/todoman,AnubhaAgrawal/todoman,pimutils/todoman,asalminen/todoman,hobarrera/todoman | tests/test_basic.py | tests/test_basic.py | import pytest
from todoman.cli import cli
def test_basic(tmpdir, runner):
result = runner.invoke(cli, ['list'], catch_exceptions=False)
assert not result.exception
assert result.output == ''
tmpdir.join('default/test.ics').write(
'BEGIN:VCALENDAR\n'
'BEGIN:VTODO\n'
'SUMMARY:h... | import pytest
from todoman.cli import cli
def test_basic(tmpdir, runner):
result = runner.invoke(cli, ['list'], catch_exceptions=False)
assert not result.exception
assert result.output == ''
tmpdir.join('default/test.ics').write(
'BEGIN:VCALENDAR\n'
'BEGIN:VTODO\n'
'SUMMARY:h... | isc | Python |
250ca36a6f2db3d38f34015b6094fc21e358db5e | Increase max_retries for flaky test | guoguo12/billboard-charts,guoguo12/billboard-charts | tests/test_dates.py | tests/test_dates.py | import datetime
import unittest
import billboard
from nose.tools import raises
class DateTest(unittest.TestCase):
def testDateRounding(self):
"""Checks that the Billboard website is rounding dates correctly: it should
round up to the nearest date on which a chart was published.
"""
... | import datetime
import unittest
import billboard
from nose.tools import raises
class DateTest(unittest.TestCase):
def testDateRounding(self):
"""Checks that the Billboard website is rounding dates correctly: it should
round up to the nearest date on which a chart was published.
"""
... | mit | Python |
54e44f45e1ae7bed79fff482cfabbbf242bd9056 | Add a test for trailing commas | alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net | tests/test_links.py | tests/test_links.py | #!/usr/bin/env python
# -*- encoding: utf-8
import pytest
import requests
@pytest.mark.parametrize('path', [
# Check pagination is working correctly
'/page/2/', '/page/3/',
])
def test_pages_appear_correctly(path):
resp = requests.get(f'http://localhost:5757/{path}')
assert resp.status_code == 200
... | #!/usr/bin/env python
# -*- encoding: utf-8
import pytest
import requests
@pytest.mark.parametrize('path', [
# Check pagination is working correctly
'/page/2/', '/page/3/',
])
def test_pages_appear_correctly(path):
resp = requests.get(f'http://localhost:5757/{path}')
assert resp.status_code == 200
... | mit | Python |
8889b5e85308d2c8b276e5b678de32cabe26516f | expand multisite tests | SexualHealthInnovations/callisto-core,project-callisto/callisto-core,scattermagic/django-wizard-builder,SexualHealthInnovations/django-wizard-builder,SexualHealthInnovations/django-wizard-builder,project-callisto/callisto-core,SexualHealthInnovations/callisto-core,scattermagic/django-wizard-builder | tests/test_sites.py | tests/test_sites.py | from wizard_builder.models import QuestionPage
from django.contrib.sites.models import Site
from django.test import TestCase
class SitePageTest(TestCase):
def test_basic_created_question_page_comes_with_a_site(self):
page = QuestionPage.objects.create()
self.assertEqual(page.site.domain, 'exampl... | from wizard_builder.models import QuestionPage
from django.test import TestCase
class SitePageTest(TestCase):
def test_basic_created_question_page_comes_with_a_site(self):
page = QuestionPage.objects.create()
self.assertEqual(page.site.domain, 'example.com')
| agpl-3.0 | Python |
dd78cfb80f17adeb431119a7693be5d1a727e384 | expand site_id tests further! | scattermagic/django-wizard-builder,SexualHealthInnovations/callisto-core,SexualHealthInnovations/django-wizard-builder,project-callisto/callisto-core,project-callisto/callisto-core,SexualHealthInnovations/callisto-core,scattermagic/django-wizard-builder,SexualHealthInnovations/django-wizard-builder | tests/test_sites.py | tests/test_sites.py | from wizard_builder.models import QuestionPage
from django.contrib.sites.models import Site
from django.test import TestCase
from django.conf import settings
class TempSiteID():
'''
with TempSiteID(1):
...
'''
def __init__(self, site_id):
self.site_id_temp = site_id
def _... | from wizard_builder.models import QuestionPage
from django.contrib.sites.models import Site
from django.test import TestCase
class SitePageTest(TestCase):
def test_basic_created_question_page_comes_with_a_site(self):
page = QuestionPage.objects.create()
self.assertEqual(page.site.domain, 'exampl... | agpl-3.0 | Python |
24f1f686c5cdc9a2272adbea7d1c2e1eb481dc8d | Make vertical white space after license header consistent | varunarya10/oslo.i18n,openstack/oslo.i18n | tests/unit/fakes.py | tests/unit/fakes.py | # Copyright 2012 Intel Inc, 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.apache.org/licenses/LICENSE-2.0
#
# ... | # Copyright 2012 Intel Inc, 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.apache.org/licenses/LICENSE-2.0
#
# ... | apache-2.0 | Python |
c37c53b45580179440dcda701b7d94b0f8b9eb47 | add source command | tipsi/tipsi_tools,tipsi/tipsi_tools | tipsi_tools/unix.py | tipsi_tools/unix.py | import os
import socket
import subprocess
import time
import re
from contextlib import closing
from collections import ChainMap
def _prepare(out):
out = out.decode('utf8').strip('\n').split('\n')
if out == ['']:
return []
return out
def run(command):
'''
Run command in shell, accepts com... | import os
import socket
import subprocess
import time
from contextlib import closing
from collections import ChainMap
def _prepare(out):
out = out.decode('utf8').strip('\n').split('\n')
if out == ['']:
return []
return out
def run(command):
'''
Run command in shell, accepts command const... | mit | Python |
aad92644d01994685d20121def511da2765adfad | Add neighbrhood property to row | datascopeanalytics/chicago-new-business,datascopeanalytics/chicago-new-business | src/data.py | src/data.py | import csv
import datetime
class Row(dict):
def __init__(self, *args, **kwargs):
super(Row, self).__init__(*args, **kwargs)
self._start_date = None
self._end_date = None
def _cast_date(self, s):
if not s:
return None
return datetime.datetime.strptime(s, '%... | import csv
import datetime
class Row(dict):
def __init__(self, *args, **kwargs):
super(Row, self).__init__(*args, **kwargs)
self._start_date = None
self._end_date = None
def _cast_date(self, s):
if not s:
return None
return datetime.datetime.strptime(s, '%... | unlicense | Python |
31a7e838b971fc9063c9dd7c35129f857fda6e0a | Include author name | CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer | wafer/management/commands/wafer_talk_video_reviewers.py | wafer/management/commands/wafer_talk_video_reviewers.py | import sys
import csv
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL
class Command(BaseCommand):
help = ("List talks and the associated video_reviewer emails."
" Only reviewers for accepted... | import sys
import csv
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL
class Command(BaseCommand):
help = ("List talks and the associated video_reviewer emails."
" Only reviewers for accepted... | isc | Python |
6ec7fac46c0970a91398b5f43168821fd4f3eb5c | Update main.py | bwolatz/CSCI4900,bwolatz/CSCI4900 | src/main.py | src/main.py | #!/usr/bin/env python
"""Imports"""
import subprocess
import glob
import os
import re
pomdir = os.getcwd()
jardir = pomdir + "/jars"
treedir = pomdir + "/tree"
mvncommand = "mvn -q dependency:copy-dependencies -DcopyPom=true -DoutputDirectory="+jardir
mvncommand2 = "mvn -q dependency:tree -Doutput=" + treedir + "/tree.... | #!/usr/bin/env python
"""Imports"""
import subprocess
import glob
import os
currentdir = "/usr/share/fossology/nomos/agent/jars"
pomdir = "/usr/share/fossology/nomos/agent/"
mvncommand = "mvn -q dependency:copy-dependencies -DcopyPom=true -DoutputDirectory="+currentdir
mvncommand2 = "mvn dependency:tree -Dout... | mit | Python |
14b5ac625bd676518997ec4d7073ac01efdcfbb8 | Update 3n+1.py | TheAlgorithms/Python | Maths/3n+1.py | Maths/3n+1.py | def main():
def n31(a):# a = initial number
c = 0
l = [a]
while a != 1:
if a % 2 == 0:#if even divide it by 2
a = a // 2
elif a % 2 == 1:#if odd 3n+1
a = 3*a +1
c += 1#counter
l += [a]
return l , c
p... | def main():
def n31(a):# a = initial number
c = 0
l = [a]
while a != 1:
if a % 2 == 0:#if even divide it by 2
a = a // 2
elif a % 2 == 1:#if odd 3n+1
a = 3*a +1
c += 1#counter
l += [a]
return l , c
p... | mit | Python |
5fe4575a6618b30456ff283a75e01f0ea68d3e7f | Optimize RGen. | vlinhd11/apk-signer,akhirasip/apk-signer,akhirasip/apk-signer,vlinhd11/apk-signer | tools/RGen.py | tools/RGen.py | #!/usr/bin/python3
# Copyright (C) 2012 Hai Bison
#
# See the file LICENSE at the root directory of this project for copying
# permission.
'''
This tool parses `messages.properties` and generates all strings to their
respective IDs, which can be put into class R.string.
'''
import os
import os.path
import re
impo... | #!/usr/bin/python3
# Copyright (C) 2012 Hai Bison
#
# See the file LICENSE at the root directory of this project for copying
# permission.
'''
This tool parses `messages.properties` and generates all strings to their
respective IDs, which can be put into class R.string.
'''
import os
import os.path
import re
impo... | mit | Python |
86305247d60feeafa529877f9141949fce20d523 | Make plot target axis configureable | dseuss/pythonlibs | tools/plot.py | tools/plot.py | #!/usr/bin/env python
# encoding: utf-8
"""Tools making everyday plotting tasks easier."""
from __future__ import division, print_function
import numpy as np
from matplotlib import pyplot as pl
def plot(function, intervall, num=500, axis=None, **kwargs):
"""Plots the function f on the axisis axis on the interval... | #!/usr/bin/env python
# encoding: utf-8
"""Tools making everyday plotting tasks easier."""
from __future__ import division, print_function
import numpy as np
from matplotlib import pyplot as pl
def plot(function, intervall, num=500, axis=None, **kwargs):
"""Plots the function f on the axisis axis on the interval... | unlicense | Python |
188de0dae55449dc1d6a15917423b2ec9d9a3fc1 | change owner to eventkit | terranodo/eventkit-cloud,venicegeo/eventkit-cloud,terranodo/eventkit-cloud,venicegeo/eventkit-cloud,terranodo/eventkit-cloud,venicegeo/eventkit-cloud,venicegeo/eventkit-cloud,venicegeo/eventkit-cloud,venicegeo/eventkit-cloud,terranodo/eventkit-cloud | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
import pwd
import grp
if __name__ == "__main__":
if os.getenv("PRODUCTION"):
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eventkit_cloud.settings.prod")
else:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eventkit_cloud.settings.dev")
from ... | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
if os.getenv("PRODUCTION"):
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eventkit_cloud.settings.prod")
else:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eventkit_cloud.settings.dev")
from django.core.management... | bsd-3-clause | Python |
0976ce5424e9b4699152513821ea15473f715dab | Fix manage.py (remove CR from newlines) | dragonfly-science/django-pigeonpost,dragonfly-science/django-pigeonpost | manage.py | manage.py | #!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("""Error: Can't find the file 'settings.py' in the directory containing %r.
It appears you've customized things.
You'll have... | #!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("""Error: Can't find the file 'settings.py' in the directory containing %r.
It appears you've customized things.
You... | mit | Python |
83afe8cf85be49af16c8e6da7110fb76a38b5843 | Drop unicode compatibility handling | pinax/pinax-blog,pinax/pinax-blog,pinax/pinax-blog | pinax/blog/conf.py | pinax/blog/conf.py | from django.conf import settings # noqa
from appconf import AppConf
from .utils import load_path_attr
def is_installed(package):
try:
__import__(package)
return True
except ImportError:
return False
DEFAULT_MARKUP_CHOICE_MAP = {
"markdown": {"label": "Markdown", "parser": "pin... | from __future__ import unicode_literals
from django.conf import settings # noqa
from appconf import AppConf
from .utils import load_path_attr
def is_installed(package):
try:
__import__(package)
return True
except ImportError:
return False
DEFAULT_MARKUP_CHOICE_MAP = {
"markdo... | mit | Python |
ade3ae6e3889e9e8c73313130896922f0d2d9af2 | improve and add feature | Rostlab/LocText,juanmirocks/LocText,juanmirocks/LocText,Rostlab/LocText,Rostlab/LocText,juanmirocks/LocText | loctext/learning/annotators.py | loctext/learning/annotators.py | from nalaf.learning.taggers import RelationExtractor
from nalaf.learning.taggers import StubSameSentenceRelationExtractor
from nalaf.learning.svmlight import SVMLightTreeKernels
from nalaf.structures.relation_pipelines import RelationExtractionPipeline
from nalaf.features.relations import NamedEntityCountFeatureGenerat... | from nalaf.learning.taggers import RelationExtractor
from nalaf.structures.dataset_pipelines import PrepareDatasetPipeline
from nalaf.learning.taggers import StubSameSentenceRelationExtractor
from nalaf.learning.svmlight import SVMLightTreeKernels
from nalaf.structures.relation_pipelines import RelationExtractionPipeli... | apache-2.0 | Python |
bec3d37c6fc1ed61d3a528a8b54e1f9c4c98a4c9 | update doc string | AsylumConnect/asylum-connect-catalog,hack4impact/asylum-connect-catalog,hack4impact/flask-base,ColinHaley/Konsole,hack4impact/asylum-connect-catalog,AsylumConnect/asylum-connect-catalog,tobymccann/flask-base,ColinHaley/Konsole,AsylumConnect/asylum-connect-catalog,hack4impact/asylum-connect-catalog,tobymccann/flask-base... | manage.py | manage.py | #!/usr/bin/env python
import os
import subprocess
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.script import Manager, Shell
from redis import Redis
from rq import Connection, Queue, Worker
from app import create_app, db
from app.models import Role, User
if os.path.exists('.env'):
print('I... | #!/usr/bin/env python
import os
import subprocess
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.script import Manager, Shell
from redis import Redis
from rq import Connection, Queue, Worker
from app import create_app, db
from app.models import Role, User
if os.path.exists('.env'):
print('I... | mit | Python |
6747fc4a4e648aff5af8b4b865b52e9a5c9e8ca3 | Add manager command | KIGOTHO/hdx-age-api,luiscape/hdx-monitor-ageing-service,luiscape/hdx-monitor-ageing-service,reubano/HDX-Age-API,reubano/HDX-Age-API,KIGOTHO/hdx-age-api | manage.py | manage.py | #!/usr/bin/env python
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
import os.path as p
from subprocess import call, check_call
from flask import current_app as app
from flask.ext.script import Server, Manager
from config import Config as c
from app i... | #!/usr/bin/env python
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
import os.path as p
from subprocess import call, check_call
from flask import current_app as app
from flask.ext.script import Server, Manager
from config import Config as c
from app i... | mit | Python |
f43b3bc50e25f77a9bfbd18a3fb551a7cf644b18 | fix map generator to exclude .exe and .out files. | arunrajora/algorithms,arunrajora/algorithms,arunrajora/algorithms | mapgen.py | mapgen.py | import sys,os
root = "./codes/"
for path, subdirs, files in os.walk(root):
print "processing : "+path
print "\tfound "+str(len(files)+len(subdirs))+" files."
mapperFile=open(path+"/mapper.txt","w+")
for dir in subdirs:
print "\t\tadding directory : "+dir
mapperFile.write(dir+"\n");
for file in files:
if(fi... | import sys,os
root = "./codes/"
for path, subdirs, files in os.walk(root):
print "processing : "+path
print "\tfound "+str(len(files)+len(subdirs))+" files."
mapperFile=open(path+"/mapper.txt","w+")
for dir in subdirs:
print "\t\tadding directory : "+dir
mapperFile.write(dir+"\n");
for file in files:
if(fi... | mit | Python |
dff1c464b82cb870f589f5edf2e81b38fd78405f | add meta options | mathewmarcus/marshmallow-pynamodb | marshmallow_pynamodb/schema.py | marshmallow_pynamodb/schema.py | from marshmallow import Schema, SchemaOpts, post_load
from marshmallow.schema import SchemaMeta
from pynamodb.attributes import Attribute
from marshmallow_pynamodb.convert import converter
from six import with_metaclass
class ModelOpts(SchemaOpts):
def __init__(self, meta):
SchemaOpts.__init__(self, meta... | from marshmallow import Schema, SchemaOpts, post_load
from marshmallow.schema import SchemaMeta
from pynamodb.attributes import Attribute
from marshmallow_pynamodb.convert import converter
from six import with_metaclass
class ModelOpts(SchemaOpts):
def __init__(self, meta):
SchemaOpts.__init__(self, meta... | mit | Python |
2e3c85383fb3b8c8d9fc42abca1824f052d12886 | update test | hvy/chainer,okuta/chainer,chainer/chainer,hvy/chainer,wkentaro/chainer,okuta/chainer,niboshi/chainer,chainer/chainer,wkentaro/chainer,chainer/chainer,niboshi/chainer,niboshi/chainer,okuta/chainer,hvy/chainer,chainer/chainer,okuta/chainer,wkentaro/chainer,hvy/chainer,wkentaro/chainer,pfnet/chainer,niboshi/chainer | tests/chainer_tests/optimizer_hooks_tests/test_gradient_hard_clipping.py | tests/chainer_tests/optimizer_hooks_tests/test_gradient_hard_clipping.py | import unittest
import numpy as np
import chainer
from chainer import optimizer_hooks
from chainer import optimizers
from chainer import testing
_backend_params = [
# NumPy
{},
# {'use_ideep': 'always'},
# CuPy
{'use_cuda': True, 'cuda_device': 0},
# {'use_cuda': True, 'cuda_device': 1},
... | import unittest
import numpy as np
import chainer
from chainer import backend
import chainer.initializers as I
from chainer import optimizer_hooks
from chainer import optimizers
from chainer import testing
from chainer.testing import attr
class SimpleLink(chainer.Link):
def __init__(self, w, g):
super(... | mit | Python |
eddf5b2280300e6ddc98eb8be65a87fddb5df98e | Add comment | datalogai/recurrentshop | examples/speed_test.py | examples/speed_test.py | from recurrentshop import*
from keras.layers import*
from keras.models import*
import numpy as np
import time
import sys
# Script for comparing performance of native keras and recurrentshop stacked RNN implementations
# We observe 20-30% speed ups on GPU
sys.setrecursionlimit(10000000)
# Params
rnn, rnn_cell = LS... | from recurrentshop import*
from keras.layers import*
from keras.models import*
import numpy as np
import time
import sys
# Script for comparing performance of native keras and recurrentshop stacked RNN implementations
sys.setrecursionlimit(10000000)
# Params
rnn, rnn_cell = LSTM, LSTMCell
depth = 3
input_length =... | mit | Python |
19b9b6472dc08a797fb659032f9ec11f27845db1 | clean up some comments | tigfox/legendary-sniffle | Halpy/Halpy.py | Halpy/Halpy.py | #!/usr/bin/env python
#this is the most simplistic irc bot, meant as a first example for simple alerting
import socket
import sys
import time
import requests
from xml.etree import ElementTree
#constants
server = "irc.freenode.org"
channel = "#Synculus"
nick = "Halpy"
alert = ":!halp"
ack = ":!ack"
catsource = "http:/... | #!/usr/bin/env python
#this is the most simplistic irc bot, meant as a first example for simple alerting
import socket
import sys
import time
import requests
from xml.etree import ElementTree
#constants
#server = "irc.etsycorp.com"
server = "irc.freenode.org"
channel = "#Synculus"
nick = "Halpy"
alert = ":!halp"
ack ... | mit | Python |
3ecf2c0e0ce723ed1f908bc640b86cc3309fe72b | Bump to 4.2.0 | vimalloc/flask-jwt-extended | flask_jwt_extended/__init__.py | flask_jwt_extended/__init__.py | from .jwt_manager import JWTManager
from .utils import create_access_token
from .utils import create_refresh_token
from .utils import current_user
from .utils import decode_token
from .utils import get_csrf_token
from .utils import get_current_user
from .utils import get_jti
from .utils import get_jwt
from .utils impor... | from .jwt_manager import JWTManager
from .utils import create_access_token
from .utils import create_refresh_token
from .utils import current_user
from .utils import decode_token
from .utils import get_csrf_token
from .utils import get_current_user
from .utils import get_jti
from .utils import get_jwt
from .utils impor... | mit | Python |
45fb01c1587cb9dba546d3d8001c782d59bed5a3 | Update median.py | thomi137/Python-Samples | median.py | median.py | #!/usr/bin/python
#########################################################################################
# Sample program to read csv data generated from MS Excel and put it into a single table
# SQLite DB. Negative Number formatting is stripped and appended with a minus ('-') sign
#
# Copyright 2013 by Thomas Pro... | #!/usr/bin/python
-*- coding:utf-8 -*-
from random import Random
generator = Random()
x = [generator.randint(1,1000) for i in range(1000)]
k = ((len(x)//2) + (len(x)//n +1))//2 if len(x)%2 else len(x)//2
def quickselect(array, k):
pivot = generator.choice(array)
index = array.index(pivot)
a1, a2, a3 = [], [], [... | apache-2.0 | Python |
ed0d94a1f05f93ba59cb69a181b5665793e4d8d4 | Complete backtracking sol | bowen0701/algorithms_data_structures | lc0047_permutations_ii.py | lc0047_permutations_ii.py | """Leetcode 47. Permutations II
Medium
URL: https://leetcode.com/problems/permutations-ii/
Given a collection of numbers that might contain duplicates,
return all possible unique permutations.
Example:
Input: [1,1,2]
Output:
[
[1,1,2],
[1,2,1],
[2,1,1]
]
"""
class SolutionBacktrack(object):
def _backtrack... | """Leetcode 47. Permutations II
Medium
URL: https://leetcode.com/problems/permutations-ii/
Given a collection of numbers that might contain duplicates,
return all possible unique permutations.
Example:
Input: [1,1,2]
Output:
[
[1,1,2],
[1,2,1],
[2,1,1]
]
"""
class Solution(object):
def permuteUnique(self,... | bsd-2-clause | Python |
7535bd611b26fa81944058c49e7238bd67a5f577 | Exclude unnecessary fields for Enjaz | enjaz/enjaz,enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz | forms_builder/wrapper/forms.py | forms_builder/wrapper/forms.py | from django import forms
from django.forms.models import inlineformset_factory
from forms_builder.forms.models import Form, Field
class FormToBuildForm(forms.ModelForm):
"""
A form that is used to create or edit an instance of ``forms.models.Form``.
"""
class Meta:
model = Form
exclude... | from django import forms
from django.forms.models import inlineformset_factory
from forms_builder.forms.models import Form, Field
class FormToBuildForm(forms.ModelForm):
"""
A form that is used to create or edit an instance of ``forms.models.Form``.
"""
class Meta:
model = Form
# A form set t... | agpl-3.0 | Python |
953f99787e3578f4338752ce3099d530d021e725 | Add special case to add Side/SideOnly to difflist | Theerapak/MinecraftForge,brubo1/MinecraftForge,CrafterKina/MinecraftForge,RainWarrior/MinecraftForge,shadekiller666/MinecraftForge,Mathe172/MinecraftForge,Ghostlyr/MinecraftForge,Zaggy1024/MinecraftForge,mickkay/MinecraftForge,karlthepagan/MinecraftForge,fcjailybo/MinecraftForge,simon816/MinecraftForge,ThiagoGarciaAlve... | fml/generatechangedfilelist.py | fml/generatechangedfilelist.py | import sys
import os
import subprocess, shlex
mcp_root = os.path.abspath(sys.argv[1])
sys.path.append(os.path.join(mcp_root,"runtime"))
from filehandling.srgshandler import parse_srg
def cmdsplit(args):
if os.sep == '\\':
args = args.replace('\\', '\\\\')
return shlex.split(args)
def main():
list... | import sys
import os
import subprocess, shlex
mcp_root = os.path.abspath(sys.argv[1])
sys.path.append(os.path.join(mcp_root,"runtime"))
from filehandling.srgshandler import parse_srg
def cmdsplit(args):
if os.sep == '\\':
args = args.replace('\\', '\\\\')
return shlex.split(args)
def main():
list... | lgpl-2.1 | Python |
892bca4fbcb084b78b1b902c1bc1e2634f4e3d2f | use self.stdout.write | cordery/django-countries-plus,cordery/django-countries-plus | countries_plus/management/commands/update_countries_plus.py | countries_plus/management/commands/update_countries_plus.py | from countries_plus.utils import update_geonames_data
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Updates the Countries Plus database from geonames.org'
def handle(self, *args, **options):
num_updated, num_created = update_geonames_data()
self.stdo... | from django.core.management.base import BaseCommand
from countries_plus.utils import update_geonames_data
class Command(BaseCommand):
help = 'Updates the Countries Plus database from geonames.org'
def handle(self, *args, **options):
num_updated, num_created = update_geonames_data()
print "Co... | mit | Python |
496829572ecfbe485a6c086684179927e2787e5c | fix test | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/icds/tests/serializers/test_hosted_ccz_serializer.py | custom/icds/tests/serializers/test_hosted_ccz_serializer.py | from __future__ import absolute_import
from __future__ import unicode_literals
import mock
from django.test import TestCase
from custom.icds.models import (
HostedCCZ,
HostedCCZLink,
)
from custom.icds.serializers import HostedCCZSerializer
BUILD = {
'build_profiles': {
'12345': {'name': 'Dummy Bu... | from __future__ import absolute_import
from __future__ import unicode_literals
import mock
from django.test import TestCase
from custom.icds.models import (
HostedCCZ,
HostedCCZLink,
)
from custom.icds.serializers import HostedCCZSerializer
BUILD = {
'build_profiles': {
'12345': {'name': 'Dummy Bu... | bsd-3-clause | Python |
d71d76bc501ec93ba39b5aa94aeaee444145e123 | Fix forms without read only fields. | django-leonardo/django-leonardo,django-leonardo/django-leonardo,django-leonardo/django-leonardo,django-leonardo/django-leonardo | leonardo/module/media/admin/file/forms.py | leonardo/module/media/admin/file/forms.py |
from django.forms.models import modelformset_factory
from django.utils.translation import ugettext as _
from leonardo.forms import SelfHandlingModelForm
from leonardo.forms.fields.common import UserField
from leonardo.module.media.fields.folder import FolderField
from leonardo.module.media.models import File
class F... |
from django.forms.models import modelformset_factory
from django.utils.translation import ugettext as _
from leonardo.forms import SelfHandlingModelForm
from leonardo.forms.fields.common import UserField
from leonardo.module.media.fields.folder import FolderField
from leonardo.module.media.models import File
class F... | bsd-3-clause | Python |
4a26ed066bb5af254bb5aedce615dd502e1f8a79 | Update server.py | vanzhiganov/pySocket | server/server.py | server/server.py | import SocketServer
import time
import config
class TCPHandler(SocketServer.BaseRequestHandler):
def handle(self):
self.data = self.request.recv(1024).strip()
print "{} wrote:".format(self.client_address[0])
print "%s %s" % (int(time.time()), self.data)
# just send back the same ... | import SocketServer
import time
import config
class TCPHandler(SocketServer.BaseRequestHandler):
def handle(self):
self.data = self.request.recv(1024).strip()
print "{} wrote:".format(self.client_address[0])
print "%s %s" % (int(time.time()), self.data)
# just send back the same ... | unlicense | Python |
a1d16d931772c52c214706da6242e470ee9a29d1 | Extend User model | twschum/mix-mind,twschum/mix-mind,twschum/mix-mind,twschum/mix-mind | models.py | models.py | from flask_sqlalchemy import SQLAlchemy
import util
db = SQLAlchemy()
class User(db.Model):
""" User where email address is account key
"""
email = db.Column(db.String(120), primary_key=True, unique=True, nullable=False)
password = db.Column(db.String)
uuid_ = db.Column(db.String(36), unique=True... | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class User(db.Model):
uuid_ = db.Column(db.String(36), primary_key=True)
username = db.Column(db.String(80), unique=True, nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
authenticated = db.Column(db.Boolean, defau... | apache-2.0 | Python |
b532b66fd552fd886b4c03633d6dab9f96fb31d8 | Remove helper function from models | patrickspencer/lytics,patrickspencer/lytics,patrickspencer/lytics,patrickspencer/lytics | models.py | models.py | # -*- coding: utf-8 -*-
"""
models
~~~~~~
Model definitions and class methods
:copyright: (c) 2016 by Patrick Spencer.
:license: Apache 2.0, see LICENSE for more details.
"""
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, Boolean, Date, Time, \
... | # -*- coding: utf-8 -*-
"""
models
~~~~~~
Model definitions and class methods
:copyright: (c) 2016 by Patrick Spencer.
:license: Apache 2.0, see LICENSE for more details.
"""
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, Boolean, Date, Time, \
... | apache-2.0 | Python |
eba1a2140762502656a514759d925e502de3e026 | Remove AccountFilter. | pcapriotti/pledger | pledger/filters.py | pledger/filters.py | from pledger.entry import Entry
class FilterCollection(object):
def __init__(self):
self.filters = { }
def add_filter(self, filter, level = 0):
self.filters.setdefault(level, [])
self.filters[level].append(filter)
def apply(self, transaction, account, amount):
entries = [E... | from pledger.entry import Entry
class FilterCollection(object):
def __init__(self):
self.filters = { }
def add_filter(self, filter, level = 0):
self.filters.setdefault(level, [])
self.filters[level].append(filter)
def apply(self, transaction, account, amount):
entries = [E... | mit | Python |
ebbaebc608d923f437f396957d71615493c13055 | Change feature return | harvitronix/five-video-classification-methods | extractor.py | extractor.py | from keras.preprocessing import image
from keras.applications.inception_v3 import InceptionV3, preprocess_input
from keras.models import Model, load_model
from keras.layers import Input
import numpy as np
class Extractor():
def __init__(self, weights=None):
"""Either load pretrained from imagenet, or load ... | from keras.preprocessing import image
from keras.applications.inception_v3 import InceptionV3, preprocess_input
from keras.models import Model, load_model
from keras.layers import Input
import numpy as np
class Extractor():
def __init__(self, weights=None):
"""Either load pretrained from imagenet, or load ... | mit | Python |
02ec0611a708a293fe4d5056152d7a229e908690 | Add option to save at intermediary points. | e-koch/Phys-595 | project_code/bulk_fitting.py | project_code/bulk_fitting.py |
'''
Bulk spectral line fitting with SDSS galaxy spectra
'''
import os
from astropy.io import fits
from pandas import DataFrame
# Bring in the package funcs
from specfit import do_specfit
from download_spectra import download_spectra
def bulk_fit(obs_file, output_file, keep_spectra=False, split_save=True,
... |
'''
Bulk spectral line fitting with SDSS galaxy spectra
'''
import os
from astropy.io import fits
from pandas import DataFrame
# Bring in the package funcs
from specfit import do_specfit
from download_spectra import download_spectra
def bulk_fit(obs_file, output_file, keep_spectra=False):
'''
Downloads fil... | mit | Python |
0bf34225dc687270c263bfc9f4555c9709eef1ad | use req.GET instead of deprecated req.REQUEST | misli/django-fas | fas/views.py | fas/views.py | from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login as auth_login, logout as auth_logout, authenticate, REDIRECT_FIELD_NAME
from django.core.urlresolvers import resolve
from django.http import HttpResponseRedirect
from django.shortcuts import resolve_url, redirect
... | from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login as auth_login, logout as auth_logout, authenticate, REDIRECT_FIELD_NAME
from django.core.urlresolvers import resolve
from django.http import HttpResponseRedirect
from django.shortcuts import resolve_url, redirect
... | bsd-3-clause | Python |
88fa50d94345716efa50fa8c970abd5b513c7c7f | Fix typo in version label | amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,jstewmon/proselint,amperser/proselint | proselint/version.py | proselint/version.py | """Proselint version number."""
__version__ = "0.3.4"
| """Wallace version number."""
__version__ = "0.3.4"
| bsd-3-clause | Python |
ad758c5f44bffe0b7468b9ccf2c5c4747cdba42c | add ast parse | faycheng/tpl,faycheng/tpl | tpl/render.py | tpl/render.py | # -*- coding:utf-8 -*-
import jinja2
import ast
from candy_prompt.prompt import prompt
env = jinja2.Environment(undefined=jinja2.StrictUndefined)
def render(tpl_text, context):
try:
return env.from_string(tpl_text).render(context)
except jinja2.UndefinedError as e:
undefined_var = e.message[... | # -*- coding:utf-8 -*-
import jinja2
from candy_prompt.prompt import prompt
env = jinja2.Environment(undefined=jinja2.StrictUndefined)
def render(tpl_text, context):
try:
return env.from_string(tpl_text).render(context)
except jinja2.UndefinedError as e:
undefined_var = e.message[1:-14]
... | mit | Python |
0548708fa1d3bf4f4b6ad570714f3334bafb14ac | Fix help for project parser | ghickman/hoard-cli | trove/main.py | trove/main.py | import argparse
from frontend import FrontEnd
def run():
f = FrontEnd()
parser = argparse.ArgumentParser(
prog='trove',
epilog="See '%(prog)s <command> --help' for more help on a specific command."
)
sub_parsers = parser.add_subparsers(title='Commands')
get_parser = sub_parsers... | import argparse
from frontend import FrontEnd
def run():
f = FrontEnd()
parser = argparse.ArgumentParser(
prog='trove',
epilog="See '%(prog)s <command> --help' for more help on a specific command."
)
sub_parsers = parser.add_subparsers(title='Commands')
get_parser = sub_parsers... | mit | Python |
0eafefa9546fee3195198c54eb3362cbaa39ea8d | Update constants.py | pathakvaidehi2391/WorkSpace,pathakvaidehi2391/WorkSpace | azurecloudify/constants.py | azurecloudify/constants.py | ########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | ########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | apache-2.0 | Python |
9222b5ab40aab356b32bea75ca32193bd556f85a | Update constants.py | pathakvaidehi2391/WorkSpace,pathakvaidehi2391/WorkSpace | azurecloudify/constants.py | azurecloudify/constants.py | ########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | ########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | apache-2.0 | Python |
6416d04d073310b7195b27fc0b33db6fec6c4a8b | Add URL-safe versions of base64 encode/decode | tomscript/babbage,tomscript/babbage,tomscript/babbage,tomscript/babbage,tomscript/babbage | backend/plugins/base_64.py | backend/plugins/base_64.py | """Base64 plugin for Babbage.
Copyright 2014 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 app... | """Base64 plugin for Babbage.
Copyright 2014 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 app... | apache-2.0 | Python |
72cd4718224b551e45c87de9d4074524e0f84d8b | Add a logger. | jilljenn/voyageavecmoi,jilljenn/voyageavecmoi,jilljenn/voyageavecmoi | backend/realtime_worker.py | backend/realtime_worker.py | import os
from retry.api import retry
from secret import CONSUMER_KEY, CONSUMER_SECRET
import twitter
import rethinkdb as r
MAX_TRIES = 3 # Number of times we try to get a tweet before giving up
def isTransportOffer(tweet):
return '#VoyageAvecMoi' in tweet['text']
def get_tweet_data(tweet):
return {
... | import os
from retry.api import retry
from secret import CONSUMER_KEY, CONSUMER_SECRET
import twitter
import rethinkdb as r
MAX_TRIES = 3 # Number of times we try to get a tweet before giving up
def isTransportOffer(tweet):
return '#VoyageAvecMoi' in tweet['text']
def get_tweet_data(tweet):
return {
... | agpl-3.0 | Python |
25abe35424aae1ba93f82f5f4adf3de21478cdea | Rename get image url function | gena/qgis-earthengine-plugin,gena/qgis-earthengine-plugin | ee_plugin/utils.py | ee_plugin/utils.py | # -*- coding: utf-8 -*-
"""
Utils functions GEE
"""
from qgis.core import QgsRasterLayer, QgsProject
from qgis.utils import iface
import ee
def get_ee_image_url(image):
map_id = ee.data.getMapId({'image': image})
url = map_id['tile_fetcher'].url_format
return url
def update_ee_layer_properties(layer,... | # -*- coding: utf-8 -*-
"""
Utils functions GEE
"""
from qgis.core import QgsRasterLayer, QgsProject
from qgis.utils import iface
import ee
def get_image_url(image):
map_id = ee.data.getMapId({'image': image})
url = map_id['tile_fetcher'].url_format
return url
def update_ee_layer_properties(layer, im... | mit | Python |
e1422bb5e4a510b8f1844f50af0c4f1659b5cdfe | handle EOF and ProcessLookupError | OTAkeys/RIOT,rfuentess/RIOT,OTAkeys/RIOT,A-Paul/RIOT,neiljay/RIOT,kYc0o/RIOT,OTAkeys/RIOT,OlegHahm/RIOT,kYc0o/RIOT,authmillenon/RIOT,basilfx/RIOT,cladmi/RIOT,gebart/RIOT,lazytech-org/RIOT,immesys/RiSyn,yogo1212/RIOT,toonst/RIOT,RIOT-OS/RIOT,BytesGalore/RIOT,A-Paul/RIOT,OlegHahm/RIOT,biboc/RIOT,LudwigKnuepfer/RIOT,kbums... | dist/tools/testrunner/testrunner.py | dist/tools/testrunner/testrunner.py | # Copyright (C) 2017 Cenk Gündoğan <cenk.guendogan@haw-hamburg.de>
# 2016 Kaspar Schleiser <kaspar@schleiser.de>
# 2014 Martine Lenders <mlenders@inf.fu-berlin.de>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in th... | # Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
# 2014 Martine Lenders <mlenders@inf.fu-berlin.de>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import signal
... | lgpl-2.1 | Python |
d7f04e845214f599bb868146bef46e00ac734e6e | Switch back to HTTP, premailer is still fucked | lutris/website,lutris/website,lutris/website,lutris/website | emails/messages.py | emails/messages.py | """Email utility functions"""
from six import string_types
from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
from premailer import transform
def send_game_accepted(user, game):
"""Email an user when their game submission is acc... | """Email utility functions"""
from six import string_types
from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
from premailer import transform
def send_game_accepted(user, game):
"""Email an user when their game submission is acc... | agpl-3.0 | Python |
7f9ca6993cb835a6941a992a537c6a026d03998e | Update DEVICE_CREDS.py | rumo/netmiko,fooelisa/netmiko,ktbyers/netmiko,rumo/netmiko,isponline/netmiko,mzbenami/netmiko,enzzzy/netmiko,isponline/netmiko,shsingh/netmiko,nitzmahone/netmiko,jinesh-patel/netmiko,ivandgreat/netmiko,enzzzy/netmiko,MikeOfNoTrades/netmiko,shamanu4/netmiko,isidroamv/netmiko,ivandgreat/netmiko,nitzmahone/netmiko,rdezava... | examples/DEVICE_CREDS.py | examples/DEVICE_CREDS.py | cisco_881 = {
'device_type': 'cisco_ios',
'ip': '10.10.10.227',
'username': 'test1',
'password': 'password',
'secret': 'secret',
'verbose': False,
}
cisco_asa = {
'device_type': 'cisco_asa',
'ip': '10.10.10.226',
'username': 'admin',
'password': 'password',
'secret': 'se... | cisco_881 = {
'device_type': 'cisco_ios',
'ip': '10.10.10.227',
'username': 'test1',
'password': 'password',
'secret': 'secret',
'verbose': False,
}
cisco_asa = {
'device_type': 'cisco_asa',
'ip': '10.10.10.226',
'username': 'admin',
'password': 'password',
'secret': 'se... | mit | Python |
eaec82bb0a4a11f683c34550bdc23b3c6b0c48d2 | Update script to export to nml2 of m1 | Neurosim-lab/netpyne,thekerrlab/netpyne,Neurosim-lab/netpyne | examples/M1/M1_export.py | examples/M1/M1_export.py | import M1 # import parameters file
from netpyne import sim # import netpyne sim module
sim.createAndExportNeuroML2(netParams = M1.netParams,
simConfig = M1.simConfig,
reference = 'M1',
connections=True,
stimulations=True) #... | import M1 # import parameters file
from netpyne import sim # import netpyne sim module
sim.createAndExport(netParams = M1.netParams,
simConfig = M1.simConfig,
reference = 'M1') # create and export network to NeuroML 2 | mit | Python |
3f1966ab10edca6df5a8b22df3fc4b7375ea8c4c | Fix for Issue#3 | ianunay/sublime_scratchpad,i-anunay/sublime_scratchpad,i-anunay/sublime_scratchpad | Scratchpad.py | Scratchpad.py | from sublime_plugin import WindowCommand, TextCommand
from sublime import packages_path, run_command, ENCODED_POSITION
from time import strftime
from os.path import isfile
headerText = """
_____ _ _ _
/ ___| | | | | | |
\ `--. ___ ... | from sublime_plugin import WindowCommand, TextCommand
from sublime import packages_path, run_command, ENCODED_POSITION
from time import strftime
from os.path import isfile
headerText = """
_____ _ _ _
/ ___| | | | | | |
\ `--. ___ ... | mit | Python |
e13e602025ffe2374237a0710a8cef3d2f477247 | use constant TRAVIS_API_URL | buildtimetrend/python-lib | buildtimetrend/travis.py | buildtimetrend/travis.py | '''
vim: set expandtab sw=4 ts=4:
Interface to Travis CI API.
Copyright (C) 2014 Dieter Adriaenssens <ruleant@users.sourceforge.net>
This file is part of buildtime-trend
<https://github.com/ruleant/buildtime-trend/>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU G... | '''
vim: set expandtab sw=4 ts=4:
Interface to Travis CI API.
Copyright (C) 2014 Dieter Adriaenssens <ruleant@users.sourceforge.net>
This file is part of buildtime-trend
<https://github.com/ruleant/buildtime-trend/>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU G... | agpl-3.0 | Python |
25aca3b7152229b6f0fd7fa9c9f81639f77263dd | update urls: spacing fixes | dfalk/mezzanine-wiki | mezzanine_wiki/urls.py | mezzanine_wiki/urls.py |
from django.conf.urls.defaults import patterns, url
# Wiki patterns.
urlpatterns = patterns("mezzanine_wiki.views",
url("^$", "wiki_index", name="wiki_index"),
url("^pages:new/$", "wiki_page_new", name="wiki_page_new"),
url("^pages:list/$", "wiki_page_list", name="wiki_page_list"),
url("^pages:change... |
from django.conf.urls.defaults import patterns, url
# Wiki patterns.
urlpatterns = patterns("mezzanine_wiki.views",
url("^$", "wiki_index", name="wiki_index"),
url("^pages:new/$", "wiki_page_new", name="wiki_page_new"),
url("^pages:list/$", "wiki_page_list", name="wiki_page_list"),
url("^pages:change... | bsd-2-clause | Python |
7b486ccf269314a3105db17fa0e8d61e42711398 | migrate spj | ultmaster/eoj3,ultmaster/eoj3,ultmaster/eoj3,ultmaster/eoj3 | migrate/migrate_spj.py | migrate/migrate_spj.py | from problem.models import Problem, SpecialProgram
import traceback
def run():
# try:
# for problem in Problem.objects.all():
# if problem.judge == '' or problem.judge == 'fcmp':
# continue
# if SpecialProgram.objects.filter(filename__contains=problem.judge).exists(... | from problem.models import Problem, SpecialProgram
import traceback
def run():
try:
for problem in Problem.objects.all():
if problem.judge == '' or problem.judge == 'fcmp':
continue
if SpecialProgram.objects.filter(filename__contains=problem.judge).exists():
... | mit | Python |
3e822a60255832279282392038612ba516290009 | fix circular import fail in Python 2.7 | niboshi/chainer,niboshi/chainer,jnishi/chainer,chainer/chainer,wkentaro/chainer,pfnet/chainer,ktnyt/chainer,jnishi/chainer,jnishi/chainer,chainer/chainer,okuta/chainer,hvy/chainer,keisuke-umezawa/chainer,wkentaro/chainer,ktnyt/chainer,okuta/chainer,keisuke-umezawa/chainer,ktnyt/chainer,chainer/chainer,niboshi/chainer,w... | chainer/backends/_cpu.py | chainer/backends/_cpu.py | import numpy
from chainer import _backend
import chainer.backends
import chainerx
class CpuDevice(_backend.Device):
@property
def xp(self):
return numpy
@staticmethod
def from_array(array):
if isinstance(array, numpy.ndarray):
return CpuDevice()
return None
... | import numpy
from chainer import _backend
from chainer.backends import cuda
from chainer.backends import intel64
import chainerx
class CpuDevice(_backend.Device):
@property
def xp(self):
return numpy
@staticmethod
def from_array(array):
if isinstance(array, numpy.ndarray):
... | mit | Python |
9b855f8b72e485fd6484037d709fd0ad1c1d39a4 | Remove duplicate insert of flags | PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild | benchbuild/projects/benchbuild/ccrypt.py | benchbuild/projects/benchbuild/ccrypt.py | from os import path
from benchbuild.projects.benchbuild.group import BenchBuildGroup
from benchbuild.utils.wrapping import wrap
from benchbuild.utils.run import run
from benchbuild.utils.downloader import Wget
from benchbuild.utils.compiler import lt_clang, lt_clang_cxx
from benchbuild.utils.cmd import tar, make
from p... | from os import path
from benchbuild.projects.benchbuild.group import BenchBuildGroup
from benchbuild.utils.wrapping import wrap
from benchbuild.utils.run import run
from benchbuild.utils.downloader import Wget
from benchbuild.utils.compiler import lt_clang, lt_clang_cxx
from benchbuild.utils.cmd import tar, make
from p... | mit | Python |
2d56f9417030410ecb606ee6aa5dc8ea58633f83 | Fix Tapastic scraper | webcomics/dosage,webcomics/dosage | dosagelib/plugins/tapastic.py | dosagelib/plugins/tapastic.py | # SPDX-License-Identifier: MIT
# Copyright (C) 2019-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from ..scraper import _ParserScraper
from ..helpers import indirectStarter
class Tapastic(_ParserScraper):
baseUrl = 'https://tapas.io/'
imageSearch = '//article[contains(@class, "js-episode-arti... | # SPDX-License-Identifier: MIT
# Copyright (C) 2019-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
import json
import re
from ..scraper import _ParserScraper
from ..helpers import indirectStarter
class Tapastic(_ParserScraper):
baseUrl = 'https://tapas.io/'
imageSearch = '//article[contains(@... | mit | Python |
18be54e7ca9937b19295b07b3d0cc2f317c65cab | Update app.py | Fillll/reddit2telegram,nsiregar/reddit2telegram,Fillll/reddit2telegram,nsiregar/reddit2telegram | channels/ya_metro/app.py | channels/ya_metro/app.py | #encoding:utf-8
from urllib.parse import urlparse
from utils import get_url, weighted_random_subreddit
t_channel = '@ya_metro'
subreddit = weighted_random_subreddit({'Subways': 0.6,
'LondonUnderground': 0.4,
'Trams': 0.3
})
def send_post(submission, r2t):
what, url, ext = get_url(submission)
title... | #encoding:utf-8
from urllib.parse import urlparse
from utils import get_url, weighted_random_subreddit
t_channel = '@ya_metro'
subreddit = weighted_random_subreddit({'Subways': 0.6,
'LondonUnderground': 0.4
})
def send_post(submission, r2t):
what, url, ext = get_url(submission)
title = submission.titl... | mit | Python |
849a115ef1e86b7a2b01ccb43d0ea4e713ab070f | Update example_pool.py | aio-libs/aioodbc,jettify/aioodbc | examples/example_pool.py | examples/example_pool.py | import asyncio
import aioodbc
loop = asyncio.get_event_loop()
async def test_pool():
dsn = 'Driver=SQLite;Database=sqlite.db'
pool = await aioodbc.create_pool(dsn=dsn, loop=loop)
async with pool.get as conn:
cur = await conn.cursor()
await cur.execute("SELECT 42;")
r = await cur... | import asyncio
import aioodbc
loop = asyncio.get_event_loop()
async def test_pool():
dsn = 'Driver=SQLite;Database=sqlite.db'
pool = await aioodbc.create_pool(dsn=dsn, loop=loop)
async with (await pool) as conn:
cur = await conn.cursor()
await cur.execute("SELECT 42;")
r = await... | apache-2.0 | Python |
9098f24fda02f1bc4eec585e807f14fdf7a8bb1d | Include engine names from the 'pygraphviz' library instead of maintaining a local list. | homeworkprod/chatrelater,TheLady/chatrelater | chatrelater/visualize.py | chatrelater/visualize.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Chat Relater's Visualizer
~~~~~~~~~~~~~~~~~~~~~~~~~
Visualize relations between chat partners.
For graphical output, GraphViz_ will be utilized (has to be installed) and
various formats can be written.
.. _GraphViz: http://www.graphviz.org/
:Copyright: 2007 Joche... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Chat Relater's Visualizer
~~~~~~~~~~~~~~~~~~~~~~~~~
Visualize relations between chat partners.
For graphical output, GraphViz_ will be utilized (has to be installed) and
various formats can be written.
.. _GraphViz: http://www.graphviz.org/
:Copyright: 2007 Joche... | mit | Python |
11f178ec6b2e6c62dbf72901022690797b9525fe | Update nn.py | AndysDeepAbstractions/deep-learning,AndysDeepAbstractions/deep-learning,AndysDeepAbstractions/deep-learning | Miniflow/nn.py | Miniflow/nn.py | """
Have fun with the number of epochs!
Be warned that if you increase them too much,
the VM will time out :)
"""
import numpy as np
from sklearn.datasets import load_boston
from sklearn.utils import shuffle, resample
from miniflow import *
# Load data
data = load_boston()
X_ = data['data']
y_ = data['target']
# No... | """
Have fun with the number of epochs!
Be warned that if you increase them too much,
the VM will time out :)
"""
import numpy as np
from sklearn.datasets import load_boston
from sklearn.utils import shuffle, resample
from miniflow import *
# Load data
data = load_boston()
X_ = data['data']
y_ = data['target']
# No... | mit | Python |
5c61bbc02ff6b4bb875123b438312fa4d513dd6c | add isRunning | GuillaumeDerval/INGInious,GuillaumeDerval/INGInious,GuillaumeDerval/INGInious,layus/INGInious,layus/INGInious,layus/INGInious,GuillaumeDerval/INGInious,layus/INGInious | modules/job_manager.py | modules/job_manager.py | import Queue
import threading
class JobManager (threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
while True:
# Monitor lock and check
condition.acquire()
if main_queue.empty():
condition.wait()
... | import Queue
import threading
class JobManager (threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
while True:
# Monitor lock and check
condition.acquire()
if main_queue.empty():
condition.wait()
... | agpl-3.0 | Python |
21eeceb718d11bc9eccbdfc1c5fc68a0d2c00ae5 | Update TCPReverseShell.py | lismore/OffensiveCyberTools | Shells/Python/Client/TCPReverseShell.py | Shells/Python/Client/TCPReverseShell.py | # Reverse TCP Shell in Python For Offensive Security/Penetration Testing Assignments
# Connect on LinkedIn https://www.linkedin.com/in/lismore or Twitter @patricklismore
#=========================================================================================================================================
# Python... | # Reverse TCP Shell in Python For Offensive Security/Penetration Testing Assignments
# Connect on LinkedIn https://www.linkedin.com/in/lismore or Twitter @patricklismore
#===================================================================================================================================================... | mit | Python |
5acedf6fab1607f8dea0cdc46df66daea870a275 | Update fastq.py | arq5x/poretools,arq5x/poretools | poretools/fastq.py | poretools/fastq.py | import Fast5File
import sys
def run(parser, args):
for fast5 in Fast5File.Fast5FileSet(args.files):
if args.start_time or args.end_time:
read_start_time = fast5.get_start_time()
read_end_time = fast5.get_end_time()
if args.start_time and args.start_time > read_start_time:
fast5.close()
continue
... | import Fast5File
import sys
def run(parser, args):
for fast5 in Fast5File.Fast5FileSet(args.files):
if args.start_time or args.end_time:
read_start_time = fast5.get_start_time()
read_end_time = fast5.get_end_time()
if args.start_time and args.start_time > read_start_time:
fast5.close()
continue
... | mit | Python |
45b48a660c0854719f77821f0617c096b89c927d | Fix mimetype for project pages | belxlaz/portfolio,belxlaz/portfolio | portfolio/views.py | portfolio/views.py | from flask import abort, Blueprint, g, make_response, render_template
from portfolio.minify import render_minified
from portfolio.projects import Project
from portfolio.sitemap import Sitemap
site = Blueprint('site', __name__, static_folder='static')
projects = Project()
# home
@site.route('/')
def index():
retu... | from flask import abort, Blueprint, g, make_response, render_template
from portfolio.minify import render_minified
from portfolio.projects import Project
from portfolio.sitemap import Sitemap
site = Blueprint('site', __name__, static_folder='static')
projects = Project()
# home
@site.route('/')
def index():
retu... | mit | Python |
512cfb2cedd3a3d2ae8b0d7d28bcb97f81492857 | Index dicts removed. | stbraun/mind_monitor | mind_monitor/monitor_common.py | mind_monitor/monitor_common.py | # coding=utf-8
"""
Common definitions.
"""
# Copyright (c) 2015 Stefan Braun
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to ... | # coding=utf-8
"""
Common definitions.
"""
# Copyright (c) 2015 Stefan Braun
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to ... | mit | Python |
565c95ce9a8ff96d177196c6dbf8d8f88cdfa029 | Add an error class for string data that is ignored by the parser | hackebrot/poyo | poyo/exceptions.py | poyo/exceptions.py | # -*- coding: utf-8 -*-
class PoyoException(Exception):
"""Super class for all of Poyo's exceptions."""
class NoMatchException(PoyoException):
"""Raised when the parser cannot find a pattern that matches the given
string.
"""
class NoParentException(PoyoException):
"""Raised when there is no p... | # -*- coding: utf-8 -*-
class PoyoException(Exception):
"""Super class for all of Poyo's exceptions."""
class NoMatchException(PoyoException):
"""Raised when the parser cannot find a pattern that matches the given
string.
"""
class NoParentException(PoyoException):
"""Raised when there is no p... | mit | Python |
8dc6c31e6c8970e9cda1bb298beb1d3b0620be58 | Remove feedparser | nerevu/riko,nerevu/riko | pipe2py/modules/pipefetchsitefeed.py | pipe2py/modules/pipefetchsitefeed.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
pipe2py.modules.pipefetchsitefeed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://pipes.yahoo.com/pipes/docs?doc=sources#FetchSiteFeed
"""
import speedparser
from urllib2 import urlopen
from pipe2py.lib import autorss
from pipe2py.lib import utils
from pipe... | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
pipe2py.modules.pipefetchsitefeed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://pipes.yahoo.com/pipes/docs?doc=sources#FetchSiteFeed
"""
try:
import speedparser as feedparser
except ImportError:
import feedparser
feedparser.USER_AGENT = (
... | mit | Python |
9d8dcc1d97f68fe8f6de25fac9737304e8ec05ff | Save dates in ISO format | ayushgoel/flock-message-reporter,ayushgoel/flock-message-reporter,ayushgoel/flock-message-reporter,ayushgoel/flock-message-reporter | events.py | events.py | from flask import request
import redis
import config
import datetime
import json
redis_client = redis.StrictRedis(host=config.redis_config["host"], port=config.redis_config["port"])
def handle_app_install(request):
print "Handling app install", request.json
userID = request.json["userId"]
token = request.... | from flask import request
import redis
import config
import datetime
import json
redis_client = redis.StrictRedis(host=config.redis_config["host"], port=config.redis_config["port"])
def handle_app_install(request):
print "Handling app install", request.json
userID = request.json["userId"]
token = request.... | mit | Python |
3eba9b8c2c3a1736549cbe6f5dfcb8fd05da62ab | Add GET /tags | wking/nmhive,wking/nmhive | nmhive.py | nmhive.py | #!/usr/bin/env python
import json
import mailbox
import tempfile
import urllib.request
import flask
import flask_cors
app = flask.Flask(__name__)
flask_cors.CORS(app)
_AVAILABLE_TAGS = {
'bug',
'needs-review',
'obsolete',
'patch',
}
_TAGS = {}
@app.route('/tags', methods=['GET'])
def tags():... | #!/usr/bin/env python
import json
import mailbox
import tempfile
import urllib.request
import flask
import flask_cors
app = flask.Flask(__name__)
flask_cors.CORS(app)
_TAGS = {}
@app.route('/mid/<message_id>', methods=['GET', 'POST'])
def message_id_tags(message_id):
if flask.request.method == 'POST':
... | bsd-2-clause | Python |
a621333a4c4fcc161f076980c9147faa555de5de | Store firmware size as last 4 bytes of padding area. | oopy/micropython,TDAbboud/micropython,alex-robbins/micropython,tobbad/micropython,AriZuu/micropython,SHA2017-badge/micropython-esp32,kerneltask/micropython,jmarcelino/pycom-micropython,lowRISC/micropython,tuc-osg/micropython,MrSurly/micropython-esp32,hosaka/micropython,pozetroninc/micropython,tuc-osg/micropython,tuc-os... | esp8266/makeimg.py | esp8266/makeimg.py | import sys
import struct
SEGS_MAX_SIZE = 0x9000
assert len(sys.argv) == 4
with open(sys.argv[3], 'wb') as fout:
with open(sys.argv[1], 'rb') as f:
data_flash = f.read()
fout.write(data_flash)
print('flash ', len(data_flash))
with open(sys.argv[2], 'rb') as f:
data_rom = f... | import sys
SEGS_MAX_SIZE = 0x9000
assert len(sys.argv) == 4
with open(sys.argv[3], 'wb') as fout:
with open(sys.argv[1], 'rb') as f:
data_flash = f.read()
fout.write(data_flash)
print('flash ', len(data_flash))
pad = b'\xff' * (SEGS_MAX_SIZE - len(data_flash))
fout.write(pad)... | mit | Python |
cf095ece24f2b50298afd1d5f5855771e2685cff | Fix media root to work with the new namespace. | graingert/gutter-django,graingert/gutter-django,graingert/gutter-django,disqus/gutter-django,disqus/gutter-django,disqus/gutter-django,disqus/gutter-django | gargoyle/web/nexus_modules.py | gargoyle/web/nexus_modules.py | """
gargoyle.nexus_modules
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
import nexus
import os
from gargoyle.client.singleton import gargoyle
from django.http import HttpResponse, HttpResponseNotFound
class GargoyleModule(nexus.NexusModule):
... | """
gargoyle.nexus_modules
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
import nexus
class GargoyleModule(nexus.NexusModule):
home_url = 'index'
name = 'gargoyle'
def get_title(self):
return 'Gargoyle'
def get_urls(self... | apache-2.0 | Python |
6fb2746386fe541ea56ba9264e96591da62476e0 | fix (pre-existing) bug with wrong filename | simonvh/genomepy | genomepy/plugins/blacklist.py | genomepy/plugins/blacklist.py | import os.path
import re
import sys
import zlib
from urllib.request import urlopen
from genomepy.plugin import Plugin
class BlacklistPlugin(Plugin):
base_url = "http://mitra.stanford.edu/kundaje/akundaje/release/blacklists/"
http_dict = {
"ce10": base_url + "ce10-C.elegans/ce10-blacklist.bed.gz",
... | import os.path
import re
import sys
import zlib
from urllib.request import urlopen
from genomepy.plugin import Plugin
class BlacklistPlugin(Plugin):
base_url = "http://mitra.stanford.edu/kundaje/akundaje/release/blacklists/"
http_dict = {
"ce10": base_url + "ce10-C.elegans/ce10-blacklist.bed.gz",
... | mit | Python |
3e769d5bdc19eb65da0972226d9fb4abb5d149db | update example for button type template | ben-cunningham/pybot,ben-cunningham/python-messenger-bot | example/example.py | example/example.py | from flask import Flask
from flask import request
import sys
import os
sys.path.append("..")
from fbmsgbot.bot import Bot
from fbmsgbot.models.message import Message
from fbmsgbot.models.template import Template
from fbmsgbot.models.attachment import WebUrlButton, Element
import json
app = Flask(__name__)
bot = Bot... | from flask import Flask
from flask import request
import sys
import os
sys.path.append("..")
from fbmsgbot.bot import Bot
from fbmsgbot.models.message import Message
from fbmsgbot.models.template import Template
from fbmsgbot.models.attachment import WebUrlButton, Element
import json
app = Flask(__name__)
bot = Bot... | mit | Python |
502167c451b5ebcfa0a18568fd992d942cc34c86 | Add missing imports | Tigge/platinumshrimp | plugins/invitejoiner/invitejoiner.py | plugins/invitejoiner/invitejoiner.py | from __future__ import division, absolute_import, print_function, unicode_literals
import sys
import plugin
from twisted.python import log
class Invitejoiner(plugin.Plugin):
def __init__(self):
plugin.Plugin.__init__(self, "Invitejoiner")
def invited(self, server, channel):
log.msg("Invit... |
import plugin
from twisted.python import log
class Invitejoiner(plugin.Plugin):
def __init__(self):
plugin.Plugin.__init__(self, "Invitejoiner")
def invited(self, server, channel):
log.msg("Invited to: ", channel)
self.join(server, channel)
if __name__ == "__main__":
sys.exit(I... | mit | Python |
e17a5d6c23eedd44917745cdf4afcba6b85721c4 | Fix issue detected by mypy. | apache/libcloud,andrewsomething/libcloud,mistio/libcloud,Kami/libcloud,apache/libcloud,Kami/libcloud,Kami/libcloud,mistio/libcloud,apache/libcloud,andrewsomething/libcloud,mistio/libcloud,andrewsomething/libcloud | example_compute.py | example_compute.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | apache-2.0 | Python |
3e7267ed1a2e31fbb3fc1bd10535c53b1d8dcf85 | simplify examples | botify-labs/simpleflow,botify-labs/simpleflow | examples/canvas.py | examples/canvas.py | from __future__ import print_function
import time
from simpleflow import (
activity,
futures,
Workflow,
)
from simpleflow.canvas import Group, Chain
from simpleflow.task import ActivityTask
@activity.with_attributes(task_list='example', version='example')
def increment_slowly(x):
time.sleep(1)
re... | from __future__ import print_function
import time
from simpleflow import (
activity,
futures,
Workflow,
)
from simpleflow.canvas import Group, Chain
from simpleflow.task import ActivityTask
@activity.with_attributes(task_list='example', version='example')
def increment_slowly(x):
time.sleep(1)
re... | mit | Python |
12f01d84b86c09db731c582a8600f89b3f513fc2 | update syntax for server example | pavlov99/json-rpc | examples/server.py | examples/server.py | """ Example of json-rpc usage with Wergzeug and requests.
NOTE: there are no Werkzeug and requests in dependencies of json-rpc.
NOTE: server handles all url paths the same way (there are no different urls).
"""
from werkzeug.wrappers import Request, Response
from werkzeug.serving import run_simple
from jsonrpc impo... | """ Example of json-rpc usage with Wergzeug and requests.
NOTE: there are no Werkzeug and requests in dependencies of json-rpc.
NOTE: server handles all url paths the same way (there are no different urls).
"""
from werkzeug.wrappers import Request, Response
from werkzeug.serving import run_simple
from jsonrpc.jsonr... | mit | Python |
55af90dd1c4aa7caa1dc34b8ff1cca2f27e9d748 | Add atom features to simple.py example | crcollins/molml | examples/simple.py | examples/simple.py | from molml.features import CoulombMatrix
from molml.features import LocalCoulombMatrix
# Define some base data
H2_ELES = ['H', 'H']
H2_NUMS = [1, 1]
H2_COORDS = [
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
]
H2_CONNS = {
0: {1: '1'},
1: {0: '1'},
}
HCN_ELES = ['H', 'C', 'N']
HCN_NUMS = [1, 6, 7]
HCN_COORDS = [... | from molml.features import CoulombMatrix
# Define some base data
H2_ELES = ['H', 'H']
H2_NUMS = [1, 1]
H2_COORDS = [
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
]
H2_CONNS = {
0: {1: '1'},
1: {0: '1'},
}
HCN_ELES = ['H', 'C', 'N']
HCN_NUMS = [1, 6, 7]
HCN_COORDS = [
[-1.0, 0.0, 0.0],
[0.0, 0.0, 0.0],
... | mit | Python |
85722c2efeaeb606591012fd19831fc31d199f86 | move start_analysis to xpdAn | NSLS-II-XPD/ipython_ophyd,NSLS-II-XPD/ipython_ophyd | profile_analysis/startup/999-load.py | profile_analysis/startup/999-load.py | from xpdan.startup.analysis import start_analysis | from bluesky.callbacks.zmq import RemoteDispatcher
from bluesky.utils import install_qt_kicker
# setup glbl
# from xpdan.pipelines.callback import MainCallback
from xpdan.pipelines.main import raw_source
from xpdan.pipelines.main import (mask_kwargs as _mask_kwargs,
pdf_kwargs as _pdf... | bsd-2-clause | Python |
241a729208f8e8fa4e914145a1e9288766ad9e9d | revert owlbot main branch templates (#39) | googleapis/python-essential-contacts,googleapis/python-essential-contacts | owlbot.py | owlbot.py | # Copyright 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, softwar... | # Copyright 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, softwar... | apache-2.0 | Python |
8f4d99f67b42fd6518d0b968c5ac2c39f3159211 | Change Windows virtualenv command | sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis,appi147/Jarvis,appi147/Jarvis | installer/steps/a_setup_virtualenv.py | installer/steps/a_setup_virtualenv.py | import os
import re
from helper import *
import unix_windows
section("Preparing virtualenv")
# check that virtualenv installed
virtualenv_installed = False
if unix_windows.IS_WIN:
virtualenv_installed = shell(unix_windows.VIRTUALENV_CMD + ' -h').success()
else:
virtualenv_installed = executable_exists('vir... | import os
import re
from helper import *
import unix_windows
section("Preparing virtualenv")
# check that virtualenv installed
if not executable_exists('virtualenv'):
fail("""\
Please install virtualenv!
https://github.com/pypa/virtualenv
{}""".format(unix_windows.VIRTUALENV_INSTALL_MSG))
# Make sure that no... | mit | Python |
115774c49493f59161bde814eecd77b5beb617a9 | Allow BROKER_URL environment setting. | HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily | lily/settings/celeryconfig.py | lily/settings/celeryconfig.py | import os
from datetime import timedelta
from kombu import Queue
from .settings import DEBUG, TIME_ZONE
BROKER_URL = os.environ.get('BROKER_URL')
if not BROKER_URL:
BROKER = os.environ.get('BROKER', 'DEV')
if BROKER == 'IRONMQ':
BROKER_URL = 'ironmq://%s:%s@mq-aws-eu-west-1.iron.io' % (os.environ.g... | import os
from datetime import timedelta
from kombu import Queue
from .settings import DEBUG, TIME_ZONE
BROKER = os.environ.get('BROKER', 'DEV')
if BROKER == 'IRONMQ':
BROKER_URL = 'ironmq://%s:%s@mq-aws-eu-west-1.iron.io' % (os.environ.get('IRON_MQ_PROJECT_ID'), os.environ.get('IRON_MQ_TOKEN'))
elif BROKER ==... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.