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 |
|---|---|---|---|---|---|---|---|---|
f48f010391f2f17acaa62470e8ae532cf832dd36 | make script as an importable module | hemartin/hn-responder | hn-responder.py | hn-responder.py | #!/usr/bin/python
# coding: utf-8
import json
import re
import requests
from Queue import Queue
from requests_oauthlib import OAuth1
from threading import Thread
from firebase import firebase
with open('twitter-secrets.json') as twitter_secrets:
s = json.load(twitter_secrets)
access_token = s['access_t... | #!/usr/bin/python
import json
import re
import requests
from Queue import Queue
from requests_oauthlib import OAuth1
from threading import Thread
from firebase import firebase
with open('twitter-secrets.json') as twitter_secrets:
s = json.load(twitter_secrets)
access_token = s['access_token']
acces... | unlicense | Python |
e16f5d6b3837027e1b5178568701e1d4ff53287d | fix apikey | BlueHouseLab/sms-openapi,BlueHouseLab/sms-openapi,BlueHouseLab/sms-openapi,BlueHouseLab/sms-openapi,BlueHouseLab/sms-openapi,BlueHouseLab/sms-openapi,BlueHouseLab/sms-openapi,BlueHouseLab/sms-openapi,BlueHouseLab/sms-openapi | python/conf.py | python/conf.py | # -*- coding: utf-8 -*-
import base64
appid = 'example'
apikey = 'c5dd7e7dkjp27377l903c42c032b413b'
address = 'api.bluehouselab.com'
sender = '01000000000' # FIXME - MUST BE CHANGED AS REAL PHONE NUMBER
receivers = ['01000000000', ] # FIXME - MUST BE CHANGED AS REAL PHONE NUMBERS
content = u'λλ μ 리λ₯Ό λ¨Ήμ μ μμ΄μ. κ·Έ... | # -*- coding: utf-8 -*-
import base64
appid = 'example'
apikey = 'c5dd7e7dkjp27377l903c42c032b413b'
appid = 'test01'
apikey = '213d7e220f5c11e487a7040113e09101'
address = 'api.bluehouselab.com'
sender = '01000000000' # FIXME - MUST BE CHANGED AS REAL PHONE NUMBER
receivers = ['01000000000', ] # FIXME - MUST BE... | apache-2.0 | Python |
03a7fbe198ce8ed723d92af976fe03c7986098c8 | update imported path of utils module | faycheng/tpl,faycheng/tpl | tests/test_constructor.py | tests/test_constructor.py | import sys
import pytest
from tpl.path import TempFile
from tpl.constructor import construct_context_from_py
from candy.utils.faker import *
def test_construct_context_from_py():
with TempFile(random_lower_string(), 'py') as f:
f.fd.write('def construct():return {"key":"value"}')
f.fd.flush()
... | import sys
import pytest
from .faker import *
from tpl.path import TempFile
from tpl.constructor import construct_context_from_py
def test_construct_context_from_py():
with TempFile(random_lower_string(), 'py') as f:
f.fd.write('def construct():return {"key":"value"}')
f.fd.flush()
contex... | mit | Python |
9b6cd0cd7b86f63b365d2c1968fd19495b707758 | Exit with `1` if no fixed command selected | nvbn/thefuck,mlk/thefuck,scorphus/thefuck,mlk/thefuck,SimenB/thefuck,scorphus/thefuck,SimenB/thefuck,Clpsplug/thefuck,Clpsplug/thefuck,nvbn/thefuck | thefuck/main.py | thefuck/main.py | # Initialize output before importing any module, that can use colorama.
from .system import init_output
init_output()
from argparse import ArgumentParser
from warnings import warn
from pprint import pformat
import sys
from . import logs, types
from .shells import shell
from .conf import settings
from .corrector impor... | # Initialize output before importing any module, that can use colorama.
from .system import init_output
init_output()
from argparse import ArgumentParser
from warnings import warn
from pprint import pformat
import sys
from . import logs, types
from .shells import shell
from .conf import settings
from .corrector impor... | mit | Python |
9b439e486e4a4932f0e76bfb51a43db7e2de8ea8 | fix id resolver tests | biothings/biothings_explorer,biothings/biothings_explorer | tests/test_id_resolver.py | tests/test_id_resolver.py | import unittest
from biothings_explorer.id_resolver import IDResolver
class TestIDResolver(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.idr = IDResolver()
def test_genes_as_input(self):
inputs = [(['CXCR4', 'CXCR3', 'CXCR2'], 'SYMBOL', 'Gene')]
res = self.idr.resolve_... | import unittest
from biothings_explorer.id_resolver import IDResolver
class TestIDResolver(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.idr = IDResolver()
def test_input_genes(self):
inputs = [(['CXCR4', 'CXCR3', 'CXCR2'], 'symbol', 'Gene')]
res = self.idr.resolve_ids... | apache-2.0 | Python |
9a021c0cece225435ed650063210af4e815c9b2d | Make sure we shutdown the listener in the api service on SIGINT (CTRL+C). | dennybaa/st2,grengojbo/st2,Itxaka/st2,armab/st2,lakshmi-kannan/st2,Plexxi/st2,peak6/st2,lakshmi-kannan/st2,grengojbo/st2,nzlosh/st2,peak6/st2,nzlosh/st2,alfasin/st2,jtopjian/st2,punalpatel/st2,lakshmi-kannan/st2,Plexxi/st2,dennybaa/st2,peak6/st2,pixelrebel/st2,punalpatel/st2,jtopjian/st2,emedvedev/st2,StackStorm/st2,em... | st2api/st2api/cmd/api.py | st2api/st2api/cmd/api.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python |
375d762dcb92aa80f6d1b8d51f919c22a70e943f | Update huffman_code.py | autumind/huffman_code | huffman_code.py | huffman_code.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on Jul 22, 2015
@author: shenzb
'''
from Node import Node
import Utils
if __name__ == '__main__':
char_list = Utils.stringToPriorityQueue("hello, world!")
#print(char_list);
''' Initialize PriorityQueue '''
nodeList = []
for ch, cnt in c... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on Jul 22, 2015
@author: shenzb
'''
from Node import Node
import Utils
if __name__ == '__main__':
char_list = Utils.stringToPriorityQueue("hello, world!")
#print(char_list);
''' Initialize PriorityQueue '''
nodeList = []
for ch, cnt in c... | apache-2.0 | Python |
3c287abe48588917b115df92927647b33670a431 | Use textarea widget when editing note text | 11craft/immercv,11craft/immercv,11craft/immercv,11craft/immercv | immercv/cvgraph/forms.py | immercv/cvgraph/forms.py | from django import forms
from neomodel import DateProperty, IntegerProperty, StringProperty
from immercv.cvgraph.models import Note
PROPERTY_TYPE_FIELDS = {
# property-type: form-field-type,
DateProperty: forms.DateField,
IntegerProperty: forms.IntegerField,
StringProperty: forms.CharField,
}
NODE_... | from django import forms
from neomodel import DateProperty, IntegerProperty, StringProperty
PROPERTY_TYPE_FIELDS = {
# property-type: form-field-type,
DateProperty: forms.DateField,
IntegerProperty: forms.IntegerField,
StringProperty: forms.CharField,
}
def field_for_node_property(node_or_class, pro... | bsd-3-clause | Python |
a9af20426d7f30008d7cda863ba855679734c8a8 | Add a temporary fix for Django ticket 29917 | matthiask/django-cabinet,matthiask/django-cabinet,matthiask/django-cabinet | tests/testapp/settings.py | tests/testapp/settings.py | from __future__ import absolute_import, unicode_literals
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.admin",
"django.contrib.contenttypes",... | from __future__ import absolute_import, unicode_literals
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.admin",
"django.contrib.contenttypes",... | bsd-3-clause | Python |
75e65f6144820ba216166eee4417912394f8cdca | Stop using os.path.join, because Visual Studio can actually handle forward slash style paths, and the os.path method was creating mixed \\ and / style paths, b0rking everything. | kans/birgo,kans/birgo,kans/birgo,kans/birgo,kans/birgo | tools/bundle.py | tools/bundle.py | #!/usr/bin/env python
import os
import sys
import glob
import getopt
def file_list(path):
files = []
if os.path.isfile(path):
return [path]
for f in os.listdir(path):
new_dir = path + '/' + f
if os.path.isdir(new_dir) and not os.path.islink(new_dir):
files.extend(file_list(new_dir))
else... | #!/usr/bin/env python
import os
import sys
import glob
import getopt
def file_list(path):
files = []
if os.path.isfile(path):
return [path]
for f in os.listdir(path):
new_dir = os.path.join(path, f)
if os.path.isdir(new_dir) and not os.path.islink(new_dir):
files.extend(file_list(new_dir))
... | apache-2.0 | Python |
d1dd5242d3139b964f7a5485afd5a8ed672c4600 | Add tests for paragraph transform | mwilliamson/python-mammoth | tests/transforms_tests.py | tests/transforms_tests.py | import cobble
from nose.tools import assert_equal, istest
from mammoth import documents, transforms
from mammoth.transforms import get_descendants, get_descendants_of_type, _each_element
@istest
class ParagraphTests(object):
@istest
def paragraph_is_transformed(self):
paragraph = documents.paragraph(... | import cobble
from nose.tools import assert_equal, istest
from mammoth import documents
from mammoth.transforms import get_descendants, get_descendants_of_type, _each_element
@istest
class EachElementTests(object):
@istest
def all_descendants_are_transformed(self):
@cobble.data
class Count(do... | bsd-2-clause | Python |
7aef001c8ecff2b750106346a7b387b17b17b2aa | Clean up docstrings in hxl.__init__ per #118 | HXLStandard/libhxl-python,HXLStandard/libhxl-python | hxl/__init__.py | hxl/__init__.py | """Support library for the Humanitarian Exchange Language (HXL), version 1.0.
This library provides support for parsing, validating, cleaning, and
transforming humanitarian datasets that follow the HXL standard. Its
use will be familiar to developers who have worked with libraries like
U{JQuery<https://jquery.com>}. ... | """Support library for the Humanitarian Exchange Language (HXL), version 1.0.
This library provides support for parsing, validating, cleaning, and
transforming humanitarian datasets that follow the HXL standard. Its
use will be familiar to developers who have worked with libraries like
U{JQuery<https://jquery.com>}. ... | unlicense | Python |
b35d72da72a76060b67592e50441d3c2fcd32ee3 | fix for groups reverse url and for queryset filter | hddn/studentsdb,hddn/studentsdb,hddn/studentsdb | students/views/groups.py | students/views/groups.py | from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.views.generic import ListView, UpdateView, DeleteView, CreateView
from ..models import Group
from ..forms import GroupEditForm
from ..util import get_current_group
G... | from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.views.generic import ListView, UpdateView, DeleteView, CreateView
from ..models import Group
from ..forms import GroupEditForm
from ..util import get_current_group
G... | mit | Python |
71aa46a8dc0d82a12cd6041d090f3f9a9b1bbe75 | add arg for specifying webcam name | fchtngr/fotowebcam.eu-downloader | wallpaper_downloader.py | wallpaper_downloader.py | from lxml import html
from lxml import etree
import json
import requests
import urllib
import os
import argparse
import sys
###
### Downloads images from traunstein webcam. Skips download of existing files. Ignores images in blacklist file.
###
parser = argparse.ArgumentParser(description="Downloads bestof images fr... | from lxml import html
from lxml import etree
import json
import requests
import urllib
import os
import argparse
###
### Downloads images from traunstein webcam. Skips download of existing files. Ignores images in blacklist file.
###
parser = argparse.ArgumentParser(description="Downloads bestof images from Traunste... | mit | Python |
ffc5d0abbc03d67ebd320cb2af7d855e5124a20b | Update mails.py | troeger/opensubmit,troeger/opensubmit,troeger/opensubmit,troeger/opensubmit,troeger/opensubmit | web/opensubmit/mails.py | web/opensubmit/mails.py | from django.core.mail import EmailMessage
from django.core.urlresolvers import reverse
from opensubmit import settings
STUDENT_FAILED_SUB = 'Warning - Validation failed'
STUDENT_FAILED_MSG = '''
Hi,
this is a short notice that your submission for "%s" in "%s"
failed in the automated validation test.
Further infor... | from django.core.mail import EmailMessage
from django.core.urlresolvers import reverse
from opensubmit import settings
STUDENT_FAILED_SUB = 'Warning - Validation failed'
STUDENT_FAILED_MSG = '''
Hi,
this is a short notice that your submission for "%s" in "%s"
failed in the automated validation test.
Further infor... | agpl-3.0 | Python |
a86789998e3267ac9c7fd9ee916eedd5670f65f7 | Add a way to pretty-print JSON | GNOME/extensions-web,GNOME/extensions-web,GNOME/extensions-web,magcius/sweettooth,GNOME/extensions-web,magcius/sweettooth | sweettooth/decorators.py | sweettooth/decorators.py |
from django.shortcuts import get_object_or_404
from django.http import HttpResponse
from django.utils.safestring import mark_safe
import functools
import json
def model_view(model):
def inner(view):
@functools.wraps(view)
def new_view(request, pk, **kw):
obj = get_object_or_404(model,... |
from django.shortcuts import get_object_or_404
from django.http import HttpResponse
from django.utils.safestring import mark_safe
import functools
import json
def model_view(model):
def inner(view):
@functools.wraps(view)
def new_view(request, pk, **kw):
obj = get_object_or_404(model,... | agpl-3.0 | Python |
bddc1d9fff2ab749b5946f44d52ed0670c1ce801 | use @wraps to set the __name__ __module__ and __doc__ correctly for logged functions | matrix-org/synapse,iot-factory/synapse,illicitonion/synapse,matrix-org/synapse,iot-factory/synapse,howethomas/synapse,illicitonion/synapse,rzr/synapse,illicitonion/synapse,TribeMedia/synapse,rzr/synapse,TribeMedia/synapse,iot-factory/synapse,matrix-org/synapse,TribeMedia/synapse,illicitonion/synapse,matrix-org/synapse,... | synapse/util/logutils.py | synapse/util/logutils.py | # -*- coding: utf-8 -*-
# Copyright 2014 matrix.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 applicable law or... | # -*- coding: utf-8 -*-
# Copyright 2014 matrix.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 applicable law or... | apache-2.0 | Python |
dafef02f46d9413b0ff125e1f8e701b009ed66c9 | Disable logging for irco-explorer. | GaretJax/irco,GaretJax/irco,GaretJax/irco,GaretJax/irco | irco/scripts/explorer.py | irco/scripts/explorer.py | import argparse
from irco.explorer import app, database, filters
#from irco.logging import sentry
def main():
argparser = argparse.ArgumentParser('irco-explorer')
argparser.add_argument('-p', '--port', default=8000, type=int)
argparser.add_argument('-i', '--interface', default='127.0.0.1')
argparser.... | import argparse
from irco.explorer import app, database, filters
from irco.logging import sentry
def main():
argparser = argparse.ArgumentParser('irco-explorer')
argparser.add_argument('-p', '--port', default=8000, type=int)
argparser.add_argument('-i', '--interface', default='127.0.0.1')
argparser.a... | mit | Python |
89478bed86dfe4b522b2c38679410b4fb4b33979 | update to pythonwikibot changes | legoktm/legobot-old,legoktm/legobot-old | trunk/toolserver/fungi.py | trunk/toolserver/fungi.py | #!usr/bin/python
#-*- coding:utf-8 -*-
__version__ = '$Id$'
import re, time, sys, os
sys.path.append(os.environ['HOME'] + '/pywiki')
from pywikibot import wiki, pagegen, timedate
wiki.setUser('Legobot')
def do_project(page, putpage):
gen = pagegen.transclude(wiki.Page('Template' + page))
table = ''
for page in gen:... | #!usr/bin/python
__version__ = '$Id$'
import re, time, sys, os
sys.path.append(os.environ['HOME'] + '/pywiki')
from pywikibot import wiki, pagegen, timedate
wiki.setUser('Legobot')
def main():
gen = pagegen.transclude(wiki.Page('Template:WikiProject Fungi'))
table = ''
for page in gen:
table += do_page(page)
put... | mit | Python |
990c4dec9549908013616ed3daad2e8d9beaf33f | fix admin | bruecksen/isimip,bruecksen/isimip,bruecksen/isimip,bruecksen/isimip | isi_mip/contrib/admin.py | isi_mip/contrib/admin.py | from django.contrib import admin
from django.contrib.auth.models import User
from django.core import urlresolvers
from isi_mip.climatemodels.models import BaseImpactModel, Sector
class UserAdmin(admin.ModelAdmin):
list_display = ('username', 'email', 'first_name', 'last_name', 'get_model', 'get_sector')
list... | from django.contrib import admin
from django.contrib.auth.models import User
from django.core import urlresolvers
from isi_mip.climatemodels.models import BaseImpactModel
class UserAdmin(admin.ModelAdmin):
list_display = ('username', 'email', 'first_name', 'last_name', 'get_model')
list_filter = ('is_staff',... | mit | Python |
e7356e6ca1968d930f4fd348b48dcdd1cb9a02ab | Add ability to search tags by name | theatlantic/django-taggit2,decibyte/django-taggit,theatlantic/django-taggit,decibyte/django-taggit,theatlantic/django-taggit,theatlantic/django-taggit2 | taggit/admin.py | taggit/admin.py | from django.contrib import admin
from taggit.models import Tag, TaggedItem
class TaggedItemInline(admin.StackedInline):
model = TaggedItem
extra = 0
class TagAdmin(admin.ModelAdmin):
inlines = [
TaggedItemInline
]
ordering = ['name']
search_fields = ['name']
admin.site.register(Tag,... | from django.contrib import admin
from taggit.models import Tag, TaggedItem
class TaggedItemInline(admin.StackedInline):
model = TaggedItem
extra = 0
class TagAdmin(admin.ModelAdmin):
inlines = [
TaggedItemInline
]
ordering = ['name']
admin.site.register(Tag, TagAdmin)
| bsd-3-clause | Python |
c7a26e74deec3534525a1752bab5849f6b05566c | Improve readability | CubicComet/exercism-python-solutions | meetup/meetup.py | meetup/meetup.py | from datetime import date
class MeetupDayException(Exception):
pass
WEEKDAYS = {"Monday": 0, "Tuesday": 1, "Wednesday": 2, "Thursday": 3,
"Friday": 4, "Saturday": 5, "Sunday": 6}
TEENTH = {1:15, 2:16, 3:17, 4:18, 5:19, 6:13, 7:14}
ORDINAL = {"1st": 0, "2nd": 7, "3rd": 14, "4th": 21, "5th": 28}
d... | from datetime import date
class MeetupDayException(Exception):
pass
WEEKDAYS = {"Monday": 0, "Tuesday": 1, "Wednesday": 2, "Thursday": 3,
"Friday": 4, "Saturday": 5, "Sunday": 6}
TEENTH = {1:15, 2:16, 3:17, 4:18, 5:19, 6:13, 7:14}
ORDINAL = {"1st": 0, "2nd": 7, "3rd": 14, "4th": 21, "5th": 28}
d... | agpl-3.0 | Python |
51c708c8f7ff39c9f9cb197f48897a00fba2ab54 | Change WELT2000 import path to point to skylines' fork | Turbo87/skylines,Harry-R/skylines,skylines-project/skylines,shadowoneau/skylines,RBE-Avionik/skylines,skylines-project/skylines,Turbo87/skylines,shadowoneau/skylines,Harry-R/skylines,skylines-project/skylines,RBE-Avionik/skylines,shadowoneau/skylines,Harry-R/skylines,skylines-project/skylines,RBE-Avionik/skylines,Turbo... | skylines/lib/waypoints/welt2000.py | skylines/lib/waypoints/welt2000.py | import os
import subprocess
from flask import current_app
from .welt2000_reader import parse_welt2000_waypoints
def __get_database_file(dir_data):
path = os.path.join(dir_data, 'WELT2000.TXT')
# Create Welt2000 data folder if necessary
if not os.path.exists(os.path.dirname(path)):
os.makedirs(o... | import os
import subprocess
from flask import current_app
from .welt2000_reader import parse_welt2000_waypoints
def __get_database_file(dir_data):
path = os.path.join(dir_data, 'WELT2000.TXT')
# Create Welt2000 data folder if necessary
if not os.path.exists(os.path.dirname(path)):
os.makedirs(o... | agpl-3.0 | Python |
3aba7e7f654e492fb689b8030615658cae93c2d1 | Fix crashing when a user attempts to set usermode +o without /oper | Heufneutje/txircd,DesertBus/txircd,ElementalAlchemist/txircd | txircd/modules/umode_o.py | txircd/modules/umode_o.py | from txircd.modbase import Mode
class OperMode(Mode):
def checkSet(self, user, target, param):
user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - User mode o may not be set")
return False # Should only be set by the OPER command; hence, reject any normal setting of the mode
def c... | from txircd.modbase import Mode
class OperMode(Mode):
def checkSet(self, target, param):
return False # Should only be set by the OPER command; hence, reject any normal setting of the mode
def checkWhoFilter(self, user, targetUser, filters, fields, channel, udata):
if "o" in filters and no... | bsd-3-clause | Python |
552c4f70afe40af7aaf72a8c6061e09753397a2c | fix typo | SuperCowPowers/travis-wheels | wheel_upload.py | wheel_upload.py |
"""Push wheels up to S3 bucket"""
import boto
from boto.s3.key import Key
_bucket = 'workbench-wheels'
_key = 'py27/wheelhouse.tar.gz'
# Spin up the S3 connection
try:
conn = boto.connect_s3()
bucket = conn.get_bucket(_bucket)
mykey = bucket.get_key(_key)
if not mykey:
print 'Could not find k... |
"""Push wheels up to S3 bucket"""
import boto
from boto.s3.key import Key
_bucket = 'workbench-wheels'
_key = 'py27/wheelhouse.tar.gz'
# Spin up the S3 connection
try:
conn = boto.connect_s3()
bucket = conn.get_bucket(_bucket)
mykey = bucket.get_key(_key)
if not mykey:
print 'Could not find k... | mit | Python |
427c654fb3afd0a9fffc8bfced577f2416edd082 | Change to new format to present stroke drawing. | xrloong/Xie | xie/graphics/utils.py | xie/graphics/utils.py | class TextCodec:
STROKE_SEPERATOR = "/"
POINT_SEPERATOR = ","
PARAMETER_SEPERATOR = "."
START_POINT_PATTERN="0" + PARAMETER_SEPERATOR + "{0[0]}" + PARAMETER_SEPERATOR + "{0[1]}"
END_POINT_PATTERN="1" + PARAMETER_SEPERATOR + "{0[0]}" + PARAMETER_SEPERATOR + "{0[1]}"
CONTROL_POINT_PATTERN="2" + PARAMETER_SEPERATOR... | class TextCodec:
def __init__(self):
pass
def encodeStartPoint(self, p):
return "0{0[0]:02X}{0[1]:02X}".format(p)
def encodeEndPoint(self, p):
return "1{0[0]:02X}{0[1]:02X}".format(p)
def encodeControlPoint(self, p):
return "2{0[0]:02X}{0[1]:02X}".format(p)
def encodeStrokeExpression(self, pointExpress... | apache-2.0 | Python |
c3b0cc681b06ab5b8d64612d5c35fb27da56beeb | Fix port number detection in sabnzbd | Decipher/spksrc,astroganga/spksrc,mjoe/spksrc,markbastiaans/spksrc,Decipher/spksrc,mreppen/spksrc,saschpe/spksrc,schumi2004/spksrc,hadess/spksrc,mirweb/spksrc,mirweb/spksrc,jdierkse/spksrc,adrien-delhorme/spksrc,sea3pea0/spksrc,thunfischbrot/spksrc,mirweb/spksrc,Foncekar/spksrc,thunfischbrot/spksrc,lysin/spksrc,hmflash... | spk/sabnzbd/src/app/sabnzbd.cgi.py | spk/sabnzbd/src/app/sabnzbd.cgi.py | #!/usr/local/sabnzbd/env/bin/python
import os
import configobj
config = configobj.ConfigObj('/usr/local/sabnzbd/var/config.ini')
protocol = 'https' if int(config['misc']['enable_https']) else 'http'
https_port = int(config['misc']['port']) if len(config['misc']['https_port']) == 0 else int(config['misc']['https_port'... | #!/usr/local/sabnzbd/env/bin/python
import os
import configobj
config = configobj.ConfigObj('/usr/local/sabnzbd/var/config.ini')
protocol = 'https' if int(config['misc']['enable_https']) else 'http'
port = int(config['misc']['https_port']) if int(config['misc']['enable_https']) else int(config['misc']['port'])
print... | bsd-3-clause | Python |
41121f29cb868b9341ec505ba43eb4784104a2e5 | Add fixed find method for RIPEDatabase | fritz0705/lglass | lglass/database/whois.py | lglass/database/whois.py | # coding: utf-8
import socket
import lglass.rpsl
import lglass.database.base
@lglass.database.base.register
class WhoisClientDatabase(lglass.database.base.Database):
""" Simple blocking whois client database """
def __init__(self, hostspec):
self.hostspec = hostspec
def get(self, type, primary_key):
try:
... | # coding: utf-8
import socket
import lglass.rpsl
import lglass.database.base
@lglass.database.base.register
class WhoisClientDatabase(lglass.database.base.Database):
""" Simple blocking whois client database """
def __init__(self, hostspec):
self.hostspec = hostspec
def get(self, type, primary_key):
try:
... | mit | Python |
1e4efa9e9f73cb332dc5bc624cc6d2b10ff87864 | Replace six.iteritems() with .items() | openstack/vitrage,openstack/vitrage,openstack/vitrage | vitrage/utils/__init__.py | vitrage/utils/__init__.py | # -*- encoding: utf-8 -*-
# Copyright 2015 - Alcatel-Lucent
# Copyright Β© 2014-2015 eNovance
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
#
# Licensed under the Apache License, Version 2.0 (the... | # -*- encoding: utf-8 -*-
# Copyright 2015 - Alcatel-Lucent
# Copyright Β© 2014-2015 eNovance
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
#
# Licensed under the Apache License, Version 2.0 (the... | apache-2.0 | Python |
b11a7c8a4a8e80534edec320dac300066f59f08b | Remove needless line | uehara1414/kuso-wifi-server,uehara1414/kuso-wifi-server | web/docker_django/urls.py | web/docker_django/urls.py | from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('kuso_wifi_server.urls', namespace='kuso_wifi_server'))
]
| from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('kuso_wifi_server.urls', namespace='kuso_wifi_server')),
# url(r'^', include('docker_django.apps.kuso_wifi_server')),
]
| mit | Python |
091478221106ea0260f90fd957a4753fc9a5a714 | bump 0.1.2 | VeryCB/jos | jos/__init__.py | jos/__init__.py | __version__ = '0.1.2'
__author__ = 'VeryCB <imcaibin@gmail.com>'
| __version__ = '0.1.1'
__author__ = 'VeryCB <imcaibin@gmail.com>'
| mit | Python |
7c502dc033d729e49f7878ccf1359a6b36eba4fc | remove unused import | couchbase/cbmonitor,ronniedada/litmus,couchbase/cbmonitor,couchbase/cbagent,mikewied/cbagent,pavel-paulau/cbagent,ronniedada/litmus,vmx/cbagent | webapp/cbmonitor/views.py | webapp/cbmonitor/views.py | from django.shortcuts import render_to_response
def tab(request, path=None):
tab_name = {
None: "inventory",
"charts": "charts",
"snapshots": "snapshots"
}.get(path)
template = "{0}/{0}".format(tab_name) + ".jade"
return render_to_response(template, {tab_name: True})
| import inspect
from django.shortcuts import render_to_response
def tab(request, path=None):
tab_name = {
None: "inventory",
"charts": "charts",
"snapshots": "snapshots"
}.get(path)
template = "{0}/{0}".format(tab_name) + ".jade"
return render_to_response(template, {tab_name: T... | apache-2.0 | Python |
295931f9f499a7740e9856df186fe72940a8e0e5 | Prepare for next release | jfwood/keep,jfwood/keep | keep/version.py | keep/version.py | # Copyright 2010-2011 OpenStack LLC.
# 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 requi... | # Copyright 2010-2011 OpenStack LLC.
# 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 requi... | apache-2.0 | Python |
63f49bebadb0796ba3a4075bf430a65a16833733 | remove my test realm | mhorowitz/pykrb5 | krb5/network.py | krb5/network.py | import socket
import struct
from . import types
class KDCConnection(object):
def __init__(self, addr):
self.addr = addr
@staticmethod
def recv_all(socket, count):
data = ""
while count > 0:
buf = socket.recv(count)
if buf == "":
return data
... | import socket
import struct
from . import types
class KDCConnection(object):
def __init__(self, addr):
self.addr = addr
@staticmethod
def recv_all(socket, count):
data = ""
while count > 0:
buf = socket.recv(count)
if buf == "":
return data
... | bsd-2-clause | Python |
99357ceafe432e9f0bcc4278ec3a90d9f923e074 | disable 'children.csv' as well (500k records, no thank you) | hsr-ba-fs15-dat/opendatahub,hsr-ba-fs15-dat/opendatahub,hsr-ba-fs15-dat/opendatahub,hsr-ba-fs15-dat/opendatahub,hsr-ba-fs15-dat/opendatahub | src/main/python/hub/tests/tests_fixtures.py | src/main/python/hub/tests/tests_fixtures.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework.test import APITestCase
from hub.management.commands.loadfixtures import Command as LoadFixtures
class FixtureTest(APITestCase):
@classmethod
def setUpClass(cls):
cls.format_list = [fmt['name'] for fmt in client.get(... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework.test import APITestCase
from hub.management.commands.loadfixtures import Command as LoadFixtures
class FixtureTest(APITestCase):
@classmethod
def setUpClass(cls):
cls.format_list = [fmt['name'] for fmt in client.get(... | mit | Python |
0421087e7feb3bd2c8386b41df6cdba58a3b35a1 | Update notice | plus1s/shadowsocks-py-mu,plus1s/shadowsocks-py-mu | shadowsocks/config_example.py | shadowsocks/config_example.py | # !!! Please rename this file as config.py BEFORE editing it !!!
import logging
# !!! Only edit this line when you update your configuration file !!!
# After you update, the value of CONFIG_VERSION in config.py and
# config_example.py should be the same in order to start the server
CONFIG_VERSION = '20160623-1'
# Dat... | # !!! Please rename this file as config.py BEFORE editing it !!!
import logging
# !!! Do NOT touch this line !!!
CONFIG_VERSION = '20160623-1'
# Database Config
MYSQL_HOST = 'mengsky.net'
MYSQL_PORT = 3306
MYSQL_USER = 'root'
MYSQL_PASS = 'root'
MYSQL_DB = 'shadowsocks'
MYSQL_USER_TABLE = 'user'
MYSQL_TIMEOUT = 30
#... | apache-2.0 | Python |
0b7730e97a64e87a1d0d5ba27290f56fd057ce26 | use a_0_0 in lode.py | tkf/railgun,tkf/railgun | samples/lode/lode.py | samples/lode/lode.py | from railgun import SimObject, relpath
class LinearODE(SimObject):
"""
Solve D-dimensional linear ordinary differential equations
Equation::
dX/dt(t) = A X(t)
X: D-dimensional vector
A: DxD matrix
"""
_clibname_ = 'liblode.so' # name of shared library
_clibdir_ = re... | from railgun import SimObject, relpath
class LinearODE(SimObject):
"""
Solve D-dimensional linear ordinary differential equations
Equation::
dX/dt(t) = A X(t)
X: D-dimensional vector
A: DxD matrix
"""
_clibname_ = 'liblode.so' # name of shared library
_clibdir_ = re... | mit | Python |
72c856a83d6dd538d6832027bf335f5ee3a70c30 | Print in a way that's valid constructor | PythonScanClient/PyScanClient,PythonScanClient/PyScanClient | scan/commands/Comment.py | scan/commands/Comment.py | '''
Created on Mar 8,2015
@author: qiuyx
'''
from scan.commands.Command import Command
import xml.etree.ElementTree as ET
class Comment(Command):
'''
Command to add comment.
SubClass of Command
'''
def __init__(self, text="This is an example comment."):
'''
@param text: Commen... | '''
Created on Mar 8,2015
@author: qiuyx
'''
from scan.commands.Command import Command
import xml.etree.ElementTree as ET
class Comment(Command):
'''
Command to add comment.
SubClass of Command
'''
def __init__(self, text="This is an example comment."):
'''
@param text: Commen... | epl-1.0 | Python |
e316576e519dbf1b0f96726cfa431c7e112d850a | Add docstirng for Plot | openworm/PyOpenWorm,gsarma/PyOpenWorm,gsarma/PyOpenWorm,openworm/PyOpenWorm | PyOpenWorm/plot.py | PyOpenWorm/plot.py | from PyOpenWorm import *
class Plot(DataObject):
"""
Object for storing plot data in PyOpenWorm.
Parameters
----------
data : 2D list (list of lists)
List of XY coordinates for this Plot.
Example usage ::
>>> pl = Plot([[1, 2], [3, 4]])
>>> pl.get_data()
# [[... | from PyOpenWorm import *
class Plot(DataObject):
"""
Object for storing plot data in PyOpenWorm.
Must be instantiated with a 2D list of coordinates.
"""
def __init__(self, data=False, *args, **kwargs):
DataObject.__init__(self, **kwargs)
Plot.DatatypeProperty('_data_string', self... | mit | Python |
10981892c236658dd3d4d9cd6caceedf300088bb | Remove unused import | erinspace/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,jeffreyliu3230/scrapi,icereval/scrapi,fabianvf/scrapi,mehanig/scrapi,ostwald/scrapi,mehanig/scrapi,felliott/scrapi,alexgarciac/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi | scripts/rename.py | scripts/rename.py | import logging
from cqlengine import Token
from scrapi import settings
from scrapi.database import _manager
from scrapi.linter import RawDocument
from scrapi.processing.elasticsearch import es
from scrapi.processing.cassandra import DocumentModel
from scrapi.tasks import normalize, process_normalized, process_raw
_m... | import logging
from cqlengine import Token, BatchQuery
from scrapi import settings
from scrapi.database import _manager
from scrapi.linter import RawDocument
from scrapi.processing.elasticsearch import es
from scrapi.processing.cassandra import DocumentModel
from scrapi.tasks import normalize, process_normalized, pro... | apache-2.0 | Python |
16fa50ae128b19479484a2f3d9c2c8b77f4c27b4 | Remove the test for abspath with an empty path - too hard to do in a cross-platform manner. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_ntpath.py | Lib/test/test_ntpath.py | import ntpath
import string
import os
errors = 0
def tester(fn, wantResult):
fn = string.replace(fn, "\\", "\\\\")
gotResult = eval(fn)
if wantResult != gotResult:
print "error!"
print "evaluated: " + str(fn)
print "should be: " + str(wantResult)
print " returned: " + str(gotResult)
print ""
global err... | import ntpath
import string
import os
errors = 0
def tester(fn, wantResult):
fn = string.replace(fn, "\\", "\\\\")
gotResult = eval(fn)
if wantResult != gotResult:
print "error!"
print "evaluated: " + str(fn)
print "should be: " + str(wantResult)
print " returned: " + str(gotResult)
print ""
global err... | mit | Python |
d59f6412c6f3103e6bd36f23ad9b0eb86b9c6069 | fix what was likely a typo, and make a default return value | fabianvf/scrapi,alexgarciac/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,erinspace/scrapi,mehanig/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,erinspace/scrapi,felliott/scrapi | scrapi/harvesters/bhl.py | scrapi/harvesters/bhl.py | """Harvests Biodiversity Heritage Library OAI Repository (BHL) metadata for ingestion into the SHARE service.
Example API call: http://www.biodiversitylibrary.org/oai?verb=ListRecords&metadataPrefix=oai_dc&from=2015-02-01
"""
import re
from scrapi.base import OAIHarvester
from scrapi.base.helpers import updated_schema,... | """Harvests Biodiversity Heritage Library OAI Repository (BHL) metadata for ingestion into the SHARE service.
Example API call: http://www.biodiversitylibrary.org/oai?verb=ListRecords&metadataPrefix=oai_dc&from=2015-02-01
"""
import re
from scrapi.base import OAIHarvester
from scrapi.base.helpers import updated_schema,... | apache-2.0 | Python |
f39d97d20b176bd5549714288643f04ee5d441c3 | add __all__ for import * | amaxwell/datatank_py | datatank_py/__init__.py | datatank_py/__init__.py | #!/usr/bin/env python
# coding: utf-8
# from glob import glob
# [x.strip(".py") for x in glob("*.py")]
__all__ = ['DTBitmap2D', 'DTDataFile', 'DTError', 'DTMask', 'DTMesh2D', 'DTPath2D', 'DTPathValues2D', 'DTPlot1D', 'DTPoint2D', 'DTPointCollection2D', 'DTPointValue2D', 'DTPointValueCollection2D', 'DTProgress', 'DTPy... | bsd-3-clause | Python | |
550dee3e13a0ee80d0bd9338c281e51fefdcfdc8 | Add format with slack attachments. | mathiasose/slacker_log_handler | slack_log_handler/__init__.py | slack_log_handler/__init__.py | import json
import traceback
from logging import Handler
from slacker import Slacker
class SlackLogHandler(Handler):
def __init__(self, api_key, channel, stack_trace=False, username='Python logger', icon_url=None, icon_emoji=None):
Handler.__init__(self)
self.slack_chat = Slacker(api_key)
... | import traceback
from logging import Handler
from slacker import Chat
class SlackLogHandler(Handler):
def __init__(self, api_key, channel, stack_trace=False, username='Python logger', icon_url=None, icon_emoji=None):
Handler.__init__(self)
self.slack_chat = Chat(api_key)
self.channel = ch... | apache-2.0 | Python |
c88cdf8c10def4b6a2be5556a04e793fe571053c | fix transaction management for 1.6 | nyaruka/smartmin,nyaruka/smartmin,caktus/smartmin,caktus/smartmin,caktus/smartmin,nyaruka/smartmin,caktus/smartmin | smartmin/csv_imports/tasks.py | smartmin/csv_imports/tasks.py | import StringIO
from smartmin import class_from_string
from django.utils import timezone
from .models import ImportTask
from time import sleep
from distutils.version import StrictVersion
import django
from celery.task import task
@task(track_started=True)
def csv_import(task_id): #pragma: no cover
from django.db... | import StringIO
from smartmin import class_from_string
from django.utils import timezone
from .models import ImportTask
from time import sleep
from celery.task import task
@task(track_started=True)
def csv_import(task_id): #pragma: no cover
from django.db import transaction
# there is a possible race condit... | bsd-3-clause | Python |
fa5a279a4585ce1c2ae04e15191020a057c49c2d | Replace `property.SingleResource` with (newer) `reference.SingleResource`. | ZeitOnline/zeit.content.portraitbox | src/zeit/content/portraitbox/portraitbox.py | src/zeit/content/portraitbox/portraitbox.py |
from zeit.cms.i18n import MessageFactory as _
import lxml.builder
import lxml.objectify
import zeit.cms.content.property
import zeit.cms.content.reference
import zeit.cms.content.xmlsupport
import zeit.cms.interfaces
import zeit.cms.type
import zeit.content.portraitbox.interfaces
import zeit.wysiwyg.html
import zope.i... |
from zeit.cms.i18n import MessageFactory as _
import lxml.builder
import lxml.objectify
import zeit.cms.content.property
import zeit.cms.content.xmlsupport
import zeit.cms.interfaces
import zeit.cms.type
import zeit.content.portraitbox.interfaces
import zeit.wysiwyg.html
import zope.interface
class Portraitbox(zeit.... | bsd-3-clause | Python |
50f3804301549cbba1c1ca6d2bc5fb1d2e500d12 | make sure output dir exists | autopulated/expose-defs | scripts/processConfig.py | scripts/processConfig.py | #! /usr/bin/env python
# This is an example of using a pre-build script to process the merged config
# file, to generate a header (prebuild-demo/defs.h), which can be #included by
# other modules
import json
import os
def generateDefinitions(config):
definitions = ''
expose_definitions = '$exposeDef' in con... | #! /usr/bin/env python
# This is an example of using a pre-build script to process the merged config
# file, to generate a header (prebuild-demo/defs.h), which can be #included by
# other modules
import json
import os
def generateDefinitions(config):
definitions = ''
expose_definitions = '$exposeDef' in con... | isc | Python |
ed68bd18b88f349a7348006a2e14cdddbc993da7 | Upgrade libchromiumcontent to Chrome 37. | beni55/electron,gbn972/electron,chrisswk/electron,mrwizard82d1/electron,Andrey-Pavlov/electron,yan-foto/electron,roadev/electron,abhishekgahlot/electron,MaxWhere/electron,nicholasess/electron,Jonekee/electron,synaptek/electron,edulan/electron,tincan24/electron,faizalpribadi/electron,davazp/electron,tylergibson/electron... | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
NODE_VERSION = 'v0.11.13'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'ea1a7e85a3de1878e5656110c76f4d2d8af41c6e'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[... | #!/usr/bin/env python
import platform
import sys
NODE_VERSION = 'v0.11.13'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'afb4570ceee2ad10f3caf5a81335a2ee11ec68a5'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[... | mit | Python |
ca79a5a66638b08b551471eeca85d75ebae61218 | make it executable | geovedi/nmt-playground,geovedi/nmt-playground | scripts/bleu_sent.py | scripts/bleu_sent.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import io
import fire
from nltk.translate.bleu_score import SmoothingFunction, sentence_bleu
def main(ref, hyp, out):
smoothing_func = SmoothingFunction()
with io.open(out, 'w', encoding='utf-8') as out_f, \
io.open(ref, 'r', encoding='utf-8') as ref_f, ... | # -*- coding: utf-8 -*-
import io
import fire
from nltk.translate.bleu_score import SmoothingFunction, sentence_bleu
def main(ref, hyp, out):
smoothing_func = SmoothingFunction()
with io.open(out, 'w', encoding='utf-8') as out_f, \
io.open(ref, 'r', encoding='utf-8') as ref_f, \
io.open(hyp,... | mit | Python |
f20156beb47f860646f31b46ff69879e190d220d | Add job console output to firebase | MDTsai/webcompat-system-addon-autotest | scripts/postbuild.py | scripts/postbuild.py | #!/usr/bin/python3
import sys
import jenkins
from firebase import firebase
JENKINS_URL = '' # Enter Jenkins URL like http://localhost:8080
JENKINS_USERNAME = '' # Enter available Jenkins username
JENKINS_APITOKEN = '' # Enter Jenkins API token (or password if Jenkins < 1.5)
FIREBASE_DSN = '' # Enter your firebase ... | #!/usr/bin/python3
import sys
import jenkins
from firebase import firebase
JENKINS_URL = '' # Enter Jenkins URL like http://localhost:8080
JENKINS_USERNAME = '' # Enter available Jenkins username
JENKINS_APITOKEN = '' # Enter Jenkins API token (or password if Jenkins < 1.5)
FIREBASE_DSN = '' # Enter your firebase ... | mpl-2.0 | Python |
5cdccbf7a6c3ff15ff66ae4634929546c3d52721 | Add Datasource parent class | lamby/debian-devel-changes-bot,xtaran/debian-devel-changes-bot,sebastinas/debian-devel-changes-bot,xtaran/debian-devel-changes-bot,lamby/debian-devel-changes-bot,lamby/debian-devel-changes-bot | DebianChangesBot/__init__.py | DebianChangesBot/__init__.py | import urllib2
class Datasource(object):
class DataError(Exception): pass
def update(self):
fileobj = urllib2.urlopen(self.URL)
return self.parse(fileobj)
import datasources
| agpl-3.0 | Python | |
dedcb6bcabe3d8d6758dcee607e8c33b174d782b | Bump to 2.0.0. | kivy/kivy,matham/kivy,rnixx/kivy,matham/kivy,akshayaurora/kivy,matham/kivy,akshayaurora/kivy,rnixx/kivy,matham/kivy,kivy/kivy,rnixx/kivy,akshayaurora/kivy,kivy/kivy | kivy/_version.py | kivy/_version.py | # This file is imported from __init__.py and exec'd from setup.py
MAJOR = 2
MINOR = 0
MICRO = 0
RELEASE = True
__version__ = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
if not RELEASE:
# if it's a rcx release, it's not proceeded by a period. If it is a
# devx release, it must start with a period
__version__ += 'r... | # This file is imported from __init__.py and exec'd from setup.py
MAJOR = 2
MINOR = 0
MICRO = 0
RELEASE = False
__version__ = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
if not RELEASE:
# if it's a rcx release, it's not proceeded by a period. If it is a
# devx release, it must start with a period
__version__ += '... | mit | Python |
f8e4334514a622fa7541e0b82800fdbc717e8838 | Add notes to sketch for priorityq. refs #10 | jay-tyler/data-structures,jonathanstallings/data-structures | priorityq.py | priorityq.py | from __future__ import unicode_literals
from functools import total_ordering
from binary_heap import BinaryHeap
@total_ordering # Will build out the remaining comparison methods
class QNode(object):
"""A class for a queue node."""
def __init__(self, val, priority=None):
self.val = val
self.p... | from __future__ import unicode_literals
from functools import total_ordering
from binary_heap import BinaryHeap
@total_ordering # Will build out the remaining comparison methods
class QNode(object):
"""A class for a queue node."""
def __init__(self, val, priority=None):
super(QNode, self).__init__()... | mit | Python |
59dc6605af2aba9c94201b5b08e614015c8824dc | Use localtime function | Netuitive/netuitive-client-python | example/example.py | example/example.py | import netuitive
import time
import os
ApiClient = netuitive.Client(url=os.environ.get('API_URL'), api_key=os.environ.get('CUSTOM_API_KEY'))
MyElement = netuitive.Element()
MyElement.add_attribute('Language', 'Python')
MyElement.add_attribute('app_version', '7.0')
MyElement.add_relation('my_child_element')
MyEleme... | import netuitive
import time
import os
ApiClient = netuitive.Client(url=os.environ.get('API_URL'), api_key=os.environ.get('CUSTOM_API_KEY'))
MyElement = netuitive.Element()
MyElement.add_attribute('Language', 'Python')
MyElement.add_attribute('app_version', '7.0')
MyElement.add_relation('my_child_element')
MyEleme... | apache-2.0 | Python |
1a0e86f11ddac5ff4842e87cfc6796670866ca0f | Update item_attribute.py | gsnbng/erpnext,susuchina/ERPNEXT,SPKian/Testing2,saurabh6790/test-erp,aruizramon/alec_erpnext,hernad/erpnext,mbauskar/omnitech-erpnext,mbauskar/sapphire-erpnext,gangadharkadam/v6_erp,gangadharkadam/saloon_erp,anandpdoshi/erpnext,Tejal011089/trufil-erpnext,meisterkleister/erpnext,mbauskar/alec_frappe5_erpnext,gangadhark... | erpnext/stock/doctype/item_attribute/item_attribute.py | erpnext/stock/doctype/item_attribute/item_attribute.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class ItemAttribute(Document):
def validate(self):
self.valid... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class ItemAttribute(Document):
def validate(self):
self.valid... | agpl-3.0 | Python |
db1e14ecabaaf39873c18ea7156eab085d89af08 | Add support for backend section in .system | olofk/fusesoc,lowRISC/fusesoc,lowRISC/fusesoc,olofk/fusesoc | orpsoc/system.py | orpsoc/system.py | import sys
if sys.version[0] == '2':
import ConfigParser as configparser
else:
import configparser
from orpsoc.core import Core
from orpsoc.config import Config
import os
DEFAULT_VALUES = {'name' : '',
'cores' : '',
'simulators' : '',
... | import sys
if sys.version[0] == '2':
import ConfigParser as configparser
else:
import configparser
from orpsoc.core import Core
from orpsoc.config import Config
import os
DEFAULT_VALUES = {'name' : '',
'cores' : '',
'simulators' : '',
... | bsd-2-clause | Python |
ba7c59bc0ad31658ae741ba7d0ddf0e0bc1d36d4 | Update production URL to the right one (#1903) | La0/mozilla-relengapi,mozilla-releng/services,mozilla-releng/services,La0/mozilla-relengapi,La0/mozilla-relengapi,mozilla-releng/services,La0/mozilla-relengapi,mozilla-releng/services | src/shipit/api/setup.py | src/shipit/api/setup.py | # -*- coding: utf-8 -*-
# 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 setuptools
def read_requirements(file_):
lines = []
with open(file_) as f:
... | # -*- coding: utf-8 -*-
# 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 setuptools
def read_requirements(file_):
lines = []
with open(file_) as f:
... | mpl-2.0 | Python |
7760e9e811524e8fdc3599169d12d12f4ff89421 | delete data sql | loreguerra/bbt-chart | delete_entry.py | delete_entry.py | import psycopg2
import sys
from connect import connect_to_db
# edit data from arguments in command line
# filename counts as first arg
args = sys.argv
date_to_delete = args[1] # second arg
# adding items to data
data = date_to_delete
# connect to database
conn = connect_to_db()
cur = conn.cursor()
# SQL for insert... | import psycopg2
import sys
from connect import connect_to_db
# edit data from arguments in command line
# filename counts as first arg
args = sys.argv
date_to_delete = args[1] # second arg
# adding items to data
data = date_to_delete
# connect to database
conn = connect_to_db()
cur = conn.cursor()
# SQL for insert... | mit | Python |
9c6b5bc39f272926e92c1c4a5a7aeed2436c61b5 | Update config.py | fadhiilrachman/line-py | linepy/config.py | linepy/config.py | # -*- coding: utf-8 -*-
from akad.ttypes import ApplicationType
import re
class Config(object):
LINE_HOST_DOMAIN = 'https://gd2.line.naver.jp'
LINE_OBS_DOMAIN = 'https://obs-sg.line-apps.com'
LINE_TIMELINE_API = 'https://gd2.line.naver.jp/mh/api'
LINE_TIMELINE_MH ... | # -*- coding: utf-8 -*-
from akad.ttypes import ApplicationType
import re
class Config(object):
LINE_HOST_DOMAIN = 'https://gd2.line.naver.jp'
LINE_OBS_DOMAIN = 'https://obs-sg.line-apps.com'
LINE_TIMELINE_API = 'https://gd2.line.naver.jp/mh/api'
LINE_TIMELINE_MH ... | bsd-3-clause | Python |
e6d5b3d09b284f0c12e54bd7dc51f9175d7e189c | implement Output edit menu | CaptainDesAstres/Simple-Blender-Render-Manager,CaptainDesAstres/Blender-Render-Manager | settingMod/Output.py | settingMod/Output.py | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage rendering output path'''
import xml.etree.ElementTree as xmlMod
import os
class Output:
'''class to manage rendering output path'''
def __init__(self, xml= None):
'''initialize output path with default value or values extracted from an xml object'''... | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage rendering output path'''
import xml.etree.ElementTree as xmlMod
import os
class Output:
'''class to manage rendering output path'''
def __init__(self, xml= None):
'''initialize output path with default value or values extracted from an xml object'''... | mit | Python |
524292c821886f5cbe5fe3ea201c65c48119be41 | update extract_samples.py | lisongze/SForecast,lisongze/SForecast,lisongze/SForecast,lisongze/SForecast | extract_samples.py | extract_samples.py | import sys, os
import numpy as np
import pandas as pd
import datetime
if __name__ == '__main__':
infile = sys.argv[1]
csv_content = pd.read_csv(infile, [0])
date = [datetime.datetime.strptime(x, '%Y-%m-%d') for x in csv_content.index]
for x in date:
s = 0
| import sys, os
import numpy as np
import pandas as pd
import datetime
if __name__ == '__main__':
infile = sys.argv[1]
csv_content = pd.read_csv(infile, [0])
date = []
| mit | Python |
dbbdf00341f5cc8673c9cc0f3b4baf7487bf7a4b | Combine conditionals | markstory/lint-review,markstory/lint-review,markstory/lint-review | lintreview/tools/shellcheck.py | lintreview/tools/shellcheck.py | import logging
import os
import functools
from lintreview.tools import Tool, run_command, process_checkstyle
from lintreview.utils import in_path
log = logging.getLogger(__name__)
class Shellcheck(Tool):
name = 'shellcheck'
def check_dependencies(self):
"""
See if shellcheck is on the syste... | import logging
import os
import functools
from lintreview.tools import Tool, run_command, process_checkstyle
from lintreview.utils import in_path
log = logging.getLogger(__name__)
class Shellcheck(Tool):
name = 'shellcheck'
def check_dependencies(self):
"""
See if shellcheck is on the syste... | mit | Python |
66a8811a5f489fc133b23996ebac145407dd512f | Update ipc_lista4.6.py | any1m1c/ipc20161 | lista4-oficial/ipc_lista4.6.py | lista4-oficial/ipc_lista4.6.py | #Bruno de Oliveira Freire - 1615310030
#questao 6 da lista de listas
media=[]
qtd_alunos=0
num_aluno=0
m=0
aluno=1
for qtd_alunos in range(10):
print("-------------nota do aluno %d-----------------"%aluno)
n1=float(input("insira o numero 1:"))
n2=float(input("insira o numero 2:"))
n3=float(input("insir... | #Bruno de Oliveira Freire - 1615310030
media=[]
qtd_alunos=0
num_aluno=0
m=0
aluno=1
for qtd_alunos in range(10):
print("-------------nota do aluno %d-----------------"%aluno)
n1=float(input("insira o numero 1:"))
n2=float(input("insira o numero 2:"))
n3=float(input("insira o numero 3:"))
n4=float(... | apache-2.0 | Python |
23b8416025e478a1740200a9a9a4302fd09d7937 | Set the version at 1.0. | uw-it-aca/spotseeker_server,uw-it-aca/spotseeker_server,uw-it-aca/spotseeker_server | spotseeker_server/__init__.py | spotseeker_server/__init__.py | __version__ = '1.0'
| apache-2.0 | Python | |
b23fd62c15c5f2e526e470daf6a6025d6231f966 | update local server to know about loading and saving gists | namin/io.livecode.ch,namin/io.livecode.ch,namin/io.livecode.ch | pub/local.py | pub/local.py | from flask import Flask
from flask import request
from flask import render_template
from flask import jsonify
import os
import json
import requests
app = Flask(__name__)
def proxy_github_post(action, user, repo):
data = {}
for k,v in request.form.iteritems():
data[k] = v
r = requests.post('http://... | from flask import Flask
from flask import request
from flask import render_template
import os
import json
import requests
app = Flask(__name__)
@app.route("/api/run/<user>/<repo>", methods=['POST'])
def proxy_github_run(user, repo):
data = {}
for k,v in request.form.iteritems():
data[k] = v
r = re... | apache-2.0 | Python |
82638521d51cea4286f4b3e8ecd3f2ccd0441e49 | Create core Class it's called pyMonitor with some stuffs | ahmedalkabir/pyMonitor | pyMonitor.py | pyMonitor.py | """
pyMonitor first Version
Written By :Ahmed Alkabir
"""
#!/usr/bin/python3
# Library
import serial
import sys
class pyMonitor():
#baud rate of Serial communication
baud_rate = [4800,9600,14400,19200,28800,38400,57600,115200]
# serial object
__main_conn = None
# Constructor
def... | mit | Python | |
343499674bb2dea15b3ecc8d3c2bb41ab273e758 | Improve exception printing | kyamagu/psd2svg | src/psd2svg/rasterizer/batik_rasterizer.py | src/psd2svg/rasterizer/batik_rasterizer.py | # -*- coding: utf-8 -*-
"""
Batik-based rasterizer module.
Download the latest batik rasterizer to use the module. Note Ubuntu 16.04LTS
package is broken and does not work.
Prerequisite:
wget http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&\
filename=xmlgraphics/batik/binaries/batik-bin-1.9.tar... | # -*- coding: utf-8 -*-
"""
Batik-based rasterizer module.
Download the latest batik rasterizer to use the module. Note Ubuntu 16.04LTS
package is broken and does not work.
Prerequisite:
wget http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&\
filename=xmlgraphics/batik/binaries/batik-bin-1.9.tar... | mit | Python |
7ce5438e9f0b4b2ac87a708996ccde69d891b2dd | Make modules uninstallable | OCA/survey,OCA/survey,OCA/survey | survey_conditional_question/__openerp__.py | survey_conditional_question/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | agpl-3.0 | Python |
056e27acf790cf7134d99b60f9d924111b7003fa | Update to 22.04 | ktdreyer/teuthology,ceph/teuthology,ktdreyer/teuthology,ceph/teuthology | teuthology/test/test_get_distro_version.py | teuthology/test/test_get_distro_version.py | from teuthology.misc import get_distro_version
class Mock:
pass
class TestGetDistroVersion(object):
def setup(self):
self.fake_ctx = Mock()
self.fake_ctx.config = {}
self.fake_ctx_noarg = Mock()
self.fake_ctx_noarg.config = {}
self.fake_ctx_noarg.os_version = None
... | from teuthology.misc import get_distro_version
class Mock:
pass
class TestGetDistroVersion(object):
def setup(self):
self.fake_ctx = Mock()
self.fake_ctx.config = {}
self.fake_ctx_noarg = Mock()
self.fake_ctx_noarg.config = {}
self.fake_ctx_noarg.os_version = None
... | mit | Python |
252f5be14a1c6c00871d73a5a4ed2f5125b44a8f | Fix APPEND_SLASH behavior | peterkuma/tjrapid,peterkuma/tjrapid,peterkuma/tjrapid | main/views.py | main/views.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2007-2012 Peter Kuma
import os
from django.http import Http404
from django.shortcuts import render
from django.template import RequestContext
from django.utils import translation
from django.http import HttpResponseRedirect
from django.conf import settings
from django.shortcu... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2007-2012 Peter Kuma
import os
from django.http import Http404
from django.shortcuts import render
from django.template import RequestContext
from django.utils import translation
from django.http import HttpResponseRedirect
from django.conf import settings
from django.shortcu... | mit | Python |
4d6b254cd6b5f586619e54cf40efeb71da35e3a7 | Update getchar simprocedure to use the new read calling convention | iamahuman/angr,axt/angr,chubbymaggie/simuvex,chubbymaggie/angr,chubbymaggie/simuvex,schieb/angr,angr/simuvex,chubbymaggie/angr,schieb/angr,iamahuman/angr,axt/angr,iamahuman/angr,schieb/angr,angr/angr,tyb0807/angr,tyb0807/angr,axt/angr,chubbymaggie/simuvex,f-prettyland/angr,f-prettyland/angr,tyb0807/angr,angr/angr,angr/... | simuvex/procedures/libc___so___6/getchar.py | simuvex/procedures/libc___so___6/getchar.py | import simuvex
from simuvex.s_type import SimTypeInt
######################################
# getchar
######################################
class getchar(simuvex.SimProcedure):
def run(self):
self.return_type = SimTypeInt(32, True)
data = self.state.posix.read_from(0,1)
data = data.zero_e... | import simuvex
from simuvex.s_type import SimTypeInt
######################################
# getchar
######################################
class getchar(simuvex.SimProcedure):
def run(self):
self.return_type = SimTypeInt(32, True)
data = self.state.posix.read(0,1)
data = data.zero_extend... | bsd-2-clause | Python |
f35b4b4016c773a8b086d9170609fe6dea3a09cd | include also common_resource in distribution | frishberg/robotframework-selenium2library,vincentfretin/robotframework-selenium2library,peritus/robotframework-selenium2library,edmi-nz/robotframework-selenium2library,githubccruz/robotframework-selenium2library,elizaleong/robotframework-selenium2library,fingeronthebutton/Selenium2Library,valaxy/robotframework-selenium... | demo/package.py | demo/package.py | #!/usr/bin/env python
import os
from time import localtime
from zipfile import ZipFile, ZIP_DEFLATED
FILES = {'': ['rundemo.py', 'README.txt'],
'login_tests': ['valid_login.txt', 'invalid_login.txt',
'html_resource.txt', 'flex_resource.txt',
'common_resource... | #!/usr/bin/env python
import os
from time import localtime
from zipfile import ZipFile, ZIP_DEFLATED
FILES = {'': ['rundemo.py', 'README.txt'],
'login_tests': ['valid_login.txt', 'invalid_login.txt',
'html_resource.txt', 'flex_resource.txt'],
'demoapp': ['server.py'],
... | apache-2.0 | Python |
5e6536de38955faf71ab1bf768aa0546d6e7b998 | Rename update command to rebuild in help | dreyou/ebstarter,dreyou/ebstarter,dreyou/ebstarter | sender.py | sender.py | #!/usr/bin/env python
import pika
import json
from optparse import OptionParser
import logging
parser = OptionParser()
parser.add_option("-a", "--application", help="application name", type="string", dest="name", default="")
parser.add_option("-o", "--operation", help="operation create|rebuild|delete", type="string",... | #!/usr/bin/env python
import pika
import json
from optparse import OptionParser
import logging
parser = OptionParser()
parser.add_option("-a", "--application", help="application name", type="string", dest="name", default="")
parser.add_option("-o", "--operation", help="operation create|update|delete", type="string", ... | mit | Python |
1f2625e3d31698faeaca1eb79343bd65979da4b2 | Add UnknownCodeError to spambl module | piotr-rusin/spam-lists | spambl.py | spambl.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
class SpamBLError(Exception):
''' Base exception class for spambl module '''
class UnknownCodeError(SpamBLError):
''' Raise when trying to use an unexpected value of dnsbl return code '''
class DNSBL(object):
''' Represents a DNSBL service provider '''
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
class SpamBLError(Exception):
''' Base exception class for spambl module '''
class DNSBL(object):
''' Represents a DNSBL service provider '''
def __init__(self, identifier, query_suffix, code_item_class, lists_ips, lists_uris):
''' Create new DNSBL ob... | mit | Python |
0a170b84c956a958270131b46e2e1b7e8f6d6777 | Bump to version 0.29.0 | reubano/meza,reubano/tabutils,reubano/meza,reubano/tabutils,reubano/tabutils,reubano/meza | meza/__init__.py | meza/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza
~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.
DEF... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza
~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.
DEF... | mit | Python |
d48356215cf48f86926d2ce3044180881827db5e | Fix integration test directory | jacebrowning/gitman,jacebrowning/gdm | tests/test_all.py | tests/test_all.py | """Integration tests for the `gdm` package."""
import os
import shutil
import pytest
import gdm
from gdm.config import Config
from .conftest import FILES, ROOT
@pytest.mark.integration
def test_install():
"""Verify dependencies can be installed."""
os.chdir(ROOT)
config = Config(FILES)
shutil.rmtr... | """Integration tests for the `gdm` package."""
import os
import shutil
import pytest
import gdm
from gdm.config import Config
from .conftest import FILES
@pytest.mark.integration
def test_install():
"""Verify dependencies can be installed."""
config = Config(FILES)
shutil.rmtree(config.location, ignor... | mit | Python |
a85cb3467180898c721792973bd31b14e1b96baa | use POST only. | geekan/task-manager,geekan/task-manager,geekan/task-manager,geekan/task-manager | task_manager/task_processor/views.py | task_manager/task_processor/views.py | from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.db.models import Q
from models import ImageNeuralTask
from time import strftime, localtime
import logging
l = logging.getLogger(__name__)
def index(request):
#l.error(__name_... | from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.db.models import Q
from models import ImageNeuralTask
from time import strftime, localtime
import logging
l = logging.getLogger(__name__)
def index(request):
#l.error(__name_... | mit | Python |
bff5e3725e81e9abd65280da51978a4a38ea5a3f | make bus and channel first-class citizens of the shellbot package | bernard357/shellbot | shellbot/__init__.py | shellbot/__init__.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not ... | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not ... | apache-2.0 | Python |
374bd4881e00c2605f28ea816fa94468a76f2621 | Add MultiplePublisher to handle topic name suffix | OTL/jps | jps/utils.py | jps/utils.py | import json
from .publisher import Publisher
from .common import DEFAULT_PUB_PORT
from .common import DEFAULT_HOST
from .env import get_master_host
class JsonMultiplePublisher(object):
'''publish multiple topics by one json message
Example:
>>> p = JsonMultiplePublisher()
>>> p.publish('{"topic1":... | import json
from .publisher import Publisher
from .common import DEFAULT_PUB_PORT
from .common import DEFAULT_HOST
from .env import get_master_host
class JsonMultiplePublisher(object):
'''publish multiple topics by one json message
Example:
>>> p = JsonMultiplePublisher()
>>> p.publish('{"topic1":... | apache-2.0 | Python |
24f449ad9c5ed738e767f21d1f137d784e2b2d2c | add register url mapping | simpleoncall/simpleoncall,simpleoncall/simpleoncall | simpleoncall/urls.py | simpleoncall/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from simpleoncall import api
urlpatterns = patterns(
'',
url(r'^$', 'simpleoncall.views.dashboard', name='dashboard'),
url(r'^login', 'simpleoncall.views.login', name='login'),
url(r'^register', 'simpleoncall.views.re... | from django.conf.urls import patterns, include, url
from django.contrib import admin
from simpleoncall import api
urlpatterns = patterns(
'',
url(r'^$', 'simpleoncall.views.dashboard', name='dashboard'),
url(r'^login', 'simpleoncall.views.login', name='login'),
url(r'^logout', 'simpleoncall.views.logo... | mit | Python |
17cea2e1d22e29fa073133044afbcab571bc1c58 | Add version number to init | AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE | AdaptivePELE/__init__.py | AdaptivePELE/__init__.py | __version__ = "1.4.2"
| mit | Python | |
8e0ae6f377c66e1fcbc50b04f1d55b372b6dea40 | make it a class | timmydoza/RPi_7SegDisplay | RPi_7SegDisplay.py | RPi_7SegDisplay.py | import RPi.GPIO as GPIO
import multiprocessing
import signal
import sys
from time import sleep
class RPi_7SegDisplay():
_CHARACTERS = {
'0': 0b11000000,
'1': 0b11111001,
'2': 0b10100100,
'3': 0b10110000,
'4': 0b10011001,
'5': 0b10010010,
'6': 0b10000010,
... | import RPi.GPIO as GPIO
import multiprocessing
import signal
import sys
from time import sleep
_CHARACTERS = {
'0': 0b11000000,
'1': 0b11111001,
'2': 0b10100100,
'3': 0b10110000,
'4': 0b10011001,
'5': 0b10010010,
'6': 0b10000010,
'7': 0b11111000,
'8': 0b10000000,
'9': 0b10010000... | mit | Python |
cadae5454859af11ba0a2793750265a4a1f9e38a | change hakbeon to bunryu which can be more generally used | Perlmint/Yuzuki,TintypeMolly/Yuzuki,TintypeMolly/Yuzuki,PoolC/Yuzuki,TintypeMolly/Yuzuki,Perlmint/Yuzuki,Perlmint/Yuzuki,PoolC/Yuzuki,PoolC/Yuzuki | model/user.py | model/user.py | from datetime import datetime
from sqlalchemy import Boolean, Column, DateTime, Integer, String, Text
from sqlalchemy.orm import relationship
from model.base import Base
from helper.pbkdf2 import pbkdf2, pbkdf2_check
class User(Base):
__tablename__ = "user"
uid = Column(Integer(), primary_key=True)
user... | from datetime import datetime
from sqlalchemy import Boolean, Column, DateTime, Integer, String, Text
from sqlalchemy.orm import relationship
from model.base import Base
from helper.pbkdf2 import pbkdf2, pbkdf2_check
class User(Base):
__tablename__ = "user"
uid = Column(Integer(), primary_key=True)
user... | mit | Python |
38791bf66166b194c6f90c140589e11c9d614673 | test c-model | Oscarlight/PiNN_Caffe2,Oscarlight/PiNN_Caffe2,Oscarlight/PiNN_Caffe2,Oscarlight/PiNN_Caffe2 | transiNXOR_modeling/transixor_predictor.py | transiNXOR_modeling/transixor_predictor.py | import sys
sys.path.append('../')
import numpy as np
from itertools import product
from pinn_api import predict_ids_grads, predict_ids
import matplotlib.pyplot as plt
import glob
## ------------ True data ---------------
ids_file = glob.glob('./transiXOR_data/current_D9.npy')
# ids_file = glob.glob('./transiXOR_data... | import sys
sys.path.append('../')
import numpy as np
from itertools import product
from pinn_api import predict_ids_grads, predict_ids
import matplotlib.pyplot as plt
import glob
## ------------ True data ---------------
ids_file = glob.glob('./transiXOR_data/current_D9.npy')
# ids_file = glob.glob('./transiXOR_data... | mit | Python |
48dc53c5c92a49fca959a962434bee6c2810a0c8 | Add missing license to pip package | PAIR-code/what-if-tool,PAIR-code/what-if-tool,PAIR-code/what-if-tool,pair-code/what-if-tool,pair-code/what-if-tool,PAIR-code/what-if-tool,pair-code/what-if-tool,pair-code/what-if-tool,PAIR-code/what-if-tool,pair-code/what-if-tool | tensorboard_plugin_wit/pip_package/setup.py | tensorboard_plugin_wit/pip_package/setup.py | # Copyright 2019 The TensorFlow Authors. 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 applica... | # Copyright 2019 The TensorFlow Authors. 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 applica... | apache-2.0 | Python |
00092b1a6af866fb74c04923be627d8b0b44e630 | fix ver | shortdudey123/gbot | modules/admin.py | modules/admin.py | #!/usr/bin/env python
# =============================================================================
# file = opme.py
# description = gbot module
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-12
# mod_date = 2014-07-12
# version = 0.1
# usage = loaded by gbot
# notes =
# python_ver = 2.7.6
#... | #!/usr/bin/env python
# =============================================================================
# file = opme.py
# description = gbot module
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-12
# mod_date = 2014-07-12
# version = 0.1
# usage = loaded by gbot
# notes =
# python_ver = 2.7.6
#... | apache-2.0 | Python |
eecded05bdd04cafe93793efdc97742b58903e83 | Fix broken imports in ParticleTest | Wilee999/panda3d,tobspr/panda3d,brakhane/panda3d,cc272309126/panda3d,tobspr/panda3d,matthiascy/panda3d,Wilee999/panda3d,Wilee999/panda3d,Wilee999/panda3d,grimfang/panda3d,matthiascy/panda3d,mgracer48/panda3d,tobspr/panda3d,brakhane/panda3d,cc272309126/panda3d,Wilee999/panda3d,Wilee999/panda3d,grimfang/panda3d,grimfang/... | direct/src/particles/ParticleTest.py | direct/src/particles/ParticleTest.py |
if __name__ == "__main__":
from direct.directbase.TestStart import *
from panda3d.physics import LinearVectorForce
from panda3d.core import Vec3
import ParticleEffect
from direct.tkpanels import ParticlePanel
import Particles
import ForceGroup
# Showbase
base.enableParticl... |
if __name__ == "__main__":
from direct.directbase.TestStart import *
from pandac.LinearVectorForce import LinearVectorForce
from pandac.Vec3 import Vec3
import ParticleEffect
from direct.tkpanels import ParticlePanel
import Particles
import ForceGroup
# Showbase
base.enabl... | bsd-3-clause | Python |
198824caf096becbb14454d8969c4c8616c521ae | bump version | nyaruka/smartmin,nyaruka/smartmin,nyaruka/smartmin | smartmin/__init__.py | smartmin/__init__.py | from __future__ import unicode_literals
__version__ = '2.2.3'
| from __future__ import unicode_literals
__version__ = '2.2.2'
| bsd-3-clause | Python |
6a7e2db1d7e2220004d37f4f4531e75672f9a2b3 | Fix issue #14 dont parse path twice | Sixdsn/MOZ_OVERRIDE | modules/files.py | modules/files.py | #!/usr/bin/python
import os, sys, commands, string
from options import SIXMOZ_options
from logger import SIXMOZ_logger
from rules import SIXMOZ_rules
class SIXMOZ_files():
def __init__(self):
#besoin d'ajouter check si files est vide ou ['']
pass
@staticmethod
def get_files():
re... | #!/usr/bin/python
import os, sys, commands, string
from options import SIXMOZ_options
from logger import SIXMOZ_logger
from rules import SIXMOZ_rules
class SIXMOZ_files():
def __init__(self):
#besoin d'ajouter check si files est vide ou ['']
pass
@staticmethod
def get_files():
re... | mpl-2.0 | Python |
4b081f7a0e3f4c2069e2da77b584c37fa6d0705f | add listener for searching playlists | hamidzr/kodi-extras | voiceControl.py | voiceControl.py | from utils.voiceParser import *
COMMANDS = [
{
'aliases': ['please set', 'pls set', 'please','pls', 'go','set'],
'script': 'python3.6 kodiCrud.py',
'hasArgs': True
},
{
'aliases': ['music','play music'],
'script': 'python3.6 playYtPlaylist.py'
},
{
'a... | from utils.voiceParser import *
COMMANDS = [
{
'aliases': ['please set', 'pls set', 'please','pls', 'go','set'],
'script': 'python3.6 kodiCrud.py',
'hasArgs': True
},
{
'aliases': ['music','play music'],
'script': 'python3.6 playYtPlaylist.py'
},
{
'a... | mit | Python |
af822a557355434ea900eb0742d5429c0f2c9d30 | Add session to function | HERA-Team/hera_mc,HERA-Team/hera_mc,HERA-Team/Monitor_and_Control | scripts/write_antenna_location_file.py | scripts/write_antenna_location_file.py | #! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2016 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""
Script to write out antenna locations for use in cal files.
"""
import pandas as pd
from hera_mc import mc, geo_handling, cm_handling
import datetime
parser = mc.get_mc_a... | #! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2016 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""
Script to write out antenna locations for use in cal files.
"""
import pandas as pd
from hera_mc import mc, geo_handling, cm_handling
import datetime
parser = mc.get_mc_a... | bsd-2-clause | Python |
e12580f1749493dbe05f474d2fecdec4eaba73c5 | bump version | google/TensorNetwork | tensornetwork/version.py | tensornetwork/version.py | # Copyright 2019 The TensorNetwork Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | # Copyright 2019 The TensorNetwork Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | apache-2.0 | Python |
130af66197095a188ff01906fd1323f107d72246 | Fix nomination form | SAlkhairy/trabd,SAlkhairy/trabd,SAlkhairy/trabd,SAlkhairy/trabd | voting/views.py | voting/views.py | from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from .models import Position, Nomina... | from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from .models import Position, Nomina... | agpl-3.0 | Python |
3229ae048b623833925f6c5db4fe6016940dcc06 | fix path to db | vjdorazio/TwoRavens,vjdorazio/TwoRavens,vjdorazio/TwoRavens,vjdorazio/TwoRavens,vjdorazio/TwoRavens | tworavensproject/settings/dev_container.py | tworavensproject/settings/dev_container.py | from __future__ import absolute_import
import json
import sys
from os import makedirs
from os.path import join, normpath, isdir, isfile
from .base import *
DEBUG = True # False - will be False
ROOT_URLCONF = 'tworavensproject.urls_prod'
APACHE_WEB_DIRECTORY = '/var/www/html'
SECRET_KEY = 'ye-dev-container-secret-k... | from __future__ import absolute_import
import json
import sys
from os import makedirs
from os.path import join, normpath, isdir, isfile
from .base import *
DEBUG = True # False - will be False
ROOT_URLCONF = 'tworavensproject.urls_prod'
APACHE_WEB_DIRECTORY = '/var/www/html'
SECRET_KEY = 'ye-dev-container-secret-k... | bsd-3-clause | Python |
5200e1d18efa2c71993f69a7d10e605b4af01430 | add file type | ehealthafrica-ci/formhub,eHealthAfrica/onadata,qlands/onadata,kobotoolbox/kobocat,piqoni/onadata,ehealthafrica-ci/formhub,spatialdev/onadata,makinacorpus/formhub,ehealthafrica-ci/onadata,qlands/onadata,eHealthAfrica/formhub,hnjamba/onaclone,smn/onadata,jomolinare/kobocat,makinacorpus/formhub,SEL-Columbia/formhub,eHealt... | main/models/meta_data.py | main/models/meta_data.py | from django.db import models
from odk_logger.models import XForm
import os
def upload_to(instance, filename):
return os.path.join(
instance.xform.user.username,
'docs',
filename
)
def unique_type_for_form(xform, data_type, data_value=None):
result = type_for_form(xform, data_ty... | from django.db import models
from odk_logger.models import XForm
import os
def upload_to(instance, filename):
return os.path.join(
instance.xform.user.username,
'docs',
filename
)
def unique_type_for_form(xform, data_type, data_value=None):
result = type_for_form(xform, data_ty... | bsd-2-clause | Python |
6b9b851d3c9b77e0a383a7c67a610337d58ec8ce | Add manage command | mkaplenko/flask-dynstatic | flask_dynstatic.py | flask_dynstatic.py | from flask import current_app
from functools import wraps
from flask.ext.script import Command
import os
class DynStatic(object):
views = []
def __init__(self, app=None):
self.app = app
@staticmethod
def construct_html():
for view in DynStatic.views:
with open(os.path.joi... | from flask import current_app
from functools import wraps
import os
class DynStatic(object):
views = []
def __init__(self, app=None):
self.app = app
@staticmethod
def construct_html():
for view in DynStatic.views:
with open(os.path.join(current_app.config['DYNSTATIC_ROOT'... | bsd-3-clause | Python |
937a5e32c77ca57917d60a891616fbcf19ab19f9 | Fix a bug that caused HTTP Accept headers with whitespace to be parsed incorrectly | jgorset/django-respite,jgorset/django-respite,jgorset/django-respite | respite/utils.py | respite/utils.py | from django import forms
def generate_form(model):
"""
Generate a form from a model.
Arguments:
model -- A Django model.
"""
_model = model
class Form(forms.ModelForm):
class Meta:
model = _model
return Form
def parse_http_accept_header(header):
"""
Return ... | from django import forms
def generate_form(model):
"""
Generate a form from a model.
Arguments:
model -- A Django model.
"""
_model = model
class Form(forms.ModelForm):
class Meta:
model = _model
return Form
def parse_http_accept_header(header):
"""
Return ... | mit | Python |
4c4c32e9a627fcbca8527aa38b5ea41457e96683 | Fix errant import | editorsnotes/editorsnotes,editorsnotes/editorsnotes | editorsnotes/api/tests/serializers.py | editorsnotes/api/tests/serializers.py | import json
from rest_framework import serializers
from rest_framework.renderers import JSONRenderer
from django.test.client import RequestFactory
from editorsnotes.auth.models import Project
from .views import ClearContentTypesTransactionTestCase
from ..serializers.mixins import EmbeddedItemsMixin
from ..serialize... | import json
from rest_framework import serializers
from rest_framework.renderers import JSONRenderer
from django.test.client import RequestFactory
from editorsnotes.auth.models import Project
from .views import ClearContentTypesTransactionTestCase
from ..serializers.base import EmbeddedItemsMixin
from ..serializers... | agpl-3.0 | Python |
3a479db126d081532e76a5a4018bcfb6ad11f5e9 | Fix hook param name in nonpython example (#9373) | RonnyPfannschmidt/pytest,pytest-dev/pytest,Akasurde/pytest,markshao/pytest | doc/en/example/nonpython/conftest.py | doc/en/example/nonpython/conftest.py | # content of conftest.py
import pytest
def pytest_collect_file(parent, file_path):
if file_path.suffix == ".yaml" and file_path.name.startswith("test"):
return YamlFile.from_parent(parent, path=file_path)
class YamlFile(pytest.File):
def collect(self):
# We need a yaml parser, e.g. PyYAML.
... | # content of conftest.py
import pytest
def pytest_collect_file(parent, fspath):
if fspath.suffix == ".yaml" and fspath.name.startswith("test"):
return YamlFile.from_parent(parent, path=fspath)
class YamlFile(pytest.File):
def collect(self):
# We need a yaml parser, e.g. PyYAML.
impor... | mit | Python |
c12186ce51edc184692dbe214d17c9993e6f627a | Update yadisk.py | haitaka/DroiTaka | cogs/utils/api/yadisk.py | cogs/utils/api/yadisk.py | import json
import requests
__version__ = '0.1.2-dev'
USER_AGENT = 'pycopy/{}'.format(__version__)
BASE_URL = 'https://api.copy.com'
AUTH_URL = BASE_URL + '/auth_user' # TODO: should use /rest
OBJECTS_URL = BASE_URL + '/list_objects' # TODO: should use /rest
DOWNLOAD_URL = BASE_URL + '/download_object' # TODO: sho... | import json
import requests
__version__ = '0.1.2-dev'
USER_AGENT = 'pycopy/{}'.format(__version__)
BASE_URL = 'https://api.copy.com'
AUTH_URL = BASE_URL + '/auth_user' # TODO: should use /rest
OBJECTS_URL = BASE_URL + '/list_objects' # TODO: should use /rest
DOWNLOAD_URL = BASE_URL + '/download_object' # TODO: sho... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.