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 |
|---|---|---|---|---|---|---|---|---|
a619d5b35eb88ab71126e53f195190536d71fdb4 | Throw exceptions error responses from server | solarwinds/orionsdk-python | orionsdk/swisclient.py | orionsdk/swisclient.py | import requests
import json
from datetime import datetime
def _json_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinstance(obj, datetime):
serial = obj.isoformat()
return serial
class SwisClient:
def __init__(self, hostname, username, password,... | import requests
import json
from datetime import datetime
def _json_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinstance(obj, datetime):
serial = obj.isoformat()
return serial
class SwisClient:
def __init__(self, hostname, username, password,... | apache-2.0 | Python |
0da6b77ec037005caf5f0b06949cbf4981d82616 | Fix sensitivity factories | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin | geotrek/sensitivity/factories.py | geotrek/sensitivity/factories.py | # -*- coding: utf-8 -*-
import factory
from geotrek.authent.factories import StructureRelatedDefaultFactory
from geotrek.common.utils.testdata import dummy_filefield_as_sequence
from . import models
class SportPracticeFactory(factory.DjangoModelFactory):
class Meta:
model = models.SportPractice
na... | # -*- coding: utf-8 -*-
import factory
from geotrek.authent.factories import StructureRelatedDefaultFactory
from geotrek.common.utils.testdata import dummy_filefield_as_sequence
from . import models
class SportPracticeFactory(factory.DjangoModelFactory):
class Meta:
model = models.SportPractice
na... | bsd-2-clause | Python |
bce007eb1e89ed66d911827e764d1062dc220d4f | add another potential with steeper slope | adrn/StreamMorphology,adrn/StreamMorphology,adrn/StreamMorphology | streammorphology/potential.py | streammorphology/potential.py | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
import astropy.units as u
import numpy as np
# Project
import gary.potential as gp
from gary.units import galactic
__all__ = ['potential_registry']
# built-in potentials
potential_registry =... | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
import astropy.units as u
import numpy as np
# Project
import gary.potential as gp
from gary.units import galactic
__all__ = ['potential_registry']
# built-in potentials
potential_registry =... | mit | Python |
336fd0a2258ae450e38dc9ddc22268b4d77f1be7 | Fix broken test | PersonalGenomesOrg/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans | studies/american_gut/tests.py | studies/american_gut/tests.py | from provider.oauth2.models import AccessToken
from rest_framework import status
from rest_framework.test import APITestCase
class UserDataTests(APITestCase):
fixtures = ['open_humans/fixtures/test-data.json']
def verify_request(self, url, status_code):
response = self.client.get('/api/american-gut'... | from provider.oauth2.models import AccessToken
from rest_framework import status
from rest_framework.test import APITestCase
class UserDataTests(APITestCase):
fixtures = ['open_humans/fixtures/test-data.json']
def verify_request(self, url, status_code):
response = self.client.get('/api/american-gut' ... | mit | Python |
218f9d44904305fea28ce99c3c22fd246f18b3e5 | Bump 0.8.2. | Enyx-SA/yassh,enyx-opensource/yassh,enyx-opensource/yassh | yassh/__init__.py | yassh/__init__.py | import logging
from .reactor import Reactor
from .remote_run import RemoteRun, remote_run
from .remote_copy import RemoteCopy, remote_copy
from .local_run import LocalRun, local_run
from .exceptions import AlreadyStartedException
logging.getLogger(__name__).addHandler(logging.NullHandler())
__all__ = ['RemoteRun', '... | import logging
from .reactor import Reactor
from .remote_run import RemoteRun, remote_run
from .remote_copy import RemoteCopy, remote_copy
from .local_run import LocalRun, local_run
from .exceptions import AlreadyStartedException
logging.getLogger(__name__).addHandler(logging.NullHandler())
__all__ = ['RemoteRun', '... | mit | Python |
809ae0b330c528af59c299b45e3494291adf2c6a | Use nvm in project file | maxbrunsfeld/node-tree-sitter-compiler,maxbrunsfeld/node-tree-sitter-compiler,tree-sitter/node-tree-sitter-compiler,tree-sitter/tree-sitter-cli,tree-sitter/tree-sitter-cli,tree-sitter/tree-sitter-cli,tree-sitter/node-tree-sitter-compiler,tree-sitter/node-tree-sitter-compiler,tree-sitter/tree-sitter-cli,maxbrunsfeld/nod... | .ycm_extra_conf.py | .ycm_extra_conf.py | import os
import ycm_core
from clang_helpers import PrepareClangFlags
flags = [
'-Wall',
'-std=c++11',
'-stdlib=libc++',
'-x', 'c++',
'-I', 'src',
'-I', os.path.expanduser('~/.nvm/current/include/node'),
'-I', 'vendor/tree-sitter/include',
'-isystem', '/Applications/Xcode.app/Contents/... | import os
import ycm_core
from clang_helpers import PrepareClangFlags
flags = [
'-Wall',
'-std=c++11',
'-stdlib=libc++',
'-x', 'c++',
'-I', 'src',
'-I', 'node_modules/tree-sitter/include',
'-I', '/usr/local/include/node',
'-I', 'vendor/tree-sitter/include',
'-isystem', '/Applicatio... | mit | Python |
dc5e0baebc6af7644340a610afe307ee2ef58cd2 | Update Flask example for new APIs. | rduplain/wsgi_party,rduplain/wsgi_party | examples/flask/flask_party.py | examples/flask/flask_party.py | from flask import Flask, abort, request
from wsgi_party import WSGIParty
class PartylineFlask(Flask):
def __init__(self, import_name, *args, **kwargs):
super(PartylineFlask, self).__init__(import_name, *args, **kwargs)
self.add_url_rule(WSGIParty.invite_path, endpoint='partyline',
... | from flask import Flask, request
from wsgi_party import WSGIParty, PartylineConnector
class PartylineFlask(Flask, PartylineConnector):
def __init__(self, import_name, *args, **kwargs):
super(PartylineFlask, self).__init__(import_name, *args, **kwargs)
self.add_url_rule(WSGIParty.invite_path, endpo... | bsd-3-clause | Python |
30f48175d9e4972599b564708fb65a6c534c9f12 | fix migrations | justb4/GeoHealthCheck,tomkralidis/GeoHealthCheck,geopython/GeoHealthCheck,tomkralidis/GeoHealthCheck,tomkralidis/GeoHealthCheck,justb4/GeoHealthCheck,tomkralidis/GeoHealthCheck,geopython/GeoHealthCheck,geopython/GeoHealthCheck,geopython/GeoHealthCheck,justb4/GeoHealthCheck,justb4/GeoHealthCheck | GeoHealthCheck/migrations/versions/2638c2a40625_.py | GeoHealthCheck/migrations/versions/2638c2a40625_.py | """empty message
Revision ID: 2638c2a40625
Revises: 992013af402f
Create Date: 2017-09-08 10:48:19.596099
"""
from alembic import op
import sqlalchemy as sa
import imp
import os
# revision identifiers, used by Alembic.
revision = '2638c2a40625'
down_revision = '992013af402f'
branch_labels = None
depends_on = None
a... | """empty message
Revision ID: 2638c2a40625
Revises: 992013af402f
Create Date: 2017-09-08 10:48:19.596099
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2638c2a40625'
down_revision = '992013af402f'
branch_labels = None
depends_on = None
alembic_helpers = imp.... | mit | Python |
27d35f4dbf2d8a05a6abfcf73ef9ef51986d8770 | add scheduled searchvector logging | datasciencebr/serenata-de-amor,datasciencebr/serenata-de-amor | jarbas/celery.py | jarbas/celery.py | import os
from celery import Celery
from celery.schedules import crontab
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jarbas.settings')
app = Celery('jarbas')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
@app.on_after_configure.connect
def setup_periodic_tasks(sen... | import os
from celery import Celery
from celery.schedules import crontab
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jarbas.settings')
app = Celery('jarbas')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
@app.on_after_configure.connect
def setup_periodic_tasks(sen... | mit | Python |
2c7ccb7d801dcedf5fac62eb2123480ba0523aad | fix for session stats parsing | steeve/libtorrent,steeve/libtorrent,steeve/libtorrent,steeve/libtorrent,steeve/libtorrent,steeve/libtorrent | parse_session_stats.py | parse_session_stats.py | #! /usr/bin/env python
# Copyright Arvid Norberg 2008. Use, modification and distribution is
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import os, sys, time
ignore = ['download rate', 'disk block buffers']
stat = ope... | #! /usr/bin/env python
# Copyright Arvid Norberg 2008. Use, modification and distribution is
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import os, sys, time
ignore = ['download rate', 'disk block buffers']
stat = ope... | bsd-3-clause | Python |
16070ee6d1ddc8ebbbb3cdc3992553f6e4f1daa3 | Create get_company_type_selection | OCA/l10n-belgium,OCA/l10n-belgium | l10n_be_cooperator/models/subscription_request.py | l10n_be_cooperator/models/subscription_request.py | from odoo import models
class SubscriptionRequest(models.Model):
_inherit = "subscription.request"
def get_company_type_selection(self):
return [
("scrl", "SCRL"),
("asbl", "ASBL"),
("sprl", "SPRL"),
("sa", "SA"),
]
| from odoo import fields, models
class SubscriptionRequest(models.Model):
_inherit = "subscription.request"
company_type = fields.Selection(
[("scrl", "SCRL"), ("asbl", "ASBL"), ("sprl", "SPRL"), ("sa", "SA")]
)
| agpl-3.0 | Python |
490d09a31415d3fd1b16f650188bfd8e701ae8e8 | Support units in progress messages | dodocat/git-repo,luohongzhen/git-repo,HenningSchroeder/git-repo,ossxp-com/repo,jmollan/git-repo,iAlios/git-repo,opencontrail-ci-admin/git-repo,sapiippo/git-repo,alanbian/git-repo,Omnifarious/git-repo,loungin/git-repo,wzhy90/git-repo,CedricCabessa/repo,lchiocca/repo,josn-jys/git-repo,nuclearmistake/repo,xhteam/git-repo,... | progress.py | progress.py | #
# Copyright (C) 2009 The Android Open Source Project
#
# 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 la... | #
# Copyright (C) 2009 The Android Open Source Project
#
# 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 la... | apache-2.0 | Python |
0ceb5c3f03d02f99ce28e9b92fa77c9384cd9470 | Fix failing BigQuery tests | cpcloud/ibis,ibis-project/ibis,cpcloud/ibis,cpcloud/ibis,cloudera/ibis,cpcloud/ibis,ibis-project/ibis,cloudera/ibis,ibis-project/ibis,cloudera/ibis,ibis-project/ibis | ibis/tests/all/test_client.py | ibis/tests/all/test_client.py | import pytest
from pkg_resources import parse_version
import ibis
import ibis.expr.datatypes as dt
from ibis.tests.backends import BigQuery
@pytest.mark.xfail_unsupported
def test_version(backend, con):
expected_type = (
type(parse_version('1.0')),
type(parse_version('1.0-legacy')),
)
ass... | import pytest
from pkg_resources import parse_version
import ibis
import ibis.expr.datatypes as dt
@pytest.mark.xfail_unsupported
def test_version(backend, con):
expected_type = (
type(parse_version('1.0')),
type(parse_version('1.0-legacy')),
)
assert isinstance(con.version, expected_type... | apache-2.0 | Python |
94b010cff5cba4619fe8c4643669c8c5eb3dec08 | Bump version to 0.3.3 | lillian-gardenia-seabreeze/sappho,lillian-gardenia-seabreeze/sappho,lily-seabreeze/sappho,lillian-lemmer/sappho,lillian-lemmer/sappho,lily-seabreeze/sappho | sappho/__init__.py | sappho/__init__.py | if __name__ == "__main__":
__version__ = "0.3.3"
else:
from animatedsprite import AnimatedSprite
from tilemap import TileMap, Tilesheet, tmx_file_to_tilemaps
from layers import SurfaceLayers
| if __name__ == "__main__":
__version__ = "0.3.2"
else:
from animatedsprite import AnimatedSprite
from tilemap import TileMap, Tilesheet, tmx_file_to_tilemaps
from layers import SurfaceLayers
| mit | Python |
c1a51f02c6c11fcec4d3f4cf64c774c8b907e8df | update to version 2.1.1 | haeygen/SSHLibrary,junousia/SSHLibrary,haeygen/SSHLibrary,junousia/SSHLibrary | src/SSHLibrary/version.py | src/SSHLibrary/version.py | VERSION = '2.1.1'
| VERSION = '2.1'
| apache-2.0 | Python |
46f2659a15a3abf1063c6fa4daad584ebc169ad9 | Allow 'localhost' for production settings | siggame/discuss | discuss/discuss/production.py | discuss/discuss/production.py | from discuss.discuss.settings import *
##########################################################################
#
# Server settings
#
##########################################################################
ALLOWED_HOSTS = ["localhost"]
WSGI_APPLICATION = 'discuss.discuss.wsgi_production.application'
#########... | from discuss.discuss.settings import *
##########################################################################
#
# Server settings
#
##########################################################################
ALLOWED_HOSTS = []
WSGI_APPLICATION = 'discuss.discuss.wsgi_production.application'
####################... | bsd-3-clause | Python |
d96438913865bd70df75c532919018ce547e3e18 | Remove incorrect docs for environment variables in attribute_modifications.py. | irtnog/SATOSA,SUNET/SATOSA,its-dirg/SATOSA,irtnog/SATOSA,SUNET/SATOSA | src/satosa/micro_services/attribute_modifications.py | src/satosa/micro_services/attribute_modifications.py | import re
from .base import ResponseMicroService
class AddStaticAttributes(ResponseMicroService):
"""
Add static attributes to the responses.
"""
def __init__(self, config, **kwargs):
super().__init__()
self.static_attributes = config["static_attributes"]
def process(self, conte... | import re
from .base import ResponseMicroService
class AddStaticAttributes(ResponseMicroService):
"""
Add static attributes to the responses.
The path to the file describing the mapping (as YAML) of static attributes must be specified
with the environment variable 'SATOSA_STATIC_ATTRIBUTES'.
"""... | apache-2.0 | Python |
79086d3de93329475dc2a67e05fccbb401f34754 | Add missing VariantCycle in _hoomd.py | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/_hoomd.py | hoomd/_hoomd.py | # This file exists to allow the hoomd module to import from the source checkout dir
# for use when building the sphinx documentation.
class Messenger(object):
def openPython(self):
pass
def notice(self, i, v):
pass
class GetarCompression(object):
FastCompress = 1
class GetarDumpMode(obje... | # This file exists to allow the hoomd module to import from the source checkout dir
# for use when building the sphinx documentation.
class Messenger(object):
def openPython(self):
pass
def notice(self, i, v):
pass
class GetarCompression(object):
FastCompress = 1
class GetarDumpMode(obje... | bsd-3-clause | Python |
37605da734cff0359ed9555a810d94837f995231 | fix visitor extend modifiers | nikitanovosibirsk/district42 | district42/_schema_visitor.py | district42/_schema_visitor.py | from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Generic, TypeVar
if TYPE_CHECKING:
from .types import (
AnySchema,
BoolSchema,
ConstSchema,
DictSchema,
FloatSchema,
IntSchema,
ListSchema,
NoneSchema,
StrSchema,
)... | from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Generic, TypeVar
if TYPE_CHECKING:
from .types import (
AnySchema,
BoolSchema,
ConstSchema,
DictSchema,
FloatSchema,
IntSchema,
ListSchema,
NoneSchema,
StrSchema,
)... | apache-2.0 | Python |
128d771654b99e56c0a3f399936ac2dbe046109a | create release/1.6.1 branch | rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo | dojo/__init__.py | dojo/__init__.py |
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app # noqa
__version__ = '1.6.1'
__url__ = 'https://github.com/DefectDojo/django-DefectDojo'
__docs__ = 'http://defectdojo.readthedocs.io/'
__demo__ = 'http://defectdojo.pyt... |
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app # noqa
__version__ = '1.6.0'
__url__ = 'https://github.com/DefectDojo/django-DefectDojo'
__docs__ = 'http://defectdojo.readthedocs.io/'
__demo__ = 'http://defectdojo.pyt... | bsd-3-clause | Python |
4f006ccf3b53b237ada95099b44ba1d9f2f106fe | Clean up imports | AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT... | python_scripts/extractor_python_readability_server.py | python_scripts/extractor_python_readability_server.py | #!/usr/bin/python
import sys
import os
import glob
sys.path.append(os.path.join(os.path.dirname(__file__),"gen-py/thrift_solr/"))
sys.path.append(os.path.dirname(__file__) )
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.server imp... | #!/usr/bin/python
import sys
import os
import glob
#sys.path.append(os.path.join(os.path.dirname(__file__), "gen-py"))
sys.path.append(os.path.join(os.path.dirname(__file__),"gen-py/thrift_solr/"))
sys.path.append(os.path.dirname(__file__) )
from thrift.transport import TSocket
from thrift.transport import TTranspor... | agpl-3.0 | Python |
65105ab4b886ddc87a60cfa4e6600d8996164a81 | Update __init__.py | PKRoma/python-for-android,kronenpj/python-for-android,wexi/python-for-android,rnixx/python-for-android,wexi/python-for-android,ibobalo/python-for-android,kivy/python-for-android,wexi/python-for-android,germn/python-for-android,wexi/python-for-android,kronenpj/python-for-android,rnixx/python-for-android,kronenpj/python-... | pythonforandroid/recipes/websocket-client/__init__.py | pythonforandroid/recipes/websocket-client/__init__.py | from pythonforandroid.toolchain import Recipe
# if android app crashes on start with "ImportError: No module named websocket"
#
# copy the 'websocket' directory into your app directory to force inclusion.
#
# see my example at https://github.com/debauchery1st/example_kivy_websocket-recipe
#
# If you see errors rel... | from pythonforandroid.toolchain import Recipe
# if android app crashes on start with "ImportError: No module named websocket"
#
# copy the 'websocket' directory into your app directory to force inclusion.
#
# see my example at https://github.com/debauchery1st/example_kivy_websocket-recipe
class WebSocketClient(R... | mit | Python |
8ca2b5c366c8eb678790e4865bef0ccbf8b9ffde | remove gevent monkey_patch while we are developing | poppingtonic/call-power,spacedogXYZ/call-power,jinding/call-power,spacedogXYZ/call-power,jinding/call-power,OpenSourceActivismTech/call-power,OpenSourceActivismTech/call-power,poppingtonic/call-power,18mr/call-congress,18mr/call-congress,spacedogXYZ/call-power,OpenSourceActivismTech/call-power,jinding/call-power,OpenSo... | call_server/app.py | call_server/app.py | #TODO, figure out how to load gevent monkey patch only in production
# try:
# from gevent.monkey import patch_all
# patch_all()
# except ImportError:
# if not DEBUG:
# print "unable to apply gevent monkey.patch_all"
from flask import Flask
from flask.ext.assets import Bundle
from .config import De... | try:
from gevent.monkey import patch_all
patch_all()
except ImportError:
print "unable to apply gevent monkey.patch_all"
from flask import Flask
from flask.ext.assets import Bundle
from .config import DefaultConfig
from .admin import admin
from .user import user
from .call import call
from .campaign impor... | agpl-3.0 | Python |
8e6237288dae3964cdd0a36e747f53f11b285073 | Include recently added matchers in callee.__all__ | Xion/callee | callee/__init__.py | callee/__init__.py | """
callee
"""
__version__ = "0.0.1"
__description__ = "Argument matcher for unittest.mock"
__author__ = "Karol Kuczmarski"
__license__ = "Simplified BSD"
from callee.base import And, Or, Not
from callee.collections import Dict, List, Mapping, Iterable, Sequence, Set
from callee.general import \
Any, ArgThat, IsA... | """
callee
"""
__version__ = "0.0.1"
__description__ = "Argument matcher for unittest.mock"
__author__ = "Karol Kuczmarski"
__license__ = "Simplified BSD"
from callee.base import And, Or, Not
from callee.general import \
Any, ArgThat, IsA, Inherits, InstanceOf, Matching, SubclassOf
from callee.strings import Byte... | bsd-3-clause | Python |
bb6c33969c7bb8359c2b0cdcfeff5aa6f9e8d3ff | Bump to v4.1.1-rc1 | gregoiresage/pebble-tool,pebble/pebble-tool,pebble/pebble-tool,gregoiresage/pebble-tool,pebble/pebble-tool,pebble/pebble-tool,gregoiresage/pebble-tool,gregoiresage/pebble-tool | pebble_tool/version.py | pebble_tool/version.py | version_base = (4, 1, 1)
version_suffix = 'rc1'
if version_suffix is None:
__version_info__ = version_base
else:
__version_info__ = version_base + (version_suffix,)
__version__ = '{}.{}'.format(*version_base)
if version_base[2] != 0:
__version__ += '.{}'.format(version_base[2])
if version_suffix is not N... | version_base = (4, 1, 0)
version_suffix = None
if version_suffix is None:
__version_info__ = version_base
else:
__version_info__ = version_base + (version_suffix,)
__version__ = '{}.{}'.format(*version_base)
if version_base[2] != 0:
__version__ += '.{}'.format(version_base[2])
if version_suffix is not No... | mit | Python |
7e358d7d32233ffce863307b745d92f017be5a69 | Update an example test | seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase | examples/test_double_click.py | examples/test_double_click.py | from seleniumbase import BaseCase
class DoubleClickTestClass(BaseCase):
def test_switch_to_frame_and_double_click(self):
self.open("https://www.w3schools.com/jsref"
"/tryit.asp?filename=tryjsref_ondblclick")
self.ad_block()
self.switch_to_frame("iframe#iframeResult")
... | from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_double_click_and_switch_to_frame(self):
self.open("https://www.w3schools.com/jsref"
"/tryit.asp?filename=tryjsref_ondblclick")
self.ad_block()
self.switch_to_frame("#iframeResult")
self.doubl... | mit | Python |
2a2a1c9ad37932bf300caf02419dd55a463d46d1 | Add nocov for lines that will never normally run | mystfox/python-tmod-tools | src/tmod_tools/__main__.py | src/tmod_tools/__main__.py | """
Entrypoint module, in case you use `python -mtmod_tools`.
Why does this file exist, and why __main__? For more info, read:
- https://www.python.org/dev/peps/pep-0338/
- https://docs.python.org/2/using/cmdline.html#cmdoption-m
- https://docs.python.org/3/using/cmdline.html#cmdoption-m
"""
from tmod_tools.cli impo... | """
Entrypoint module, in case you use `python -mtmod_tools`.
Why does this file exist, and why __main__? For more info, read:
- https://www.python.org/dev/peps/pep-0338/
- https://docs.python.org/2/using/cmdline.html#cmdoption-m
- https://docs.python.org/3/using/cmdline.html#cmdoption-m
"""
from tmod_tools.cli impo... | isc | Python |
8b8c698f1a02789e54d6f765872facf099ab851c | Add more interpreter versions to multipython example | MichaelAquilina/pytest,markshao/pytest,jaraco/pytest,alfredodeza/pytest,tareqalayan/pytest,hpk42/pytest,hackebrot/pytest,skylarjhdownes/pytest,nicoddemus/pytest,malinoff/pytest,pfctdayelise/pytest,tgoodlet/pytest,hpk42/pytest,The-Compiler/pytest,flub/pytest,RonnyPfannschmidt/pytest,ddboline/pytest,eli-b/pytest,etatauro... | doc/en/example/multipython.py | doc/en/example/multipython.py | """
module containing a parametrized tests testing cross-python
serialization via the pickle module.
"""
import py
import pytest
import _pytest._code
pythonlist = ['python2.6', 'python2.7', 'python3.4', 'python3.5']
@pytest.fixture(params=pythonlist)
def python1(request, tmpdir):
picklefile = tmpdir.join("data.pic... | """
module containing a parametrized tests testing cross-python
serialization via the pickle module.
"""
import py
import pytest
import _pytest._code
pythonlist = ['python2.6', 'python2.7', 'python3.3']
@pytest.fixture(params=pythonlist)
def python1(request, tmpdir):
picklefile = tmpdir.join("data.pickle")
ret... | mit | Python |
28d7e7915db0529a04ee7ad70f041bee95b35a5b | Fix imports in backoff.py to prevent warnings | ZeusWPI/hydra,ZeusWPI/hydra,ZeusWPI/hydra | scraper/backoff.py | scraper/backoff.py | import requests.adapters
from urllib3 import Retry
TIMEOUT = 5 # Time before a request times out
BACKOFF = 0.25 # Try 0.0s, 0.25s, 0.5s, 1s, 2s between requests
AMOUNT = 13 # Amount of request to make before giving up
class TimeoutHTTPAdapter(requests.adapters.HTTPAdapter):
def __init__(self, timeout=None, *a... | import requests
from requests.packages.urllib3.util.retry import Retry
TIMEOUT = 5 # Time before a request times out
BACKOFF = 0.25 # Try 0.0s, 0.25s, 0.5s, 1s, 2s between requests
AMOUNT = 13 # Amount of request to make before giving up
class TimeoutHTTPAdapter(requests.adapters.HTTPAdapter):
def __init__(se... | mit | Python |
50e8f6e540bb8e94b61a0ee10b966b5b5c00f930 | test objectsio | bnoi/scikit-tracker,bnoi/scikit-tracker,bnoi/scikit-tracker | sktracker/io/tests/test_objectsio.py | sktracker/io/tests/test_objectsio.py | import os
from nose import with_setup
from sktracker import data
from sktracker.io import objectsio, validate_metadata
def test_from_store():
store_path = data.sample_h5()
oio = objectsio.ObjectsIO.from_h5(store_path)
assert validate_metadata(oio.metadata)
| import os
from nose import with_setup
from sktracker import data
from sktracker.io import objectsio
def test_from_store():
store_path = data.sample_h5()
| bsd-3-clause | Python |
33aa75b99dab3810e44da6e69ebe5bec3b1ab20b | Update src/nanoemoji/disjoint_set.py | googlefonts/nanoemoji,googlefonts/nanoemoji | src/nanoemoji/disjoint_set.py | src/nanoemoji/disjoint_set.py | # https://en.wikipedia.org/wiki/Disjoint-set_data_structure
import collections
from typing import FrozenSet, Generic, Generator, Tuple, TypeVar
T = TypeVar("T")
class DisjointSet(Generic[T]):
def __init__(self):
self.parent = {}
self.rank = {}
def make_set(self, e: T):
if e in self.... | # https://en.wikipedia.org/wiki/Disjoint-set_data_structure
import collections
from typing import FrozenSet, Generic, Generator, Tuple, TypeVar
T = TypeVar("T")
class DisjointSet(Generic[T]):
def __init__(self):
self.parent = {}
self.rank = {}
def make_set(self, e: T):
if e in self.... | apache-2.0 | Python |
f5685f5da99ccfd0b4bc0a018dfd474e9edca810 | Rename dag BaseModel to be in line with config | ternaris/marv-robotics,ternaris/marv-robotics | code/marv-api/marv_api/dag.py | code/marv-api/marv_api/dag.py | # Copyright 2020 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
# pylint: disable=too-few-public-methods,invalid-name,no-self-argument,no-self-use
from typing import Optional, Union
from pydantic import BaseModel, Extra, create_model, validator
class Model(BaseModel):
class Config:
extra = Extra.f... | # Copyright 2020 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
# pylint: disable=too-few-public-methods,invalid-name,no-self-argument,no-self-use
from typing import Optional, Union
from pydantic import BaseModel as _BaseModel
from pydantic import Extra, create_model, validator
class BaseModel(_BaseModel):
... | agpl-3.0 | Python |
30fca51cbd74b0dba46462d6383dc9055d67eed1 | Fix for #11, how could I miss this one? | ojengwa/django-simple-captcha,google-code-export/django-simple-captcha,rlramirez/django-simple-captcha,andela-bojengwa/django-simple-captcha | captcha/helpers.py | captcha/helpers.py | # -*- coding: utf-8 -*-
import random
from captcha.conf import settings
def math_challenge():
operators = ('+','*','-',)
operands = (random.randint(1,10),random.randint(1,10))
operator = random.choice(operators)
if operands[0] < operands[1] and '-' == operator:
operands = (operands[1],operands[... | # -*- coding: utf-8 -*-
import random
from captcha.conf import settings
def math_challenge():
operators = ('+','*','-',)
operands = (random.randint(1,10),random.randint(1,10))
operator = operators[random.randint(0,len(operators)-1)]
if operands[0] < operands[1] and '-' == operator:
operands = (... | mit | Python |
26d8188024845055b96597833f1e8b077aaa84a9 | Make advisor.py capable of running a proper Advisor analysis | opesci/devito,opesci/devito | scripts/advisor.py | scripts/advisor.py | import os
import sys
from pathlib import Path
from subprocess import check_call
from tempfile import gettempdir
import click
@click.command()
# Required arguments
@click.option('--path', '-p', help='Absolute path to the Devito executable.',
required=True)
@click.option('--output', '-o', help='A directo... | import os
import sys
from pathlib import Path
from subprocess import check_call
import click
@click.command()
# Required arguments
@click.option('--path', '-p', help='Absolute path to the Devito executable.',
required=True)
@click.option('--output', '-o', help='A directory for storing profiling reports... | mit | Python |
e95a3fd3b190baacda0a646ca0cab1d20d9ef5a0 | Downgrade log.error in process_email(): it's mostly spam at this point (#19707) | wagnerand/addons-server,wagnerand/addons-server,diox/olympia,wagnerand/addons-server,diox/olympia,mozilla/addons-server,wagnerand/addons-server,diox/olympia,mozilla/addons-server,diox/olympia,mozilla/addons-server,mozilla/addons-server | src/olympia/activity/tasks.py | src/olympia/activity/tasks.py | import olympia.core.logger
from olympia.activity.models import ActivityLogEmails
from olympia.activity.utils import add_email_to_activity_log_wrapper
from olympia.amo.celery import task
from olympia.amo.decorators import use_primary_db
log = olympia.core.logger.getLogger('z.amo.activity')
@task
@use_primary_db
def... | import olympia.core.logger
from olympia.activity.models import ActivityLogEmails
from olympia.activity.utils import add_email_to_activity_log_wrapper
from olympia.amo.celery import task
from olympia.amo.decorators import use_primary_db
log = olympia.core.logger.getLogger('z.amo.activity')
@task
@use_primary_db
def... | bsd-3-clause | Python |
f1372842fa1c3eef11f4e9dbe2b35af02c1c5bf5 | Fix the migration so it takes care of bad default for resource links. | uw-it-aca/mdot-rest,uw-it-aca/mdot-rest | mdot_rest/migrations/0003_auto_20150723_1759.py | mdot_rest/migrations/0003_auto_20150723_1759.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mdot_rest', '0002_auto_20150722_2054'),
]
operations = [
migrations.RemoveField(
model_name='resourcelink',
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mdot_rest', '0002_auto_20150722_2054'),
]
operations = [
migrations.RemoveField(
model_name='resourcelink',
... | apache-2.0 | Python |
58ae1b483801a53c0119e2d7c9e1d2c27652c2c5 | Fix typo in django admin (#16604) | bqbn/addons-server,mozilla/addons-server,mozilla/addons-server,diox/olympia,bqbn/addons-server,diox/olympia,mozilla/addons-server,bqbn/addons-server,mozilla/addons-server,diox/olympia,wagnerand/addons-server,mozilla/olympia,mozilla/olympia,bqbn/addons-server,mozilla/olympia,diox/olympia,mozilla/olympia,wagnerand/addons... | src/olympia/shelves/models.py | src/olympia/shelves/models.py | from django.db import models
from olympia.amo.models import ModelBase
ENDPOINTS = ('collections', 'search', 'search-themes')
ENDPOINT_CHOICES = tuple((ty, ty) for ty in ENDPOINTS)
class Shelf(ModelBase):
title = models.CharField(max_length=200)
endpoint = models.CharField(
max_length=200, choices=E... | from django.db import models
from olympia.amo.models import ModelBase
ENDPOINTS = ('collections', 'search', 'search-themes')
ENDPOINT_CHOICES = tuple((ty, ty) for ty in ENDPOINTS)
class Shelf(ModelBase):
title = models.CharField(max_length=200)
endpoint = models.CharField(
max_length=200, choices=E... | bsd-3-clause | Python |
bacd05f50574a3149d5e765be8821f66bd14191b | Update for rpm based systems | Vicente-Cheng/ceph-deploy,trhoden/ceph-deploy,trhoden/ceph-deploy,osynge/ceph-deploy,dachary/ceph-deploy,branto1/ceph-deploy,zhouyuan/ceph-deploy,dachary/ceph-deploy,osynge/ceph-deploy,branto1/ceph-deploy,ghxandsky/ceph-deploy,ddiss/ceph-deploy,shenhequnying/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,imzhulei/ceph-depl... | ceph_deploy/lsb.py | ceph_deploy/lsb.py | def lsb_release():
import subprocess
args = [ 'which', 'lsb_release', ]
p = subprocess.Popen(
args=args,
stdout=subprocess.PIPE,
)
distro = p.stdout.read()
ret = p.wait()
if ret != 0:
raise RuntimeError('lsb_release not found on host')
args = [ 'lsb_release'... |
def lsb_release():
import subprocess
args = [
'lsb_release',
'-s',
'-i',
'-r',
'-c',
]
p = subprocess.Popen(
args=args,
stdout=subprocess.PIPE,
)
out = p.stdout.read()
ret = p.wait()
if ret != 0:
raise subprocess.C... | mit | Python |
f86578c88e61b81cd5bdbf5e1cd6841aeabaf0e6 | Use module locator | zaibacu/wutu,zaibacu/wutu,zaibacu/wutu | wutu/tests/modules/test_module/test_module.py | wutu/tests/modules/test_module/test_module.py | from wutu.module import Module, module_locator
from wutu.util import load_js
class TestModule(Module):
def __init__(self):
super(TestModule, self).__init__()
def ping(self):
return "pong"
def get(self, id):
return {"result": id}
def get_identifier(self):
return ["id"... | from wutu.module import Module
from wutu.util import load_js
from test_util import test_locator
class TestModule(Module):
def __init__(self):
super(TestModule, self).__init__()
def ping(self):
return "pong"
def get(self, id):
return {"result": id}
def get_identifier(self):
... | mit | Python |
d4a8720d9f8ce9e7b73dfd804e45f3cdb9bd6ca1 | Update database.py | sylarcp/anita,sylarcp/anita,mcollins12321/anita,sylarcp/anita,mcollins12321/anita,mcollins12321/anita,mcollins12321/anita,sylarcp/anita,sylarcp/anita,mcollins12321/anita | app/database.py | app/database.py | from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine0 = create_engine('postgresql://gui:AniTa08@67.239.76.218/anita_0710a', convert_unicode=True)
Base = declarative_base()
# engine0 seems can be any database, does not... | from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine0 = create_engine('postgresql://gui:AniTa08@128.175.112.125/anita_0116d', convert_unicode=True)
Base = declarative_base()
# engine0 seems can be any database, does n... | mit | Python |
a4dd311658e555403b0587983be6f0e9765e46e6 | Update pullover.py | Heads-and-Hands/pullover | pullover.py | pullover.py | #!/usr/bin/env python
import sys, getopt
from flask import Flask
from flask import request
import subprocess
from config import repos
def main(argv):
try:
opts, args = getopt.getopt(argv,"hr")
except getopt.GetoptError:
print_help()
sys.exit(2)
for opt, arg in opts:
if opt == '-... | #!/usr/bin/env python
import sys, getopt
from flask import Flask
from flask import request
import subprocess
from config import repos
def main(argv):
try:
opts, args = getopt.getopt(argv,"hr")
except getopt.GetoptError:
print_help()
sys.exit(2)
for opt, arg in opts:
if opt == '-... | mit | Python |
e3464414886ec28fe8c989ea0af0b310ef176a0a | Remove commented code. | andela-akiura/bucketlist | app/database.py | app/database.py | """This module initialises database transactions."""
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from config.config import Config
engine = create_engine(Config.DATABASE_URI, convert_unicode=True)
db_session = scope... | """This module initialises database transactions."""
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from config.config import Config
engine = create_engine(Config.DATABASE_URI, convert_unicode=True)
db_session = scope... | mit | Python |
869597b8f874f8a6bea0a47115e839e8681532f1 | Use pillow, not PIL | akgrant43/storagemgr,akgrant43/storagemgr | storagemgr/storage/smhash.py | storagemgr/storage/smhash.py | import hashlib
from PIL import Image
from logger import init_logging
logger = init_logging(__name__)
def smhash(fn):
"""Try and return the hash of just the image data.
If not, the entire file."""
try:
img = Image.open(fn)
img_data = img.tostring()
hasher = hashlib.sha256()
... | import hashlib
import Image
from logger import init_logging
logger = init_logging(__name__)
def smhash(fn):
"""Try and return the hash of just the image data.
If not, the entire file."""
try:
img = Image.open(fn)
img_data = img.tostring()
hasher = hashlib.sha256()
hasher.u... | apache-2.0 | Python |
9c69e19225d98afaca6ca129ac1c9a4013e39e35 | fix collide.hit file location. | joetsoi/moonstone,joetsoi/moonstone | assets/files.py | assets/files.py | from pathlib import Path, PureWindowsPath
from pygame.mixer import Sound
from resources.cmp import CmpFile
from resources.font import FontFile
from resources.piv import PivFile
from settings import MOONSTONE_DIR
from resources.terrain import TerrainFile
from .collide import parse_collision_file
def load_file(file_... | from pathlib import Path, PureWindowsPath
from pygame.mixer import Sound
from resources.cmp import CmpFile
from resources.font import FontFile
from resources.piv import PivFile
from settings import MOONSTONE_DIR
from resources.terrain import TerrainFile
from .collide import parse_collision_file
def load_file(file_... | agpl-3.0 | Python |
2cfa2ef22dae4d0dc434bd79aa849033b8ed53d3 | update version | jvrana/Pillowtalk | pillowtalk/__init__.py | pillowtalk/__init__.py | __version__ = "1.0.7dev"
from .base import *
from .schemas import *
from .relationship import *
from .session import SessionManager
from .exceptions import *
from marshmallow import pprint
| __version__ = "1.0.6dev"
from .base import *
from .schemas import *
from .relationship import *
from .session import SessionManager
from .exceptions import *
from marshmallow import pprint
| mit | Python |
b0e7168ce5182272691e22122acb7be3800cfa13 | remove unused code | zdw/xos,wathsalav/xos,opencord/xos,open-cloud/xos,opencord/xos,xmaruto/mcord,opencord/xos,cboling/xos,xmaruto/mcord,cboling/xos,cboling/xos,xmaruto/mcord,jermowery/xos,jermowery/xos,xmaruto/mcord,wathsalav/xos,cboling/xos,wathsalav/xos,zdw/xos,jermowery/xos,open-cloud/xos,open-cloud/xos,cboling/xos,wathsalav/xos,zdw/xo... | planetstack/observer/steps/sync_site_privileges.py | planetstack/observer/steps/sync_site_privileges.py | import os
import base64
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models import User, UserDeployments, SitePrivilege, SiteDeployments
class SyncSitePrivileges(OpenStackSyncStep):
requested_interval=0
provides=[S... | import os
import base64
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models import User, UserDeployments, SitePrivilege, SiteDeployments
class SyncSitePrivileges(OpenStackSyncStep):
requested_interval=0
provides=[S... | apache-2.0 | Python |
4355006067f781d502486210655428d665287c3a | change base_profile test from none to empty string | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/tests/test_base_profile.py | accelerator/tests/test_base_profile.py | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
from django.test import TestCase
from accelerator.tests.factories import MemberFactory
class TestBaseProfile(TestCase):
def test_str_is_first_and_last_name(self):
member = MemberFactory()
display = mem... | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
from django.test import TestCase
from accelerator.tests.factories import MemberFactory
class TestBaseProfile(TestCase):
def test_str_is_first_and_last_name(self):
member = MemberFactory()
display = mem... | mit | Python |
19e5b75ea80e2623d96ab5620224f9cd17a066ea | Order testimonials by date | ACLARKNET/aclarknet-django,ACLARKNET/aclarknet-django | aclarknet/aclarknet/aclarknet/views.py | aclarknet/aclarknet/aclarknet/views.py | from django.shortcuts import render
from aclarknet.aclarknet.models import Client
from aclarknet.aclarknet.models import Service
from aclarknet.aclarknet.models import TeamMember
from aclarknet.aclarknet.models import Testimonial
def clients(request):
clients = Client.objects.all()
context = {'clients': clien... | from django.shortcuts import render
from aclarknet.aclarknet.models import Client
from aclarknet.aclarknet.models import Service
from aclarknet.aclarknet.models import TeamMember
from aclarknet.aclarknet.models import Testimonial
def clients(request):
clients = Client.objects.all()
context = {'clients': clien... | mit | Python |
3898ce548aff92ac23617d39b928448f6a6ef9b6 | fix heading | felipeacsi/python-acoustics,python-acoustics/python-acoustics | acoustics/standards/iso_1996_1_2003.py | acoustics/standards/iso_1996_1_2003.py | """
ISO 1996-1:2003
===============
ISO 1996-1:2003 defines the basic quantities to be used for the description of
noise in community environments and describes basic assessment procedures. It
also specifies methods to assess environmental noise and gives guidance on
predicting the potential annoyance response of a... | """
ISO 1996-1-2003
===============
ISO 1996-1:2003 defines the basic quantities to be used for the description of
noise in community environments and describes basic assessment procedures. It
also specifies methods to assess environmental noise and gives guidance on
predicting the potential annoyance response of a... | bsd-3-clause | Python |
462c384b3dc56865a145d2fb922b86975299edbc | Bump version to 0.0.0 | clchiou/iga,clchiou/iga,clchiou/iga,clchiou/iga | iga/__init__.py | iga/__init__.py | __version__ = '0.0.0'
__author__ = 'Che-Liang Chiou'
__author_email__ = 'clchiou@gmail.com'
__copyright__ = 'Copyright 2015, Che-Liang Chiou'
__license__ = 'MIT'
__all__ = [
'workspace',
]
def workspace(**kwargs):
import iga.context
iga.context.set_global_context(**kwargs)
| __version__ = '0.0.0-dev'
__author__ = 'Che-Liang Chiou'
__author_email__ = 'clchiou@gmail.com'
__copyright__ = 'Copyright 2015, Che-Liang Chiou'
__license__ = 'MIT'
__all__ = [
'workspace',
]
def workspace(**kwargs):
import iga.context
iga.context.set_global_context(**kwargs)
| mit | Python |
c6338c72869a73b9baa0f74d16206e64437eef41 | Update reverse_with_singledispatch.py | vladshults/python_modules,vladshults/python_modules | job_interview_algs/reverse_with_singledispatch.py | job_interview_algs/reverse_with_singledispatch.py | import functools
def swap_it(arr):
i = 0
j = -1
for _ in range(len(arr)//2):
arr[i], arr[j] = arr[j], arr[i]
i += 1
j -= 1
return arr
@functools.singledispatch
def reverse_it(seq):
return swap_it(seq)
@reverse_it.register(list)
def _(arr):
return swap_it(arr)
@rev... | import functools
def swap_it(arr):
i = 0
j = -1
for _ in range(len(arr)//2):
arr[i], arr[j] = arr[j], arr[i]
i += 1
j -= 1
return arr
@functools.singledispatch
def reverse_it(seq):
return swap_it(seq)
@reverse_it.register(list)
def _(arr):
return swap_it(arr)
@rev... | mit | Python |
3fd2d1cade716f264b2febc3627b1443a1d3e604 | Fix a problem with a migration between master and stable branch | taigaio/taiga-back,dayatz/taiga-back,xdevelsistemas/taiga-back-community,taigaio/taiga-back,taigaio/taiga-back,dayatz/taiga-back,dayatz/taiga-back,xdevelsistemas/taiga-back-community,xdevelsistemas/taiga-back-community | taiga/projects/migrations/0043_auto_20160530_1004.py | taiga/projects/migrations/0043_auto_20160530_1004.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-05-30 10:04
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0040_remove_mem... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-05-30 10:04
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0042_auto_20160... | agpl-3.0 | Python |
6916a3fb24a12ce3c0261034c1dcaae57a8cd0ee | Add stdout flushing statements to example. | ipython/ipython,ipython/ipython | docs/examples/kernel/task2.py | docs/examples/kernel/task2.py | #!/usr/bin/env python
# encoding: utf-8
from IPython.kernel import client
import time
import sys
flush = sys.stdout.flush
tc = client.TaskClient()
mec = client.MultiEngineClient()
mec.execute('import time')
for i in range(24):
tc.run(client.StringTask('time.sleep(1)'))
for i in range(6):
time.sleep(1.0)
... | #!/usr/bin/env python
# encoding: utf-8
from IPython.kernel import client
import time
tc = client.TaskClient()
mec = client.MultiEngineClient()
mec.execute('import time')
for i in range(24):
tc.run(client.StringTask('time.sleep(1)'))
for i in range(6):
time.sleep(1.0)
print "Queue status (vebose=False)... | bsd-3-clause | Python |
491c51005ca42dcdb4410b5e7b3afe0822bd509a | Use integer cast instead of case expression | shadowoneau/skylines,shadowoneau/skylines,skylines-project/skylines,skylines-project/skylines,Turbo87/skylines,RBE-Avionik/skylines,Harry-R/skylines,shadowoneau/skylines,RBE-Avionik/skylines,RBE-Avionik/skylines,RBE-Avionik/skylines,skylines-project/skylines,snip/skylines,Harry-R/skylines,Harry-R/skylines,snip/skylines... | scripts/search.py | scripts/search.py | #!/usr/bin/python
import sys
from sqlalchemy import desc, literal_column, cast, Integer
from skylines.config import environment
from skylines import model
NULL = literal_column(str(0))
def ilike_as_int(column, value, relevance):
# Make sure relevance is numeric and we can safely
# pass it to the literal_... | #!/usr/bin/python
import sys
from sqlalchemy import case, desc, literal_column
from skylines.config import environment
from skylines import model
NULL = literal_column(str(0))
def ilike_as_int(column, value, relevance):
# Make sure relevance is numeric and we can safely
# pass it to the literal_column()
... | agpl-3.0 | Python |
a96f02ac57de414d94b73378bc40348616f1926d | Update B_ETA.py | Herpinemmanuel/Oceanography | Cas_4/ETA/B_ETA.py | Cas_4/ETA/B_ETA.py | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import cartopy.crs as ccrs
from xmitgcm import open_mdsdataset
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
plt.ion()
dir0 = '/homedata/bderembl/runmit/test_southatlgyre3'
ds0 = open_mdsdataset(dir0... | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import cartopy.crs as ccrs
from xmitgcm import open_mdsdataset
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
plt.ion()
dir0 = '/homedata/bderembl/runmit/test_southatlgyre3'
ds0 = open_mdsdataset(dir0... | mit | Python |
a0978d09c5460657fef187ac90ad0eb01b3754bc | update useragent | boklm/tbb-testsuite,boklm/tbb-testsuite,boklm/tbb-testsuite,boklm/tbb-testsuite,boklm/tbb-testsuite | marionette/tor_browser_tests/test_fp_useragent.py | marionette/tor_browser_tests/test_fp_useragent.py | from marionette_driver import By
from marionette_driver.errors import MarionetteException
from marionette import MarionetteTestCase
class Test(MarionetteTestCase):
def test_useragent(self):
with self.marionette.using_context('content'):
self.marionette.navigate('about:robots')
js =... | from marionette_driver import By
from marionette_driver.errors import MarionetteException
from marionette import MarionetteTestCase
class Test(MarionetteTestCase):
def test_useragent(self):
with self.marionette.using_context('content'):
self.marionette.navigate('about:robots')
js =... | bsd-3-clause | Python |
afdf5d3ccd3556a0f1204ad9a4b92632ed836898 | fix for querying api | tristantao/py-bing-search,tristantao/html-contact | bingsearch.py | bingsearch.py | import urllib2
import requests
URL = 'https://api.datamarket.azure.com/Bing/Search/v1/Composite' \
+ '?Sources=%(source)s&Query=%(query)s&$top=50&$format=json'
API_KEY = 'SECRET_API_KEY'
def request(query, **params):
url = URL % {'source': urllib2.quote("'web'"),
'query': urllib2.quote("'"+... | import requests
URL = 'https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(query)s&$top=50&$format=json'
API_KEY = 'SECRET_API_KEY'
def request(query, **params):
r = requests.get(URL % {'query': query}, auth=('', API_KEY))
return r.json['d']['results']
| mit | Python |
b06952bd9ed1fa298c06bcb3199bac648752b73a | Update ECP example | gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf | examples/gto/05-input_ecp.py | examples/gto/05-input_ecp.py | #!/usr/bin/env python
from pyscf import gto, scf
'''
Use gto.basis.parse_ecp and gto.basis.load_ecp functions to input
user-specified ecp functions.
'''
mol = gto.M(atom='''
Na 0. 0. 0.
H 0. 0. 1.''',
basis={'Na':'lanl2dz', 'H':'sto3g'},
ecp = {'Na':'lanl2dz'})
mol = gto.M(atom='''
Na... | #!/usr/bin/env python
from pyscf import gto, scf
'''
Use gto.basis.parse_ecp and gto.basis.load_ecp functions to input
user-specified ecp functions.
'''
mol = gto.M(atom='''
Na 0. 0. 0.
H 0. 0. 1.''',
basis={'Na':'lanl2dz', 'H':'sto3g'},
ecp = {'Na':'lanl2dz'})
mol = gto.M(atom='''
Na... | apache-2.0 | Python |
3fabae09c849b6fecf1b1d63eb177cea5c0ca7b3 | clean does it already but refresh still need to | claudio-walser/gitcd,claudio-walser/gitcd | gitcd/interface/cli/refresh.py | gitcd/interface/cli/refresh.py | from gitcd.interface.cli.abstract import BaseCommand
from gitcd.git.branch import Branch
class Refresh(BaseCommand):
updateRemote = True
def run(self, branch: Branch):
remote = self.getRemote()
master = Branch(self.config.getMaster())
if branch.getName() == master.getName():
... | from gitcd.interface.cli.abstract import BaseCommand
from gitcd.git.branch import Branch
class Refresh(BaseCommand):
def run(self, branch: Branch):
remote = self.getRemote()
master = Branch(self.config.getMaster())
if branch.getName() == master.getName():
# maybe i should us... | apache-2.0 | Python |
490872b8296ec8c93b9631fd61bef7070b732db8 | Fix some bugs in the Celery code | oshepherd/eforge,oshepherd/eforge,oshepherd/eforge | eforge/queue/celery.py | eforge/queue/celery.py | # -*- coding: utf-8 -*-
# EForge project management system, Copyright © 2010, Element43
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWA... | # -*- coding: utf-8 -*-
# EForge project management system, Copyright © 2010, Element43
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWA... | isc | Python |
5e0016f4a3a54eab6cd71f6e121b9e21d448f923 | Bump patch | egtaonline/quiesce | egta/__init__.py | egta/__init__.py | __version__ = '0.0.22'
| __version__ = '0.0.21'
| apache-2.0 | Python |
c0f6668d64b0d8f098b0962b23ab86e80e01f1d9 | Remove options from command line | pythonindia/junction,nava45/junction,ChillarAnand/junction,ChillarAnand/junction,pythonindia/junction,nava45/junction,nava45/junction,ChillarAnand/junction,pythonindia/junction,ChillarAnand/junction,nava45/junction,pythonindia/junction | junction/tickets/management/commands/fill_data.py | junction/tickets/management/commands/fill_data.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
# Third Party Stuff
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
# Junction Stuff
from junction.tickets.models import Ticket
class Command(BaseCommand):
"""
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import optparse
# Third Party Stuff
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
# Junction Stuff
from junction.tickets.models import Ticket
class Comman... | mit | Python |
73b6db43b80b2c86e9bd7b342c8dcd24aee122fa | update yaml_mako to use standard template renderer | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/renderers/yaml_mako.py | salt/renderers/yaml_mako.py | '''
Process yaml with the Mako templating engine
This renderer will take a yaml file within a mako template and render it to a
high data format for salt states.
'''
# Import Python Modules
import os
# Import Third Party libs
from mako.template import Template
from salt.utils.yaml import CustomLoader, load
def ren... | '''
Process yaml with the Mako templating engine
This renderer will take a yaml file within a mako template and render it to a
high data format for salt states.
'''
# Import Python Modules
import os
# Import Third Party libs
from mako.template import Template
from salt.utils.yaml import CustomLoader, load
def ren... | apache-2.0 | Python |
1067e8fbcda84d6c656ccee8e996dc32450c4123 | Fix as_seconds on Windows where tz is present | yaybu/touchdown | touchdown/core/datetime.py | touchdown/core/datetime.py | # Copyright 2011-2015 Isotoma Limited
#
# 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 2011-2015 Isotoma Limited
#
# 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 |
32d4339cf27306792fc5776193f82ac9bd6ef39d | Add output result box for remove_padding script | vladimirgamalian/pictools | remove_padding.py | remove_padding.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
from PIL import Image
from utils import get_file_list
def box_union(a, b):
left = min(a[0], b[0])
top = min(a[1], b[1])
right = max(a[2], b[2])
bottom = max(a[3], b[3])
return left, top, right, bottom
@click.command()
@click.argument('p... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
from PIL import Image
from utils import get_file_list
def box_union(a, b):
left = min(a[0], b[0])
top = min(a[1], b[1])
right = max(a[2], b[2])
bottom = max(a[3], b[3])
return left, top, right, bottom
@click.command()
@click.argument('p... | mit | Python |
f57f8013d7d6f18bb1bbe8c04116062ae33608f7 | Add a message at the end of concatenating | e-koch/VLA_Lband,e-koch/VLA_Lband | 17B-162/HI/imaging/concat_channels.py | 17B-162/HI/imaging/concat_channels.py |
'''
Combine individually-imaged channels into a cube.
Run in CASA.
'''
import sys
from glob import glob
from taskinit import iatool
ia = iatool()
path_to_data = sys.argv[-4]
filename = sys.argv[-3]
# Check for the expected number of images
num_imgs = int(sys.argv[-2])
suffix = sys.argv[-1]
suffixes = ['mask',... |
'''
Combine individually-imaged channels into a cube.
Run in CASA.
'''
import sys
from glob import glob
from taskinit import iatool
ia = iatool()
path_to_data = sys.argv[-4]
filename = sys.argv[-3]
# Check for the expected number of images
num_imgs = int(sys.argv[-2])
suffix = sys.argv[-1]
suffixes = ['mask',... | mit | Python |
249c3a0c9368faaf63efe02df43838f4e775c411 | Change conanfile.py to install with CMake | Morwenn/cpp-sort,Morwenn/cpp-sort,Morwenn/cpp-sort,Morwenn/cpp-sort | conanfile.py | conanfile.py | from conans import CMake, ConanFile
class CppSortConan(ConanFile):
name = "cpp-sort"
version = "1.4.0"
license = "https://github.com/Morwenn/cpp-sort/blob/master/license.txt"
url = "https://github.com/Morwenn/cpp-sort"
author = "Morwenn <morwenn29@hotmail.fr>"
description = "Additional sorting... | from conans import ConanFile
class CppSortConan(ConanFile):
name = "cpp-sort"
version = "1.4.0"
settings = "compiler"
license = "https://github.com/Morwenn/cpp-sort/blob/master/license.txt"
url = "https://github.com/Morwenn/cpp-sort"
author = "Morwenn <morwenn29@hotmail.fr>"
description = ... | mit | Python |
026565a0fcee402f35a35d5aeeff6d8aea79ac4f | Make the PASS command a required step on connect when there is a server password | ElementalAlchemist/txircd,Heufneutje/txircd,DesertBus/txircd | txircd/modules/cmd_pass.py | txircd/modules/cmd_pass.py | from twisted.words.protocols import irc
from txircd.modbase import Command, Module
class PassCommand(Command, Module):
def onUse(self, user, data):
if self.ircd.server_password and not user.password:
user.registered -= 1
user.password = data["password"]
if user.registered == 0:
user.register()
def proc... | from twisted.words.protocols import irc
from txircd.modbase import Command, Module
class PassCommand(Command, Module):
def onUse(self, user, data):
user.password = data["password"]
def processParams(self, user, params):
if user.registered == 0:
user.sendMessage(irc.ERR_ALREADYREGISTRED, ":Unauthorized comma... | bsd-3-clause | Python |
82aba46a74721aafa637889af98d62885ada711d | add timeout to http example | ubolonton/twisted-csp | example/http.py | example/http.py | import csp
from twisted.web.client import getPage
def request(url):
return csp.channelify(getPage(url))
def main():
def timeout_channel(seconds):
c = csp.Channel()
def _t():
yield csp.wait(seconds)
yield c.put(None)
csp.go(_t())
return c
c = requ... | import csp
from twisted.web.client import getPage
def excerpt(text, cutoff=100):
l = len(text)
if l > cutoff:
return text[0:cutoff] + "..."
else:
return text
def request(url):
return csp.channelify(getPage(url))
def main():
c = request("http://google.com")
result, error = ... | epl-1.0 | Python |
85903eff6a23592e2ad10f3d226b7712eaebc64d | define scikits.umfpack.__version__ | scikit-umfpack/scikit-umfpack,rc/scikit-umfpack-rc,scikit-umfpack/scikit-umfpack,rc/scikit-umfpack,rc/scikit-umfpack,rc/scikit-umfpack-rc | scikits/umfpack/__init__.py | scikits/umfpack/__init__.py | """
===============
scikits.umfpack
===============
Interface to UMFPACK linear solver.
"""
from __future__ import division, print_function, absolute_import
from .umfpack import *
from .interface import *
from .version import version as __version__
if __doc__ is not None:
from .umfpack import __doc__ as _umfp... | """
===============
scikits.umfpack
===============
Interface to UMFPACK linear solver.
"""
from __future__ import division, print_function, absolute_import
from .umfpack import *
from .interface import *
if __doc__ is not None:
from .umfpack import __doc__ as _umfpack_doc
from .interface import __doc__ as... | bsd-3-clause | Python |
ab24db61340ccfd1160e6d39066f9541a411a179 | Remove unused imports | cernops/python-neutronclient,cryptickp/python-neutronclient,rackerlabs/rackspace-python-neutronclient,Stavitsky/python-neutronclient,venusource/python-neutronclient,yamahata/python-tackerclient,cryptickp/python-neutronclient,huntxu/python-neutronclient,cernops/python-neutronclient,roaet/python-neutronclient,roaet/pytho... | doc/source/conf.py | doc/source/conf.py | # -*- coding: utf-8 -*-
#
project = 'python-neutronclient'
# -- General configuration ---------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sp... | # -*- coding: utf-8 -*-
#
import sys
import os
project = 'python-neutronclient'
# -- General configuration ---------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sp... | apache-2.0 | Python |
e94f2cb6dd144cec7b10aecb29669e7ba2ef98b1 | Update release version to 0.6.1 | gunthercox/ChatterBot,vkosuri/ChatterBot | chatterbot/__init__.py | chatterbot/__init__.py | """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.6.1'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
__all__ = (
'ChatBot',
)
| """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.6.0'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
__all__ = (
'ChatBot',
)
| bsd-3-clause | Python |
666d9c999ebf0cc388d8f045a04756424c2d9b62 | Make it work for Python 2 | cdent/gabbi-demo,cdent/gabbi-demo | gdemo/util.py | gdemo/util.py | """Share utility functions."""
try:
from urllib import parse
except ImportError:
import urllib as parse
def get_route_value(environ, name):
value = environ['wsgiorg.routing_args'][1][name]
value = parse.unquote(value)
return value.replace('%2F', '/')
| """Share utility functions."""
from urllib import parse
def get_route_value(environ, name):
value = environ['wsgiorg.routing_args'][1][name]
value = parse.unquote(value)
return value.replace('%2F', '/')
| apache-2.0 | Python |
5d9bb47f0d0015533cbf547d613600f8b4b7d2d7 | Store the inner exception when creating an OSCException | stackforge/python-openstacksdk,openstack-infra/shade,openstack/python-openstacksdk,stackforge/python-openstacksdk,dtroyer/python-openstacksdk,dtroyer/python-openstacksdk,openstack/python-openstacksdk,openstack-infra/shade | shade/exc.py | shade/exc.py | # Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python |
4477ef7b7fd9d9e3f7518486cfce4f049009b092 | make reprocess.py a bit smarter, add command line args for sourcedir, builddir and buildarch | kishoredbn/barrelfish,kishoredbn/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,kishoredbn/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,kishoredbn/barrelfish,kishoredbn/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,kishoredbn/barrelf... | tools/harness/reprocess.py | tools/harness/reprocess.py | #!/usr/bin/env python
##########################################################################
# Copyright (c) 2009, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Ha... | #!/usr/bin/env python
##########################################################################
# Copyright (c) 2009, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Ha... | mit | Python |
be3cfd7033097bbc073e05c232f702bbcbfbd4db | Fix the imports for Python 3 | rabernat/xmitgcm,xgcm/xmitgcm,sambarluc/xmitgcm,xgcm/xgcm,rabernat/xgcm | xgcm/__init__.py | xgcm/__init__.py | from .mdsxray import open_mdsdataset
from .gridops import GCMDataset
from .regridding import regrid_vertical
| from mdsxray import open_mdsdataset
from gridops import GCMDataset
from regridding import regrid_vertical
| mit | Python |
39b0621fc1d7e240ed141e55cb81c7f249d92a7c | fix p4a revamp | johnbolia/plyer,KeyWeeUsr/plyer,KeyWeeUsr/plyer,kivy/plyer,KeyWeeUsr/plyer,johnbolia/plyer,kivy/plyer,kived/plyer,kivy/plyer,kived/plyer | plyer/platforms/android/__init__.py | plyer/platforms/android/__init__.py | from os import environ
from jnius import autoclass
ANDROID_VERSION = autoclass('android.os.Build$VERSION')
SDK_INT = ANDROID_VERSION.SDK_INT
if 'PYTHON_SERVICE_ARGUMENT' in environ:
try:
PythonService = autoclass('org.kivy.android.PythonService')
except Exception:
PythonService = autoclass('or... | from os import environ
from jnius import autoclass
ANDROID_VERSION = autoclass('android.os.Build$VERSION')
SDK_INT = ANDROID_VERSION.SDK_INT
if 'PYTHON_SERVICE_ARGUMENT' in environ:
PythonService = autoclass('org.renpy.android.PythonService')
activity = PythonService.mService
else:
PythonActivity = autocl... | mit | Python |
021ccdd7abd3133ddde3893dd5719ba6a7303327 | Change variable name | rafalmierzwiak/yearn,rafalmierzwiak/yearn | code/hash_me_poorly.py | code/hash_me_poorly.py | #!/usr/bin/env python3
from collections import namedtuple
PoorItem = namedtuple('Item', 'key value')
class PoorHash:
"""Poor man's hash.
Hash is compartmentalized into slots and in these slots items are kept.
No room left for probing, number of slots fixed at initialisation time,
hence name of the c... | #!/usr/bin/env python3
from collections import namedtuple
PoorItem = namedtuple('Item', 'key value')
class PoorHash:
"""Poor man's hash.
Hash is compartmentalized into slots and in these slots items are kept.
No room left for probing, number of slots fixed at initialisation time,
hence name of the c... | unlicense | Python |
9d6265efb57c350d866c926d18263a64535b238c | fix concept tagger | darenr/MOMA-Art,darenr/art-dataset-nlp-experiments,darenr/MOMA-Art,darenr/MOMA-Art,darenr/MOMA-Art,darenr/art-dataset-nlp-experiments,darenr/art-dataset-nlp-experiments,darenr/art-dataset-nlp-experiments | concept_tag_alchemy.py | concept_tag_alchemy.py | from alchemyapi.alchemyapi import AlchemyAPI
import json
import unicodecsv
alchemyapi = AlchemyAPI()
results = []
with open('MOMA3k.csv', 'rb') as in_csv:
stop = False
for i, m in enumerate(unicodecsv.DictReader(in_csv, encoding='utf-8')):
print i
fieldnames = m.keys()
fieldnames.extend(['AlchemyKeyw... | from alchemyapi.alchemyapi import AlchemyAPI
import json
import unicodecsv
alchemyapi = AlchemyAPI()
results = []
with open('MOMA3k.csv', 'rb') as in_csv:
for i, m in enumerate(unicodecsv.DictReader(in_csv, encoding='utf-8')):
print i
fieldnames = m.keys()
fieldnames.extend(['AlchemyKeywords', 'Alchemy... | mit | Python |
7e754f348327a8fa07adb0850f22b4d2628cecd9 | Use env-python | miyakogi/wdom,miyakogi/wdom,miyakogi/wdom | wdom/tests/test_imports.py | wdom/tests/test_imports.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from os import path
import subprocess
from nose_parameterized import parameterized
from wdom.testing import TestCase
root = path.dirname(path.dirname(path.dirname(path.abspath(__file__))))
cases = [
('wdom', 'css'),
('wdom', 'document'),
('wdom'... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os import path
import subprocess
from nose_parameterized import parameterized
from wdom.testing import TestCase
root = path.dirname(path.dirname(path.dirname(path.abspath(__file__))))
cases = [
('wdom', 'css'),
('wdom', 'document'),
('wdom', 'element'... | mit | Python |
5a1f3a37120b9dbcfc3fbd144c4c21772df089e7 | Make explicit some db features | maxirobaina/django-firebird,maxirobaina/django-firebird | firebird/features.py | firebird/features.py | from django.utils.functional import cached_property
from django.db.backends.base.features import BaseDatabaseFeatures
class DatabaseFeatures(BaseDatabaseFeatures):
allows_group_by_pk = False # if the backend can group by just by PK
supports_forward_references = False
has_bulk_insert = False
can_retur... | from django.utils.functional import cached_property
from django.db.backends.base.features import BaseDatabaseFeatures
class DatabaseFeatures(BaseDatabaseFeatures):
allows_group_by_pk = False # if the backend can group by just by PK
supports_forward_references = False
has_bulk_insert = False
can_retur... | bsd-3-clause | Python |
f60363b3d24d2f4af5ddb894cc1f6494b371b18e | FIX opt_out prevention for mailchimp export | CompassionCH/compassion-switzerland,eicher31/compassion-switzerland,CompassionCH/compassion-switzerland,CompassionCH/compassion-switzerland,eicher31/compassion-switzerland,eicher31/compassion-switzerland | mass_mailing_switzerland/wizards/mailchimp_export_update_wizard.py | mass_mailing_switzerland/wizards/mailchimp_export_update_wizard.py | ##############################################################################
#
# Copyright (C) 2020 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | ##############################################################################
#
# Copyright (C) 2020 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | agpl-3.0 | Python |
dd6c758f364e84ab9fb5fbc04021c1df460b7622 | Fix get_bump_version output. | matbra/bokeh,almarklein/bokeh,philippjfr/bokeh,percyfal/bokeh,schoolie/bokeh,bokeh/bokeh,azjps/bokeh,Karel-van-de-Plassche/bokeh,ptitjano/bokeh,birdsarah/bokeh,draperjames/bokeh,philippjfr/bokeh,muku42/bokeh,ericmjl/bokeh,caseyclements/bokeh,aavanian/bokeh,phobson/bokeh,deeplook/bokeh,ericmjl/bokeh,azjps/bokeh,msarahan... | scripts/get_bump_version.py | scripts/get_bump_version.py | from __future__ import print_function
import subprocess
def get_version_from_git():
cmd = ["git", "describe", "--tags", "--long", "--always"]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
code = proc.wait()
if code != 0:
print("Failed to run: %s" % " ".join(cmd))
sys.exit(1)
... | from __future__ import print_function
import subprocess
def get_version_from_git():
cmd = ["git", "describe", "--tags", "--long", "--always"]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
code = proc.wait()
if code != 0:
print("Failed to run: %s" % " ".join(cmd))
sys.exit(1)
... | bsd-3-clause | Python |
c16cf1d321115f303615087bc3fcb5ab287b6102 | Support building LS8 netcdf VRTs, and do it faster | omad/damootils,omad/damootils | scripts/netcdf_overviews.py | scripts/netcdf_overviews.py | #!/usr/bin/env python3
"""
Generate gdal VRTs of netcdfs that can be viewed as RGB/etc in QGIS.
"""
import sys
from glob import glob
import subprocess
from tqdm import tqdm
from pathlib import Path
import xarray as xr
import concurrent.futures
COLOURS = 'blue green red nir swir1 swir2'.split()
LS8_COLOURS = ['coasta... | #!/usr/bin/env python3
"""
Generate gdal VRTs of netcdfs that can be viewed as RGB/etc in QGIS.
"""
import sys
from glob import glob
import subprocess
from tqdm import tqdm
from pathlib import Path
import concurrent.futures
COLOURS = 'blue green red nir swir1 swir2'.split()
MAX_WORKERS = 8
def build_netcdf_vrts(pa... | apache-2.0 | Python |
a4e72dc07f029798cbe765c75736412a5a52a2ff | Rollback testing change in euler31 | wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy | graal/edu.uci.python.benchmark/src/benchmarks/euler31-timed.py | graal/edu.uci.python.benchmark/src/benchmarks/euler31-timed.py | #runas solve()
#unittest.skip recursive generator
#pythran export solve()
# 01/08/14 modified for benchmarking by Wei Zhang
import sys, time
COINS = [1, 2, 5, 10, 20, 50, 100, 200]
# test
def _sum(iterable):
sum = None
for i in iterable:
sum += i
return sum
def balance(pattern):
return sum(... | #runas solve()
#unittest.skip recursive generator
#pythran export solve()
# 01/08/14 modified for benchmarking by Wei Zhang
import sys, time
COINS = [1, 2, 5, 10, 20, 50, 100, 200]
# test
def _sum(iterable):
sum = None
for i in iterable:
sum += i
return sum
def balance(pattern):
return _sum... | bsd-3-clause | Python |
1dc47560dc64325a919b22b0a0a52557a4dc02af | Modify script to use lookup instead of show; #1989 | gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,eXcomm/gratipay.com,eXcomm/gratipay.com,mccolgst/www.gittip.com,eXcomm/gratipay.com,gratipay/gratipay.com,studio666/gratipay.com,mccolgst/www.gittip.com,studio666/gratipay.com,mccolgst/www.gittip.com,mccolgst/www.gittip.com,studio666/gratipay.com,studio6... | scripts/update_user_info.py | scripts/update_user_info.py | #!/usr/bin/env python
"""This is a one-off script to update user_info for #1936.
This could be generalized for #900.
"""
import os
import sys
import time
import requests
from gittip import wireup
from requests_oauthlib import OAuth1
db = wireup.db()
oauth = OAuth1( os.environ['TWITTER_CONSUMER_KEY']
... | #!/usr/bin/env python
"""This is a one-off script to update user_info for #1936.
This could be generalized for #900.
"""
import os
import time
import requests
from gittip import wireup
from requests_oauthlib import OAuth1
db = wireup.db()
oauth = OAuth1( os.environ['TWITTER_CONSUMER_KEY']
, os.enviro... | mit | Python |
b8166742ec60b5a79cde2d9d708cf54bc5736f1e | modify stdout_encoding to return str instead of bytes object for Python3 | goldsmith/Wikipedia,Timidger/Wikia,TobyRoseman/Wikipedia,jeffbuttars/Wikipedia,Timidger/Wikia,alexsalo/Wikipedia,TobyRoseman/Wikipedia,jeffbuttars/Wikipedia,barrust/Wikipedia,AhmedAMohamed/Wikipedia,seansay/Wikipedia,seansay/Wikipedia,suesai/Wikipedia,alexsalo/Wikipedia,kaushik94/Wikipedia,AhmedAMohamed/Wikipedia,kaush... | wikipedia/util.py | wikipedia/util.py | import sys
import functools
def debug(fn):
def wrapper(*args, **kwargs):
res = fn(*args, **kwargs)
return res
return wrapper
class cache(object):
def __init__(self, fn):
self.fn = fn
self._cache = {}
functools.update_wrapper(self, fn)
def __call__(self, *args... | import sys
import functools
def debug(fn):
def wrapper(*args, **kwargs):
res = fn(*args, **kwargs)
return res
return wrapper
class cache(object):
def __init__(self, fn):
self.fn = fn
self._cache = {}
functools.update_wrapper(self, fn)
def __call__(self, *args... | mit | Python |
bf24a7aacf0e25151307cfb2d8ed6bc8f743f70d | Comment out log modifying code in CGC receive so it doesn't crash concrete tracing | angr/angr,chubbymaggie/angr,chubbymaggie/simuvex,schieb/angr,chubbymaggie/simuvex,angr/angr,schieb/angr,f-prettyland/angr,f-prettyland/angr,tyb0807/angr,axt/angr,iamahuman/angr,chubbymaggie/angr,zhuyue1314/simuvex,schieb/angr,axt/angr,chubbymaggie/angr,tyb0807/angr,angr/angr,chubbymaggie/simuvex,axt/angr,iamahuman/angr... | simuvex/procedures/cgc/receive.py | simuvex/procedures/cgc/receive.py | import simuvex
from itertools import count
fastpath_data_counter = count()
class receive(simuvex.SimProcedure):
#pylint:disable=arguments-differ
def run(self, fd, buf, count, rx_bytes):
if self.state.mode == 'fastpath':
# Special case for CFG generation
if not self.state.se.s... | import simuvex
from itertools import count
fastpath_data_counter = count()
class receive(simuvex.SimProcedure):
#pylint:disable=arguments-differ
def run(self, fd, buf, count, rx_bytes):
if self.state.mode == 'fastpath':
# Special case for CFG generation
if not self.state.se.s... | bsd-2-clause | Python |
cae1b8461d4ccafe098d01a5d4c9aca51e675e97 | bump version number | mattias-lundell/pytest-xdist | xdist/__init__.py | xdist/__init__.py | #
__version__ = "1.3"
| #
__version__ = "1.2"
| mit | Python |
7e610622a3ed9bffff155234c7b71c9aacf89e31 | add exit() | Nocturnana/jpush-docs,raoxudong/jpush-docs,Aoyunyun/jpush-docs,war22moon/jpush-docs,Aoyunyun/jpush-docs,Nocturnana/jpush-docs,xiepiaa/jpush-docs,Aoyunyun/jpush-docs,xiongtiancheng/jpush-docs,dengyhgit/jpush-docs,jpush/jpush-docs,dengyhgit/jpush-docs,xiongtiancheng/jpush-docs,war22moon/jpush-docs,xiepiaa/jpush-docs,jpus... | autobuild.py | autobuild.py | #!/usr/bin/env python
import logging
import commands
import os
import time
def git_pull():
print (os.chdir("/opt/push/jpush-docs/jpush-docs/"))
logging.info(commands.getstatusoutput("git pull origin master"))
print ("git pull origin master")
def build():
print (os.chdir("/opt/push/jpush-docs/jpush-do... | #!/usr/bin/env python
import logging
import commands
import os
import time
def git_pull():
print (os.chdir("/opt/push/jpush-docs/jpush-docs/"))
logging.info(commands.getstatusoutput("git pull origin master"))
print ("git pull origin master")
def build():
print (os.chdir("/opt/push/jpush-docs/jpush-do... | mit | Python |
3ef1531f6934055a416cdddc694f6ca75694d649 | Make use of expanduser() more sane | snare/voltron,snare/voltron,snare/voltron,snare/voltron | voltron/common.py | voltron/common.py | import logging
import logging.config
LOG_CONFIG = {
'version': 1,
'formatters': {
'standard': {'format': 'voltron: [%(levelname)s] %(message)s'}
},
'handlers': {
'default': {
'class': 'logging.StreamHandler',
'formatter': 'standard'
}
},
'loggers'... | import logging
import logging.config
LOG_CONFIG = {
'version': 1,
'formatters': {
'standard': {'format': 'voltron: [%(levelname)s] %(message)s'}
},
'handlers': {
'default': {
'class': 'logging.StreamHandler',
'formatter': 'standard'
}
},
'loggers'... | mit | Python |
bf78c387338e2a2bbc556fb0a1c2ed1a693557de | Add port to available arguments. | nvdv/vprof,nvdv/vprof,nvdv/vprof | vprof/__main__.py | vprof/__main__.py | """Main module for visual profiler."""
import argparse
import os
import sys
from vprof import profile_wrappers
from vprof import stats_server
_MODULE_DESC = 'Python visual profiler.'
_HOST = 'localhost'
_PROFILE_MAP = {
'c': profile_wrappers.RuntimeProfile,
'm': profile_wrappers.MemoryProfile,
}
def main()... | """Main module for visual profiler."""
import argparse
import os
import sys
from vprof import profile_wrappers
from vprof import stats_server
_MODULE_DESC = 'Python visual profiler.'
_HOST = 'localhost'
_PORT = 8000
_PROFILE_MAP = {
'c': profile_wrappers.RuntimeProfile,
'm': profile_wrappers.MemoryProfile,
... | bsd-2-clause | Python |
f945c054023220f865032817d04309005e50015e | update __init__.py for SRAMs | cornell-brg/pymtl,cornell-brg/pymtl,cornell-brg/pymtl | pclib/rtl/__init__.py | pclib/rtl/__init__.py |
from regs import Reg, RegEn, RegRst, RegEnRst
from arith import Adder, Subtractor, Incrementer
from arith import ZeroExtender, SignExtender
from arith import ZeroComparator, EqComparator, LtComparator, GtComparator
from arith import SignUnit, UnsignUnit
from arith import Lef... |
from regs import Reg, RegEn, RegRst, RegEnRst
from arith import Adder, Subtractor, Incrementer
from arith import ZeroExtender, SignExtender
from arith import ZeroComparator, EqComparator, LtComparator, GtComparator
from arith import SignUnit, UnsignUnit
from arith import Lef... | bsd-3-clause | Python |
22207247c286ad3c656c3f6b550d869cf92f6e92 | Add fs Opener based on the builtin FTPFS opener | althonos/fs.sshfs | fs/sshfs/__init__.py | fs/sshfs/__init__.py | from __future__ import absolute_import
from __future__ import unicode_literals
from .sshfs import SSHFS
from ..opener import Opener, registry
@registry.install
class SSHOpener(Opener):
protocols = ['ssh']
def open_fs(self, fs_url, parse_result, writeable, create, cwd):
#from .sshfs import SSHFS
... | from __future__ import absolute_import
from __future__ import unicode_literals
from .sshfs import SSHFS
| lgpl-2.1 | Python |
714b517c18c1bdedafd6cd5451df2f64ce9c6ef9 | add GetSliceTicket | dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi | PLC/Methods/__init__.py | PLC/Methods/__init__.py | methods = 'AddAddressType AddAddressTypeToAddress AddBootState AddConfFile AddConfFileToNodeGroup AddConfFileToNode AddKeyType AddMessage AddNetworkMethod AddNetworkType AddNodeGroup AddNodeNetwork AddNode AddNodeToNodeGroup AddNodeToPCU AddPCU AddPeer AddPersonKey AddPerson AddPersonToSite AddPersonToSlice AddRole Add... | methods = 'AddAddressType AddAddressTypeToAddress AddBootState AddConfFile AddConfFileToNodeGroup AddConfFileToNode AddKeyType AddMessage AddNetworkMethod AddNetworkType AddNodeGroup AddNodeNetwork AddNode AddNodeToNodeGroup AddNodeToPCU AddPCU AddPeer AddPersonKey AddPerson AddPersonToSite AddPersonToSlice AddRole Add... | bsd-3-clause | Python |
b54f2549fd6d9a97492a652aae29a4e47f46920d | add todo for trash factory | PTank/trashtalk,PTank/trashtalk | trashtalk/trash_factory.py | trashtalk/trash_factory.py | from __future__ import print_function, absolute_import
from pwd import getpwnam
from os import getlogin
from pathlib import Path
from trashtalk.trash import Trash
import sys
"""
Module who generate trash
:Todo
rename file: generate_trash.py
remove class and make function
change this in core.py and autocomplete_bash.p... | from __future__ import print_function, absolute_import
from pwd import getpwnam
from os import getlogin
from pathlib import Path
from trashtalk.trash import Trash
import sys
class TrashFactory():
"""
"""
def create_trash(self, users=[], medias=[], home=True, all_media=False, error=True):
trashs =... | mit | Python |
bc3a795902a84ae49fc12753c3f391b98b9a924d | Add the "user is away" line to WHOIS output | Heufneutje/txircd,DesertBus/txircd,ElementalAlchemist/txircd | txircd/modules/cmd_away.py | txircd/modules/cmd_away.py | from twisted.words.protocols import irc
from txircd.modbase import Command
class AwayCommand(Command):
def onUse(self, user, data):
if "reason" in data:
user.metadata["away"] = data["reason"]
user.sendMessage(irc.RPL_NOWAWAY, ":You have been marked as being away")
else:
if "away" in user.metadata:
de... | from twisted.words.protocols import irc
from txircd.modbase import Command
class AwayCommand(Command):
def onUse(self, user, data):
if "reason" in data:
user.metadata["away"] = data["reason"]
user.sendMessage(irc.RPL_NOWAWAY, ":You have been marked as being away")
else:
if "away" in user.metadata:
de... | bsd-3-clause | Python |
c2400d5c5349e70bf375d4fe3cab9a4e9f851d31 | improve test to use Twisted listener, not nc | sammyshj/txtorcon,meejah/txtorcon,sammyshj/txtorcon,ghtdak/txtorcon,isislovecruft/txtorcon,isislovecruft/txtorcon,meejah/txtorcon,david415/txtorcon,ghtdak/txtorcon,david415/txtorcon | txtorcon/test/test_util.py | txtorcon/test/test_util.py | from twisted.trial import unittest
from twisted.test import proto_helpers
from twisted.internet import defer
from twisted.internet.endpoints import TCP4ServerEndpoint
from twisted.internet.interfaces import IProtocolFactory
from zope.interface import implements
from txtorcon.util import process_from_address, delete_fi... | from twisted.trial import unittest
from twisted.test import proto_helpers
from txtorcon.util import process_from_address, delete_file_or_tree
import os
import tempfile
import subprocess
class FakeState:
tor_pid = -1
class TestProcessFromUtil(unittest.TestCase):
def setUp(self):
self.fakestate = Fak... | mit | Python |
3c776b0dd950a7444dfc58f2bf8d1f15ab3e6a21 | make a dependency-error'd version of nwis.hdf5 | ocefpaf/ulmo,cameronbracken/ulmo,nathanhilbert/ulmo,nathanhilbert/ulmo,ocefpaf/ulmo,cameronbracken/ulmo | ulmo/usgs/nwis/__init__.py | ulmo/usgs/nwis/__init__.py | """
`USGS National Water Information System`_ web services
.. _USGS National Water Information System: http://waterdata.usgs.gov/nwis
"""
from __future__ import absolute_import
from . import core
from .core import (get_sites, get_site_data)
from ulmo import util
try:
from . import hdf5
except ImportE... | """
`USGS National Water Information System`_ web services
.. _USGS National Water Information System: http://waterdata.usgs.gov/nwis
"""
from __future__ import absolute_import
from . import core
from .core import (get_sites, get_site_data)
from ulmo import util
try:
from . import hdf5
pytables = ... | bsd-3-clause | Python |
416ad8b4ed3f81119ab4a47fea43da4bf246afa2 | reduce BaseDNSService interface. add method docstrings | bkonkle/update-ip | update_ip/services/base.py | update_ip/services/base.py | class BaseDNSService(object):
name = 'Service Name' # Replace this with the name of the DNS service
def update(self, domain, ip):
'''updates the domain with the new ip'''
raise NotImplementedError
def find_domains(self, ip):
'''get all domains with the given ip'''
raise... | class BaseDNSService(object):
name = 'Service Name' # Replace this with the name of the DNS service
def create(self, domain, ip):
raise NotImplementedError
def read(self, domain):
raise NotImplementedError
def update(self, domain, ip):
raise NotImplementedError
... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.