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 |
|---|---|---|---|---|---|---|---|---|
beac0323253454f343b32d42d8c065cfc4fcc04f | Set available options for weekday field of reminder's model | ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website | src/epiweb/apps/reminder/models.py | src/epiweb/apps/reminder/models.py | import datetime
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
_ = lambda x: x
# Reference: http://docs.python.org/library/time.html
# - tm_wday => range [0,6], Monday is 0
MONDAY = 0
TUESDAY = 1
WEDNESDAY = 2
THURSDAY = 3
FRIDAY = 4
SATURDAY =... | import datetime
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
class Reminder(models.Model):
user = models.ForeignKey(User, unique=True)
last_reminder = models.DateTimeField()
next_reminder = models.DateField()
wday = models.Inte... | agpl-3.0 | Python |
d04895050e3771f6672b3d61961f1be064a019fb | Change version to 0.7.4 (final) | Gadal/sympy,moble/sympy,Designist/sympy,kaichogami/sympy,yukoba/sympy,vipulroxx/sympy,hargup/sympy,pbrady/sympy,wyom/sympy,cswiercz/sympy,Arafatk/sympy,hargup/sympy,meghana1995/sympy,sunny94/temp,garvitr/sympy,skirpichev/omg,mcdaniel67/sympy,souravsingh/sympy,skidzo/sympy,yashsharan/sympy,abhiii5459/sympy,toolforger/sy... | sympy/__init__.py | sympy/__init__.py | """
SymPy is a Python library for symbolic mathematics. It aims to become a
full-featured computer algebra system (CAS) while keeping the code as
simple as possible in order to be comprehensible and easily extensible.
SymPy is written entirely in Python and does not require any external
libraries, except optionally for... | """
SymPy is a Python library for symbolic mathematics. It aims to become a
full-featured computer algebra system (CAS) while keeping the code as
simple as possible in order to be comprehensible and easily extensible.
SymPy is written entirely in Python and does not require any external
libraries, except optionally for... | bsd-3-clause | Python |
1b6dd59835808b3620a22a47562572d04fb22176 | update version | mongolab/mongoctl | mongoctl/version.py | mongoctl/version.py | __author__ = 'abdul'
MONGOCTL_VERSION = '1.1.13'
| __author__ = 'abdul'
MONGOCTL_VERSION = '1.1.12'
| mit | Python |
e8888966bbf8fb14974a8fefa593bc702a036b23 | update version | mongolab/mongoctl | mongoctl/version.py | mongoctl/version.py | __author__ = 'abdul'
MONGOCTL_VERSION = '0.9.3'
| __author__ = 'abdul'
MONGOCTL_VERSION = '0.9.2'
| mit | Python |
bd98acaf8fbdff8c219abd4118914682b768a11b | Remove some unused imports | MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS | server/api/v0/auth.py | server/api/v0/auth.py | from flask.ext.login import current_user, logout_user, login_user
from flask.ext.restful import Resource, abort, reqparse
from server.models import Lecturer, db
class LoginResource(Resource):
def get(self):
if current_user.is_active:
return {'username': current_user.full_name}
else:
... | import json
from flask import request
from flask.ext.login import current_user, logout_user, login_user
from flask.ext.restful import Resource, abort, requparse
from server.models import Lecturer, db
class LoginResource(Resource):
def get(self):
if current_user.is_active:
return {'username':... | mit | Python |
7e581faa4290cd6df01203da51884396efb710a7 | Fix for missing library | Cue/fast-python-pb | src/fastpb/template/setup.jinja.py | src/fastpb/template/setup.jinja.py | from distutils.core import setup, Extension
setup(name="{{ moduleName }}", version="1.0",
ext_modules=[
{% for name in files %}
Extension("{{ name }}", ["{{ name }}.c"], libraries=['protobuf']),
{% endfor %}
])
| from distutils.core import setup, Extension
setup(name="{{ moduleName }}", version="1.0",
ext_modules=[
{% for name in files %}
Extension("{{ name }}", ["{{ name }}.c"]),
{% endfor %}
])
| apache-2.0 | Python |
0df030e5ccc1fa31bfac4b04cbfc226ea9830c32 | add module import | PytLab/VASPy,PytLab/VASPy | vaspy/__init__.py | vaspy/__init__.py | __version__ = '0.2.10'
__all__ = ['atomco', 'electro', 'iter', 'matstudio', 'plotter']
class VasPy(object):
def __init__(self, filename):
"Base class to be inherited by all classes in VASPy."
self.filename = filename
class CarfileValueError(Exception):
"Exception raised for errors in the CON... | __version__ = '0.2.10'
class VasPy(object):
def __init__(self, filename):
"Base class to be inherited by all classes in VASPy."
self.filename = filename
class CarfileValueError(Exception):
"Exception raised for errors in the CONTCAR-like file."
pass
class UnmatchedDataShape(Exception):... | mit | Python |
cb638585737731647b07a6424cc48e5b0bc61ab1 | Update number-of-islands-ii.py | jaredkoontz/leetcode,yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,githubutilities/LeetCode,githubutilities/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-201... | Python/number-of-islands-ii.py | Python/number-of-islands-ii.py | # Time: O(klog*k) ~= O(k), k is the length of the positions
# Space: O(k)
class Solution(object):
def numIslands2(self, m, n, positions):
"""
:type m: int
:type n: int
:type positions: List[List[int]]
:rtype: List[int]
"""
def node_id(node, n):
r... | # Time: O(klog*k) ~= O(k), k is the length of the positions
# Space: O(k)
class Solution(object):
def numIslands2(self, m, n, positions):
"""
:type m: int
:type n: int
:type positions: List[List[int]]
:rtype: List[int]
"""
def node_id(node, n):
r... | mit | Python |
01d2bfd1ab7e3c19c1927e3a63503d7ba8704326 | Remove unused variable | abawchen/leetcode | solutions/403.py | solutions/403.py | # -*- coding: utf-8 -*-
"""
https://leetcode.com/problems/frog-jump/description/
A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.
Given a list of stones' positions (in units) in sorted ... | # -*- coding: utf-8 -*-
"""
https://leetcode.com/problems/frog-jump/description/
A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.
Given a list of stones' positions (in units) in sorted ... | mit | Python |
614dc515cd57fa0130ba90e45180ddbacef1b394 | make clang-rename.py vim integration python3 compatible | apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-cl... | tools/clang-rename/clang-rename.py | tools/clang-rename/clang-rename.py | '''
Minimal clang-rename integration with Vim.
Before installing make sure one of the following is satisfied:
* clang-rename is in your PATH
* `g:clang_rename_path` in ~/.vimrc points to valid clang-rename executable
* `binary` in clang-rename.py points to valid to clang-rename executable
To install, simply put this... | '''
Minimal clang-rename integration with Vim.
Before installing make sure one of the following is satisfied:
* clang-rename is in your PATH
* `g:clang_rename_path` in ~/.vimrc points to valid clang-rename executable
* `binary` in clang-rename.py points to valid to clang-rename executable
To install, simply put this... | apache-2.0 | Python |
5cd459b9d76732f8722597b60a373fbab33fcbd8 | Update the version ID. | volab/vor12,volab/vor12 | vor12/__init__.py | vor12/__init__.py | # -*- coding : utf-8 -*-
# VoR12
# The MIT License
#
# Copyright (c) 2015 Jeremie DECOCK (http://www.jdhp.org)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | # -*- coding : utf-8 -*-
# VoR12
# The MIT License
#
# Copyright (c) 2015 Jeremie DECOCK (http://www.jdhp.org)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | mit | Python |
d69d6f9cb84eab9ae943e0de7b7b2edbd1b9ec2e | Fix CLI help (#24). | 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
_MODULE_DESC = 'Python visual profiler'
_HOST = 'localhost'
_PROFILE_MAP = ... | bsd-2-clause | Python |
e33c680eca75c62c950465f56d0d7edf2ad82a5e | Update utils.py | Kaggle/learntools,Kaggle/learntools | notebooks/nb_utils/utils.py | notebooks/nb_utils/utils.py | import importlib
import os
import yaml
from nb_utils import track_metadata
def get_track_meta(track_dir, cfg):
parts = track_dir.split(os.path.sep)
pkg = '.'.join(filter(None, parts))
module_name = pkg + '.track_meta'
meta_module = importlib.import_module(module_name)
return track_metadata.TrackMe... | import importlib
import os
import yaml
from nb_utils import track_metadata
def get_track_meta(track_dir, cfg):
parts = track_dir.split(os.path.sep)
pkg = '.'.join(filter(None, parts))
module_name = pkg + '.track_meta'
meta_module = importlib.import_module(module_name)
return track_metadata.TrackM... | apache-2.0 | Python |
40ffa9f68ccf9d9a6a31c6619087e1e4457a174a | Bump version to 1.4.0 | TailorDev/Watson,TailorDev/Watson | watson/version.py | watson/version.py | # -*- coding: utf-8 -*-
version = "1.4.0"
| # -*- coding: utf-8 -*-
version = "1.3.2"
| mit | Python |
e164e11970bbc8000706b259e854c9f51f3700f9 | Make some changes to comments in example config.py | albert12132/templar,albert12132/templar | templar/config.py | templar/config.py | import os
import re
# Import various utilities from utils
# import templar.utils.html
# import templar.utils.filters
# Path of the current file -- best not to change this
FILEPATH = os.path.dirname(os.path.abspath(__file__))
##################
# Configurations #
##################
configurations = {
# List of di... | import os
import re
# Import various utilities from utils
# import templar.utils.html
# import templar.utils.filters
# Path of the current file -- best not to change this
FILEPATH = os.path.dirname(os.path.abspath(__file__))
configurations = {
# List of directories in which to search for templates
'TEMPLATE_D... | mit | Python |
9963b7e837c6bf7cd3288bc85b076d1570598f5e | change removeRoom method; now when remove the start room search a room with name that doesn't start with | develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms | trunk/editor/structdata/project.py | trunk/editor/structdata/project.py | #!/usr/bin/env python
from misc.odict import OrderedDict
from subject import Subject
class Project(Subject):
def __init__(self):
super(Project, self).__init__()
self.data = OrderedDict()
self.data['world'] = None
self.data['images'] = {}
self.data['items'] = OrderedDict()... | #!/usr/bin/env python
from misc.odict import OrderedDict
from subject import Subject
class Project(Subject):
def __init__(self):
super(Project, self).__init__()
self.data = OrderedDict()
self.data['world'] = None
self.data['images'] = {}
self.data['items'] = OrderedDict()... | mit | Python |
5f41cd6b73e4238f9d72b0c5c16707d0ffaa2b80 | remove unused import | ImmobilienScout24/alppaca,ImmobilienScout24/alppaca,ImmobilienScout24/afp-alppaca,ImmobilienScout24/afp-alppaca | src/main/python/alppaca/webapp.py | src/main/python/alppaca/webapp.py | from util import init_logging
from bottle import Bottle
from alppaca import IMSInterface
from alppaca.scheduler import configure_scheduler
local_host = '127.0.0.1'
local_port = 5000
ims_host = 'localhost'
ims_port = '8080'
logger = init_logging(False)
class WebApp(Bottle):
PATH = '/latest/meta-data/iam/secur... | from util import init_logging
from bottle import Bottle
from alppaca import IMSInterface
from alppaca.compat import OrderedDict
from alppaca.scheduler import configure_scheduler
local_host = '127.0.0.1'
local_port = 5000
ims_host = 'localhost'
ims_port = '8080'
logger = init_logging(False)
class WebApp(Bottle):
... | apache-2.0 | Python |
2c7aef2c0dbae34d3654d5e47ce6871b55f2f576 | Update find-minimum-in-rotated-sorted-array.py | kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,yiwen-luo/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,githubutilities/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,githubutilities/LeetCode,tudennis/LeetCode... | Python/find-minimum-in-rotated-sorted-array.py | Python/find-minimum-in-rotated-sorted-array.py | # Time: O(logn)
# Space: O(1)
#
# Suppose a sorted array is rotated at some pivot unknown to you beforehand.
#
# (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
#
# Find the minimum element.
#
# You may assume no duplicate exists in the array.
#
class Solution(object):
def findMin(self, nums):
"""
... | # Time: O(logn)
# Space: O(1)
#
# Suppose a sorted array is rotated at some pivot unknown to you beforehand.
#
# (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
#
# Find the minimum element.
#
# You may assume no duplicate exists in the array.
#
class Solution(object):
def findMin(self, nums):
"""
... | mit | Python |
b41c2952dbf3b128d8048d0fc9908bfc35f40da0 | Fix a variable name | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | openquake/commands/webui.py | openquake/commands/webui.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2016, GEM Foundation
# OpenQuake 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 Licen... | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2016, GEM Foundation
# OpenQuake 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 Licen... | agpl-3.0 | Python |
c1bc999aec15d3e0e9bc8960cb457518386d864f | Support base_name in rest urls for non model apis | NeCTAR-RC/horizon,NeCTAR-RC/horizon,NeCTAR-RC/horizon,NeCTAR-RC/horizon | openstack_dashboard/urls.py | openstack_dashboard/urls.py | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | apache-2.0 | Python |
8a46e9b38d68f2efb4b74f6e4c2dd7f57d8230b3 | Fix issues with mimic for people who don't use punctuation. (#82) | ibanner56/OtherDave | otherdave/commands/mimic.py | otherdave/commands/mimic.py | import markovify
import random
import re
_makeFailed = "hahaha Oof owie Heck, guess I don't know you well enough to do that."
loads = {}
def listen(message):
if(len(message.content.split(" ")) < 4):
return
user = message.author.id
content = message.content
if(not content.endswith(".")):
... | import markovify
import random
import re
loads = {}
def listen(message):
if(len(message.content.split(" ")) < 4):
return
user = message.author.id
if(user in loads):
loads[user] += "\n" + message.content
filename = "./data/markov/" + str(message.author.id) + ".txt"
with open(filen... | mit | Python |
c0d53ba23ecde161455f23eb78f638a09cafc43d | comment on variables and imports | AlexEaton1105/computerScience | arithmeticQuiz.py | arithmeticQuiz.py | import random #imports the default Python random module, which allows for random number generation
import time #imports the default Python time module, which allows for pauses in the prgram
counter = 1 #defines the counter, which counts up to 10 each time a question is asked
score = 0 #defines the user... | import random
import time
counter = 1
score = 0
numberOne = 0
numberTwo = 0
operator = 0
name = input("What is your name user? ")
while name == "":
time.sleep(1)
name = input("Hello, \nWhat is your name? ")
print("Weclome to the quiz,",name)
time.sleep(1)
def add(x, y):
return x + y;
def subtract (x, y):... | mit | Python |
9177254b80d27f2e4a22f7a570ba80856f8c8bd2 | Revert "Tries commenting django deafult wsgi lines" | dhiana/arpostits_api | arpostits/wsgi.py | arpostits/wsgi.py | """
WSGI config for arpostits project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "arpostits.settings")
from django.co... | """
WSGI config for arpostits project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
#import os
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "arpostits.settings")
#from django... | mit | Python |
c6d92d277016b2bbe732ed94fdbaaf77397c872b | Set task status to "rev" on promotion | westernx/sgpublish | sgpublish/versions.py | sgpublish/versions.py | from sgfs import SGFS
def promote_publish(publish, **kwargs):
publish.fetch((
'code',
'sg_version',
'created_by',
'description',
'sg_link',
'sg_link.Task.entity',
'sg_path_to_frames',
'sg_path_to_movie',
'sg_qt',
'project',
)... | from sgfs import SGFS
def promote_publish(publish, **kwargs):
publish.fetch((
'code',
'sg_version',
'created_by',
'description',
'sg_link',
'sg_link.Task.entity',
'sg_path_to_frames',
'sg_path_to_movie',
'sg_qt',
'project',
)... | bsd-3-clause | Python |
cf422a5bad7592b26155607d1c8c423e89f0e09f | Fix tests | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | test/test_gff3.py | test/test_gff3.py |
from sequana.gff3 import GFF3
from sequana import sequana_data
from easydev import TempFile
def test_gff():
gff = GFF3(sequana_data('test_small.gff3'))
df = gff.df
assert "telomere" in gff.features
def test_gff_rnadiff():
gff = GFF3(sequana_data('saccer3_truncated.gff'))
df = gff.df
gff.get_... |
from sequana.gff3 import GFF3
from sequana import sequana_data
from easydev import TempFile
def test_gff():
gff = GFF3(sequana_data('test_small.gff3'))
df = gff.get_df()
assert "telomere" in gff.get_types()
def test_gff_rnadiff():
gff = GFF3(sequana_data('saccer3_truncated.gff'))
df = gff.get_df... | bsd-3-clause | Python |
bc2bb81a4c3db8f3e544709b5a3c45a4494ed390 | break up the tests a bit, explain why status is kind of lame | lvh/pyopenssl,msabramo/pyOpenSSL,mitghi/pyopenssl,aalba6675/pyopenssl,rackerlabs/pyopenssl,elitest/pyopenssl,hynek/pyopenssl,r0ro/pyopenssl,EnerNOC/pyopenssl,sorenh/pyopenssl,kediacorporation/pyopenssl,hynek/pyopenssl,mschmo/pyopenssl,mitghi/pyopenssl,EnerNOC/pyopenssl,reaperhulk/pyopenssl,kjav/pyopenssl,kediacorporati... | test/test_rand.py | test/test_rand.py | # Copyright (C) Frederick Dean 2009, All rights reserved
"""
Unit tests for L{OpenSSL.rand}.
"""
from unittest import main
import os
import stat
from OpenSSL.test.util import TestCase
from OpenSSL import rand
class RandTests(TestCase):
def test_bytes(self):
"""
Verify that we can obtain bytes ... | # Copyright (C) Frederick Dean 2009, All rights reserved
"""
Unit tests for L{OpenSSL.rand}.
"""
from unittest import main
import os
import stat
from OpenSSL.test.util import TestCase
from OpenSSL import rand
class RandTests(TestCase):
def test_bytes(self):
"""
Verify that we can obtain bytes f... | apache-2.0 | Python |
c618876f971e81eddfe754ea8cf2787af7f24eca | Rename a test class | thombashi/typepy | test/test_type.py | test/test_type.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
import pytest
from typepy import StrictLevel
from typepy.type import Integer
class Test_TypeClass_repr(object):
@pytest.mark.parametrize(["type_class", "value", "strict_level"], [
[Integer, 0, StrictLevel.MIN],
[... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
import pytest
from typepy import StrictLevel
from typepy.type import Integer
class Test_DataPeroperty_repr:
@pytest.mark.parametrize(["type_class", "value", "strict_level"], [
[Integer, 0, StrictLevel.MIN],
[Inte... | mit | Python |
1e23d25e875d2c6d7d026c863bc2ecd9b4bb0a35 | Use acinclude.m4 as single source of project information. | fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb | share/doc/src/conf.py | share/doc/src/conf.py | ## Licensed under the Apache License, Version 2.0 (the "License"); you may not
## use this file except in compliance with the License. You may obtain a copy of
## the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed un... | ## Licensed under the Apache License, Version 2.0 (the "License"); you may not
## use this file except in compliance with the License. You may obtain a copy of
## the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed un... | apache-2.0 | Python |
1c3ce8c0948f8cba3928b01b5520eb7b0d842006 | fix typo--tried to slugify a slug that doesn't exit. | annaelde/forum-app,annaelde/forum-app,annaelde/forum-app | site/boards/models.py | site/boards/models.py | from django.contrib.auth import get_user_model
from django.db import models
from slugify import slugify
def slugify_board_name(name: str) -> str:
slug = name.replace('&', 'and')
return slugify(slug, max_length=64, separator='',
save_order=True, entities=False)
class Board(models.Model):
... | from django.contrib.auth import get_user_model
from django.db import models
from slugify import slugify
def slugify_board_name(name: str) -> str:
slug = name.replace('&', 'and')
return slugify(slug, max_length=64, separator='',
save_order=True, entities=False)
class Board(models.Model):
... | mit | Python |
1e7bcc4923f8a6870f586811e721b69d1c8654e2 | Add missing newline | machtfit/django-oscar,machtfit/django-oscar,machtfit/django-oscar | sites/sandbox/urls.py | sites/sandbox/urls.py | from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from oscar.app import shop
from apps.sitemaps import base_sitemaps
admin.autodiscover()
urlpatterns = [
# Include admin as convenience. It's unsupported and you should
# use the dashbo... | from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from oscar.app import shop
from apps.sitemaps import base_sitemaps
admin.autodiscover()
urlpatterns = [
# Include admin as convenience. It's unsupported and you should
# use the dashbo... | bsd-3-clause | Python |
234200453e67c1c439920b751cc1cf167ae574a3 | Update storage.py | ErinMorelli/em-slack-roll,ErinMorelli/em-slack-roll,ErinMorelli/em-slack-roll | slack_roll/storage.py | slack_roll/storage.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# pylint: disable=invalid-name
"""
Copyright (c) 2015-2021 Erin Morelli.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, includin... | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# pylint: disable=invalid-name
"""
Copyright (c) 2015-2021 Erin Morelli.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, includin... | mit | Python |
74ed90aa44580160f5cf0a45d15f84024a40920c | fix plugin for bilibili to adapt the new API | beardypig/streamlink,chhe/streamlink,back-to/streamlink,melmorabity/streamlink,beardypig/streamlink,wlerin/streamlink,bastimeyer/streamlink,gravyboat/streamlink,melmorabity/streamlink,javiercantero/streamlink,chhe/streamlink,back-to/streamlink,gravyboat/streamlink,bastimeyer/streamlink,streamlink/streamlink,wlerin/stre... | src/streamlink/plugins/bilibili.py | src/streamlink/plugins/bilibili.py | import hashlib
import re
import time
from requests.adapters import HTTPAdapter
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, validate, useragents
from streamlink.stream import HTTPStream
API_URL = "http://live.bilibili.com/api/playurl?cid={0}&player=1&quality=0&sign={1}&otype=json"
ROOM... | import hashlib
import re
import time
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, validate
from streamlink.stream import HTTPStream
API_URL = "http://live.bilibili.com/api/playurl?cid={0}&player=1&quality=0&sign={1}&otype=json"
API_SECRET = "95acd7f6cc3392f3"
SHOW_STATUS_ONLINE = 1
SHO... | bsd-2-clause | Python |
6df4aa0e7ea03a27ce50f8338d5287947a3bdb6f | Remove stale comment. | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | src/puzzle/heuristics/acrostic.py | src/puzzle/heuristics/acrostic.py | from puzzle.heuristics.acrostics import _acrostic_iter
class Acrostic(_acrostic_iter.Acrostic):
"""Best available Acrostic solver."""
pass
| from puzzle.heuristics.acrostics import _acrostic_iter
# The "naive acrostic" is currently the best one available.
class Acrostic(_acrostic_iter.Acrostic):
"""Best available Acrostic solver."""
pass
| mit | Python |
ea039a021a33284fb05f09e54cc7cc82cee93713 | fix for old Django | SujaySKumar/pythondotorg,malemburg/pythondotorg,lebronhkh/pythondotorg,lebronhkh/pythondotorg,lebronhkh/pythondotorg,malemburg/pythondotorg,SujaySKumar/pythondotorg,Mariatta/pythondotorg,proevo/pythondotorg,manhhomienbienthuy/pythondotorg,lsk112233/Clone-test-repo,berkerpeksag/pythondotorg,demvher/pythondotorg,lsk11223... | pages/middleware.py | pages/middleware.py | from django.conf import settings
from django import http
from django.utils.http import urlquote
from .models import Page
from .views import PageView
class PageFallbackMiddleware(object):
def get_queryset(self, request):
if request.user.is_staff:
return Page.objects.all()
else:
... | from django.conf import settings
from django import http
from django.utils.http import urlquote
from .models import Page
from .views import PageView
class PageFallbackMiddleware(object):
def get_queryset(self, request):
if request.user.is_staff:
return Page.objects.all()
else:
... | apache-2.0 | Python |
4f4d083ea8be7da6a4aecfd4bf15dc4e91a2d72d | Add method for final probability vector, which corresponds to all-photobleached collection. | grollins/palm | palm/blink_model.py | palm/blink_model.py | import numpy
from palm.aggregated_kinetic_model import AggregatedKineticModel
from palm.probability_vector import make_prob_vec_from_state_ids
from palm.state_collection import StateIDCollection
class BlinkModel(AggregatedKineticModel):
'''
BlinkModel is an AggregatedKineticModel. Two observation classes
a... | import numpy
from palm.aggregated_kinetic_model import AggregatedKineticModel
from palm.probability_vector import make_prob_vec_from_state_ids
from palm.state_collection import StateIDCollection
class BlinkModel(AggregatedKineticModel):
'''
BlinkModel is an AggregatedKineticModel. Two observation classes
a... | bsd-2-clause | Python |
b91399ad926b18e8d8e755e45addd0579a7a3891 | Handle mail errors more gracefully. Closes #648. | ibrahimcesar/panda,datadesk/panda,newsapps/panda,pandaproject/panda,pandaproject/panda,PalmBeachPost/panda,newsapps/panda,PalmBeachPost/panda,PalmBeachPost/panda,pandaproject/panda,pandaproject/panda,ibrahimcesar/panda,datadesk/panda,pandaproject/panda,ibrahimcesar/panda,datadesk/panda,NUKnightLab/panda,datadesk/panda,... | panda/utils/mail.py | panda/utils/mail.py | #!/usr/bin/env python
import logging
import socket
from django.core import mail
from livesettings import config_value
def get_connection():
return mail.get_connection(
host=config_value('EMAIL', 'EMAIL_HOST'),
port=config_value('EMAIL', 'EMAIL_PORT'),
# See http://bugs.python.org/issue848... | #!/usr/bin/env python
from django.core import mail
from livesettings import config_value
def get_connection():
return mail.get_connection(
host=config_value('EMAIL', 'EMAIL_HOST'),
port=config_value('EMAIL', 'EMAIL_PORT'),
# See http://bugs.python.org/issue8489
username=str(config_... | mit | Python |
939a96a93d959bf2c26da37adb672f5538c1f222 | Update base 62 id after paste creation. | ryanc/mmmpaste,ryanc/mmmpaste | mmmpaste/db.py | mmmpaste/db.py | from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from hashlib import md5
engine = create_engine("sqlite:///db/pastebin.db")
session = scoped_session(sessionmaker(bind = engine, autoflush = False))
Base = declarative_b... | from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from hashlib import md5
engine = create_engine("sqlite:///db/pastebin.db")
session = scoped_session(sessionmaker(bind = engine, autoflush = False))
Base = declarative_b... | bsd-2-clause | Python |
25905cd607923bf770c11ff25b6d451e9dc7c142 | remove dead code | kronenthaler/mod-pbxproj | pbxproj/__init__.py | pbxproj/__init__.py | # MIT License
#
# Copyright (c) 2016 Ignacio Calderon aka kronenthaler
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use,... | # MIT License
#
# Copyright (c) 2016 Ignacio Calderon aka kronenthaler
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use,... | mit | Python |
25e4e89cf062375cf1a27e8697a7d79b5c662296 | Fix one more flake8 error. | karamanolev/WhatManager2,grandmasterchef/WhatManager2,grandmasterchef/WhatManager2,MADindustries/WhatManager2,karamanolev/WhatManager2,davols/WhatManager2,karamanolev/WhatManager2,karamanolev/WhatManager2,MADindustries/WhatManager2,davols/WhatManager2,grandmasterchef/WhatManager2,davols/WhatManager2,grandmasterchef/Wha... | what_json/urls.py | what_json/urls.py | from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(r'^checks$', 'what_json.views.checks'),
url(r'^add_torrent$', 'what_json.views.add_torrent'),
url(r'^sync$', 'what_json.views.sync'),
url(r'^sync_replicas$', 'what_json.views.sync_replicas'),
url(r'^update_freele... | from django.conf.urls import patterns, include, url
urlpatterns = patterns(
'',
url(r'^checks$', 'what_json.views.checks'),
url(r'^add_torrent$', 'what_json.views.add_torrent'),
url(r'^sync$', 'what_json.views.sync'),
url(r'^sync_replicas$', 'what_json.views.sync_replicas'),
url(r'^upda... | mit | Python |
8b93372b18b8537dd0843eca10c4ca04a92e8ee7 | include full url to card | topher200/hearthstone_reddit_card_bot | generate_card_csv.py | generate_card_csv.py | """Fetches latest card names and links from hearthpwn.
Outputs to cards.csv.
"""
import bs4
import collections
import csv
import httplib2
import logging
import util
BANNED_CARD_LIST = [
"Blizzard",
]
def get_cards_from_page(url):
logging.info("getting cards from {}".format(url))
card_dict = collections.Orde... | """Fetches latest card names and links from hearthpwn.
Outputs to cards.csv.
"""
import bs4
import collections
import csv
import httplib2
import logging
import util
BANNED_CARD_LIST = [
"Blizzard",
]
def get_cards_from_page(url):
logging.info("getting cards from {}".format(url))
card_dict = collections.Orde... | mit | Python |
7e8bfc45559a5d0712014005afb8a21892e7e7a9 | Add docker compose installer | hatchery/Genepool2,hatchery/genepool | genes/docker/main.py | genes/docker/main.py | from genes.apt import commands as apt
from genes.brew import commands as brew
from genes.curl.commands import download
from genes.debian.traits import is_debian, get_codename
from genes.lib.traits import if_any_funcs
from genes.linux.traits import get_distro
from genes.mac.traits import is_osx
from genes.ubuntu.traits ... | from genes.apt import commands as apt
from genes.brew import commands as brew
from genes.debian.traits import is_debian, get_codename
from genes.lib.traits import if_any_funcs
from genes.linux.traits import get_distro
from genes.mac.traits import is_osx
from genes.ubuntu.traits import is_ubuntu
@if_any_funcs(is_ubun... | mit | Python |
bc0b78f9736351f37e265de483c69bcf4ec5bfba | Modify return type of mail.py for python3 | davenportw15/SnailMail,davenportw15/SnailMail,davenportw15/SnailMail | models/mail.py | models/mail.py | from datetime import datetime
from datetime import timedelta
from models.distance import time
from models.distance import dist
class Mail:
def __init__(self, db, users):
self.db = db
self.users = users
def create_mail(self, content, date_sent, sender, recipient, subject):
cursor = self.db.cursor()
delay ... | from datetime import datetime
from datetime import timedelta
from models.distance import time
from models.distance import dist
class Mail:
def __init__(self, db, users):
self.db = db
self.users = users
def create_mail(self, content, date_sent, sender, recipient, subject):
cursor = self.db.cursor()
delay ... | mit | Python |
a4129b39e87aa33cb20ef33736136e48f7df2bd2 | Bump version to 0.3. | berkerpeksag/astor,zackmdavis/astor | astor/__init__.py | astor/__init__.py | # -*- coding: utf-8 -*-
"""
Part of the astor library for Python AST manipulation.
License: BSD
Copyright 2012 (c) Patrick Maupin
Copyright 2013 (c) Berker Peksag
"""
__version__ = '0.3'
from astor.misc import iter_node, dump, all_symbols, get_anyop
from astor.misc import get_boolop, get_binop, get_cmpop, get_unar... | # -*- coding: utf-8 -*-
"""
Part of the astor library for Python AST manipulation.
License: BSD
Copyright 2012 (c) Patrick Maupin
Copyright 2013 (c) Berker Peksag
"""
__version__ = '0.2.1'
from astor.misc import iter_node, dump, all_symbols, get_anyop
from astor.misc import get_boolop, get_binop, get_cmpop, get_un... | bsd-3-clause | Python |
1a4a4d2c7372153577f5512f994860ca25db07ce | update consensus checker with masterchest and mymastercoins sites | grazcoin/mastercoin-tools,grazcoin/mastercoin-tools | msc_compare.py | msc_compare.py | #!/usr/bin/python
import os
import urllib2
from optparse import OptionParser
from msc_utils_validating import *
# get domain name from url
def url_to_domain(u):
return u.split('//')[1].split('.')[0]
#################################################################
# main function - compares mastercoin_verify of i... | #!/usr/bin/python
import os
import urllib2
from optparse import OptionParser
from msc_utils_validating import *
# get domain name from url
def url_to_domain(u):
return u.split('//')[1].split('.')[0]
#################################################################
# main function - compares mastercoin_verify of i... | agpl-3.0 | Python |
0f7a6cd5a904f1b9bd972d635756def53b575220 | Store str instead of int in the cache, to support more than just bug IDs (#724) | mozilla/relman-auto-nag,mozilla/bztools,mozilla/relman-auto-nag,mozilla/relman-auto-nag | auto_nag/cache.py | auto_nag/cache.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
from libmozdata import utils as lmdutils
from auto_nag import utils
class Cache(object):
d... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
from libmozdata import utils as lmdutils
from auto_nag import utils
class Cache(object):
d... | bsd-3-clause | Python |
be8be7d2f016935998513be9ac0f656b467cdcef | bump version | flyser/AutobahnPython,nucular/AutobahnPython,ewollesen/AutobahnPython,rapyuta/autobahn_rce,cachedout/AutobahnPython,dash-dash/AutobahnPython,crossbario/autobahn-python,oberstet/autobahn-python,bencharb/AutobahnPython,mcfletch/AutobahnPython,magnux/AutobahnPython,dash-dash/AutobahnPython,iffy/AutobahnPython,iffy/Autobah... | autobahn/setup.py | autobahn/setup.py | ###############################################################################
##
## Copyright 2011,2012 Tavendo GmbH
##
## 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
##
## ... | ###############################################################################
##
## Copyright 2011,2012 Tavendo GmbH
##
## 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
##
## ... | mit | Python |
437be4770898ebf4aa709cf96056bacc64d182e9 | fix typo | DavidPurcell/murano_temp,NeCTAR-RC/murano,NeCTAR-RC/murano,sajuptpm/murano,satish-avninetworks/murano,openstack/murano,satish-avninetworks/murano,openstack/murano,DavidPurcell/murano_temp,satish-avninetworks/murano,olivierlemasle/murano,NeCTAR-RC/murano,DavidPurcell/murano_temp,sajuptpm/murano,DavidPurcell/murano_temp,... | murano/opts.py | murano/opts.py | # Copyright (c) 2014 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... | # Copyright (c) 2014 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... | apache-2.0 | Python |
1ecc62d453a122443924b21cf04edf661f9d1878 | Add command line argument to set bot name | fenhl/mwikiircbot | mwikiircbot.py | mwikiircbot.py | import ircbotframe
import sys
class Handler:
def __init__(self, host, port=6667, name="MediaWiki", description="MediaWiki recent changes bot", channels=[]):
self.channels = channels
self.bot = ircbotframe.ircBot(host, port, name, description)
self.bot.bind("376", self.endMOTD)
self.... | import ircbotframe
import sys
class Handler:
def __init__(self, host, port=6667, name="MediaWiki", description="MediaWiki recent changes bot", channels=[]):
self.channels = channels
self.bot = ircbotframe.ircBot(host, port, name, description)
self.bot.bind("376", self.endMOTD)
self.... | mit | Python |
3d354860ca5aaf09490aa26af94d1a665f03928c | use pathlib 😍 | dpshelio/sunpy,dpshelio/sunpy,dpshelio/sunpy | sunpy/io/special/asdf/extension.py | sunpy/io/special/asdf/extension.py | from pathlib import Path
from asdf import AsdfExtension
from asdf.util import filepath_to_url
from .types import SunPyType
from .tags.map import *
from .tags.coordinates import *
__all__ = ['SunpyExtension']
SUNPY_SCHEMA_URI_BASE = 'http://sunpy.org/schemas/'
SCHEMA_PATH = Path(__file__).parent / "schemas"
SUNPY_... | import os
from asdf import AsdfExtension
from asdf.util import filepath_to_url
from .types import SunPyType
from .tags.map import *
from .tags.coordinates import *
__all__ = ['SunpyExtension']
SUNPY_SCHEMA_URI_BASE = 'http://sunpy.org/schemas/'
SCHEMA_PATH = os.path.abspath(
os.path.join(os.path.dirname(__fil... | bsd-2-clause | Python |
1cbf1438171d7a9f102352e8bf26a57e75c2634c | add verbosity option to fit | jakesnell/myshkin | myshkin/fit.py | myshkin/fit.py | from operator import add
import tensorflow as tf
from myshkin.util.feeder import reduce_batches
def fit(model, optimizer, train_feeder, valid_feeder, sess, n_epochs=100, callbacks=[], train_vars=None, verbose=False):
monitor_fields = list(set(reduce(add, [callback.get_monitor_fields() for callback in callbacks])... | from operator import add
import tensorflow as tf
from myshkin.util.feeder import reduce_batches
def fit(model, optimizer, train_feeder, valid_feeder, sess, n_epochs=100, callbacks=[], train_vars=None):
monitor_fields = list(set(reduce(add, [callback.get_monitor_fields() for callback in callbacks])))
if trai... | mit | Python |
ada208b47d3cca30198c0b95324ad49601d2b252 | fix intermittent ipython queue empty bug, fixes #16 | robchambers/nbserve | nbserve/app.py | nbserve/app.py | import flask
import nbserve
import os
flask_app = flask.Flask(nbserve.__progname__)
flask_app.config['DEBUG'] = True
from IPython.html.services.notebooks.filenbmanager import FileNotebookManager
nbmanager = FileNotebookManager(notebook_dir='.')
def set_working_directory(path):
if not os.path.exists(path):
... | import flask
import nbserve
import os
flask_app = flask.Flask(nbserve.__progname__)
flask_app.config['DEBUG'] = True
from IPython.html.services.notebooks.filenbmanager import FileNotebookManager
nbmanager = FileNotebookManager(notebook_dir='.')
def set_working_directory(path):
if not os.path.exists(path):
... | mit | Python |
9c92553aa79dba7efe5a8513954bfc632a4adf5d | Set version to v1.10.0c0. Another pre release. | karstenw/nodebox-pyobjc,karstenw/nodebox-pyobjc | nodebox/__init__.py | nodebox/__init__.py | __version__='1.10.0c0'
# py3 stuff
py3 = False
try:
unicode('')
punicode = unicode
pstr = str
punichr = unichr
except NameError:
punicode = str
pstr = bytes
py3 = True
punichr = chr
long = int
def get_version():
return __version__
| __version__='1.10.0'
# py3 stuff
py3 = False
try:
unicode('')
punicode = unicode
pstr = str
punichr = unichr
except NameError:
punicode = str
pstr = bytes
py3 = True
punichr = chr
long = int
def get_version():
return __version__
| mit | Python |
2b55f36a719da56e5736365e4ee7861572c223d5 | fix namespaces (no final slash) | arskom/spyne,arskom/spyne,arskom/spyne | spyne/const/xml_ns.py | spyne/const/xml_ns.py |
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This libra... |
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This libra... | lgpl-2.1 | Python |
dc9607da3075072017d6d568ed9bc4c6f11cbcea | Add more BQM benchmarks | dwavesystems/dimod,dwavesystems/dimod | benchmarks/bqm.py | benchmarks/bqm.py | # Copyright 2021 D-Wave Systems 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... | # Copyright 2019 D-Wave Systems 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... | apache-2.0 | Python |
996cab9efe8c1bbc9a6922b76b1982ce37dcdccd | Make queue_to_send a celery task | dragonfly-science/django-pigeonpost,dragonfly-science/django-pigeonpost | pigeonpost/tasks.py | pigeonpost/tasks.py | import datetime
import logging
from celery.task import task
from django.core.mail.backends.smtp import EmailBackend
from django.contrib.auth.models import User
from pigeonpost.models import ContentQueue, Outbox
logger = logging.getLogger('pigeonpost.tasks')
@task
def queue_to_send(sender, **kwargs):
# Check to... | import datetime
import logging
from celery.task import task
from django.core.mail.backends.smtp import EmailBackend
from django.contrib.auth.models import User
from pigeonpost.models import ContentQueue, Outbox
logger = logging.getLogger('pigeonpost.tasks')
def queue_to_send(sender, **kwargs):
# Check to see i... | mit | Python |
a62439db918305bd9b57d44c0cb1340d29fd4169 | Build output in a list before spitting it out wholly | eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog | 2018/markov-simple/markov-simple.py | 2018/markov-simple/markov-simple.py | # TODO: remove all debugging code for presentation
from collections import defaultdict, Counter
import random
import sys
# This is the length of the "state" the current character is predicted from.
# For Markov chains with memory, this is the "order" of the chain. For n-grams,
# n is STATE_LEN+1 since it includes the ... | # TODO: remove all debugging code for presentation
from collections import defaultdict, Counter
import random
import sys
# This is the length of the "state" the current character is predicted from.
# For Markov chains with memory, this is the "order" of the chain. For n-grams,
# n is STATE_LEN+1 since it includes the ... | unlicense | Python |
74fbcf2e1d655c5587b6ef0cb08691c13fcc54c5 | add json adapter for `timedelta` instances | pyfidelity/rest-seed,pyfidelity/rest-seed,pyfidelity/rest-seed | backend/restbase/__init__.py | backend/restbase/__init__.py | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.config import Configurator
from pyramid.renderers import JSON
from .models import db_session, metadata
from .principals ... | # -*- coding: utf-8 -*-
from datetime import datetime
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.config import Configurator
from pyramid.renderers import JSON
from .models import db_session, metadata
from .principals import get_... | bsd-2-clause | Python |
753a3bf8a37ace8dff9626bb1c6d867b4b8cee49 | Update TermTest.py | sumanta23/pyscript,sumanta23/pyscript | tests/TermTest.py | tests/TermTest.py | from pyscript import pyscript
import io
import unittest
import unicodedata
class TermTest(unittest.TestCase):
def exe(self,command):
session = pyscript.open("https://localhost:8443")
response = session.terminal().execute(command);
if type(response) is tuple:
filename = respons... | from pyscript import pyscript
import io
import unittest
import unicodedata
class TermTest(unittest.TestCase):
def exe(self,command):
session = pyscript.open("https://localhost:8443")
response = session.terminal().execute(command);
if type(response) is tuple:
filename = respons... | apache-2.0 | Python |
241a259dac6bfbdd390bdcaff3a1aebe2c8174b8 | set HGRCPATH so local hgrc's aren't loaded | beckjake/python3-hglib,beckjake/python3-hglib | tests/__init__.py | tests/__init__.py | import os, tempfile, sys, shutil
def setUp():
os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C'
os.environ['TZ'] = 'GMT'
os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>"
os.environ['CDPATH'] = ''
os.environ['COLUMNS'] = '80'
os.environ['GREP_OPTIONS'] = ''
os.env... | import os, tempfile, sys, shutil
def setUp():
os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C'
os.environ['TZ'] = 'GMT'
os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>"
os.environ['CDPATH'] = ''
os.environ['COLUMNS'] = '80'
os.environ['GREP_OPTIONS'] = ''
os.env... | mit | Python |
ab6e0d971530e972930efa1db0500b25a8449f75 | Remove logbook dependency. | ihuro/rq-scheduler,mbodock/rq-scheduler,lechup/rq-scheduler,cheungpat/rq-scheduler,sum12/rq-scheduler,peergradeio/rq-scheduler,ui/rq-scheduler | tests/__init__.py | tests/__init__.py | import unittest
from redis import StrictRedis
from rq import push_connection, pop_connection
def find_empty_redis_database():
"""Tries to connect to a random Redis database (starting from 4), and
will use/connect it when no keys are in there.
"""
for dbnum in range(4, 17):
testconn = StrictRed... | import unittest
from redis import StrictRedis
from logbook import NullHandler
from rq import push_connection, pop_connection
def find_empty_redis_database():
"""Tries to connect to a random Redis database (starting from 4), and
will use/connect it when no keys are in there.
"""
for dbnum in range(4, 1... | mit | Python |
97f58ddc46946640870acf7d0f3d950c46d380d3 | Disable health checks for distro builds | untitaker/vdirsyncer,untitaker/vdirsyncer,untitaker/vdirsyncer | tests/conftest.py | tests/conftest.py | # -*- coding: utf-8 -*-
'''
General-purpose fixtures for vdirsyncer's testsuite.
'''
import logging
import os
import click_log
from hypothesis import HealthCheck, Verbosity, settings
import pytest
@pytest.fixture(autouse=True)
def setup_logging():
click_log.basic_config('vdirsyncer').setLevel(logging.DEBUG)
... | # -*- coding: utf-8 -*-
'''
General-purpose fixtures for vdirsyncer's testsuite.
'''
import logging
import os
import click_log
from hypothesis import HealthCheck, Verbosity, settings
import pytest
@pytest.fixture(autouse=True)
def setup_logging():
click_log.basic_config('vdirsyncer').setLevel(logging.DEBUG)
... | mit | Python |
aa00c9aa2f235665cf8fffbcf432f89342fd6297 | fix info implementation | tsuru/varnishapi,tsuru/varnishapi | tests/managers.py | tests/managers.py | # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from varnishapi import storage
class FakeInstance(object):
def __init__(self, name):
self.name = name
self.bound = []
def bind(self... | # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from varnishapi import storage
class FakeInstance(object):
def __init__(self, name):
self.name = name
self.bound = []
def bind(self... | bsd-3-clause | Python |
22437477b4e368f41bbde19a1f54124553b3bf10 | add cipherLetter function | jjaniec/1ari-mp1 | src/JeffersonShell.py | src/JeffersonShell.py | import sys #For debug purposes
import random
from collections import Counter
FILEPATH = "../CreatedFile.txt"
FILENL = 15 #createCylinder(->n)
def convertLetter(text):
tmp_str = ""
for letter in text:
if letter.isalpha() and ord(letter) <= 123:
tmp_str += letter
retur... | import sys #For debug purposes
import random
from collections import Counter
FILEPATH = "../CreatedFile.txt"
FILENL = 15 #createCylinder(->n)
def convertLetter(text):
tmp_str = ""
for letter in text:
if letter.isalpha() and ord(letter) <= 123:
tmp_str += letter
retur... | unlicense | Python |
398ec3ecb95132245b6768ad7ee6c09d2e901431 | Remove unit test for config | ueg1990/imgur-cli | tests/test_cli.py | tests/test_cli.py | import sys
import fixtures
import imgurpython
import testtools
from unittest import mock
import imgur_cli.cli as cli
FAKE_ENV = {'IMGUR_CLIENT_ID': 'client_id',
'IMGUR_CLIENT_SECRET': 'client_secret',
'IMGUR_ACCESS_TOKEN': 'access_token',
'IMGUR_REFRESH_TOKEN': 'refresh_token',
... | import sys
import fixtures
import imgurpython
import testtools
from unittest import mock
import imgur_cli.cli as cli
FAKE_ENV = {'IMGUR_CLIENT_ID': 'client_id',
'IMGUR_CLIENT_SECRET': 'client_secret',
'IMGUR_ACCESS_TOKEN': 'access_token',
'IMGUR_REFRESH_TOKEN': 'refresh_token',
... | mit | Python |
e7ad2be6cdb87b84bfa77ff9824f2e9913c17599 | Revert "Fix unit test python3 compatibility." | bsvetchine/django-fusion-tables | tests/test_cmd.py | tests/test_cmd.py | import base64
import os
from distutils.core import Command
class TestCommand(Command):
description = "Launch all tests under fusion_tables app"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def create_client_secret_file(self):
clie... | import base64
import os
from distutils.core import Command
class TestCommand(Command):
description = "Launch all tests under fusion_tables app"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def create_client_secret_file(self):
clie... | mit | Python |
ea9a1480a4e6e595d210930026aa912991347425 | Use 'with' context instead of decorator | MisanthropicBit/bibpy,MisanthropicBit/bibpy | tests/test_doi.py | tests/test_doi.py | """Test getting entries from a doi."""
import bibpy
import bibpy.doi
import os
import pytest
import vcr
@pytest.mark.skipif(os.environ.get('TRAVIS', False),
reason='Do not test http requests on Travis')
def test_doi():
with vcr.use_cassette('fixtures/vcr_cassettes/doi.yaml'):
doi = '1... | """Test getting entries from a doi."""
import bibpy
import bibpy.doi
import os
import pytest
import vcr
@pytest.mark.skipif(os.environ.get('TRAVIS', False),
reason='Do not test http requests on Travis')
@vcr.use_cassette('fixtures/vcr_cassettes/doi.yaml')
def test_doi():
doi = '10.1145/101553... | mit | Python |
c9e4ce6e37bfbf04b26f390ded07e076b401527b | fix fru binary file | kontron/python-ipmi | tests/test_fru.py | tests/test_fru.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from nose.tools import eq_
from pyipmi.fru import (FruData, InventoryCommonHeader,
get_fru_inventory_from_file)
def test_frudata_object():
fru_field = FruData((0, 1, 2, 3))
eq_(fru_field.data[0], 0)
eq_(fru_field.data[1], 1)... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import eq_
from pyipmi.fru import (FruData, InventoryCommonHeader,
get_fru_inventory_from_file)
def test_frudata_object():
fru_field = FruData((0, 1, 2, 3))
eq_(fru_field.data[0], 0)
eq_(fru_field.data[1], 1)
eq_(f... | lgpl-2.1 | Python |
0a1caae2c396d6c24dd982d1cd4d41652c9899bb | Add support for 'add repository' for themes | thatsIch/sublime-rainmeter | theme_switcher.py | theme_switcher.py | # import os.path
import re
import sublime
import sublime_plugin
from . import logger
class EditThemeCommand(sublime_plugin.ApplicationCommand):
def run(self, theme):
"""
This will search all *.tmTheme files in the Rainmeter space and
tries to match it to the theme param. If no matching ... | # import os.path
import re
import sublime
import sublime_plugin
from . import logger
class EditThemeCommand(sublime_plugin.ApplicationCommand):
def run(self, theme):
"""
This will search all *.tmTheme files in the Rainmeter space and
tries to match it to the theme param. If no matching ... | mit | Python |
d607c084f0a32175cd256c244b65aaf861f319cd | Bump version to 0.1.1 final | OSSystems/lava-server,Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server | lava_scheduler_app/__init__.py | lava_scheduler_app/__init__.py | # Copyright (C) 2011 Linaro Limited
#
# Author: Michael Hudson-Doyle <michael.hudson@linaro.org>
#
# This file is part of LAVA Scheduler.
#
# LAVA Scheduler 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... | # Copyright (C) 2011 Linaro Limited
#
# Author: Michael Hudson-Doyle <michael.hudson@linaro.org>
#
# This file is part of LAVA Scheduler.
#
# LAVA Scheduler 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... | agpl-3.0 | Python |
3bbbf8810c2d218f8651a08ab48c09b5fd0eff76 | update import | TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl | AlphaTwirl/Concurrently/__init__.py | AlphaTwirl/Concurrently/__init__.py | from CommunicationChannel import CommunicationChannel
from CommunicationChannel0 import CommunicationChannel0
from TaskPackage import TaskPackage
from TaskPackageDropbox import TaskPackageDropbox
from MultiprocessingDropbox import MultiprocessingDropbox
from SubprocessRunner import SubprocessRunner
from WorkingArea imp... | from CommunicationChannel import CommunicationChannel
from CommunicationChannel0 import CommunicationChannel0
from TaskPackage import TaskPackage
from TaskPackageDropbox import TaskPackageDropbox
from MultiprocessingDropbox import MultiprocessingDropbox
from SubprocessRunner import SubprocessRunner
from WorkingArea imp... | bsd-3-clause | Python |
9adf7d2ef8e84ad660fac76c125d9541883d1e9c | Expand authors | microcom/partner-contact,brain-tec/partner-contact,microcom/partner-contact,brain-tec/partner-contact | base_location/__openerp__.py | base_location/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Contributor: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
# Ignacio Ibeas <ignacio@acysos.com>
# Alejandro Santana <ale... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Contributor: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
# Ignacio Ibeas <ignacio@acysos.com>
# Alejandro Santana <ale... | agpl-3.0 | Python |
8869e0dec7b3651f85367878f088ad8dad5b3354 | Add debug flag to feaLib command line utility | googlefonts/fonttools,fonttools/fonttools | Lib/fontTools/feaLib/__main__.py | Lib/fontTools/feaLib/__main__.py | from fontTools.misc.py23 import *
from fontTools.ttLib import TTFont
from fontTools.feaLib.builder import addOpenTypeFeatures, Builder
from fontTools.feaLib.error import FeatureLibError
from fontTools import configLogger
from fontTools.misc.cliTools import makeOutputFileName
import sys
import argparse
import logging
... | from fontTools.misc.py23 import *
from fontTools.ttLib import TTFont
from fontTools.feaLib.builder import addOpenTypeFeatures, Builder
from fontTools.feaLib.error import FeatureLibError
from fontTools import configLogger
from fontTools.misc.cliTools import makeOutputFileName
import sys
import argparse
import logging
... | mit | Python |
40a08503edef360bc2d07f1bfe5ecd37ffc4b1d1 | Add some basic pydoc documentation. | nullr0ute/oz,cernops/oz,imcleod/oz,moofrank/oz,NeilBryant/oz,nullr0ute/oz,clalancette/oz,mgagne/oz,clalancette/oz,NeilBryant/oz,ndonegan/oz,ndonegan/oz,mgagne/oz,cernops/oz,moofrank/oz,imcleod/oz | oz/__init__.py | oz/__init__.py | """
Class for automated operating system installation.
Oz is a set of classes to do automated operating system installation. It
has built-in knowledge of the proper things to do for each of the supported
operating systems, so the data that the user must provide is very minimal.
This data is supplied in the form of an... | lgpl-2.1 | Python | |
167c8c203cc2607fd3b80359de4b6064ac2e5234 | Bump version | graphql-python/graphene,graphql-python/graphene | graphene/__init__.py | graphene/__init__.py | from .pyutils.version import get_version
from .types import (
AbstractType,
ObjectType,
InputObjectType,
Interface,
Mutation,
Field,
InputField,
Schema,
Scalar,
String,
ID,
Int,
Float,
Boolean,
Date,
DateTime,
Time,
Decimal,
JSONString,
UU... | from .pyutils.version import get_version
from .types import (
AbstractType,
ObjectType,
InputObjectType,
Interface,
Mutation,
Field,
InputField,
Schema,
Scalar,
String,
ID,
Int,
Float,
Boolean,
Date,
DateTime,
Time,
Decimal,
JSONString,
UU... | mit | Python |
805e47677c20474377682277ee100f1ee7f21860 | Update tests/integration/test_corecli.py | dcos/dcos-cli,dcos/dcos-cli,dcos/dcos-cli,dcos/dcos-cli,dcos/dcos-cli | tests/integration/test_corecli.py | tests/integration/test_corecli.py | import json
import os
import sys
from concurrent import futures
import pytest
from .common import exec_cmd, default_cluster # noqa: F401
@pytest.mark.skipif(os.environ.get('DCOS_TEST_CORECLI') is None, reason="no core CLI bundle")
def test_extract_core(default_cluster):
code, out, err = exec_cmd(['dcos', 'plu... | import json
import os
import sys
from concurrent import futures
import pytest
from .common import exec_cmd, default_cluster # noqa: F401
@pytest.mark.skipif(os.environ.get('DCOS_TEST_CORECLI') is None, reason="no core CLI bundle")
def test_extract_core(default_cluster):
code, out, err = exec_cmd(['dcos', 'plu... | apache-2.0 | Python |
dfa1424896b015fe376c523e13d0a59ceacca298 | Test more than one thing | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | test/797-add-missing-boundaries.py | test/797-add-missing-boundaries.py | # NE data - no OSM elements
# boundary between NV and CA is _also_ a "statistical" boundary
assert_has_feature(
7, 21, 49, 'boundaries',
{ 'kind': 'state' })
# boundary between MT and ND is _also_ a "statistical meta" boundary
assert_has_feature(
7, 27, 44, 'boundaries',
{ 'kind': 'state' })
| # NE data - no OSM elements
# boundary between NV and CA is _also_ a "statistical" boundary
assert_has_feature(
7, 21, 49, 'boundaries',
{ 'kind': 'state' })
# boundary between MT and ND is _also_ a "statistical meta" boundary
assert_has_feature(
7, 21, 49, 'boundaries',
{ 'kind': 'state' })
| mit | Python |
a5bac33e87c9d9c638dbee971427099c1244ef4a | fix model error | kyunooh/JellyBlog,kyunooh/JellyBlog,kyunooh/JellyBlog | about_me/admin.py | about_me/admin.py | from django.contrib import admin
| from django.contrib import admin
from .models import Home, About, Usually, PortFolio, ETC, Contact
# Register your models here.
admin.site.register(Home)
admin.site.register(About)
admin.site.register(Usually)
admin.site.register(PortFolio)
admin.site.register(ETC)
admin.site.register(Contact)
| apache-2.0 | Python |
2967bf9e8e7443a4982f8c9cba5ae908e19e37c5 | Add game_count to user admin | Turupawn/website,lutris/website,Turupawn/website,lutris/website,lutris/website,lutris/website,Turupawn/website,Turupawn/website | accounts/admin.py | accounts/admin.py | from accounts import models
from django.contrib import admin
from django.core import urlresolvers
class UserAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'email', 'email_confirmed', 'is_staff',
'steamid', 'website', 'game_count', 'installers_link')
list_filter = ('is_staff', 'gro... | from accounts import models
from django.contrib import admin
from django.core import urlresolvers
class UserAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'email', 'email_confirmed', 'is_staff',
'steamid', 'website', 'installers_link')
list_filter = ('is_staff', 'groups')
sear... | agpl-3.0 | Python |
c428b2f2b9d30721484838a5abe0014635371c87 | Add filters on UserAdmin | lutris/website,lutris/website,Turupawn/website,lutris/website,Turupawn/website,Turupawn/website,Turupawn/website,lutris/website | accounts/admin.py | accounts/admin.py | from accounts import models
from django.contrib import admin
class UserAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'email', 'email_confirmed', 'is_staff',
'steamid', 'website')
list_filter = ('is_staff', 'groups')
search_fields = ('username', 'email')
admin.site.register(m... | from accounts import models
from django.contrib import admin
class UserAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'email', 'email_confirmed', 'steamid', 'website')
search_fields = ('username', 'email')
admin.site.register(models.User, UserAdmin)
| agpl-3.0 | Python |
dc7873bd77dbe29baac5ab118f50436495329ccc | fix version | transtats/transtats-cli,transtats/transtats-cli | tscli/__init__.py | tscli/__init__.py | # Copyright 2017 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2017 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python |
e8871bafe25e40f8854415ce1973389f2e73525a | fix the decorator "@wraps" to work on python < 2.5 | splbio/openobject-server,gisce/openobject-server,MarkusTeufelberger/openobject-server,MarkusTeufelberger/openobject-server,vnc-biz/openerp-server,ovnicraft/openerp-server,splbio/openobject-server,ovnicraft/openerp-server,xrg/openerp-server,MarkusTeufelberger/openobject-server,splbio/openobject-server,gisce/openobject-s... | bin/tools/func.py | bin/tools/func.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
#... | agpl-3.0 | Python |
33347270f114cdd014270ad4d0920ede3226fe5d | Refactor udp_server. | pozytywnie/elasticsearch-raven,serathius/elasticsearch-raven,socialwifi/elasticsearch-raven | bin/udp_server.py | bin/udp_server.py | #!/usr/bin/env python3
import base64
from datetime import datetime
import os
from queue import Queue
import socket
import sys
from threading import Thread
from elasticsearch_raven.transport import decode
from elasticsearch_raven.transport import ElasticsearchTransport
blocking_queue = Queue(maxsize=os.environ.get('Q... | #!/usr/bin/env python3
import base64
from datetime import datetime
import os
from queue import Queue
import socket
import sys
from threading import Thread
from elasticsearch_raven.transport import decode
from elasticsearch_raven.transport import ElasticsearchTransport
blocking_queue = Queue(maxsize=os.environ.get('Q... | mit | Python |
0cd054ed082dddbc8af9736379ffce03f281586d | comment for clarity | arq5x/poretools,arq5x/poretools | poretools/common.py | poretools/common.py | import os
import glob
import sys
def get_fast5_files(file):
# return as-is if list of files
if len(file) > 1:
return file
elif len(file) == 1:
# e.g. ['/path/to/dir'] or ['/path/to/file']
file = file[0]
# is it a directory or single file?
if os.path.isdir(file):
pattern = file + '/' + '*.fast5'
fil... | import os
import glob
import sys
def get_fast5_files(file):
# return as-is if list of files
if len(file) > 1:
return file
elif len(file) == 1:
file = file[0]
# is it a directory or single file?
if os.path.isdir(file):
pattern = file + '/' + '*.fast5'
files = glob.glob(pattern)
return files
else:... | mit | Python |
a1df1b3332fbfb2c5608df64dbc51d754212d8a7 | Update pdb_families.py | Rfam/rfam-production,Rfam/rfam-production,Rfam/rfam-production | pdb_mapping/pdb_families.py | pdb_mapping/pdb_families.py | import logging
import datetime
import os
import mysql.connector
from utils import RfamDB
rfam_search_url = "<https://rfam.org/family/{0}>"
pdb_search_url = "<https://www.rcsb.org/structure/{0}>"
def list_new_families():
"""
List new families with 3D structures
"""
conn = RfamDB.connect()
cursor... | import logging
import datetime
import mysql.connector
from utils import RfamDB
rfam_search_url = "<https://rfam.org/family/{0}>"
pdb_search_url = "<https://www.rcsb.org/structure/{0}>"
def list_new_families():
"""
List new families with 3D structures
"""
conn = RfamDB.connect()
cursor = conn.cu... | apache-2.0 | Python |
035ce3d67d44f2dacab607cf9a699ef451019c18 | test cases for AccountListView and IncomeListView | frekenbok/frekenbok,frekenbok/frekenbok,frekenbok/frekenbok | accountant/tests/test_views.py | accountant/tests/test_views.py | from django.test import TestCase
from django.views.generic.base import ContextMixin
from .test_data import prepare_test_data
from accountant.models import Account
from accountant.views import AccountantViewMixin, DashboardView, AccountListView, IncomeListView
class AccountantViewMixinTestCase(TestCase):
def set... | from django.test import TestCase
from django.views.generic.base import ContextMixin
from .test_data import prepare_test_data
from accountant.models import Account
from accountant.views import AccountantViewMixin, DashboardView
class AccountantViewMixinTestCase(TestCase):
def setUp(self):
self.mixin = Ac... | mit | Python |
b5713a79c4ae40bf1f8349857c5bf45b1d3fc241 | remove variations of particles | klingtnet/sblgntparser,klingtnet/sblgntparser,klingtnet/sblgntparser | data/particle_parser.py | data/particle_parser.py | #!/usr/bin/env python3
from pathlib import Path
import pprint
pp = pprint.PrettyPrinter()
import logging
log = logging.getLogger(__name__)
def main():
p = Path('particles-python_project.txt')
if p.exists() and p.is_file():
parse(str(p))
def parse(filepath):
raw = ''
try:
with open(fi... | #!/usr/bin/env python3
from pathlib import Path
import pprint
pp = pprint.PrettyPrinter()
import logging
log = logging.getLogger(__name__)
def main():
p = Path('particles-python_project.txt')
if p.exists() and p.is_file():
parse(str(p))
def parse(filepath):
raw = ''
try:
with open(fi... | mit | Python |
b98251cd24d4ee933139227e16898804e57ff4ca | add ids to fixtures | ericdill/databroker,ericdill/databroker | databroker/resource_registry/tests/conftest.py | databroker/resource_registry/tests/conftest.py | import pytest
from ..utils import create_test_database
def mongo_fs_factory():
from databroker.resource_registry import mongo as ffs
db_name = "fs_testing_base_disposable_{uid}"
test_conf = create_test_database(host='localhost',
port=27017, version=1,
... | import pytest
from ..utils import create_test_database
def mongo_fs_factory():
from databroker.resource_registry import mongo as ffs
db_name = "fs_testing_base_disposable_{uid}"
test_conf = create_test_database(host='localhost',
port=27017, version=1,
... | bsd-3-clause | Python |
09c4433d18e62519eff9889a798187563b1728c2 | Make sure we convert between str and bool representations of config values | sizlo/RPiFun,sizlo/RPiFun | pisite/motionSound/views.py | pisite/motionSound/views.py | from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.conf import settings
from logs.forms import LineCountForm
from motionSound.models import TextFile
import subprocess
import ConfigParser
def strToBool(configStr):
states = { '1': True, 'yes': True, 'true': True,... | from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.conf import settings
from logs.forms import LineCountForm
from motionSound.models import TextFile
import subprocess
import ConfigParser
# Create your views here.
def index(request):
configFile = get_object_or_40... | mit | Python |
e8291ded30454792e91b0dbb853bfaab44dcdec3 | Update plantcv/plantcv/rgb2gray.py | danforthcenter/plantcv,danforthcenter/plantcv,stiphyMT/plantcv,stiphyMT/plantcv,stiphyMT/plantcv,danforthcenter/plantcv | plantcv/plantcv/rgb2gray.py | plantcv/plantcv/rgb2gray.py | # RGB -> Gray
import cv2
import os
from plantcv.plantcv import params
from plantcv.plantcv._debug import _debug
def rgb2gray(rgb_img):
"""Convert image from RGB colorspace to Gray.
Inputs:
rgb_img = RGB image data
Returns:
gray = grayscale image
:param rgb_img: numpy.ndarray
:retu... | # RGB -> Gray
import cv2
import os
from plantcv.plantcv import params
from plantcv.plantcv._debug import _debug
def rgb2gray(rgb_img):
"""Convert image from RGB colorspace to Gray.
Inputs:
rgb_img = RGB image data
Returns:
gray = grayscale image
:param rgb_img: numpy.ndarray
:retu... | mit | Python |
f3817961fbfddd97e09f8efc4bd57c2448fb887b | Update sidebar background and menu items | PythonNepal/pythonnepal.github.io | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Python Users Group Nepal'
SITENAME = u'Python Users Group Nepal'
SITETITLE = AUTHOR
TAGLINE = u'#PyNepal'
SITEURL = ''
FAVICON_URL = 'https://www.python.org/static/favicon.ico'
DISPLAY_PAGES_ON_MENU = False
PATH = 'con... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Python Users Group Nepal'
SITENAME = u'Python Users Group Nepal'
SITETITLE = AUTHOR
TAGLINE = u'#PyNepal'
SITEURL = ''
FAVICON_URL = 'https://www.python.org/static/favicon.ico'
DISPLAY_PAGES_ON_MENU = False
PATH = 'con... | mit | Python |
e2f70ee238004b5f53efac9be6ba18d5dbde5224 | add links to social stuff and other UT CS groups | UTACM/utacm.org,UTACM/utacm.org,UTACM/utacm.org | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'William Ting'
SITENAME = u'Association for Computing Machinery'
TAGLINE = u'University of Texas Chapter'
SITEURL = ''
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when dev... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'William Ting'
SITENAME = u'Association for Computing Machinery'
TAGLINE = u'University of Texas Chapter'
SITEURL = ''
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when dev... | mit | Python |
772338ec5ff9f8e6e89a159cb0adec2e80a563e0 | Update configuration options | edwinksl/edwinksl.github.io,edwinksl/edwinksl.github.io,edwinksl/edwinksl.github.io,edwinksl/edwinksl.github.io | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
AUTHOR = 'Edwin Khoo'
SITENAME = 'Edwin Khoo'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/New_York'
DEFAULT_LANG = 'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEE... | #!/usr/bin/env python
AUTHOR = 'Edwin Khoo'
SITENAME = 'Edwin Khoo'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/New_York'
DEFAULT_LANG = 'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEE... | mit | Python |
6692cf714621525d9057f2c35e43a7d267f5e4ef | Fix requirements-parser import | treyhunner/pep438 | pep438/core.py | pep438/core.py | """Core pep438 utility functions"""
from __future__ import unicode_literals
import requests
import xmlrpclib
import lxml.html
from requirements import parse
def valid_package(package_name):
"""Return bool if package_name is a valid package on PyPI"""
response = requests.head('https://pypi.python.org/pypi/%s'... | """Core pep438 utility functions"""
from __future__ import unicode_literals
import requests
import xmlrpclib
import lxml.html
from reqfileparser import parse
def valid_package(package_name):
"""Return bool if package_name is a valid package on PyPI"""
response = requests.head('https://pypi.python.org/pypi/%s... | mit | Python |
edf6326f605b24208a0c70c09a1ee51f95ad5eb8 | Fix boolean env variable (#290) | alerta/alerta-contrib,alerta/alerta-contrib,alerta/alerta-contrib | plugins/amqp/alerta_amqp.py | plugins/amqp/alerta_amqp.py |
import logging
import os
from kombu import BrokerConnection, Exchange, Producer
from kombu.utils.debug import setup_logging
try:
from alerta.plugins import app # alerta >= 5.0
except ImportError:
from alerta.app import app # alerta < 5.0
from alerta.plugins import PluginBase
LOG = logging.getLogger('alert... |
import logging
import os
from kombu import BrokerConnection, Exchange, Producer
from kombu.utils.debug import setup_logging
try:
from alerta.plugins import app # alerta >= 5.0
except ImportError:
from alerta.app import app # alerta < 5.0
from alerta.plugins import PluginBase
LOG = logging.getLogger('alert... | mit | Python |
9e68e8e8a21b1ca59d2cd0cbdc096e398c25c92b | fix yaml warning | archangelic/pinhook | pinhook/cli.py | pinhook/cli.py | import click
from .bot import Bot
from marshmallow import Schema, fields, validate, INCLUDE
class Config(Schema):
nickname = fields.Str(required=True)
channels = fields.List(fields.Str(), required=True)
server = fields.Str(required=True)
port = fields.Int()
ops = fields.List(fields.Str())
ssl_r... | import click
from .bot import Bot
from marshmallow import Schema, fields, validate, INCLUDE
class Config(Schema):
nickname = fields.Str(required=True)
channels = fields.List(fields.Str(), required=True)
server = fields.Str(required=True)
port = fields.Int()
ops = fields.List(fields.Str())
ssl_r... | mit | Python |
2cf7ea0ab1f4fcaf259a101175c9a3198e755ffd | add changes to login_view | samitnuk/urlsaver_django,samitnuk/urlsaver_django | urlsaver/views.py | urlsaver/views.py | from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import HttpResponse
from .forms import (LoginForm, RegistrationForm,
EditForm, S... | from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import HttpResponse
from .forms import (LoginForm, RegistrationForm,
EditForm, SearchForm, RestorePasswordForm)
def main_view(reque... | mit | Python |
f6d092f37ac80513df9274deb6ec6ef20e57b519 | Fix judge not checking if connected component is maximal | lypnol/graph-theory | problem-01/judge.py | problem-01/judge.py | from judge import Judge
import networkx as nx
import random
class Problem01Judge(Judge):
def name(self):
return "Problem-01 Judge"
def config(self):
return {
'default_inputs': 1000
}
def generate_input(self):
n = random.randint(8, 20)
m = random.randi... | from judge import Judge
import networkx as nx
import random
class Problem01Judge(Judge):
def name(self):
return "Problem-01 Judge"
def config(self):
return {
'default_inputs': 1000
}
def generate_input(self):
n = random.randint(8, 20)
m = random.randi... | mit | Python |
85596643306a23d66c059ccae822364c05aca63a | Revert "better reload message" | Akuli/porcupine,Akuli/editor,Akuli/porcupine,Akuli/porcupine | porcupine/plugins/reload.py | porcupine/plugins/reload.py | """Reload file from disk when Ctrl+R is pressed."""
from tkinter import messagebox
from porcupine import get_tab_manager, menubar, tabs
def reload() -> None:
tab = get_tab_manager().select()
assert isinstance(tab, tabs.FileTab)
assert tab.path is not None
if not tab.is_saved():
user_says_yes... | """Reload file from disk when Ctrl+R is pressed."""
from tkinter import messagebox
from porcupine import get_tab_manager, menubar, tabs
def reload() -> None:
tab = get_tab_manager().select()
assert isinstance(tab, tabs.FileTab)
assert tab.path is not None
if not tab.is_saved():
user_says_yes... | mit | Python |
8589742cbe0f9b039b5c6fba1cb7512f99cbccd3 | Allow multiple loggers for future use | geniusgordon/NTHUOJ_web,nthuoj/NTHUOJ_web,henryyang42/NTHUOJ_web,henryyang42/NTHUOJ_web,drowsy810301/NTHUOJ_web,henryyang42/NTHUOJ_web,bbiiggppiigg/NTHUOJ_web,bruce3557/NTHUOJ_web,Changron/NTHUOJ_web,drowsy810301/NTHUOJ_web,bruce3557/NTHUOJ_web,geniusgordon/NTHUOJ_web,nthuoj/NTHUOJ_web,drowsy810301/NTHUOJ_web,nthuoj/NT... | utils/log_info.py | utils/log_info.py | """
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, ... | """
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, ... | mit | Python |
95c6dbba08271215f7d425d93746755198021e19 | Increment Vesper version to 0.4.9. | HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper | vesper/version.py | vesper/version.py | """
Module containing Vesper version.
This module is the authority regarding the Vesper version. Any other
module that needs the Vesper version should obtain it from this module.
"""
major_number = 0
minor_number = 4
patch_number = 9
suffix = ''
major_version = f'{major_number}'
minor_version = f'{major_version}.{m... | """
Module containing Vesper version.
This module is the authority regarding the Vesper version. Any other
module that needs the Vesper version should obtain it from this module.
"""
major_number = 0
minor_number = 4
patch_number = 9
suffix = 'b0'
major_version = f'{major_number}'
minor_version = f'{major_version}.... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.