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 |
|---|---|---|---|---|---|---|---|---|
00b8bd07875e3d747c2399b5e00f0884499691c9 | Make sure to get the correct internal WB url for file objects | felliott/osf.io,leb2dg/osf.io,Nesiehr/osf.io,Nesiehr/osf.io,pattisdr/osf.io,caseyrollins/osf.io,TomBaxter/osf.io,mfraezz/osf.io,aaxelb/osf.io,caneruguz/osf.io,icereval/osf.io,cwisecarver/osf.io,HalcyonChimera/osf.io,caneruguz/osf.io,chennan47/osf.io,Nesiehr/osf.io,hmoco/osf.io,adlius/osf.io,erinspace/osf.io,CenterForOp... | api/nodes/utils.py | api/nodes/utils.py | # -*- coding: utf-8 -*-
from modularodm import Q
from rest_framework.exceptions import PermissionDenied, NotFound
from rest_framework.status import is_server_error
import requests
from website.files.models import OsfStorageFile
from website.files.models import OsfStorageFolder
from website.util import waterbutler_api_... | # -*- coding: utf-8 -*-
from modularodm import Q
from rest_framework.exceptions import PermissionDenied, NotFound
from rest_framework.status import is_server_error
import requests
from website.files.models import OsfStorageFile
from website.files.models import OsfStorageFolder
from website.util import waterbutler_api_... | apache-2.0 | Python |
dc41024679edfa93534c80f02433040cb48cb8be | Bump patch version | prkumar/uplink | uplink/__about__.py | uplink/__about__.py | """
This module is the single source of truth for any package metadata
that is used both in distribution (i.e., setup.py) and within the
codebase.
"""
__version__ = "0.5.3"
| """
This module is the single source of truth for any package metadata
that is used both in distribution (i.e., setup.py) and within the
codebase.
"""
__version__ = "0.5.2"
| mit | Python |
8c20deac927bbc9e27d1890d13b457be0a36255c | Add ConsoleCommand | tiagochiavericosta/cobe,meska/cobe,LeMagnesium/cobe,wodim/cobe-ng,pteichman/cobe,pteichman/cobe,LeMagnesium/cobe,tiagochiavericosta/cobe,meska/cobe,DarkMio/cobe,DarkMio/cobe,wodim/cobe-ng | halng/commands.py | halng/commands.py | import logging
import os
import readline
import sys
from brain import Brain
from cmdparse import Command
log = logging.getLogger("hal")
class InitCommand(Command):
def __init__(self):
Command.__init__(self, "init", summary="Initialize a new brain")
self.add_option("", "--force", action="store_t... | import logging
import os
from brain import Brain
from cmdparse import Command
log = logging.getLogger("hal")
class InitCommand(Command):
def __init__(self):
Command.__init__(self, "init", summary="Initialize a new brain")
self.add_option("", "--force", action="store_true")
self.add_opt... | mit | Python |
a202af3e20d1a8d094b1c9683b7eaeb701541f73 | Fix broken test | cjellick/cattle,vincent99/cattle,cloudnautique/cattle,cloudnautique/cattle,cjellick/cattle,cloudnautique/cattle,rancherio/cattle,cjellick/cattle,vincent99/cattle,rancher/cattle,vincent99/cattle,cjellick/cattle,rancher/cattle,rancherio/cattle,rancher/cattle,rancherio/cattle,cloudnautique/cattle | tests/integration/cattletest/core/test_k8s.py | tests/integration/cattletest/core/test_k8s.py | from common_fixtures import * # NOQA
def test_create_k8s_container_no_k8s(context):
c = context.create_container(labels={
'io.kubernetes.pod.namespace': 'n',
'io.kubernetes.pod.name': 'p',
'io.kubernetes.container.name': 'POD',
})
c = context.client.wait_success(c)
assert c.st... | from common_fixtures import * # NOQA
def test_create_k8s_container_no_k8s(context):
c = context.create_container(labels={
'io.kubernetes.pod.namespace': 'n',
'io.kubernetes.pod.name': 'p',
'io.kubernetes.container.name': 'POD',
})
c = context.client.wait_success(c)
assert c.st... | apache-2.0 | Python |
301138d302edce2d6e6b3e1d824f6fbc5ab876be | Change workdir back to starting one when testing "cd" | melkamar/webstore-manager,melkamar/webstore-manager | tests/script_parser/test_generic_functions.py | tests/script_parser/test_generic_functions.py | import os
import pytest
import shutil
import zipfile
from script_parser import parser
def test_pushd_popd():
p = parser.Parser("foo")
startdir = os.getcwd()
p.execute_line("pushd tests")
assert os.getcwd() == os.path.join(startdir, 'tests')
p.execute_line("pushd files")
assert os.getcwd() ==... | import os
import pytest
import shutil
import zipfile
from script_parser import parser
def test_pushd_popd():
p = parser.Parser("foo")
startdir = os.getcwd()
p.execute_line("pushd tests")
assert os.getcwd() == os.path.join(startdir, 'tests')
p.execute_line("pushd files")
assert os.getcwd() ==... | mit | Python |
c06267145205ab7c1272d0d77643aed145b3655c | Add while interrupt. | dbrentley/Raspberry-Pi-3-GPS | get_data.py | get_data.py | #!/usr/bin/env python3
from gps.gps_class import GPS
import time
import sys
def main():
gps_data = GPS('/dev/ttyS0')
print("Press Control+C to stop.")
gps_data.start()
try:
while True:
print("lat: {}, lon: {}, elevation: {}ft, speed: {}mph".format(
gps_data.lat, gp... | #!/usr/bin/env python3
from gps.gps_class import GPS
import time
def main():
gps_data = GPS('/dev/ttyS0')
gps_data.start()
while True:
print("lat: {}, lon: {}, elevation: {}ft, speed: {}mph".format(
gps_data.lat, gps_data.lon, gps_data.altitude, gps_data.mph))
time.sleep(1)
i... | apache-2.0 | Python |
52d65ff926a079b4e07e8bc0fda3e3c3fe8f9437 | Remove dependency from remotecv worker on queued detector | fanhero/thumbor,fanhero/thumbor,fanhero/thumbor,fanhero/thumbor | thumbor/detectors/queued_detector/__init__.py | thumbor/detectors/queued_detector/__init__.py | from remotecv.unique_queue import UniqueQueue
from thumbor.detectors import BaseDetector
class QueuedDetector(BaseDetector):
queue = UniqueQueue()
def detect(self, callback):
engine = self.context.modules.engine
self.queue.enqueue_unique_from_string('remotecv.pyres_tasks.DetectTask', 'Detect'... | from remotecv import pyres_tasks
from remotecv.unique_queue import UniqueQueue
from thumbor.detectors import BaseDetector
class QueuedDetector(BaseDetector):
queue = UniqueQueue()
def detect(self, callback):
engine = self.context.modules.engine
self.queue.enqueue_unique(pyres_tasks.DetectTask... | mit | Python |
c9f8663e6b0bf38f6c041a3a6b77b8a0007a9f09 | Add a name to the index URL | ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople | urls.py | urls.py | from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.views.generic.simple import direct_to_template
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^i4p/', include('i4p.foo.urls')),
# Uncomment the admin/d... | from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.views.generic.simple import direct_to_template
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^i4p/', include('i4p.foo.urls')),
# Uncomment the admin/d... | agpl-3.0 | Python |
24b58f2bcbff029ce5d399dc1d8f478d7b066af7 | fix image provider api | chaubold/hytra,chaubold/hytra,chaubold/hytra | toolbox/pluginsystem/image_provider_plugin.py | toolbox/pluginsystem/image_provider_plugin.py | from yapsy.IPlugin import IPlugin
class ImageProviderPlugin(IPlugin):
"""
This is the base class for all plugins that load images from a given location
"""
def activate(self):
"""
Activation of plugin could do something, but not needed here
"""
pass
def deactivate... | from yapsy.IPlugin import IPlugin
class ImageProviderPlugin(IPlugin):
"""
This is the base class for all plugins that load images from a given location
"""
def activate(self):
"""
Activation of plugin could do something, but not needed here
"""
pass
def deactivate... | mit | Python |
151110aefcd9268b77ecbfe1e6e637bbb5f8bc1d | Update move_motor.py to python3, make it work for all motors | dwalton76/ev3dev-lang-python,rhempel/ev3dev-lang-python,dwalton76/ev3dev-lang-python | utils/move_motor.py | utils/move_motor.py | #!/usr/bin/env python3
"""
Used to adjust the position of a motor in an already assembled robot
where you can"t move the motor by hand.
"""
from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, Motor
import argparse
import logging
import sys
# command line args
parser = argparse.ArgumentParser(description=... | #!/usr/bin/env python
"""
Used to adjust the position of a motor in an already assembled robot
where you can"t move the motor by hand.
"""
from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D
from ev3dev.helper import LargeMotor
import argparse
import logging
import sys
# command line args
parser = argpars... | mit | Python |
d6763210d60a7b6caf97e0b5930e1456f1a73bb1 | Drop Py2 and six on tests/unit/modules/test_mod_random.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/modules/test_mod_random.py | tests/unit/modules/test_mod_random.py | """
:codeauthor: Rupesh Tare <rupesht@saltstack.com>
"""
import salt.modules.mod_random as mod_random
import salt.utils.pycrypto
from salt.exceptions import SaltInvocationError
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import patch
from tests.support.unit import TestCase, skipI... | # -*- coding: utf-8 -*-
"""
:codeauthor: Rupesh Tare <rupesht@saltstack.com>
"""
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Libs
import salt.modules.mod_random as mod_random
import salt.utils.pycrypto
from salt.exceptions import SaltInvocationError
... | apache-2.0 | Python |
b69cfe67a0881fbe497cc56aec02412db82f08a5 | Fix AssetAttributes' format_extension property | gears/gears,gears/gears,gears/gears | gears/asset_attributes.py | gears/asset_attributes.py | import os
import re
from .utils import cached_property
class AssetAttributes(object):
def __init__(self, environment, path):
self.environment = environment
self.path = path
@cached_property
def search_paths(self):
paths = [self.path]
if os.path.basename(self.path_without_... | import os
import re
from .utils import cached_property
class AssetAttributes(object):
def __init__(self, environment, path):
self.environment = environment
self.path = path
@cached_property
def search_paths(self):
paths = [self.path]
if os.path.basename(self.path_without_... | isc | Python |
a7c7bbe484183d2dee21f525c28c34c169b3f755 | fix parameterization | Naught0/qtbot | utils/user_funcs.py | utils/user_funcs.py | #!bin/env python
import asyncpg
class PGDB:
def __init__(self, db_conn):
self.db_conn = db_conn
async def fetch_user_info(self, member_id: int, column: str):
query = f'''SELECT {column} FROM user_info WHERE member_id = {member_id};'''
return await self.db_conn.fetchval(query)
asy... | #!bin/env python
import asyncpg
class PGDB:
def __init__(self, db_conn):
self.db_conn = db_conn
async def fetch_user_info(self, member_id: int, column: str):
query = f'''SELECT {column} FROM user_info WHERE member_id = {member_id};'''
return await self.db_conn.fetchval(query)
asy... | mit | Python |
f799561adb3b76a17e9da30a7cb715ae26b1a5eb | Update tsdb_serialization.py | Planet-Nine/cs207project,Planet-Nine/cs207project | timeseries/tsdb/tsdb_serialization.py | timeseries/tsdb/tsdb_serialization.py | import json
LENGTH_FIELD_LENGTH = 4
def serialize(json_obj):
'''Turn a JSON object into bytes suitable for writing out to the network.
Includes a fixed-width length field to simplify reconstruction on the other
end of the wire.'''
#your code here. Returns the bytes on the wire
try:
obj =... | import json
LENGTH_FIELD_LENGTH = 4
def serialize(json_obj):
'''Turn a JSON object into bytes suitable for writing out to the network.
Includes a fixed-width length field to simplify reconstruction on the other
end of the wire.'''
# your code here
class Deserializer(object):
'''A buffering and... | mit | Python |
623f37316c7d09c18a846d437b7ff943060a5521 | Add pageTitle params to post routes | ollien/Timpani,ollien/Timpani,ollien/Timpani | timpani/webserver/controllers/user.py | timpani/webserver/controllers/user.py | import flask
import os.path
import datetime
from ... import auth
from ... import blog
from ... import configmanager
from ... import settings
from .. import webhelpers
TEMPLATE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../templates"))
blueprint = flask.Blueprint("user", __name__, template_f... | import flask
import os.path
import datetime
from ... import auth
from ... import blog
from ... import configmanager
from ... import settings
from .. import webhelpers
TEMPLATE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../templates"))
blueprint = flask.Blueprint("user", __name__, template_f... | mit | Python |
7f2b41a706cf110e6c9cd888917e6762fad69dbc | Replace session with flask.session in user.py | ollien/Timpani,ollien/Timpani,ollien/Timpani | timpani/webserver/controllers/user.py | timpani/webserver/controllers/user.py | import flask
import os.path
import datetime
from ... import auth
from ... import blog
from ... import configmanager
from .. import webhelpers
FILE_LOCATION = os.path.abspath(os.path.dirname(__file__))
CONFIG_PATH = os.path.abspath(os.path.join(FILE_LOCATION, "../../../configs/"))
TEMPLATE_PATH = os.path.abspath(os.pat... | import flask
import os.path
import datetime
from ... import auth
from ... import blog
from ... import configmanager
from .. import webhelpers
FILE_LOCATION = os.path.abspath(os.path.dirname(__file__))
CONFIG_PATH = os.path.abspath(os.path.join(FILE_LOCATION, "../../../configs/"))
TEMPLATE_PATH = os.path.abspath(os.pat... | mit | Python |
84fe0f1bde39f007da08c93298f53ae1ad623fd1 | Add file that should be deployed to REQUIRED_PATHS, for JPF | dbeyer/benchexec,dbeyer/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,dbeyer/benchexec,sosy-lab/benchexec | benchexec/tools/jpf.py | benchexec/tools/jpf.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2018 Dirk Beyer
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
ht... | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2018 Dirk Beyer
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
ht... | apache-2.0 | Python |
199761c550e80f8e8c2882a09694f2bde08c8d75 | Remove get_repo(). | s3rvac/git-branch-viewer,s3rvac/git-branch-viewer | viewer/web/views.py | viewer/web/views.py | """
viewer.web.views
~~~~~~~~~~~~~~~~
Views for the web.
:copyright: © 2014 by Petr Zemek <s3rvac@gmail.com> and contributors
:license: BSD, see LICENSE for more details
"""
from flask import render_template
from flask import g
from viewer import git
from . import app
@app.before_request
def b... | """
viewer.web.views
~~~~~~~~~~~~~~~~
Views for the web.
:copyright: © 2014 by Petr Zemek <s3rvac@gmail.com> and contributors
:license: BSD, see LICENSE for more details
"""
from flask import render_template
from flask import g
from viewer import git
from . import app
def get_repo():
retur... | bsd-3-clause | Python |
805ba9d93e04ed3991d8d00132e439df02eaff79 | Add import_from_dir() function | bennoleslie/pyutil | util.py | util.py | """Snipppets of potentially reusable code that don't deserve their
own library."""
import bisect
class Location:
def __init__(self, name, line, col):
self.name = name
self.line = line
self.col = col
def __str__(self):
return "{}:{}.{}".format(self.name, self.line, self.col)
... | """Snipppets of potentially reusable code that don't deserve their
own library."""
import bisect
class Location:
def __init__(self, name, line, col):
self.name = name
self.line = line
self.col = col
def __str__(self):
return "{}:{}.{}".format(self.name, self.line, self.col)
... | mit | Python |
88f57982d8f93bb9e4d6915081dabaa143708419 | Fix method of getting server version, add docstring | igboyes/virtool,virtool/virtool,virtool/virtool,igboyes/virtool | virtool/db/mongo.py | virtool/db/mongo.py | import logging
import sys
from typing import Any, Awaitable, Callable, Dict, List
import pymongo.errors
import semver
from motor.motor_asyncio import AsyncIOMotorClient
import virtool.db.core
import virtool.db.utils
MINIMUM_MONGO_VERSION = "3.6.0"
logger = logging.getLogger("mongo")
async def connect(
con... | import logging
import sys
from typing import Any, Awaitable, Callable, Dict, List
import pymongo.errors
import semver
from motor.motor_asyncio import AsyncIOMotorClient
import virtool.db.core
import virtool.db.utils
MINIMUM_MONGO_VERSION = "3.6.0"
logger = logging.getLogger("mongo")
async def connect(
con... | mit | Python |
566e7b17d220eec143487f6d9ea7db647c557b10 | Update variantPipeline.py | lauringlab/variant_pipeline,lauringlab/variant_pipeline,lauringlab/variant_pipeline,lauringlab/variant_pipeline | bin/variantPipeline.py | bin/variantPipeline.py | import os
import os.path
import argparse
import shutil
import subprocess as s
import sys
parser = argparse.ArgumentParser(description='This is a wrapper to set up and run the bpipe command')
parser.add_argument('-i',action='store',dest='input_dir',help='Directory containing the input fastqs')
parser.add_argument('-... | import os
import os.path
import argparse
import shutil
import subprocess as s
import sys
parser = argparse.ArgumentParser(description='This is a wrapper to set up and run the bpipe command')
parser.add_argument('-i',action='store',dest='input_dir',help='Directory containing the input fastqs')
parser.add_argument('-... | apache-2.0 | Python |
85eb6a24aa65c6967e30a9c3f9cbbd84e124140c | Remove comma from docstring | gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com | bin/verify-identity.py | bin/verify-identity.py | #!/usr/bin/env python
"""verify-identity.py <participant_id> <country_code>
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from gratipay import wireup
from gratipay.models.participant import Participant
from gratipay.models.country import Country
wireup.db(wireup.en... | #!/usr/bin/env python
"""verify-identity.py <participant_id>, <country_code>
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from gratipay import wireup
from gratipay.models.participant import Participant
from gratipay.models.country import Country
wireup.db(wireup.e... | mit | Python |
db6ee1cdcc31c8c1c2899d100cb0d1a9baf0e71e | Remove old initializers | admiyo/keystone,kwss/keystone,openstack/keystone,maestro-hybrid-cloud/keystone,cbrucks/keystone_ldap,pvo/keystone,sileht/deb-openstack-keystone,citrix-openstack-build/keystone,ajayaa/keystone,nuxeh/keystone,jonnary/keystone,roopali8/keystone,cbrucks/Federated_Keystone,jamielennox/keystone,himanshu-setia/keystone,roopal... | keystone/__init__.py | keystone/__init__.py | # Copyright (C) 2011 OpenStack 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 wr... | # Copyright (C) 2011 OpenStack 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 wr... | apache-2.0 | Python |
7b9f84d365ef0eeb43238fc6779c6d0adfe29ac7 | clean up imports | pteichman/kibot-modules | kibot/modules/woo.py | kibot/modules/woo.py | import kibot.BaseModule
import random
import re
from kibot.irclib import nm_to_n
class woo(kibot.BaseModule.BaseModule):
def __init__(self, bot):
random.seed()
kibot.BaseModule.BaseModule.__init__(self, bot)
def _on_pubmsg(self, conn, event):
message = event.args[0]
message = ... | import kibot.BaseModule
import random
from kibot.irclib import nm_to_n
class woo(kibot.BaseModule.BaseModule):
def __init__(self, bot):
random.seed()
kibot.BaseModule.BaseModule.__init__(self, bot)
def _on_pubmsg(self, conn, event):
import string, re
message = event.args[0]
... | mit | Python |
3df89cb9705b3475132940e50d15e422ec3ea7ab | fix itertools import for mapproxy-util scales --repeat | drnextgis/mapproxy,camptocamp/mapproxy,mapproxy/mapproxy,olt/mapproxy,vrsource/mapproxy,mapproxy/mapproxy,vrsource/mapproxy,camptocamp/mapproxy,olt/mapproxy,drnextgis/mapproxy | mapproxy/compat/itertools.py | mapproxy/compat/itertools.py | from __future__ import absolute_import
import sys
PY2 = sys.version_info[0] == 2
PY3 = not PY2
if PY2:
from itertools import (
izip,
izip_longest,
imap,
islice,
chain,
groupby,
cycle,
)
else:
izip = zip
imap = map
from itertools import (
... | from __future__ import absolute_import
import sys
PY2 = sys.version_info[0] == 2
PY3 = not PY2
if PY2:
from itertools import (
izip,
izip_longest,
imap,
islice,
chain,
groupby,
)
else:
izip = zip
imap = map
from itertools import (
zip_longe... | apache-2.0 | Python |
551b590115da4d6eac356b7f94ec6f2197da3ce0 | bump version | benzid-wael/djangorestframework-utils | django_rest_utils/__init__.py | django_rest_utils/__init__.py | __version__ = '0.0.1'
| __version__ = '0.0.0'
| isc | Python |
11e64afa2192a8e71cba9357f332f4e8edd66bba | bump to 2.1.2 | BlokeOne/premailer-1,lavr/premailer,kengruven/premailer,BlokeOne/premailer-1,peterbe/premailer,kengruven/premailer,graingert/premailer,industrydive/premailer,graingert/premailer,industrydive/premailer,ionelmc/premailer,ionelmc/premailer,peterbe/premailer,peterbe/premailer,lavr/premailer | premailer/__init__.py | premailer/__init__.py | from premailer import Premailer, transform
__version__ = '2.1.2'
| from premailer import Premailer, transform
__version__ = '2.1.1'
| bsd-3-clause | Python |
2ef86fa9ecc0c6f8ec8480a545123e66fdb90af5 | Improve unicode parsing. From https://github.com/bmander/gtfs/commit/e0390740ef951bebc2e1a5448abc68e51891833d | gpichot/pygtfs,jarondl/pygtfs,howeik/pygtfs | gtfs/feed.py | gtfs/feed.py | from codecs import iterdecode
from zipfile import ZipFile
import os
import csv
class CSV(object):
"""A CSV file."""
def __init__(self, header, rows):
self.header = header
self.rows = rows
def __repr__(self):
return '<CSV %s>' % self.header
def __iter__(self):
return s... | from codecs import iterdecode
from zipfile import ZipFile
import os
import csv
class CSV(object):
"""A CSV file."""
def __init__(self, header, rows):
self.header = header
self.rows = rows
def __repr__(self):
return '<CSV %s>' % self.header
def __iter__(self):
return s... | mit | Python |
59b09f9251c5a41f5362e2d6e1438f2c33274f89 | Bump version | marteinn/The-Big-Username-Blacklist-Python | the_big_username_blacklist/__init__.py | the_big_username_blacklist/__init__.py | # -*- coding: utf-8 -*-
"""
the-big-username-blacklist
--------------------------
A opinionated username blacklist
"""
__title__ = "the_big_username_blacklist"
__version__ = "1.5.2"
__build__ = 152
__author__ = "Martin Sandström"
__license__ = "MIT"
__copyright__ = "Copyright 2015-2018 Martin Sandström"
from .valid... | # -*- coding: utf-8 -*-
"""
the-big-username-blacklist
--------------------------
A opinionated username blacklist
"""
__title__ = "the_big_username_blacklist"
__version__ = "1.5.0"
__build__ = 150
__author__ = "Martin Sandström"
__license__ = "MIT"
__copyright__ = "Copyright 2015-2017 Martin Sandström"
from .valid... | mit | Python |
7a3f8adf66ce2de398ad7168a11ecaa526c26db5 | Check content of public IP response against a list of valid characters. | jaymed/python-blessclient | blessclient/user_ip.py | blessclient/user_ip.py | import contextlib
import logging
import string
import time
from urllib2 import urlopen
VALID_IP_CHARACTERS = string.hexdigits + '.:'
class UserIP(object):
def __init__(self, bless_cache, maxcachetime, ip_urls, fixed_ip=False):
self.fresh = False
self.currentIP = None
self.cache = bless_c... | import contextlib
import logging
import time
from urllib2 import urlopen
class UserIP(object):
def __init__(self, bless_cache, maxcachetime, ip_urls, fixed_ip=False):
self.fresh = False
self.currentIP = None
self.cache = bless_cache
self.maxcachetime = maxcachetime
self.ip... | apache-2.0 | Python |
7c816832aa57065cd37100ebd088ad49782ecfa6 | Fix names displayed in admin | jesuejunior/golingo,jesuejunior/golingo,jesuejunior/golingo | quiz/admin.py | quiz/admin.py | __author__ = 'jesuejunior'
from quiz.models import Question, Lesson, Answer, Unity, Media, Result
from django.contrib import admin
class UnityAdmin(admin.ModelAdmin):
list_display = ('id', 'number', 'name', 'description', )
list_filter = ('number', 'name', 'description', )
search_fields = ('id', 'number'... | __author__ = 'jesuejunior'
from quiz.models import Question, Lesson, Answer, Unity, Media, Result
from django.contrib import admin
class UnityAdmin(admin.ModelAdmin):
list_display = ('id', 'number', 'name', 'description', )
list_filter = ('number', 'name', 'description', )
search_fields = ('id', 'number'... | bsd-3-clause | Python |
73ff56f4b8859e82b0d69a6505c982e26de27859 | Add randcolor function to uitl | joseph346/cellular | util.py | util.py | import colorsys
import random
def randcolor():
hue = random.random()
sat = random.randint(700, 1000) / 1000
val = random.randint(700, 1000) / 1000
return tuple(int(f*255) for f in colorsys.hsv_to_rgb(hue, sat, val))
def product(nums):
r = 1
for n in nums:
r *= n
return r
def choos... |
def product(nums):
r = 1
for n in nums:
r *= n
return r
def choose(n, k):
if 0 <= k <= n:
ntok = 1
ktok = 1
for t in range(1, min(k, n - k) + 1):
ntok *= n
ktok *= t
n -= 1
return ntok // ktok
else:
return 0
def ... | unlicense | Python |
e463cff89aa244e2241d6b71d81fd04f6d16a53a | Fix variable names | hkaju/Ising2D,hkaju/Ising2D,hkaju/Ising2D | util.py | util.py | import glob
import subprocess
def generate_report():
'''Generate a PDF report containing magnetization data and lattice snapshots.'''
n_lattices = len(glob.glob("data/lattice*.csv"))
#R code template
report_template = open("templates/report.template.r", 'r').read()
#R code template for a ... | import glob
import subprocess
def generate_report():
'''Generate a PDF report containing magnetization data and lattice snapshots.'''
n_lattices = len(glob.glob("data/lattice*.csv"))
#R code template
report_template = open("templates/report.template.r", 'r').read()
#R code template for a ... | mit | Python |
fc30af765493f8ba1be5113992ff5d8beb043554 | Update test script for new website (#25) | joyzoursky/docker-python-chromedriver,joyzoursky/docker-python-chromedriver | test_script.py | test_script.py | """
A simple selenium test example written by python
"""
import unittest
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
class TestTemplate(unittest.TestCase):
"""Include test cases on a given url"""
def setUp(self):
"""Start web driver"""
chrome_o... | """
A simple selenium test example written by python
"""
import unittest
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
class TestTemplate(unittest.TestCase):
"""Include test cases on a given url"""
def setUp(self):
"""Start web driver"""
chrome_o... | mit | Python |
b5d0694fe9d5e22ea82be9a78bbe4f755bec250d | Remove unneeded funfactory defaults (Jinja and LocaleURLMiddleware) | akatsoulas/remo,mozilla/remo,mozilla/remo,tsmrachel/remo,Mte90/remo,flamingspaz/remo,akatsoulas/remo,Mte90/remo,tsmrachel/remo,abdullah2891/remo,chirilo/remo,flamingspaz/remo,Mte90/remo,Mte90/remo,tsmrachel/remo,flamingspaz/remo,chirilo/remo,akatsoulas/remo,abdullah2891/remo,flamingspaz/remo,johngian/remo,johngian/remo... | remo/settings/base.py | remo/settings/base.py | # This is your project's main settings file that can be committed to your
# repo. If you need to override a setting locally, use settings_local.py
from funfactory.settings_base import *
# Bundles is a dictionary of two dictionaries, css and js, which list css files
# and js files that can be bundled together by the mi... | # This is your project's main settings file that can be committed to your
# repo. If you need to override a setting locally, use settings_local.py
from funfactory.settings_base import *
# Bundles is a dictionary of two dictionaries, css and js, which list css files
# and js files that can be bundled together by the mi... | bsd-3-clause | Python |
7801c5d7430233eb78ab8b2a91f5960bd808b2c7 | Move admin authentication into before_request handler | Encrylize/flask-blogger,Encrylize/flask-blogger,Encrylize/flask-blogger | app/admin/views.py | app/admin/views.py | from flask import Blueprint, render_template, redirect, url_for
from flask_security import current_user
admin = Blueprint('admin', __name__)
@admin.route('/')
@admin.route('/index')
def index():
return render_template('admin/index.html', title='Admin')
@admin.before_request
def require_login():
if not curr... | from flask import Blueprint, render_template
from flask_security import login_required
admin = Blueprint('admin', __name__)
@admin.route('/')
@admin.route('/index')
@login_required
def index():
return render_template('admin/index.html', title='Admin')
| mit | Python |
e87adc4e1d2c191f7d72ba80c2fe048d9c392eeb | Test SCEs | jonfoster/pyxb1,jonfoster/pyxb2,jonfoster/pyxb2,CantemoInternal/pyxb,jonfoster/pyxb2,jonfoster/pyxb-upstream-mirror,pabigot/pyxb,jonfoster/pyxb1,jonfoster/pyxb-upstream-mirror,balanced/PyXB,pabigot/pyxb,balanced/PyXB,CantemoInternal/pyxb,balanced/PyXB,jonfoster/pyxb-upstream-mirror,CantemoInternal/pyxb | pyxb/utils/xmlre.py | pyxb/utils/xmlre.py | # Copyright 2009, Peter A. Bigot
#
# 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 ... | # Copyright 2009, Peter A. Bigot
#
# 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 ... | apache-2.0 | Python |
5b757b29b4ea69dcc4e432e7c54b92b241d8e3a0 | Send proper HTTP headers for files | Surye/relaygram | relaygram/http_server.py | relaygram/http_server.py | import http.server
from threading import Thread
import os.path
import mimetypes
class HTTPHandler:
def __init__(self, config):
self.config = config
handler = HTTPHandler.make_http_handler(self.config['media_dir'])
self.httpd = http.server.HTTPServer(('', self.config['media']['port']), hand... | import http.server
from threading import Thread
import os.path
class HTTPHandler:
def __init__(self, config):
self.config = config
handler = HTTPHandler.make_http_handler(self.config['media_dir'])
self.httpd = http.server.HTTPServer(('', self.config['media']['port']), handler)
se... | mit | Python |
c4e0c99ab14ba9ad3a5f5084798be0297a28865b | add decision_function to example | adykstra/mne-python,teonlamont/mne-python,teonlamont/mne-python,larsoner/mne-python,rkmaddox/mne-python,Odingod/mne-python,Teekuningas/mne-python,trachelr/mne-python,yousrabk/mne-python,pravsripad/mne-python,mne-tools/mne-python,larsoner/mne-python,dimkal/mne-python,olafhauk/mne-python,jaeilepp/mne-python,Teekuningas/m... | examples/decoding/plot_decoding_time_generalization.py | examples/decoding/plot_decoding_time_generalization.py | """
==========================================================
Decoding sensor space data with Generalization Across Time
==========================================================
This example runs the analysis computed in:
Jean-Remi King, Alexandre Gramfort, Aaron Schurger, Lionel Naccache
and Stanislas Dehaene, "T... | """
==========================================================
Decoding sensor space data with Generalization Across Time
==========================================================
This example runs the analysis computed in:
Jean-Remi King, Alexandre Gramfort, Aaron Schurger, Lionel Naccache
and Stanislas Dehaene, "T... | bsd-3-clause | Python |
196cf804fddb1f2943ddee60d0219b6c8dc4e439 | Add email field to User model. We will use this field as the unique user identifier. | thomasbhatia/kigata | app/models/user.py | app/models/user.py | from app.models import Model
from app.factory import mongodb
import datetime
from marshmallow import Schema, fields, ValidationError
from flask import current_app, json
from bson import ObjectId
from app.helpers import generate_sid
now = datetime.datetime.now()
class User(Model):
collection = mongodb.db.users
... | from app.models import Model
from app.factory import mongodb
import datetime
from marshmallow import Schema, fields, ValidationError
from flask import current_app, json
from bson import ObjectId
from app.helpers import generate_sid
now = datetime.datetime.now()
class User(Model):
collection = mongodb.db.users
... | bsd-3-clause | Python |
bdc800f7dc00933cd8fec0fa6ea13bd0dfc1050d | fix wsgi | tarvitz/djtp,tarvitz/djtp,tarvitz/djtp,tarvitz/djtp | wsgi.py | wsgi.py | """
WSGI config for mong project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... | """
WSGI config for mong project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... | bsd-3-clause | Python |
74fd7a24bdde74222dac0b4725947e27abdfb469 | remove video before retrying | benjaoming/ka-lite-zim,benjaoming/ka-lite-zim,benjaoming/ka-lite-zim | kalite_zim/utils.py | kalite_zim/utils.py | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
import logging
import os
import urllib
from colorlog import ColoredFormatter
from django.conf import settings
from fle_utils.videos import get_outside_video_urls
from . import __name__ as base_path
b... | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
import logging
import os
import urllib
from colorlog import ColoredFormatter
from django.conf import settings
from fle_utils.videos import get_outside_video_urls
from . import __name__ as base_path
b... | mit | Python |
fa57bd304f5924586b6c46076c83f1c0f1dc11ee | remove py3k imcompatible string raise from data example (this deprecated syntax is not need for the tests) | PyCQA/astroid | test/data/module2.py | test/data/module2.py | # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# copyright 2003-2010 Sylvain Thenault, all rights reserved.
# contact mailto:thenault@gmail.com
#
# This file is part of logilab-astng.
#
# logilab-astng is free software: you can redi... | # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# copyright 2003-2010 Sylvain Thenault, all rights reserved.
# contact mailto:thenault@gmail.com
#
# This file is part of logilab-astng.
#
# logilab-astng is free software: you can redi... | lgpl-2.1 | Python |
9759a806407cd9259e7ef4eb0303aa9f3b6ae336 | remove left-in print statements. | kuansim/timemap,ukris/timemapper,ukris/timemapper,ukris/timemapper,kuansim/timemap,kuansim/timemap,okfn/timemapper,okfn/timemapper,okfn/timemapper | hypernotes/web.py | hypernotes/web.py | import os
from flask import Flask, jsonify, render_template, json, request, redirect
from core import app
import logic
@app.route("/")
def home():
return 'Nothing to see here - go to api'
@app.route('/api/v1/note/<id>', methods=['GET', 'POST'])
def api_note(id):
if request.method == 'GET':
out = logi... | import os
from flask import Flask, jsonify, render_template, json, request, redirect
from core import app
import logic
@app.route("/")
def home():
return 'Nothing to see here - go to api'
@app.route('/api/v1/note/<id>', methods=['GET', 'POST'])
def api_note(id):
if request.method == 'GET':
out = logi... | mit | Python |
6ce14f21cec2c37939f68aaf40d5227c80636e53 | Add docstring to explain the code | laboiteproject/laboite-backend,laboiteproject/laboite-backend,bgaultier/laboitepro,bgaultier/laboitepro,bgaultier/laboitepro,laboiteproject/laboite-backend | app_bikes/forms.py | app_bikes/forms.py | from dal import autocomplete
from django import forms
class BikeModelForm(forms.ModelForm):
def __init__(self, *args, **kw):
super(BikeModelForm, self).__init__(*args, **kw)
if self.instance is not None:
# Saved instance is loaded, setup choices to display the selected value
... | from dal import autocomplete
from django import forms
class BikeModelForm(forms.ModelForm):
def __init__(self, *args, **kw):
super(BikeModelForm, self).__init__(*args, **kw)
if self.instance is not None:
# Saved instance is loaded, setup choices to display the selected value
... | agpl-3.0 | Python |
c18be2bbf78bc84b4642a749d536ba1ff3a50a0e | Set version number to 0.9. | live-clones/pybtex | pybtex/__version__.py | pybtex/__version__.py | version = '0.9'
| version = '20090402'
| mit | Python |
b22c5cdeb75f77c15eba5ef9ad2f8fca24d1a9db | add json mixin for core views | tarvitz/djtp,tarvitz/djtp,tarvitz/djtp,tarvitz/djtp | apps/core/views.py | apps/core/views.py | # Create your views here.
# coding: utf-8
from apps.core.helpers import render_to
from django.http import HttpResponse
try:
import simplejson as json
except ImportError:
import json
from django.views.generic.edit import (
FormMixin, TemplateResponseMixin, DeletionMixin
)
@render_to('index.html')
def index... | # Create your views here.
# coding: utf-8
from apps.core.helpers import render_to
from django.http import HttpResponse
@render_to('index.html')
def index(request):
return {}
def write_redirect(request, pk):
response = HttpResponse()
response.write('redirected with: %s' % pk)
return response
@rende... | bsd-3-clause | Python |
8b81699181f6b01784427d77e627bf722f78a68a | remove print() , use logger instead. | haandol/hongmoa,haandol/honey | apps/decorators.py | apps/decorators.py | import re
import traceback
from functools import wraps
from loggers import logger
TOKENIZE_PATTERN = re.compile(r'["“](.+?)["”]|(\S+)', re.U | re.S)
def _extract_tokens(message):
'''Parse the given message, extract command and split'em into tokens
Args:
message (str): user gave message
... | import re
import traceback
from functools import wraps
TOKENIZE_PATTERN = re.compile(r'["“](.+?)["”]|(\S+)', re.U | re.S)
def _extract_tokens(message):
'''Parse the given message, extract command and split'em into tokens
Args:
message (str): user gave message
Returns:
(... | mit | Python |
8b56d561bb120f1f3dba8962721c2156967e0d83 | Make rotation matrices | adrianliaw/PyCuber | pycuber/cube/cubie.py | pycuber/cube/cubie.py | import numpy as np
class Cubie(np.ndarray):
def __new__(subtype, side_colour_map, **kwargs):
if isinstance(side_colour_map, Cubie):
return side_colour_map
side_colour_map = np.array(side_colour_map)
if side_colour_map.shape == (6,):
return side_colour_map
... | import numpy as np
class Cubie(np.ndarray):
def __new__(subtype, side_colour_map, **kwargs):
if isinstance(side_colour_map, Cubie):
return side_colour_map
if not isinstance(side_colour_map, np.ndarray):
side_colour_map = np.array(side_colour_map)
if side_colour_m... | mit | Python |
e7b105105ae1dd826f195eb5d6c6716a9940b9c3 | Document get_exe_path() | innogames/igcommit | igcommit/utils.py | igcommit/utils.py | """igcommit - Utility functions
Copyright (c) 2021 InnoGames GmbH
Portions Copyright (c) 2021 Emre Hasegeli
"""
from os import X_OK, access, environ
def get_exe_path(exe):
"""Traverse the PATH to find where the executable is
This should behave similar to the shell built-in "which".
"""
for dir_path... | """igcommit - Utility functions
Copyright (c) 2021 InnoGames GmbH
Portions Copyright (c) 2021 Emre Hasegeli
"""
from os import X_OK, access, environ
def get_exe_path(exe):
for dir_path in environ['PATH'].split(':'):
path = dir_path.strip('"') + '/' + exe
if access(path, X_OK):
return... | mit | Python |
0b1f38b8354a0ad6a021f247a7bc1336ae5d50fb | Change some of the relative imports, which fail in doctests, to absolute imports. | mikemhenry/arcade,mikemhenry/arcade | arcade/__init__.py | arcade/__init__.py | """
The Arcade Library
A Python simple, easy to use module for creating 2D games.
"""
import arcade.key
import arcade.color
from arcade.version import *
from arcade.window_commands import *
from arcade.draw_commands import *
from arcade.sprite import *
from arcade.physics_engines import *
from arcade.physics_engine_2... | """
The Arcade Library
A Python simple, easy to use module for creating 2D games.
"""
import arcade.key
import arcade.color
from .version import *
from .window_commands import *
from .draw_commands import *
from .sprite import *
from .physics_engines import *
from .physics_engine_2d import *
from .application import ... | mit | Python |
7150674eec92120c6107fe728798bdcefba1efd7 | Use os.path.sep in util.py for regex DEFAULT_SKIP_FILES | certik/pyjamas,andreyvit/pyjamas,andreyvit/pyjamas,andreyvit/pyjamas,certik/pyjamas,certik/pyjamas,certik/pyjamas,andreyvit/pyjamas | pyjs/src/pyjs/util.py | pyjs/src/pyjs/util.py | import os
import shutil
import re
import logging
DEFAULT_SKIP_FILES=re.compile(
r"^(.*\%(sep)s)?("
r"(\..*)|"
r"(#.*#)|"
r"(.*~)|"
r"(.*\.py[co])|"
r"(.*\/RCS\/?.*)|"
r"(.*\/CVS\/?.*)|"
r"(.*\.egg-info.*)|"
r")$" % {'sep': os.path.sep})
def copytree_exists(src, dst, symlinks=False,... | import os
import shutil
import re
import logging
DEFAULT_SKIP_FILES=re.compile(
r"^(.*%(sep)s)?("
r"(\..*)|"
r"(#.*#)|"
r"(.*~)|"
r"(.*\.py[co])|"
r"(.*\/RCS\/?.*)|"
r"(.*\/CVS\/?.*)|"
r"(.*\.egg-info.*)|"
r")$" % {'sep': os.path.sep})
def copytree_exists(src, dst, symlinks=False,
... | apache-2.0 | Python |
6d55e296e99bfff28f6bdf694206871b8d04de62 | Fix client metadata extractor test | msmolens/girder,data-exp-lab/girder,jcfr/girder,Xarthisius/girder,sutartmelson/girder,Kitware/girder,opadron/girder,kotfic/girder,adsorensen/girder,msmolens/girder,kotfic/girder,jcfr/girder,sutartmelson/girder,Kitware/girder,salamb/girder,salamb/girder,chrismattmann/girder,data-exp-lab/girder,girder/girder,jcfr/girder,... | plugins/metadata_extractor/plugin_tests/client_metadata_extractor_test.py | plugins/metadata_extractor/plugin_tests/client_metadata_extractor_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | apache-2.0 | Python |
6627f00d592597b41bd3b288cd4ad3dccbecdecc | add prefix config | google-code-export/beets,google-code-export/beets,google-code-export/beets | beetsplug/fuzzy.py | beetsplug/fuzzy.py | # This file is part of beets.
# Copyright 2013, Philippe Mongeau.
#
# 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 use, copy... | # This file is part of beets.
# Copyright 2013, Philippe Mongeau.
#
# 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 use, copy... | mit | Python |
44574107a22a2cb20304151ee1b3907df4d1fcd4 | print warning instead of crash for overlapping input intervals | glennhickey/teHmm,glennhickey/teHmm | bin/fillTermini.py | bin/fillTermini.py | #!/usr/bin/env python
#Copyright (C) 2014 by Glenn Hickey
#
#Released under the MIT license, see LICENSE.txt
import sys
import os
import argparse
import copy
from pybedtools import BedTool, Interval
"""
Stick a bed interval between pairs of lastz termini. Script written to be used
in conjunction with tsdFinder.py:
... | #!/usr/bin/env python
#Copyright (C) 2014 by Glenn Hickey
#
#Released under the MIT license, see LICENSE.txt
import sys
import os
import argparse
import copy
from pybedtools import BedTool, Interval
"""
Stick a bed interval between pairs of lastz termini. Script written to be used
in conjunction with tsdFinder.py:
... | mit | Python |
1ba050509865832ce72b8ee79084b56c9836c9ff | update the test file to reflect the rename of the blockfinder.use_sql_database_call method | ioerror/blockfinder,d1b/blockfinder,Starefossen/docker-blockfinder,Starefossen/docker-blockfinder,ioerror/blockfinder,d1b/blockfinder | blockfindertest.py | blockfindertest.py | #!/usr/bin/python
import blockfinder
import unittest
import os
class CheckReverseLookup(unittest.TestCase):
ipValues = ( (3229318011, '192.123.123.123'),
(3463778365, '206.117.16.61'),
(4278190202, '255.0.0.122'),
(3654084623, '217.204.232.15'),
... | #!/usr/bin/python
import blockfinder
import unittest
import os
class CheckReverseLookup(unittest.TestCase):
ipValues = ( (3229318011, '192.123.123.123'),
(3463778365, '206.117.16.61'),
(4278190202, '255.0.0.122'),
(3654084623, '217.204.232.15'),
... | bsd-2-clause | Python |
e70a45baa04a8f79bc0fd47d52fac24ca9a5985e | Clean '--' values | dpxxdp/berniemetrics,Rumel/berniemetrics,dpxxdp/berniemetrics,fpagnoux/berniemetrics,dpxxdp/berniemetrics,Rumel/berniemetrics,Rumel/berniemetrics,dpxxdp/berniemetrics,fpagnoux/berniemetrics,fpagnoux/berniemetrics,Rumel/berniemetrics,fpagnoux/berniemetrics | private/realclearpolitics-scraper/realclearpolitics/spiders/spider.py | private/realclearpolitics-scraper/realclearpolitics/spiders/spider.py | import scrapy
from realclearpolitics.items import TableItem
class RcpSpider(scrapy.Spider):
name = "realclearpoliticsSpider"
start_urls = []
columns = ['Poll','Date', 'Sample', 'Spread']
def __init__(self, url, extra_fields = {}):
self.url = url
self.extra_fields = extra_fields
de... | import scrapy
from realclearpolitics.items import TableItem
class RcpSpider(scrapy.Spider):
name = "realclearpoliticsSpider"
start_urls = []
columns = ['Poll','Date', 'Sample', 'Spread']
def __init__(self, url, extra_fields = {}):
self.url = url
self.extra_fields = extra_fields
de... | mit | Python |
ed4f786de54dde50cb26cfe4859507579806a14b | Adjust to avoid bugs with other values in context | ingadhoc/sale,ingadhoc/sale,ingadhoc/sale,ingadhoc/sale | portal_sale_distributor/models/ir_action_act_window.py | portal_sale_distributor/models/ir_action_act_window.py | ##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, api
from odoo.tools.safe_eval import safe_eval
... | ##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, api
from odoo.tools.safe_eval import safe_eval
... | agpl-3.0 | Python |
e6cb753e625d53281a0cc6146911d267aa147643 | fix argparse | samcheck/PyMedia,samcheck/PyMedia,samcheck/PyMedia | whats_on_tv.py | whats_on_tv.py | #!venv/bin/python3
# media_namer.py - Renames passed media files in a folder (and subfolders) using
# OMDB for movies and theTVDB for TV shows
import sys
import os
import logging
import argparse
import random
import subprocess
import shlex
import videoLister
def main():
# set up logging
log... | #!venv/bin/python3
# media_namer.py - Renames passed media files in a folder (and subfolders) using
# OMDB for movies and theTVDB for TV shows
import sys
import os
import logging
import argparse
import random
import subprocess
import shlex
import videoLister
def main():
# set up logging
log... | mit | Python |
8f6abdc12292d3b8cc4ebd6a35563da05501aecd | add config parameter to dbImport | igemsoftware/Shenzhen_BGIC_0101_2013,erasche/jbrowse,SuLab/jbrowse,igemsoftware/Shenzhen_BGIC_0101_2013,igemsoftware/Shenzhen_BGIC_0101_2013,igemsoftware/Shenzhen_BGIC_0101_2013,limeng12/jbrowse,GreggHelt2/apollo-test,GMOD/jbrowse,SuLab/jbrowse,Arabidopsis-Information-Portal/jbrowse,erasche/jbrowse,erasche/jbrowse,nath... | python/db_importer.py | python/db_importer.py | import os
from json_generator import JsonGenerator
# example call:
# snpQuery = 'select chromStart as Start, chromEnd as End, name as Name, transcript, frame, alleleCount, funcCodes, alleles, codons, peptides'
# db_importer.dbImport(conn, "snp132CodingDbSnp", snpQuery, "chromEnd", "chrom", "../data/", "snp132CodingDbS... | import os
from json_generator import JsonGenerator
# example call:
# snpQuery = 'select chromStart as Start, chromEnd as End, name as Name, transcript, frame, alleleCount, funcCodes, alleles, codons, peptides'
# db_importer.dbImport(conn, "snp132CodingDbSnp", snpQuery, "chromEnd", "chrom", "../data/", "snp132CodingDbS... | lgpl-2.1 | Python |
d79c82e7406284eb0f3c696bd7cc5ecc08b66106 | Adjust settings path for wsgi | prattl/wepickheroes,prattl/wepickheroes,prattl/wepickheroes,prattl/wepickheroes | api/wph/wsgi.py | api/wph/wsgi.py | """
WSGI config for api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS... | """
WSGI config for api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS... | mit | Python |
bc95cf222a2f59e77962fb4ae5613d4695853944 | Add imports in halfedge_meshes/__init__.py | carlosrojas/halfedge_mesh | halfedge_mesh/__init__.py | halfedge_mesh/__init__.py | from halfedge_mesh import HalfedgeMesh
from halfedge_mesh import Vertex
from halfedge_mesh import Halfedge
from halfedge_mesh import Facet
| from halfedge_mesh import HalfedgeMesh | mit | Python |
bd369471abb00478f7b5e03a22f94e25133d7d78 | add __version__ | josesho/bootstrap_contrast | bootstrap_contrast/__init__.py | bootstrap_contrast/__init__.py | from .bootstrap_contrast import *
__version__=0.327
| from .bootstrap_contrast import * | mit | Python |
e9d6884e43869f5d22e882b0aec2a534fb2a735b | 部署2.1.1 | HeathKang/flasky,HeathKang/flasky,HeathKang/flasky | app/__init__.py | app/__init__.py | from flask import Flask,render_template
from flask.ext.bootstrap import Bootstrap
from flask.ext.mail import Mail
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from config import config
from flask.ext.login import LoginManager
from flask.ext.pagedown import PageDown
bootstrap... | from flask import Flask,render_template
from flask.ext.bootstrap import Bootstrap
from flask.ext.mail import Mail
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from config import config
from flask.ext.login import LoginManager
from flask.ext.pagedown import PageDown
bootstrap... | mit | Python |
5974af661e1c8d11aa92c5fb36ee41e10f616202 | Update test file | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | python/ql/test/experimental/dataflow/ApiGraphs/test.py | python/ql/test/experimental/dataflow/ApiGraphs/test.py | import a1 #$ use=moduleImport("a1")
x = a1.blah1 #$ use=moduleImport("a1").getMember("blah1")
import a2 as m2 #$ use=moduleImport("a2")
x2 = m2.blah2 #$ use=moduleImport("a2").getMember("blah2")
import a3.b3 as m3 #$ use=moduleImport("a3").getMember("b3")
x3 = m3.blah3 #$ use=moduleImport("a3").getMember("b3").ge... | import a1 #$ use=moduleImport("a1")
x = a1.blah1 #$ use=moduleImport("a1").getMember("blah1")
import a2 as m2 #$ use=moduleImport("a2")
x2 = m2.blah2 #$ use=moduleImport("a2").getMember("blah2")
import a3.b3 as m3 #$ use=moduleImport("a3").getMember("b3")
x3 = m3.blah3 #$ use=moduleImport("a3").getMember("b3").ge... | mit | Python |
a11c4b7c4f546156d5d70c9799d148b99e932e2c | Update __init__.py | SpaceHotDog/Flask_API | app/__init__.py | app/__init__.py | # app/__init__.py
from flask_api import FlaskAPI
from flask_sqlalchemy import SQLAlchemy
# local import
from instance.config import app_config
# initialize sql-alchemy
db = SQLAlchemy()
def create_app(config_name):
app = FlaskAPI(__name__, instance_relative_config=True)
app.config.from_object(app_config[con... | # app/__init__.py
from flask_api import FlaskAPI
from flask_sqlalchemy import SQLAlchemy
# local import
from instance.config import app_config
# initialize sql-alchemy
db = SQLAlchemy()
def create_app(config_name):
app = FlaskAPI(__name__, instance_relative_config=True)
app.config.from_object(app_config[con... | unlicense | Python |
672d88d69c28d5304dbc2b1ed055289671a9444f | fix views in init for import | dschmaryl/golf-flask,dschmaryl/golf-flask,dschmaryl/golf-flask | app/__init__.py | app/__init__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import Flask
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
from flask_login import LoginManager, current_user
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
app = Flask(__name__)
app.config.from_object('... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import Flask
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
from flask_login import LoginManager, current_user
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
app = Flask(__name__)
app.config.from_object('... | mit | Python |
9107d03f3c19cbc1f488478dc428dfcfaac93ded | update test | signalsciences/SigSciApiPy | test_SigSci.py | test_SigSci.py | from __future__ import print_function
from builtins import str
import unittest
import mock
from SigSciApiPy.SigSci import SigSciAPI
def mocked_requests_get(*args, **kwargs):
class MockResponse(object):
def __init__(self, json_data, status_code):
self.json_data = json_data
self.sta... | from __future__ import print_function
from builtins import str
import unittest
import mock
from SigSciApiPy.SigSci import SigSciAPI
def mocked_requests_get(*args, **kwargs):
class MockResponse(object):
def __init__(self, json_data, status_code):
self.json_data = json_data
self.sta... | mit | Python |
e4b9633ddd4c5926efd6dec56d70b9c1ac9a3b31 | support search by attribute name | cartologic/cartoview,cartologic/cartoview,cartologic/cartoview,cartologic/cartoview | cartoview/app_manager/rest.py | cartoview/app_manager/rest.py |
from cartoview.app_manager.models import AppInstance
from geonode.api.resourcebase_api import *
from .resources import FileUploadResource
from tastypie.resources import ModelResource
from tastypie import fields
from geonode.maps.models import Map as GeonodeMap, MapLayer as GeonodeMapLayer
from geonode.layers.models i... |
from cartoview.app_manager.models import AppInstance
from geonode.api.resourcebase_api import *
from .resources import FileUploadResource
from tastypie.resources import ModelResource
from tastypie import fields
from geonode.maps.models import Map as GeonodeMap, MapLayer as GeonodeMapLayer
from geonode.layers.models i... | bsd-2-clause | Python |
ca9ca7c4a4ca951a0584f16716057629f8560021 | Remove unused imports | alphagov/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend | app/__init__.py | app/__init__.py | import re
from datetime import timedelta
from flask import Flask, request, redirect, session, Markup
from flask_login import LoginManager
from flask_wtf.csrf import CsrfProtect
from dmutils import apiclient, init_app, flask_featureflags
from dmutils.user import User
from config import configs
from markdown import m... | import re
from datetime import timedelta
from flask import Flask, request, redirect, session
from flask_login import LoginManager
from flask_wtf.csrf import CsrfProtect
from dmutils import apiclient, init_app, flask_featureflags
from dmutils.user import User
from config import configs
from jinja2 import Markup, esc... | mit | Python |
31ea2191bb83101d0b9123f8e6a427aeefa9dee3 | test getsize | Volumental/fakefs | test_fakefs.py | test_fakefs.py | import unittest
import fakefs
from nose.tools import assert_equal, assert_true, assert_false, raises
import os
class FakeTestCase(unittest.TestCase):
def run(self, result=None):
self.fs = fakefs.FakeFilesystem()
with self.fs.monkey.patch():
super(FakeTestCase, self).run(result)
de... | import unittest
import fakefs
from nose.tools import assert_equal, assert_true, assert_false
import os
class FakeTestCase(unittest.TestCase):
def run(self, result=None):
self.fs = fakefs.FakeFilesystem()
with self.fs.monkey.patch():
super(FakeTestCase, self).run(result)
def test_o... | mit | Python |
0ec6f767d15bf59d6ba9f5088c88923136f18e2a | support mengxue | chinese-poetry/chinese-poetry,chinese-poetry/chinese-poetry | test_poetry.py | test_poetry.py | # -*- coding: utf-8 -*-
import os
import json
import sys
import traceback
import functools
def check_json(f, _dir):
if not f.endswith('.json'):
return True
filepath = os.path.join(_dir, f)
with open(filepath) as file:
try:
_ = json.loads(file.read())
sys.stdout.wri... | #! -*- coding: utf-8 -*-
# import sqlite3
import os
import json
import sys
import traceback
import functools
def check_json(f, _dir):
if not f.endswith('.json'):
return True
filepath = os.path.join(_dir, f)
with open(filepath) as file:
try:
_ = json.loads(file.read())
... | mit | Python |
ffb2b5a21018a59e99f5a2a959c30d95456244e0 | Update rtconfig.py | geniusgogo/rt-thread,weety/rt-thread,RT-Thread/rt-thread,RT-Thread/rt-thread,hezlog/rt-thread,RT-Thread/rt-thread,armink/rt-thread,nongxiaoming/rt-thread,armink/rt-thread,hezlog/rt-thread,geniusgogo/rt-thread,RT-Thread/rt-thread,nongxiaoming/rt-thread,nongxiaoming/rt-thread,RT-Thread/rt-thread,weety/rt-thread,hezlog/rt... | bsp/allwinner_tina/rtconfig.py | bsp/allwinner_tina/rtconfig.py | import os
# toolchains options
ARCH ='arm'
CPU ='arm9'
CROSS_TOOL ='gcc'
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
else:
RTT_ROOT = '../..'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = r'E:\wo... | import os
# toolchains options
ARCH ='arm'
CPU ='arm9'
CROSS_TOOL ='gcc'
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
else:
RTT_ROOT = '../..'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = r'E:\wo... | apache-2.0 | Python |
b1ad5c8a4d2e9a116a6bb385dbdbeb777f6852b0 | Fix ImportError in tests for `import_module` in django < 1.9 and >= 1.9 | hellysmile/django-mongo-sessions | tests/tests.py | tests/tests.py | # tests stolen from https://github.com/martinrusev/django-redis-sessions
try:
# For Django versions < 1.9
from django.utils.importlib import import_module
except ImportError:
# For Django versions >= 1.9
from django.utils.module_loading import import_module
from django.conf import settings
import time
... | # tests stolen from https://github.com/martinrusev/django-redis-sessions
from django.utils.importlib import import_module
from django.conf import settings
import time
from nose.tools import eq_
session_engine = import_module(settings.SESSION_ENGINE).SessionStore()
def test_modify_and_keys():
eq_(session_engine.... | apache-2.0 | Python |
1172c5e538b09dc3b65c44c1deff8ba2a9ad669c | check back | tqchen/tinyflow,ZihengJiang/tinyflow,tqchen/tinyflow,tqchen/tinyflow,ZihengJiang/tinyflow,ZihengJiang/tinyflow | example/mnist_softmax.py | example/mnist_softmax.py | """Tinyflow example code.
This code is adapted from Tensorflow's MNIST Tutorial with minimum code changes.
"""
import tinyflow as tf
from tinyflow.datasets import get_mnist
# Create the model
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
y = tf.nn.softmax(tf.matmul(x, W))
# Define ... | """Tinyflow example code.
This code is adapted from Tensorflow's MNIST Tutorial with minimum code changes.
"""
import tinyflow as tf
from tinyflow.datasets import get_mnist
stdev = 0.01
# Create the model
x = tf.placeholder(tf.float32, [None, 784])
conv1_filter = tf.Variable(tf.normal([20, 3, 5, 5], stdev=stdev))
co... | apache-2.0 | Python |
348205f38fbc09f04a6e8d795b001f08cce96c30 | fix `__init__` | scott-maddox/openbandparams | src/openbandparams/__init__.py | src/openbandparams/__init__.py | #
# Copyright (c) 2013-2014, Scott J Maddox
#
# This file is part of openbandparams.
#
# openbandparams is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# ... | #
# Copyright (c) 2013-2014, Scott J Maddox
#
# This file is part of openbandparams.
#
# openbandparams is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# ... | agpl-3.0 | Python |
ee2c15f068607fc0d919b407f90d43056bd53ce9 | drop extraneous newline | falconindy/auracle,falconindy/auracle,falconindy/auracle | tests/clone.py | tests/clone.py | #!/usr/bin/env python
import auracle_test
import os
class TestClone(auracle_test.TestCase):
def testCloneSingle(self):
p = self.Auracle(['clone', 'auracle-git'])
self.assertEqual(p.returncode, 0)
self.assertPkgbuildExists('auracle-git', git=True)
self.assertCountEqual(self.reque... | #!/usr/bin/env python
import auracle_test
import os
class TestClone(auracle_test.TestCase):
def testCloneSingle(self):
p = self.Auracle(['clone', 'auracle-git'])
self.assertEqual(p.returncode, 0)
self.assertPkgbuildExists('auracle-git', git=True)
self.assertCountEqual(self.reque... | mit | Python |
1831a7608a063d3f9b3dce7e42f591c50b099150 | remove the router name validation because that has been done in the __init__.py | tumluliu/rap | rap/servicefactory.py | rap/servicefactory.py | """ Factory of RoutingService classes """
import json
from .mb import MapboxRouter
from .graphhopper import GraphHopperRouter
# from . import mapzen
# from . import google
# from . import here
# from . import tomtom
""" Factory method of creating concrete routing service instances
"""
def RoutingServiceFactory(serv... | """ Factory of RoutingService classes """
import json
from .mb import MapboxRouter
from .graphhopper import GraphHopperRouter
# from . import mapzen
# from . import google
# from . import here
# from . import tomtom
""" Factory method of creating concrete routing service instances
"""
VALID_ROUTING_SERVICES = [
'... | mit | Python |
89cc31bd99b7c1397662352b411a5be9bd7cf625 | Set version to 6.11.0 | explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc | thinc/about.py | thinc/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = 'thinc'
__version__ = '6.11.0'
__summary__ = "Practical Machine Learning for NLP"
__uri__ = 'https://github.com/explosion/thinc'
__a... | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = 'thinc'
__version__ = '6.11.0.dev2'
__summary__ = "Practical Machine Learning for NLP"
__uri__ = 'https://github.com/explosion/thinc... | mit | Python |
e7ba38cb79be32336321d80394904243f0799c69 | Revert to using --output switch for the output file. | jd28/pynwn-tools,jd28/pynwn-tools | tlkie/tlkie.py | tlkie/tlkie.py | #!/usr/bin/env python
import argparse, os, sys
from pynwn.file.tlk import Tlk
from pynwn.file.tls import TLS
from pynwn.util.helper import get_encoding
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--version', action='version', version='0.1')
parser.add_argument('-o', '--output', help='Output TLK or ... | #!/usr/bin/env python
import argparse, os, sys
from pynwn.file.tlk import Tlk
from pynwn.file.tls import TLS
from pynwn.util.helper import get_encoding
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--version', action='version', version='0.1')
parser.add_argument('output', help='Output TLK or TLS file... | mit | Python |
76412c0d99dd3bed76cf0cc9d06629c6c72ce972 | fix bug on urls.py | kyunooh/JellyBlog,kyunooh/JellyBlog,kyunooh/JellyBlog | jellyblog/urls.py | jellyblog/urls.py | from django.conf.urls import url, include
from django.conf import settings
from django.http import HttpResponseRedirect
from django.contrib.sitemaps.views import sitemap
from jellyblog import views
from .feeds import LatestFeed, AllPublickFeed
from .sitemaps import BlogSitemap
from .serializer import router
sitemaps... | from django.conf.urls import url, include
from django.conf import settings
from django.http import HttpResponseRedirect
from django.contrib.sitemaps.views import sitemap
from jellyblog import views
from .feeds import LatestFeed, AllPublickFeed
from .sitemaps import BlogSitemap
from .serializer import router
sitemaps... | apache-2.0 | Python |
fb384756680bb533aa44d7cd638c15aaf0991d32 | Add some more tests | fedora-infra/hrf | tests/tests.py | tests/tests.py | import os
import hrf
import unittest
import json
directory = os.path.dirname(__file__)
class HrfTestCase(unittest.TestCase):
def setUp(self):
self.app = hrf.app.test_client()
def test_json1_title(self):
json_input = file(os.path.join(directory, '1.json'), 'r').read()
post = json.loads... | import os
import hrf
import unittest
import json
directory = os.path.dirname(__file__)
class HrfTestCase(unittest.TestCase):
def setUp(self):
self.app = hrf.app.test_client()
def test_json1_title(self):
json_input = file(os.path.join(directory, '1.json'), 'r').read()
post = json.loads... | lgpl-2.1 | Python |
7556def7c9d591b9579742545bb2f40777b26ed8 | Fix default value for the fake_utils' path argument | atodorov/libblockdev,vpodzime/libblockdev,atodorov/libblockdev,rhinstaller/libblockdev,atodorov/libblockdev,vpodzime/libblockdev,rhinstaller/libblockdev,rhinstaller/libblockdev,vpodzime/libblockdev | tests/utils.py | tests/utils.py | import os
import tempfile
from contextlib import contextmanager
def create_sparse_tempfile(name, size):
""" Create a temporary sparse file.
:param str name: suffix for filename
:param size: the file size (in bytes)
:returns: the path to the newly created file
"""
(fd, path) = tempf... | import os
import tempfile
from contextlib import contextmanager
def create_sparse_tempfile(name, size):
""" Create a temporary sparse file.
:param str name: suffix for filename
:param size: the file size (in bytes)
:returns: the path to the newly created file
"""
(fd, path) = tempf... | lgpl-2.1 | Python |
ccfdec698cfd6d4de3b3d57ab74bfd87a196957c | Rename these methods because we will introduce the json module's versions. | faassen/jsonvalue,faassen/jsonvalue | jsonvalue/core.py | jsonvalue/core.py | from pyld import jsonld
class JsonValue(object):
def __init__(self):
self._dumpers = {}
self._loaders = {}
def type(self, type, dump, load):
self._dumpers[type] = dump
self._loaders[type] = load
def load_value(self, type, value):
load = self._loaders.get(type)
... | from pyld import jsonld
class JsonValue(object):
def __init__(self):
self._dumpers = {}
self._loaders = {}
def type(self, type, dump, load):
self._dumpers[type] = dump
self._loaders[type] = load
def load(self, type, value):
load = self._loaders.get(type)
if... | bsd-3-clause | Python |
50e4cf1ae678ac73d41885647eee7c16a30e392d | Add one more test on registration. | allo-/django-registration,ei-grad/django-registration,PetrDlouhy/django-registration,wda-hb/test,yorkedork/django-registration,alawnchen/django-registration,Geffersonvivan/django-registration,kinsights/django-registration,wy123123/django-registration,rulz/django-registration,imgmix/django-registration,tanjunyen/django-... | registration/tests.py | registration/tests.py | """
Unit tests for django-registration.
"""
from django.core import mail
from django.test import TestCase
from registration.models import RegistrationProfile
class DefaultBackendTestCase(TestCase):
"""
Test the default registration backend.
"""
def setUp(self):
"""
Create an in... | """
Unit tests for django-registration.
"""
from django.core import mail
from django.test import TestCase
from registration.models import RegistrationProfile
class DefaultBackendTestCase(TestCase):
"""
Test the default registration backend.
"""
def setUp(self):
"""
Create an in... | bsd-3-clause | Python |
8f9b1d8ae70bd259e2b2953913a03f52e5960a1b | Test email sending. | stefankoegl/django-couchdb-utils,ogirardot/django-registration,ratio/django-registration,stefankoegl/django-registration-couchdb,stefankoegl/django-registration-couchdb,wuyuntao/django-registration,wuyuntao/django-registration,danielsokolowski/django-registration,schmidsi/django-registration,andresdouglas/django-regist... | registration/tests.py | registration/tests.py | """
Unit tests for django-registration.
"""
from django.core import mail
from django.test import TestCase
class DefaultBackendTestCase(TestCase):
"""
Test the default registration backend.
"""
def setUp(self):
"""
Create an instance of the default backend for use in testing.
... | """
Unit tests for django-registration.
"""
from django.test import TestCase
class DefaultBackendTestCase(TestCase):
"""
Test the default registration backend.
"""
def setUp(self):
"""
Create an instance of the default backend for use in testing.
"""
fro... | bsd-3-clause | Python |
0145cfad50b72d3f2105fe17f6de11831ce5c1de | Add -c option to specify dataframe columns name in advance. | geektoni/Influenza-Like-Illness-Predictor,geektoni/Influenza-Like-Illness-Predictor | data_analysis/generate_weekly_data.py | data_analysis/generate_weekly_data.py | #!/usr/bin/env python
# Given a complete year files with data in the form (page, week, visits)
# this script will generate a convenient csv file which will store for
# each page and for each years's week the total number of visits.
#
# Written by Giovanni De Toni (2017)
# Email: giovanni.det at gmail.com
"""Generate y... | #!/usr/bin/env python
# Given a complete year files with data in the form (page, week, visits)
# this script will generate a convenient csv file which will store for
# each page and for each years's week the total number of visits.
#
# Written by Giovanni De Toni (2017)
# Email: giovanni.det at gmail.com
"""Generate y... | mit | Python |
1334a91c9200fdefd8938ceacee67a5f0ad6bd84 | update regex for sql log parse | lsaffre/lino,lsaffre/lino,khchine5/lino,lino-framework/lino,lsaffre/lino,khchine5/lino,lino-framework/lino,lino-framework/lino,lsaffre/lino,lino-framework/lino,lino-framework/lino,lsaffre/lino,khchine5/lino,khchine5/lino,khchine5/lino | lino/utils/sql.py | lino/utils/sql.py | # import lino
# lino.startup('lino_book.projects.team.settings.demo')
# import django
# print django.__file__
# from lino.api.doctest import *
# show_sql_queries()
# #doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
# r = demo_get('robin','api/tickets/AllTickets', fmt='json', limit=1)
# print(r)
# show_sql_queries()
import ... | # import lino
# lino.startup('lino_book.projects.team.settings.demo')
# import django
# print django.__file__
# from lino.api.doctest import *
# show_sql_queries()
# #doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
# r = demo_get('robin','api/tickets/AllTickets', fmt='json', limit=1)
# print(r)
# show_sql_queries()
import ... | unknown | Python |
0bc4535aa5b17cebfdf8243b165c678538a10fe7 | remove table truncating, when connecting to database | varnish/varnish-microservice-monitor,varnish/zipnish,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/zipnish,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/varnish-microservice-monitor,varnish/zipnish,varnish/varnish-microservice-monitor | log-reader/app.py | log-reader/app.py | # basic stuff required for logging / debugging
import os, sys, syslog, traceback
# varnishapi to interact with varnishlog
import varnishapi
# log module to manage data flow coming in from varnishlog into ZipKin database
from log import LogReader, LogDataManager
from log import LogDatabase, LogStorage
# called when t... | # basic stuff required for logging / debugging
import os, sys, syslog, traceback
# varnishapi to interact with varnishlog
import varnishapi
# log module to manage data flow coming in from varnishlog into ZipKin database
from log import LogReader, LogDataManager
from log import LogDatabase, LogStorage
# called when t... | bsd-2-clause | Python |
4223c8e235337fbb2935eb0e6c78eab50b158609 | Update version string. | pquentin/libcloud,erjohnso/libcloud,carletes/libcloud,mbrukman/libcloud,mistio/libcloud,sfriesel/libcloud,mtekel/libcloud,sahildua2305/libcloud,aleGpereira/libcloud,jerryblakley/libcloud,Verizon/libcloud,sfriesel/libcloud,NexusIS/libcloud,Keisuke69/libcloud,aviweit/libcloud,thesquelched/libcloud,atsaki/libcloud,smafful... | libcloud/__init__.py | libcloud/__init__.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 |
2f784a5eb8002b2fbb4e960685a1f43474309bf4 | bump version | Calysto/octave_kernel,Calysto/octave_kernel | octave_kernel/__init__.py | octave_kernel/__init__.py | """An Octave kernel for Jupyter"""
__version__ = '0.25.0'
| """An Octave kernel for Jupyter"""
__version__ = '0.24.8'
| bsd-3-clause | Python |
aaa30aab6c2b46a1ae247d9cdee8033641106172 | Bump version | Frojd/django-react-templatetags,Frojd/django-react-templatetags,Frojd/django-react-templatetags | django_react_templatetags/__init__.py | django_react_templatetags/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
django_react_templatetags
----------
This extension allows you to add React components into your django templates.
"""
__title__ = "django_react_templatetags"
__version__ = "5.0.1"
__build__ = 501
__author__ = "Martin Sandström"
__license__ = "MIT"
__copyright__ = "Co... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
django_react_templatetags
----------
This extension allows you to add React components into your django templates.
"""
__title__ = "django_react_templatetags"
__version__ = "5.0.0"
__build__ = 500
__author__ = "Martin Sandström"
__license__ = "MIT"
__copyright__ = "Co... | mit | Python |
510c111a9ec2672857455a66c3718145185fffdc | Make default type of is_dict_union 'type' and automatically add key to nested is_dict_unions | Daanvdk/is_valid | is_valid/is_dict_union.py | is_valid/is_dict_union.py | from .base import Predicate
from .is_dict_where import is_dict_where
from .is_in import is_in
from .is_superdict_where import is_superdict_where
from .is_subdict_where import is_subdict_where
from .to_pred import to_pred
class is_dict_union(Predicate):
def __init__(self, *args, **kwargs):
if args and isi... | from .base import Predicate
from .is_dict_where import is_dict_where
from .is_in import is_in
from .is_superdict_where import is_superdict_where
from .is_subdict_where import is_subdict_where
from .to_pred import to_pred
class is_dict_union(Predicate):
def __init__(self, key, *args, **kwargs):
self._key ... | mit | Python |
b8cf5becf6b68d8044ad3a89a9abcea107909597 | Add adapters to main pika import | fkarb/pika-python3,reddec/pika,hugoxia/pika,knowsis/pika,vrtsystems/pika,vitaly-krugl/pika,Zephor5/pika,zixiliuyue/pika,jstnlef/pika,benjamin9999/pika,renshawbay/pika-python3,skftn/pika,Tarsbot/pika,pika/pika,shinji-s/pika | pika/__init__.py | pika/__init__.py | # ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozilla.org/MPL/
#
# Software distri... | # ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozilla.org/MPL/
#
# Software distri... | mpl-2.0 | Python |
b527f9a87c1b18412db9d98ac5272ddc4aad03f9 | Add extraInfo link in `/admin/auth/user` | caesar2164/edx-platform,caesar2164/edx-platform,caesar2164/edx-platform,Stanford-Online/edx-platform,Stanford-Online/edx-platform,Stanford-Online/edx-platform,caesar2164/edx-platform,Stanford-Online/edx-platform | openedx/stanford/djangoapps/register_cme/admin.py | openedx/stanford/djangoapps/register_cme/admin.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.utils.html import format_html
from .models import ExtraInfo
class ExtraInfoAdmin(admin.ModelAdmin):
"""
Adm... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import ExtraInfo
class ExtraInfoAdmin(admin.ModelAdmin):
"""
Admin interface for ExtraInfo model.
"""
list_display = (
'user',
'get_email',
'last_name',
'fir... | agpl-3.0 | Python |
7bbf00a1e68d2310346c10f416e9bee16e99bb44 | Add RegisterForm | siawyoung/bookstore,siawyoung/bookstore,siawyoung/bookstore | bookstore_app/forms.py | bookstore_app/forms.py | import pdb
from django import forms
from models import *
class LoginForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
class Meta:
model = Customer
fields = ['login_id', 'password']
labels = {
'login_id': 'Username'
}
class RegisterForm(fo... | from django import forms
from models import *
class LoginForm(forms.ModelForm):
# username = forms.CharField(label='Username', max_length=20)
# password = forms.PasswordInput()
password = forms.CharField(widget=forms.PasswordInput)
class Meta:
model = Customer
fields = ['login_id', 'pas... | mit | Python |
f1cefc3fa4500440af63765784175baf760ae6c7 | bump version 0.9.9 | littlezz/island-backup,littlezz/island-backup,littlezz/island-backup | island_backup/__init__.py | island_backup/__init__.py | version = '0.9.9'
| version = '0.9.1'
| mit | Python |
3a795c6a614d96012d60216818cd3b6a4f2e7ab0 | Remove hard coded input and output files from script | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | embem/bodyparts/make_body_part_mapping.py | embem/bodyparts/make_body_part_mapping.py | """Make a mapping from body part words to categories.
Make mapping <body part word> -> [historic words] based on Inger Leemans'
clustering.
Usage: python make_body_part_mapping.py
Requires files body_part_clusters_renaissance.csv,
body_part_clusters_classisism.csv, and body_part_clusters_enlightenment.csv to
be in t... | """Make a mapping from body part words to categories.
Make mapping <body part word> -> [historic words] based on Inger Leemans'
clustering.
Usage: python make_body_part_mapping.py
Requires files body_part_clusters_renaissance.csv,
body_part_clusters_classisism.csv, and body_part_clusters_enlightenment.csv to
be in ... | apache-2.0 | Python |
110131487474abadd6255bd31153592f3fa516c0 | Add SDG and validation generator | johnmartinsson/bird-species-classification,johnmartinsson/bird-species-classification | trainResnet.py | trainResnet.py | from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
SEED = 1337
from keras.datasets import mnist
from keras.utils import np_utils
from keras import backend as K
from keras.optimizers import SGD
from bird.models.resnet import ResNetBuilder
from bird.generators.sound imp... | from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
SEED = 1337
from keras.datasets import mnist
from keras.utils import np_utils
from keras import backend as K
from bird.models.resnet import ResNetBuilder
from bird.generators.sound import SoundDataGenerator
batch_siz... | mit | Python |
cf0d928cffc86e7ba2a68a7e95c54c7e530d2da8 | Disable accelerate_simd test for now. | apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb | packages/Python/lldbsuite/test/lang/swift/accelerate_simd/TestAccelerateSIMD.py | packages/Python/lldbsuite/test/lang/swift/accelerate_simd/TestAccelerateSIMD.py | # TestAccelerateSIMD.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTR... | # TestAccelerateSIMD.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTR... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.