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 |
|---|---|---|---|---|---|---|---|---|
ce13dd0fd049782531e939da9a5238a6f5493b8d | Add note to misleading test | jakevdp/mpld3,mpld3/mpld3,jakevdp/mpld3,mpld3/mpld3 | mpld3/test_plots/test_date_ticks.py | mpld3/test_plots/test_date_ticks.py | """
Plot to test custom date axis tick locations and labels
NOTE (@vladh): We may see different behaviour in mpld3 vs d3 for the y axis, because we never
specified exactly how we want the y axis formatted. This is ok.
"""
from datetime import datetime
import matplotlib.pyplot as plt
import mpld3
def create_plot():
... | """Plot to test custom date axis tick locations and labels"""
from datetime import datetime
import matplotlib.pyplot as plt
import mpld3
def create_plot():
times = [datetime(2013, 12, i) for i in range(1, 20)]
ticks = [times[0], times[1], times[2], times[6], times[-2], times[-1]]
labels = [t.strftime("%Y-... | bsd-3-clause | Python |
cabb93635375aaa7e37945e874224001210ff321 | Create calseqs copies | BBN-Q/QGL,BBN-Q/QGL | BasicSequences/helpers.py | BasicSequences/helpers.py | from itertools import product
import operator
from ..PulsePrimitives import Id, X, MEAS
def create_cal_seqs(qubits, numRepeats, measChans=None):
"""
Helper function to create a set of calibration sequences.
Parameters
----------
qubits : logical channels, e.g. (q1,) or (q1,q2) (tuple)
numRepeats = number of ti... | from itertools import product
import operator
from ..PulsePrimitives import Id, X, MEAS
def create_cal_seqs(qubits, numRepeats, measChans=None):
"""
Helper function to create a set of calibration sequences.
Parameters
----------
qubits : logical channels, e.g. (q1,) or (q1,q2) (tuple)
numRepeats = number of ti... | apache-2.0 | Python |
1a17c08e9942ea565d7c08ed61d6dad21171f60d | Fix `Cquotation` defaults. | antske/coref_draft | multisieve_coreference/quotation.py | multisieve_coreference/quotation.py | class Cquotation:
'''
This class encodes source and quotation
'''
def __init__(self, sip):
'''
Constructor for quotations object
'''
self.sip = sip
self.span = None
self.string = None
self.beginOffset = None
self.endOffset = None
s... | class Cquotation:
'''
This class encodes source and quotation
'''
def __init__(self, sip):
'''
Constructor for quotations object
'''
self.sip = sip
self.span = []
self.string = ''
self.beginOffset = ''
self.endOffset = ''
self.sour... | apache-2.0 | Python |
760a43bf5829f4ad84afe8736ccd183c672e1841 | Enhance PEP8 | msoulier/tftpy | tftpy/TftpShared.py | tftpy/TftpShared.py | # vim: ts=4 sw=4 et ai:
# -*- coding: utf8 -*-
"""This module holds all objects shared by all other modules in tftpy."""
MIN_BLKSIZE = 8
DEF_BLKSIZE = 512
MAX_BLKSIZE = 65536
SOCK_TIMEOUT = 5
MAX_DUPS = 20
DEF_TIMEOUT_RETRIES = 3
DEF_TFTP_PORT = 69
# A hook for deliberately introducing delay in testing.
DELAY_BLOCK =... | # vim: ts=4 sw=4 et ai:
# -*- coding: utf8 -*-
"""This module holds all objects shared by all other modules in tftpy."""
MIN_BLKSIZE = 8
DEF_BLKSIZE = 512
MAX_BLKSIZE = 65536
SOCK_TIMEOUT = 5
MAX_DUPS = 20
DEF_TIMEOUT_RETRIES = 3
DEF_TFTP_PORT = 69
# A hook for deliberately introducing delay in testing.
DELAY_BLOCK... | mit | Python |
c029905a8ffad7fcf7ef70591dd0ad3f72365c09 | Update static import to support Django 3 | l1f7/wagtail_uplift,l1f7/wagtail_uplift,l1f7/wagtail_uplift | wagtail_uplift/wagtail_hooks.py | wagtail_uplift/wagtail_hooks.py | import django
from django.conf.urls import url
from django.utils.html import format_html
if django.VERSION[0] == "2":
from django.contrib.staticfiles.templatetags.staticfiles import static
elif django.VERSION[0] == "3":
from django.templatetags.static import static
from wagtail.core import hooks
from wagtail.ad... | from django.conf.urls import url
from django.utils.html import format_html
from django.contrib.staticfiles.templatetags.staticfiles import static
from wagtail.core import hooks
from wagtail.admin.menu import MenuItem
@hooks.register('insert_global_admin_css')
def global_admin_css():
html = '<link rel="stylesheet"... | bsd-3-clause | Python |
3c58ffd3e4c85e04ba9b20475ba86a7942e6b13a | Create the dataset using a Bunch object. | aplanas/hackweek11,aplanas/hackweek11 | models.py | models.py | #! /usr/bin/env python
import argparse
import csv
import numpy as np
from sklearn import preprocessing
from sklearn.datasets.base import Bunch
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.linear_model import SGDClassifier
from sk... | #! /usr/bin/env python
import argparse
import csv
def fetch_gitlog(data_path, stats=False):
"""Convert the CSV log into a datase suitable for scikit-learn."""
with open(data_path, 'rb') as csvfile:
csvreader = csv.reader(csvfile, delimiter=',', quotechar='"',
doublequot... | mit | Python |
ca22bbfdd36351e2b7d8f346b5a3ab81c94f7203 | Use latin-1 encoding when converting hmac secret to bytes | genenetwork/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2 | wqflask/utility/hmac.py | wqflask/utility/hmac.py | import hmac
import hashlib
from flask import url_for
from wqflask import app
def hmac_creation(stringy):
"""Helper function to create the actual hmac"""
secret = app.config['SECRET_HMAC_CODE']
hmaced = hmac.new(bytearray(secret, "latin-1"),
bytearray(stringy, "utf-8"),
... | import hmac
import hashlib
from flask import url_for
from wqflask import app
def hmac_creation(stringy):
"""Helper function to create the actual hmac"""
secret = app.config['SECRET_HMAC_CODE']
hmaced = hmac.new(bytearray(secret, "utf-8"),
bytearray(stringy, "utf-8"),
... | agpl-3.0 | Python |
526d5ad73612f814db7284bd3fb21827bcfdf5d1 | Remove wrong parens | guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle | lib/io.py | lib/io.py | import threading
class AsyncStreamReader(threading.Thread):
'''Reads a process stream from an alternate thread.
'''
def __init__(self, stream, on_data, *args, **kwargs):
'''
@stream
Stream to read from.
@on_data
Callback to call with bytes read from @stream.
... | import threading
class AsyncStreamReader(threading.Thread):
'''Reads a process stream from an alternate thread.
'''
def __init__(self, stream, on_data, *args, **kwargs):
'''
@stream
Stream to read from.
@on_data
Callback to call with bytes read from @stream.
... | bsd-3-clause | Python |
7a64bfb93e7b66ad8ff7a34b7710dc67661d3433 | Clean rewrite | davidgasquez/kaggle-airbnb | snippets/clean_users_data_frames.py | snippets/clean_users_data_frames.py | #!/usr/bin/env python
import pandas as pd
def main():
path = '../datasets/processed/'
train_users = pd.read_csv(path + 'processed_train_users.csv')
test_users = pd.read_csv(path + 'processed_test_users.csv')
percentage = 0.95
train_mask = train_users.isnull().sum() > train_users.shape[0] * perc... | import pandas as pd
train_users = pd.read_csv('../datasets/processed/processed_train_users.csv')
test_users = pd.read_csv('../datasets/processed/processed_test_users.csv')
percentage = 0.95
train_mask = train_users.isnull().sum() > train_users.shape[0] * percentage
train_to_remove = list(train_users.isnull().sum()[t... | mit | Python |
1d5a1b7ac385632fd4a235cafbd09e194ee24540 | Reduce code smell (steps implementation of a test) | bittner/behave-django,behave/behave-django,bittner/behave-django,behave/behave-django | features/steps/context-urlhelper.py | features/steps/context-urlhelper.py | from behave import when, then
from django.core.urlresolvers import reverse
from test_app.models import BehaveTestModel
@when(u'I call get_url() without arguments')
def without_args(context):
context.result = context.get_url()
@when(u'I call get_url("{url_path}") with an absolute path')
def path_arg(context, ur... | from behave import when, then
from django.core.urlresolvers import reverse
from test_app.models import BehaveTestModel
@when(u'I call get_url() without arguments')
def without_args(context):
context.__result = context.get_url()
@when(u'I call get_url("{url_path}") with an absolute path')
def path_arg(context, ... | mit | Python |
f607ce148b34ddf16bd9c09e1760b885fcdc1ab9 | Load any() implementation from compat.py in Python 2.4 | mjl/feincms,hgrimelid/feincms,feincms/feincms,nickburlett/feincms,joshuajonah/feincms,joshuajonah/feincms,nickburlett/feincms,hgrimelid/feincms,joshuajonah/feincms,feincms/feincms,pjdelport/feincms,michaelkuty/feincms,matthiask/django-content-editor,matthiask/feincms2-content,michaelkuty/feincms,joshuajonah/feincms,nic... | feincms/views/applicationcontent.py | feincms/views/applicationcontent.py | # ------------------------------------------------------------------------
# coding=utf-8
# ------------------------------------------------------------------------
from django.http import Http404
from feincms import settings
from feincms.content.application.models import retrieve_page_information
from feincms.module... | # ------------------------------------------------------------------------
# coding=utf-8
# ------------------------------------------------------------------------
from django.http import Http404
from feincms import settings
from feincms.content.application.models import retrieve_page_information
from feincms.module... | bsd-3-clause | Python |
02e28c869933ff0b5a838c071f4f1416fae5b380 | Implement Saboteur | Meerkov/fireplace,Ragowit/fireplace,amw2104/fireplace,Ragowit/fireplace,smallnamespace/fireplace,beheh/fireplace,smallnamespace/fireplace,NightKev/fireplace,jleclanche/fireplace,Meerkov/fireplace,amw2104/fireplace | fireplace/cards/tgt/neutral_rare.py | fireplace/cards/tgt/neutral_rare.py | from ..utils import *
##
# Minions
# Saboteur
class AT_086:
play = Buff(OPPONENT, "AT_086e")
class AT_086e:
update = CurrentPlayer(OWNER) & Refresh(ENEMY_HERO_POWER, {GameTag.COST: +5})
events = OWN_TURN_BEGIN.on(Destroy(SELF))
# Injured Kvaldir
class AT_105:
play = Hit(SELF, 3)
# Light's Champion
class AT_... | from ..utils import *
##
# Minions
# Injured Kvaldir
class AT_105:
play = Hit(SELF, 3)
# Light's Champion
class AT_106:
play = Silence(TARGET)
# Armored Warhorse
class AT_108:
play = JOUST & SetTag(SELF, {GameTag.CHARGE: True})
# Argent Watchman
class AT_109:
inspire = Buff(SELF, "AT_109e")
# Coliseum Ma... | agpl-3.0 | Python |
e0d0c4a7de0f656ec65c4cc8aa96736acf246c37 | support bashate's pycodestyle (pep8) output | maristgeek/SublimeLinter-contrib-bashate | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ben Stoutenburgh
# Copyright (c) 2016 Ben Stoutenburgh
#
# License: MIT
#
"""This module exports the Bashate plugin class."""
from SublimeLinter.lint import Linter
import os
class Bashate(Linter):
"""Provides ... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ben Stoutenburgh
# Copyright (c) 2016 Ben Stoutenburgh
#
# License: MIT
#
"""This module exports the Bashate plugin class."""
from SublimeLinter.lint import Linter
import os
class Bashate(Linter):
"""Provides ... | mit | Python |
5657dd437af76ecccdb671a1a09a4c6f9874aab0 | Check if epages6 settings are configured | ePages-rnd/SublimeLinter-contrib-perl-epages6 | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jonas Gratz
# Copyright (c) 2015 Jonas Gratz
#
# License: MIT
#
"""This module exports the PerlEpages6 plugin class."""
import sublime
from SublimeLinter.lint import Linter, util
class PerlEpages6(Linter):
"""... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jonas Gratz
# Copyright (c) 2015 Jonas Gratz
#
# License: MIT
#
"""This module exports the PerlEpages6 plugin class."""
import sublime
from SublimeLinter.lint import Linter, util
class PerlEpages6(Linter):
"""... | mit | Python |
46ba4f97d3ad2d673e8f3acb86d8c75905bc319f | Move attribute to "selector" in defaults from "syntax", as suggested by SublimeLinter | benedfit/SublimeLinter-contrib-pug-lint,benedfit/SublimeLinter-contrib-jade-lint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ben Edwards
# Copyright (c) 2015 Ben Edwards
#
# License: MIT
#
"""This module exports the PugLint plugin class."""
from SublimeLinter.lint import NodeLinter, util, highlight
class PugLint(NodeLinter):
"""Prov... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ben Edwards
# Copyright (c) 2015 Ben Edwards
#
# License: MIT
#
"""This module exports the PugLint plugin class."""
from SublimeLinter.lint import NodeLinter, util, highlight
class PugLint(NodeLinter):
"""Prov... | mit | Python |
4bf01c350744e8cbf00750ec85d825f22e06dd29 | Handle new sublime syntax: bash | SublimeLinter/SublimeLinter-shellcheck | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by NotSqrt
# Copyright (c) 2013 NotSqrt
#
# License: MIT
#
"""
This module exports the Shellcheck plugin class.
Example output with --format gcc
-:230:7: warning: Quote this to prevent word splitting. [SC2046]
-:230:7... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by NotSqrt
# Copyright (c) 2013 NotSqrt
#
# License: MIT
#
"""
This module exports the Shellcheck plugin class.
Example output with --format gcc
-:230:7: warning: Quote this to prevent word splitting. [SC2046]
-:230:7... | mit | Python |
281f8df2fa16bae4f6f81c39ceeb62456b29c92f | add ability to infer GOPATH from filename | sirreal/SublimeLinter-contrib-golint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jon Surrell and Jeremy Jay
# Copyright (c) 2014 Jon Surrell
#
# License: MIT
#
"""This module exports the Golint plugin class."""
from SublimeLinter.lint import Linter, util, highlight, persist
import os
class Gol... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jon Surrell
# Copyright (c) 2014 Jon Surrell
#
# License: MIT
#
"""This module exports the Golint plugin class."""
from SublimeLinter.lint import Linter, util, highlight
class Golint(Linter):
"""Provides an i... | mit | Python |
95ab48b9d25fe2803ff0a1431701f5247fb2ac71 | Update to use selector for sl4 | jasjuang/SublimeLinter-contrib-cmakelint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jason Juang
# Copyright (c) 2015 Jason Juang
#
# License: MIT
#
"""This module exports the cmakelint plugin class."""
import sublime
from SublimeLinter.lint import Linter, util
# Settings file locations.
settings_f... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jason Juang
# Copyright (c) 2015 Jason Juang
#
# License: MIT
#
"""This module exports the cmakelint plugin class."""
import sublime
from SublimeLinter.lint import Linter, util
# Settings file locations.
settings_f... | mit | Python |
92f2fa1c48bb4742314f998657e981782d0a7569 | use FETCH_HEAD default for version_from_git | ericmjl/bokeh,bokeh/bokeh,ericmjl/bokeh,ericmjl/bokeh,bokeh/bokeh,ericmjl/bokeh,bokeh/bokeh,ericmjl/bokeh,bokeh/bokeh,bokeh/bokeh | conftest.py | conftest.py | pytest_plugins = (
"bokeh._testing.plugins.implicit_mark",
"bokeh._testing.plugins.ipython",
"bokeh._testing.plugins.pandas",
)
from bokeh._testing.util.git import version_from_git
# Unfortunately these seem to all need to be centrally defined at the top level
def pytest_addoption(parser):
# plugins/... | pytest_plugins = (
"bokeh._testing.plugins.implicit_mark",
"bokeh._testing.plugins.ipython",
"bokeh._testing.plugins.pandas",
)
from bokeh._testing.util.git import version_from_git
# Unfortunately these seem to all need to be centrally defined at the top level
def pytest_addoption(parser):
# plugins/... | bsd-3-clause | Python |
1fec4c084e4d96d66245aaf90882047857724b90 | Fix ft for my bets page | asyler/betleague,asyler/betleague,asyler/betleague | functional_tests/pages/user_bets.py | functional_tests/pages/user_bets.py | class UserBetsPage(object):
def __init__(self, test):
self.test = test
self.url = self.test.live_server_url + '/my_bets'
def go(self):
self.test.browser.get(self.url)
def get_matches(self):
return self.test.browser \
.find_elements_by_css_selector('tr.match')
... | class UserBetsPage(object):
def __init__(self, test):
self.test = test
self.url = self.test.live_server_url + '/my_bets'
def go(self):
self.test.browser.get(self.url)
def get_matches(self):
return self.test.browser \
.find_elements_by_css_selector('div.match')
... | mit | Python |
d8ae3ab5f6baf0ee965548f8df37e1a4b331a8aa | Update install script with full file paths | TactileUniverse/3D-Printed-Galaxy-Software | install_all_addons.py | install_all_addons.py | import bpy
import os
# get current directory
current_dir = os.getcwd()
# install and activate `emboss plane`
emboss_plane_filepath = os.path.join(current_dir, 'emboss_plane.py')
bpy.ops.wm.addon_install(filepath=emboss_plane_filepath)
bpy.ops.wm.addon_enable(module='emboss_plane')
# install and activate `name plate`... | import bpy
# install and activate `emboss plane`
bpy.ops.wm.addon_install(filepath='emboss_plane.py')
bpy.ops.wm.addon_enable(module='emboss_plane')
# install and activate `name plate`
bpy.ops.wm.addon_install(filepath='name_plate.py')
bpy.ops.wm.addon_enable(module='name_plate')
# save user preferences
bpy.ops.wm.s... | mit | Python |
25530d5ad8e880f6596217e4b86eb6d9ed8b5a9a | Include unused and schema-related gradings in grading scheme administration. Fixes #92. | troeger/opensubmit,troeger/opensubmit,troeger/opensubmit,troeger/opensubmit,troeger/opensubmit | web/opensubmit/admin/gradingscheme.py | web/opensubmit/admin/gradingscheme.py | # Grading scheme admin interface
from django.contrib.admin import ModelAdmin
from django.db.models import Q
from django.core.urlresolvers import resolve
from opensubmit.models import Course, Grading
def gradings(gradingScheme):
''' Determine the list of gradings in this scheme as rendered string.
TODO: Us... | # Grading scheme admin interface
from django.contrib.admin import ModelAdmin
from django.db.models import Q
from opensubmit.models import Course, Grading
def gradings(gradingScheme):
''' Determine the list of gradings in this scheme as rendered string.
TODO: Use nice little icons instead of (p) / (f) mark... | agpl-3.0 | Python |
fa9c42926820972860eced3ca0216a69e11e2746 | Remove unused imports | bcb/jsonrpcclient | jsonrpcclient/parse.py | jsonrpcclient/parse.py | """
Parse response text, returning JSONRPCResponse objects.
"""
from typing import List, Union
from json import loads as deserialize
import jsonschema # type: ignore
from pkg_resources import resource_string
from .response import JSONRPCResponse
schema = deserialize(resource_string(__name__, "response-schema.json")... | """
Parse response text, returning JSONRPCResponse objects.
"""
from typing import List, Union
from json import loads as deserialize, JSONDecodeError
import jsonschema # type: ignore
from pkg_resources import resource_string
from . import exceptions
from .response import JSONRPCResponse
schema = deserialize(resourc... | mit | Python |
d0136d302524ff08e33ebdbab835b499aeeb2c2c | Fix 'get_absolute_url()' refer to url | hyesun03/k-board,guswnsxodlf/k-board,hyesun03/k-board,darjeeling/k-board,kboard/kboard,cjh5414/kboard,cjh5414/kboard,guswnsxodlf/k-board,hyesun03/k-board,cjh5414/kboard,guswnsxodlf/k-board,kboard/kboard,kboard/kboard | kboard/board/models.py | kboard/board/models.py | from django.db import models
from django.core.urlresolvers import reverse
from django_summernote import models as summer_model
from django_summernote import fields as summer_fields
class Board(models.Model):
def get_absolute_url(self):
return reverse('board:post_list', args=[self.id])
slug = models.T... | from django.db import models
from django.core.urlresolvers import reverse
from django_summernote import models as summer_model
from django_summernote import fields as summer_fields
class Board(models.Model):
def get_absolute_url(self):
return reverse('board:post_list', args=[self.id])
slug = models.T... | mit | Python |
426990c208a728ecb96d4c05c8d8308aee5140e3 | make summary use basicstarmodel | timothydmorton/isochrones,timothydmorton/isochrones | isochrones/summary.py | isochrones/summary.py | import os, sys, re
import numpy as np
import pandas as pd
import logging
from multiprocessing import Pool
from .starmodel import StarModel, BasicStarModel
def get_quantiles(name, rootdir='.', columns=['eep','mass','radius','age','feh','distance','AV'],
qs=[0.05,0.16,0.5,0.84,0.95], modelname='mist_s... | import os, sys, re
import numpy as np
import pandas as pd
import logging
from multiprocessing import Pool
from .starmodel import StarModel
def get_quantiles(name, rootdir='.', columns=['eep','mass','radius','age','feh','distance','AV'],
qs=[0.05,0.16,0.5,0.84,0.95], modelname='mist_starmodel_single'... | mit | Python |
373b9c6a97d20396e393da6208ce18d358398517 | Bring back logging level setting | amino-data/redash,rockwotj/redash,moritz9/redash,alexanderlz/redash,M32Media/redash,44px/redash,guaguadev/redash,chriszs/redash,imsally/redash,rockwotj/redash,chriszs/redash,pubnative/redash,ninneko/redash,stefanseifert/redash,pubnative/redash,stefanseifert/redash,alexanderlz/redash,M32Media/redash,akariv/redash,amino-... | manage.py | manage.py | #!/usr/bin/env python
"""
CLI to manage redash.
"""
import atfork
atfork.monkeypatch_os_fork_functions()
import atfork.stdlib_fixer
atfork.stdlib_fixer.fix_logging_module()
import logging
import time
from redash import settings, app, db, models, data_manager, __version__
from flask.ext.script import Manager
manager =... | #!/usr/bin/env python
"""
CLI to manage redash.
"""
import atfork
atfork.monkeypatch_os_fork_functions()
import atfork.stdlib_fixer
atfork.stdlib_fixer.fix_logging_module()
import logging
import time
from redash import settings, app, db, models, data_manager, __version__
from flask.ext.script import Manager
manager =... | bsd-2-clause | Python |
4f4ba39bf2d270ef1cb34afe1a5ebe7816d448b7 | Set hostname to '' so the server binds to all interfaces. | kurtraschke/cadors-parse,kurtraschke/cadors-parse | manage.py | manage.py | #!/usr/bin/env python
from werkzeug import script
def make_app():
from cadorsfeed.application import CadorsFeed
return CadorsFeed()
def make_shell():
from cadorsfeed import utils
application = make_app()
return locals()
action_runserver = script.make_runserver(make_app, use_reloader=True, hostn... | #!/usr/bin/env python
from werkzeug import script
def make_app():
from cadorsfeed.application import CadorsFeed
return CadorsFeed()
def make_shell():
from cadorsfeed import utils
application = make_app()
return locals()
action_runserver = script.make_runserver(make_app, use_reloader=True)
actio... | mit | Python |
d4dd0fe826fb187b40e807417092118b40f23517 | Use production settings as default | andrijan/csgostats,andrijan/csgostats,andrijan/csgostats,andrijan/csgostats | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| bsd-3-clause | Python |
6b144b186a0c26bae3727a876ec12c03fc11fa42 | Fix ordering in init | andrewsnowden/flask-starter,litnimax/flask-starter,andrewsnowden/flask-starter,litnimax/flask-starter,andrewsnowden/flask-starter,wenxer/flask-starter,wenxer/flask-starter,wenxer/flask-starter,litnimax/flask-starter | manage.py | manage.py | from flask.ext.script import Manager
from flask.ext.alembic import ManageMigrations
import os
import datetime
import bcrypt
from flask.ext.security.utils import encrypt_password
from starter import app, db
from starter.users.models import user_datastore
manager = Manager(app)
manager.add_command("migrate", ManageMig... | from flask.ext.script import Manager
from flask.ext.alembic import ManageMigrations
import os
import datetime
import bcrypt
from flask.ext.security.utils import encrypt_password
from starter import app, db
from starter.users.models import user_datastore
manager = Manager(app)
manager.add_command("migrate", ManageMig... | mit | Python |
7668ba1b467e2c48719fc6e3a53932ec1bfb9d18 | Remove the cdecimal debug print | cmptrgeekken/evething,madcowfred/evething,cmptrgeekken/evething,Gillingham/evething,Gillingham/evething,Gillingham/evething,cmptrgeekken/evething,madcowfred/evething,madcowfred/evething,madcowfred/evething,Gillingham/evething,cmptrgeekken/evething,cmptrgeekken/evething | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
# try using cdecimal for faster Decimal type
try:
import cdecimal
except ImportError:
pass
else:
sys.modules["decimal"] = cdecimal
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "evething.settings")
from django.core.managemen... | #!/usr/bin/env python
import os
import sys
# try using cdecimal for faster Decimal type
try:
import cdecimal
except ImportError:
pass
else:
sys.modules["decimal"] = cdecimal
print 'cdecimal'
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "evething.settings")
from ... | bsd-2-clause | Python |
249ff5137ec31d0417bed6ae38ee438447aa7e46 | Update person.py | Libcsh/bhdbs-persons | person.py | person.py | import json
import requests
class Person:
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
@property
def siblings_count(self):
return len(self.siblings)
@property
def parents_count(self):
return len(self.parents)
@property
def partners_id(self):
partners_ids = ... | import json
import requests
class Person:
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
@property
def siblings_count(self):
return len(self.siblings)
@property
def parents_count(self):
return len(self.parents)
@property
def partners_id(self):
partners_ids = ... | apache-2.0 | Python |
e55cf0bda8eacb12378a6cb92d61070eecf717ed | Revert "version bump 3.7.1.1" | fanhero/thumbor,fanhero/thumbor,fanhero/thumbor,fanhero/thumbor | thumbor/__init__.py | thumbor/__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
'''This is the main module in thumbor'''
__version__ = "3.7.1"
| #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
'''This is the main module in thumbor'''
__version__ = "3.7.1.1"
| mit | Python |
36b76c4f85ae814ec3a493284516d40b8d4a0914 | Bump to 6.0.0b5 | fanhero/thumbor,fanhero/thumbor,fanhero/thumbor,fanhero/thumbor | thumbor/__init__.py | thumbor/__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
'''This is the main module in thumbor'''
__version__ = "6.0.0b5"
__r... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
'''This is the main module in thumbor'''
__version__ = "6.0.0b4"
__r... | mit | Python |
0dc2570f8de3538b84d64c28cbfdb40878240716 | Fix user permissions on profile => Don't forget to manually call init_good_profile_perm() | ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople | apps/member/models.py | apps/member/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from userena.models import UserenaLanguageBaseProfile
from django_countries import CountryField
from apps.i4p_base.models import Location
from guardian.shortcuts import assign
from django.db.models.signals import post_save
class I4pPr... | from django.db import models
from django.utils.translation import ugettext_lazy as _
from userena.models import UserenaLanguageBaseProfile, PROFILE_PERMISSIONS
from django_countries import CountryField
from apps.i4p_base.models import Location
class I4pProfile(UserenaLanguageBaseProfile):
GENDER_TYPE = (
('... | agpl-3.0 | Python |
507865570573ae75f1315ba0d8ea19c5ce2e2522 | Drop Python 2 compatibility in gzip.lines_from_stream. | jaraco/jaraco.stream | jaraco/stream/gzip.py | jaraco/stream/gzip.py | """
Routines for reliably decompressing gzip streams
in iterables.
"""
import zlib
import itertools
from more_itertools.more import peekable
from . import buffer
def read_chunks(stream, block_size=2 ** 10):
"""
Given a byte stream with reader, yield chunks of block_size
until the stream is consusmed.
... | """
Routines for reliably decompressing gzip streams
in iterables.
"""
import zlib
import itertools
from more_itertools.more import peekable
from . import buffer
def read_chunks(stream, block_size=2 ** 10):
"""
Given a byte stream with reader, yield chunks of block_size
until the stream is consusmed.
... | mit | Python |
92873a166d935c865bbc53076dcdb2e8f7d89f2c | revert owlbot main branch templates (#84) | googleapis/python-data-qna,googleapis/python-data-qna | owlbot.py | owlbot.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | apache-2.0 | Python |
8e143d15964220d4ee27510ebabe8b438f0283d7 | Add activities structure to detect list request | iwi/linkatos,iwi/linkatos | linkatos/activities.py | linkatos/activities.py | from . import parser
from . import printer
from . import firebase as fb
from . import reaction as react
def is_empty(events):
return ((events is None) or (len(events) == 0))
def is_url(url_cache):
return url_cache is not None
def is_not_from_bot(bot_id, user_id):
return not bot_id == user_id
def eve... | from . import parser
from . import printer
from . import firebase as fb
from . import reaction as react
def is_empty(events):
return ((events is None) or (len(events) == 0))
def is_url(url_cache):
return url_cache is not None
def is_not_from_bot(bot_id, user_id):
return not bot_id == user_id
def eve... | mit | Python |
62f36a30af070c68b1f595b7ac39d7238eb4f9a0 | Add bits about booleans | MadPUG/Introduction-To-Python,mjmaldonado/Introduction-To-Python,MadPUG/Introduction-To-Python,mjmaldonado/Introduction-To-Python | lesson_002/booleans.py | lesson_002/booleans.py | from __future__ import print_function # Ignore this line until next month
# Section 7 of Lesson 2
# There are only two boolean values
True
False
# Booleans are very important for our next topic, but let's see where they
# can come from
print("1 == 1:", 1 == 1)
print("1 == 2:", 1 == 2)
# Okay so when we say 1 equal... | mit | Python | |
c634e23ffb3c2f884699003767f30c0eb6a936a4 | Fix class name. | alejandroautalan/pygubu,alejandroautalan/pygubu | pygubu/plugins/tksheet/__init__.py | pygubu/plugins/tksheet/__init__.py | import importlib
from pygubu.i18n import _
from pygubu.api.v1 import BuilderLoaderPlugin
_designer_tab_label = _("tksheet")
_plugin_uid = "tksheet"
class TksheetLoader(BuilderLoaderPlugin):
_module = "pygubu.plugins.tksheet.sheet"
def do_activate(self) -> bool:
spec = importlib.util.find_spec("tksh... | import importlib
from pygubu.i18n import _
from pygubu.api.v1 import BuilderLoaderPlugin
_designer_tab_label = _("tksheet")
_plugin_uid = "tksheet"
class StandardTKWidgetsLoader(BuilderLoaderPlugin):
_module = "pygubu.plugins.tksheet.sheet"
def do_activate(self) -> bool:
spec = importlib.util.find_... | mit | Python |
a3f2a763b2ddb54a1c6c21c4b5153d08779848aa | test fix chef | MadeiraCloud/salt,MadeiraCloud/salt,MadeiraCloud/salt | sources/salt/modules/chef.py | sources/salt/modules/chef.py | # -*- coding: utf-8 -*-
'''
Execute chef in server or solo mode
'''
# Import Python libs
import logging
# Import Salt libs
import salt.utils
import salt.utils.decorators as decorators
log = logging.getLogger(__name__)
def __virtual__():
'''
Only load if chef is installed
'''
if salt.utils.which('ch... | # -*- coding: utf-8 -*-
'''
Execute chef in server or solo mode
'''
# Import Python libs
import logging
# Import Salt libs
import salt.utils
import salt.utils.decorators as decorators
log = logging.getLogger(__name__)
def __virtual__():
'''
Only load if chef is installed
'''
if salt.utils.which('ch... | apache-2.0 | Python |
94a2fd51a3d28f2f9a22c2777933ffc2db325d38 | Bump version | markstory/lint-review,markstory/lint-review,markstory/lint-review | lintreview/__init__.py | lintreview/__init__.py | __version__ = '2.34.3'
| __version__ = '2.34.2'
| mit | Python |
0d5f89ddf90cdfd623855dbd00b48ae2a6262d5e | Update ipc_lista1.6.py | any1m1c/ipc20161 | lista1/ipc_lista1.6.py | lista1/ipc_lista1.6.py | #ipc_lista1.6
#Professor: Jucimar Junior
#Any Mendes Carvalho -
#
#
#
#
#Faça um programa
| #ipc_lista1.6
#Professor: Jucimar Junior
#Any Mendes Carvalho -
#
#
#
#
#Faça um
| apache-2.0 | Python |
49bee8d30360e9df8b341cd52a31b8e4f3f478df | Update ipc_lista1.7.py | any1m1c/ipc20161 | lista1/ipc_lista1.7.py | lista1/ipc_lista1.7.py | #ipc_lista1.7
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
#Faça um programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o #usuário.
altura = input
| #ipc_lista1.7
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
#Faça um programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o #usuário.
altura =
| apache-2.0 | Python |
896d39120d732527837581a5c2acbe1ac73f383c | undo changes to local test settings | praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo | local_test_settings.py | local_test_settings.py | from testapp.settings.base import * # noqa: F403, F405
ALLOWED_HOSTS = [
'localhost',
'.localhost',
'site2',
]
ENABLE_SSO = True
MIDDLEWARE_CLASSES += ( # noqa: F405
'molo.core.middleware.MoloCASMiddleware',
'molo.core.middleware.Custom403Middleware',
'molo.core.middleware.MaintenanceModeM... | from testapp.settings.base import * # noqa: F403, F405
ALLOWED_HOSTS = [
'localhost',
'.localhost',
'site2',
]
ENABLE_SSO = False
MIDDLEWARE_CLASSES += ( # noqa: F405
'molo.core.middleware.MaintenanceModeMiddleware',
)
AUTHENTICATION_BACKENDS = (
'molo.profiles.backends.MoloProfilesModelBack... | bsd-2-clause | Python |
72181de1a679a3df8c5f32fffb026402c92842f7 | Add survey_id. | ISIFoundation/influenzanet-epidb-client | python/examples/submit_response.py | python/examples/submit_response.py | #!/usr/bin/env python
import sys
sys.path += ['../src']
from epidb_client import EpiDBClient
api_key = 'your-epidb-api-key-here'
data = {
'user_id': '1c66bb91-33fd-4c6c-9c11-8ddd94164ae8',
'date': '2009-09-09 09:09:09',
'survey_id': 'example-1.0',
'answers': {
'q1': 1,
'q2': True,
... | #!/usr/bin/env python
import sys
sys.path += ['../src']
from epidb_client import EpiDBClient
api_key = 'your-epidb-api-key-here'
data = {
'user_id': '1c66bb91-33fd-4c6c-9c11-8ddd94164ae8',
'date': '2009-09-09 09:09:09',
'answers': {
'q1': 1,
'q2': True,
'q3': [ 1, 2, 3 ],
... | agpl-3.0 | Python |
54f08d2ca1e69bf89009e0a7b7ae8245bfe18bde | Add condition for get_log_docs() | keepzero/fluent-mongo-parser | parser.py | parser.py | #!/usr/bin/env python
from manager import PluginManager
from config import MongoSource
class LogDocGenerator:
def __init__(self, log_format, log_source):
"""docstring for __init__"""
self.collection = log_source
def get_log_docs(self, condition={}):
"""docstring for get_log_docs"""
... | #!/usr/bin/env python
from manager import PluginManager
from config import MongoSource
class LogDocGenerator:
def __init__(self, log_format, log_source):
"""docstring for __init__"""
self.collection = log_source
def get_log_docs(self):
"""docstring for get_log_docs"""
return s... | apache-2.0 | Python |
cb7ce05a8d52d97087791d154823ae70312220ef | Test that user can input a to-do item | ajgeers/tdd-with-python,ajgeers/tdd-with-python | functional_tests.py | functional_tests.py | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)
def tearDown(self):
self.browser.quit()
def test_can_start_... | from selenium import webdriver
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)
def tearDown(self):
self.browser.quit()
def test_can_start_a_list_and_retrieve_it_later(self):
# U... | mit | Python |
247710a12df855d41b2e5e622c56dbe86e236bd0 | fix typo | arskom/spyne,arskom/spyne,arskom/spyne | spyne/protocol/html/_base.py | spyne/protocol/html/_base.py | # encoding: utf8
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version... | # encoding: utf8
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version... | lgpl-2.1 | Python |
59bf9eca217ef8ef3011124d1ff9e1570e8ff76d | Simplify stony's response to exactly what the user sent | cworth-gh/stony | plugins/clue/clue.py | plugins/clue/clue.py | from __future__ import unicode_literals
# don't convert to ascii in py2.7 when creating string to return
crontable = []
outputs = []
def process_message(data):
outputs.append([data['channel'], data['text']])
| from __future__ import unicode_literals
# don't convert to ascii in py2.7 when creating string to return
crontable = []
outputs = []
def process_message(data):
outputs.append([data['channel'], "from repeat1 \"{}\" in channel {}".format(
data['text'], data['channel'])]
)
| mit | Python |
9e78dcabf170de12f40bcdeb823fecb5987a9626 | Fix port passing | thinkingmachines/deeplearningworkshop,thinkingmachines/deeplearningworkshop | emojify/emojify.py | emojify/emojify.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import os.path
from base64 import b64encode
from io import BytesIO
from werkzeug.utils import secure_filename
from flask import Flask, abort, render_template, request, url_for
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
f... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import os.path
from base64 import b64encode
from io import BytesIO
from werkzeug.utils import secure_filename
from flask import Flask, abort, render_template, request, url_for
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
f... | mit | Python |
e5fafa186f113ad9f58c2b8955f95127d5c7228b | Update explorer/urls.py with latest conventions | tzangms/django-sql-explorer,groveco/django-sql-explorer,dsanders11/django-sql-explorer,dsanders11/django-sql-explorer,dsanders11/django-sql-explorer,grantmcconnaughey/django-sql-explorer,enstrategic/django-sql-explorer,epantry/django-sql-explorer,groveco/django-sql-explorer,grantmcconnaughey/django-sql-explorer,tzangms... | explorer/urls.py | explorer/urls.py | from django.conf.urls import patterns, url
from explorer.views import (
QueryView,
CreateQueryView,
PlayQueryView,
DeleteQueryView,
ListQueryView,
ListQueryLogView,
download_query,
view_csv_query,
email_csv_query,
download_csv_from_sql,
schema,
format_sql,
)
urlpatterns ... | from django.conf.urls import patterns, url
from explorer.views import QueryView, CreateQueryView, PlayQueryView, DeleteQueryView, ListQueryView, ListQueryLogView
urlpatterns = patterns('',
url(r'(?P<query_id>\d+)/$', QueryView.as_view(), name='query_detail'),
url(r'(?P<query_id>\d+)/download$', 'explorer.views... | mit | Python |
943958400203cad8ab9d7a4d247721b210aaa9ab | Update localization example. | r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview | examples/localization.py | examples/localization.py | # -*- coding: utf-8 -*-
import webview
"""
This example demonstrates how to localize GUI strings used by pywebview.
"""
if __name__ == '__main__':
localization = {
'global.saveFile': u'Сохранить файл',
'cocoa.menu.about': u'О программе',
'cocoa.menu.services': u'Cлужбы',
'cocoa.me... | # -*- coding: utf-8 -*-
import webview
"""
This example demonstrates how to localize GUI strings used by pywebview.
"""
if __name__ == '__main__':
localization = {
'global.saveFile': u'Сохранить файл',
'cocoa.menu.about': u'О программе',
'cocoa.menu.services': u'Cлужбы',
'cocoa.me... | bsd-3-clause | Python |
6199c2edf90d5e05959b848bb0b41a99c3969d9b | fix chat token | adityahase/frappe,yashodhank/frappe,mhbu50/frappe,tundebabzy/frappe,mhbu50/frappe,frappe/frappe,frappe/frappe,frappe/frappe,RicardoJohann/frappe,mhbu50/frappe,manassolanki/frappe,manassolanki/frappe,tundebabzy/frappe,almeidapaulopt/frappe,chdecultot/frappe,saurabh6790/frappe,vjFaLk/frappe,almeidapaulopt/frappe,adityaha... | frappe/chat/website/__init__.py | frappe/chat/website/__init__.py | import frappe
from frappe.chat.util import filter_dict, safe_json_loads
from frappe.sessions import get_geo_ip_country
@frappe.whitelist(allow_guest = True)
def settings(fields = None):
fields = safe_json_loads(fields)
dsettings = frappe.get_single('Website Settings')
response = dict(
so... | import frappe
from frappe.chat.util import filter_dict, safe_json_loads
from frappe.sessions import get_geo_ip_country
@frappe.whitelist(allow_guest = True)
def settings(fields = None):
fields = safe_json_loads(fields)
dsettings = frappe.get_single('Website Settings')
response = dict(
so... | mit | Python |
2d35204ca7c6ac615a2a54e84ad86f2cf0a89c78 | Drop 'dev' tag on version | tgsmith61591/pyramid,alkaline-ml/pmdarima,alkaline-ml/pmdarima,tgsmith61591/pyramid,alkaline-ml/pmdarima,tgsmith61591/pyramid | pmdarima/__init__.py | pmdarima/__init__.py | # -*- coding: utf-8 -*-
#
# Author: Taylor Smith <taylor.smith@alkaline-ml.com>
#
# The pmdarima module
import os as _os
__version__ = "1.0.0"
try:
# this var is injected in the setup build to enable
# the retrieval of the version number without actually
# importing the un-built submodules.
__PMDARIM... | # -*- coding: utf-8 -*-
#
# Author: Taylor Smith <taylor.smith@alkaline-ml.com>
#
# The pmdarima module
import os as _os
__version__ = "1.0.0-dev"
try:
# this var is injected in the setup build to enable
# the retrieval of the version number without actually
# importing the un-built submodules.
__PMD... | mit | Python |
fabac592bf75336c7792e011a94d6439ff65b8f5 | Fix uclearn with setup.py | orezpraw/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,orezpraw/estimate-charm,naturalness/unnaturalcode... | unnaturalcode/learn.py | unnaturalcode/learn.py | #!/usr/bin/env python
# Copyright 2013, 2014 Joshua Charles Campbell, Alex Wilson
#
# This file is part of UnnaturalCode.
#
# UnnaturalCode 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 Foundat... | #!/usr/bin/env python
# Copyright 2013, 2014 Joshua Charles Campbell, Alex Wilson
#
# This file is part of UnnaturalCode.
#
# UnnaturalCode 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 Foundat... | agpl-3.0 | Python |
c60a25542921d0a920961ccee681854539ce979f | Simplify import logic. | mozilla/build-cleanslate | cleanslate.py | cleanslate.py | #!/usr/bin/env python
# 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/.
'''
Run some cleanup actions against a user's system.
'''
import logging
log = logging.getLogger(... | #!/usr/bin/env python
# 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/.
'''
Run some cleanup actions against a user's system.
'''
import logging
log = logging.getLogger(... | mpl-2.0 | Python |
6d76842d9f9394aa78cda55fff9c62a4db5da5c6 | Fix for python 2.6 compatibility in subprocess | boxidau/rax-autoscaler,boxidau/rax-autoscaler,eljrax/rax-autoscaler,rackerlabs/rax-autoscaler | common.py | common.py | from __future__ import print_function
import os, pyrax, sys
import pyrax.exceptions as pexc
from termcolor import colored
import ConfigParser
import subprocess
path = os.path.dirname(os.path.realpath(__file__))
config_file = path + "/config.ini"
def log(level, message):
if level == 'OK':
print(colored('[ OK ]... | from __future__ import print_function
import os, pyrax, sys
import pyrax.exceptions as pexc
from termcolor import colored
import ConfigParser
from subprocess import check_output
path = os.path.dirname(os.path.realpath(__file__))
config_file = path + "/config.ini"
def log(level, message):
if level == 'OK':
print... | apache-2.0 | Python |
c1c047841f96def15516ecc259285c7c636b00ec | fix the cursor class in the backend; we were accessing attributes before calling super before, which is bad | jmoiron/micromongo | micromongo/backend.py | micromongo/backend.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A set of minimal subclasses around pymongo to get the desired "as_class"
behavior we want without resorting to inspect hackery (which was too slow).
Because the bson wrapping can happen in C code, we don't have a lot of access
to that, so we introduce the concept of a ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A set of minimal subclasses around pymongo to get the desired "as_class"
behavior we want without resorting to inspect hackery (which was too slow).
Because the bson wrapping can happen in C code, we don't have a lot of access
to that, so we introduce the concept of a ... | mit | Python |
5d56cf1c569ddcb135e8acc28c0cdfa0917c72aa | Remove prints during download | jakelever/kindred,jakelever/kindred | kindred/utils.py | kindred/utils.py |
import os
import zipfile
import hashlib
import requests
import logging
import traceback
import time
def _calcSHA256(filename):
return hashlib.sha256(open(filename, 'rb').read()).hexdigest()
def _findDir(name, path):
if os.path.isdir(path):
for root, dirs, files in os.walk(path):
if name in dirs:
return os... |
import os
import zipfile
import hashlib
import requests
import logging
import traceback
import time
def _calcSHA256(filename):
return hashlib.sha256(open(filename, 'rb').read()).hexdigest()
def _findDir(name, path):
if os.path.isdir(path):
for root, dirs, files in os.walk(path):
if name in dirs:
return os... | mit | Python |
e197b1fb24aa975bcc1bf1172555d518de1e3dfe | Remove Python version comment, as namespace support is not native on Python 3.9. | python/importlib_resources | importlib_resources/_compat.py | importlib_resources/_compat.py | import abc
import sys
from contextlib import suppress
# flake8: noqa
try:
from zipfile import Path as ZipPath # type: ignore
except ImportError:
from zipp import Path as ZipPath # type: ignore
try:
from typing import runtime_checkable # type: ignore
except ImportError:
def runtime_checkable(cls)... | import abc
import sys
from contextlib import suppress
# flake8: noqa
try:
from zipfile import Path as ZipPath # type: ignore
except ImportError:
from zipp import Path as ZipPath # type: ignore
try:
from typing import runtime_checkable # type: ignore
except ImportError:
def runtime_checkable(cls)... | apache-2.0 | Python |
7a325091644a1023d893c730fef77e01fb3bba3e | Remove assembly-specific logger | opennode/nodeconductor-openstack | src/nodeconductor_openstack/log.py | src/nodeconductor_openstack/log.py | from nodeconductor.logging.loggers import EventLogger, event_logger
class BackupEventLogger(EventLogger):
resource = 'openstack.Instance'
class Meta:
event_types = ('resource_backup_creation_scheduled',
'resource_backup_creation_succeeded',
'resource_back... | from nodeconductor.logging.loggers import EventLogger, event_logger
class BackupEventLogger(EventLogger):
resource = 'openstack.Instance'
class Meta:
event_types = ('resource_backup_creation_scheduled',
'resource_backup_creation_succeeded',
'resource_back... | mit | Python |
6e72ec21e2a282ba23ef50f7a5aba2661870d40e | Add option to swap y and z dimensions | jobovy/galpy,jobovy/galpy,jobovy/galpy,jobovy/galpy | galpy/snapshot_src/nemo_util.py | galpy/snapshot_src/nemo_util.py | ###############################################################################
# nemo_util.py: some utilities for handling NEMO snapshots
###############################################################################
import os
import numpy
import tempfile
import subprocess
def read(filename,ext=None,swapyz=False):
... | ###############################################################################
# nemo_util.py: some utilities for handling NEMO snapshots
###############################################################################
import os
import numpy
import tempfile
import subprocess
def read(filename,ext=None):
"""
NAM... | bsd-3-clause | Python |
f9187a5d3c82b0234a538119f33bc76185823d78 | use sets for uniqueness (reduces computation time) | qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | dimagi/utils/create_unique_filter.py | dimagi/utils/create_unique_filter.py |
def create_unique_filter(fn):
"""Returns a filter that applies fn to an object and returns
true if it's a new value, otherwise false. useful for filtering
lists dynamically based on some other conditional.
>>> import random
>>> l = [{'id': 'a'}, {'id': 'b'}, {'id': 'a'}, {'id': 'c'}, {'id': 'b'}]
... |
def create_unique_filter(fn):
"""Returns a filter that applies fn to an object and returns
true if it's a new value, otherwise false. useful for filtering
lists dynamically based on some other conditional.
>>> import random
>>> l = [{'id': 'a'}, {'id': 'b'}, {'id': 'a'}, {'id': 'c'}, {'id': 'b'}]
... | bsd-3-clause | Python |
63f1f695d8376a8f561fb0c183ac7a9d45912e2c | test only building dict modules | l4u/tomoe,l4u/tomoe,l4u/tomoe,l4u/tomoe | test/python/runtests.py | test/python/runtests.py | #!/usr/bin/env python
# -*- coding: UTF=8 -*-
import glob
import os
import sys
import unittest
import test_common
dict_modules = os.getenv('DICT_MODULES').split()
SKIP_FILES = ['runtests', 'test_dict', 'test_common', 'test_dict_est', 'test_dict_mysql', 'test_dict_unihan', 'test_dict_xml']
dir = os.path.split(os.path.... | #!/usr/bin/env python
# -*- coding: UTF=8 -*-
import glob
import os
import sys
import unittest
import test_common
SKIP_FILES = ['runtests', 'test_dict', 'test_common']
dir = os.path.split(os.path.abspath(__file__))[0]
os.chdir(dir)
def gettestnames():
files = glob.glob('*.py')
names = map(lambda x: x[:-3], f... | lgpl-2.1 | Python |
9347f3bc4a9c37c7013e8666f86cceee1a7a17f9 | Fix bug with array_agg_mult() function not actually being created. | churchlab/millstone,woodymit/millstone_accidental_source,churchlab/millstone,woodymit/millstone,churchlab/millstone,woodymit/millstone_accidental_source,churchlab/millstone,woodymit/millstone,woodymit/millstone_accidental_source,woodymit/millstone,woodymit/millstone,woodymit/millstone_accidental_source | genome_designer/main/startup.py | genome_designer/main/startup.py | """Actions to run at server startup.
"""
from django.db import connection
from django.db import transaction
def run():
"""Call this from manage.py or tests.
"""
_add_custom_mult_agg_function()
def _add_custom_mult_agg_function():
"""Make sure the Postgresql database has a custom function array_agg_... | """Actions to run at server startup.
"""
from django.db import connection
def run():
"""Call this from manage.py or tests.
"""
_add_custom_mult_agg_function()
def _add_custom_mult_agg_function():
"""Make sure the Postgresql database has a custom function array_agg_mult.
NOTE: Figured out the r... | mit | Python |
da300200b13fc723f5636b8be55d511db507515c | update defaults | jeremy-miller/life-python | life/main.py | life/main.py | #!/usr/bin/python
"""This module runs the Life game."""
import logging
from life.logger import LoggerClass
from life.game import GameClass
class MainClass(object): # pylint: disable=R0903
"""This class runs the Life game."""
def __init__(self):
"""This method initializes the Life game.
Attributes:
... | #!/usr/bin/python
"""This module runs the Life game."""
import logging
from life.logger import LoggerClass
from life.game import GameClass
class MainClass(object): # pylint: disable=R0903
"""This class runs the Life game."""
def __init__(self):
"""This method initializes the Life game.
Attributes:
... | mit | Python |
2b4246da4dabc77315953f3413ce73d224b2f2f0 | Add a getHostname to system | SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange | app/soc/logic/system.py | app/soc/logic/system.py | #!/usr/bin/python2.5
#
# Copyright 2008 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 2008 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 |
78e90805c80c4eb31aaba47ea7d2eca96c3e6878 | change to comments to extract_ssx_zip_files.py | mttvns/python | extract_ssx_zip_files.py | extract_ssx_zip_files.py | import os, zipfile, ntpath
'''
Python Script: Mass Macro Runner
By: Matthew Gary Evans, Copyright 2016, All Rights Reserved
Date: March 27, 2016
ABOUT: This script extracts all zip files in a directory to a new folder in that
same directory named the same as the zip file. SSX refers to the original file
extension tha... | import os, zipfile, ntpath
'''
Python Script: Mass Macro Runner
By: Matthew Gary Evans, Copyright 2016, All Rights Reserved
Date: March 27, 2016
ABOUT: This script extracts all zip files in a directory to a new folder in that
same directory named the same as the zip file. SSX refers to the original file
extension tha... | mit | Python |
86e34b8bb87f33e4016e479d8d2a0f4228f3f1f9 | fix misprint | instagrambot/instapro | instabot/api/api.py | instabot/api/api.py | from instabot.api.request import Request
def is_user_id(smth):
if str(smth).isdigit():
return True
return False
def get_user_info(user, user_id):
if is_user_id(user_id):
return Request.send(user.session,
'users/' + str(user_id) + '/info/')
else:
retu... | from instabot.api.request import Request
def is_user_id(smth):
if str(smth).isdigit():
return True
return False
def get_user_info(user, user_id):
if is_user_id(user_id):
return Request.send(user.session,
'users/' + str(user_id) + '/info/')
else:
retu... | apache-2.0 | Python |
ec3408a1506b52286c7b8d1fb2bbcfba80ccdbcd | Remove version docstring outdated since #2448 (#2471) | Parsl/parsl,Parsl/parsl,Parsl/parsl,Parsl/parsl | parsl/version.py | parsl/version.py | """Set module version.
"""
VERSION = '1.3.0-dev'
| """Set module version.
<Major>.<Minor>.<maintenance>[alpha/beta/..]
Alphas will be numbered like this -> 0.4.0a0
"""
VERSION = '1.3.0-dev'
| apache-2.0 | Python |
cbee11fa8ffcc57311abed7029b26ac3991fc014 | Use pytest.raises | redkyn/grader,grade-it/grader,redkyn/grader | grader/grader/test/test_init.py | grader/grader/test/test_init.py | import os
import pytest
import re
import yaml
UUID_RE = r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
def test_init(parse_and_run):
"""Test vanilla grader initialization
"""
path = parse_and_run(["init", "cpl"])
with open(os.path.join(path, "grader.yml")) as config_file:
gra... | import os
import pytest
import re
import yaml
UUID_RE = r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
def test_init(parse_and_run):
"""Test vanilla grader initialization
"""
path = parse_and_run(["init", "cpl"])
with open(os.path.join(path, "grader.yml")) as config_file:
gra... | mit | Python |
c47b57d75305f5ef2a2490e140261e3e1e74f6d4 | fix order of output formats | inveniosoftware/invenio-formatter,inveniosoftware/invenio-formatter,tiborsimko/invenio-formatter,inveniosoftware/invenio-formatter,tiborsimko/invenio-formatter,tiborsimko/invenio-formatter | registry.py | registry.py | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... | mit | Python |
146bef59b31b0b4e5fa46a4e934570b4d91241f8 | Fix fast_homography test based on new lena. | dpshelio/scikit-image,pratapvardhan/scikit-image,bsipocz/scikit-image,michaelaye/scikit-image,ofgulban/scikit-image,vighneshbirodkar/scikit-image,almarklein/scikit-image,jwiggins/scikit-image,vighneshbirodkar/scikit-image,keflavich/scikit-image,SamHames/scikit-image,oew1v07/scikit-image,rjeli/scikit-image,chintak/sciki... | scikits/image/transform/tests/test_project.py | scikits/image/transform/tests/test_project.py | import numpy as np
from numpy.testing import assert_array_almost_equal
from scikits.image.transform.project import _stackcopy
from scikits.image.transform import homography, fast_homography
from scikits.image import data
from scikits.image.color import rgb2gray
def test_stackcopy():
layers = 4
x = np.empty((3... | import numpy as np
from numpy.testing import assert_array_almost_equal
from scikits.image.transform.project import _stackcopy
from scikits.image.transform import homography, fast_homography
from scikits.image import data
def test_stackcopy():
layers = 4
x = np.empty((3, 3, layers))
y = np.eye(3, 3)
_s... | bsd-3-clause | Python |
fc3cd8ff39f71c79c3ba2b8ce9c7be2effd85a3c | update version for dev | wq/wq.io,wq/wq.io | version.py | version.py | VERSION = "1.1.1-dev"
| VERSION = "1.1.0"
| mit | Python |
95b085c5a16a99d36ae9c719decec13e91518785 | Reset node | ddepaoli3/fuel-library-dev,zhaochao/fuel-library,eayunstack/fuel-library,eayunstack/fuel-library,stackforge/fuel-library,slystopad/fuel-lib,zhaochao/fuel-library,ddepaoli3/fuel-library-dev,huntxu/fuel-library,SmartInfrastructures/fuel-library-dev,xarses/fuel-library,ddepaoli3/fuel-library-dev,xarses/fuel-library,huntxu... | fuel_test/prepare_for_tempest.py | fuel_test/prepare_for_tempest.py | from time import sleep
from devops.helpers import ssh
import keystoneclient.v2_0
from ci_helpers import get_environment
from helpers import tempest_write_config, tempest_add_images, tempest_share_glance_images, tempest_mount_glance_images, get_auth_url, sync_time, execute, retry
from openstack_site_pp_base import OpenS... | from time import sleep
from devops.helpers import ssh
import keystoneclient.v2_0
from ci_helpers import get_environment
from helpers import tempest_write_config, tempest_add_images, tempest_share_glance_images, tempest_mount_glance_images, get_auth_url, sync_time, execute, retry
from openstack_site_pp_base import OpenS... | apache-2.0 | Python |
d1a00a811531b8609aaecba017a1dd688c63707c | update version.py | Caoimhinmg/PmagPy,lfairchild/PmagPy,lfairchild/PmagPy,lfairchild/PmagPy,Caoimhinmg/PmagPy,Caoimhinmg/PmagPy | version.py | version.py | "pmagpy-3.0.2"
version = 'pmagpy-3.0.2'
| "pmagpy-3.0.0"
version = 'pmagpy-3.0.0'
| bsd-3-clause | Python |
961d9a6106706bc62c02d848b59eba2086e3d1de | Set encoding for config file during read | SamR1/django-twittfeed | config.py | config.py | """
Loads and parses the configuration file.
"""
import yaml
def get_config():
with open('config.yml', 'r', encoding='utf-8') as stream:
try:
return yaml.safe_load(stream)
except yaml.YAMLError as e:
print(e)
sys.exit()
| """
Loads and parses the configuration file.
"""
import yaml
def get_config():
with open('config.yml', 'r') as stream:
try:
return yaml.safe_load(stream)
except yaml.YAMLError as e:
print(e)
sys.exit()
| mit | Python |
d3a3645302afd5adbf52cf5cef4a4eed2298349f | Remove import for random | andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin | src/python/m5/internal/__init__.py | src/python/m5/internal/__init__.py | # Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | # Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | bsd-3-clause | Python |
c70fd06a12f53b8133a9b31c1fac9c5c2b1a76c2 | Change channel names | wolfy1339/Python-IRC-Bot | config.py | config.py | from zirc import Sasl, Caps
# zIRC
ci = __import__("os").getenv('CI', 'false') == 'true'
if not ci:
with open("password", "r") as i:
password = i.read().strip()
sasl = Sasl(username="BigWolfy1339", password=password, method="external")
caps = Caps(sasl, "multi-prefix", "account-notify", "extended-j... | from zirc import Sasl, Caps
# zIRC
ci = __import__("os").getenv('CI', 'false') == 'true'
if not ci:
with open("password", "r") as i:
password = i.read().strip()
sasl = Sasl(username="BigWolfy1339", password=password, method="external")
caps = Caps(sasl, "multi-prefix", "account-notify", "extended-j... | mit | Python |
c973f7b034af3bca71c5fdb43155bde8927f5f40 | Correct example config format | teslaworksumn/teslaworks.net,teslaworksumn/teslaworks.net | config.py | config.py | DATA_DIR = 'data'
SECRET_KEY = '6C863A81-5C37-47BE-9D7D-362F073F7BE7'
CONTACT_EMAIL = 'officers@teslaworks.net'
DEBUG_EMAIL = 't.trim@me.com'
APP_CONFIG = {
'DEBUG': False,
'TESTING': False
}
MAIL_SETTINGS = {
'MAIL_SERVER': 'smtp.mailgun.org',
'MAIL_PORT': '25',
'MAIL_USE_TLS': False,
'MAIL_USERNAME': '... | DATA_DIR = 'data'
SECRET_KEY = '6C863A81-5C37-47BE-9D7D-362F073F7BE7'
DEBUG_EMAIL = 't.trim@me.com'
CONTACT_EMAIL = 'officers@teslaworks.net'
APP_CONFIG = {
'DEBUG': False,
'TESTING': False
}
MAIL_SETTINGS = {
'MAIL_SERVER': 'smtp.mailgun.org',
'MAIL_PORT': '25',
'MAIL_USE_TLS': False,
'MAIL_USERNAME': '... | mit | Python |
e3351ed783d3ce62e107e6f07867dcdbb562abf0 | Add SQLALCHEMY_TRACK_MODIFICATIONS config in order to prevent warning from showing | mdsrosa/routes_api_python | config.py | config.py | import os
DEBUG = True
# Application directory
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
DATABASE = os.path.join(BASE_DIR, 'routes_api.db')
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + DATABASE
SQLALCHEMY_MIGRATION_REPO = os.path.join(BASE_DIR, 'db_repository')
SQLALCHEMY_TRACK_MODIFICATIONS = True
| import os
DEBUG = True
# Application directory
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR,
'routes_api.db')
SQLALCHEMY_MIGRATION_REPO = os.path.join(BASE_DIR, 'db_repository')
| mit | Python |
3e2b06aa73488323600a5942588b556f2d78c2af | Test case for Member/Person sync | navotsil/Open-Knesset,ofri/Open-Knesset,Shrulik/Open-Knesset,DanaOshri/Open-Knesset,jspan/Open-Knesset,navotsil/Open-Knesset,MeirKriheli/Open-Knesset,jspan/Open-Knesset,Shrulik/Open-Knesset,ofri/Open-Knesset,habeanf/Open-Knesset,jspan/Open-Knesset,noamelf/Open-Knesset,otadmor/Open-Knesset,alonisser/Open-Knesset,navotsi... | persons/tests.py | persons/tests.py | from datetime import datetime
from django.test import TestCase
from unittest import skip
from .models import Person
from mks.models import Member
class PersonTests(TestCase):
@skip
def test_member_person_sync(self):
"""
Test member/person sync on member save()
"""
birth = d... | """
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... | bsd-3-clause | Python |
6d2301dcdafd561adf2ef346dc28f4b705850711 | Remove old djcelery syntax | cmptrgeekken/evething,madcowfred/evething,cmptrgeekken/evething,cmptrgeekken/evething,cmptrgeekken/evething,madcowfred/evething,Gillingham/evething,madcowfred/evething,cmptrgeekken/evething,Gillingham/evething,madcowfred/evething,Gillingham/evething,Gillingham/evething | evething/wsgi.py | evething/wsgi.py | """
WSGI config for evething project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | """
WSGI config for evething project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | bsd-2-clause | Python |
8377f3e61441a7f465feefba905cd3c82586e1a5 | Add metadata to visualization module | orbingol/NURBS-Python,orbingol/NURBS-Python | geomdl/visualization/__init__.py | geomdl/visualization/__init__.py | """ NURBS-Python Visualization Component
.. moduleauthor:: Onur Rauf Bingol <orbingol@gmail.com>
"""
__author__ = "Onur Rauf Bingol"
__version__ = "1.0.0"
__license__ = "MIT"
| """ NURBS-Python Visualization Component
.. moduleauthor:: Onur Rauf Bingol <orbingol@gmail.com>
"""
| mit | Python |
3358d47cc9bdad5abaa1e8a9358d49539e6256b1 | Make sure official user type emails are lower case | SCUEvals/scuevals-api,SCUEvals/scuevals-api | scuevals_api/resources/official_user_types.py | scuevals_api/resources/official_user_types.py | from flask_jwt_extended import current_user
from flask_restful import Resource
from marshmallow import fields, Schema
from scuevals_api.auth import auth_required
from scuevals_api.models import Permission, OfficialUserType, db
from scuevals_api.utils import use_args
class OfficialUserTypeSchema(Schema):
email = ... | from flask_jwt_extended import current_user
from flask_restful import Resource
from marshmallow import fields, Schema
from scuevals_api.auth import auth_required
from scuevals_api.models import Permission, OfficialUserType, db
from scuevals_api.utils import use_args
class OfficialUserTypeSchema(Schema):
email = ... | agpl-3.0 | Python |
b950af582f6fd739340827d7f937eac4b2ce0258 | Add tests for PathForm fields configuration | GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/core/tests/test_forms.py | geotrek/core/tests/test_forms.py | from django.forms.widgets import HiddenInput
from django.conf import settings
from django.core.checks import Error
from django.test import TestCase
from unittest import skipIf
from unittest.mock import patch
from django.test.utils import override_settings
from geotrek.core.factories import TrailFactory, PathFactory
... | from django.conf import settings
from django.core.checks import Error
from django.test import TestCase
from unittest import skipIf
from django.test.utils import override_settings
from geotrek.core.factories import TrailFactory, PathFactory
from geotrek.authent.factories import UserFactory
from geotrek.core.forms imp... | bsd-2-clause | Python |
a3c62f099088ac2206b83275ca096d4952f76e28 | fix python syntax error | printedheart/h2o-3,brightchen/h2o-3,tarasane/h2o-3,printedheart/h2o-3,h2oai/h2o-dev,bikash/h2o-dev,ChristosChristofidis/h2o-3,datachand/h2o-3,junwucs/h2o-3,bospetersen/h2o-3,bospetersen/h2o-3,h2oai/h2o-3,nilbody/h2o-3,mathemage/h2o-3,spennihana/h2o-3,PawarPawan/h2o-v3,brightchen/h2o-3,nilbody/h2o-3,mrgloom/h2o-3,kyoren... | h2o-py/h2o/model/autoencoder.py | h2o-py/h2o/model/autoencoder.py | """
AutoEncoder Models should be comparable.
"""
from model_base import *
class H2OAutoEncoderModel(ModelBase):
"""
Class for Binomial models.
"""
def __init__(self, dest_key, model_json):
super(H2OAutoEncoderModel, self).__init__(dest_key, model_json,H2OAutoEncoderModelMetrics)
def anomaly:
"""
Re... | """
AutoEncoder Models should be comparable.
"""
from model_base import *
class H2OAutoEncoderModel(ModelBase):
"""
Class for Binomial models.
"""
def __init__(self, dest_key, model_json):
super(H2OAutoEncoderModel, self).__init__(dest_key, model_json,H2OAutoEncoderModelMetrics)
def anomaly
"""
R... | apache-2.0 | Python |
2fc3ee4edc4b7a1842fca369620c790244000f11 | Set static/docs as the default folder to generate the apidoc's files | viniciuschiele/flask-apidoc | flask_apidoc/commands.py | flask_apidoc/commands.py | # Copyright 2015 Vinicius Chiele. 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 ... | # Copyright 2015 Vinicius Chiele. 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 ... | mit | Python |
0cf3b7ede02afa54e388f00c93d502290a1fd5da | Add shebang for webapp example | takluyver/nbparameterise | examples/webapp.py | examples/webapp.py | #!/usr/bin/env python3
import os.path
import sys
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
from nbconvert.exporters import HTMLExporter
import tornado.ioloop
import tornado.web
from nbparameterise import extract_parameters, replace_definitions
from htmlform import build_form
static_path... | import os.path
import sys
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
from nbconvert.exporters import HTMLExporter
import tornado.ioloop
import tornado.web
from nbparameterise import extract_parameters, replace_definitions
from htmlform import build_form
static_path = os.path.join(os.path... | mit | Python |
72a051c007e538df59d72e1bbe8c739134bcd0f8 | Bump version to 0.17.1 | thombashi/sqlitebiter,thombashi/sqlitebiter | sqlitebiter/__version__.py | sqlitebiter/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.17.1"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.17.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
98771f6a7a96ccedf56e3619433e2451d5c3251f | Use finally and so on. | Vayne-Lover/Python | exception/test1.py | exception/test1.py | #!/usr/local/bin/python
#class MuffledCalculator:
# muffled=False
# def calc(self,expr):
# try:
# return eval(expr)
# except (ZeroDivisionError,TypeError):
# if self.muffled:
# print "There are errors."
# else:
# raise
#a=MuffledCalculator()
#print a.calc('2/1')
##print a.calc('2/"d... | #!/usr/local/bin/python
class MuffledCalculator:
muffled=False
def calc(self,expr):
try:
return eval(expr)
except ZeroDivisionError:
if self.muffled:
print "Can't divide zero"
else:
raise
a=MuffledCalculator()
print a.calc('2/1')
#print a.calc('1/0')
a.muffled=True
print a.... | apache-2.0 | Python |
661d42468359836c0ce9ee4e267241a4aaf7a021 | Check for an empty user | ABASystems/django-lot | lot/views.py | lot/views.py | import json
from django.conf import settings
from django.http import HttpResponseRedirect, HttpResponseNotFound
from django.shortcuts import get_object_or_404, resolve_url
from django.utils.http import is_safe_url
from django.views.generic import View
from django.contrib.auth import authenticate, login
from .models ... | import json
from django.conf import settings
from django.http import HttpResponseRedirect, HttpResponseNotFound
from django.shortcuts import get_object_or_404, resolve_url
from django.utils.http import is_safe_url
from django.views.generic import View
from django.contrib.auth import authenticate, login
from .models ... | bsd-3-clause | Python |
6fd0c91fd1bbc6ae1a8fae46503464ab63603d38 | Enable filtering over the published field | lapo-luchini/pinry,supervacuo/pinry,lapo-luchini/pinry,supervacuo/pinry,wangjun/pinry,QLGu/pinry,Stackato-Apps/pinry,dotcom900825/xishi,lapo-luchini/pinry,Stackato-Apps/pinry,MSylvia/pinry,pinry/pinry,MSylvia/pinry,pinry/pinry,pinry/pinry,Stackato-Apps/pinry,dotcom900825/xishi,QLGu/pinry,wangjun/pinry,QLGu/pinry,rafiro... | pinry/api/api.py | pinry/api/api.py | from tastypie.resources import ModelResource
from tastypie import fields
from tastypie.authentication import BasicAuthentication
from tastypie.authorization import DjangoAuthorization
from django.contrib.auth.models import User
from pinry.pins.models import Pin
class PinResource(ModelResource): # pylint: disable-m... | from tastypie.resources import ModelResource
from tastypie import fields
from tastypie.authentication import BasicAuthentication
from tastypie.authorization import DjangoAuthorization
from django.contrib.auth.models import User
from pinry.pins.models import Pin
class PinResource(ModelResource): # pylint: disable-m... | bsd-2-clause | Python |
d445daee9dc5edb3701cd3324bf001eb7c2121df | fix doc string | sudoguy/instabot,instagrambot/instapro,instagrambot/instabot,misisnik/testinsta,ohld/instabot,AlexBGoode/instabot,misisnik/testinsta,vkgrd/instabot,instagrambot/instabot,Diapostrofo/instabot,rasperepodvipodvert/instabot | instabot/bot/bot_checkpoint.py | instabot/bot/bot_checkpoint.py | """
Instabot Checkpoint methods.
"""
import os
import pickle
from datetime import datetime
CHECKPOINT_PATH = "instabot.checkpoint"
class Checkpoint(object):
"""
Checkpoint for instabot.Bot class which can store:
.total_<name> - all Bot's counters
.following (list of user_ids)
... | """
Instabot Checkpoint methods.
"""
import os
import pickle
from datetime import datetime
CHECKPOINT_PATH = "instabot.checkpoint"
class Checkpoint(object):
"""
Checkpoint for instabot.Bot which can store:
.total_<name> - all Bot's counters
.following (list of user_ids)
... | apache-2.0 | Python |
01d5588436902e47540a5477bb9bd9a5d7b2aba5 | Support Shortened URLs | flijloku/livestreamer,programming086/livestreamer,hmit/livestreamer,Masaz-/livestreamer,chhe/streamlink,Masaz-/livestreamer,derrod/livestreamer,bastimeyer/streamlink,gtmanfred/livestreamer,flijloku/livestreamer,melmorabity/streamlink,lyhiving/livestreamer,okaywit/livestreamer,wlerin/streamlink,Klaudit/livestreamer,bast... | src/livestreamer/plugins/veetle.py | src/livestreamer/plugins/veetle.py | from livestreamer.compat import urlparse
from livestreamer.exceptions import PluginError, NoStreamsError
from livestreamer.plugin import Plugin
from livestreamer.stream import HTTPStream
from livestreamer.utils import urlget, res_json
class Veetle(Plugin):
APIURL = "http://veetle.com/index.php/stream/ajaxStreamLoc... | from livestreamer.compat import urlparse
from livestreamer.exceptions import PluginError, NoStreamsError
from livestreamer.plugin import Plugin
from livestreamer.stream import HTTPStream
from livestreamer.utils import urlget, res_json
class Veetle(Plugin):
APIURL = "http://veetle.com/index.php/stream/ajaxStreamLoc... | bsd-2-clause | Python |
03497c618b5f349bbe9294cadfae4bcd1269ca24 | add enable/disable comments to admin | jcarbaugh/django-blogdor | blogdor/admin.py | blogdor/admin.py | from django.contrib import admin
from blogdor.models import Post
import datetime
class PostAdmin(admin.ModelAdmin):
list_display = ('title','author','date_published','is_published','comments_enabled')
list_display_links = ('title',)
list_filter = ('author','is_published','comments_enabled')
prepop... | from django.contrib import admin
from blogdor.models import Post
import datetime
class PostAdmin(admin.ModelAdmin):
list_display = ('title','author','date_published','is_published','comments_enabled')
list_display_links = ('title',)
list_filter = ('author','is_published','comments_enabled')
prepop... | bsd-3-clause | Python |
3f8fb926cf39f438d34636dbd3d255ee9bd2537c | load logging.conf if available | bndl/bndl,bndl/bndl | bndl/__init__.py | bndl/__init__.py | import logging.config
import os.path
if os.path.exists('logging.conf'):
logging.config.fileConfig('logging.conf', disable_existing_loggers=False)
| apache-2.0 | Python | |
5d95d17530e9ba64aaae71e582310ba1ae06cc6f | Add logging to database.py | MikeiLL/appension,MikeiLL/appension,Rosuav/appension,Rosuav/appension,MikeiLL/appension,Rosuav/appension,Rosuav/appension,MikeiLL/appension | fore/database.py | fore/database.py | import apikeys
import psycopg2
import utils
import logging
_conn = psycopg2.connect(apikeys.db_connect_string)
log = logging.getLogger(__name__)
class Track(object):
def __init__(self, id, filename, artist, title):
log.info("Rendering Track(%r, %r, %r, %r)", id, filename, artist, title)
self.id = id
self.filen... | import apikeys
import psycopg2
import utils
_conn = psycopg2.connect(apikeys.db_connect_string)
class Track(object):
def __init__(self, id, filename, artist, title):
self.id = id
self.filename = filename
# Add some stubby metadata (in an attribute that desperately
# wants to be renamed to something mildly us... | artistic-2.0 | Python |
83ae9f7d56c06da0942bcbcae395f59dac5dca00 | Update OAuth endpoint | jgorset/fandjango,jgorset/fandjango | fandjango/views.py | fandjango/views.py | from urllib import urlencode
from django.http import HttpResponse
from django.shortcuts import render
from facepy import SignedRequest
from fandjango.models import User
from fandjango.settings import (
FACEBOOK_APPLICATION_ID, FACEBOOK_APPLICATION_DOMAIN,
FACEBOOK_APPLICATION_NAMESPACE, FACEBOOK_APPLICATION_... | from urllib import urlencode
from django.http import HttpResponse
from django.shortcuts import render
from facepy import SignedRequest
from fandjango.models import User
from fandjango.settings import (
FACEBOOK_APPLICATION_ID, FACEBOOK_APPLICATION_DOMAIN,
FACEBOOK_APPLICATION_NAMESPACE, FACEBOOK_APPLICATION_... | mit | Python |
174cc8e5eaa42676c2c18bd392eafeb215b1fe13 | Fix regex for user url | Davidyuk/witcoin,Davidyuk/witcoin | main/urls.py | main/urls.py | from django.conf.urls import url
from django.contrib.auth import views as auth_views, forms as auth_forms
from . import views
urlpatterns = [
url(r'^register$', views.register, name='register'),
url(r'^login$', auth_views.login, {'extra_context': {'password_reset': auth_forms.PasswordResetForm()}},
na... | from django.conf.urls import url
from django.contrib.auth import views as auth_views, forms as auth_forms
from . import views
urlpatterns = [
url(r'^register$', views.register, name='register'),
url(r'^login$', auth_views.login, {'extra_context': {'password_reset': auth_forms.PasswordResetForm()}},
na... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.