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 |
|---|---|---|---|---|---|---|---|---|
7430dabe21fe505e411a1fefc2fb05218af84057 | add iterator to test case | yuyu2172/chainercv,chainer/chainercv,pfnet/chainercv,yuyu2172/chainercv,chainer/chainercv | tests/evaluations_tests/test_eval_semantic_segmentation.py | tests/evaluations_tests/test_eval_semantic_segmentation.py | import unittest
import numpy as np
from chainer import testing
from chainercv.evaluations import calc_confusion_matrix
from chainercv.evaluations import eval_semantic_segmentation
def _pred_iterator():
pred_labels = np.repeat([[[1, 1, 0], [0, 0, 1]]], 2, axis=0)
for pred_label in pred_labels:
yield... | import unittest
import numpy as np
from chainer import testing
from chainercv.evaluations import calc_confusion_matrix
from chainercv.evaluations import eval_semantic_segmentation
@testing.parameterize(
{'pred_labels': np.repeat([[[1, 1, 0], [0, 0, 1]]], 2, axis=0),
'gt_labels': np.repeat([[[1, 0, 0], [0,... | mit | Python |
f42276007ea1feb4453780f8f9c7e63043b29a23 | fix "connection lost" spam when server-ip isn't blank. | SupaHam/mark2,frostyfrog/mark2,frostyfrog/mark2,SupaHam/mark2 | services/ping.py | services/ping.py | import re
import struct
from twisted.application.service import Service
from twisted.internet import task, reactor
from twisted.internet.protocol import Protocol, ClientFactory
from events import StatPlayerCount, ServerOutputConsumer, ACCEPTED
class PingProtocol(Protocol):
def connectionMade(self):
self... | import struct
from twisted.application.service import Service
from twisted.internet import task, reactor
from twisted.internet.protocol import Protocol, ClientFactory
from events import StatPlayerCount, ServerOutputConsumer, ACCEPTED
class PingProtocol(Protocol):
def connectionMade(self):
self.buff = ""... | mit | Python |
271a506f9000b5206057de6091f5d5314a5b1e65 | bump versions | licenses/lice | lice/__init__.py | lice/__init__.py | __version__ = "0.5"
def main():
from lice.core import main
main()
| __version__ = "0.4"
def main():
from lice.core import main
main()
| bsd-3-clause | Python |
d5f3031562c5c158a731ca5b93442273725b04ba | Use date/time when determining notices | statgen/encore,statgen/encore,statgen/encore,statgen/encore,statgen/encore,statgen/encore | encore/notice.py | encore/notice.py | import sql_pool
import MySQLdb
class Notice:
def __init__(self, notice_id):
self.notice_id = notice
self.message = None
self.start_date = None
self.end_date = None
def as_object(self):
obj = {"notice_id": self.notice_id,
"message": self.messsage,
... | import sql_pool
import MySQLdb
class Notice:
def __init__(self, notice_id):
self.notice_id = notice
self.message = None
self.start_date = None
self.end_date = None
def as_object(self):
obj = {"notice_id": self.notice_id,
"message": self.messsage,
... | agpl-3.0 | Python |
f730b60c961d540f8a6d338cb259d193b30ed7e9 | Add __repr__ and __str__ to models | gmacon/postfix-aliases,gmacon/postfix-aliases | postfix_aliases/models.py | postfix_aliases/models.py | from flask_login import UserMixin
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Domain(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128), unique=True)
def __repr__(self):
return '<{}: {}>'.format(self.__class__.__name__, self.name)
class... | from flask_login import UserMixin
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Domain(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128), unique=True)
class Mailbox(UserMixin, db.Model):
__table_args__ = (
db.UniqueConstraint('localpart',... | mit | Python |
fa02eb8e0bd043293eb96a1be93ee88bea6084b2 | Clean up messy syntax | isaacmg/fb_scraper,isaacmg/fb_scraper | tests/integrations_tests.py | tests/integrations_tests.py | import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
from fb_posts import *
scrape_posts_from_last_scrape("115285708497149")
scrape_posts_from_last_scrape_kafka("319872211700098")
scrape_all_comments("319872211700098")
| import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
from fb_posts import scrape_comments_from_last_scrape, scrape_posts_from_last_scrape, scrape_posts_from_last_scrape_kafka, scrape_all_comments
scrape_posts_from_last_scrape("115285708497149")
scrape_posts_from_last_scrape_k... | apache-2.0 | Python |
559d516d1f4cea4156522ebd22d6d155c8f38b84 | change "name" to "label" | MBALearnsToCode/CorpFin,MBALearnsToCode/FinSymPy,MBALearnsToCode/FinSymPy,MBALearnsToCode/CorpFin | CorpFin/Security.py | CorpFin/Security.py |
class Security:
def __init__(self, label='', par=0., val=0.):
self.name = label
self.par = par
self.val = val
def __repr__(self):
if self.name:
s = ' "%s"' % self.name
else:
s = ''
return 'Security' + s + ': Par = %.3g, Val = %.3g' % (se... |
class Security:
def __init__(self, name='', par=0., val=0.):
self.name = name
self.par = par
self.val = val
def __repr__(self):
if self.name:
s = ' "%s"' % self.name
else:
s = ''
return 'Security' + s + ': Par = %.3g, Val = %.3g' % (self... | mit | Python |
effbc4bf8131cbd355155c1c72a858204311f7be | update how tours are listed | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | corehq/apps/tour/tours.py | corehq/apps/tour/tours.py | from django.core.urlresolvers import reverse
from corehq.apps.tour.models import has_user_seen_tour
from corehq.apps.tour.views import EndTourView
class StaticGuidedTour(object):
def __init__(self, slug, template):
self.slug = slug
self.template = template
def get_tour_data(self):
re... | import collections
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_noop as _
from corehq.apps.tour.utils import tour_is_enabled_for_user
GuidedTourStep = collections.namedtuple('GuidedTourStep', ['element', 'title', 'content'])
class StaticGuidedTour(object):
def __i... | bsd-3-clause | Python |
7039bfdd0e7384bf1ae934a3cea2486becd5a48f | Upgrade mockito to 2.23.0 | GerritCodeReview/plugins_webhooks | external_plugin_deps.bzl | external_plugin_deps.bzl | load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
maven_jar(
name = "mockito",
artifact = "org.mockito:mockito-core:2.23.0",
sha1 = "497ddb32fd5d01f9dbe99a2ec790aeb931dff1b1",
deps = [
"@byte-buddy//jar",
"@byte-buddy-agent//jar",
... | load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
maven_jar(
name = "mockito",
artifact = "org.mockito:mockito-core:2.9.0",
sha1 = "f28b9606eca8da77e10df30a7e301f589733143e",
deps = [
"@byte-buddy//jar",
"@objenesis//jar",
],
... | apache-2.0 | Python |
e98d1fd364f9eff5497306b08b0fe5176b3c7379 | Initialize the ship with active set up to True | nephilahacks/spider-eats-the-kiwi | entities/ship.py | entities/ship.py | from .base import BaseEntity
from kivy.core.window import Window
class Ship(BaseEntity):
def __init__(self, *args, **kwargs):
super(Ship, self).__init__(*args, **kwargs)
self.active = True | from .base import BaseEntity
from kivy.core.window import Window
class Ship(BaseEntity):
pass | mit | Python |
b031c1d6d2a4e6214bf53357dd400c0d54b1c099 | Use StrictRedis's from_url() | nickfrostatx/expenses,nickfrostatx/expenses,nickfrostatx/expenses | expenses/app.py | expenses/app.py | # -*- coding: utf-8 -*-
"""Flask application factory."""
from flask import Flask
from redis import StrictRedis
from . import __name__ as package_name
import os
def create_app():
"""Return an instance of the main Flask application."""
app = Flask(package_name)
app.config.setdefault('REDIS_URL', 'redis://... | # -*- coding: utf-8 -*-
"""Flask application factory."""
from flask import Flask
from redis import from_url
from . import __name__ as package_name
import os
def create_app():
"""Return an instance of the main Flask application."""
app = Flask(package_name)
app.config.setdefault('REDIS_URL', 'redis://loc... | mit | Python |
c481a6266668e747dfaf3a9a86904530d01e6ade | Fix some tests. | hello-base/web,hello-base/web,hello-base/web,hello-base/web | tests/people/test_models.py | tests/people/test_models.py | # -*- coding: utf-8 -*-
import datetime
import pytest
from components.people.models import Group, Idol, Membership, Staff
from components.people.factories import (GroupFactory, IdolFactory,
MembershipFactory, StaffFactory)
pytestmark = pytest.mark.django_db
class TestGroups:
def test_group_factory(self):
... | # -*- coding: utf-8 -*-
import datetime
import pytest
from components.people.models import Group, Idol, Membership, Staff
from components.people.factories import (GroupFactory, IdolFactory,
MembershipFactory, StaffFactory)
pytestmark = pytest.mark.django_db
class TestGroups:
def test_group_factory(self):
... | apache-2.0 | Python |
9993853448c593ab11ddf7d7c12bbcd307829901 | remove label from captcha | AccentDesign/wagtailstreamforms,AccentDesign/wagtailstreamforms,AccentDesign/wagtailstreamforms,AccentDesign/wagtailstreamforms | wagtailstreamforms/forms.py | wagtailstreamforms/forms.py | from django import forms
from captcha.fields import ReCaptchaField
from wagtail.wagtailforms.forms import FormBuilder as OrigFormBuilder
from wagtailstreamforms.utils import recaptcha_enabled
class FormBuilder(OrigFormBuilder):
def __init__(self, fields, **kwargs):
self.add_recaptcha = kwargs.pop('add_r... | from django import forms
from captcha.fields import ReCaptchaField
from wagtail.wagtailforms.forms import FormBuilder as OrigFormBuilder
from wagtailstreamforms.utils import recaptcha_enabled
class FormBuilder(OrigFormBuilder):
def __init__(self, fields, **kwargs):
self.add_recaptcha = kwargs.pop('add_r... | mit | Python |
ca862a62f93273efd0561ed1d37087cd8edefaed | bump version | ramusus/django-facebook-api | facebook_api/__init__.py | facebook_api/__init__.py | # -*- coding: utf-8 -*-
#
# Copyright 2011-2015 ramusus
# 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 ... | # -*- coding: utf-8 -*-
#
# Copyright 2011-2015 ramusus
# 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 ... | bsd-3-clause | Python |
df2d61d1b9dc9dc22e745a6bd06bc8feeb766bab | Fix roles migration script. | eevee/floof,eevee/floof,eevee/floof | migration/versions/006_Add_roles.py | migration/versions/006_Add_roles.py | from sqlalchemy import *
from migrate import *
from sqlalchemy.orm import sessionmaker, relation
from sqlalchemy.ext.declarative import declarative_base
TableBase = declarative_base()
class Role(TableBase):
__tablename__ = 'roles'
id = Column(Integer, primary_key=True, nullable=False)
name = Column(Unicod... | from sqlalchemy import *
from migrate import *
from sqlalchemy.orm import sessionmaker, relation
from sqlalchemy.ext.declarative import declarative_base
TableBase = declarative_base()
class Role(TableBase):
__tablename__ = 'roles'
id = Column(Integer, primary_key=True, nullable=False)
name = Column(Unicod... | isc | Python |
ac4ba844aade398ee18c9f11326035ec33e8af6b | Fix print statement in lint.py | PostDispatchInteractive/app-template,PostDispatchInteractive/app-template,PostDispatchInteractive/app-template,PostDispatchInteractive/app-template | fabfile/lint.py | fabfile/lint.py | #!/usr/bin/env python
"""
Commands for linting JavaScript
"""
from glob import glob
import os
from fabric.api import local, task
import app
@task(default=True)
def lint():
"""
Run ESLint on all .js files.
"""
for path in glob('www/js/*.js'):
filename = os.path.split(path)[-1]
name ... | #!/usr/bin/env python
"""
Commands for linting JavaScript
"""
from glob import glob
import os
from fabric.api import local, task
import app
@task(default=True)
def lint():
"""
Run ESLint on all .js files.
"""
for path in glob('www/js/*.js'):
filename = os.path.split(path)[-1]
name ... | mit | Python |
bc8be113b50cc733a9c924d5be7a0488a947e347 | Use apt safe-upgrade. | sociateru/fabtools,wagigi/fabtools-python,bitmonk/fabtools,prologic/fabtools,fabtools/fabtools,badele/fabtools,n0n0x/fabtools-python,pombredanne/fabtools,pahaz/fabtools,davidcaste/fabtools,ronnix/fabtools,ahnjungho/fabtools,AMOSoft/fabtools,hagai26/fabtools | fabtools/deb.py | fabtools/deb.py | """
Fabric tools for managing Debian/Ubuntu packages
"""
from fabric.api import *
def update_index():
"""
Quietly update package index
"""
sudo("aptitude -q -q update")
def upgrade():
"""
Upgrade all packages
"""
sudo("aptitude --assume-yes safe-upgrade")
def is_installed(pkg_name)... | """
Fabric tools for managing Debian/Ubuntu packages
"""
from fabric.api import *
def update_index():
"""
Quietly update package index
"""
sudo("aptitude -q -q update")
def upgrade():
"""
Upgrade all packages
"""
sudo("aptitude --assume-yes upgrade")
def is_installed(pkg_name):
... | bsd-2-clause | Python |
23073881aafcd0e7fdff024d3ef6c2f93a48dad3 | Fix keystone config group name | StackStorm/mistral,openstack/mistral,dennybaa/mistral,dennybaa/mistral,openstack/mistral,StackStorm/mistral,dzimine/mistral,TimurNurlygayanov/mistral | mistral/utils/openstack/keystone.py | mistral/utils/openstack/keystone.py | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 | Python |
d52cd5285eacacd534663e1bf4b10ddff92037df | Fix error in function call | NLeSC/cptm,NLeSC/cptm | cptm/tabular2cpt_input.py | cptm/tabular2cpt_input.py | """Script that converts a field in a tabular data file to cptm input files
Used for the CAP vragenuurtje data.
Uses frog to pos-tag and lemmatize the data.
Usage: python tabular2cpt_input.py <csv of excel file> <full text field name>
<dir out>
"""
import pandas as pd
import logging
import sys
import argparse
from ... | """Script that converts a field in a tabular data file to cptm input files
Used for the CAP vragenuurtje data.
Uses frog to pos-tag and lemmatize the data.
Usage: python tabular2cpt_input.py <csv of excel file> <full text field name>
<dir out>
"""
import pandas as pd
import logging
import sys
import argparse
from ... | apache-2.0 | Python |
3ca11cd2ba0bcff8bbc4d01df2ba5b72f5b2e4b0 | Remove the plural from the url | robhudson/warehouse,mattrobenolt/warehouse,techtonik/warehouse,techtonik/warehouse,mattrobenolt/warehouse,mattrobenolt/warehouse,robhudson/warehouse | warehouse/packaging/urls.py | warehouse/packaging/urls.py | # Copyright 2013 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | # Copyright 2013 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 | Python |
33c82aaaf4e13a8762fc98ea3ad9b6757751cee9 | Update process-schedules.py | JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub | cron/process-schedules.py | cron/process-schedules.py | #!/usr/bin/env python
import MySQLdb
#import datetime
#import urllib2
#import os
servername = "localhost"
username = "pi"
password = "password"
dbname = "pi_heating_db"
cnx = MySQLdb.connect(host=servername, user=username, passwd=password, db=dbname)
cursorupdate = cnx.cursor()
query = ("UPDATE `timers` set value... | apache-2.0 | Python | |
190546fa029b47adbfc2c008e505169294c9bb67 | Update WebClient.py | VitorHugoAguiar/ProBot,VitorHugoAguiar/ProBot,VitorHugoAguiar/ProBot,VitorHugoAguiar/ProBot | ProBot_BeagleBone/WebClient.py | ProBot_BeagleBone/WebClient.py | #!/usr/bin/python
import sys
import zmq
import SocketCommunication
from twisted.internet import reactor
from twisted.internet.protocol import ReconnectingClientFactory
from twisted.python import log
from autobahn.twisted.websocket import WebSocketClientFactory, \
WebSocketClientProtocol, \
connectWS
# Initia... | #!/usr/bin/python
import sys
import zmq
import SocketCommunication
from twisted.internet import reactor
from twisted.internet.protocol import ReconnectingClientFactory
from twisted.python import log
from autobahn.twisted.websocket import WebSocketClientFactory, \
WebSocketClientProtocol, \
connectWS
Pub_Sub... | agpl-3.0 | Python |
4c230f587b66be4a2acfdf3814fa813914a1ab4e | Add upvotes/downvotes to urbandict plugin (closes #166) | JohnMaguire/Cardinal | plugins/urbandict/plugin.py | plugins/urbandict/plugin.py | import logging
from cardinal.decorators import command, help
import requests
URBANDICT_API_PREFIX = 'http://api.urbandictionary.com/v0/define'
class UrbanDictPlugin:
def __init__(self):
self.logger = logging.getLogger(__name__)
@command(['ud', 'urbandict'])
@help('Returns the top Urban Diction... | from urllib.request import urlopen
import json
from cardinal.decorators import command, help
URBANDICT_API_PREFIX = 'http://api.urbandictionary.com/v0/define?term='
class UrbanDictPlugin:
@command(['ud', 'urbandict'])
@help('Returns the top Urban Dictionary definition for a given word.')
@help('Syntax: ... | mit | Python |
0ad6845b5ea1c4151143bd8e6902595bcd64845f | Add logging.error to run_cmd | sjktje/sjkscan,sjktje/sjkscan | sjkscan/utils.py | sjkscan/utils.py | import argparse
import datetime
import logging
import os
import shutil
import subprocess
from .config import config
from . import __version__
def run_cmd(args):
"""Run shell command and return its output.
:param args: list or string of shell command and arguments
:returns: output of command
"""
... | import argparse
import datetime
import logging
import os
import shutil
import subprocess
from .config import config
from . import __version__
def run_cmd(args):
"""Run shell command and return its output.
:param args: list or string of shell command and arguments
:returns: output of command
"""
... | bsd-2-clause | Python |
6b2202d0b7a4ef544b63e1692e40c5fec9c5930a | Extend import statement to support Python 3 | plotly/dash,plotly/dash,plotly/dash,plotly/dash,plotly/dash | dash_renderer/__init__.py | dash_renderer/__init__.py | # For reasons that I don't fully understand,
# unless I include __file__ in here, the packaged version
# of this module will just be a .egg file, not a .egg folder.
# And if it's just a .egg file, it won't include the necessary
# dependencies from MANIFEST.in.
# Found the __file__ clue by inspecting the `python setup.p... | # For reasons that I don't fully understand,
# unless I include __file__ in here, the packaged version
# of this module will just be a .egg file, not a .egg folder.
# And if it's just a .egg file, it won't include the necessary
# dependencies from MANIFEST.in.
# Found the __file__ clue by inspecting the `python setup.p... | mit | Python |
9539275c3d3d0b6dd4ff95c5e0795faea4112b02 | Remove usage of versiontools from dashboard_app/__init__.py | OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server | dashboard_app/__init__.py | dashboard_app/__init__.py | # Copyright (C) 2010 Linaro Limited
#
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
#
# This file is part of Launch Control.
#
# Launch Control is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3
# as published by the Free Software F... | # Copyright (C) 2010 Linaro Limited
#
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
#
# This file is part of Launch Control.
#
# Launch Control is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3
# as published by the Free Software F... | agpl-3.0 | Python |
0574b7dad5225444f0f7292374f645a6dc2d305b | test cleanup | mitodl/lore,amir-qayyum-khan/lore,amir-qayyum-khan/lore,amir-qayyum-khan/lore,mitodl/lore,mitodl/lore,mitodl/lore,mitodl/lore,amir-qayyum-khan/lore,amir-qayyum-khan/lore | importer/tests/test_views.py | importer/tests/test_views.py | """
Test the importer views to make sure they work.
"""
from __future__ import unicode_literals
import logging
from learningresources.models import LearningResource, Course
from learningresources.tests.base import LoreTestCase
from .test_import import get_course_zip
HTTP_OK = 200
log = logging.getLogger(__name__)... | """
Test the importer views to make sure they work.
"""
from __future__ import unicode_literals
import logging
from learningresources.models import LearningResource, Course
from learningresources.tests.base import LoreTestCase
from .test_import import get_course_zip
HTTP_OK = 200
log = logging.getLogger(__name__)... | agpl-3.0 | Python |
fe65cca3ab2fe3c0f2c05531e761e5a7bd83dbd4 | add cluster info api | InterestingLab/elasticmanager | cluster/models.py | cluster/models.py | from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from elasticsearch import Elasticsearch
@python_2_unicode_compatible
class ElasticCluster(models.Model):
class Meta:
db_table = 'cluster_elastic_cluster'
# cluster name
name = models.CharField(max_length=128... | from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from elasticsearch import Elasticsearch
@python_2_unicode_compatible
class ElasticCluster(models.Model):
class Meta:
db_table = 'cluster_elastic_cluster'
# cluster name
name = models.CharField(max_length=128... | mit | Python |
ad276d549eebe9c6fe99a629a76f02fc04b2bd51 | Simplify pubannotation test to not check exact numbers | jakelever/kindred,jakelever/kindred | tests/test_pubannotation.py | tests/test_pubannotation.py |
import kindred
def test_pubannotation():
corpus = kindred.pubannotation.load('bionlp-st-gro-2013-development')
assert isinstance(corpus,kindred.Corpus)
fileCount = len(corpus.documents)
entityCount = sum([ len(d.entities) for d in corpus.documents ])
relationCount = sum([ len(d.relations) for d in corpus.docum... |
import kindred
def test_pubannotation():
corpus = kindred.pubannotation.load('bionlp-st-gro-2013-development')
assert isinstance(corpus,kindred.Corpus)
fileCount = len(corpus.documents)
entityCount = sum([ len(d.entities) for d in corpus.documents ])
relationCount = sum([ len(d.relations) for d in corpus.docum... | mit | Python |
75d0b325ac16b05bdc22591a7532c5543ffe26d2 | Add wagtail_hooks tests | gasman/wagtaildraftail,springload/wagtaildraftail,springload/wagtaildraftail,springload/wagtaildraftail,gasman/wagtaildraftail,gasman/wagtaildraftail,gasman/wagtaildraftail,springload/wagtaildraftail | tests/test_wagtail_hooks.py | tests/test_wagtail_hooks.py | from __future__ import absolute_import, unicode_literals
import unittest
from wagtail.wagtailcore.hooks import get_hooks
from wagtaildraftail.wagtail_hooks import draftail_editor_css, draftail_editor_js
class TestWagtailHooks(unittest.TestCase):
def test_editor_css(self):
self.assertEqual(
... | from __future__ import absolute_import, unicode_literals
import unittest
from wagtaildraftail.wagtail_hooks import draftail_editor_css, draftail_editor_js
class TestWagtailHooks(unittest.TestCase):
def test_editor_css(self):
self.assertEqual(
draftail_editor_css(), '<link rel="stylesheet" hr... | mit | Python |
e7587adfa574f17998168aa09eb924ecd78bd74f | rename for clarity | AntreasAntoniou/DeepClassificationBot,AntreasAntoniou/DeepClassificationBot | tests/test_name_extractor.py | tests/test_name_extractor.py | # -*- coding: utf-8 -*-
import collections
import requests
import name_extractor
def test_top_n_shows(monkeypatch):
for report, expected in [
(two_shows, [['Steins;Gate'], ['Fullmetal Alchemist: Brotherhood']]),
(no_shows, []),
]:
monkeypatch.setattr(requests, 'get', mock_get(r... | # -*- coding: utf-8 -*-
import collections
import requests
import name_extractor
def test_top_n_shows(monkeypatch):
for report, expected in [
(two_items, ['Steins;Gate', 'Fullmetal Alchemist: Brotherhood']),
(no_items, []),
]:
monkeypatch.setattr(requests, 'get', mock_get(repor... | mit | Python |
2cff29fa2ec89c4ced09691c455e3aa554be4f9f | Add test for display-cop-names | adrianmoisey/lint-review,zoidbergwill/lint-review,markstory/lint-review,markstory/lint-review,markstory/lint-review,adrianmoisey/lint-review,zoidbergwill/lint-review,zoidbergwill/lint-review | tests/tools/test_rubocop.py | tests/tools/test_rubocop.py | from os.path import abspath
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.utils import in_path
from lintreview.tools.rubocop import Rubocop
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_
rubocop_missing = not(in_path('rubocop'))
cl... | from os.path import abspath
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.utils import in_path
from lintreview.tools.rubocop import Rubocop
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_
rubocop_missing = not(in_path('rubocop'))
cl... | mit | Python |
7cd2a9ba465c84c979985791e135025f448d0dcc | add pipeline settings | Crayzero/crawler | first_scrapy/settings.py | first_scrapy/settings.py | # Scrapy settings for first_scrapy project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'first_scrapy'
SPIDER_MODULES = ['first_scrapy.spiders']
NEWSPIDER_MODU... | # Scrapy settings for first_scrapy project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'first_scrapy'
SPIDER_MODULES = ['first_scrapy.spiders']
NEWSPIDER_MODU... | mit | Python |
be9a7601296d274b858e299435e1c6f903d3c564 | remove init | freevo/kaa-base,freevo/kaa-base | test/glib.py | test/glib.py | import kaa
class Test():
@kaa.threaded(kaa.GOBJECT)
@kaa.synchronized()
def foo(self):
import time
time.sleep(0.4)
return kaa.is_mainthread()
@kaa.coroutine()
def test(self):
r = yield self.foo()
print 'foo', kaa.is_mainthread(), r
@kaa.synchronize... | import kaa
class Test():
@kaa.threaded(kaa.GOBJECT)
@kaa.synchronized()
def foo(self):
import time
time.sleep(0.4)
return kaa.is_mainthread()
@kaa.coroutine()
def test(self):
r = yield self.foo()
print 'foo', kaa.is_mainthread(), r
@kaa.synchronize... | lgpl-2.1 | Python |
f73b04bb17febf7b8eee05e389d071e4a83912c7 | test with json messages | mgax/zechat,mgax/zechat | testsuite/test_transport.py | testsuite/test_transport.py | import pytest
from mock import Mock, call
from flask import json
@pytest.fixture
def node():
from zechat.node import Node
return Node()
def mock_ws(client_id):
ws = Mock(id=client_id)
ws.out = []
ws.send.side_effect = lambda i: ws.out.append(json.loads(i))
return ws
def handle(node, ws, in... | import pytest
from mock import Mock, call
from flask import json
@pytest.fixture
def node():
from zechat.node import Node
return Node()
def mock_ws(client_id):
ws = Mock(id=client_id)
ws.out = []
ws.send.side_effect = lambda i: ws.out.append(json.loads(i))
return ws
def handle(node, ws, in... | mit | Python |
e38a97b9a4252aa5d1c825d564284e4d7ba23d0d | Fix importlib error detection for Python 3.5, compatible with 2.x | django-fluent/django-fluent-comments,edoburu/django-fluent-comments,django-fluent/django-fluent-comments,django-fluent/django-fluent-comments,edoburu/django-fluent-comments,django-fluent/django-fluent-comments,edoburu/django-fluent-comments | fluent_comments/utils.py | fluent_comments/utils.py | """
Internal utils
"""
import sys
import traceback
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from fluent_comments import appsettings
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_m... | """
Internal utils
"""
import sys
import traceback
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from fluent_comments import appsettings
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_m... | apache-2.0 | Python |
246c4bed63b59763c84e7bc89c1a3b22a36157f1 | Bump version to 1.2 | edoburu/django-fluent-utils | fluent_utils/__init__.py | fluent_utils/__init__.py | # following PEP 386
__version__ = "1.2"
| # following PEP 386
__version__ = "1.1.6"
| apache-2.0 | Python |
4b659b7b2552da033753349e059eee172025e00e | Reorder imports based on isort rules. | adbpy/wire-protocol | adbwp/__init__.py | adbwp/__init__.py | """
adbwp
~~~~~
Android Debug Bridge (ADB) Wire Protocol.
"""
# pylint: disable=wildcard-import
from . import exceptions, header, message
from .exceptions import *
from .header import Header
from .message import Message
__all__ = exceptions.__all__ + ['header', 'message', 'Header', 'Message']
__version__... | """
adbwp
~~~~~
Android Debug Bridge (ADB) Wire Protocol.
"""
# pylint: disable=wildcard-import
from . import exceptions
from .exceptions import *
from . import header
from .header import Header
from . import message
from .message import Message
__all__ = exceptions.__all__ + ['header', 'message', 'Heade... | apache-2.0 | Python |
33641ac7d517f436fd69bd567e21aebcb1e908cd | Update admin | colajam93/aurpackager,colajam93/aurpackager,colajam93/aurpackager,colajam93/aurpackager | manager/admin.py | manager/admin.py | from django.contrib import admin
from manager.models import Package, Build
class PackageAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'source')
admin.site.register(Package, PackageAdmin)
class BuildAdmin(admin.ModelAdmin):
list_display = ('id', 'package', 'version', 'date', 'status')
admin.site... | from django.contrib import admin
from manager.models import Package, Build
class PackageAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'source')
admin.site.register(Package, PackageAdmin)
class BuildAdmin(admin.ModelAdmin):
list_display = ('id', 'package', 'version', 'date')
admin.site.register(... | mit | Python |
12b1b7a477cc99e1c3ec3405269999c7974677b6 | Move getting the event loop out of try/except | mwfrojdman/aioinotify | aioinotify/cli.py | aioinotify/cli.py | import logging
from argparse import ArgumentParser
import asyncio
from .protocol import connect_inotify
logger = logging.getLogger(__name__)
def main():
parser = ArgumentParser()
parser.add_argument(
'-ll', '--log-level', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR'], default='WARNING')
parser.... | import logging
from argparse import ArgumentParser
import asyncio
from .protocol import connect_inotify
logger = logging.getLogger(__name__)
def main():
parser = ArgumentParser()
parser.add_argument(
'-ll', '--log-level', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR'], default='WARNING')
parser.... | apache-2.0 | Python |
a6eb9eabc2931cbb647d245332bc3eb9ac77598b | Add a soup.find API test | kovidgoyal/html5-parser,kovidgoyal/html5-parser | test/soup.py | test/soup.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
# License: Apache 2.0 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import absolute_import, division, print_function, unicode_literals
from html5_parser.soup import parse
from . import TestCase
class SoupTest(TestCase):
def test_simple_so... | #!/usr/bin/env python
# vim:fileencoding=utf-8
# License: Apache 2.0 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import absolute_import, division, print_function, unicode_literals
from html5_parser.soup import parse
from . import TestCase
class SoupTest(TestCase):
def test_simple_so... | apache-2.0 | Python |
a60a840ff938030e2790bdae7d0fd933073cd96c | update West Oxfordshire import script for parl.2017-06-08 (closes #953) | DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_west_oxfordshire.py | polling_stations/apps/data_collection/management/commands/import_west_oxfordshire.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000181'
addresses_name = 'parl.2017-06-08/Version 1/West Oxfordshire Democracy_Club__08June2017.tsv'
stations_name = 'parl.2017-06-08/Version 1/West Oxfords... | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000181'
addresses_name = 'May 2017/WestOxfordshire_Democracy_Club__04May2017.tsv'
stations_name = 'May 2017/WestOxfordshire_Democracy_Club__04May2017.tsv'
... | bsd-3-clause | Python |
ef8dc1b4696b053896c315c54e0bfd375c25b7f5 | Update config.py | A1014280203/Ugly-Distributed-Crawler | master/config.py | master/config.py | headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/'
'537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',
'Referer': ''
}
r_server = {
'ip': 'localhost',
'port': '6379',
'passwd': '',
's_proxy': 'proxy_ip',
# the name of set w... | headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/'
'537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',
'Referer': ''
}
r_server = {
'ip': 'localhost',
'port': '6379',
'passwd': '',
's_proxy': 'proxy_ip',
's_url': 'url'
}
... | mpl-2.0 | Python |
e4885689fc2f9e9f37814326a9eeef07ee4483f9 | Bump version to 1.8alpha3 | rolandgeider/wger,wger-project/wger,petervanderdoes/wger,kjagoo/wger_stark,wger-project/wger,kjagoo/wger_stark,rolandgeider/wger,kjagoo/wger_stark,petervanderdoes/wger,wger-project/wger,petervanderdoes/wger,wger-project/wger,kjagoo/wger_stark,rolandgeider/wger,rolandgeider/wger,petervanderdoes/wger | wger/__init__.py | wger/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
VERSION = (1, 8, 0, 'alpha', 3)
RELEASE = False
def get_version(version=None, release=None):
"""Derives a PEP386-compliant version number from VER... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
VERSION = (1, 8, 0, 'alpha', 2)
RELEASE = False
def get_version(version=None, release=None):
"""Derives a PEP386-compliant version number from VER... | agpl-3.0 | Python |
0c09c230c6c52ce86fe1a7220aea4e70da34e258 | Bump version | petervanderdoes/wger,petervanderdoes/wger,wger-project/wger,petervanderdoes/wger,wger-project/wger,wger-project/wger,petervanderdoes/wger,wger-project/wger | wger/__init__.py | wger/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
VERSION = (2, 1, 0, 'alpha', 1)
RELEASE = False
def get_version(version=None, release=None):
"""Derives a PEP386-compliant version number from VER... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
VERSION = (2, 0, 0, 'final', 1)
RELEASE = True
def get_version(version=None, release=None):
"""Derives a PEP386-compliant version number from VERS... | agpl-3.0 | Python |
9384f76d4ecfe2a822747020ba20771019105aaa | Set threads to daemons so that they exit when the main thread exits | boundary/boundary-plugin-shell,boundary/boundary-plugin-shell,jdgwartney/boundary-plugin-shell,jdgwartney/boundary-plugin-shell | metric_thread.py | metric_thread.py | #!/usr/bin/env python
# Copyright 2014 Boundary, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | #!/usr/bin/env python
# Copyright 2014 Boundary, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | apache-2.0 | Python |
43f9f148b7b6d7a483a5c585f3bb9802f74d314f | bump version | tizz98/prosperworks-api | prosperworks/constants.py | prosperworks/constants.py | __version__ = "0.0.5"
# Headers
# values
CONTENT_TYPE = "application/json"
APPLICATION = "developer_api"
# keys
ACCESS_TOKEN_HEADER = "X-PW-AccessToken"
APPLICATION_HEADER = "X-PW-Application"
EMAIL_HEADER = "X-PW-UserEmail"
# Order by most recent first, default will be API_VERSIONS[0]
API_VERSIONS = (
"v1",
)
B... | __version__ = "0.0.4"
# Headers
# values
CONTENT_TYPE = "application/json"
APPLICATION = "developer_api"
# keys
ACCESS_TOKEN_HEADER = "X-PW-AccessToken"
APPLICATION_HEADER = "X-PW-Application"
EMAIL_HEADER = "X-PW-UserEmail"
# Order by most recent first, default will be API_VERSIONS[0]
API_VERSIONS = (
"v1",
)
B... | mit | Python |
164b07fefdd8db74ccce7ff44c33a6120cd98c86 | Fix xlrd issue Column headers must be strings | mfraezz/modular-file-renderer,rdhyee/modular-file-renderer,AddisonSchiller/modular-file-renderer,mfraezz/modular-file-renderer,TomBaxter/modular-file-renderer,rdhyee/modular-file-renderer,AddisonSchiller/modular-file-renderer,CenterForOpenScience/modular-file-renderer,felliott/modular-file-renderer,AddisonSchiller/modu... | mfr/ext/tabular/libs/xlrd_tools.py | mfr/ext/tabular/libs/xlrd_tools.py | import xlrd
from ..exceptions import TableTooBigException, EmptyTableException
from ..configuration import config
from ..utilities import header_population
from ..compat import range
def xlsx_xlrd(fp):
"""Read and convert a xlsx file to JSON format using the xlrd library
:param fp: File pointer object
:re... | import xlrd
from ..exceptions import TableTooBigException, EmptyTableException
from ..configuration import config
from ..utilities import header_population
from ..compat import range
def xlsx_xlrd(fp):
"""Read and convert a xlsx file to JSON format using the xlrd library
:param fp: File pointer object
:re... | apache-2.0 | Python |
031aed2929710c2ed80885031ba83858d2f350b9 | fix translate command | appu1232/Selfbot-for-Discord | cogs/translate.py | cogs/translate.py | import requests
import discord
import json
from urllib import parse
from bs4 import BeautifulSoup
from discord.ext import commands
'''Translator cog - Love Archit & Lyric'''
class Translate:
def __init__(self, bot):
self.bot = bot
# Thanks to lyric for helping me in making this pos... | import requests
import discord
from urllib import parse
from bs4 import BeautifulSoup
from discord.ext import commands
'''Translator cog - Love Archit & Lyric'''
class Translate:
def __init__(self, bot):
self.bot = bot
# Thanks to lyric for helping me in making this possible. You ar... | mit | Python |
4d8a6196425f6a113bc4653100b1a183634f8f9b | add /assemblee/ just after france/ in urls | yohanboniface/memopol-core,yohanboniface/memopol-core,yohanboniface/memopol-core | memopol2/urls.py | memopol2/urls.py | import os
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import direct_to_template
from django.conf import settings
from django.contrib import admin
from django.views.static import serve
admin.autodiscover()
urlpatterns = patterns('', # pylint: disable=C0103
url(r'^... | import os
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import direct_to_template
from django.conf import settings
from django.contrib import admin
from django.views.static import serve
admin.autodiscover()
urlpatterns = patterns('', # pylint: disable=C0103
url(r'^... | agpl-3.0 | Python |
b858b4e230222de125b30f9ec3f70b72056322ba | Set version 2.0.1-pre. | jdswinbank/Comet,jdswinbank/Comet | comet/__init__.py | comet/__init__.py | __description__ = "VOEvent Broker"
__url__ = "http://comet.transientskp.org/"
__author__ = "John Swinbank"
__contact__ = "swinbank@princeton.edu"
__version__ = "2.0.1-pre"
| __description__ = "VOEvent Broker"
__url__ = "http://comet.transientskp.org/"
__author__ = "John Swinbank"
__contact__ = "swinbank@princeton.edu"
__version__ = "2.0.0"
| bsd-2-clause | Python |
c15a9622ab31d09fec9a12c34584342df12ae362 | fix login_allowed check | coco-project/coco,coco-project/coco,coco-project/coco,coco-project/coco | ipynbsrv/core/auth/checks.py | ipynbsrv/core/auth/checks.py | # from ipynbsrv.core.models import BackendUser
def login_allowed(user):
"""
@user_passes_test decorator to check whether the user is allowed to access the application or not.
We do not want to allow non-UserBackend users to access the application
(because we need the LDAP entry for the shares etc.) s... | # from ipynbsrv.core.models import BackendUser
def login_allowed(user):
"""
@user_passes_test decorator to check whether the user is allowed to access the application or not.
We do not want to allow non-UserBackend users to access the application
(because we need the LDAP entry for the shares etc.) s... | bsd-3-clause | Python |
3dfa128111027cc77ac1294ccb78f7687f80d069 | add tests for parsing description | tswicegood/maxixe | maxixe/tests/parser.py | maxixe/tests/parser.py | import textwrap
import unittest
from .. import parser
basic = """
Feature: This is a feature
In order to understand the system under test
As a developer and a business user
I want to be able to parse features
""".strip()
lower = """
feature: This is a feature
In order to understand the system under test
As... | import unittest
from .. import parser
basic = """
Feature: This is a feature
In order to understand the system under test
As a developer and a business user
I want to be able to parse features
""".strip()
lower = """
feature: This is a feature
In order to understand the system under test
As a developer and... | apache-2.0 | Python |
5d1e8e4d4ba9c78c83d9cc82f250c8e6766c0ca8 | Simplify the accuracy implementation | niboshi/chainer,ikasumi/chainer,niboshi/chainer,pfnet/chainer,sou81821/chainer,sinhrks/chainer,benob/chainer,tigerneil/chainer,ktnyt/chainer,AlpacaDB/chainer,cupy/cupy,niboshi/chainer,ysekky/chainer,cupy/cupy,minhpqn/chainer,AlpacaDB/chainer,okuta/chainer,anaruse/chainer,1986ks/chainer,delta2323/chainer,hvy/chainer,kik... | chainer/functions/accuracy.py | chainer/functions/accuracy.py | import numpy
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class Accuracy(function.Function):
def check_type_forward(self, in_types):
type_check.expect(in_types.size() == 2)
x_type, t_type = in_types
type_check.expect(
x_type.dtyp... | import numpy
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class Accuracy(function.Function):
def check_type_forward(self, in_types):
type_check.expect(in_types.size() == 2)
x_type, t_type = in_types
type_check.expect(
x_type.dtyp... | mit | Python |
b27b5eaf56f0d5c739d7422f65e2e7e5cde8ed7f | Fix up the email script | pydotorg/pypi,pydotorg/pypi,pydotorg/pypi,pydotorg/pypi | tools/email_renamed_users.py | tools/email_renamed_users.py | import smtplib
import pickle
import sys
import os
from email.mime.text import MIMEText
# Workaround current bug in docutils:
# http://permalink.gmane.org/gmane.text.docutils.devel/6324
import docutils.utils
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path = [root] + sys.path
import config... | import smtplib
import pickle
import sys
import os
from email.mime.text import MIMEText
# Workaround current bug in docutils:
# http://permalink.gmane.org/gmane.text.docutils.devel/6324
import docutils.utils
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path = [root] + sys.path
import config... | bsd-3-clause | Python |
dfb19163b0538508e7f0a820ff017ad9a8041727 | test data improvement | moto-timo/robotframework,joongh/robotframework,Colorfulstan/robotframework,yahman72/robotframework,SivagnanamCiena/robotframework,un33k/robotframework,moto-timo/robotframework,Colorfulstan/robotframework,stasiek/robotframework,snyderr/robotframework,synsun/robotframework,snyderr/robotframework,dkentw/robotframework,woj... | tools/libdoc/test/regular.py | tools/libdoc/test/regular.py | class regular:
"""This is a very regular test library"""
def __init__(self, arg1='hello', arg2='world'):
"""Constructs a new regular test library
See `keyword`
Examples:
| regular | foo | bar |
| regular | | # default values are used |
"""
... | class regular:
"""This is a very regular test library"""
def __init__(self, arg1='hello', arg2='world'):
"""Constructs a new regular test library
Examples:
| regular | foo | bar |
| regular | | # default values are used |
"""
self.arg1 = arg... | apache-2.0 | Python |
ddb87a049adfe0f05f00a33f5cd39ddbd62ebfed | Bump version to dev | pv/mediasnake,pv/mediasnake,pv/mediasnake | mediasnake/__init__.py | mediasnake/__init__.py | __version__ = "0.2.dev"
| __version__ = "0.1"
| bsd-3-clause | Python |
f0a2124d40939d2d42e950ba040200cfd7f5c08d | Set extra fields for Character class | lerrua/merlin-engine | merlin/engine.py | merlin/engine.py | from merlin import configs
from merlin.exceptions import DeadException
SHOW_MESSAGES = getattr(configs, 'SHOW_MESSAGES', False)
class Character(object):
def __init__(self, name, base_attack, base_hp, extra={}):
self.name = name
self.base_attack = base_attack
self.base_hp = base_hp
... | from merlin import configs
from merlin.exceptions import DeadException
SHOW_MESSAGES = getattr(configs, 'SHOW_MESSAGES', False)
class Character(object):
def __init__(self, name, base_attack, base_hp):
self.name = name
self.base_attack = base_attack
self.base_hp = base_hp
self.is_d... | mit | Python |
9f01777e4d985aef6a77208f9839bd257e7be995 | Update station.py | elailai94/EasyTicket | Source-Code/Station/station.py | Source-Code/Station/station.py | #==============================================================================
# EasyTicket
#
# @description: Module for providing methods to work with Station objects
# @author: Elisha Lai
# @version: 1.2 16/04/2015
#==============================================================================
# Station module (sta... | #==============================================================================
# EasyTicket
#
# @description: Module for providing methods to work with Station objects
# @author: Elisha Lai
# @version: 1.2 16/04/2015
#==============================================================================
# Station module (sta... | mit | Python |
eb7281ee406e80870a8fa7f6a9b7a878d8b75cd4 | Rewrite the oa start date script to fix some errors | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | portality/migrate/2966_add_oa_start_date_from_backup/add_oa_start_date_from_backup.py | portality/migrate/2966_add_oa_start_date_from_backup/add_oa_start_date_from_backup.py | import csv
from datetime import datetime
import esprit
from portality.core import es_connection
from portality.models import Journal
from portality.util import ipt_prefix
def reinstate_oa_start(csv_reader):
""" Write the OA start date into Journals from the CSV file containing rows of id,oa_start_date """
... | import csv
from copy import deepcopy
from datetime import datetime
import esprit
from portality.core import es_connection
from portality.models import Journal
from portality.settings import BASE_FILE_PATH
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(... | apache-2.0 | Python |
7dc7fb9772c40fb318aff2047d5411c66c57a8d2 | fix privilege handling in channels with capital letters | anqxyr/jarvis | jarvis/modules/jarvis_irc.py | jarvis/modules/jarvis_irc.py | #!/usr/bin/env python3
"""
Jarvis IRC Wrapper.
This module connects jarvis functions to allow them to be called from irc.
"""
###############################################################################
# Module Imports
###############################################################################
import arrow
... | #!/usr/bin/env python3
"""
Jarvis IRC Wrapper.
This module connects jarvis functions to allow them to be called from irc.
"""
###############################################################################
# Module Imports
###############################################################################
import arrow
... | mit | Python |
0f62dc9ba898db96390658107e9ebe9930f8b90a | Make plugin work in python 3 | EliRibble/mothermayi-isort | mmiisort/main.py | mmiisort/main.py | from isort import SortImports
import mothermayi.colors
import mothermayi.errors
def plugin():
return {
'name' : 'isort',
'pre-commit' : pre_commit,
}
def do_sort(filename):
results = SortImports(filename)
return results.in_lines != results.out_lines
def get_status(had_chan... | from isort import SortImports
import itertools
import mothermayi.colors
import mothermayi.errors
def plugin():
return {
'name' : 'isort',
'pre-commit' : pre_commit,
}
def do_sort(filename):
results = SortImports(filename)
return results.in_lines != results.out_lines
def ge... | mit | Python |
0dc8eafd576acfb0ab133b14e2bd1ebb2157da95 | fix typos in help (#4297) | yugangw-msft/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure-cli,samedder/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure-cli,samedder/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure-cli,samedder/azure-cli,QingChenmsft/azure-cli,yugangw-msft/azure-cli,samedder/azure-cli,yugangw-msft/azure-cli | src/command_modules/azure-cli-container/azure/cli/command_modules/container/_help.py | src/command_modules/azure-cli-container/azure/cli/command_modules/container/_help.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | mit | Python |
e08927d69c0ed3682997d7f123f0fd2aec1d11a8 | Tag new release: 2.8.2 | Floobits/floobits-sublime,Floobits/floobits-sublime | floo/version.py | floo/version.py | PLUGIN_VERSION = '2.8.2'
# The line above is auto-generated by tag_release.py. Do not change it manually.
try:
from .common import shared as G
assert G
except ImportError:
from common import shared as G
G.__VERSION__ = '0.11'
G.__PLUGIN_VERSION__ = PLUGIN_VERSION
| PLUGIN_VERSION = '2.8.1'
# The line above is auto-generated by tag_release.py. Do not change it manually.
try:
from .common import shared as G
assert G
except ImportError:
from common import shared as G
G.__VERSION__ = '0.11'
G.__PLUGIN_VERSION__ = PLUGIN_VERSION
| apache-2.0 | Python |
56199ec6848959226422cc8d6f91924e7030c238 | Use newer protocol version. | Floobits/floobits-sublime,Floobits/floobits-sublime | floo/version.py | floo/version.py | PLUGIN_VERSION = '2.5.3'
# The line above is auto-generated by tag_release.py. Do not change it manually.
try:
from .common import shared as G
assert G
except ImportError:
from common import shared as G
G.__VERSION__ = '0.11'
G.__PLUGIN_VERSION__ = PLUGIN_VERSION
| PLUGIN_VERSION = '2.5.3'
# The line above is auto-generated by tag_release.py. Do not change it manually.
try:
from .common import shared as G
assert G
except ImportError:
from common import shared as G
G.__VERSION__ = '0.03'
G.__PLUGIN_VERSION__ = PLUGIN_VERSION
| apache-2.0 | Python |
4197a491224eea724e5334abc4a7dbbf23425c1b | Switch off robots handling in PyPI example to keep it working | python-mechanize/mechanize,python-mechanize/mechanize | examples/pypi.py | examples/pypi.py | #!/usr/bin/env python
# Search PyPI, the Python Package Index, and retrieve latest mechanize
# tarball.
# This is just to demonstrate mechanize: You should use EasyInstall to
# do this, not this silly script.
import sys, os, re
import mechanize
b = mechanize.Browser(
# mechanize's XHTML support needs work, so ... | #!/usr/bin/env python
# Search PyPI, the Python Package Index, and retrieve latest mechanize
# tarball.
# This is just to demonstrate mechanize: You should use EasyInstall to
# do this, not this silly script.
import sys, os, re
import mechanize
b = mechanize.Browser(
# mechanize's XHTML support needs work, so ... | bsd-3-clause | Python |
014c8ca68b196c78b9044b194b762cdb3dfe6c78 | Add comment description of methods for gitlab hook | pipex/gitbot,pipex/gitbot,pipex/gitbot | app/hooks/views.py | app/hooks/views.py | from __future__ import absolute_import
from __future__ import unicode_literals
from app import app, webhooks
@webhooks.hook(
app.config.get('GITLAB_HOOK','/hooks/gitlab'),
handler='gitlab')
class Gitlab:
def issue(self, data):
# if the repository belongs to a group check if a channel with the same... | from __future__ import absolute_import
from __future__ import unicode_literals
from app import app, webhooks
@webhooks.hook(
app.config.get('GITLAB_HOOK','/hooks/gitlab'),
handler='gitlab')
class Gitlab:
def issue(self, data):
pass
def push(self, data):
pass
def tag_push(self, da... | apache-2.0 | Python |
b3029282329c6e7f36fb65ffaef30b7558e0e06f | Make source and sink more alike. | ajdavis/asyncio,1st1/asyncio,vxgmichel/asyncio,fallen/asyncio,jashandeep-sohi/asyncio,Martiusweb/asyncio,manipopopo/asyncio,manipopopo/asyncio,ajdavis/asyncio,Martiusweb/asyncio,haypo/trollius,gsb-eng/asyncio,vxgmichel/asyncio,gvanrossum/asyncio,gvanrossum/asyncio,fallen/asyncio,vxgmichel/asyncio,haypo/trollius,gsb-eng... | examples/sink.py | examples/sink.py | """Test service that accepts connections and reads all data off them."""
import sys
from tulip import *
server = None
def dprint(*args):
print('sink:', *args, file=sys.stderr)
class Service(Protocol):
def connection_made(self, tr):
dprint('connection from', tr.get_extra_info('socket').getpeername(... | """Test service that accepts connections and reads all data off them."""
import sys
from tulip import *
server = None
def dprint(*args):
print('sink:', *args, file=sys.stderr)
class Service(Protocol):
def connection_made(self, tr):
dprint('connection from', tr.get_extra_info('socket').getpeername(... | apache-2.0 | Python |
6ecada90e944ee976197e0ee79baf1d711a20803 | Add honeypot field to feedback form | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | cla_public/apps/base/forms.py | cla_public/apps/base/forms.py | # -*- coding: utf-8 -*-
"Base forms"
from flask_wtf import Form
from wtforms import StringField, TextAreaField
from cla_public.apps.base.fields import MultiRadioField
from cla_public.apps.base.constants import FEEL_ABOUT_SERVICE, \
HELP_FILLING_IN_FORM
from cla_public.apps.checker.honeypot import Honeypot
class... | # -*- coding: utf-8 -*-
"Base forms"
from flask_wtf import Form
from wtforms import StringField, TextAreaField
from cla_public.apps.base.fields import MultiRadioField
from cla_public.apps.base.constants import FEEL_ABOUT_SERVICE, \
HELP_FILLING_IN_FORM
class FeedbackForm(Form):
difficulty = TextAreaField(u'D... | mit | Python |
13110cb0f14b8f13d726389c753cca22b15960e8 | Update product_supplierinfo.py | Daniel-CA/odoomrp-wip-public,alhashash/odoomrp-wip,odoomrp/odoomrp-wip,odoocn/odoomrp-wip,Antiun/odoomrp-wip,esthermm/odoomrp-wip,sergiocorato/odoomrp-wip,Endika/odoomrp-wip,jorsea/odoomrp-wip,factorlibre/odoomrp-wip,InakiZabala/odoomrp-wip,diagramsoftware/odoomrp-wip,agaldona/odoomrp-wip-1,diagramsoftware/odoomrp-wip,... | product_supplierinfo_for_customer/models/product_supplierinfo.py | product_supplierinfo_for_customer/models/product_supplierinfo.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the... | # -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the... | agpl-3.0 | Python |
bf5d0a9700382835a0e543622f327431b752f539 | Update P8_coinFlip.py added docstring and wrapped in main() function | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | pythontutorials/books/AutomateTheBoringStuff/Ch10/P8_coinFlip.py | pythontutorials/books/AutomateTheBoringStuff/Ch10/P8_coinFlip.py | """Coin flip
This program simulates flipping a coin 1000 times and prints the number
of times it landed on heads.
"""
def main():
import random
heads = 0
for i in range(1, 1001):
if random.randint(0, 1) == 1:
heads += 1
if i == 500:
print("Halfway done!")
print... | # This program simulates flipping a coin 1000 times
import random
heads = 0
for i in range(1, 1001):
if random.randint(0, 1) == 1:
heads += 1
if i == 500:
print("Halfway done!")
print("Heads came up " + str(heads) + " times.")
| mit | Python |
05b7748713187883eb31919b78986b69b0590667 | add coverage | mljar/mljar-api-python | tests/run.py | tests/run.py | '''
MLJAR unit tests.
'''
import os
import unittest
from project_client_test import ProjectClientTest
#from dataset_client_test import DatasetClientTest
#from experiment_client_test import ExperimentClientTest
#from result_client_test import ResultClientTest
#from mljar_test import MljarTest
if __name__ == '__mai... | '''
MLJAR unit tests.
'''
import os
import unittest
from project_client_test import ProjectClientTest
from dataset_client_test import DatasetClientTest
from experiment_client_test import ExperimentClientTest
from result_client_test import ResultClientTest
from mljar_test import MljarTest
if __name__ == '__main__'... | apache-2.0 | Python |
29256e658b975eadfaea64a2dc4427849204e6b2 | fix transport tests being affected by env settings | sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary | testsuite.py | testsuite.py | #!/usr/bin/python
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | #!/usr/bin/python
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 | Python |
b297ecd987e74a33a5152bc9546f14fdde4bdca2 | Edit Order admin | ballpor98/TheDarkCompany,ballpor98/TheDarkCompany,ballpor98/TheDarkCompany | gamingSpot/shop/admin.py | gamingSpot/shop/admin.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import *
# Register your models here.
'''class ImageInline(admin.StackedInline):
model = Image
extra = 1'''
class ProductAdmin(admin.ModelAdmin):
list_display = ('name','brand','price','lates_upd... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import *
# Register your models here.
'''class ImageInline(admin.StackedInline):
model = Image
extra = 1'''
class ProductAdmin(admin.ModelAdmin):
list_display = ('name','brand','price','lates_upd... | apache-2.0 | Python |
bd353f9145dfe75657d4bad24b667d864190f397 | bump to 0.4.5 | tsuru/tsuru-unit-agent | tsuru_unit_agent/__init__.py | tsuru_unit_agent/__init__.py | __version__ = "0.4.5"
| __version__ = "0.4.4"
| bsd-3-clause | Python |
f35c32123ce4f1b80e6654163075f40a2660b562 | Bump SDL2 version | mfichman/winbrew | formula/sdl2.py | formula/sdl2.py | import winbrew
import os
import glob
class Sdl2(winbrew.Formula):
url = 'http://libsdl.org/release/SDL2-2.0.3.zip'
homepage = 'http://libsdl.org'
sha1 = '9283f1ce25b8f3155b6960b214cb6a706c285e27'
build_deps = ()
deps = ()
def directx(self):
"""
Find the DirectX SDK and set the ... | import winbrew
import os
import glob
class Sdl2(winbrew.Formula):
url = 'http://libsdl.org/release/SDL2-2.0.1.zip'
homepage = 'http://libsdl.org'
sha1 = '9283f1ce25b8f3155b6960b214cb6a706c285e27'
build_deps = ()
deps = ()
def directx(self):
"""
Find the DirectX SDK and set the ... | mit | Python |
bba4a2f22306e905951379efe74806f164fa1327 | implement dummy post create view | byteweaver/django-forums,byteweaver/django-forums,ckcnik/django-forums,ckcnik/django-forums | forums/views.py | forums/views.py | from django.views.generic import ListView, DetailView, FormView
from forms import TopicCreateForm, PostCreateForm
from models import Category, Topic, Forum
class CategoryListView(ListView):
model = Category
class ForumDetailView(DetailView):
model = Forum
class TopicDetailView(DetailView):
model = Topi... | from django.views.generic import ListView, DetailView, FormView
from forms import TopicCreateForm
from models import Category, Topic, Forum
class CategoryListView(ListView):
model = Category
class ForumDetailView(DetailView):
model = Forum
class TopicDetailView(DetailView):
model = Topic
class TopicCr... | bsd-3-clause | Python |
1fc0a9b6a5e9be2530058bd8f704ccb2eba2c758 | Change Auto Correct Message Style | iGene/igene_bot,aver803bath5/igene_bot | models/google.py | models/google.py | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import logging
import re
import requests
import urllib.parse
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def google(bot, update):
search = update.message.text
s... | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import logging
import re
import requests
import urllib.parse
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def google(bot, update):
search = update.message.text
s... | mit | Python |
4f69e2cc8cec816b9c75ba8a58ee801870ee7bd0 | delete print | it-projects-llc/misc-addons,it-projects-llc/misc-addons,it-projects-llc/misc-addons | website_redirect/website_redirect_models.py | website_redirect/website_redirect_models.py | from openerp import api, models, fields, SUPERUSER_ID
from openerp.http import request
import fnmatch
import werkzeug.utils
class website_redirect(models.Model):
_name = 'website.redirect'
_order = 'sequence,id'
name = fields.Char('Name')
active = fields.Boolean('Active', default=True)
sequence =... | from openerp import api, models, fields, SUPERUSER_ID
from openerp.http import request
import fnmatch
import werkzeug.utils
class website_redirect(models.Model):
_name = 'website.redirect'
_order = 'sequence,id'
name = fields.Char('Name')
active = fields.Boolean('Active', default=True)
sequence =... | mit | Python |
09081e9adb4f6a2338a2b7c8812fd816079a4296 | add delete_all() ToDoItem method to delete all items in a given list | davidnjakai/bc-8-todo-console-application | todo_item.py | todo_item.py | from database import conn2, c2
class ToDoItem(object):
"""docstring for ToDoItem"""
def __init__(self, content = '1st item', complete = 0):
self.content = content
self.complete = complete
def save_item(self, listname):
SQL = "INSERT INTO todoitem (CONTENT, COMPLETE, LISTNAME) VALUES ('{0}', '{1}', '{2}')"\
... | from database import conn2, c2
class ToDoItem(object):
"""docstring for ToDoItem"""
def __init__(self, content = '1st item', complete = 0):
self.content = content
self.complete = complete
def save_item(self, listname):
SQL = "INSERT INTO todoitem (CONTENT, COMPLETE, LISTNAME) VALUES ('{0}', '{1}', '{2}')"
... | mit | Python |
66bc76acf8ffaaf5f6abf8cdcf018f1f3f2d07eb | add delete_list() method in ToDoList to delete records from database | davidnjakai/bc-8-todo-console-application | todo_list.py | todo_list.py | import todo_item
import sqlite3
class ToDoList(object):
def __init__(self, name, description, todo_items):
if type(name) != type(''):
self.name = 'Enter valid name'
else:
self.name = name
if type(description) != type(''):
self.description = 'Enter valid description'
else:
self.description = descr... | import todo_item
import sqlite3
class ToDoList(object):
def __init__(self, name, description, todo_items):
if type(name) != type(''):
self.name = 'Enter valid name'
else:
self.name = name
if type(description) != type(''):
self.description = 'Enter valid description'
else:
self.description = descr... | mit | Python |
e5de8dc7e964d6938f5ff352bb1b524fe5f7ce8d | Fix calling npm/bower | getslash/mailboxer,vmalloc/mailboxer,vmalloc/mailboxer,vmalloc/mailboxer,getslash/mailboxer,getslash/mailboxer | _lib/frontend.py | _lib/frontend.py | import os
import subprocess
from contextlib import contextmanager
import logbook
import click
from .bootstrapping import from_env, from_project_root
_logger = logbook.Logger(__name__)
@click.group()
def frontend():
pass
@frontend.command()
@click.option("--watch", is_flag=True)
def build(watch):
_bootstr... | import os
import subprocess
from contextlib import contextmanager
import logbook
import click
from .bootstrapping import from_env, from_project_root
_logger = logbook.Logger(__name__)
@click.group()
def frontend():
pass
@frontend.command()
@click.option("--watch", is_flag=True)
def build(watch):
_bootstr... | mit | Python |
7750b900b6ab6f136aee64fb806c95b0bfef1d8d | set Metwit base url to api.metwit.com | metwit/metwit-python | metwit/metwit.py | metwit/metwit.py | from .rest import Resource, RestApi
class Metwit(RestApi):
base_url = "https://api.metwit.com/"
token_url = 'https://api.metwit.com/token/'
dialog_url = "https://metwit.com/oauth/authorize/"
weather = Resource('/v2/weather/')
metags = Resource('/v2/metags/')
users = Resource('/v2/users/')
| from .rest import Resource, RestApi
class Metwit(RestApi):
#base_url = "https://api.metwit.com/"
#token_url = 'https://api.metwit.com/token/'
dialog_url = "https://metwit.com/oauth/authorize/"
base_url = "http://127.0.0.1:8000/"
token_url = 'http://127.0.0.1:8000/token/'
weather = Resource('/... | bsd-3-clause | Python |
1f00dd47cc3490e7da68180258c365bf9b8583ba | Bump to version 0.42.5 | reubano/tabutils,reubano/tabutils,reubano/meza,reubano/tabutils,reubano/meza,reubano/meza | meza/__init__.py | meza/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza
~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.
DEF... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza
~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.
DEF... | mit | Python |
fee5beb59bfb2a68ba1409e7dfb3cad1521ca486 | Add count employees | DataViva/dataviva-api,jdmmiranda307/dataviva-api,daniel1409/dataviva-api | app/models/rais.py | app/models/rais.py | from sqlalchemy import Column, Integer, String, Numeric, func
from app import db
class Rais(db.Model):
__tablename__ = 'rais'
ocupation = Column(String(6), primary_key=True)
cnae = Column(String(5), primary_key=True)
cnae_section = Column(String(1), primary_key... | from sqlalchemy import Column, Integer, String, Numeric, func
from app import db
class Rais(db.Model):
__tablename__ = 'rais'
ocupation = Column(String(6), primary_key=True)
cnae = Column(String(5), primary_key=True)
cnae_section = Column(String(1), primary_key... | mit | Python |
0eb8c60c647c76ad244073cabc66883000c4faa2 | print sql to debug | YFFY/Eredar | ext/databaser.py | ext/databaser.py | #! /usr/bin/env python
# --*-- coding:utf-8 --*--
import MySQLdb
from ext.util import *
from config.setting import *
class Dber(object):
def __init__(self):
self.host = database.get('host')
self.port = database.get('port')
self.user = database.get('user')
self.password = database... | #! /usr/bin/env python
# --*-- coding:utf-8 --*--
import MySQLdb
from ext.util import *
from config.setting import *
class Dber(object):
def __init__(self):
self.host = database.get('host')
self.port = database.get('port')
self.user = database.get('user')
self.password = database... | apache-2.0 | Python |
45ebf89018512f93592083cf0cf0413d4f8c6d4a | Add blogger authentication | jamalmoir/pyblogit | pyblogit/api_interface.py | pyblogit/api_interface.py | """
pyblogit.api_interface
~~~~~~~~~~~~~~~~~~~~~~
This modules acts as an interface between pyblogit and various
blogging platform apis.
"""
import oauth2client.client
import oauth2client.file
import httplib2
class BloggerInterface(object):
"""Connects to blogger api and authorises client."""
def __init__(s... | """
pyblogit.api_interface
~~~~~~~~~~~~~~~~~~~~~~
This modules acts as an interface between pyblogit and various
blogging platform apis.
"""
import gdata.gauth
import gdata.blogger.client
class BloggerInterface(object):
def __init__(self):
self._CLIENT_ID = client_id
self._CLIENT_SECRET = client... | mit | Python |
afd7687c1140612527f0846a7225dd6adc669c2e | update io plugin interface | pyexcel/pyexcel-chart,pyexcel/pyexcel-chart | pyexcel_chart/__init__.py | pyexcel_chart/__init__.py | """
pyexcel_chart
~~~~~~~~~~~~~~~~~~~
chart drawing plugin for pyexcel
:copyright: (c) 2016-2017 by Onni Software Ltd.
:license: New BSD License, see LICENSE for further details
"""
from pyexcel.internal.common import PyexcelPluginList
PyexcelPluginList(__name__).add_a_renderer(
submodule='c... | """
pyexcel_chart
~~~~~~~~~~~~~~~~~~~
chart drawing plugin for pyexcel
:copyright: (c) 2016-2017 by Onni Software Ltd.
:license: New BSD License, see LICENSE for further details
"""
from pyexcel.internal.common import PyexcelPluginList
__pyexcel_plugins__ = PyexcelPluginList(__name__).add_a_rend... | bsd-3-clause | Python |
7d41495562185eebc72ab6eb05a0f27fd527d70f | Bump version | piotrjakimiak/cmsplugin-text-ng | cmsplugin_text_ng/__init__.py | cmsplugin_text_ng/__init__.py | __version__ = '0.7'
default_app_config = 'cmsplugin_text_ng.apps.CmsPluginTextNgConfig'
| __version__ = '0.6'
default_app_config = 'cmsplugin_text_ng.apps.CmsPluginTextNgConfig'
| bsd-3-clause | Python |
4d8a51f429b8d148444e69ecaf8db7c45a1a3bad | allow text before a line line comment | pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments | pygments/lexers/puppet.py | pygments/lexers/puppet.py | # -*- coding: utf-8 -*-
"""
pygments.lexers.puppet
~~~~~~~~~~~~~~~~~~~~~~
Lexer for the Puppet DSL.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer
from pygments.token import *
__all__ = ['Puppet... | # -*- coding: utf-8 -*-
"""
pygments.lexers.puppet
~~~~~~~~~~~~~~~~~~~~~~
Lexer for the Puppet DSL.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer
from pygments.token import *
__all__ = ['Puppet... | bsd-2-clause | Python |
7468c05ad1a231c36f831a82e02c06804626f827 | update version | vparitskiy/data-importer,vparitskiy/data-importer | data_importer/__init__.py | data_importer/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__doc__ = 'Data Importer'
__version__ = '1.6.2'
__author__ = 'Valder Gallo <valdergallo@gmail.com>'
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
__doc__ = 'Data Importer'
__version__ = '1.4.0'
__author__ = 'Valder Gallo <valdergallo@gmail.com>'
| bsd-2-clause | Python |
aca53b30f310aac506ce2e17cfd5f876f9f186b6 | Add crontab decorator | gaujin/tornado-crontab | tornado_crontab/_crontab.py | tornado_crontab/_crontab.py | import functools
import math
from crontab import CronTab
from tornado.ioloop import PeriodicCallback
class CronTabCallback(PeriodicCallback):
def __init__(self, callback, schedule, io_loop=None):
self.__crontab = CronTab(schedule)
super(CronTabCallback, self).__init__(
callback, ... | import math
from crontab import CronTab
from tornado.ioloop import PeriodicCallback
class CronTabCallback(PeriodicCallback):
def __init__(self, callback, crontab, io_loop=None):
self.__crontab = CronTab(crontab)
super(CronTabCallback, self).__init__(
callback, self._calc_callback... | mit | Python |
f68ca64c01fda8c6f7a29d4e287cc816bd1e03d0 | bump in __version__ | datascopeanalytics/django-flux,datascopeanalytics/django-flux | flux/__init__.py | flux/__init__.py | __version__ = "0.1.3"
| __version__ = "0.1.2"
| mit | Python |
349565f3b246f94b35c877bfeacc4daa7478e9b4 | Improve urlconf construction (fix bug 690440) | hoosteeno/mozillians,mozilla/mozillians,akarki15/mozillians,fxa90id/mozillians,brian-yang/mozillians,mozilla/mozillians,akatsoulas/mozillians,johngian/mozillians,akarki15/mozillians,ChristineLaMuse/mozillians,safwanrahman/mozillians,justinpotts/mozillians,fxa90id/mozillians,anistark/mozillians,satdav/mozillians,safwanr... | apps/users/urls.py | apps/users/urls.py | from django.conf.urls.defaults import patterns, url
from django.contrib.auth import views as auth_views
from jinjautils import jinja_for_django
from users import forms
from . import views
# So we can use the contrib logic for password resets, etc.
auth_views.render_to_response = jinja_for_django
urlpatterns = pat... | from django.conf.urls.defaults import patterns, url
from django.contrib.auth import views as auth_views
from jinjautils import jinja_for_django
from session_csrf import anonymous_csrf
from users import forms
from . import views
# So we can use the contrib logic for password resets, etc.
auth_views.render_to_respons... | bsd-3-clause | Python |
694bec1a07b1ba63ce4294879a09a2521c3ec122 | Fix user admin | mupi/escolamupi,hacklabr/timtec,virgilio/timtec,mupi/timtec,mupi/tecsaladeaula,AllanNozomu/tecsaladeaula,mupi/tecsaladeaula,AllanNozomu/tecsaladeaula,mupi/tecsaladeaula,mupi/timtec,mupi/escolamupi,AllanNozomu/tecsaladeaula,GustavoVS/timtec,hacklabr/timtec,mupi/timtec,GustavoVS/timtec,virgilio/timtec,hacklabr/timtec,mup... | course/admin.py | course/admin.py | from django.contrib import admin
from django.contrib.admin import ModelAdmin
from django.contrib.auth.admin import UserAdmin
from suit.admin import SortableTabularInline
from models import *
admin.site.register(TimtecUser, UserAdmin)
admin.site.register(Video)
admin.site.register(CourseProfessor)
class LessonInline(... | from django.contrib import admin
from django.contrib.admin import ModelAdmin
from suit.admin import SortableTabularInline
from models import *
admin.site.register(TimtecUser)
admin.site.register(Video)
admin.site.register(CourseProfessor)
class LessonInline(SortableTabularInline):
model = Lesson
sortable = '... | agpl-3.0 | Python |
6bd3d3a1ef972ce830024c9ccdc8c028eb2718e7 | Remove all refrences to imdb in the code | Uname-a/knife_scraper,Uname-a/knife_scraper,Uname-a/knife_scraper | modules/movie.py | modules/movie.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
"""
imdb.py - Willie Movie Information Module
Copyright © 2012, Elad Alfassa, <elad@fedoraproject.org>
Licensed under the Eiffel Forum License 2.
This module relies on imdbapi.com
"""
import json
import web
def movie(willie, trigger):
"""
Returns some information a... | #!/usr/bin/env python
# -*- coding: utf8 -*-
"""
imdb.py - Willie Movie Information Module
Copyright © 2012, Elad Alfassa, <elad@fedoraproject.org>
Licensed under the Eiffel Forum License 2.
This module relies on imdbapi.com
"""
import json
import web
def imdb(willie, trigger):
"""
Returns some information ab... | mit | Python |
76b837fd6d783b9a67740b76af2fd1ec80ea229a | Fix for ddate weekday | Flat/JiyuuBot,Zaexu/JiyuuBot | modules/ddate.py | modules/ddate.py | def ddate(self, msginfo):
import datetime
import calendar
dSeasons = ["Chaos", "Discord", "Confusion", "Beureacracy", "The Aftermath"]
dDays = ["Sweetmorn", "Boomtime", "Pungenday", "Prickle-Prickle", "Setting Orange"]
year = int(datetime.datetime.now().strftime("%Y"))
month = int(datetime.datet... | def ddate(self, msginfo):
import datetime
import calendar
dSeasons = ["Chaos", "Discord", "Confusion", "Beureacracy", "The Aftermath"]
dDays = ["Sweetmorn", "Boomtime", "Pungenday", "Prickle-Prickle", "Setting Orange"]
year = int(datetime.datetime.now().strftime("%Y"))
month = int(datetime.datet... | agpl-3.0 | Python |
151e50e41ab7931cbce108817b21a4aefdffc8b8 | Simplify plugin | ropez/pytest-describe | pytest_describe/plugin.py | pytest_describe/plugin.py | import imp
import sys
import types
import pytest
def trace_function(funcobj, *args, **kwargs):
"""Call a function, and return its locals"""
funclocals = {}
def _tracefunc(frame, event, arg):
if event == 'call':
# Activate local trace for first call only
if frame.f_back.f_l... | import imp
import sys
import types
import pytest
def trace_function(funcobj, *args, **kwargs):
"""Call a function, and return its locals"""
funclocals = {}
def _tracefunc(frame, event, arg):
if event == 'call':
# Activate local trace for first call only
if frame.f_back.f_l... | mit | Python |
b1168c523ed544f16d2de0979a0e427f414dfc54 | add a generic function to print a dictionary | sillyfellow/rosalind | python_village/rosalib.py | python_village/rosalib.py |
def is_integer(s):
try:
int(s)
return True
except ValueError:
return False
def hyopotenuse(a, b):
return (a * a) + (b * b)
def get_input_integers(count):
numbers = raw_input().split()
if len(numbers) != count or (not reduce(lambda x, y: is_integer(x) and y, numbers, True... |
def is_integer(s):
try:
int(s)
return True
except ValueError:
return False
def hyopotenuse(a, b):
return (a * a) + (b * b)
def get_input_integers(count):
numbers = raw_input().split()
if len(numbers) != count or (not reduce(lambda x, y: is_integer(x) and y, numbers, True... | apache-2.0 | Python |
a706a22261af1cdf420eef25ef9b5d5722392226 | Test comment | dariusbakunas/rawdisk | rawdisk/util/rawstruct.py | rawdisk/util/rawstruct.py | """Helper class used as a parent class for most filesystem classes.
"""
import struct
import hexdump
import uuid
class RawStruct(object):
def __init__(self, data = None):
self._data = data
@property
def data(self):
return self._data
@property
def size(self):
return len(s... | import struct
import hexdump
import uuid
class RawStruct(object):
def __init__(self, data = None):
self._data = data
@property
def data(self):
return self._data
@property
def size(self):
return len(self._data)
@data.setter
def data(self, value):
self._dat... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.