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 |
|---|---|---|---|---|---|---|---|---|
e76cd601aa841a58ec74b208a8a06c691fa1ad0b | update version to 0.9.11 | fujimisakari/django-actionlog | django_actionlog/__init__.py | django_actionlog/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.9.11'
| # -*- coding: utf-8 -*-
__version__ = '0.9.10'
| bsd-3-clause | Python |
d7cfbf55253f66daa90165d02b51ad7830cebefe | update version to 0.9.14 | fujimisakari/django-actionlog | django_actionlog/__init__.py | django_actionlog/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.9.14'
| # -*- coding: utf-8 -*-
__version__ = '0.9.13'
| bsd-3-clause | Python |
484fead33139995badac3c48d303c0f5ffe65636 | remove obsolete method get_objs() | potatolondon/djangotoolbox-1-4,kavdev/djangotoolbox,sunils34/djangotoolbox,Knotis/djangotoolbox,brstrat/djangotoolbox | djangotoolbox/auth/models.py | djangotoolbox/auth/models.py | from django.contrib.auth.models import User, Group
from django.db import models
from djangotoolbox.fields import ListField
class UserPermissionList(models.Model):
user = models.ForeignKey(User)
permission_list = ListField(models.CharField(max_length=128))
permission_fk_list = ListField(models.CharFie... | from django.contrib.auth.models import User, Group
from django.db import models
from djangotoolbox.fields import ListField
def get_objs(obj_cls, obj_ids):
objs = set()
if len(obj_ids) > 0:
objs.update(obj_cls .objects.filter(id__in=obj_ids).order_by('name'))
return objs
class UserPermissionList(... | bsd-3-clause | Python |
85ab8524dfd7e7c37734d277a7d4194947df818c | USE template engine in user.py | cardmaster/makeclub,cardmaster/makeclub,cardmaster/makeclub | controlers/user.py | controlers/user.py | '''Copyright(C): Leaf Johnson 2011
This file is part of makeclub.
makeclub is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later versi... | '''Copyright(C): Leaf Johnson 2011
This file is part of makeclub.
makeclub is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later versi... | agpl-3.0 | Python |
0cfa77816620a8dfeed8b965081bb4668fd682ac | Add test to make sure the grouping order is maintained. | mindriot101/bokeh,philippjfr/bokeh,rs2/bokeh,phobson/bokeh,msarahan/bokeh,jakirkham/bokeh,philippjfr/bokeh,dennisobrien/bokeh,msarahan/bokeh,ericmjl/bokeh,philippjfr/bokeh,draperjames/bokeh,quasiben/bokeh,jakirkham/bokeh,Karel-van-de-Plassche/bokeh,draperjames/bokeh,ericmjl/bokeh,draperjames/bokeh,clairetang6/bokeh,phi... | bokeh/charts/builders/tests/test_bar_builder.py | bokeh/charts/builders/tests/test_bar_builder.py | """ This is the Bokeh charts testing interface.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with thi... | """ This is the Bokeh charts testing interface.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with thi... | bsd-3-clause | Python |
89b69b36baa9e84024c05e7b67023a01da48e1ee | bump to 0.4.42 | nickp60/riboSeed,nickp60/riboSeed,nickp60/riboSeed | riboSeed/_version.py | riboSeed/_version.py | __version__ = '0.4.42'
| __version__ = '0.4.41'
| mit | Python |
dee81e58b349a94f8f1f22a9b3605965a0b276a3 | Bump version to 2.0a1-dev. | FinnStutzenstein/OpenSlides,emanuelschuetze/OpenSlides,tsiegleauq/OpenSlides,emanuelschuetze/OpenSlides,OpenSlides/OpenSlides,boehlke/OpenSlides,normanjaeckel/OpenSlides,normanjaeckel/OpenSlides,boehlke/OpenSlides,ostcar/OpenSlides,rolandgeider/OpenSlides,jwinzer/OpenSlides,FinnStutzenstein/OpenSlides,tsiegleauq/OpenSl... | openslides/__init__.py | openslides/__init__.py | # -*- coding: utf-8 -*-
VERSION = (2, 0, 0, 'alpha', 1) # During development it is the next release
RELEASE = False
def get_version(version=None, release=None):
"""
Derives a PEP386-compliant version number from VERSION. Adds '-dev',
if it is not a release commit.
"""
if version is None:
... | # -*- coding: utf-8 -*-
VERSION = (1, 6, 1, 'final', 1) # During development it is the next release
RELEASE = False
def get_version(version=None, release=None):
"""
Derives a PEP386-compliant version number from VERSION. Adds '-dev',
if it is not a release commit.
"""
if version is None:
... | mit | Python |
2206681a89346970b71ca8d0ed1ff60a861b2ff9 | Update pyramid example with longer description | chintak/scikit-image,paalge/scikit-image,keflavich/scikit-image,SamHames/scikit-image,jwiggins/scikit-image,bsipocz/scikit-image,keflavich/scikit-image,rjeli/scikit-image,vighneshbirodkar/scikit-image,SamHames/scikit-image,youprofit/scikit-image,chintak/scikit-image,dpshelio/scikit-image,Midafi/scikit-image,WarrenWecke... | doc/examples/plot_pyramid.py | doc/examples/plot_pyramid.py | """
====================
Build image pyramids
====================
The `build_gauassian_pyramid` function takes an image and yields successive
images shrunk by a constant scale factor. Image pyramids are often used, e.g.,
to implement algorithms for denoising, texture discrimination, and scale-
invariant detection.
""... | """
====================
Build image pyramids
====================
This example shows how to build image pyramids.
"""
import numpy as np
import matplotlib.pyplot as plt
from skimage import data
from skimage import img_as_float
from skimage.transform import build_gaussian_pyramid
image = data.lena()
rows, cols, di... | bsd-3-clause | Python |
960d8119b789304900cd437ac22b6c1c600c6a11 | replace rendered frames counter by FrameLog list in the GroupLog | CaptainDesAstres/Simple-Blender-Render-Manager,CaptainDesAstres/Blender-Render-Manager | TaskList/TaskLog/GroupLog.py | TaskList/TaskLog/GroupLog.py | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage task renderlayer group log'''
import xml.etree.ElementTree as xmlMod
from TaskList.TaskLog.FrameLog import *
class TaskLog:
'''class to manage task renderlayer group log'''
def __init__(self, xml = None,
groupName = None,
preferences = No... | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage task renderlayer group log'''
import xml.etree.ElementTree as xmlMod
from TaskList.TaskLog.FrameLog import *
class TaskLog:
'''class to manage task renderlayer group log'''
def __init__(self, xml = None,
groupName = None,
preferences = No... | mit | Python |
c9ba06abd2a06035f6aefcc0435c22f49bde490b | Fix 404 response in StatusChangedNotificationView, should be Http404 exception | edoburu/django-oscar-docdata,edoburu/django-oscar-docdata | oscar_docdata/views.py | oscar_docdata/views.py | import logging
from django.http import HttpResponseBadRequest, HttpResponseRedirect, HttpResponse, HttpResponseNotFound, Http404
from django.views.generic import View
from oscar.core.loading import get_class
from oscar_docdata import appsettings
from oscar_docdata.facade import Facade
from oscar_docdata.models import D... | import logging
from django.http import HttpResponseBadRequest, HttpResponseRedirect, HttpResponse, HttpResponseNotFound
from django.views.generic import View
from oscar.core.loading import get_class
from oscar_docdata import appsettings
from oscar_docdata.facade import Facade
from oscar_docdata.models import DocdataOrd... | apache-2.0 | Python |
a9bc78ab8b8fea67a7793312452e7354de40221c | use correct support group on stairs | openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro | software/config/terrain/stairs.py | software/config/terrain/stairs.py | import numpy as np
blockName = 'stair'
blockSize = np.array([1.0, 0.28, 0.22]) # meters
blockTiltAngle = 0 # degrees
# F=sloping up forward (+x), B=sloping up backward (-x),
# R=sloping up rightward (-y), L=sloping up leftward (+y)
# last row is closest to robot (robot is on bottom looking up)
# column order is left... | import numpy as np
blockName = 'stair'
blockSize = np.array([1.0, 0.28, 0.22]) # meters
blockTiltAngle = 0 # degrees
# F=sloping up forward (+x), B=sloping up backward (-x),
# R=sloping up rightward (-y), L=sloping up leftward (+y)
# last row is closest to robot (robot is on bottom looking up)
# column order is left... | bsd-3-clause | Python |
88076fd142267b9439989a4ac8c5fc4c00fe07ad | Add new operators | grnet/snf-ganeti,mbakke/ganeti,ganeti-github-testing/ganeti-test-1,leshchevds/ganeti,ganeti-github-testing/ganeti-test-1,bitemyapp/ganeti,mbakke/ganeti,apyrgio/snf-ganeti,grnet/snf-ganeti,onponomarev/ganeti,leshchevds/ganeti,dimara/ganeti,yiannist/ganeti,andir/ganeti,apyrgio/ganeti,andir/ganeti,ganeti/ganeti,yiannist/g... | lib/qlang.py | lib/qlang.py | #
#
# Copyright (C) 2010 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | #
#
# Copyright (C) 2010 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | bsd-2-clause | Python |
5f33fca579809570f8be9592f196fad68c4644de | Remove unnecessary line wrapping | stevelle/rpc-openstack,jacobwagner/rpc-openstack,galstrom21/rpc-openstack,BjoernT/rpc-openstack,jpmontez/rpc-openstack,nrb/rpc-openstack,byronmccollum/rpc-openstack,npawelek/rpc-maas,claco/rpc-openstack,major/rpc-openstack,git-harry/rpc-openstack,rcbops/rpc-openstack,xeregin/rpc-openstack,cfarquhar/rpc-maas,briancurtin... | glance_registry_local_check.py | glance_registry_local_check.py | #!/usr/bin/env python
from maas_common import (status_ok, status_err, metric, get_keystone_client,
get_auth_ref)
from requests import Session
from requests import exceptions as exc
def check(auth_ref):
keystone = get_keystone_client(auth_ref)
tenant_id = keystone.tenant_id
auth_t... | #!/usr/bin/env python
from maas_common import (status_ok, status_err, metric, get_keystone_client,
get_auth_ref)
from requests import Session
from requests import exceptions as exc
def check(auth_ref):
keystone = get_keystone_client(auth_ref)
tenant_id = keystone.tenant_id
auth_t... | apache-2.0 | Python |
cfbbe78d4671490a1df071496369f2b550483dfa | Update afops.py | pegasusict/AMM | lib/afops.py | lib/afops.py | #!/usr/bin/env python3
"""
************************************************************************
** Audiophiles Music Manager VER0.0.0PREALPHA **
** (C)2017 Mattijs Snepvangers pegasus.ict@gmail.com **
** afops.py audiofile operations VER0.0.0PREALPHA **
*... | #!/usr/bin/env python3
"""
************************************************************************
** Audiophiles Music Manager VER0.0.0PREALPHA **
** (C)2017 Mattijs Snepvangers pegasus.ict@gmail.com **
** afops.py audiofile operations VER0.0.0PREALPHA **
*... | mit | Python |
bf8388baaac41988955e60e84b36dad71afb4689 | Add initial solution for leap | CubicComet/exercism-python-solutions | leap/leap.py | leap/leap.py | def is_leap_year(y):
if y % 400 == 0:
return True
elif y % 100 == 0:
return False
elif y % 4 == 0:
return True
else:
return False
| def is_leap_year():
pass
| agpl-3.0 | Python |
4ff80287f7bd0e88c87cba546e03bb39b5dbca8b | Remove TextbookDescriptor from setup. | msegado/edx-platform,prarthitm/edxplatform,kursitet/edx-platform,chand3040/cloud_that,JCBarahona/edX,proversity-org/edx-platform,ahmadio/edx-platform,ubc/edx-platform,dkarakats/edx-platform,torchingloom/edx-platform,antoviaque/edx-platform,analyseuc3m/ANALYSE-v1,Unow/edx-platform,xuxiao19910803/edx,10clouds/edx-platfor... | common/lib/xmodule/setup.py | common/lib/xmodule/setup.py | from setuptools import setup, find_packages
setup(
name="XModule",
version="0.1",
packages=find_packages(exclude=["tests"]),
install_requires=['distribute'],
package_data={
'xmodule': ['js/module/*']
},
requires=[
'capa',
'mitxmako'
],
# See http://guide.pyt... | from setuptools import setup, find_packages
setup(
name="XModule",
version="0.1",
packages=find_packages(exclude=["tests"]),
install_requires=['distribute'],
package_data={
'xmodule': ['js/module/*']
},
requires=[
'capa',
'mitxmako'
],
# See http://guide.pyt... | agpl-3.0 | Python |
21bb746a2aa5c08a3acc3ac335d607992c053093 | Add logging to GitHub module | igboyes/virtool,virtool/virtool,igboyes/virtool,virtool/virtool | virtool/github.py | virtool/github.py | import logging
import virtool.errors
import virtool.http.proxy
logger = logging.getLogger(__name__)
BASE_URL = "https://api.github.com/repos"
HEADERS = {
"Accept": "application/vnd.github.v3+json"
}
def format_release(release):
asset = release["assets"][0]
return {
"id": release["id"],
... | import virtool.errors
import virtool.http.proxy
BASE_URL = "https://api.github.com/repos"
HEADERS = {
"Accept": "application/vnd.github.v3+json"
}
def format_release(release):
asset = release["assets"][0]
return {
"id": release["id"],
"name": release["name"],
"body": release["bo... | mit | Python |
2ad9c50e3613674cb6170b46411d7dba0b1edff9 | add test for params permissions | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | common/tests/test_params.py | common/tests/test_params.py | import os
import threading
import time
import tempfile
import shutil
import stat
import unittest
from common.params import Params, UnknownKeyName
class TestParams(unittest.TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
print("using", self.tmpdir)
self.params = Params(self.tmpdir)
def te... | from common.params import Params, UnknownKeyName
import threading
import time
import tempfile
import shutil
import unittest
class TestParams(unittest.TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
print("using", self.tmpdir)
self.params = Params(self.tmpdir)
def tearDown(self):
shut... | mit | Python |
3c67bbf2e58ff1f64be739e52ba7e9d6dbae68d7 | fix relative import | mir-dataset-loaders/mirdata | mir_datasets/load/utils.py | mir_datasets/load/utils.py | from collections import namedtuple
import os
from .. import MIR_DATASETS_DIR
def abs_path(rel_path, data_home):
if data_home is None:
return os.path.join(MIR_DATASETS_DIR, rel_path)
else:
return os.path.join(data_home, rel_path)
F0Data = namedtuple(
'F0Data',
['times', 'frequencies'... | from collections import namedtuple
import os
from . import MIR_DATASETS_DIR
def abs_path(rel_path, data_home):
if data_home is None:
return os.path.join(MIR_DATASETS_DIR, rel_path)
else:
return os.path.join(data_home, rel_path)
F0Data = namedtuple(
'F0Data',
['times', 'frequencies',... | bsd-3-clause | Python |
7610448c6d8367b29164fad71ba71a8dbc5735ca | Bump version | thombashi/SimpleSQLite,thombashi/SimpleSQLite | simplesqlite/__version__.py | simplesqlite/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.33.3"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.33.2"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
b36e84a0121949cb54a6c81d4ba5b05dc6aabebb | Fix lint warning. | nvdv/vprof,nvdv/vprof,nvdv/vprof | vprof/__main__.py | vprof/__main__.py | """Main module for visual profiler."""
import argparse
import os
import sys
from collections import OrderedDict
from vprof import code_heatmap
from vprof import memory_profile
from vprof import runtime_profile
from vprof import stats_server
_PROGRAN_NAME = 'vprof'
_MODULE_DESC = 'Python visual profiler'
_HOST = 'loca... | """Main module for visual profiler."""
import argparse
import os
import sys
from collections import OrderedDict
from vprof import code_heatmap
from vprof import memory_profile
from vprof import runtime_profile
from vprof import stats_server
_PROGRAN_NAME = 'vprof'
_MODULE_DESC = 'Python visual profiler'
_HOST = 'loca... | bsd-2-clause | Python |
1454b42049e94db896aab99e2dd1b286ca2d04e3 | Add options for add date and tags. | jhh/netscape-bookmark-converter | convert-bookmarks.py | convert-bookmarks.py | #!/usr/bin/env python
#
# Convert browser bookmark export (NETSCAPE-Bookmark-file-1 format) to json
#
from argparse import ArgumentParser
from bs4 import BeautifulSoup
from datetime import datetime, timezone
import json
parser = ArgumentParser(description='Convert Netscape bookmarks to JSON')
parser.add_argument(dest... | #!/usr/bin/env python
#
# Convert browser bookmark export (NETSCAPE-Bookmark-file-1 format) to json
#
from argparse import ArgumentParser
from bs4 import BeautifulSoup
from datetime import datetime, timezone
import json
parser = ArgumentParser(description='Convert Netscape bookmarks to JSON')
parser.add_argument(dest... | mit | Python |
27e6bd2d966b7be6ebee68169a55ff2f7ebb1af7 | Improve example script | elastic-coders/py-graphqlparser | examples/visitor_example.py | examples/visitor_example.py | import sys
from graphql_parser import GraphQLAstVisitor
from graphql_parser import GraphQLParser
class Visitor(GraphQLAstVisitor.GraphQLAstVisitor):
def __init__(self):
self.level = 0
def visit_document(self, node):
print('document start')
return 1
def visit_operation_definitio... | import sys
from graphql_parser import GraphQLAstVisitor
from graphql_parser import GraphQLParser
class Visitor(GraphQLAstVisitor.GraphQLAstVisitor):
def __init__(self):
self.level = 0
def visit_document(self, node):
print('document start')
return 1
def visit_operation_definitio... | bsd-3-clause | Python |
d55a4b101c25f1a08649fe40b4b12dbf2acaa58f | check for the field, rather than the DEBUG setting | pculture/mirocommunity,pculture/mirocommunity,natea/Miro-Community,natea/Miro-Community,pculture/mirocommunity,pculture/mirocommunity | localtv/comments/forms.py | localtv/comments/forms.py | from django import forms
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.contrib.comments import forms as comment_forms
from recaptcha_django import ReCaptchaField
try:
from tinymce.widgets import TinyMCE as CommentWidget
except ImportError:
CommentWidget ... | from django import forms
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.contrib.comments import forms as comment_forms
from recaptcha_django import ReCaptchaField
try:
from tinymce.widgets import TinyMCE as CommentWidget
except ImportError:
CommentWidget ... | agpl-3.0 | Python |
b564100ef19c46c236974b66e5b0d92bd4badf59 | Update of dd_board_logger.py: changes in init parameters, revamp of the methods. | jolibrain/dd_board | dd_board_logger.py | dd_board_logger.py | # -*- coding:utf-8 -*-
import json, os
from shutil import rmtree
from datetime import datetime
from tensorboard_logger import configure as tbl_configure, log_value as tbl_log_value
class DDBoard:
"""Version 0.3
Converts logs to "TensorBoard compatible" data.
- obs = data flow that has to be analyzed
- json_file = ... | # -*- coding:utf-8 -*-
import json, os
from shutil import rmtree
from datetime import datetime
from tensorboard_logger import configure as tbl_configure, log_value as tbl_log_value
class DDBoard:
"""Version 0.3
Converts logs to "TensorBoard compatible" data.
- obs = data flow that has to be analyzed
- json_file = ... | apache-2.0 | Python |
d9c90889d13d63e1d903227e3f60ab10e8d88e52 | Create IdentityModule | HazyResearch/metal,HazyResearch/metal | metal/modules/identity_module.py | metal/modules/identity_module.py | import torch
import torch.nn as nn
from metal.modules.base_module import InputModule
class IdentityModule(InputModule):
"""A default identity input layer that simply passes the input through."""
def __init__(self, output_dim):
super().__init__()
self.output_dim = output_dim
def get_out... | import torch
import torch.nn as nn
from metal.modules.base_module import InputModule
class IdentityModule(InputModule):
"""A generic nn.Module class with a method for getting the output dim."""
def __init__(self):
super().__init__()
def get_output_dim(self):
raise NotImplementedError(... | apache-2.0 | Python |
1894003f8a704f516a1f246fd463f78a1bcc0bf6 | bump version to 0.16.2 | MongoEngine/mongoengine | mongoengine/__init__.py | mongoengine/__init__.py | # Import submodules so that we can expose their __all__
from mongoengine import connection
from mongoengine import document
from mongoengine import errors
from mongoengine import fields
from mongoengine import queryset
from mongoengine import signals
# Import everything from each submodule so that it can be accessed v... | # Import submodules so that we can expose their __all__
from mongoengine import connection
from mongoengine import document
from mongoengine import errors
from mongoengine import fields
from mongoengine import queryset
from mongoengine import signals
# Import everything from each submodule so that it can be accessed v... | mit | Python |
f50cc909104d8e4d3aeb913a30fd3e65cd21aceb | fix invocation of ScannerTestRegex (the constructor of Scanner requires the complete `config` object) | magne4000/festival,magne4000/festival,magne4000/festival | festival.py | festival.py | #!/usr/bin/env python3
import argparse
from init import init, check
def handle_args():
parser = argparse.ArgumentParser(description='Festival')
parser.add_argument('--with-scanner', action='store_true', help='Start the scanner process with the webserver')
parser.add_argument('-c', '--config', help='Path ... | #!/usr/bin/env python3
import argparse
from init import init, check
def handle_args():
parser = argparse.ArgumentParser(description='Festival')
parser.add_argument('--with-scanner', action='store_true', help='Start the scanner process with the webserver')
parser.add_argument('-c', '--config', help='Path ... | mit | Python |
1573e5db272a716e756e4b40304ddc8310d02df8 | Fix result id | SnowyCoder/brainfuckify | brainfuckify/bot.py | brainfuckify/bot.py | import telegram
import os
import logging
from telegram import *
from telegram.ext import *
from core import encode
URL = 'https://brainfuckify.herokuapp.com/'
TOKEN = os.environ['TOKEN']
PORT = int(os.environ['PORT'])
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.IN... | import telegram
import os
import logging
from telegram import *
from telegram.ext import *
from core import encode
URL = 'https://brainfuckify.herokuapp.com/'
TOKEN = os.environ['TOKEN']
PORT = int(os.environ['PORT'])
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.IN... | mit | Python |
a46cf5ed1cefc49e8c01429364ee3d156b17e9d3 | refactor experiments to take arguments from command line | mkoledoye/mds_experiments,mkoledoye/mds_examples | experiments/missing_data.py | experiments/missing_data.py | from functools import partial, wraps
import numpy as np
from matplotlib import pyplot as plt
from core.config import Config
from utils import generate_static_nodes
from experiments import evaluation
LABELS = ['MDS-A, no missing data', 'modified MDS-A, missing inter-tag data']
def runexperiment(func):
@wraps(fun... | from functools import partial, wraps
import numpy as np
from matplotlib import pyplot as plt
from core.config import Config
from utils import generate_static_nodes
from experiments import evaluation
ALGORITHMS = ['MDS-A, no missing data', 'modified MDS-A, missing inter-tag data']
def runexperiment(func):
@wraps... | mit | Python |
ab24bda537f3b1303d2935b505627127148f60b3 | Update 'pinkparts' to find image in page | jodal/comics,datagutten/comics,datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics | comics/comics/pinkparts.py | comics/comics/pinkparts.py | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Pink Parts'
language = 'en'
url = 'http://pinkpartscomic.com/'
start_date = '2010-02-01'
rights = 'Katherine Skipper'
class Crawler(CrawlerBase... | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Pink Parts'
language = 'en'
url = 'http://pinkpartscomic.com/'
start_date = '2010-02-01'
rights = 'Katherine Skipper'
class Crawler(CrawlerBase... | agpl-3.0 | Python |
c189e3c5d0231d36b1913865ec31e8ec3d89844a | Convert pywintypes.error into WindowsError. | shaurz/devo | fileutil.py | fileutil.py | import sys, os, shutil
if sys.platform == "win32":
# os.rename is broken on windows
import win32file, pywintypes
def rename(old, new):
try:
win32file.MoveFileEx(old, new, win32file.MOVEFILE_REPLACE_EXISTING)
except pywintypes.error, e:
raise WindowsError(*e.args)
els... | import sys, os, shutil
if sys.platform == "win32":
# os.rename is broken on windows
import win32file
def rename(old, new):
win32file.MoveFileEx(old, new, win32file.MOVEFILE_REPLACE_EXISTING)
else:
rename = os.rename
def atomic_write_file(path, data):
temp = os.path.join(os.path.dirname(pat... | mit | Python |
7fc2463e232ed40bb79134fd8d6fc4c32837b55f | prepare 0.2.0 | tomster/briefkasten,tomster/briefkasten,tomster/briefkasten,tomster/briefkasten | watchdog/setup.py | watchdog/setup.py | from setuptools import setup
version = '0.2.0'
setup(
name='briefkasten_watchdog',
version=version,
description='Perform functional testing of a Briefkasten instance',
long_description="""
Part of the `ZeitOnline Briefkasten <https://github.com/ZeitOnline/briefkasten>`_ project,
this a... | from setuptools import setup
version = '0.2.0.dev'
setup(
name='briefkasten_watchdog',
version=version,
description='Perform functional testing of a Briefkasten instance',
long_description="""
Part of the `ZeitOnline Briefkasten <https://github.com/ZeitOnline/briefkasten>`_ project,
th... | bsd-3-clause | Python |
2dbdcfb7bc9507420f7f48f5cd75199078fefa59 | Remove unused match variable | martinb3/helpbot,ryandub/helpbot,ryandub/helpbot,martinb3/helpbot | lib/utils.py | lib/utils.py | import arrow
import json
def _extract_id(name, items):
for item in items:
if item['name'] == name:
return item['id']
return None
def format_helps(helps):
text = []
for halp in helps:
halp = json.loads(halp)
channel = halp.keys()[0]
user = halp[channel]['us... | import arrow
import json
def _extract_id(name, items):
for item in items:
if item['name'] == name:
return item['id']
return None
def format_helps(helps):
text = []
for halp in helps:
halp = json.loads(halp)
channel = halp.keys()[0]
user = halp[channel]['us... | mit | Python |
82daed35cb328590e710800672fc3524c226d166 | Fix detect Git-LFS in tests | watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder | feder/letters/tests/base.py | feder/letters/tests/base.py | import email
from os.path import dirname, join
from django.utils import six
from django_mailbox.models import Mailbox
from feder.letters.signals import MessageParser
class MessageMixin(object):
def setUp(self):
self.mailbox = Mailbox.objects.create(from_email='from@example.com')
super(MessageMix... | import email
from os.path import dirname, join
from django.utils import six
from django_mailbox.models import Mailbox
from feder.letters.signals import MessageParser
class MessageMixin(object):
def setUp(self):
self.mailbox = Mailbox.objects.create(from_email='from@example.com')
super(MessageMix... | mit | Python |
72d0b6704de3aaaf1f260799c4f90fdd331600a6 | use reconfigured switch in autofire | missionpinball/mpf,missionpinball/mpf | mpf/devices/autofire.py | mpf/devices/autofire.py | """ Contains the base class for autofire coil devices."""
from mpf.devices.switch import ReconfigureSwitch
from mpf.core.system_wide_device import SystemWideDevice
class AutofireCoil(SystemWideDevice):
"""Base class for coils in the pinball machine which should fire
automatically based on switch activity usi... | """ Contains the base class for autofire coil devices."""
from mpf.core.system_wide_device import SystemWideDevice
class AutofireCoil(SystemWideDevice):
"""Base class for coils in the pinball machine which should fire
automatically based on switch activity using hardware switch rules.
autofire_coils are ... | mit | Python |
13efcb5b717bfc67af6df84f48c32e36799212f3 | Fix reference | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | corehq/util/mixin.py | corehq/util/mixin.py | import uuid
class UUIDGeneratorException(Exception):
pass
class UUIDGeneratorMixin(object):
"""
Automatically generates uuids on __init__ if not generated yet.
To use: Add this mixin to your model as the left-most class being inherited from
and list all field names in UUIDS_TO_GENERATE to gener... | import uuid
class UUIDGeneratorException(Exception):
pass
class UUIDGeneratorMixin(object):
"""
Automatically generates uuids on __init__ if not generated yet.
To use: Add this mixin to your model as the left-most class being inherited from
and list all field names in UUIDS_TO_GENERATE to gener... | bsd-3-clause | Python |
9c7c7a968bdb9099635e586bc7a1802ebe62ba50 | remove tsp.solver.TSPPath | Larhard/tsp | tsp/solver.py | tsp/solver.py | # Copyright (c) 2015, Bartlomiej Puget <larhard@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this... | # Copyright (c) 2015, Bartlomiej Puget <larhard@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this... | bsd-3-clause | Python |
0a124e7a54f61bb1590bc449b7030cc7634f4e3c | allow Flattr events | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo/history/models.py | mygpo/history/models.py | from django.db import models
from django.conf import settings
from mygpo.podcasts.models import Podcast, Episode
from mygpo.users.models import Client
class HistoryEntry(models.Model):
""" A entry in the history """
SUBSCRIBE = 'subscribe'
UNSUBSCRIBE = 'unsubscribe'
FLATTR = 'flattr'
PODCAST_AC... | from django.db import models
from django.conf import settings
from mygpo.podcasts.models import Podcast, Episode
from mygpo.users.models import Client
class HistoryEntry(models.Model):
""" A entry in the history """
SUBSCRIBE = 'subscribe'
UNSUBSCRIBE = 'unsubscribe'
PODCAST_ACTIONS = (
(SUB... | agpl-3.0 | Python |
dabb6e7b3855d93df74d690607432e27b5d9c82f | Add h5py on sciqnd ipython profile | escorciav/linux-utils,escorciav/linux-utils | ipython/profile/00_import_sciqnd.py | ipython/profile/00_import_sciqnd.py | import cPickle as pickle
import glob
import json
import math
import os
import sys
import cv2
import h5py
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import scipy.io
import scipy.stats
import skimage
import skimage.transform
import skimage.io
# The... | import cPickle as pickle
import glob
import json
import math
import os
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import scipy.io
import scipy.stats
import skimage
import skimage.transform
import skimage.io
import cv2
# The following ... | mit | Python |
0bfb604665344ace9415e3731acb9badbd38c0d3 | fix bug with create_branch_and_reset_to_upstream_master | tscholl2/smc,tscholl2/smc,sagemathinc/smc,tscholl2/smc,sagemathinc/smc,tscholl2/smc,DrXyzzy/smc,sagemathinc/smc,sagemathinc/smc,DrXyzzy/smc,DrXyzzy/smc,tscholl2/smc,DrXyzzy/smc | src/smc_pyutil/smc_pyutil/smc_git.py | src/smc_pyutil/smc_pyutil/smc_git.py | #!/usr/bin/python
"""
(c) Tim Clemans, 2016
"""
import json, os, subprocess, sys, uuid
def current_branch():
result = os.popen('git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "master" ').read().strip('\n').split('\n')[-1]
return result.strip()
def branches():
results = os.popen('git branch').read... | #!/usr/bin/python
"""
(c) Tim Clemans, 2016
"""
import json, os, subprocess, sys, uuid
def current_branch():
result = os.popen('git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "master" ').read().strip('\n').split('\n')[-1]
return result.strip()
def branches():
results = os.popen('git branch').read... | agpl-3.0 | Python |
5bc323794750b4bea101302fd436c7cf9fc9047f | add very simple orphaned function | groutr/conda-tools,groutr/conda-tools | conda_tools/environment_utils.py | conda_tools/environment_utils.py | """
Utility functions that map information from environments onto package cache
"""
from os.path import join
from .environment import Environment, environments
from .cache import PackageInfo
from .utils import is_hardlinked
def hard_linked(env):
"""
Return dictionary of all packages (as PackageInfo instance... | """
Utility functions that map information from environments onto package cache
"""
from os.path import join
from .environment import Environment, environments
from .cache import PackageInfo
from .utils import is_hardlinked
def hard_linked(env):
"""
Return dictionary of all packages (as PackageInfo instance... | bsd-3-clause | Python |
6cd7e79fc32ebf75776ab0bcf367854d76dd5e03 | Add comments to item fields. | rfkrocktk/subreddit-scraper | src/redditsubscraper/items.py | src/redditsubscraper/items.py | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import scrapy
class Post(scrapy.Item):
"""
A model representing a single Reddit post.
"""
"""An id encoded in base-36 without any prefixes."""
id = scrapy.Field()
class Comment(scrapy.Item):
"""
A model representing a single Reddit comme... | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import scrapy
class Post(scrapy.Item):
"""
A model representing a single Reddit post.
"""
id = scrapy.Field()
class Comment(scrapy.Item):
"""
A model representing a single Reddit comment
"""
id = scrapy.Field()
parent_id = scrapy.... | mit | Python |
454ed728c7a0d02f51ca2720e8ccead3fd362912 | Update poll-sensors.py | JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub | cron/poll-sensors.py | cron/poll-sensors.py | #!/usr/bin/env python
import MySQLdb
import datetime
import urllib2
import os
servername = "localhost"
username = "pi"
password = "password"
dbname = "pi_heating_db"
t = datetime.datetime.now().strftime('%s')
cnx = MySQLdb.connect(host=servername, user=username, passwd=password, db=dbname)
cursorread = cnx.cursor... | #!/usr/bin/env python
import MySQLdb
import datetime
import urllib2
import os
servername = "localhost"
username = "pi"
password = "password"
dbname = "pi_heating_db"
t = datetime.datetime.now().strftime('%s')
cnx = MySQLdb.connect(host=servername, user=username, passwd=password, db=dbname)
cursorread = cnx.cursor... | apache-2.0 | Python |
68d004219db0412b8d8d9198f3194525c3c2f781 | Add user/uid converters | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/file.py | salt/modules/file.py | '''
Manage information about files on the minion, set/read user, group, and mode
data
'''
import os
import grp
import pwd
def gid_to_group(gid):
'''
Convert the group id to the group name on this system
'''
try:
return grp.getgrgid(gid).gr_name
except KeyError:
return ''
def group... | '''
Manage information about files on the minion, set/read user, group, and mode
data
'''
import os
import grp
import pwd
def gid_to_group(gid):
'''
Convert the group id to the group name on this system
'''
try:
return grp.getgrgid(gid).gr_name
except KeyError:
return ''
def group... | apache-2.0 | Python |
058e77abbd9ecdebcd03f01914e11b9df2e01f88 | rename facter_data module function to facter | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/test.py | salt/modules/test.py | '''
Module for running arbitrairy tests
'''
def echo(text):
'''
Return a string - used for testing the connection
CLI Example:
salt '*' test.echo 'foo bar baz quo qux'
'''
print 'Echo got called!'
return text
def ping():
'''
Just used to make sure the minion is up and responding
... | '''
Module for running arbitrairy tests
'''
def echo(text):
'''
Return a string - used for testing the connection
CLI Example:
salt '*' test.echo 'foo bar baz quo qux'
'''
print 'Echo got called!'
return text
def ping():
'''
Just used to make sure the minion is up and responding
... | apache-2.0 | Python |
9c822e7e299c32e024aeb60289fa3d0b47dc0751 | use sha256 to hash passwords for aes shit | rpbeltran/closed-kimono | crypto/lameCrypto.py | crypto/lameCrypto.py | from ctypes import *
from Crypto import Random
from Crypto.Cipher import AES
import base64
import hashlib
class LameCrypto():
def __init__(self, string, password):
self.string = string
self.password = self.hashPW(password)
def encrypt(self):
cipher = AES.new(self.password, AES.MODE_CBC, 'This is an IV456')
... | from ctypes import *
from Crypto import Random
from Crypto.Cipher import AES
import base64
class LameCrypto():
def __init__(self, string, password):
self.string = string
self.password = self.hashPW(password)
def encrypt(self):
cipher = AES.new(self.password, AES.MODE_CBC, 'This is an IV456')
encoded = str(b... | unlicense | Python |
b590ddd735131faa3fd1bdc91b1866e1bd7b0738 | Add featured homepage initial fixture. | us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite | us_ignite/snippets/management/commands/snippets_load_fixtures.py | us_ignite/snippets/management/commands/snippets_load_fixtures.py | from django.core.management.base import BaseCommand
from us_ignite.snippets.models import Snippet
FIXTURES = [
{
'slug': 'home-box',
'name': 'UP NEXT: LOREM IPSUM',
'body': '',
'url_text': 'GET INVOLVED',
'url': '',
},
{
'slug': 'featured',
'name': ... | from django.core.management.base import BaseCommand
from us_ignite.snippets.models import Snippet
FIXTURES = [
{
'slug': 'home-box',
'name': 'Up next:',
'body': '',
'url_text': 'Get involved',
'url': '',
},
]
class Command(BaseCommand):
def handle(self, *args, *... | bsd-3-clause | Python |
b66f02510577f9af70df31dcb729ccac3881fe94 | Update opencv_intro.py | LCAS/teaching,LCAS/teaching,LCAS/teaching,LCAS/teaching,LCAS/teaching | cmp3103m-code-fragments/scripts/opencv_intro.py | cmp3103m-code-fragments/scripts/opencv_intro.py |
from cv2 import namedWindow, imread, imshow
from cv2 import waitKey, destroyAllWindows, startWindowThread
from cv2 import blur, Canny, circle
import numpy as np
# declare windows you want to display
namedWindow("original")
namedWindow("blur")
namedWindow("canny")
img = imread('../blofeld.jpg')
print('type: %s' % typ... |
from cv2 import namedWindow, imread, imshow
from cv2 import waitKey, destroyAllWindows, startWindowThread
from cv2 import blur, Canny, circle
import numpy as np
# declare windows you want to display
namedWindow("original")
namedWindow("blur")
namedWindow("canny")
# this is always needed to run the GUI thread
startWi... | mit | Python |
22aa4fec2ee19ed4590ca7c86aed0a732c5d4871 | add 'ProcsT', an type alias of typing.List[ProcT] | ssato/python-anyconfig,ssato/python-anyconfig | src/anyconfig/processors/datatypes.py | src/anyconfig/processors/datatypes.py | #
# Copyright (C) 2018 - 2021 Satoru SATOH <satoru.satoh @ gmail.com>
# SPDX-License-Identifier: MIT
#
r"""Common functions and variables.
"""
import typing
from ..models import processor
ProcT = typing.TypeVar('ProcT', bound=processor.Processor)
ProcsT = typing.List[ProcT]
ProcClsT = typing.Type[ProcT]
ProcClssT = ... | #
# Copyright (C) 2018 - 2021 Satoru SATOH <satoru.satoh @ gmail.com>
# SPDX-License-Identifier: MIT
#
r"""Common functions and variables.
"""
import typing
from ..models import processor
ProcT = typing.TypeVar('ProcT', bound=processor.Processor)
ProcClsT = typing.Type[ProcT]
ProcClssT = typing.List[ProcClsT]
Maybe... | mit | Python |
2423bb2f890d0db937a0a11a27d6aa3404db298e | Update __init__.py | Genomon-Project/paplot,Genomon-Project/paplot,Genomon-Project/paplot,Genomon-Project/paplot | paplot/__init__.py | paplot/__init__.py | #import comut
import prep
import qc
import run_conf
import run_qc
import run_sv
import sv
| import comut
import prep
import qc
import run_conf
import run_qc
import run_sv
import sv
| mit | Python |
4421a26db7821a989cdc2959fa4f80f7c4e04580 | save test results in a file | marioyc/CCA-images-text,marioyc/CCA-images-text | main_test.py | main_test.py | from gensim.models import word2vec
from keras.applications.vgg16 import VGG16, preprocess_input
from keras.preprocessing import image
from pycocotools.coco import COCO
from scipy.spatial import distance
from sklearn.externals import joblib
import logging
import os
import numpy as np
import time
logging.basicConfig(fil... | from gensim.models import word2vec
from keras.applications.vgg16 import VGG16, preprocess_input
from keras.preprocessing import image
from pycocotools.coco import COCO
from scipy.spatial import distance
from sklearn.externals import joblib
import logging
import os
import numpy as np
import time
logging.basicConfig(fil... | mit | Python |
dbef09addcd532e3006c4e26ccf377f5117c57d2 | Update makeTests.py | guilindner/VortexFitting | makeTests.py | makeTests.py | import os
import sys
is_windows = sys.platform.startswith('win')
if is_windows:
print("Running on Windows ...")
else:
print("Running on Linux ...")
if sys.version_info[0] < 3:
raise Exception("Must be using Python 3")
else:
cwd = os.getcwd()
os.chdir(cwd + '/tests')
cwd = os.getcwd()
... | import os
import sys
is_windows = sys.platform.startswith('win')
if is_windows:
print("Running on Windows ...")
else:
print("Running on Linux ...")
cwd = os.getcwd()
os.chdir(cwd + '/tests')
cmd = 'python test_fitting.py'
os.system(cmd)
cmd = 'python test_tools.py'
os.system(cmd)
cmd = 'python testOseen.py'... | mit | Python |
d37f91f50dd6c0c3202258daca95ee6ee111688f | Fix for IE 11 (Focus) | gpitel/pyjs,spaceone/pyjs,lancezlin/pyjs,spaceone/pyjs,lancezlin/pyjs,pombredanne/pyjs,pyjs/pyjs,Hasimir/pyjs,gpitel/pyjs,pyjs/pyjs,spaceone/pyjs,pyjs/pyjs,Hasimir/pyjs,lancezlin/pyjs,pyjs/pyjs,pombredanne/pyjs,gpitel/pyjs,Hasimir/pyjs,gpitel/pyjs,spaceone/pyjs,pombredanne/pyjs,lancezlin/pyjs,pombredanne/pyjs,Hasimir/p... | pyjswidgets/pyjamas/ui/Focus.oldmoz.py | pyjswidgets/pyjamas/ui/Focus.oldmoz.py |
def ensureFocusHandler():
JS("""
return (focusHandler !== null) ? focusHandler : (focusHandler =
@{{createFocusHandler}}());
""")
def createFocusHandler():
JS("""
return function(evt) {
// This function is called directly as an event handler, so 'this' is
// set up by the b... |
def ensureFocusHandler():
JS("""
return (focusHandler !== null) ? focusHandler : (focusHandler =
@{{createFocusHandler}}());
""")
def createFocusHandler():
JS("""
return function(evt) {
// This function is called directly as an event handler, so 'this' is
// set up by the b... | apache-2.0 | Python |
b456b2836940361d1715d5f89d614ca8ff9513e2 | Revert __str__ of _WrappingException | xLegoz/marshmallow,Tim-Erwin/marshmallow,Bachmann1234/marshmallow,0xDCA/marshmallow,0xDCA/marshmallow,jmcarp/marshmallow,dwieeb/marshmallow,bartaelterman/marshmallow,marshmallow-code/marshmallow,VladimirPal/marshmallow,quxiaolong1504/marshmallow,daniloakamine/marshmallow,maximkulkin/marshmallow,etataurov/marshmallow,mw... | marshmallow/exceptions.py | marshmallow/exceptions.py | # -*- coding: utf-8 -*-
"""Exception classes for marshmallow-related errors."""
class MarshmallowError(Exception):
"""Base class for all marshmallow-related errors."""
pass
class _WrappingException(MarshmallowError):
"""Exception that wraps a different, underlying exception. Used so that
an error in ... | # -*- coding: utf-8 -*-
"""Exception classes for marshmallow-related errors."""
class MarshmallowError(Exception):
"""Base class for all marshmallow-related errors."""
pass
class _WrappingException(MarshmallowError):
"""Exception that wraps a different, underlying exception. Used so that
an error in ... | mit | Python |
1013d5e3c3b5cbf96651e85a909b507db4b45a9b | Fix conf names | pinax/pinax-comments,pinax/pinax-comments,eldarion/dialogos | pinax/comments/conf.py | pinax/comments/conf.py | from __future__ import unicode_literals
from appconf import AppConf
from django.conf import settings
class CommentsAppConf(AppConf):
CAN_DELETE_CALLABLE = True
CAN_EDIT_CALLABLE = True
| from __future__ import unicode_literals
from django.conf import settings
from appconf import AppConf
class CommentsAppConf(AppConf):
COMMENTS_CAN_DELETE_CALLABLE = True
COMMENTS_CAN_EDIT_CALLABLE = True | mit | Python |
f7373a4c2adc74fc2ff18a7c441a978b6982df89 | Update check_requires_python and describe behavior in docstring | pradyunsg/pip,fiber-space/pip,atdaemon/pip,RonnyPfannschmidt/pip,techtonik/pip,rouge8/pip,xavfernandez/pip,fiber-space/pip,rouge8/pip,pradyunsg/pip,zvezdan/pip,techtonik/pip,pypa/pip,sigmavirus24/pip,sigmavirus24/pip,RonnyPfannschmidt/pip,zvezdan/pip,benesch/pip,rouge8/pip,atdaemon/pip,pfmoore/pip,pypa/pip,sbidoul/pip,... | pip/utils/packaging.py | pip/utils/packaging.py | from __future__ import absolute_import
import logging
import sys
from pip._vendor import pkg_resources
from pip._vendor.packaging import specifiers
from pip._vendor.packaging import version
logger = logging.getLogger(__name__)
def get_metadata(dist):
if (isinstance(dist, pkg_resources.DistInfoDistribution) and... | from __future__ import absolute_import
import logging
import sys
from pip._vendor import pkg_resources
from pip._vendor.packaging import specifiers
from pip._vendor.packaging import version
logger = logging.getLogger(__name__)
def get_metadata(dist):
if (isinstance(dist, pkg_resources.DistInfoDistribution) and... | mit | Python |
07de785193392e038a91ec481358ff42ae6b08c7 | change to inning.py | Shinichi-Nakagawa/pitchpx | pitchpx/game/inning.py | pitchpx/game/inning.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pitchpx.mlbam_util import MlbamUtil
__author__ = 'Shinichi Nakagawa'
class Inning(object):
DIRECTORY = 'inning'
FILENAME_PATTERN = 'inning_\d*.xml'
TAG = 'a'
@classmethod
def read_xml(cls, url, markup, game, players):
"""
read ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pitchpx.mlbam_util import MlbamUtil
__author__ = 'Shinichi Nakagawa'
class Inning(object):
DIRECTORY = 'inning'
FILENAME_PATTERN = 'inning_\d*.xml'
TAG = 'a'
@classmethod
def read_xml(cls, url, markup, game, players):
"""
read ... | mit | Python |
9ef39434f27697e105e8ad594f3d2a6b04ef7c91 | fix record array issue | nitikayad96/chandra_suli | chandra_suli/query_region_db.py | chandra_suli/query_region_db.py | import numpy as np
import os
from chandra_suli.angular_distance import angular_distance
def query_region_db(ra_center, dec_center, radius, region_dir):
"""
Returns a list of files relative to regions which are within the provided cone
:param ra_center: R.A. of the center of the cone
:param dec_cente... | import numpy as np
import os
from chandra_suli.angular_distance import angular_distance
def query_region_db(ra_center, dec_center, radius, region_dir):
"""
Returns a list of files relative to regions which are within the provided cone
:param ra_center: R.A. of the center of the cone
:param dec_cente... | bsd-3-clause | Python |
ea0c0beb1d2aa0d5970b629ac06e6f9b9708bfdd | Update custom template filter | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | cla_public/apps/base/filters.py | cla_public/apps/base/filters.py | import re
from cla_public.apps.base import base
@base.app_template_filter()
def matches(value, pattern):
return bool(re.search(pattern, value))
| from cla_public.apps.base import base
@base.app_template_filter()
def test(value):
return value
| mit | Python |
9b236558fe46ee9523d0889be194cf63068a4694 | rename variables | UM-ARM-Lab/arc_utilities,UM-ARM-Lab/arc_utilities,UM-ARM-Lab/arc_utilities,WPI-ARC/arc_utilities,WPI-ARC/arc_utilities,WPI-ARC/arc_utilities | src/arc_utilities/filesystem_utils.py | src/arc_utilities/filesystem_utils.py | import pathlib
from typing import Optional, Iterable
from colorama import Fore
from arc_utilities.path_utils import rm_tree
def mkdir_and_ask(path, parents: bool, yes: Optional[bool] = False):
if path.exists():
msg = f"Path {path} exists, do you want to reuse it? [Y/n]"
if yes:
print... | import pathlib
from typing import Optional, Iterable
from colorama import Fore
from arc_utilities.path_utils import rm_tree
def mkdir_and_ask(path, parents: bool, yes: Optional[bool] = False):
if path.exists():
msg = f"Path {path} exists, do you want to reuse it? [Y/n]"
if yes:
print... | bsd-2-clause | Python |
16c6e2cba9a61ccad00ace1502426245bec0f7db | Bump version: 0.0.1 -> 0.0.2 | polysquare/cmake-header-language | conanfile.py | conanfile.py | from conans import ConanFile
from conans.tools import download, unzip
import os
VERSION = "0.0.2"
class CMakeHeaderLanguageConan(ConanFile):
name = "cmake-header-language"
version = os.environ.get("CONAN_VERSION_OVERRIDE", VERSION)
generators = "cmake"
requires = ("cmake-include-guard/master@smspilla... | from conans import ConanFile
from conans.tools import download, unzip
import os
VERSION = "0.0.1"
class CMakeHeaderLanguageConan(ConanFile):
name = "cmake-header-language"
version = os.environ.get("CONAN_VERSION_OVERRIDE", VERSION)
generators = "cmake"
requires = ("cmake-include-guard/master@smspilla... | mit | Python |
829c1504c043c08af1d6e7f2bf1fb87fb1739fcc | Update to TBB/2018_U6@conan/stable | acgetchell/CDT-plusplus,acgetchell/CDT-plusplus,acgetchell/CDT-plusplus | conanfile.py | conanfile.py | from conans import ConanFile, CMake
class CausalDynamicalTriangulations(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "boost/1.68.0@conan/stable", "catch2/2.4.1@bincrafters/stable", "TBB/2018_U6@conan/stable",\
"eigen/3.3.5@conan/stable", "docopt/0.6.2@conan/stable",\
... | from conans import ConanFile, CMake
class CausalDynamicalTriangulations(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "boost/1.68.0@conan/stable", "catch2/2.4.1@bincrafters/stable", "TBB/2018_U5@conan/stable",\
"eigen/3.3.5@conan/stable", "docopt/0.6.2@conan/stable",\
... | bsd-3-clause | Python |
3d5fd3233ecaf2bae5fbd5a1ae349c55d2f4cdc7 | Return pre-built dockerfile to user | callaghanmt/research-stacks,callaghanmt/research-stacks,callaghanmt/research-stacks | scistack/scistack.py | scistack/scistack.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SciStack: the web app to build docker containers for reproducable science
"""
import os
import flask
import inspect
app = flask.Flask(__name__, static_url_path='')
# Home of any pre-build docker files
docker_file_path = os.path.join(os.path.dirname(os.path.abspath(
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SciStack: the web app to build docker containers for reproducable science
"""
import os
import flask
app = flask.Flask(__name__)
@app.route("/")
def hello():
return "Choose a domain!"
if __name__ == "__main__":
app.run()
| mit | Python |
020b949adfb4afbfb8b6ca71ce7916ca9ddbf0e8 | Add Sample Usage to table_fetcher.py | lnishan/SQLGitHub | components/table_fetcher.py | components/table_fetcher.py | """Fetches data from GitHub API, store and return the data in a SgTable.
Sample Usage:
sqlserv = core.SQLGitHub(token)
fetcher = table_fetcher.SgTableFetcher(sqlserv._github)
print(fetcher.Fetch("abseil"))
print("----------------------------")
print(fetcher.Fetch("abseil.repos"))
print("-------... | """Fetches data from GitHub API, store and return the data in a SgTable."""
import table
import inspect
class SgTableFetcher:
"""Fetches data from GitHub API, store and return the data in a SgTable."""
def __init__(self, github):
self._github = github
def _Parse(self, label):
tmp = labe... | mit | Python |
c54eea24ec46c26128b07ae0cfd62d40a7cb2749 | Deal with partial download | noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit | economist_tools/fetch_economist.py | economist_tools/fetch_economist.py | import os
import re
import requests
import subprocess
import time
""" Download The Economist and send to kindle if new """
def fetch(existant_versions):
print('Fetching calibre recipe from Github')
url = ('https://raw.githubusercontent.com/kovidgoyal/calibre/master/' +
'recipes/economist.recipe')
... | import os
import re
import requests
import subprocess
import time
""" Download The Economist and send to kindle if new """
def fetch(existant_versions):
print('Fetching calibre recipe from Github')
url = ('https://raw.githubusercontent.com/kovidgoyal/calibre/master/' +
'recipes/economist.recipe')
... | mit | Python |
834d02d65b0d71bd044b18b0be031751a8c1a7de | Upgrade libchromiumcontent: Add support for acceptsFirstMouse. | bbondy/electron,greyhwndz/electron,Neron-X5/electron,jacksondc/electron,baiwyc119/electron,brave/electron,tinydew4/electron,trigrass2/electron,pirafrank/electron,arturts/electron,RobertJGabriel/electron,takashi/electron,wan-qy/electron,hokein/atom-shell,digideskio/electron,tincan24/electron,jonatasfreitasv/electron,ben... | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
NODE_VERSION = 'v0.11.10'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '276722e68bb643e3ae3b468b701c276aeb884838'
| #!/usr/bin/env python
NODE_VERSION = 'v0.11.10'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '607907aed2c1dcdd3b5968a756a990ba3f47bca7'
| mit | Python |
e82443a30233514dca762690be66e35a5fbca62e | Bump version to 5.0.5a1 | platformio/platformio,platformio/platformio-core,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
665381d84dc73bd0471e611439f64f1bec50a2ff | Use slugs for extracting URIs. | mikesname/ehri-collections,mikesname/ehri-collections,mikesname/ehri-collections | ehriportal/portal/api/resources.py | ehriportal/portal/api/resources.py | """
Tastypie resources for notable models.
"""
from django.conf.urls.defaults import *
from django.core.urlresolvers import reverse
from tastypie import resources, serializers
from portal import models
# Unused/unfinished collection exporter/importer that
# supports EAD.
class CollectionSerializer(serializers.Serial... | """
Tastypie resources for notable models.
"""
from tastypie import resources, serializers
from portal import models
# Unused/unfinished collection exporter/importer that
# supports EAD.
class CollectionSerializer(serializers.Serializer):
formats = ['json', 'jsonp', 'xml', 'yaml', 'html', 'plist', 'ead']
con... | mit | Python |
c1e6e8c15d4eabeef70213b240b365f9820732ce | Bump version | eBay/wextracto,gilessbrown/wextracto,gilessbrown/wextracto,eBay/wextracto | wex/__init__.py | wex/__init__.py | """
Wextracto is a library for extracting data from web resources.
:copyright: (c) 2012-2015
"""
__version__ = '0.8.4' # pragma: no cover
| """
Wextracto is a library for extracting data from web resources.
:copyright: (c) 2012-2015
"""
__version__ = '0.8.3' # pragma: no cover
| bsd-3-clause | Python |
099eb53d3c7a4be19fd79f11c9ccf52faff300d4 | Upgrade libchromiumcontent to fix generating node.lib | setzer777/electron,dkfiresky/electron,carsonmcdonald/electron,davazp/electron,michaelchiche/electron,gerhardberger/electron,systembugtj/electron,renaesop/electron,mirrh/electron,bbondy/electron,subblue/electron,Andrey-Pavlov/electron,joaomoreno/atom-shell,bpasero/electron,hokein/atom-shell,bpasero/electron,benweissmann... | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'aa87035cc012ce0d533bb56b947bca81a6e71b82'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'e4b283c22236560fd289fe59c03e50adf39e7c4b'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | mit | Python |
abcc4c0a129661131eb5a01e15f4829483760a1d | Bump version to 5.2.3b4 | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
077156a69250f09a177e692024fa045e47347c4f | rename change project permission | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | adhocracy4/projects/rules.py | adhocracy4/projects/rules.py | import rules
from rules.predicates import is_superuser
from adhocracy4.organisations.predicates import is_initiator
from .predicates import is_live, is_member, is_public
rules.add_perm('a4projects.change_project',
is_superuser | is_initiator)
rules.add_perm('a4projects.view_project',
... | import rules
from rules.predicates import is_superuser
from adhocracy4.organisations.predicates import is_initiator
from .predicates import is_live, is_member, is_public
rules.add_perm('a4projects.edit_project',
is_superuser | is_initiator)
rules.add_perm('a4projects.view_project',
is... | agpl-3.0 | Python |
3b0f92144ab4d3e7f0852d6ecb1196c197f82197 | Use os.devnull | nth10sd/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,MozillaSecurity/funfuzz | util/multi.py | util/multi.py | #!/usr/bin/env python
import platform
import subprocess
import sys
import time
if __name__ == "__main__":
count = int(sys.argv[1])
command = sys.argv[2:]
close_fds = sys.platform != 'win32'
for i in range(count):
subprocess.Popen(command, close_fds=close_fds, stdout=open(os.devnull, 'w'), stde... | #!/usr/bin/env python
import platform
import subprocess
import sys
import time
WIN = (platform.system() in ("Microsoft", "Windows"))
DEV_NULL = 'NUL' if WIN else '/dev/null'
if __name__ == "__main__":
count = int(sys.argv[1])
command = sys.argv[2:]
close_fds = sys.platform != 'win32'
for i in range(c... | mpl-2.0 | Python |
f2071eb5781f4dfa4cacbcd9f0d1c71412ba80b1 | Set hash rounds back to 100000 | RuddockHouse/RuddockWebsite,RuddockHouse/RuddockWebsite,RuddockHouse/RuddockWebsite | constants.py | constants.py | # Store various constants here
# Maximum file upload size (in bytes).
MAX_CONTENT_LENGTH = 1 * 1024 * 1024 * 1024
# Authentication constants
PWD_HASH_ALGORITHM = 'pbkdf2_sha256'
SALT_SIZE = 24
MIN_PASSWORD_LENGTH = 8
MAX_PASSWORD_LENGTH = 1024
HASH_ROUNDS = 100000
PWD_RESET_KEY_LENGTH = 32
# Length of time before rec... | # Store various constants here
# Maximum file upload size (in bytes).
MAX_CONTENT_LENGTH = 1 * 1024 * 1024 * 1024
# Authentication constants
PWD_HASH_ALGORITHM = 'pbkdf2_sha256'
SALT_SIZE = 24
MIN_PASSWORD_LENGTH = 8
MAX_PASSWORD_LENGTH = 1024
HASH_ROUNDS = 50000
PWD_RESET_KEY_LENGTH = 32
# Length of time before reco... | mit | Python |
281ed12e9835cfbeaeeaf34b9f89dff3871e35f5 | change location for keep files | DHLabs/keep,DHLabs/keep,DHLabs/keep,9929105/KEEP,9929105/KEEP,9929105/KEEP | keep_backend/settings/production.py | keep_backend/settings/production.py | from settings import *
from credentials import AWS, MAILGUN, RDS
ALLOWED_HOSTS = [ '*' ]
DEBUG = False
# # Setup Amazon RDS access
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': 'keep',
# 'PORT': 3306,
# 'HOST': RDS[ 'HOST' ],
# 'USER': RD... | from settings import *
from credentials import AWS, MAILGUN, RDS
ALLOWED_HOSTS = [ '*' ]
DEBUG = False
# # Setup Amazon RDS access
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': 'keep',
# 'PORT': 3306,
# 'HOST': RDS[ 'HOST' ],
# 'USER': RD... | mit | Python |
6bb6e3e794f946d4d038c6ac4d763c816344e575 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/fbea0c8b4bc09c835c14b8538ef273fe0f80b380. | tensorflow/tensorflow,Intel-tensorflow/tensorflow,karllessard/tensorflow,yongtang/tensorflow,karllessard/tensorflow,Intel-Corporation/tensorflow,paolodedios/tensorflow,karllessard/tensorflow,karllessard/tensorflow,yongtang/tensorflow,paolodedios/tensorflow,Intel-tensorflow/tensorflow,yongtang/tensorflow,Intel-tensorflo... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "fbea0c8b4bc09c835c14b8538ef273fe0f80b380"
TFRT_SHA256 = "d3f2c8dd24045ec2c9c16190f1918d56878d45385cecde... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "9c1995dbc64ea865827f6067530e41fa0667a2e3"
TFRT_SHA256 = "043a18270b4c4814d48a077a550adc014402a4bcafd285... | apache-2.0 | Python |
f37a0fad180da70ecfc13e211a0d6c18e9b7fd1e | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/eaf0cd3987bccb607e665ae25a209b16227b1d00. | paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,tensorflow/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,yongtang/te... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "eaf0cd3987bccb607e665ae25a209b16227b1d00"
TFRT_SHA256 = "0a9934c941fbaca0fe1f50afe16f... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "4bcf7c881273a1e289ffc07ce6e02b4f63763afb"
TFRT_SHA256 = "73ca1740eeea89da183fd1a871b2... | apache-2.0 | Python |
a11f7f0b8422b191932dd28580c6f09bf242b969 | add mysetting: global variable | yasokada/python-151113-lineMonitor,yasokada/python-151113-lineMonitor | utilUdpCmd.py | utilUdpCmd.py | #import serial
import time
import socket
import utilSetting
from utilSetting import CSetting
mysetting = CSetting()
def procCommand(rcvstr):
print "rcvd:", rcvstr
cmds = rcvstr.split(",")
if "set" in cmds[0]:
if "mon" in cmds[1]:
count = len(cmds)
if count == 4:
print "set monitor (ip, port)"
if "com... | #import serial
import time
import socket
import utilSetting
def procCommand(rcvstr):
print "rcvd:", rcvstr
cmds = rcvstr.split(",")
if "set" in cmds[0]:
if "mon" in cmds[1]:
count = len(cmds)
if count == 4:
print "set monitor (ip, port)"
if "comdelay" in cmds[1]:
print "set comdelay"
return
def ... | mit | Python |
9d97704273213c5a04f6a232e56b345e2d019831 | remove colum headers as well. | brentp/bio-playground,shashidhar22/bio-playground,shashidhar22/bio-playground,shashidhar22/bio-playground,brentp/bio-playground,brentp/bio-playground,shashidhar22/bio-playground,brentp/bio-playground,shashidhar22/bio-playground,shashidhar22/bio-playground,brentp/bio-playground,brentp/bio-playground | utils/join.py | utils/join.py | """
%prog [options] filea:col# fileb:col#
e.g.
%prog --sepa , --sepb , f1.txt:2 f3.txt:5
join filea with fileb by looking for the same value in col#
col numbers are 0-based indexing. can key on multiple columns:
%prob f1.txt:2:4 f3.txt:5:7
will use columns 2 and 4 and check agains columns 5 and 7.
"""... | """
%prog [options] filea:col# fileb:col#
e.g.
%prog --sepa , --sepb , f1.txt:2 f3.txt:5
join filea with fileb by looking for the same value in col#
col numbers are 0-based indexing. can key on multiple columns:
%prob f1.txt:2:4 f3.txt:5:7
will use columns 2 and 4 and check agains columns 5 and 7.
"""... | mit | Python |
06a91da7b85c0d74066330acefe7255f970cb5f6 | add roll command | mikevb1/lagbot,mikevb1/discordbot | cogs/misc.py | cogs/misc.py | """Cog for miscellaneous stuff."""
from discord.ext import commands
import asyncio
import random
class Misc:
"""Miscellaneous functions/commands and stuff."""
def __init__(self, bot):
"""Constructor."""
self.bot = bot
@commands.command()
async def roll(self, dice='1d6'):
"""... | """Cog for miscellaneous stuff."""
from discord.ext import commands
import asyncio
class Misc:
"""Miscellaneous functions/commands and stuff."""
def __init__(self, bot):
"""Constructor."""
self.bot = bot
def setup(bot):
"""'Magic' function to set up cog."""
bot.add_cog(Misc(bot))
| mit | Python |
3ca040c171c27d0d927f47e3844f51b8321f1701 | remove timeout. | ustream/openduty,ustream/openduty,ustream/openduty,ustream/openduty | openduty/healthcheck.py | openduty/healthcheck.py | __author__ = 'deathowl'
from time import sleep, time
import datetime
from openduty.serializers import NoneSerializer
from openduty.models import Incident
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets
from .celery import add
from random import randint... | __author__ = 'deathowl'
from time import sleep, time
import datetime
from openduty.serializers import NoneSerializer
from openduty.models import Incident
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets
from .celery import add
from random import randint... | mit | Python |
1ee640b7ea9ada616e5f65cb375307d4c8944aa6 | Use stacklevel=2 in DeprecationWarning. | kirkeby/sheared | src/sheared/web/collection.py | src/sheared/web/collection.py | #
# Sheared -- non-blocking network programming library for Python
# Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2... | #
# Sheared -- non-blocking network programming library for Python
# Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2... | mit | Python |
cc6380b7c005b0d36307db81417084792f584716 | Change configuration for sphinx autodoc | dudymas/python-openstacksdk,openstack/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,mtougeron/python-openstacksdk,dudymas/python-openstacksdk,briancurtin/python-opensta... | doc/source/conf.py | doc/source/conf.py | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... | apache-2.0 | Python |
3a78496f350c904ce64d30f422dfae8b6bc879c3 | Simplify test execution to restore coverage measurement | theskumar-archive/flask-api,theskumar-archive/flask-api,theskumar-archive/flask-api,theskumar-archive/flask-api | flask_api/tests/runtests.py | flask_api/tests/runtests.py | import unittest
if __name__ == '__main__':
unittest.main(module='flask_api.tests')
| import unittest
import sys
import subprocess
if __name__ == '__main__':
if len(sys.argv) > 1:
unittest.main(module='flask_api.tests')
else:
subprocess.call([sys.executable, '-m', 'unittest', 'discover'])
| bsd-2-clause | Python |
163056cc642fe1183cab3f58910f9b20096e74e3 | Move generation code into a function. | nanomsg/nnpy,tempbottle/nnpy | generate.py | generate.py | from cffi import FFI
import os
INCLUDE = ['/usr/include/nanomsg', '/usr/local/include/nanomsg']
def functions():
for dir in INCLUDE:
if os.path.exists(dir):
break
lines = []
for fn in os.listdir(dir):
with open(os.path.join(dir, fn)) as f:
cont = False
for ln in f:
if cont:
lines.app... | from cffi import FFI
import os
INCLUDE = ['/usr/include/nanomsg', '/usr/local/include/nanomsg']
def functions():
for dir in INCLUDE:
if os.path.exists(dir):
break
lines = []
for fn in os.listdir(dir):
with open(os.path.join(dir, fn)) as f:
cont = False
for ln in f:
if cont:
lines.app... | mit | Python |
32b04f64d003306c93986768e90324a046c72f2c | fix doc | LinkHS/incubator-mxnet,EvanzzzZ/mxnet,lxn2/mxnet,coder-james/mxnet,antoan2/incubator-mxnet,ykim362/mxnet,madjam/mxnet,Guneet-Dhillon/mxnet,dmlc/mxnet,Prasad9/incubator-mxnet,sxjscience/mxnet,tornadomeet/mxnet,luoyetx/mxnet,jennyzhang0215/incubator-mxnet,wangyum/mxnet,luoyetx/mxnet,arikpoz/mxnet,Guneet-Dhillon/mxnet,Sho... | doc/sphinx_util.py | doc/sphinx_util.py | # -*- coding: utf-8 -*-
"""Helper utilty function for customization."""
import sys
import os
import docutils
import subprocess
#READTHEDOCS_BUILD = (os.environ.get('READTHEDOCS', None) == 'True')
READTHEDOCS_BUILD = True
def run_build_mxnet(folder):
"""Run the doxygen make command in the designated folder."""
... | # -*- coding: utf-8 -*-
"""Helper utilty function for customization."""
import sys
import os
import docutils
import subprocess
READTHEDOCS_BUILD = (os.environ.get('READTHEDOCS', None) == 'True')
def run_build_mxnet(folder):
"""Run the doxygen make command in the designated folder."""
try:
if READTHED... | apache-2.0 | Python |
a7ab60fe88454611fd33b3a9ab3aabfa3f872782 | Set `qrcode_sha256` when record in create mode. | kilfu0701/Wedding-QRcode-Web,kilfu0701/Wedding-QRcode-Web,kilfu0701/Wedding-QRcode-Web,kilfu0701/Wedding-QRcode-Web | web/wedding/models.py | web/wedding/models.py | # -*- coding: utf-8 -*-
from django.db import models
from my_util import secure
class People(models.Model):
id = models.AutoField(primary_key=True)
fullname = models.CharField(max_length=32) # 姓名
#groups_id
attend_number = models.IntegerField(default=1) # 預計參加人數
froms = models... | # -*- coding: utf-8 -*-
from django.db import models
from my_util import secure
class People(models.Model):
id = models.AutoField(primary_key=True)
fullname = models.CharField(max_length=32) # 姓名
#groups_id
attend_number = models.IntegerField(default=1) # 預計參加人數
froms = models... | mit | Python |
b268879b07389e591be9b970d221d963b2150c67 | Fix bug in send.py | wastevensv/intercom,wastevensv/intercom | utils/send.py | utils/send.py | #!/usr/bin/env python
from __future__ import print_function
import hashlib
try:
input = raw_input
except NameError:
pass
class Sender:
def make_message(self, message):
bmessage = message.encode('utf-8','ignore')
checksum = hashlib.md5(bmessage+self.privateid).hexdigest()
return se... | #!/usr/bin/env python
from __future__ import print_function
import hashlib
try:
input = raw_input
except NameError:
pass
class Sender:
def make_message(self, message):
bmessage = message.encode('utf-8','ignore')
checksum = hashlib.md5(bmessage+self.privateid).hexdigest()
return se... | mit | Python |
a539f7e99ca6533437a9fe9c04221157d1cfacbf | Set error handling before debug verbosity | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon_cli/logger.py | polyaxon_cli/logger.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import logging
import sys
from functools import wraps
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
logger = logging.getLogger('polyaxon.cli')
def configure_logger(verbose):
def s... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import logging
import sys
from functools import wraps
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
logger = logging.getLogger('polyaxon.cli')
def configure_logger(verbose):
log_l... | apache-2.0 | Python |
5e0ae3056da9af0281896a68e26e0a5a2f80ba3e | Divide urls to three categories | crike/crike,crike/crike,crike/crike,crike/crike | src/crike_django/crike_django/urls.py | src/crike_django/crike_django/urls.py |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import *
from crike_django import views
from crike_django import settings
from django.conf.urls.static import static
from crike_django.views import *
admin.autodiscover()
urlpatterns = patterns('',
# accou... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import *
from crike_django import views
from crike_django import settings
from django.conf.urls.static import static
from crike_django.views import *
admin.autodiscover()
urlpatterns = patterns('',
url... | apache-2.0 | Python |
776376200dade28f8a37abf5690639f60e0ce8f9 | Add argument --dont-create to etiquette_repl. | voussoir/etiquette,voussoir/etiquette,voussoir/etiquette | frontends/etiquette_repl.py | frontends/etiquette_repl.py | import logging
handler = logging.StreamHandler()
log_format = '{levelname}:etiquette.{module}.{funcName}: {message}'
handler.setFormatter(logging.Formatter(log_format, style='{'))
logging.getLogger().addHandler(handler)
import argparse
import code
import sys
import traceback
from voussoirkit import getpermission
imp... | import logging
handler = logging.StreamHandler()
log_format = '{levelname}:etiquette.{module}.{funcName}: {message}'
handler.setFormatter(logging.Formatter(log_format, style='{'))
logging.getLogger().addHandler(handler)
import argparse
import code
import sys
import traceback
from voussoirkit import getpermission
imp... | bsd-3-clause | Python |
a6211d48c57a0886ee1eefa87651c99bd08d4fd2 | Bump version number. | aaugustin/websockets,aaugustin/websockets,aaugustin/websockets,aaugustin/websockets | websockets/version.py | websockets/version.py | version = '4.0.1'
| version = '4.0'
| bsd-3-clause | Python |
ff9e4c9bb7e6f706f11ab0c75d7db679c7f2e6bf | Add some more documentation to ContainerManager | hmflash/Cura,Curahelper/Cura,fieldOfView/Cura,totalretribution/Cura,totalretribution/Cura,hmflash/Cura,senttech/Cura,Curahelper/Cura,ynotstartups/Wanhao,fieldOfView/Cura,senttech/Cura,ynotstartups/Wanhao | cura/Settings/ContainerManager.py | cura/Settings/ContainerManager.py | # Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
import UM.Settings
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
## Manager class that contains common actions to deal with containers... | # Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
import UM.Settings
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
class ContainerManager(QObject):
def __init__(self, parent = None)... | agpl-3.0 | Python |
40b1a0da0af686719db3fcde4a20ac6b267b9a7a | refactor method name | jboegeholz/easypattern | easy_pattern/easy_pattern.py | easy_pattern/easy_pattern.py |
ANY_CHAR = '.'
DIGIT = '\d'
NON_DIGIT = '\D'
WHITESPACE = '\s'
NON_WHITESPACE = '\S'
ALPHA = '[a-zA-Z]'
ALPHANUM = '\w'
NON_ALPHANUM = '\W'
def zero_or_more(string):
return string + '*'
def zero_or_one(string):
return string + '?'
def one_or_more(string):
return string + '+'
def exactly(number, st... |
ANY_CHAR = '.'
DIGIT = '\d'
NON_DIGIT = '\D'
WHITESPACE = '\s'
NON_WHITESPACE = '\S'
ALPHA = '[a-zA-Z]'
ALPHANUM = '\w'
NON_ALPHANUM = '\W'
def zero_or_more(string):
return string + '*'
def zero_or_once(string):
return string + '?'
def one_or_more(string):
return string + '+'
def exactly(number, s... | mit | Python |
dcb8add6685dfb7dff626742b17ce03e013e72a1 | Use stemmed Kucera Francis for Enrichment | Somsubhra/Simplify,Somsubhra/Simplify,Somsubhra/Simplify | src/enrich/kucera_francis_enricher.py | src/enrich/kucera_francis_enricher.py | __author__ = 's7a'
# All imports
from extras import StemmedKuceraFrancis
from resource import Resource
from os import path
# The Kucera Francis enrichment class
class KuceraFrancisEnricher:
# Constructor for the Kucera Francis Enricher
def __init__(self):
self.kf = StemmedKuceraFrancis(path.join('da... | __author__ = 's7a'
# All imports
from extras import KuceraFrancis
from resource import Resource
from os import path
# The Kucera Francis enrichment class
class KuceraFrancisEnricher:
# Constructor for the Kucera Francis Enricher
def __init__(self):
self.kf = KuceraFrancis(path.join('data', 'kucera_f... | mit | Python |
2e66cc7a5f2ce808c213ec22ac8eee728372f7ed | Update request to suricate with Auth | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/feedback/helpers.py | geotrek/feedback/helpers.py | import logging
from hashlib import md5
import requests
from requests.auth import HTTPBasicAuth
from django.template.loader import render_to_string
from django.conf import settings
from django.core.mail import mail_managers
from django.utils.translation import ugettext_lazy as _
logger = logging.getLogger(__name__)
... | import logging
from hashlib import md5
import requests
from django.template.loader import render_to_string
from django.conf import settings
from django.core.mail import mail_managers
from django.utils.translation import ugettext_lazy as _
logger = logging.getLogger(__name__)
def send_report_managers(report, templat... | bsd-2-clause | Python |
f66d0e1200ca1f71000ce9a294e20e6f136530e4 | Update buttons.py | web2py/pydal,niphlod/pydal,kmcheung12/pydal,stephenrauch/pydal,michele-comitini/pydal,willimoa/pydal,manuelep/pydal | applications/admin/models/buttons.py | applications/admin/models/buttons.py | # Template helpers
import os
def A_button(*a, **b):
b['_data-role'] = 'button'
b['_data-inline'] = 'true'
return A(*a, **b)
def button(href, label):
if is_mobile:
ret = A_button(SPAN(label), _href=href)
else:
ret = A(SPAN(label), _class='button btn', _href=href)
return ret
d... | # Template helpers
import os
def A_button(*a, **b):
b['_data-role'] = 'button'
b['_data-inline'] = 'true'
return A(*a, **b)
def button(href, label):
if is_mobile:
ret = A_button(SPAN(label), _href=href)
else:
ret = A(SPAN(label), _class='button btn', _href=href)
return ret
d... | bsd-3-clause | Python |
6e2250034817bb6cf23b123f1055f8c0a91b4b71 | fix guessed mime type was wrong | texastribune/django-gistpage,texastribune/django-gistpage | gistserver_project/views.py | gistserver_project/views.py | from glob import iglob
from operator import concat
import mimetypes
from django.http import HttpResponse
from django.views.generic import View
class Glob(View):
"""
Concats and serves all files found by globbing `self.pattern`.
TODO raise helpful error if no `pattern`.
WISHLIST handle large numbers ... | from glob import iglob
from operator import concat
import mimetypes
from django.http import HttpResponse
from django.views.generic import View
class Glob(View):
"""
Concats and serves all files found by globbing `self.pattern`.
TODO raise helpful error if no `pattern`.
WISHLIST handle large numbers ... | apache-2.0 | Python |
9c6786d5256ff355932ee77067dd1e7ba4ba32f3 | enable robustness | bird-house/flyingpigeon | flyingpigeon/processes/__init__.py | flyingpigeon/processes/__init__.py | from .wps_subset_countries import ClippingProcess
from .wps_subset_continents import ClipcontinentProcess
from .wps_subset_regionseurope import ClipregionseuropeProcess
from .wps_pointinspection import PointinspectionProcess
from .wps_landseamask import LandseamaskProcess
from .wps_climatefactsheet import FactsheetProc... | from .wps_subset_countries import ClippingProcess
from .wps_subset_continents import ClipcontinentProcess
from .wps_subset_regionseurope import ClipregionseuropeProcess
from .wps_pointinspection import PointinspectionProcess
from .wps_landseamask import LandseamaskProcess
from .wps_climatefactsheet import FactsheetProc... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.