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 |
|---|---|---|---|---|---|---|---|---|
8874789b889b913c925d28221c4caa65b453f3d2 | use timezone aware datetime when USE_TZ is True | DrMeers/django-oembed,DrMeers/django-oembed,ixc/django-oembed,ixc/django-oembed,JordanReiter/django-oembed,JordanReiter/django-oembed | oembed/models.py | oembed/models.py | import datetime
from django.db import models
from django.utils import simplejson
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
JSON = 1
XML = 2
FORMAT_CHOICES = (
(JSON, "JSON"),
(XML, "XML"),
)
class ProviderRule(models.Model):
name = models.CharField(_("na... | import datetime
from django.db import models
from django.utils import simplejson
from django.utils.translation import ugettext_lazy as _
JSON = 1
XML = 2
FORMAT_CHOICES = (
(JSON, "JSON"),
(XML, "XML"),
)
class ProviderRule(models.Model):
name = models.CharField(_("name"), max_length=128, null=True, blank... | bsd-3-clause | Python |
4bdb1640b91a029030a6a60b754f006e2090703d | fix a race condition where an Award in the post_save handler may not have a DB id associated with it. If that's the case, we'll try retrieving it from the database and just give up on failure | tndatacommons/tndata_backend,izzyalonso/tndata_backend,izzyalonso/tndata_backend,izzyalonso/tndata_backend,tndatacommons/tndata_backend,izzyalonso/tndata_backend,tndatacommons/tndata_backend,tndatacommons/tndata_backend | tndata_backend/notifications/signals.py | tndata_backend/notifications/signals.py | import django.dispatch
import waffle
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils import timezone
from badgify.models import Award
# -----------------------------------------------------------------------------
#
# A signal that will be fired when a GCMMessage... | import django.dispatch
import waffle
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils import timezone
from badgify.models import Award
# -----------------------------------------------------------------------------
#
# A signal that will be fired when a GCMMessage... | mit | Python |
30bc69c91f5955ee8552884706e410b9bf6e42fc | Structure made | HRODEV/Frequency | Frequency/Board/MenuRight/MenuRight.py | Frequency/Board/MenuRight/MenuRight.py | import pygame
import Game
from Vector2 import Vector2
from Helpers.popup import *
from Helpers.EventHelpers import *
from GameLogic.Player import import *
class playerInfoLabels:
def __init__(self):
pass
class PlayerMoney(playerInfoLabels):
def __init__(self, player):
self.Player = player
... | import pygame
import Game
from Vector2 import Vector2
from Helpers.popup import *
from Helpers.EventHelpers import *
class playerInfoLabels:
def __init__(self):
pass
class PlayerMoney:
def __init__(self, player):
self.Player = player
def Draw(self):
return self.Player.Money
class... | mit | Python |
1eab5bf32df3d689beebc4720e1a8d803217e41f | Fix typo in api.urls | editorsnotes/editorsnotes,editorsnotes/editorsnotes | editorsnotes/api/urls.py | editorsnotes/api/urls.py | # vim: set tw=0:
from django.conf.urls import patterns, url, include
import views
project_specific_patterns = patterns('',
url(r'^$', views.ProjectDetail.as_view(), name='api-project-detail'),
url(r'^activity/$', views.ActivityView.as_view(), name='api-project-activity'),
url(r'^topics/$', views.TopicList... | # vim: set tw=0:
from django.conf.urls import patterns, url, include
import views
project_specific_patterns = patterns('',
url(r'^$', views.ProjectDetail.as_view(), name='api-project-detail'),
url(r'^activity/$', views.ActivityView.as_view(), name='api-project-activity'),
url(r'^topics/$', views.TopicList... | agpl-3.0 | Python |
549bc126720c3c533d9afa037587a5eaad85c5c9 | Update oomApp.py | joerg84/dcos-101,joerg84/dcos-101 | oomApp/oomApp.py | oomApp/oomApp.py |
import time
storage = {};
for i in range(1, 100):
big_str = ' ' * 1000000
storage[i] = some_str
time.sleep(0.1)
print "Eat 1 MB"
print "Satisfied!"
time.sleep(10)
|
import time
storage = {};
for i in range(1, 100):
big_str = ' ' * 512000000
storage[i] = some_str
time.sleep(0.1)
print "Eat 512 MB"
print "Satisfied!"
time.sleep(10)
| apache-2.0 | Python |
8bc5461118df6d35f58be85244031ce843236fe7 | Update _version | khchine5/opal,khchine5/opal,khchine5/opal | opal/_version.py | opal/_version.py | __version__ = '0.4.1'
| __version__ = '0.4.0.2'
| agpl-3.0 | Python |
481d0deaca3dc0f22db67d3ca5623f2f951b7148 | fix in schedule handler | gangadharkadam/sterp,saurabh6790/omnitech-apps,indictranstech/fbd_erpnext,Suninus/erpnext,suyashphadtare/sajil-erp,saurabh6790/ON-RISAPP,Tejal011089/osmosis_erpnext,pawaranand/phrerp,Tejal011089/huntercamp_erpnext,indictranstech/reciphergroup-erpnext,gangadharkadam/smrterp,indictranstech/vestasi-erpnext,mbauskar/intern... | startup/schedule_handlers.py | startup/schedule_handlers.py | # ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... | # ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... | agpl-3.0 | Python |
b65dd0d3e0da85232fcebc6a98a33de531e971fd | move haversine | ddboline/kaggle_taxi_trajectory_prediction,ddboline/kaggle_taxi_trajectory_prediction | load_data.py | load_data.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 22 14:40:52 2015
@author: ddboline
"""
import numpy as np
import pandas as pd
#from feature_extraction import haversine_distance
def clean_data(df):
df['CALL_TYPE'] = df['CALL_TYPE'].map({'A': 0, 'B': 1, 'C': 2})
df['DAY_TYPE'] = df['DAY_TYPE']... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 22 14:40:52 2015
@author: ddboline
"""
import numpy as np
import pandas as pd
def haversine_distance(lat1, lon1, lat2, lon2):
r_earth = 6371.
dlat = np.abs(lat1-lat2)*np.pi/180.
dlon = np.abs(lon1-lon2)*np.pi/180.
lat1 *= np.pi/180.
... | mit | Python |
670139492d1a8c7f70aeb715d78f7f22d00f2d9b | Fix permission action evaluation | digitalocean/netbox,digitalocean/netbox,digitalocean/netbox,digitalocean/netbox | netbox/users/migrations/0009_replicate_permissions.py | netbox/users/migrations/0009_replicate_permissions.py | from django.db import migrations
ACTIONS = ['view', 'add', 'change', 'delete']
def replicate_permissions(apps, schema_editor):
"""
Replicate all Permission assignments as ObjectPermissions.
"""
Permission = apps.get_model('auth', 'Permission')
ObjectPermission = apps.get_model('users', 'ObjectPe... | from django.db import migrations
ACTIONS = ['view', 'add', 'change', 'delete']
def replicate_permissions(apps, schema_editor):
"""
Replicate all Permission assignments as ObjectPermissions.
"""
Permission = apps.get_model('auth', 'Permission')
ObjectPermission = apps.get_model('users', 'ObjectPe... | apache-2.0 | Python |
ac5ec0e30f51b5483aaacd566a4b8c02e3138072 | Add custom admin url | ameistad/django-template,ameistad/amei-django-template,ameistad/django-template,ameistad/dokku-django-template,ameistad/django-template,ameistad/dokku-django-template,ameistad/amei-django-template,ameistad/amei-django-template,ameistad/amei-django-template,ameistad/dokku-django-template | {{cookiecutter.repo_name}}/config/urls.py | {{cookiecutter.repo_name}}/config/urls.py | from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(
template_name='index.html'),
name='home'),
# Django Admin, use {% raw %}{% url 'admin:index... | from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(
template_name='index.html'),
name='home'),
url(r'^admin/', include(admin.site.urls))
]
| mit | Python |
7283cbadd1787ccf629b817694fb4f9848aa3231 | Fix default MAIL_DEFAULT_SENDER value | nickjj/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask | config/settings.py | config/settings.py | import os
from distutils.util import strtobool
SECRET_KEY = os.getenv('SECRET_KEY', None)
SERVER_NAME = os.getenv('SERVER_NAME',
'localhost:{0}'.format(os.getenv('DOCKER_WEB_PORT',
'8000')))
# Flask-Mail.
MAIL_SERVER = os.getenv('MAIL_... | import os
from distutils.util import strtobool
SECRET_KEY = os.getenv('SECRET_KEY', None)
SERVER_NAME = os.getenv('SERVER_NAME',
'localhost:{0}'.format(os.getenv('DOCKER_WEB_PORT',
'8000')))
# Flask-Mail.
MAIL_SERVER = os.getenv('MAIL_... | mit | Python |
17d0b8a59ec1bbd0e8f4230949673184085715bb | Fix broken tests. | JohnGriffiths/nipype,rameshvs/nipype,sgiavasis/nipype,FredLoney/nipype,carolFrohlich/nipype,grlee77/nipype,FCP-INDI/nipype,blakedewey/nipype,gerddie/nipype,satra/NiPypeold,Leoniela/nipype,arokem/nipype,blakedewey/nipype,wanderine/nipype,fprados/nipype,Leoniela/nipype,dgellis90/nipype,sgiavasis/nipype,FredLoney/nipype,c... | nipype/interfaces/tests/test_spm.py | nipype/interfaces/tests/test_spm.py | import nipype.interfaces.spm as spm
from nipype.testing import *
def test_spm_path():
spm_path = spm.spm_info.spm_path
if spm_path is not None:
yield assert_equal,type(spm_path),type('')
yield assert_equal,'spm' in spm_path,True
def test_reformat_dict_for_savemat():
mlab = spm.SpmMatlabCo... | import nipype.interfaces.spm as spm
from nipype.testing import *
def test_spm_path():
spm_path = spm.spm_info.spm_path
if spm_path is not None:
yield assert_equal,type(spm_path),type('')
yield assert_equal,'spm' in spm_path,True
def test_reformat_dict_for_savemat():
mlab = spm.SpmMatlabCo... | bsd-3-clause | Python |
17610167cacc55cbe2c90bdf7099c0b857519192 | fix description of DataplaneSIPRegistr | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | plugins/feeds/public/dataplane_sipregistr.py | plugins/feeds/public/dataplane_sipregistr.py | import logging
import pandas as pd
from datetime import timedelta, datetime
from core.errors import ObservableValidationError
from core.feed import Feed
from core.observables import Ip, AutonomousSystem
class DataplaneSIPRegistr(Feed):
default_values = {
"frequency": timedelta(hours=2),
"name": "... | import logging
import pandas as pd
from datetime import timedelta, datetime
from core.errors import ObservableValidationError
from core.feed import Feed
from core.observables import Ip, AutonomousSystem
class DataplaneSIPRegistr(Feed):
default_values = {
"frequency": timedelta(hours=2),
"name": "... | apache-2.0 | Python |
07a2e6712ebc4a072a116b1b1e4b8f9f213cc39d | Update factory_utils to avoid failing tests on accelerate | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/tests/factories/factory_utils.py | accelerator/tests/factories/factory_utils.py | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
from accelerator.tests.factories.expert_category_factory import (
ExpertCategoryFactory
)
from accelerator.tests.factories.industry_factory import IndustryFactory
from accelerator.tests.factories.program_factory import ... | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
from accelerator.tests.factories.expert_category_factory import (
ExpertCategoryFactory
)
from accelerator.tests.factories.industry_factory import IndustryFactory
from accelerator.tests.factories.program_factory import ... | mit | Python |
befc606e7245e32ed4bac4f7ec176b07522245b9 | Update __openerp__.py | ingadhoc/account-invoicing | account_invoice_prices_update/__openerp__.py | account_invoice_prices_update/__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 |
9df3f3a2d0660b8e8166aa944bf45f261a51d987 | Make default color not required | InstanteSports/ies-django-base | ies_base/serializers.py | ies_base/serializers.py | from rest_framework import serializers
class Tag(object):
def __init__(self, name, related_tags, equivalent_names):
self.name = name
self.related_tags = related_tags
self.equivalent_names = equivalent_names
class TagSerializer(serializers.Serializer):
name = serializers.CharField()
... | from rest_framework import serializers
class Tag(object):
def __init__(self, name, related_tags, equivalent_names):
self.name = name
self.related_tags = related_tags
self.equivalent_names = equivalent_names
class TagSerializer(serializers.Serializer):
name = serializers.CharField()
... | mit | Python |
1babe9f60096b7060411ec938d70d6b800b4f8ff | Remove unused names | blink1073/oct2py,blink1073/oct2py | oct2py/__init__.py | oct2py/__init__.py | # -*- coding: utf-8 -*-
"""
Oct2Py is a means to seamlessly call M-files and GNU Octave functions from Python.
It manages the Octave session for you, sharing data behind the scenes using
MAT files. Usage is as simple as:
.. code-block:: python
>>> import oct2py
>>> oc = oct2py.Oct2Py()
>>> x =... | # -*- coding: utf-8 -*-
"""
Oct2Py is a means to seamlessly call M-files and GNU Octave functions from Python.
It manages the Octave session for you, sharing data behind the scenes using
MAT files. Usage is as simple as:
.. code-block:: python
>>> import oct2py
>>> oc = oct2py.Oct2Py()
>>> x =... | mit | Python |
b647ec1220ec0fc420e86967ec1fddbe6c35a4a6 | Revert last commit, Python3 only | innogames/igcollect | src/mysql_query.py | src/mysql_query.py | #!/usr/bin/env python
#
# igcollect - Mysql query results
#
# This script executes a single query and prints the results. The columns
# returned by the query are going to be appended to the given prefix.
# The query must return numeric values.
#
# Copyright (c) 2017, InnoGames GmbH
#
from __future__ import print_funct... | #!/usr/bin/env python
#
# igcollect - Mysql query results
#
# This script executes a single query and prints the results. The columns
# returned by the query are going to be appended to the given prefix.
# The query must return numeric values.
#
# Copyright (c) 2017, InnoGames GmbH
#
from __future__ import print_funct... | mit | Python |
00d6f1c63e3091cf46a05f4853b9675ae7dfc430 | Use python3 dictionary iteration | edx/course-discovery,edx/course-discovery,cpennington/course-discovery,edx/course-discovery,edx/course-discovery | edx_course_discovery/settings/production.py | edx_course_discovery/settings/production.py | from os import environ
import yaml
from edx_course_discovery.settings.base import *
from edx_course_discovery.settings.utils import get_env_setting
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = ['*']
LOGGING = environ.get('LOGGING', LOGGING)
CONFIG_FILE = get_env_setting('COURSE_DISCOVERY_CFG')
with open(C... | from os import environ
import yaml
from edx_course_discovery.settings.base import *
from edx_course_discovery.settings.utils import get_env_setting
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = ['*']
LOGGING = environ.get('LOGGING', LOGGING)
CONFIG_FILE = get_env_setting('COURSE_DISCOVERY_CFG')
with open(C... | agpl-3.0 | Python |
43e3e84b6e26fe8b15ad5bf2299ccce39d529663 | fix typo | lym/allura-git,apache/allura,apache/incubator-allura,apache/allura,leotrubach/sourceforge-allura,heiths/allura,lym/allura-git,lym/allura-git,heiths/allura,leotrubach/sourceforge-allura,leotrubach/sourceforge-allura,Bitergia/allura,heiths/allura,Bitergia/allura,lym/allura-git,apache/allura,Bitergia/allura,apache/allura,... | Allura/allura/lib/widgets/oauth_widgets.py | Allura/allura/lib/widgets/oauth_widgets.py | from pylons import c
import ew as ew_core
import ew.jinja2_ew as ew
from allura.lib import validators as V
from allura import model as M
from .form_fields import AutoResizeTextarea
from .forms import ForgeForm
class OAuthApplicationForm(ForgeForm):
submit_text='Register new application'
style='wide'
cla... | from pylons import c
import ew as ew_core
import ew.jinja2_ew as ew
from allura.lib import validators as V
from allura import model as M
from .form_fields import AutoResizeTextarea
from .forms import ForgeForm
class OAuthApplicationForm(ForgeForm):
submit_text='Register new applicaiton'
style='wide'
cla... | apache-2.0 | Python |
5bd903846586bd09db3f7b2fb6794dcf0b2e54c1 | Update meta data | hynek/argon2_cffi,hynek/argon2_cffi | src/argon2/__init__.py | src/argon2/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from . import exceptions
from ._util import Type
from ._api import (
DEFAULT_HASH_LENGTH,
DEFAULT_MEMORY_COST,
DEFAULT_PARALLELISM,
DEFAULT_RANDOM_SALT_LENGTH,
DEFAULT_TIME_COST,
hash_password,
hash_pa... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from . import exceptions
from ._util import Type
from ._api import (
DEFAULT_HASH_LENGTH,
DEFAULT_MEMORY_COST,
DEFAULT_PARALLELISM,
DEFAULT_RANDOM_SALT_LENGTH,
DEFAULT_TIME_COST,
hash_password,
hash_pa... | mit | Python |
961d3317004c4cd03a2d0e5b1d7d4966728bee55 | Add ubuntu to docker group | danielpalstra/train,anokun7/train,curtisz/train,curtisz/train,kizbitz/train,anokun7/train,danielpalstra/train,kizbitz/train | train/labs/ucp/scripts/ubuntu.py | train/labs/ucp/scripts/ubuntu.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import getpass
def prompt_pass(question):
pass1 = getpass.getpass(question)
pass2 = getpass.getpass("Confirm password: ")
if pass1 != pass2:
prompt_pass(question)
else:
return pass1
# prompts
ubuntu_pass = prompt_pass("Enter 'ubuntu' pas... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import getpass
def prompt_pass(question):
pass1 = getpass.getpass(question)
pass2 = getpass.getpass("Confirm password: ")
if pass1 != pass2:
prompt_pass(question)
else:
return pass1
# prompts
ubuntu_pass = prompt_pass("Enter 'ubuntu' pas... | apache-2.0 | Python |
461030b9633cea7ff85da4e448dd75c427a3b4a9 | Fix eclipse builds with new git structure | denny820909/builder,denny820909/builder,denny820909/builder,denny820909/builder | lib/python2.7/site-packages/autobuilder/buildsteps/BuildEclipsePlugin.py | lib/python2.7/site-packages/autobuilder/buildsteps/BuildEclipsePlugin.py | '''
Created on March 10, 2013
__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "elizabeth.flanagan@intel.com"
'''
from buildbot.steps.shell import... | '''
Created on March 10, 2013
__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "elizabeth.flanagan@intel.com"
'''
from buildbot.steps.shell import... | mit | Python |
92b84e21266d308e9ebca0dc28d152b42044f1f4 | add test for tagCompletion | egolus/NoteOrganiser,baudren/NoteOrganiser,egolus/NoteOrganiser,baudren/NoteOrganiser | noteorganiser/tests/test_widgets.py | noteorganiser/tests/test_widgets.py | """tests for custom widgets"""
from PySide import QtGui
from PySide import QtCore
#widgets to test
from ..widgets import LineEditWithClearButton
from ..widgets import TagCompletion
from ..utils import MultiCompleter
from .custom_fixtures import parent
def test_LineEditWithClearButton(qtbot, parent):
lineEdit = ... | """tests for custom widgets"""
from PySide import QtGui
from PySide import QtCore
#widgets to test
from ..widgets import LineEditWithClearButton
from ..widgets import TagCompletion
from ..utils import MultiCompleter
from .custom_fixtures import parent
def test_LineEditWithClearButton(qtbot, parent):
lineEdit = ... | mit | Python |
858f53c1de0c85b09bf6d5b203dd35e989873f71 | Convert to enum | Tanmay28/coala,lonewolf07/coala,yland/coala,vinc456/coala,sagark123/coala,stevemontana1980/coala,yashLadha/coala,netman92/coala,aptrishu/coala,kartikeys98/coala,MariosPanag/coala,arush0311/coala,sagark123/coala,arjunsinghy96/coala,yashLadha/coala,MariosPanag/coala,Shade5/coala,swatilodha/coala,abhiroyg/coala,Asnelchris... | coalib/results/RESULT_SEVERITY.py | coalib/results/RESULT_SEVERITY.py | from coalib.misc.Enum import enum
from coalib.misc.i18n import _, N_
RESULT_SEVERITY = enum(N_("INFO"), N_("NORMAL"), N_("MAJOR"))
RESULT_SEVERITY.__str__ = lambda x: _(RESULT_SEVERITY.reverse.get(x, "NORMAL"))
| from coalib.misc.i18n import _
class RESULT_SEVERITY:
INFO = 0
NORMAL = 1
MAJOR = 2
@staticmethod
def __str__(severity):
return {0: _("INFO"),
1: _("NORMAL"),
2: _("MAJOR")}.get(severity, _("NORMAL"))
| agpl-3.0 | Python |
54537ad40dfb0de5bfbc448bbc50355c44ea4ba2 | Check inmutability | ashwoods/lustro | lustro/db.py | lustro/db.py | # -*- coding: utf-8 -*-
from sqlalchemy import MetaData, create_engine
from sqlalchemy.orm import Session
from sqlalchemy.ext.automap import automap_base
class DB(object):
"""Facade for the low level DB operations"""
def __init__(self, dsn, schema=None):
self.engine = create_engine(dsn)
meta ... | # -*- coding: utf-8 -*-
from sqlalchemy import MetaData, create_engine
from sqlalchemy.orm import Session
from sqlalchemy.ext.automap import automap_base
class DB(object):
"""Facade for the low level DB operations"""
def __init__(self, dsn, schema=None):
self.engine = create_engine(dsn)
self.... | mit | Python |
cb434cd396574cbe13c388c8269bf0405a1f5a57 | Update main.py | HypoChloremic/datan | main/main.py | main/main.py | import tkinter as tk
import pygubu
import numpy as np
import matwidget
import urllib.request as re
import csv
import requests
class googlefinance:
def __init__(self, master):
# Root definition
self.master = master # De facto self.root
self.builder = builder = pygubu.Builder() # This is require... | import tkinter as tk
import pygubu
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
import matwidget
class googlefinance:
def __init__(self, master):
# Root definition
self.master = master
... | mit | Python |
218265d65695e777cd3e010c6a0108fad6fea5f6 | Enforce that our Including Hyperlink includes | beavyHQ/beavy,beavyHQ/beavy,beavyHQ/beavy,beavyHQ/beavy | beavy/common/including_hyperlink_related.py | beavy/common/including_hyperlink_related.py |
from marshmallow_jsonapi.fields import HyperlinkRelated
from marshmallow_jsonapi.utils import get_value_or_raise
class IncludingHyperlinkRelated(HyperlinkRelated):
def __init__(self, nestedObj, *args, **kwargs):
if callable(nestedObj):
nestedObj = nestedObj(many=False)
self.nestedOb... |
from marshmallow_jsonapi.fields import HyperlinkRelated
from marshmallow_jsonapi.utils import get_value_or_raise
class IncludingHyperlinkRelated(HyperlinkRelated):
def __init__(self, nestedObj, *args, **kwargs):
if callable(nestedObj):
nestedObj = nestedObj(many=False)
self.nestedOb... | mpl-2.0 | Python |
62beac82dbeefaf8a4b34750b711b596f78eb03c | add more to mcp api | fkmclane/MCP,fkmclane/MCP,fkmclane/MCP,fkmclane/MCP | mcp/api/mcp.py | mcp/api/mcp.py | import os
import signal
import fooster.web
import fooster.web.query
import mcp.config
import mcp.common.daemon
import mcp.common.http
class Features(mcp.common.http.AuthHandler):
def do_get(self):
# return enabled features
return 200, {'creation': mcp.config.creation}
class Config(mcp.common.h... | import os
import signal
import fooster.web.query
import mcp.common.daemon
import mcp.common.http
class Restart(mcp.common.http.AuthHandler):
def do_post(self):
# send SIGUSR1 to main process
os.kill(mcp.common.daemon.pid, signal.SIGUSR1)
return 204, None
routes = {'/api/restart' + foo... | mit | Python |
38569fb860da33e409fac70ef007514adfaaf439 | fix and cleanup; fixes #57 | GOVCERT-LU/eml_parser,sim0nx/eml_parser | examples/recursively_extract_attachments.py | examples/recursively_extract_attachments.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Simple example showing how to parse all .eml files in the current folder
# and extract any attachments to a pre-configured folder
#
import argparse
import base64
import datetime
import email.header
import pathlib
import eml_parser
def json_serial(obj):
"""JSON... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Simple example showing how to parse all .eml files in the current folder
# and extract any attachments to a pre-configured folder
#
import base64
import os
import eml_parser
# where to save attachments to
outpath = '.'
for k in os.listdir('.'):
if k.endswith('... | agpl-3.0 | Python |
390e71d89883649dd55fbb70dc8686bf99e2a2e2 | Disable the thread state lock | collinstocks/eventlet,lindenlab/eventlet,tempbottle/eventlet,lindenlab/eventlet,collinstocks/eventlet,lindenlab/eventlet,tempbottle/eventlet | eventlet/green/thread.py | eventlet/green/thread.py | """Implements the standard thread module, using greenthreads."""
from eventlet.support.six.moves import _thread as __thread
from eventlet.support import greenlets as greenlet, six
from eventlet import greenthread
from eventlet.semaphore import Semaphore as LockType
import sys
__patched__ = ['get_ident', 'start_new_th... | """Implements the standard thread module, using greenthreads."""
from eventlet.support.six.moves import _thread as __thread
from eventlet.support import greenlets as greenlet, six
from eventlet import greenthread
from eventlet.semaphore import Semaphore as LockType
__patched__ = ['get_ident', 'start_new_thread', 'sta... | mit | Python |
d1e3f2be0d290af2147f55c9e53857f9e25717e2 | refactor execute_request for using requests timeout | Mifiel/python-api-client | mifiel/base.py | mifiel/base.py | from mifiel import Response
import requests
class Base(object):
def __init__(self, client, path):
object.__setattr__(self, 'sandbox', False)
object.__setattr__(self, 'path', path)
object.__setattr__(self, 'client', client)
object.__setattr__(self, 'response', Response())
# initialize id
self.... | from mifiel import Response
import requests
class Base(object):
def __init__(self, client, path):
object.__setattr__(self, 'sandbox', False)
object.__setattr__(self, 'path', path)
object.__setattr__(self, 'client', client)
object.__setattr__(self, 'response', Response())
# initialize id
self.... | mit | Python |
2b87b03983ee6b34906890add549ed4ccc6befac | Add vectorizer | rajikaimal/emma,rajikaimal/emma | src/predict.py | src/predict.py | import pandas as pd
import io
import os
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
from sklearn.multiclass import OneVsRestClassifier
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import MultinomialNB
fr... | import pandas as pd
import io
import os
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
from sklearn.multiclass import OneVsRestClassifier
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import MultinomialNB
... | mit | Python |
3d82a0f6fddac93f61d46aca781fa41da717ca7c | Return entire query definition line in output | bartaelterman/BlastTaxonomy | parsexmlblast.py | parsexmlblast.py | #!/usr/bin/python
import sys
from Bio.Blast import NCBIXML
def printBlastResults(outputfile):
resultHandle = open(outputfile)
blastRecords = NCBIXML.parse(resultHandle)
for blastRecord in blastRecords:
for description in blastRecord.descriptions:
print blastRecord.descriptions[0].title
for alignment... | #!/usr/bin/python
import sys
from Bio.Blast import NCBIXML
def printBlastResults(outputfile):
resultHandle = open(outputfile)
blastRecords = NCBIXML.parse(resultHandle)
for blastRecord in blastRecords:
for description in blastRecord.descriptions:
print blastRecord.descriptions[0].title
for alignment... | mit | Python |
109fb3c3a2881ee9499d501a2c96eab2c1a074aa | Print MiB/s stats for pickling. | haofree/pyactivemq,winking324/pyactivemq,alberts/pyactivemq,cl2dlope/pyactivemq,cleardo/pyactivemq,hetian9288/pyactivemq,aberzan/pyactivemq,haofree/pyactivemq,chenrui333/pyactivemq,hetian9288/pyactivemq,WilliamFF/pyactivemq,WilliamFF/pyactivemq,cleardo/pyactivemq,alberts/pyactivemq,winking324/pyactivemq,cl2dlope/pyacti... | src/examples/numpypickle.py | src/examples/numpypickle.py | #!/usr/bin/env python
# Copyright 2007 Albert Strasheim <fullung@gmail.com>
#
# 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 requ... | #!/usr/bin/env python
# Copyright 2007 Albert Strasheim <fullung@gmail.com>
#
# 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 requ... | apache-2.0 | Python |
eb21a17dabba8b9d79d8ede7908d34986f431058 | update version.py | tensorflow/model-card-toolkit,tensorflow/model-card-toolkit,tensorflow/model-card-toolkit | model_card_toolkit/version.py | model_card_toolkit/version.py | # Copyright 2020 Google 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 required by applicable law or a... | # Copyright 2020 Google 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 required by applicable law or a... | apache-2.0 | Python |
590d00b2d1f4169c43e9ed4b2aee3a80e50f5447 | build corerctly the unicode string | DUlSine/DUlSine,DUlSine/DUlSine | models/team.py | models/team.py | # -*- coding: utf-8 -*-
# vim: set ts=4
from django.db import models
from benevole import Benevole
from DPS import Dimensionnement
from dulsine_commons import TEAM_TYPES, DIPLOME_SECOURS
class Team(models.Model):
class Meta:
app_label = 'DUlSine'
dimensionnement = models.ForeignKey(Dimensionnement)... | # -*- coding: utf-8 -*-
# vim: set ts=4
from django.db import models
from benevole import Benevole
from DPS import Dimensionnement
from dulsine_commons import TEAM_TYPES, DIPLOME_SECOURS
class Team(models.Model):
class Meta:
app_label = 'DUlSine'
dimensionnement = models.ForeignKey(Dimensionnement)... | agpl-3.0 | Python |
c9f21a389028ed3b831286dc6c3991f48faa6e81 | Remove the check for existence of project since mapreduce API guarantees that. | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | app/soc/mapreduce/convert_project_mentors.py | app/soc/mapreduce/convert_project_mentors.py | #!/usr/bin/python2.5
#
# Copyright 2011 the Melange authors.
#
# 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... | #!/usr/bin/python2.5
#
# Copyright 2011 the Melange authors.
#
# 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... | apache-2.0 | Python |
7cd1d25940f79b35006db6aef4be3790fdad7c2a | update image downloading script | yiling-chen/flickr-cropping-dataset | scripts/download_images.py | scripts/download_images.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import json
import urllib
import argparse
import multiprocessing
if sys.version_info[0] == 3:
from urllib.request import urlretrieve
else:
from urllib import urlretrieve
image_folder = '../... | #!/usr/bin/env python
import os
import json
import urllib
import argparse
import multiprocessing
from PIL import Image
image_folder = '../data/'
def fetch_image(url):
filename = os.path.split(url)[-1]
full_path = os.path.join(image_folder, filename)
if os.path.exists(full_path):
return
print ... | mit | Python |
bae1cb6ae0ad76a7149366f4ae5b05f383489550 | support macros with parentheses | littlevgl/lvgl,littlevgl/lvgl,littlevgl/lvgl,littlevgl/lvgl | scripts/lv_conf_checker.py | scripts/lv_conf_checker.py | #!/usr/bin/env python3.6
'''
Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
'''
import re
fin = open("../lv_conf_template.h", "r")
fout = open("../src/lv_conf_checker.h", "w")
fout.write(
'''/**
* GENERATED FILE, DO NOT EDIT IT!
* @file lv_conf_checker.h
* Make su... | '''
Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
'''
import re
fin = open("../lv_conf_template.h", "r")
fout = open("../src/lv_conf_checker.h", "w")
fout.write(
'''/**
* GENERATED FILE, DO NOT EDIT IT!
* @file lv_conf_checker.h
* Make sure all the defines of lv_c... | mit | Python |
8e089b697cc6dd75a11016088656a98b7b24b935 | remove unused imports, spacing | mainakibui/kobocat,spatialdev/onadata,piqoni/onadata,sounay/flaminggo-test,sounay/flaminggo-test,jomolinare/kobocat,sounay/flaminggo-test,hnjamba/onaclone,mainakibui/kobocat,mainakibui/kobocat,qlands/onadata,kobotoolbox/kobocat,jomolinare/kobocat,smn/onadata,GeoODK/onadata,eHealthAfrica/onadata,kobotoolbox/kobocat,smn/... | staff/management/commands/mailer.py | staff/management/commands/mailer.py | from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.template.loader import get_template
from django.utils.translation import ugettext as _, ugettext_lazy
from templated_email import send_templated_mail
class Comma... | from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.contrib.auth.models import User
from django.template.loader import get_template
from django.utils.translation import ugettext as _, ugettext_lazy
from templated_email import ... | bsd-2-clause | Python |
cab9ea09baaaa87637090a7aafdd49692f81c325 | improve server.py example | sourceperl/pyModbusTCP | examples/server.py | examples/server.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Modbus/TCP server
#
# run this as root to listen on TCP priviliged ports (<= 1024)
# default Modbus/TCP port is 502 so we prefix call with sudo
# add "--host 0.0.0.0" to listen on all available IPv4 addresses of the host
#
# sudo ./server.py --host 0.0.0.0
import arg... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Modbus/TCP server
import argparse
from pyModbusTCP.server import ModbusServer
if __name__ == '__main__':
# parse args
parser = argparse.ArgumentParser()
parser.add_argument('-H', '--host', type=str, default='localhost', help='Host')
parser.add_argument... | mit | Python |
d056d0e140e05953aaf496aa268e65e642ce3b73 | Add missing return value type hint | vitalik/django-ninja,vitalik/django-ninja,vitalik/django-ninja | ninja/files.py | ninja/files.py | from typing import Any, Callable, Dict, Iterable, Optional, Type
from django.core.files.uploadedfile import UploadedFile as DjangoUploadedFile
from pydantic.fields import ModelField
__all__ = ["UploadedFile"]
class UploadedFile(DjangoUploadedFile):
@classmethod
def __get_validators__(cls: Type["UploadedFile... | from typing import Any, Callable, Dict, Iterable, Optional, Type
from django.core.files.uploadedfile import UploadedFile as DjangoUploadedFile
from pydantic.fields import ModelField
__all__ = ["UploadedFile"]
class UploadedFile(DjangoUploadedFile):
@classmethod
def __get_validators__(cls: Type["UploadedFile... | mit | Python |
71a2cc9a036cee2b541b149e57d162004500bfbb | Add hook to load CSS | springload/wagtaildraftail,gasman/wagtaildraftail,gasman/wagtaildraftail,springload/wagtaildraftail,springload/wagtaildraftail,springload/wagtaildraftail,gasman/wagtaildraftail,gasman/wagtaildraftail | wagtaildraftail/wagtail_hooks.py | wagtaildraftail/wagtail_hooks.py | from django.utils.html import format_html
from django.contrib.staticfiles.templatetags.staticfiles import static
from wagtail.wagtailcore import hooks
@hooks.register('insert_editor_js')
def draftail_editor_js():
return format_html('<script src="{0}"></script>', static('wagtaildraftail/wagtaildraftail.js'))
@ho... | from django.utils.html import format_html
from django.contrib.staticfiles.templatetags.staticfiles import static
from wagtail.wagtailcore import hooks
@hooks.register('insert_editor_js')
def draftail_editor_js():
return format_html('<script src="{0}"></script>',
static('wagtaildraftail/wagt... | mit | Python |
3e30dca63e637e25ee7928b1d08da401343cf3a6 | set debug flag to application run method | karec/cookiecutter-flask-restful | {{cookiecutter.project_name}}/manage.py | {{cookiecutter.project_name}}/manage.py | from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from {{cookiecutter.app_name}}.app import create_app
from {{cookiecutter.app_name}}.extensions import db
app = create_app()
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
@manager.comman... | from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from {{cookiecutter.app_name}}.app import create_app
from {{cookiecutter.app_name}}.extensions import db
app = create_app()
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
@manager.comman... | mit | Python |
31d9e9dcde2d8151c68e15492a632b0ce5719911 | Update cookies.py | restlet/httpsnippet,postmanlabs/httpsnippet,Mashape/httpsnippet | test/fixtures/output/python/python3/cookies.py | test/fixtures/output/python/python3/cookies.py | import http.client
conn = http.client.HTTPConnection("mockbin.com")
headers = { 'cookie': "foo=bar; bar=baz" }
conn.request("POST", "/har", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
| import http.client
conn = http.client.HTTPConnection("mockbin.com")
headers = { 'cookie': "foo=bar; bar=baz" }
conn.request("POST", "/har", headers = headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
| mit | Python |
8da4ce025395a958991b8c2647af6b51b7775596 | return native str | warner/foolscap | src/foolscap/base32.py | src/foolscap/base32.py | import sys, base64
def encode(b):
assert isinstance(b, bytes), (type(b), b)
out = base64.b32encode(b).lower().rstrip(b"=")
if sys.version_info.major == 2:
return out
return out.decode("ascii")
# we use the rfc4648 base32 alphabet, in lowercase
BASE32_ALPHABET = 'abcdefghijklmnopqrstuvwxyz23456... | import base64
def encode(b):
assert isinstance(b, bytes), (type(b), b)
return base64.b32encode(b).lower().rstrip(b"=").decode("ascii")
# we use the rfc4648 base32 alphabet, in lowercase
BASE32_ALPHABET = 'abcdefghijklmnopqrstuvwxyz234567'
def is_base32(s):
assert isinstance(s, str), (type(s), s)
for ... | mit | Python |
8cd17cbcea620171bc3c2780429d0fcd6d39190b | Set version 3 in __openerp__ | open-synergy/connector,sylvain-garancher/connector,dvitme/connector,acsone/connector,hugosantosred/connector,maljac/connector,esousy/connector,dvitme/connector,zhaohuaw/connector,BT-ojossen/connector,esousy/connector,js-landoo/connector,zhaohuaw/connector,anybox/connector,mohamedhagag/connector,BT-jmichaud/connector,En... | connector/__openerp__.py | connector/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013-2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013-2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | agpl-3.0 | Python |
494d35234e30d368a9539910ff3ad6d45ed73125 | Add better docstring to simple_discovery | kragniz/containers | containers/containers.py | containers/containers.py | try:
from urllib import urlretrieve
except ImportError:
from urllib.request import urlretrieve
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
import os
def simple_discovery(name, var=None, secure=True):
'''Perform simple discovery and save the discovered... | try:
from urllib import urlretrieve
except ImportError:
from urllib.request import urlretrieve
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
import os
def simple_discovery(path, var=None, secure=True):
if secure:
protocol = 'https'
else:
... | mit | Python |
c15bd0b6a94f14e0cb735a95beaeda54058de617 | Update the build version | vlegoff/cocomud | src/version.py | src/version.py | BUILD = 19
| BUILD = 18
| bsd-3-clause | Python |
0db2fafff21837ca702848ccfc77e5798a198a90 | Update placeholders.py | tensorflow/tfx,tensorflow/tfx | tfx/dsl/component/experimental/placeholders.py | tfx/dsl/component/experimental/placeholders.py | # Lint as: python2, python3
# Copyright 2020 Google 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 req... | # Lint as: python2, python3
# Copyright 2020 Google 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 req... | apache-2.0 | Python |
51b2d93ab8affcdae6cfc426f452407644cb88ed | Make MPD module more resistant to crashing | 5225225/bar,5225225/bar | modules/mpd.py | modules/mpd.py | import socket
import signal
import linelib
import time
ID = "mpd"
def handler(x,y):
pass
signal.signal(signal.SIGUSR1, handler)
signal.signal(signal.SIGALRM, handler)
def mpd2dict(output):
x = output.split("\n")
d = dict()
for item in x[:-2]:
# MPD returns OK at the end, and there's a newlin... | import socket
import signal
import linelib
ID = "mpd"
def handler(x,y):
pass
signal.signal(signal.SIGUSR1, handler)
signal.signal(signal.SIGALRM, handler)
def mpd2dict(output):
x = output.split("\n")
d = dict()
for item in x[:-2]:
# MPD returns OK at the end, and there's a newline. This skip... | mit | Python |
6afb8d3b273db706ff78901211c3154ac1327122 | remove htmls | stellarstep/scripts,metasmile/scripts,stellarstep/scripts,stellarstep/scripts,stellarstep/scripts,metasmile/scripts,metasmile/scripts,metasmile/scripts,metasmile/scripts,stellarstep/scripts,stellarstep/scripts,metasmile/scripts | fastlane/data2deliver.py | fastlane/data2deliver.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import yaml, os, codecs, argparse
import re, mdpatterns
from os.path import expanduser
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
parser = argparse.ArgumentParser(description='Write deliver reso... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import yaml, os, codecs, argparse
import re, mdpatterns
from os.path import expanduser
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
parser = argparse.ArgumentParser(description='Write deliver reso... | mit | Python |
40e42371b202f6becf9924b8dd091489d8610976 | Update taglib to 1.9.1.99 | BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild | packages/taglib.py | packages/taglib.py | class TaglibPackage (GitHubPackage):
def __init__ (self):
GitHubPackage.__init__ (self, 'taglib', 'taglib', '1.9.1.99',
revision = '62ab41fa07bfe6456eafc7ffacbfa2043cba0668')
def build (self):
self.sh (
# Let's set a bunch of variables, to make cmake feel loved
'CMAKE_PREFIX_PATH=%{prefix}',
'CMAKE... | Package ('taglib', '1.6.3', sources = [
'http://developer.kde.org/~wheeler/files/src/%{name}-%{version}.tar.gz'
])
| mit | Python |
1a232e8a4de84902eff0aaa6c81d81b19047d357 | Update __init__ to make compatible with v0 | fastai/fastprogress | fastprogress/__init__.py | fastprogress/__init__.py | __version__ = "0.2.2"
__all__ = ["master_bar", "progress_bar"]
from .fastprogress import master_bar, progress_bar
| __version__ = "0.2.2"
| apache-2.0 | Python |
e889e2d0cab5267984ad0f188fe70a02851f76aa | Update __init__.py | arteria/django-ar-organizations,arteria/django-ar-organizations | organizations/middleware/__init__.py | organizations/middleware/__init__.py | # -*- coding: utf-8 -*-
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.core.exceptions import MultipleObjectsReturned
from organizations.models import Organization
from organizations.utils import set_current_organization_to_session, get_current_organization, skip_req... | # -*- coding: utf-8 -*-
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from organizations.models import Organization
from organizations.utils import set_current_organization_to_session, get_current_organization, skip_request
class OrganizationsMiddleware:
"""
Simple Mid... | bsd-2-clause | Python |
26ae2dfd2e981ef94a0877af41243931363e8b0c | use existing strings.sep_periods() | chlorm/conveyor,chlorm/conveyor | conveyor/paths.py | conveyor/paths.py | # Copyright (c) 2017-2018, Cody Opel <codyopel@gmail.com>
#
# 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 ... | # Copyright (c) 2017-2018, Cody Opel <codyopel@gmail.com>
#
# 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 ... | apache-2.0 | Python |
2ec9e4ddd666ddc77f6c70b09f56791ff7924720 | Use HTTPS bucket URL | GetBlimp/filepreviews-python | filepreviews/__init__.py | filepreviews/__init__.py | import os
import json
import hashlib
import logging
try:
# Python 3
from urllib.parse import urlencode, urlparse
from urllib.error import HTTPError
from urllib.request import urlopen
except ImportError:
# Python 2
from urlparse import urlparse
from urllib import urlencode, urlopen
from ... | import os
import json
import hashlib
import logging
try:
# Python 3
from urllib.parse import urlencode, urlparse
from urllib.error import HTTPError
from urllib.request import urlopen
except ImportError:
# Python 2
from urlparse import urlparse
from urllib import urlencode, urlopen
from ... | mit | Python |
30dcdb99aaf7139ea09bb049f15192ec72ebf47b | Update downloadable clang to r346388, subrevision 3 | jhseu/tensorflow,petewarden/tensorflow,hfp/tensorflow-xsmm,alsrgv/tensorflow,Intel-tensorflow/tensorflow,ppwwyyxx/tensorflow,ppwwyyxx/tensorflow,jhseu/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,kevin-coder/tensorflow-fork,petewarden/tensorflow,petewarden/tensorflow,petewarden/tensorflow,... | third_party/clang_toolchain/download_clang.bzl | third_party/clang_toolchain/download_clang.bzl | """ Helpers to download a recent clang release."""
def _get_platform_folder(os_name):
os_name = os_name.lower()
if os_name.startswith("windows"):
return "Win"
if os_name.startswith("mac os"):
return "Mac"
if not os_name.startswith("linux"):
fail("Unknown platform")
return "L... | """ Helpers to download a recent clang release."""
def _get_platform_folder(os_name):
os_name = os_name.lower()
if os_name.startswith("windows"):
return "Win"
if os_name.startswith("mac os"):
return "Mac"
if not os_name.startswith("linux"):
fail("Unknown platform")
return "L... | apache-2.0 | Python |
999d7a337c0bb2b55da85019abba26edbf5f467a | Add modes and utils submodules | fancompute/ceviche,fancompute/ceviche | ceviche/__init__.py | ceviche/__init__.py | # used for setup.py
name = "ceviche"
__version__ = '0.0.1'
from .fdtd import fdtd
from .fdfd import fdfd_ez, fdfd_hz, fdfd_ez_nl
from .jacobians import jacobian
from . import viz
from . import modes
from . import utils
| # used for setup.py
name = "ceviche"
__version__ = '0.0.1'
from .fdtd import fdtd
from .fdfd import fdfd_ez, fdfd_hz, fdfd_ez_nl
from .jacobians import jacobian
from . import viz
| mit | Python |
08316371f9d6963b7901b3018fa74af726e03a5b | Update example3.py | logpai/logparser,logpai/logparser,logpai/logparser,logpai/logparser | demo/example3.py | demo/example3.py | #!/usr/bin/env python
#To run this demo, put POP.py, rawlog.log (your raw log file) and this example3.py in the same directory. Then run "python example3.py".
#rawlog.log "logID\tlogMessage\n"
#We assume you run this script in the master of Yarn and Spark.
#In this demo, we assume the POP.py is under the same direct... | #!/usr/bin/env python
#To run this demo, put POP.py, rawlog.log (your raw log file) and this example3.py in the same directory. Then run "python example3.py".
#rawlog.log "logID\tlogMessage\n"
#We assume you run this script in the master of Yarn and Spark. If you are running Spark on top of single machine, delete "--m... | mit | Python |
fc1b14989453cfac9ae42116ac4ba5ef3c00f573 | Fix int() error in datetime value | ethanperez/t4k-rms,ethanperez/t4k-rms | dashboard/templatetags/datetime_duration.py | dashboard/templatetags/datetime_duration.py | from django import template
import datetime
register = template.Library()
# Turn a datetime.timedelta into a string
@register.filter(name='timedelta')
def timedelta(value):
if not value:
return "0"
int(time = value / 1000000)
delta = datetime.timedelta(0, time)
return str(delta)
| from django import template
import datetime
register = template.Library()
# Turn a datetime.timedelta into a string
@register.filter(name='timedelta')
def timedelta(value):
if not value:
return "0"
time = value / 1000000
delta = datetime.timedelta(0, time)
return str(delta)
| mit | Python |
d53989fae589afc6ac5e46eb9d08fda91b4b28db | add helper function for 'goodenough' | daniorerio/trackpy,daniorerio/trackpy | mr/tracking.py | mr/tracking.py | import trackpy.tracking as pt
import numpy as np
import pandas as pd
def track(features, search_range=5, memory=0, box_size=100):
frames = []
for frame_no, positions in features[['x', 'y']].groupby(features['frame']):
frame = []
frames.append(frame)
for i, pos in positions.iterrows():
... | import trackpy.tracking as pt
import numpy as np
import pandas as pd
def track(features, search_range=5, memory=0, box_size=100):
frames = []
for frame_no, positions in features[['x', 'y']].groupby(features['frame']):
frame = []
frames.append(frame)
for i, pos in positions.iterrows():
... | bsd-3-clause | Python |
b9a19969ddb4c42c35dd5722172014fdb226dfd8 | Remove forced HTML parser | oersted/cordis-scraper | cordis_scraper.py | cordis_scraper.py | import logging
import re
from collections import namedtuple
import requests
from bs4 import BeautifulSoup
PROJECT_URL = 'http://cordis.europa.eu/project/rcn/{}_en.html'
def extract_entry(doc, name):
try:
regex = re.compile('{0}[ ]*:?[ ]*'.format(name), re.IGNORECASE)
text = doc.find(text=regex)
... | import logging
import re
from collections import namedtuple
import requests
from bs4 import BeautifulSoup
PROJECT_URL = 'http://cordis.europa.eu/project/rcn/{}_en.html'
def extract_entry(doc, name):
try:
regex = re.compile('{0}[ ]*:?[ ]*'.format(name), re.IGNORECASE)
text = doc.find(text=regex)
... | mit | Python |
388c138950412d309b481d93378266c802b8e98c | Change prod url to https | haystack/eyebrowse-chrome-ext,haystack/eyebrowse-chrome-ext,haystack/eyebrowse-chrome-ext,haystack/eyebrowse-chrome-ext | deploy/deploy.py | deploy/deploy.py | import json
MAINJS_PATH = 'js/common.js'
MANIFEST_PATH = 'manifest.json'
DEV_URL = 'http://localhost:8000'
PROD_URL = 'https://eyebrowse.csail.mit.edu'
def rewriteBaseUrl():
with open(MAINJS_PATH, 'r+') as f:
text = f.read()
text = text.replace(DEV_URL, PROD_URL)
f.seek(0)
f.write(text)
f.trunc... | import json
MAINJS_PATH = 'js/common.js'
MANIFEST_PATH = 'manifest.json'
DEV_URL = 'http://localhost:8000'
PROD_URL = 'http://eyebrowse.csail.mit.edu'
def rewriteBaseUrl():
with open(MAINJS_PATH, 'r+') as f:
text = f.read()
text = text.replace(DEV_URL, PROD_URL)
f.seek(0)
f.write(text)
f.trunca... | mit | Python |
1ba4d84fb72a343cdf288d905d2029f1d2fbee12 | Remove assert from WagtailPagination.paginate_queryset method | mikedingjan/wagtail,rsalmaso/wagtail,rsalmaso/wagtail,jnns/wagtail,mixxorz/wagtail,wagtail/wagtail,mixxorz/wagtail,FlipperPA/wagtail,wagtail/wagtail,gasman/wagtail,zerolab/wagtail,torchbox/wagtail,mikedingjan/wagtail,timorieber/wagtail,zerolab/wagtail,gasman/wagtail,jnns/wagtail,zerolab/wagtail,kaedroho/wagtail,thenewg... | wagtail/api/v2/pagination.py | wagtail/api/v2/pagination.py | from collections import OrderedDict
from django.conf import settings
from rest_framework.pagination import BasePagination
from rest_framework.response import Response
from .utils import BadRequestError
class WagtailPagination(BasePagination):
def paginate_queryset(self, queryset, request, view=None):
li... | from collections import OrderedDict
from django.conf import settings
from rest_framework.pagination import BasePagination
from rest_framework.response import Response
from .utils import BadRequestError
class WagtailPagination(BasePagination):
def paginate_queryset(self, queryset, request, view=None):
li... | bsd-3-clause | Python |
01e29606a7504eed89d3ea88d97f9c9b86eb892e | Drop Python 2.0 support | takeflight/wagtailmodelchooser,takeflight/wagtailmodelchooser,takeflight/wagtailmodelchooser | wagtailmodelchooser/utils.py | wagtailmodelchooser/utils.py | import inspect
from functools import wraps
def kwarg_decorator(func):
"""
Turns a function that accepts a single arg and some kwargs in to a
decorator that can optionally be called with kwargs:
.. code-block:: python
@kwarg_decorator
def my_decorator(func, bar=True, baz=None):
... | import inspect
from functools import wraps
from django.utils import six
def kwarg_decorator(func):
"""
Turns a function that accepts a single arg and some kwargs in to a
decorator that can optionally be called with kwargs:
.. code-block:: python
@kwarg_decorator
def my_decorator(fun... | bsd-2-clause | Python |
bdc45cc03406d2a2604c37ab757a5a4734803a26 | debug 10 ptit oubli | simchanu29/ros_teleop | src/key_interpreter.py | src/key_interpreter.py | #!/usr/bin/env python
# coding=utf-8
import rospy
from pydoc import locate
from std_msgs.msg import String
import interpreter_callback
class key_interpreter():
def __init__(self):
self.cmd = Command()
def keys_cb(self, msg, twist_pub):
val = interpreter_callback.get_val(msg, topic_name, k... | #!/usr/bin/env python
# coding=utf-8
import rospy
from pydoc import locate
from std_msgs.msg import String
import interpreter_callback
class key_interpreter():
def __init__(self):
self.cmd = Command()
def keys_cb(self, msg, twist_pub):
val = interpreter_callback.get_val(msg, topic_name, k... | apache-2.0 | Python |
3a2a0b000945e74a842e74f1422cd671c8604503 | Fix syntax error | jasonsbrooks/ysniff-software,jasonsbrooks/ysniff-software | devops/makedb.py | devops/makedb.py | import boto.dynamodb
dynamoconn = boto.dynamodb.connect_to_region('us-east-1')
table_schema_macs = dynamoconn.create_schema(hash_key_name='MAC',hash_key_proto_value=str)
table_schema_ips = dynamoconn.create_schema(hash_key_name='LOCATION',hash_key_proto_value=str)
dynamoconn.create_table(name='dev2-ysniff',schema=tab... | import boto.dynamodb
dynamoconn = boto.dynamodb.connect_to_region('us-east-1')
table_schema_macs = dynamoconn.create_schema(hash_key_name='MAC',hash_key_proto_value=str)
table_schema_ips = dynamoconn.create_schema(hash_key_name='LOCATION',hash_key_proto_value=str)
#dynamoconn.create_table(name='dev-ysniff',schema=tab... | mit | Python |
6ac36cab3cc0ec5d3666fbdcf9c9e470f5d79e9c | Improve PCA analysis | democratia/political_science,Niederb/political_science | PCA-ja-stimmen/pca_analyse.py | PCA-ja-stimmen/pca_analyse.py | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 08 18:10:05 2017
@author: Thomas
"""
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from numpy import genfromtxt
import numpy as np
from sklearn.decomposition import PCA
import pandas as pd
data = genfromtxt('prozent-ja-stimmen.csv', delimiter=';')
importdata... | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 08 18:10:05 2017
@author: Thomas
"""
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from numpy import genfromtxt
import numpy as np
from sklearn.decomposition import PCA
import pandas as pd
data = genfromtxt('prozent-ja-stimmen.csv', delimiter=';')
importdata... | mit | Python |
9cba3c63a0b6af40a484bf9ebf92b23fe46b5c9e | add url patterns and fix encoding issues | yannrouillard/weboob,nojhan/weboob-devel,franek/weboob,Konubinix/weboob,RouxRC/weboob,frankrousseau/weboob,RouxRC/weboob,willprice/weboob,sputnick-dev/weboob,Konubinix/weboob,nojhan/weboob-devel,Boussadia/weboob,willprice/weboob,Boussadia/weboob,sputnick-dev/weboob,franek/weboob,Boussadia/weboob,willprice/weboob,Boussa... | modules/minutes20/browser.py | modules/minutes20/browser.py | "browser for 20minutes website"
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Julien Hebert
#
# This file is part of weboob.
#
# weboob 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 o... | "browser for 20minutes website"
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Julien Hebert
#
# This file is part of weboob.
#
# weboob 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 o... | agpl-3.0 | Python |
50d8aff17a84f68d773186c843d3a212931677fd | Update fetch_metrics.py | GoogleCloudPlatform/gcsfuse,GoogleCloudPlatform/gcsfuse,GoogleCloudPlatform/gcsfuse | perfmetrics/scripts/fetch_metrics.py | perfmetrics/scripts/fetch_metrics.py | """Executes fio_metrics.py and vm_metrics.py by passing appropriate arguments.
"""
import socket
import sys
import time
from fio import fio_metrics
from vm_metrics import vm_metrics
START_TIME = 'start_time'
END_TIME = 'end_time'
RW = 'rw'
INSTANCE = socket.gethostname()
PERIOD = 120
if __name__ == '__main__':
argv... | """Executes fio_metrics.py and vm_metrics.py by passing appropriate arguments.
"""
import socket
import sys
import time
from fio import fio_metrics
from vm_metrics import vm_metrics
START_TIME = 'start_time'
END_TIME = 'end_time'
RW = 'rw'
INSTANCE = socket.gethostname()
PERIOD = 120
if __name__ == '__main__':
argv... | apache-2.0 | Python |
75dc15e5c4a9cf6e442dbe9e14d3f78f977b2e68 | Support Twiggy 0.2 and 0.4 APIs | dieseldev/diesel | diesel/logmod.py | diesel/logmod.py | # vim:ts=4:sw=4:expandtab
'''A simple logging module that supports various verbosity
levels and component-specific subloggers.
'''
import sys
import time
from twiggy import log as olog, levels, outputs, formats, emitters
try:
from twiggy import add_emitters
except ImportError:
from twiggy import addEmitters as... | # vim:ts=4:sw=4:expandtab
'''A simple logging module that supports various verbosity
levels and component-specific subloggers.
'''
import sys
import time
from twiggy import log as olog, add_emitters, levels, outputs, formats, emitters
from functools import partial
diesel_format = formats.line_format
diesel_format.tra... | bsd-3-clause | Python |
5d2fd2a329854852a9be63124647ba7f038e9cc8 | Update models.py | andresmtz98/GoogleNews_Scraper_Django,andresmtz98/GoogleNews_Scraper_Django | news/models.py | news/models.py | from django.db import models
# Create your models here.
class News(models.Model):
title = models.TextField(max_length=10000000000000)
description = models.TextField(max_length=10000000000000000000000)
url = models.URLField()
date = models.CharField(max_length=255, null=True)
url_image = models.Tex... | from django.db import models
# Create your models here.
class News(models.Model):
title = models.TextField(max_length=10000000000000)
description = models.TextField(max_length=10000000000000000000000)
url = models.URLField()
date = models.CharField(max_length=255)
url_image = models.TextField(max_... | mit | Python |
933827e619c862be28c4dcf26d18a715905f27b9 | fix parent path | GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples | talent/job_search_commute_search.py | talent/job_search_commute_search.py | # Copyright 2020 Google LLC
#
# 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 agreed to in writing, ... | # Copyright 2020 Google LLC
#
# 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 agreed to in writing, ... | apache-2.0 | Python |
8a0260d10b0f627b4ce8b57345dda642b0b70a6b | Update admin.py | ebridge2/FNGS_website,ebridge2/FNGS_website,02agarwalt/FNGS_website,ebridge2/FNGS_website,ebridge2/FNGS_website,02agarwalt/FNGS_website,02agarwalt/FNGS_website | fngs/algorithms/admin.py | fngs/algorithms/admin.py | from django.contrib import admin
from .models import *
admin.site.register(Submission)
| from django.contrib import admin
# Register your models here.
| apache-2.0 | Python |
44c3daa83327951426347c85ac97fb4132376beb | Add prompt to docker sudo requests | getweber/weber-cli | cob/utils/docker.py | cob/utils/docker.py | from mitba import cached_function
import subprocess
@cached_function
def _check_if_sudo_needed():
proc = subprocess.Popen('docker ps', shell=True, stderr=subprocess.PIPE, stdout=subprocess.DEVNULL)
err = proc.communicate()[1].decode('utf-8')
if proc.returncode == 0:
return False
assert 'permis... | from mitba import cached_function
import subprocess
@cached_function
def _check_if_sudo_needed():
proc = subprocess.Popen('docker ps', shell=True, stderr=subprocess.PIPE, stdout=subprocess.DEVNULL)
err = proc.communicate()[1].decode('utf-8')
if proc.returncode == 0:
return False
assert 'permis... | bsd-3-clause | Python |
62453ed8f2de538d202215086f2f413490e73645 | add comments to cache utility | cozy-labs/cozy-fuse | cozyfuse/cache.py | cozyfuse/cache.py | import datetime
VALIDITY_PERIOD = datetime.timedelta(seconds=30)
class Cache:
'''
Utility to store data in memory for a short time and retrieve them quickly.
'''
def __init__(self, validity_period=VALIDITY_PERIOD):
'''
Initialize cache dict one for the data to store, the other one to... | import datetime
VALIDITY_PERIOD = datetime.timedelta(seconds=30)
class Cache:
def __init__(self, validity_period=VALIDITY_PERIOD):
self._cache = {}
self._timestamps = {}
self.validity_period = validity_period
def get(self, key):
now = datetime.datetime.now()
if self.... | bsd-3-clause | Python |
2adaf4be90441416181916216caf865e6f8607b7 | Fix black formatting | vitalik/django-ninja,vitalik/django-ninja,vitalik/django-ninja | ninja/files.py | ninja/files.py | from typing import Any, Callable, Dict, Iterable, Optional, Type
from django.core.files.uploadedfile import UploadedFile as DjangoUploadedFile
from pydantic.fields import ModelField
__all__ = ["UploadedFile"]
class UploadedFile(DjangoUploadedFile):
@classmethod
def __get_validators__(cls: Type["UploadedFile... | from typing import Any, Callable, Dict, Iterable, Optional, Type
from django.core.files.uploadedfile import UploadedFile as DjangoUploadedFile
from pydantic.fields import ModelField
__all__ = ["UploadedFile"]
class UploadedFile(DjangoUploadedFile):
@classmethod
def __get_validators__(cls: Type["UploadedFile... | mit | Python |
7a0f66ca7a95d7ac1e1d1ebbd025c77b7c7f2d97 | Add some docstrings. | moccu/django-cruditor,moccu/django-cruditor,moccu/django-cruditor | cruditor/forms.py | cruditor/forms.py | from django import forms
from django.contrib.auth.forms import AuthenticationForm, SetPasswordForm
from django.forms.formsets import DELETION_FIELD_NAME
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from tapeforms.contrib.bootstrap import BootstrapTapeformMixin
... | from django import forms
from django.contrib.auth.forms import AuthenticationForm, SetPasswordForm
from django.forms.formsets import DELETION_FIELD_NAME
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from tapeforms.contrib.bootstrap import BootstrapTapeformMixin
... | mit | Python |
d21111f80c8d51a94ddee245422747d87f4d03b5 | Fix config mix-up | jgeraerts/singlemailboxserver | singlemailboxserver/tap.py | singlemailboxserver/tap.py | import service
import getpass
from twisted.python import usage,util
from twisted.application import internet
class Options(usage.Options):
optParameters = [
["pop3port", None, 1100, "Port Number the POP3 server should listen on",int],
["pop3listen", None, '0.0.0.0',"IP address the POP3 se... | import service
import getpass
from twisted.python import usage,util
from twisted.application import internet
class Options(usage.Options):
optParameters = [
["pop3port", None, 1100, "Port Number the POP3 server should listen on",int],
["pop3listen", None, '0.0.0.0',"IP address the POP3 se... | mit | Python |
3ee7623d5e20fd4e156239fd5af4eedacdd452c0 | Fix PKCS#7 padding removal function | dimkarakostas/matasano-cryptochallenges | crypto_library.py | crypto_library.py | from Crypto.Cipher import AES
BLOCKSIZE = 16
class InvalidPaddingError(Exception):
'''Custom exception to handle cases of invalid PKCS#7 padding.'''
pass
def apply_pkcs_7_padding(plaintext, blocksize=BLOCKSIZE):
padding_length = blocksize - len(plaintext) % blocksize
pad = chr(padding_length)
r... | from Crypto.Cipher import AES
from string import printable
BLOCKSIZE = 16
class InvalidPaddingError(Exception):
'''Custom exception to handle cases of invalid PKCS#7 padding.'''
pass
def apply_pkcs_7_padding(plaintext, blocksize=BLOCKSIZE):
padding_length = blocksize - len(plaintext) % blocksize
pa... | mit | Python |
1ced74a087076877018ce1fad904576299b96159 | bump a new version | turbolabtech/Stream-Framework,SergioChan/Stream-Framework,izhan/Stream-Framework,izhan/Stream-Framework,smuser90/Stream-Framework,izhan/Stream-Framework,Anislav/Stream-Framework,Anislav/Stream-Framework,nikolay-saskovets/Feedly,Anislav/Stream-Framework,smuser90/Stream-Framework,SergioChan/Stream-Framework,nikolay-sasko... | feedly/__init__.py | feedly/__init__.py | __author__ = 'Thierry Schellenbach'
__copyright__ = 'Copyright 2012, Thierry Schellenbach'
__credits__ = ['Thierry Schellenbach, mellowmorning.com, @tschellenbach']
__license__ = 'BSD'
__version__ = '0.8.0'
__maintainer__ = 'Thierry Schellenbach'
__email__ = 'thierryschellenbach@gmail.com'
__status__ = 'Production'
| __author__ = 'Thierry Schellenbach'
__copyright__ = 'Copyright 2012, Thierry Schellenbach'
__credits__ = ['Thierry Schellenbach, mellowmorning.com, @tschellenbach']
__license__ = 'BSD'
__version__ = '0.7.9'
__maintainer__ = 'Thierry Schellenbach'
__email__ = 'thierryschellenbach@gmail.com'
__status__ = 'Production'
| bsd-3-clause | Python |
690f771ac17bb1b81aaf3b4ae06fd8eac0735ac8 | Add TestMainPage using WebTest module | terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python | myflaskapp/tests/test_unit.py | myflaskapp/tests/test_unit.py | import unittest
import requests
class SmokeTest(unittest.TestCase):
def test_maths(self):
self.assertEquals(6, 2 + 4)
def test_home_page_is_about_todo_lists(self):
request = requests.get('http://localhost:5000')
self.assertTrue(
request.content.startswith(bytes('\n\n<!doct... | import unittest
import requests
class SmokeTest(unittest.TestCase):
def test_maths(self):
self.assertEquals(6, 2 + 4)
def test_home_page_is_about_todo_lists(self):
request = requests.get('http://localhost:5000')
self.assertTrue(
request.content.startswith(bytes('\n\n<!doct... | mit | Python |
f0054d2a860b004925b6675360348157495720b3 | Update boston.py (#7566) | lakshayg/tensorflow,haeusser/tensorflow,JVillella/tensorflow,manipopopo/tensorflow,ishay2b/tensorflow,lukeiwanski/tensorflow,seanli9jan/tensorflow,nburn42/tensorflow,tntnatbry/tensorflow,petewarden/tensorflow,zycdragonball/tensorflow,ppwwyyxx/tensorflow,dongjoon-hyun/tensorflow,ychfan/tensorflow,thesuperzapper/tensorfl... | tensorflow/examples/learn/boston.py | tensorflow/examples/learn/boston.py | # Copyright 2016 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 appl... | # Copyright 2016 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 appl... | apache-2.0 | Python |
bf52298a63b23cf992734386da0e1cb816274052 | Bump version number for next release (#296) | jarrodmcc/OpenFermion,kevinsung/OpenFermion,kevinsung/OpenFermion,quantumlib/OpenFermion,kevinsung/OpenFermion,quantumlib/OpenFermion,quantumlib/OpenFermion,jarrodmcc/OpenFermion | src/openfermion/_version.py | src/openfermion/_version.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
# distribu... | # 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
# distribu... | apache-2.0 | Python |
899c216bc146acd1932a057da0f15e755fe32441 | Add current request to default jinja context | notapresent/yukata,notapresent/yukata | frontend/basehandlers.py | frontend/basehandlers.py | from __future__ import absolute_import
import urllib
from google.appengine.api import users
import webapp2
from webapp2_extras import jinja2
from webapp2_extras.appengine.users import login_required, admin_required
from models.account import Account
class BaseHandler(webapp2.RequestHandler):
"""
BaseHan... | from __future__ import absolute_import
import urllib
from google.appengine.api import users
import webapp2
from webapp2_extras import jinja2
from webapp2_extras.appengine.users import login_required, admin_required
from models.account import Account
class BaseHandler(webapp2.RequestHandler):
"""
BaseHan... | apache-2.0 | Python |
39b9c3b7fa882690a8a6af2314f8b4927e0e358f | Bump version 32 | hugovk/terroroftinytown,ArchiveTeam/terroroftinytown,hugovk/terroroftinytown,hugovk/terroroftinytown,ArchiveTeam/terroroftinytown,ArchiveTeam/terroroftinytown | terroroftinytown/client/__init__.py | terroroftinytown/client/__init__.py | VERSION = 32 # Please update this whenever .client or .services changes
# Please update MIN_VERSION_OVERRIDE and MIN_CLIENT_VERSION_OVERRIDE as needed
| VERSION = 31 # Please update this whenever .client or .services changes
# Please update MIN_VERSION_OVERRIDE and MIN_CLIENT_VERSION_OVERRIDE as needed
| mit | Python |
a283deaedd2369f3a963eb5bde638cb89eb7785b | Update Permissions.py | mikelambson/tcid,mikelambson/tcid,mikelambson/tcid,mikelambson/tcid | site/models/Permissions.py | site/models/Permissions.py | import datetime, re;
from sqlalchemy.orm import validates;
from server import DB, FlaskServer;
class Permissions(DB.Model):
id = DB.Column(DB.Integer, primary_key=True, autoincrement=True);
schedule_orders = DB.Column(DB.Integer(20));
manage_user = DB.Column(DB.Integer(20));
manage_role = DB.Column(DB.In... | import datetime, re;
from sqlalchemy.orm import validates;
from server import DB, FlaskServer;
from components.validation import validate_word;
class Permissions(DB.Model):
id = DB.Column(DB.Integer, primary_key=True, autoincrement=True);
schedule_orders = DB.Column(DB.Integer(20));
manage_user = DB.Column(... | bsd-3-clause | Python |
1494bc56008f50f24d9046f7713b27a250b54eeb | Remove unused fopenmp compile args | bennlich/scikit-image,rjeli/scikit-image,SamHames/scikit-image,dpshelio/scikit-image,ClinicalGraphics/scikit-image,Hiyorimi/scikit-image,pratapvardhan/scikit-image,emon10005/scikit-image,chintak/scikit-image,michaelaye/scikit-image,newville/scikit-image,ofgulban/scikit-image,chintak/scikit-image,blink1073/scikit-image,... | skimage/transform/setup.py | skimage/transform/setup.py | #!/usr/bin/env python
import os
from skimage._build import cython
base_path = os.path.abspath(os.path.dirname(__file__))
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
config = Configuration('transform', parent_package, top_... | #!/usr/bin/env python
import os
from skimage._build import cython
base_path = os.path.abspath(os.path.dirname(__file__))
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
config = Configuration('transform', parent_package, top_... | bsd-3-clause | Python |
8687f0538ce3f1050fb4253620e0d68373a3955e | Update main.py | clccmh/pomodoro | pomodoro/main.py | pomodoro/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import progressbar
import time
@click.command()
@click.option('--minutes', '-m', default=25, help='Number of minutes, default 25.')
@click.option('--seconds', '-s', help='Number of seconds.')
def main(minutes, seconds):
bar = progressbar.ProgressBar(widg... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import progressbar
import time
@click.command()
@click.option('--minutes', '-m', default=25, help='Number of minutes, default 25.')
@click.option('--seconds', '-s', help='Number of seconds.')
def main(minutes, seconds):
bar = progressbar.ProgressBar(widg... | mit | Python |
6065af0eac0950e425099c41c9cd448d3f030753 | update boundary option | berkeley-stat159/project-theta | code/findoutlier.py | code/findoutlier.py | import numpy as np
from outlierfunction import outlier
for i in range(1,10):
for j in range(1,4):
# set general path for reaching dvars and fd files
# also path for saving files
txtpath='ds005/sub00'+`i`+'/BOLD/task001_run00'+`j`+'/QA/'
# dvars path and name, call function to get ou... | import numpy as np
from outlierfunction import outlier
for i in range(1,10):
for j in range(1,4):
# set general path for reaching dvars and fd files
# also path for saving files
txtpath='ds005/sub00'+`i`+'/BOLD/task001_run00'+`j`+'/QA/'
# dvars path and name, call function to get ou... | bsd-3-clause | Python |
11c22e7e5ef04663280856ff09eab11caa8fc940 | Set the version to 0.1.3 final | xujun10110/king-phisher,guitarmanj/king-phisher,wolfthefallen/king-phisher,zigitax/king-phisher,guitarmanj/king-phisher,zigitax/king-phisher,wolfthefallen/king-phisher,wolfthefallen/king-phisher,wolfthefallen/king-phisher,zeroSteiner/king-phisher,drptbl/king-phisher,hdemeyer/king-phisher,securestate/king-phisher,drptbl... | king_phisher/version.py | king_phisher/version.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/version.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this lis... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/version.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this lis... | bsd-3-clause | Python |
7617110e9f3cf8b97991ce3727631f8ed800a571 | Add builtins._ doctest | ipython/ipython,ipython/ipython | IPython/testing/plugin/test_ipdoctest.py | IPython/testing/plugin/test_ipdoctest.py | """Tests for the ipdoctest machinery itself.
Note: in a file named test_X, functions whose only test is their docstring (as
a doctest) and which have no test functionality of their own, should be called
'doctest_foo' instead of 'test_foo', otherwise they get double-counted (the
empty function call is counted as a test... | """Tests for the ipdoctest machinery itself.
Note: in a file named test_X, functions whose only test is their docstring (as
a doctest) and which have no test functionality of their own, should be called
'doctest_foo' instead of 'test_foo', otherwise they get double-counted (the
empty function call is counted as a test... | bsd-3-clause | Python |
a62d038885dcf0b97c544f3b091f2bfba7cc23d7 | Add required renderer argument to Widget.render() call | mozilla/kitsune,mozilla/kitsune,mozilla/kitsune,mozilla/kitsune | kitsune/sumo/widgets.py | kitsune/sumo/widgets.py | # Based on http://djangosnippets.org/snippets/1580/
from django import forms
class ImageWidget(forms.FileInput):
"""
A ImageField Widget that shows a thumbnail.
"""
def __init__(self, attrs={}):
super(ImageWidget, self).__init__(attrs)
def render(self, name, value, attrs=None, renderer=N... | # Based on http://djangosnippets.org/snippets/1580/
from django import forms
class ImageWidget(forms.FileInput):
"""
A ImageField Widget that shows a thumbnail.
"""
def __init__(self, attrs={}):
super(ImageWidget, self).__init__(attrs)
def render(self, name, value, attrs=None):
o... | bsd-3-clause | Python |
f4ecffe3dd4cf875075dd8be45ec890e6d9093c8 | Fix partialy bug 153 | odyaka341/django-page-cms,PiRSquared17/django-page-cms,Alwnikrotikz/django-page-cms,odyaka341/django-page-cms,pombreda/django-page-cms,pombreda/django-page-cms,odyaka341/django-page-cms,Alwnikrotikz/django-page-cms,odyaka341/django-page-cms,google-code-export/django-page-cms,Alwnikrotikz/django-page-cms,PiRSquared17/dj... | pages/views.py | pages/views.py | """Default example views"""
from django.http import Http404, HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.contrib.sites.models import SITE_CACHE
from pages import settings
from pages.models import Page, Content, PageAlias
from pages.http import auto_render, get_language_from_... | """Default example views"""
from django.http import Http404, HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.contrib.sites.models import SITE_CACHE
from pages import settings
from pages.models import Page, Content, PageAlias
from pages.http import auto_render, get_language_from_... | bsd-3-clause | Python |
34c1b988876ec0a61941de6f42ca48eb96cf25c0 | Add init for sensor | vortexntnu/rov-control,vortexntnu/rov-control,vortexntnu/rov-control | sensor_interface/scripts/ms5837_interface.py | sensor_interface/scripts/ms5837_interface.py | #!/usr/bin/env python
import rospy
import ms5837
class Ms5837InterfaceNode(object):
def __init__(self):
rospy.init_node('pressure_node')
self.ms5837 = ms5837.MS5837(model=ms5837.MODEL_30BA, bus=1)
if not self.ms5837.init():
rospy.logfatal('Failed to initialise MS5837! Is the s... | #!/usr/bin/env python
import rospy
class Ms5837InterfaceNode(object):
def __init__(self):
rospy.init_node('pressure_node')
# Stuff
if __name__ == '__main__':
try:
pressure_node = Ms5837InterfaceNode()
rospy.spin()
except rospy.ROSInterruptException:
pass
| mit | Python |
aec48a22088a8c33171daa2cb34750e0cb88f075 | repair monitor module (was broken by circular import, use late import) | xpndlabs/kivy,viralpandey/kivy,darkopevec/kivy,jegger/kivy,manashmndl/kivy,youprofit/kivy,jffernandez/kivy,gonzafirewall/kivy,matham/kivy,jffernandez/kivy,tony/kivy,darkopevec/kivy,bhargav2408/kivy,jffernandez/kivy,VinGarcia/kivy,matham/kivy,KeyWeeUsr/kivy,vipulroxx/kivy,dirkjot/kivy,niavlys/kivy,Farkal/kivy,aron-bordi... | kivy/modules/monitor.py | kivy/modules/monitor.py | '''
Monitor module
==============
The Monitor module is a toolbar that shows the activity of your current
application :
* FPS
* Graph of input events
Usage
-----
For normal module usage, please see the :mod:`~kivy.modules` documentation.
'''
__all__ = ('start', 'stop')
from kivy.uix.label import Label
from kivy.... | '''
Monitor module
==============
The Monitor module is a toolbar that shows the activity of your current
application :
* FPS
* Graph of input events
Usage
-----
For normal module usage, please see the :mod:`~kivy.modules` documentation.
'''
from kivy.uix.label import Label
from kivy.graphics import Rectangle, Co... | mit | Python |
68a09ebeff38554915da812394aae98b1ed88e43 | add cov.urls | rezometz/paiji2,rezometz/paiji2,rezometz/paiji2 | paiji2/urls.py | paiji2/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^blog/', include('blog.urls')),
url(r'^', include('rezo.urls')),
url(r'^bulletin/', include('bulletin_board.urls')),
url(r'^cov/', include('cov.... | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^blog/', include('blog.urls')),
url(r'^', include('rezo.urls')),
url(r'^bulletin/', include('bulletin_board.urls')),
url(r'^', include('home.ur... | agpl-3.0 | Python |
51dc6b405cb11cef7ae6e24d7338b8f3114d0518 | Update __init__.py | josenavas/deblur,biocore/deblur | deblur/__init__.py | deblur/__init__.py | # -----------------------------------------------------------------------------
# Copyright (c) 2013, The Deblur Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------------------------------------... | # -----------------------------------------------------------------------------
# Copyright (c) 2013, The Deblur Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------------------------------------... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.