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 |
|---|---|---|---|---|---|---|---|---|
3e86916303ab4eb02d0e7508e4a743f1b83e92bd | Add TK_LIBRARY if we are in a py2exe environment | jimmsta/namebench-1,catap/namebench | namebench.py | namebench.py | #!/usr/bin/env python
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | #!/usr/bin/env python
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | apache-2.0 | Python |
ff053f3052d94315732893df31fbe4ee7a954d85 | Add methods to check if setpoint was sent to LLRF | lnls-fac/sirius | pymodels/middlelayer/devices/li_llrf.py | pymodels/middlelayer/devices/li_llrf.py | #!/usr/bin/env python-sirius
"""."""
import time as _time
from epics import PV
class LiLLRF:
"""."""
NAME_SHB = 'shb'
NAME_K1 = 'kly1'
NAME_K2 = 'kly2'
def __init__(self, device_name):
"""."""
if not set(self.NAME_SHB) - set(device_name.lower()):
name = 'BUN1'
... | #!/usr/bin/env python-sirius
"""."""
from epics import PV
class LiLLRF:
"""."""
NAME_SHB = 'shb'
NAME_K1 = 'kly1'
NAME_K2 = 'kly2'
def __init__(self, device_name):
"""."""
if not set(self.NAME_SHB) - set(device_name.lower()):
name = 'BUN1'
elif not set(self.N... | mit | Python |
68c7e07b4277c817b385c8ac9ebe9879f56a4be6 | Add map_genes func | jvivian/rnaseq-lib,jvivian/rnaseq-lib | src/rnaseq_lib/utils/tissues.py | src/rnaseq_lib/utils/tissues.py | import os
import pickle
import pandas as pd
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
def return_samples():
"""
Returns sample dictionary which maps TCGA and GTEx samples to a tissue.
Synapse ID: syn10296681
:return: Tissues are keys are list of samples ar... | import os
import pickle
import pandas as pd
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
def return_samples():
"""
Returns sample dictionary which maps TCGA and GTEx samples to a tissue.
Synapse ID: syn10296681
:return: Tissues are keys are list of samples ar... | mit | Python |
79cc9f82fda890627bc86cbaf016af6a557a3ee1 | update version 0.6.1 | randomsync/robotframework-mqttlibrary | src/MQTTLibrary/version.py | src/MQTTLibrary/version.py | VERSION = '0.6.1'
| VERSION = '0.6.0'
| apache-2.0 | Python |
706a6cf898b4f9ab6cd6b4297eb6230a6c91040c | Tweak partition formatting commands | chrisbarrett/dcp.py | dcp/drive.py | dcp/drive.py | """Commands for working with attached drives.
"""
import os
from subprocess import check_call, call, getoutput
import dcp.bytesize as bytesize
def attached_drives ():
"""Return a list of attached drives.
"""
output = getoutput('df')
lines = output.strip().split('\n')
info = [line.split() for l... | """Commands for working with attached drives.
"""
import os
from subprocess import check_call, call, getoutput
import dcp.bytesize as bytesize
def attached_drives ():
"""Return a list of attached drives.
"""
output = getoutput('df')
lines = output.strip().split('\n')
info = [line.split() for l... | bsd-2-clause | Python |
b9845c56f3aa62cd2c6f42a914985f1bc3ff148d | change the install command's hashbang to just python | torbjornvatn/powerline-shell,ceholden/powerline-shell,b-ryan/powerline-shell,iKrishneel/powerline-shell,banga/powerline-shell,bitIO/powerline-shell,banga/powerline-shell,rbanffy/powerline-shell,paulhybryant/powerline-shell,b-ryan/powerline-shell,milkbikis/powerline-shell,LeonardoGentile/powerline-shell,Menci/powerline-... | install.py | install.py | #!/usr/bin/env python
from __future__ import print_function
import os
import stat
try:
import config
except ImportError:
print('Created personal config.py for your customizations')
import shutil
shutil.copyfile('config.py.dist', 'config.py')
import config
TEMPLATE_FILE = 'powerline_shell_base.py'
... | #!/usr/bin/env python2
from __future__ import print_function
import os
import stat
try:
import config
except ImportError:
print('Created personal config.py for your customizations')
import shutil
shutil.copyfile('config.py.dist', 'config.py')
import config
TEMPLATE_FILE = 'powerline_shell_base.py'... | mit | Python |
4d6e44bf7265bd8aff5d6190de13c3a7eaab9076 | Change del command by remove member of interface to be compatible with 7.0 | odoo-l10n-ar/l10n_ar_invoice | report/invoice.py | report/invoice.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 OpenERP - Team de Localización Argentina.
# https://launchpad.net/~openerp-l10n-ar-localization
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 OpenERP - Team de Localización Argentina.
# https://launchpad.net/~openerp-l10n-ar-localization
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | agpl-3.0 | Python |
effb5d796e55dbf28de2ec8d6711fcf2724bc62f | Fix missing dependency on core.0059 migration | BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway | src/core/migrations/0059_auto_20211013_1657.py | src/core/migrations/0059_auto_20211013_1657.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-10-13 15:57
from __future__ import unicode_literals
from django.db import migrations
def set_about_plugin_to_hpe(apps, schema_editor):
Plugin = apps.get_model('utils', 'Plugin')
Plugin.objects.filter(
name='About',
).update(
h... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-10-13 15:57
from __future__ import unicode_literals
from django.db import migrations
def set_about_plugin_to_hpe(apps, schema_editor):
Plugin = apps.get_model('utils', 'Plugin')
Plugin.objects.filter(
name='About',
).update(
h... | agpl-3.0 | Python |
d79bec532ebc55099322103a289fd917410bb245 | refactor names for fomatting in scriptographer | IanDCarroll/xox | source/scriptographer_desk.py | source/scriptographer_desk.py | from observer_abilities import *
class Scriptographer(Observer):
def __init__(self):
self.start = "Welcome to XOX, a Noughts and Crosses Game"
self.select = "Type 1 to go first, or 2 to go second."
self.tie = "The game is a draw."
self.computer = "The Computer wins the game."
... | from observer_abilities import *
class Scriptographer(Observer):
def __init__(self):
self.start = "Welcome to XOX, a Noughts and Crosses Game"
self.select = "Type 1 to go first, or 2 to go second."
self.tie = "The game is a draw."
self.computer = "The Computer wins the game."
... | mit | Python |
c72764fde63e14f378a9e31dd89ea4180655d379 | Add a note if no emails are available to send | avinassh/nightreads,avinassh/nightreads | nightreads/emails/management/commands/send_email.py | nightreads/emails/management/commands/send_email.py | from django.core.management.base import BaseCommand
from nightreads.emails.models import Email
from nightreads.emails.email_service import send_email_obj
from nightreads.emails.views import get_subscriber_emails
class Command(BaseCommand):
help = 'Send the email to susbcribers'
def handle(self, *args, **opti... | from django.core.management.base import BaseCommand
from nightreads.emails.models import Email
from nightreads.emails.email_service import send_email_obj
from nightreads.emails.views import get_subscriber_emails
class Command(BaseCommand):
help = 'Send the email to susbcribers'
def handle(self, *args, **opti... | mit | Python |
1ccb63faa80767d92084d626efd06e65b68988ba | Add duplicate test to openacademy course | maitaoriana/openacademy-project | openacademy/tests/test_global_openacademy_course.py | openacademy/tests/test_global_openacademy_course.py | # -*- coding: utf-8 -*-
from psycopg2 import IntegrityError
from openerp.tests.common import TransactionCase
from openerp.tools import mute_logger
class GlobalTestOpenAcademyCourse(TransactionCase):
'''
Global test to openacademy course model
Test createcourse and trigger contraints
'''
# Method... | # -*- coding: utf-8 -*-
from psycopg2 import IntegrityError
from openerp.tests.common import TransactionCase
from openerp.tools import mute_logger
class GlobalTestOpenAcademyCourse(TransactionCase):
'''
Global test to openacademy course model
Test createcourse and trigger contraints
'''
# Method... | apache-2.0 | Python |
f9e7239f93b9865c60a0c32c69cd41b16837318e | fix regex | streamlink/streamlink,gravyboat/streamlink,chhe/streamlink,gravyboat/streamlink,bastimeyer/streamlink,chhe/streamlink,streamlink/streamlink,bastimeyer/streamlink | src/streamlink/plugins/foxtr.py | src/streamlink/plugins/foxtr.py | import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
@pluginmatcher(re.compile(
r"https?://(?:www\.)?fox(?:play)?\.com\.tr/"
))
class FoxTR(Plugin):
def _get_streams(self):
re_streams = re.compile(r"""(['"... | import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.stream.hls import HLSStream
@pluginmatcher(re.compile(
r"https?://(?:www\.)?fox(?:play)?\.com\.tr/"
))
class FoxTR(Plugin):
playervars_re = re.compile(r"source\s*:\s*\[\s*\{\s*videoSrc\s*:\s*(?:mobilecheck\(\)\s*\?\s*)?'([^']+)'")
... | bsd-2-clause | Python |
921ba9557513a16d21b407244786ee6bac129286 | Make life good for VLive users | praekelt/jmbo-your-words,praekelt/jmbo-your-words | jmboyourwords/admin.py | jmboyourwords/admin.py | from django.contrib import admin
from jmboyourwords.models import YourStoryCompetition, YourStoryEntry
from ckeditor.widgets import CKEditorWidget
from django.db import models
class YourStoryCompetitionAdmin(admin.ModelAdmin):
list_filter = ('created', 'publish_on', 'retract_on')
list_display = ('title', 'pub... | from django.contrib import admin
from jmboyourwords.models import YourStoryCompetition, YourStoryEntry
from ckeditor.widgets import CKEditorWidget
from django.db import models
class YourStoryCompetitionAdmin(admin.ModelAdmin):
list_filter = ('created', 'publish_on', 'retract_on')
list_display = ('title', 'pub... | bsd-3-clause | Python |
9bcce8a3e397adff1f854d8a178e117710d8896d | add dependency on l10n_be | OCA/l10n-belgium,OCA/l10n-belgium | l10n_be_mis_reports/__manifest__.py | l10n_be_mis_reports/__manifest__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of l10n_be_mis_reports,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# l10n_be_mis_reports is free software:
# you can redistribute it and/or m... | # -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of l10n_be_mis_reports,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# l10n_be_mis_reports is free software:
# you can redistribute it and/or m... | agpl-3.0 | Python |
012f799c37dba3ac325273ff4a455237eda7f2f4 | Add InvalidFeaturesData | moyogo/ufo2ft,googlefonts/ufo2ft,googlei18n/ufo2ft,jamesgk/ufo2fdk | Lib/ufo2ft/errors.py | Lib/ufo2ft/errors.py | class Error(Exception):
"""Base exception class for all ufo2ft errors."""
pass
class InvalidFontData(Error):
"""Raised when input font contains invalid data."""
pass
class InvalidFeaturesData(Error):
"""Raised when input font contains invalid features data."""
pass
class InvalidDesignSp... | class Error(Exception):
"""Base exception class for all ufo2ft errors."""
pass
class InvalidFontData(Error):
"""Raised when input font contains invalid data."""
pass
class InvalidDesignSpaceData(Error):
"""Raised when input DesignSpace document contains invalid data."""
pass
| mit | Python |
3e3691f3a9f726032cfc8a7f532af940ec479d82 | Test values as expected. | caskorg/cask,caskorg/cask,caskorg/cask,caskorg/cask,caskorg/cask | sparsegrind/test/test_main.py | sparsegrind/test/test_main.py | from sparsegrind.sparsegrindio import io
import os
import unittest
import numpy as np
from numpy import testing
def path_to(file):
return os.path.join(os.path.dirname(__file__), file)
class TestMain(unittest.TestCase):
def setUp(self):
self.csr_matrix = io.read_matrix_market(path_to("small.in"))
... | from sparsegrind.sparsegrindio import io
import os
import unittest
def path_to(file):
return os.path.join(os.path.dirname(__file__), file)
class TestMain(unittest.TestCase):
def setUp(self):
self.csr_matrix = io.read_matrix_market(path_to("small.in"))
def test_main(self):
self.assertEq... | mit | Python |
b38388177c8c535c5225e72ded364fcff174bb27 | Improve help text for DataFileSet.name | mfcovington/djangocms-lab-data,mfcovington/djangocms-lab-data,mfcovington/djangocms-lab-data | cms_lab_data/models.py | cms_lab_data/models.py | from django.db import models
from filer.fields.file import FilerFileField
from filer.fields.image import FilerImageField
from taggit.managers import TaggableManager
class DataFile(models.Model):
name = models.CharField('name',
help_text='Enter a concise, yet descriptive, name for this data file record.',... | from django.db import models
from filer.fields.file import FilerFileField
from filer.fields.image import FilerImageField
from taggit.managers import TaggableManager
class DataFile(models.Model):
name = models.CharField('name',
help_text='Enter a concise, yet descriptive, name for this data file record.',... | bsd-3-clause | Python |
ac90651942d9e11be273121adaa122ff172fae9c | Fix formatting in newline_values_only docstring | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/output/newline_values_only.py | salt/output/newline_values_only.py | # -*- coding: utf-8 -*-
'''
Display values only, separated by newlines
==========================================
.. versionadded:: Lithium
This outputter is designed for Salt CLI return data. It will do the following
to the return dict:
1. Get just the values (ignoring the minion IDs).
2. Each value, if it is itera... | # -*- coding: utf-8 -*-
'''
Display values only with simple data.
=================================
Example input 1::
{
'myminion': ["127.0.0.1", "10.0.0.1"],
'second-minion': ["127.0.0.1", "10.0.0.2"]
}
Example output 1::
127.0.0.1
10.0.0.1
127.0.0.1
10.0.0.2
Example input 2::
... | apache-2.0 | Python |
6cf35a5681b405e61100a3e4c9ca64ce3fa78129 | Complete k_means.py | monal94/digits-scikit-learn | k_means.py | k_means.py | # Import
import numpy as np
from sklearn import cluster
from sklearn import datasets
from sklearn import metrics
from sklearn.cross_validation import train_test_split
from sklearn.metrics import homogeneity_score, completeness_score, v_measure_score, adjusted_rand_score, \
adjusted_mutual_info_score, silhouette_sco... | # Import
import matplotlib.pyplot as plt
import numpy as np
from sklearn import cluster
from sklearn import datasets
from sklearn.cross_validation import train_test_split
from sklearn.manifold import Isomap
from sklearn.preprocessing import scale
digits = datasets.load_digits()
data = scale(digits.data)
X_train, X_te... | mit | Python |
a3a9f64f825a5bfa334fee73c12cc84b5caa7dcc | add regex of every type | yy8597/Sublime-QuickGotoAnything,lite3/Sublime-QuickGotoAnything,yy8597/Sublime-QuickGotoAnything | QuickGotoAnything.py | QuickGotoAnything.py | import sublime
import sublime_plugin
import re
class QuickGotoCommand(sublime_plugin.TextCommand):
def doCommand(self, edit, prifix, reg):
for sel in self.view.sel():
if sel.empty():
sel = self.view.word(sel)
word_sel = self.view.substr(sel)
if not re.sea... | import sublime
import sublime_plugin
import re
class QuickGotoCommand(sublime_plugin.TextCommand):
def doCommand(self, edit, prifix):
for sel in self.view.sel():
if sel.empty():
sel = self.view.word(sel)
word_sel = self.view.substr(sel)
if not re.search('... | mit | Python |
bc49d20270046d36dc16bac70aaf486085537453 | Implement Actor class | Cyanogenoid/kb-project | kb/core.py | kb/core.py | import abc
from collections import namedtuple
Key = namedtuple('Key', ['x', 'y'])
class Keyboard(metaclass=abc.ABCMeta):
def __init__(self):
pass
@abc.abstractproperty
def keys(self):
pass
class Actor(metaclass=abc.ABCMeta):
def __init__(self):
pass
@abc.abstractmetho... | import abc
from collections import namedtuple
Key = namedtuple('Key', ['x', 'y'])
class Keyboard(metaclass=abc.ABCMeta):
def __init__(self):
pass
@abc.abstractproperty
def keys(self):
pass
| mit | Python |
014e4fe380cddcdcc5ca12a32ab6af35e87ee56e | Fix buggy patched QuerySet methods | m4tx/egielda,m4tx/egielda,m4tx/egielda | common/postgresqlfix.py | common/postgresqlfix.py | # This file is part of e-Giełda.
# Copyright (C) 2014 Mateusz Maćkowski and Tomasz Zieliński
#
# e-Giełda is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your ... | # This file is part of e-Giełda.
# Copyright (C) 2014 Mateusz Maćkowski and Tomasz Zieliński
#
# e-Giełda is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your ... | agpl-3.0 | Python |
ce6e69c26b6d820b4f835cd56e72244faf0a6636 | Remove logging. It will just break travis. | RomanZWang/osf.io,billyhunt/osf.io,billyhunt/osf.io,DanielSBrown/osf.io,monikagrabowska/osf.io,pattisdr/osf.io,pattisdr/osf.io,brandonPurvis/osf.io,amyshi188/osf.io,icereval/osf.io,KAsante95/osf.io,cslzchen/osf.io,cwisecarver/osf.io,saradbowman/osf.io,RomanZWang/osf.io,mluo613/osf.io,caneruguz/osf.io,GageGaskins/osf.io... | api/caching/listeners.py | api/caching/listeners.py | from api.caching.tasks import ban_url, logger
from framework.guid.model import Guid
from framework.tasks.handlers import enqueue_task
from modularodm import signals
@signals.save.connect
def log_object_saved(sender, instance, fields_changed, cached_data):
abs_url = None
if hasattr(instance, 'absolute_api_v2_ur... | from api.caching.tasks import ban_url, logger
from framework.guid.model import Guid
from framework.tasks.handlers import enqueue_task
from modularodm import signals
@signals.save.connect
def log_object_saved(sender, instance, fields_changed, cached_data):
abs_url = None
if hasattr(instance, 'absolute_api_v2_ur... | apache-2.0 | Python |
47b045f4c22510dedce7110a1d077f3cfe49592e | 更新 modules main/apps.py, 修正 PEP8 警告 | yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo | commonrepo/main/apps.py | commonrepo/main/apps.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.apps import AppConfig
class MainAppConfig(AppConfig):
name = 'commonrepo.main'
def ready(self):
import commonrepo.main.signals
| # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.apps import AppConfig
class MainAppConfig(AppConfig):
name = 'commonrepo.main'
def ready(self):
import commonrepo.main.signals
| apache-2.0 | Python |
040d63b047c31ce66df7224e31a95f874f07f813 | Update Abby's credentials | hciburrito/tweetcollector | scripts/collect_tweets_for_abby.py | scripts/collect_tweets_for_abby.py | #!/usr/bin/env/ python
# -*- coding: utf-8 -*-
from __future__ import division
__author__ = "Abigale Stangl & Yoshiki Vazquez Baeza"
__copyright__ = "Copyright 2013, The Tweet Collector Project"
__credits__ = ["Yoshiki Vazquez Baeza", "Abigale Stangl"]
__license__ = "BSD"
__version__ = "0.0.0-dev"
__maintainer__ = "Yo... | #!/usr/bin/env/ python
# -*- coding: utf-8 -*-
from __future__ import division
__author__ = "Abigale Stangl & Yoshiki Vazquez Baeza"
__copyright__ = "Copyright 2013, The Tweet Collector Project"
__credits__ = ["Yoshiki Vazquez Baeza", "Abigale Stangl"]
__license__ = "BSD"
__version__ = "0.0.0-dev"
__maintainer__ = "Yo... | bsd-3-clause | Python |
d10e1cde43418679cd512739a812c16f9611468c | add something to report any differences in time | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/dbutil/compute_asos_sts.py | scripts/dbutil/compute_asos_sts.py | # Look into the ASOS database and figure out the start time of various
# sites for a given network.
import sys
sys.path.insert(0, '../lib')
import db, network
asos = db.connect('asos')
mesosite = db.connect('mesosite')
net = sys.argv[1]
table = network.Table( net )
ids = `tuple(table.sts.keys())`
rs = asos.query("... | # Look into the ASOS database and figure out the start time of various
# sites for a given network.
import sys
sys.path.insert(0, '../lib')
import db, network
asos = db.connect('asos')
mesosite = db.connect('mesosite')
net = sys.argv[1]
table = network.Table( net )
ids = `tuple(table.sts.keys())`
rs = asos.query("... | mit | Python |
f2d82224c20587de8eb88fbbc7eae39d872a97e0 | Allow researcher to see the scientist list. refs #10 | openhealthcare/opal-research,openhealthcare/opal-research,openhealthcare/opal-research | research/teams.py | research/teams.py | """
Research study teams!
"""
from opal.models import Team
from research.models import ResearchStudy
def get_study_teams(user):
"""
Given a USER, return a list of study teams that this user can see.
If USER is not authenticated, just return []
"""
# Go through study roles, getting those fo... | """
Research study teams!
"""
from opal.models import Team
from research.models import ResearchStudy
def get_study_teams(user):
"""
Given a USER, return a list of study teams that this user can see.
If USER is not authenticated, just return []
"""
# Go through study roles, getting those fo... | agpl-3.0 | Python |
e8a2a57d8215e7fe012c35502726feced292cd66 | define a struct to represent a req line | h2o/h2o,cwyang/h2o,devnexen/h2o,cwyang/h2o,cwyang/h2o,devnexen/h2o,cwyang/h2o,cwyang/h2o,h2o/h2o,yannick/h2o,h2o/h2o,cwyang/h2o,h2o/h2o,devnexen/h2o,devnexen/h2o,yannick/h2o,h2o/h2o,h2o/h2o,yannick/h2o,h2o/h2o,yannick/h2o,yannick/h2o,yannick/h2o,cwyang/h2o,yannick/h2o,devnexen/h2o,devnexen/h2o,h2o/h2o,h2o/h2o,yannick/h... | h2olog.py | h2olog.py | #!/usr/bin/env python
#
# h2olog - A BPF-backed request logging client for the H2O server.
#
# USAGE: $ sudo h2olog -p $(pgrep -o h2o)
#
# Copyright 2019 Fastly, Toru Maesaka
from bcc import BPF, USDT
import getopt, sys
bpf = """
#define MAX_STR_LEN 128
/*
* "req_line_t" represents an individual log line for a give... | #!/usr/bin/env python
#
# h2olog - A BPF-backed request logging client for the H2O server.
#
# USAGE: $ sudo h2olog -p $(pgrep -o h2o)
#
# Copyright 2019 Fastly, Toru Maesaka
from bcc import BPF, USDT
import getopt, sys
try:
h2o_pid = 0
opts, args = getopt.getopt(sys.argv[1:], 'p:')
for opt, arg in opts:
... | mit | Python |
da0461f30e4a693308d55a6e23cf31c96c2ebd62 | Add to filter definition back to /items endpoint config (temporarily?) | marwoodandrew/superdesk,marwoodandrew/superdesk,amagdas/superdesk,vied12/superdesk,petrjasek/superdesk,verifiedpixel/superdesk,plamut/superdesk,akintolga/superdesk,Aca-jov/superdesk,vied12/superdesk,ancafarcas/superdesk,mdhaman/superdesk,akintolga/superdesk,amagdas/superdesk,akintolga/superdesk-aap,superdesk/superdesk-... | server/publicapi/items/resource.py | server/publicapi/items/resource.py | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from superde... | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from superde... | agpl-3.0 | Python |
f12af205ca549b451dc202d245a7afdefc5873dd | Update conf.py | temaput/django-oscar-robokassa | robokassa/conf.py | robokassa/conf.py | #coding: utf-8
from django.conf import settings
# обязательные параметры - реквизиты магазина
LOGIN = settings.ROBOKASSA_LOGIN
PASSWORD1 = settings.ROBOKASSA_PASSWORD1
PASSWORD2 = getattr(settings, 'ROBOKASSA_PASSWORD2', None)
# использовать ли метод POST при приеме результатов
USE_POST = getattr(settings, 'ROBOKASS... | #coding: utf-8
from django.conf import settings
# обязательные параметры - реквизиты магазина
LOGIN = settings.ROBOKASSA_LOGIN
PASSWORD1 = settings.ROBOKASSA_PASSWORD1
PASSWORD2 = getattr(settings, 'ROBOKASSA_PASSWORD2', None)
# использовать ли метод POST при приеме результатов
USE_POST = getattr(settings, 'ROBOKASS... | mit | Python |
177c46be5ce36393c61ea59e11eb06aada7d6f02 | Update included commands. | goliatone/minions | scaffolder/cli.py | scaffolder/cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from scaffolder.core.commands import CommandController
COMMANDS = [
'create',
'list',
'install',
'vcs',
]
class CliApplication():
def __init__(self):
self.description
@property
def description(self):
return self._d... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from scaffolder.core.commands import CommandController
COMMANDS = [
'create',
'template',
'install',
'vcs',
]
class CliApplication():
def __init__(self):
self.description
@property
def description(self):
return sel... | mit | Python |
683156c5ae906adb4030f7874f4cd735db31a5cc | Bump dev version for continued work | bskinn/sphobjinv | src/sphobjinv/version.py | src/sphobjinv/version.py | r"""``sphobjinv`` *version definition module*.
``sphobjinv`` is a toolkit for manipulation and inspection of
Sphinx |objects.inv| files.
**Author**
Brian Skinn (bskinn@alum.mit.edu)
**File Created**
18 Mar 2019
**Copyright**
\(c) Brian Skinn 2016-2020
**Source Repository**
https://github.com/bskinn... | r"""``sphobjinv`` *version definition module*.
``sphobjinv`` is a toolkit for manipulation and inspection of
Sphinx |objects.inv| files.
**Author**
Brian Skinn (bskinn@alum.mit.edu)
**File Created**
18 Mar 2019
**Copyright**
\(c) Brian Skinn 2016-2020
**Source Repository**
https://github.com/bskinn... | mit | Python |
a1fcecf75ae7dff39f90edb170b7ff036ad733a2 | implement ls and list | jonasdk/joe,0xAX/joe,0xAX/joe,kaushik94/joe,karan/joe,jonasdk/joe,msoftreddy/joe,benoptimus/joe,msoftreddy/joe,gautamk/joe,kaushik94/joe,benoptimus/joe,karan/joe | joe/joe.py | joe/joe.py | import os
import click
_ROOT = os.path.abspath(os.path.dirname(__file__))
def get_data_dir(path):
return os.path.dirname(os.path.join(_ROOT, 'data', path))
# Where all gitignore files are
DATA_DIR = get_data_dir('*.gitignore')
# Load up names for all gitignore files
GITIGNORE = [f.replace('.gitignore', '').lo... | from os import walk
import click
@click.command(name='ls', help='List all available .gitignore files.')
def ls():
click.echo('ls called yo')
@click.command(name='list', help='List all available .gitignore files.')
def list():
click.echo('list called yo')
# @click.command()
# @click.option('--count', defa... | mit | Python |
3f0b2f306f11df230873a540e8b456a4ea8f5c74 | Add transaction manager | jesseklein406/learning-journal,jesseklein406/learning-journal | journal.py | journal.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A Pyramid app for my learning journal
"""
from __future__ import unicode_literals
import os
from pyramid.config import Configurator
from pyramid.view import view_config
from waitress import serve
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A Pyramid app for my learning journal
"""
from __future__ import unicode_literals
import os
from pyramid.config import Configurator
from pyramid.view import view_config
from waitress import serve
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative... | mit | Python |
6a172e73fd39b27b4d03cfd601d59d25cd8cdf96 | Change log levels | juliema/aTRAM | lib/log.py | lib/log.py | """Common logging functions."""
import sys
import logging
import tempfile
import subprocess
def setup(args):
"""Standard logger setup."""
logging.basicConfig(
filename=args.log_file,
level=logging.DEBUG,
format='%(asctime)s %(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M... | """Common logging functions."""
import sys
import logging
import tempfile
import subprocess
def setup(args):
"""Standard logger setup."""
logging.basicConfig(
filename=args.log_file,
level=logging.DEBUG,
format='%(asctime)s %(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M... | bsd-3-clause | Python |
4dc166649d42e00ef9c3db38e623b50439285cbc | Fix path. | ShapeNet/JointEmbedding,ShapeNet/JointEmbedding,ShapeNet/JointEmbedding,ShapeNet/JointEmbedding | JointEmbedding/src/image_embedding_training/extract_pool5_feats.py | JointEmbedding/src/image_embedding_training/extract_pool5_feats.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(BASE_DIR))
from global_variables import *
script_path = os.path.join(BASE_DIR, 'extract_feature_batch.py')
cmd = 'python %s --caffe_path %s --img_filelist %s --prototxt %s --... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(BASE_DIR))
from global_variables import *
script_path = os.path.join(BASE_DIR, 'image_embedding_training/extract_feature_batch.py')
cmd = 'python %s --caffe_path %s --img_fil... | bsd-3-clause | Python |
530bef9e1fd39089b279e79f1b56ba039ce3c4ad | Test for function utils.fixes._copysign. | cauchycui/scikit-learn,nesterione/scikit-learn,victorbergelin/scikit-learn,lenovor/scikit-learn,voxlol/scikit-learn,alexsavio/scikit-learn,vibhorag/scikit-learn,mfjb/scikit-learn,jzt5132/scikit-learn,jayflo/scikit-learn,pypot/scikit-learn,billy-inn/scikit-learn,pkruskal/scikit-learn,Sentient07/scikit-learn,Adai0808/sci... | scikits/learn/utils/tests/test_fixes.py | scikits/learn/utils/tests/test_fixes.py | # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD
import numpy as np
from nose.tools import assert_equal
from numpy.testing import assert_array_equal
from ..fixes import _in1d, _copysign
def test_in1d():
a = np.arange(1... | # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD
import numpy as np
import nose
from ..fixes import _in1d
def test_in1d():
a = np.arange(10)
b = a[a%2 == 0]
nose.tools.assert_equal(_in1d(a, b).sum(), 5)
| bsd-3-clause | Python |
1fab2a5bec63d8b57859febc13b052439920963f | Bump version to 3.5.0a16 | platformio/platformio,platformio/platformio-core,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 | Python |
8f1a8f9154b63723024fc2e03a148a41c1277a90 | fix typo | Changron/NTHUOJ_web,geniusgordon/NTHUOJ_web,nthuoj/NTHUOJ_web,henryyang42/NTHUOJ_web,bruce3557/NTHUOJ_web,drowsy810301/NTHUOJ_web,drowsy810301/NTHUOJ_web,geniusgordon/NTHUOJ_web,nthuoj/NTHUOJ_web,bbiiggppiigg/NTHUOJ_web,nthuoj/NTHUOJ_web,henryyang42/NTHUOJ_web,Changron/NTHUOJ_web,bbiiggppiigg/NTHUOJ_web,bruce3557/NTHUO... | install.py | install.py | '''
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, ... | '''
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, ... | mit | Python |
af68c8ac7dcf318d5eea4166e158f3823662001a | Add coding | korniichuk/sphinx-sagecell-ext,korniichuk/sphinx-sagecell-ext | sagecell/sagecell.py | sagecell/sagecell.py | # -*- coding: utf-8 -*-
| unlicense | Python | |
3429a1b543208adf95e60c89477a4219a5a366a3 | Add header and footer sections to the .sty. | posquit0/latex-fontawesome | makesty.py | makesty.py | import re
# Input file created from http://astronautweb.co/snippet/font-awesome/
INPUT_FILE = 'htmlfontawesome.txt'
OUTPUT_FILE = 'fontawesome.sty'
OUTPUT_HEADER = r'''
% Identify this package.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fontawesome}[2014/04/24 v4.0.3 font awesome icons]
% Requirements to use.
\usepac... | import re
# Input file created from http://astronautweb.co/snippet/font-awesome/
INPUT_FILE = 'htmlfontawesome.txt'
OUTPUT_FILE = 'fontawesome.sty'
with open(INPUT_FILE) as r, open(OUTPUT_FILE, 'w') as w:
for line in r:
# Expects to find 'fa-NAME' ending with "
name = re.findall(r'fa-[^""]*', line)[0]
#... | mit | Python |
1db3ad2279288eb7393d1e7d6b87a469b548f064 | Fix migrations | anuveyatsu/dpr-api,frictionlessdata/dpr-api,anuveyatsu/dpr-api,anuveyatsu/dpr-api,frictionlessdata/dpr-api,frictionlessdata/dpr-api,subhankarb/dpr-api | manager.py | manager.py | from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from flask import current_app, json
from os.path import join, dirname
from dotenv import load_dotenv
from app.database import db
from app.mod_api import models
from app import create_app
dot_env_path = join(dirname(__file__), '.env')
lo... | from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from flask import current_app, json
from os.path import join, dirname
from dotenv import load_dotenv
from app.database import db
from app.mod_api import models
from app import create_app
dot_env_path = join(dirname(__file__), '.env')
lo... | mit | Python |
0cb84741592675253bb91be0b25e1793762535f7 | change package message handling | masselstine/meta-overc,WindRiver-OpenSourceLabs/meta-overc,mufeng/meta-overc,OverC/meta-overc,masselstine/meta-overc,jwessel/meta-overc,OverC/meta-overc,OverC/meta-overc,jwessel/meta-overc,mufeng/meta-overc,jwessel/meta-overc,WindRiver-OpenSourceLabs/meta-overc,WindRiver-OpenSourceLabs/meta-overc,masselstine/meta-overc... | meta-pod/recipes-support/overc-system-agent/files/overc-system-agent-1.2/Overc/package.py | meta-pod/recipes-support/overc-system-agent/files/overc-system-agent-1.2/Overc/package.py | import sys, os
import subprocess
import select
class Package(object):
def __init__(self):
pass
def _smartpm(self, args, chroot=None):
cmd = []
if chroot != None:
cmd.append("chroot")
cmd.append(chroot)
cmd.append("/usr/bin/smart")
cmd.append(args... | import sys, os
import subprocess
class Package(object):
def __init__(self):
pass
def _smartpm(self, args):
# return os.system('/usr/bin/smart %s' % args)
self.message = subprocess.Popen(["/usr/bin/smart", args], stdout=subprocess.PIPE).communicate()[0]
def _get_kernel(self, path)... | mit | Python |
cb73f03d09a2205086ef38f57b58387c53d9f9b5 | add info | wenshin/kibanapy | kibanapy/__init__.py | kibanapy/__init__.py | #!/usr/bin/env python
# encoding: utf-8
__version__ = '0.1.4'
__release_date__ = '2015-08-01'
try:
from .dashboard import Dashboard
from .visualization import Visualization
except Exception:
# setup.py import module 来获取__version__时,
# 如果是纯净的环境没有安装一些依赖库,导入就会报错。
# 如:requests 包依赖。所以这里用异常包裹导入异常
p... | #!/usr/bin/env python
# encoding: utf-8
__version__ = '0.1.3'
__release_date__ = '2015-07-29'
try:
from .dashboard import Dashboard
from .visualization import Visualization
except Exception:
# setup.py import module 来获取__version__时,
# 如果是纯净的环境没有安装一些依赖库,导入就会报错。
# 如:requests 包依赖。所以这里用异常包裹导入异常
p... | bsd-3-clause | Python |
fe084c197c7f3bc9072ba6e6fa34e7d65af2ed9b | debug instructions | john-38787364/antifier,john-38787364/antifier | T1942/T1942_debug.py | T1942/T1942_debug.py | import usb.core, time, binascii
from datetime import datetime
dev = usb.core.find(idVendor=0x3561, idProduct=0x1942)
dev.set_configuration()
#possible resistance values to be sent
#-5% (0xf34d or -0x0cb3 or -3251)
#-2.5% (0xf9a7 or -0x659 or -1625),
#0 (0),
#2.5% (0x0659 or 1625),
#5% (0x0cb3 or 3251),
#7.5% (0x1... | import usb.core, time, binascii
from datetime import datetime
dev = usb.core.find(idVendor=0x3561, idProduct=0x1942)
dev.set_configuration()
#initialise TACX USB device
byte_ints = [2,0,0,0] # will not read cadence until initialisation byte is sent
byte_str = "".join(chr(n) for n in byte_ints)
if not simulatetrainer:... | mit | Python |
a26556eeab8b0e6bb0aa23423884622453cfa26e | Update wsgi.py | DemocracyFoundation/Epitome,DemocracyFoundation/Epitome,DemocracyFoundation/Epitome | Epitome/wsgi.py | Epitome/wsgi.py | """
WSGI config for Epitome project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
#from whitenoise import WhiteNoise
#from my_project import MyWSGIApp
... | """
WSGI config for Epitome project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from whitenoise import WhiteNoise
from my_project import MyWSGIApp
fr... | agpl-3.0 | Python |
eee3e8ca851a766fe0707107c8e0360e73271d1a | fix logout if user try to make illegal operation | IlyaSergeev/taxi_service | TaxiService/views.py | TaxiService/views.py | from django.template import RequestContext
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout
from django.core.context_processors import csrf
from TaxiService.models import *
from TaxiService.user_groups ... | from django.template import RequestContext
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout
from django.core.context_processors import csrf
from TaxiService.models import *
from TaxiService.user_groups ... | mit | Python |
0ef46e451e8aa10a5bb6df0d4380c3fe5c8fd3d0 | Fix contents write bug in soundcloud script | up1/blog-1,up1/blog-1,up1/blog-1 | soundcloud.py | soundcloud.py | import os, re, requests
rootdir = '_posts'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
filename = os.path.join(subdir, file)
f = open(filename, "r")
contents = f.readlines()
f.close()
# Get WordPress
slug = filename.replace("_posts/", "").replace(".markdown",... | import os, re, requests
rootdir = '_posts'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
filename = os.path.join(subdir, file)
f = open(filename, "r")
contents = f.readlines()
f.close()
# Get WordPress
slug = filename.replace("_posts/", "").replace(".markdown",... | mit | Python |
a05a5287352a3d624ba18f7c30cd7271309e8470 | Move app imports to the top of file (fix Flake8 E402) | claudyus/LXC-Web-Panel,claudyus/LXC-Web-Panel,romses/LXC-Web-Panel,romses/LXC-Web-Panel,romses/LXC-Web-Panel,claudyus/LXC-Web-Panel,claudyus/LXC-Web-Panel,romses/LXC-Web-Panel | lwp/app.py | lwp/app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
import sys
from flask import Flask, g
from lwp.utils import connect_db, check_session_limit, config
from lwp.views import main, auth, api
SESSION_SECRET_FILE = '/etc/lwp/session_secret'
if '--generate_ses... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
import sys
from flask import Flask, g
SESSION_SECRET_FILE = '/etc/lwp/session_secret'
if '--generate_session_secret' in sys.argv[1:]:
key = os.urandom(24)
with os.fdopen(os.open(SESSION_SECRET_FILE... | mit | Python |
07d1998cc2f571846bf99f8d1ef9236ada027155 | Allow specifying temporary=False in the checkout-helper | ZeitOnline/zeit.cms,ZeitOnline/zeit.cms,ZeitOnline/zeit.cms,ZeitOnline/zeit.cms | src/zeit/cms/checkout/helper.py | src/zeit/cms/checkout/helper.py | # Copyright (c) 2008-2011 gocept gmbh & co. kg
# See also LICENSE.txt
import contextlib
import logging
import zeit.cms.checkout.interfaces
log = logging.getLogger(__name__)
def with_checked_out(content, function, events=True):
"""Call a function with a checked out version of content.
Function makes sure c... | # Copyright (c) 2008-2011 gocept gmbh & co. kg
# See also LICENSE.txt
import contextlib
import logging
import zeit.cms.checkout.interfaces
log = logging.getLogger(__name__)
def with_checked_out(content, function, events=True):
"""Call a function with a checked out version of content.
Function makes sure c... | bsd-3-clause | Python |
78ecab5f7e7402cb54f463fbc33e8f31600c749a | remove unused import | ZeitOnline/zeit.cms,ZeitOnline/zeit.cms,ZeitOnline/zeit.cms,ZeitOnline/zeit.cms | src/zeit/cms/checkout/helper.py | src/zeit/cms/checkout/helper.py | # Copyright (c) 2008-2010 gocept gmbh & co. kg
# See also LICENSE.txt
from __future__ import with_statement
import contextlib
import logging
import zeit.cms.checkout.interfaces
log = logging.getLogger(__name__)
def with_checked_out(content, function, events=True):
"""Call a function with a checked out version ... | # Copyright (c) 2008-2010 gocept gmbh & co. kg
# See also LICENSE.txt
from __future__ import with_statement
from zeit.cms.i18n import MessageFactory as _
import contextlib
import logging
import zeit.cms.checkout.interfaces
log = logging.getLogger(__name__)
def with_checked_out(content, function, events=True):
... | bsd-3-clause | Python |
e53e642ebcc9cb2b6c50231d33f5ae2f8f7211dd | Add aligned tests. | strinking/statbot,strinking/statbot | statbot/test_message_history.py | statbot/test_message_history.py | #
# test_message_history.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
... | #
# test_message_history.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
... | mit | Python |
5f8978de7dad5d0310f7e4cd2f72e6c5e43bb674 | Fix imports in SliceStyles | scholer/cadnano2.5 | cadnano/gui/views/sliceview/slicestyles.py | cadnano/gui/views/sliceview/slicestyles.py | from PyQt5.QtGui import QFont
from cadnano.gui.views.styles import BLUE_STROKE, THE_FONT
# Slice Sizing
SLICE_HELIX_RADIUS = 15.
SLICE_HELIX_STROKE_WIDTH = 0.5
SLICE_HELIX_MOD_HILIGHT_WIDTH = 1
# Z values
# bottom
ZSLICEHELIX = 40
ZSELECTION = 50
ZDESELECTOR = 60
ZWEDGEGIZMO = 100
ZPXIGROUP = 150
ZPARTITEM = 200
# ... | from PyQt5.QtGui import QFont
from cadnano.gui.views.styles import THE_FONT, THE_FONT_SIZE
from cadnano.gui.views.styles import BLUE_FILL, BLUE_STROKE
from cadnano.gui.views.styles import GRAY_FILL, GRAY_STROKE
# Slice Sizing
SLICE_HELIX_RADIUS = 15.
SLICE_HELIX_STROKE_WIDTH = 0.5
SLICE_HELIX_MOD_HILIGHT_WIDTH = 1
#... | mit | Python |
cbdcad47ae0e42f4ca5c23925f9dfeab4b5186fa | Use assert instead of raise | ktnyt/chainer,hvy/chainer,chainer/chainer,keisuke-umezawa/chainer,hvy/chainer,chainer/chainer,wkentaro/chainer,wkentaro/chainer,ktnyt/chainer,chainer/chainer,jnishi/chainer,niboshi/chainer,keisuke-umezawa/chainer,wkentaro/chainer,ronekko/chainer,niboshi/chainer,hvy/chainer,okuta/chainer,chainer/chainer,hvy/chainer,jnis... | tests/chainer_tests/utils_tests/test_sparse.py | tests/chainer_tests/utils_tests/test_sparse.py | import unittest
import numpy
from chainer import testing
from chainer import utils
def _setup_tensor(_min, _max, shape, dtype, threshold=None):
y = numpy.random.uniform(_min, _max, shape).astype(dtype)
if threshold is not None:
y[y < threshold] = 0
return y
@testing.parameterize(*testing.produ... | import unittest
import numpy
from chainer import testing
from chainer import utils
def _setup_tensor(_min, _max, shape, dtype, threshold=None):
y = numpy.random.uniform(_min, _max, shape).astype(dtype)
if threshold is not None:
y[y < threshold] = 0
return y
@testing.parameterize(*testing.produ... | mit | Python |
769a88f9551120280a5713a3852edb3ef6046cc3 | Remove trailing whitespace. | cbumgard/GitCommitMsg | GitCommitMsg.py | GitCommitMsg.py | import sublime, sublime_plugin
import commands
import subprocess
import os
import sys
class GitCommitMsgCommand(sublime_plugin.TextCommand):
"""
Custom git_commit_msg plugin:
Shows the git commit history for one or more lines of code.
Default keybinding is cmd+shift+m (Mac) or alt+shift+m (Linux/Windows).
... | import sublime, sublime_plugin
import commands
import subprocess
import os
import sys
class GitCommitMsgCommand(sublime_plugin.TextCommand):
"""
Custom git_commit_msg plugin:
Shows the git commit history for one or more lines of code.
Default keybinding is cmd+shift+m (Mac) or alt+shift+m (Linux/Windows).
... | mit | Python |
c10dc1fd9352e9b44458053125370f87b79bee9c | Fix components declaration. | opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind | src/waldur_mastermind/marketplace_vmware/apps.py | src/waldur_mastermind/marketplace_vmware/apps.py | from django.apps import AppConfig
from django.db.models import signals
class MarketplaceVMwareConfig(AppConfig):
name = 'waldur_mastermind.marketplace_vmware'
verbose_name = 'Marketplace VMware'
def ready(self):
from waldur_mastermind.marketplace.plugins import Component
from waldur_maste... | from django.apps import AppConfig
from django.db.models import signals
class MarketplaceVMwareConfig(AppConfig):
name = 'waldur_mastermind.marketplace_vmware'
verbose_name = 'Marketplace VMware'
def ready(self):
from waldur_mastermind.marketplace.plugins import Component
from waldur_maste... | mit | Python |
088610530754f6bb1cf2013f416b6f45ba334028 | Update rosalind_lexf.py | angeeranaser/Rosalind,angeeranaser/Rosalind | Python/rosalind_lexf.py | Python/rosalind_lexf.py | # Rosalind: Enumerating k-mers Lexicographically
# Given: A collection of at most 10 symbols defining an ordered alphabet, and a positive integer n (n < 10).
# Return: All strings of length n that can be formed from the alphabet, ordered lexicographically.
from itertools import product
def main():
... | from itertools import product
def main():
dataFile = open('rosalind_lexf.txt','r')
dataList, n = dataFile.readlines()
dataList = dataList.strip().replace(' ','')
dataFile.close()
n = int(n)
outputFile = open('output.txt','w')
result = list(product(dataList,repeat=n))
for x... | mit | Python |
9ced315d4cb91efa273aadaf657aa1310ccd0597 | Simplify formula for standard line | all3fox/algos-py | src/geometry/line2d.py | src/geometry/line2d.py | from src.geometry.point2d import Point2D
def dot_product(ps, qs, sum=sum):
'''
Computes the dot product of two vectors.
:ps: the list of coordinates of the first vector
:qs: the list of coordinates of the second vector
:sum: consider using math.fsum if you need to sum over many floats
:return... | from src.geometry.point2d import Point2D
def dot_product(ps, qs, sum=sum):
'''
Computes the dot product of two vectors.
:ps: the nnlist of coordinates of the first vector
:qs: the list of coordinates of the second vector
:sum: consider using math.fsum if you need to sum over many floats
:retu... | mit | Python |
5217d664bee97ca252d83a771952c5625d2240e0 | Update romanToDecimal.py | CptDemocracy/Python | Puzzles/leetcode/April-9th-2016/romanToDecimal.py | Puzzles/leetcode/April-9th-2016/romanToDecimal.py | """
[ref.href] leetcode.com/problems/roman-to-integer
"
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
"
"""
class Solution(object):
def romanToInt(self, s):
nums = { 'I': 1, 'V': 5, 'X': 10,
'L': 50, 'C... | """
[ref.href] leetcode.com/problems/roman-to-integer
"
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
"
"""
class Solution(object):
def romanToInt(self, s):
nums = { 'I': 1, 'V': 5, 'X': 10,
'L': 50, 'C... | mit | Python |
6192d445b42b94eca1a813878b009aa4582ea4b0 | add ingress description | tobiasmcnulty/aws-container-basics,caktus/aws-web-stacks | stack/security_groups.py | stack/security_groups.py | import os
from itertools import product
from troposphere import Ref
from troposphere.ec2 import SecurityGroup, SecurityGroupRule
from .template import template
from .vpc import loadbalancer_a_subnet_cidr, loadbalancer_b_subnet_cidr, vpc
load_balancer_security_group = SecurityGroup(
"LoadBalancerSecurityGroup",
... | import os
from itertools import product
from troposphere import Ref
from troposphere.ec2 import SecurityGroup, SecurityGroupRule
from .template import template
from .vpc import loadbalancer_a_subnet_cidr, loadbalancer_b_subnet_cidr, vpc
load_balancer_security_group = SecurityGroup(
"LoadBalancerSecurityGroup",
... | mit | Python |
3b540026e15862bc95cceb567c9ee8f754eeb55d | Correct environment in test | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | tests/zeus/api/resources/test_install_index.py | tests/zeus/api/resources/test_install_index.py | def test_installation_details(client, default_user, default_build):
resp = client.get("/api/install")
assert resp.status_code == 200
data = resp.json()
assert data["stats"] == {
"builds24h": 1,
"buildsTotal": 1,
"reposTotal": 1,
"usersTotal": 1,
}
assert data["con... | def test_installation_details(client, default_user, default_build):
resp = client.get("/api/install")
assert resp.status_code == 200
data = resp.json()
assert data["stats"] == {
"builds24h": 1,
"buildsTotal": 1,
"reposTotal": 1,
"usersTotal": 1,
}
assert data["con... | apache-2.0 | Python |
9b40838f25c6a64f289b1bd07db9e0326486c8ec | Use pointMult instead of arithmetic.privtopub | timothyparez/PyBitmessage,debguy0x/PyBitmessage,debguy0x/PyBitmessage,torifier/PyBitmessage,Erkan-Yilmaz/PyBitmessage,kyucrane/PyBitmessage,hb9kns/PyBitmessage,xeddmc/PyBitmessage,bmng-dev/PyBitmessage,krytarowski/PyBitmessage,hb9kns/PyBitmessage,gnu3ra/PyBitmessage,mailchuck/PyBitmessage,lightrabbit/PyBitmessage,Josep... | src/highlevelcrypto.py | src/highlevelcrypto.py | import pyelliptic
from pyelliptic import arithmetic as a, OpenSSL
def makeCryptor(privkey):
private_key = a.changebase(privkey, 16, 256, minlen=32)
public_key = pointMult(private_key)
privkey_bin = '\x02\xca\x00\x20' + private_key
pubkey_bin = '\x02\xca\x00\x20' + public_key[1:-32] + '\x00\x20' + pubkey[-32:]
... | import pyelliptic
from pyelliptic import arithmetic as a, OpenSSL
def makeCryptor(privkey):
privkey_bin = '\x02\xca\x00 '+a.changebase(privkey,16,256,minlen=32)
pubkey = a.changebase(a.privtopub(privkey),16,256,minlen=65)[1:]
pubkey_bin = '\x02\xca\x00 '+pubkey[:32]+'\x00 '+pubkey[32:]
cryptor = pyelliptic.ECC(... | mit | Python |
016b1d4e6dc1acbd9a11f43a2cdad4c1787c5ce7 | Add new default settings. | markmuetz/stormtracks,markmuetz/stormtracks | stormtracks/settings/default.py | stormtracks/settings/default.py | import os
# expandvars expands e.g. $HOME
DATA_DIR = os.path.expandvars('$HOME/stormtracks/data')
OUTPUT_DIR = os.path.expandvars('$HOME/stormtracks/output')
C20_FULL_DATA_DIR = os.path.join(DATA_DIR, 'c20_full')
C20_MEAN_DATA_DIR = os.path.join(DATA_DIR, 'c20_mean')
IBTRACS_DATA_DIR = os.path.join(DATA_DIR, 'ibtracs... | import os
# expandvars expands e.g. $HOME
DATA_DIR = os.path.expandvars('$HOME/stormtracks/data')
OUTPUT_DIR = os.path.expandvars('$HOME/stormtracks/output')
| mit | Python |
43fa2664d7b0d5882b866150ce5d942345cfc6de | make STALE_DAYS configurable. | openafs-contrib/afspy,openafs-contrib/afspy | afs/__init__.py | afs/__init__.py | """
The module afs provides high-level acess to openAFS.
It mostly deals with the server-side (volumes).
A database can be used as transparent cache towards the live system.
"""
__all__ = ["service"]
#
# internal usages
#
from afs.orm import setup_options as orm_setup_options
from afs.lla import setup_options as lla... | """
The module afs provides high-level acess to openAFS.
It mostly deals with the server-side (volumes).
A database can be used as transparent cache towards the live system.
"""
__all__ = ["service"]
#
# internal usages
#
from afs.orm import setup_options as orm_setup_options
from afs.lla import setup_options as lla... | bsd-2-clause | Python |
79c3ded5c335edbd5bcb68851fc050393beed4a9 | Improve argument parsing | david-wm-sanders/rwrtrack,david-wm-sanders/rwrtrack | ranking.py | ranking.py | import sys
from pathlib import Path
from stats import load_stats_from_csv
from analysis import calculate_metrics
if __name__ == '__main__':
if len(sys.argv) < 2:
print("Usage: ranking.py METRIC [MINXP=0] [UPTO=50]")
sys.exit(1)
sorted_by = sys.argv[1]
min_xp = int(sys.argv[2]) if len(sys.... | import sys
from pathlib import Path
from stats import load_stats_from_csv
from analysis import calculate_metrics
if __name__ == '__main__':
if len(sys.argv) != 4:
print("Usage: ranking.py METRIC MINXP UPTO")
sys.exit(1)
sorted_by = sys.argv[1]
min_xp = int(sys.argv[2])
upto = int(sys.... | mit | Python |
6ee7619dc7bd24d626bd19e884494a50b1659e01 | Fix refactoring bug. | google/ctfscoreboard,google/ctfscoreboard,google/ctfscoreboard,google/ctfscoreboard | scoreboard/errors.py | scoreboard/errors.py | # Copyright 2014 David Tomaschik <david@systemoverlord.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 2014 David Tomaschik <david@systemoverlord.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 |
d75b698f92280433179d74c6d408a9775c981df5 | Remove outdated arg | ucb-sts/sts,jmiserez/sts,ucb-sts/sts,jmiserez/sts | config/pox_list_mcs.py | config/pox_list_mcs.py |
from experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import MCSFinder, Peeker
from sts.invariant_checker import InvariantChecker
from sts.simulation_state import SimulationConfig
controllers = [ControllerConfig(cmdline='./pox.py --verbose --no-cli openflow.of_... |
from experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import MCSFinder, Peeker
from sts.invariant_checker import InvariantChecker
from sts.simulation_state import SimulationConfig
controllers = [ControllerConfig(cmdline='./pox.py --verbose --no-cli openflow.of_... | apache-2.0 | Python |
84ccd5ff9a90c960781a8958972f0b03582ba265 | test list reading | fonorobert/mailforward | mailfwd.py | mailfwd.py | #!/usr/bin/env python3
import sys
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.parser import Parser
#function to read address lists into list
def readlist(input_file):
with open(input_file, mode="r") as f:
lines = f.readlines()
result ... | #!/usr/bin/env python3
import sys
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.parser import Parser
#function to read address lists into list
def readlist(input_file):
with open(input_file, mode="r") as f:
lines = f.readlines()
result ... | mit | Python |
ca29f58f8cf32687e6fb86b878e156ad78838a63 | Set version to 0.1.6 | gnotaras/django-postgresql-manager | src/PostgreSQL_manager/__init__.py | src/PostgreSQL_manager/__init__.py | # -*- coding: utf-8 -*-
#
# This file is part of django-postgresql-manager.
#
# django-postgresql-manager - a Django application which can be used to manage
# PostgreSQL users and databases.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-postgresql-manager
# Public Source Code Repository:... | # -*- coding: utf-8 -*-
#
# This file is part of django-postgresql-manager.
#
# django-postgresql-manager - a Django application which can be used to manage
# PostgreSQL users and databases.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-postgresql-manager
# Public Source Code Repository:... | apache-2.0 | Python |
708c0efd693d30577a9a4bfeab6bdf7f759ca9d5 | Return a future for the loader | CodingNinja/thumbor_rackspace | thumbor_rackspace/loaders/cloudfiles_loader.py | thumbor_rackspace/loaders/cloudfiles_loader.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) 2013 theiconic.com.au development@theiconic.com.au
from os.path import join, expanduser
from thumbor.utils ... | #!/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) 2013 theiconic.com.au development@theiconic.com.au
from os.path import join, expanduser
from thumbor.utils ... | mit | Python |
f87f2ec4707bcf851e00ff58bbfe43f4d7523606 | Refactor DNZ fetch script before overhaul | judsonsam/tekautoday,judsonsam/tekautoday,judsonsam/tekautoday,judsonsam/tekautoday | scripts/dnz-fetch.py | scripts/dnz-fetch.py | import os
# import math
import json
from pprint import pprint
from datetime import date
from pydnz import Dnz
dnz_api = Dnz(os.environ.get('DNZ_KEY'))
YEAR_INTERVAL = 10
def request_dnz_records(timespan, page):
parameters = {
'_and': {
'category': ['Images'],
'year': [timespan]
... | import os
import math
import json
from pprint import pprint
from pydnz import Dnz
dnz = Dnz(os.environ.get('DNZ_KEY'))
results = []
def dnz_request(page=1):
filters = {
'category': ['Images'],
'year': ['2005+TO+2006']
}
fields = ['id', 'date']
return dnz.search('', _and=filters, per... | mit | Python |
be5541bd16a84c37b973cf77cb0f4d5c5e83e39a | Fix import and tokenizer exceptions | explosion/spaCy,honnibal/spaCy,recognai/spaCy,explosion/spaCy,explosion/spaCy,aikramer2/spaCy,aikramer2/spaCy,recognai/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,recognai/spaCy,recognai/spaCy,spacy-io/spaCy,honnibal/spaCy,spacy-io/spaCy,spacy-io/spaCy,aikramer2/spaCy,spacy-io/spaCy,explosion/s... | spacy/tests/regression/test_issue768.py | spacy/tests/regression/test_issue768.py | # coding: utf-8
from __future__ import unicode_literals
from ...language import Language
from ...attrs import LANG
from ...fr.stop_words import STOP_WORDS
from ...fr.tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from ...language_data.punctuation import TOKENIZER_INFIXES, ALPHA
from ...util import update_exc
import... | # coding: utf-8
from __future__ import unicode_literals
from ...language import Language
from ...attrs import LANG
from ...fr.language_data import get_tokenizer_exceptions, STOP_WORDS
from ...language_data.punctuation import TOKENIZER_INFIXES, ALPHA
import pytest
@pytest.fixture
def fr_tokenizer_w_infix():
SPLI... | mit | Python |
ffa96dbc431628218dec604d59bb80511af40751 | Fix readline detection bug in OSX. | ipython/ipython,ipython/ipython | IPython/utils/rlineimpl.py | IPython/utils/rlineimpl.py | # -*- coding: utf-8 -*-
""" Imports and provides the 'correct' version of readline for the platform.
Readline is used throughout IPython as::
import IPython.utils.rlineimpl as readline
In addition to normal readline stuff, this module provides have_readline
boolean and _outputfile variable used in IPython.utils.... | # -*- coding: utf-8 -*-
""" Imports and provides the 'correct' version of readline for the platform.
Readline is used throughout IPython as::
import IPython.utils.rlineimpl as readline
In addition to normal readline stuff, this module provides have_readline
boolean and _outputfile variable used in IPython.utils.... | bsd-3-clause | Python |
67a167a225e8c5c9183ae0baf5d88eb7c0ee120e | Use SSL by default for contentfiles | blancltd/blanc-contentfiles | contentfiles/storage.py | contentfiles/storage.py | from __future__ import unicode_literals
import os
from django.conf import settings
from django.core.files.storage import DefaultStorage
from django.utils.six.moves import urllib
from storages.backends.s3boto import S3BotoStorage
CONTENTFILES_SSL = getattr(settings, 'CONTENTFILES_SSL', True)
CONTENTFILES_PREFIX = g... | from __future__ import unicode_literals
import os
from django.conf import settings
from django.core.files.storage import DefaultStorage
from django.utils.six.moves import urllib
from storages.backends.s3boto import S3BotoStorage
CONTENTFILES_SSL = getattr(settings, 'CONTENTFILES_SSL', False)
CONTENTFILES_PREFIX = ... | bsd-3-clause | Python |
cdbb1d6c3079f79dad785651cc18dbb568997c30 | Add bgp, trunk, flow_classifier, and sfc to supported API extensions | openstack/dragonflow,openstack/dragonflow,openstack/dragonflow | dragonflow/common/extensions.py | dragonflow/common/extensions.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
# ... | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | apache-2.0 | Python |
99ef8377b5bf540542efe718a4eb4345a4b4d5a4 | Add UniqueMixin import to init | Brogency/drf-writable-nested | drf_writable_nested/__init__.py | drf_writable_nested/__init__.py | __title__ = 'DRF writable nested'
__version__ = '0.4.3'
__author__ = 'beda.software'
__license__ = 'BSD 2-Clause'
__copyright__ = 'Copyright 2014-2018 beda.software'
# Version synonym
VERSION = __version__
from .mixins import NestedUpdateMixin, NestedCreateMixin, UniqueFieldsMixin
from .serializers import WritableNe... | __title__ = 'DRF writable nested'
__version__ = '0.4.3'
__author__ = 'beda.software'
__license__ = 'BSD 2-Clause'
__copyright__ = 'Copyright 2014-2018 beda.software'
# Version synonym
VERSION = __version__
from .mixins import NestedUpdateMixin, NestedCreateMixin
from .serializers import WritableNestedModelSerializer... | bsd-2-clause | Python |
d07a5e710d4671645226761b398a15c3c537a31c | fix cells returned path | rlowrance/re-local-linear,rlowrance/re-local-linear,rlowrance/re-local-linear | directory.py | directory.py | def directory(name):
'''Return path to specified directory in file system.
Parameters
----------
name : string
name of the directory, one of cells, input, log, working
Returns
-------
string: path to the named directory, ending with a "/"
'''
root = '../'
if name == 'cel... | def directory(name):
'''Return path to specified directory in file system.
Parameters
----------
name : string
name of the directory, one of cells, input, log, working
Returns
-------
string: path to the named directory, ending with a "/"
'''
root = '../'
if name == 'cel... | mit | Python |
e036a2e2f1edabd1f7bfce2b7b25b3fdf2a106cc | Remove the deprecated, now no-op, "data" transition. | bazelbuild/rules_swift,bazelbuild/rules_swift | swift/internal/attrs.bzl | swift/internal/attrs.bzl | # Copyright 2018 The Bazel 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 applicable la... | # Copyright 2018 The Bazel 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 applicable la... | apache-2.0 | Python |
6e897689d8c4e3196c9e9dd799a40306b32e09b8 | Use BeautifulSoup's native ability to select links and images | mreid-moz/jupyter-spark,mreid-moz/jupyter-spark | jupyter_spark/spark.py | jupyter_spark/spark.py | import json
import requests
import tornado
from bs4 import BeautifulSoup
from notebook.utils import url_path_join
from notebook.base.handlers import IPythonHandler
def raise_error(msg):
raise tornado.web.HTTPError(500, 'ERROR: ' + msg)
class SparkHandler(IPythonHandler):
def initialize(self, host, url, p... | import json
import requests
import tornado
from bs4 import BeautifulSoup
from notebook.utils import url_path_join
from notebook.base.handlers import IPythonHandler
def raise_error(msg):
raise tornado.web.HTTPError(500, 'ERROR: ' + msg)
class SparkHandler(IPythonHandler):
def initialize(self, host, url, p... | mpl-2.0 | Python |
0d8e779f0bed5fd0f75b2960b89001ec72503dea | Add function to load config from file | atillamas/ircbot | ircbot.py | ircbot.py | #!/usr/bin/env python2
import socket
import os
import sys
import yaml
import datetime
class IRCbot:
def __init__(self):
''' Initialize instance'''
self.irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
config = load_config("./ircbot.config")
self.channel = config['channel']
... | #!/usr/bin/env python2
import socket
import os
import sys
import yaml
import datetime
class IRCbot:
def __init__(self):
''' Initialize instance'''
self.irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
config = yaml.safe_load(open("./ircbot.config"))
self.channel = config['c... | mit | Python |
09e7f34c15751d050af542b5c87a114cfd02b1ae | Fix entry points, dependencies. | alephmelo/watchman | watchman/__init__.py | watchman/__init__.py | """ watchman: version control status management made easy."""
__version__ = '0.0.2'
__author__ = 'Aleph Melo'
| """ watchman: version control status management made easy."""
__version__ = '0.0.1'
__author__ = 'Aleph Melo'
| mit | Python |
a2b8a38016fcf8a491cabc17a95083ae8bab0ad4 | Revert last commit in base.utils.urls | obimod/taiga-back,EvgeneOskin/taiga-back,EvgeneOskin/taiga-back,coopsource/taiga-back,Zaneh-/bearded-tribble-back,dayatz/taiga-back,obimod/taiga-back,CoolCloud/taiga-back,19kestier/taiga-back,rajiteh/taiga-back,bdang2012/taiga-back-casting,Tigerwhit4/taiga-back,forging2012/taiga-back,Zaneh-/bearded-tribble-back,astagi/... | taiga/base/utils/urls.py | taiga/base/utils/urls.py | import django_sites as sites
URL_TEMPLATE = "{scheme}://{domain}/{path}"
def build_url(path, scheme="http", domain="localhost"):
return URL_TEMPLATE.format(scheme=scheme, domain=domain, path=path.lstrip("/"))
def is_absolute_url(path):
"""Test wether or not `path` is absolute url."""
return path.starts... | import django_sites as sites
URL_TEMPLATE = "{scheme}://{domain}/{path}"
def build_url(path, scheme="http", domain="localhost"):
return URL_TEMPLATE.format(scheme=scheme, domain=domain, path=path.lstrip("/"))
def is_absolute_url(path):
"""Test wether or not `path` is absolute url."""
return path.starts... | agpl-3.0 | Python |
d6bf0f6bfa27a18bc90538af88463cb12627be5b | update to simulation helpers for demonstrator | DiCarloLab-Delft/PycQED_py3,QudevETH/PycQED_py3,DiCarloLab-Delft/PycQED_py3,DiCarloLab-Delft/PycQED_py3 | pycqed/measurement/demonstrator_helper/detectors.py | pycqed/measurement/demonstrator_helper/detectors.py | import numpy as np
import time
from pycqed.measurement.detector_functions import Detector_Function, Hard_Detector
import quantumsim.qasm
from quantumsim import sparsedm as sdm
class AllXYDetector(Detector_Function):
def __init__(self, noise=0, delay=0, **kw):
self.name = "AllXYDetector"
self.value... | import numpy as np
import time
from pycqed.measurement.detector_functions import Detector_Function, Hard_Detector
import quantumsim.qasm
from quantumsim import sparsedm as sdm
class AllXYDetector(Detector_Function):
def __init__(self, noise=0, delay=0, **kw):
self.name = "AllXYDetector"
self.value... | mit | Python |
e81d21c18c619fbdbab46f1c06d3805087f039c3 | correct argument 'ac_schema' | ssato/python-anyconfig,ssato/python-anyconfig | tests/api/load/single_load/test_schema.py | tests/api/load/single_load/test_schema.py | #
# Copyright (C) 2012 - 2021 Satoru SATOH <satoru.satoh@gmail.com>
# License: MIT
#
# pylint: disable=missing-docstring
import pathlib
import tempfile
import unittest
import anyconfig.api._load as TT
import anyconfig.schema
from anyconfig.api import ValidationError
from .common import BaseTestCase
SCM_NG_0 = '{"t... | #
# Copyright (C) 2012 - 2021 Satoru SATOH <satoru.satoh@gmail.com>
# License: MIT
#
# pylint: disable=missing-docstring
import pathlib
import tempfile
import unittest
import anyconfig.api._load as TT
import anyconfig.schema
from anyconfig.api import ValidationError
from .common import BaseTestCase
SCM_NG_0 = '{"t... | mit | Python |
6d22d09bd67a51f78e9d04c99bebf15cddceaafa | copy the logo into the staticfiles dir too | appsembler/edx-microsite-manager,jazkarta/edx-microsite-manager | edx_microsite_manager/models.py | edx_microsite_manager/models.py | from django.conf import settings
from django.db import models
import json
import os
class Microsite(models.Model):
domain_prefix = models.CharField(max_length=100)
site_title = models.CharField(max_length=255)
logo = models.ImageField(upload_to='microsites/logos')
def __unicode__(self):
retur... | from django.conf import settings
from django.db import models
import json
import os
class Microsite(models.Model):
domain_prefix = models.CharField(max_length=100)
site_title = models.CharField(max_length=255)
logo = models.ImageField(upload_to='microsites/logos')
def __unicode__(self):
retur... | agpl-3.0 | Python |
7f587b554291c99702d7afe2b225b933cab78182 | Update check spec with command key | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | tests/scoring_engine/models/test_check.py | tests/scoring_engine/models/test_check.py | import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../'))
from scoring_engine.models.check import Check
from scoring_engine.models.round import Round
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../'))
from helpers import generate_sample_m... | import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../'))
from scoring_engine.models.check import Check
from scoring_engine.models.round import Round
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../'))
from helpers import generate_sample_m... | mit | Python |
d9577df90bd01a21e854fb7a5bb1ff8ee198f91a | change from strong to basic protection | hack4impact/flask-base,hack4impact/flask-base,hack4impact/flask-base | app/__init__.py | app/__init__.py | import os
from flask import Flask
from flask_assets import Environment
from flask_compress import Compress
from flask_login import LoginManager
from flask_mail import Mail
from flask_rq import RQ
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import CSRFProtect
from app.assets import app_css, app_js, vendor_c... | import os
from flask import Flask
from flask_assets import Environment
from flask_compress import Compress
from flask_login import LoginManager
from flask_mail import Mail
from flask_rq import RQ
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import CSRFProtect
from app.assets import app_css, app_js, vendor_c... | mit | Python |
75c10791d4a01958391a0d0b3fde4f36f3ed45bd | fix ie location implementation | jaredly/pyjamas,jaredly/pyjamas,jaredly/pyjamas,jaredly/pyjamas | library/__ie6__/pyjamas/Location.py | library/__ie6__/pyjamas/Location.py |
class Location:
def getHash(self):
return JS('unescape(self.location.hash)')
def getSearch(self):
return JS('unescape(self.location.search)')
|
class Location:
def getHash(self):
return unescape(self.location.hash)
def getSearch(self):
return unescape(self.location.search)
| apache-2.0 | Python |
cd19c81d88df3fa390b45158d78b52fcb57394e4 | Add permission checks for manual_action endpoint and validate inputs accepted | garbas/mozilla-releng-services,Callek/build-relengapi,garbas/mozilla-releng-services,La0/mozilla-relengapi,djmitche/build-relengapi,mozilla/build-relengapi,Callek/build-relengapi-slaveloan,lundjordan/services,Callek/build-relengapi-slaveloan,Callek/build-relengapi,lundjordan/services,andrei987/services,La0/mozilla-rele... | relengapi/blueprints/slaveloan/tests/test_slaveloan.py | relengapi/blueprints/slaveloan/tests/test_slaveloan.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from nose.tools import eq_
from relengapi.lib import auth
from relengapi.lib.permissions import p
from relengapi.lib.tes... | # 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/.
from nose.tools import eq_
from relengapi.lib import auth
from relengapi.lib.permissions import p
from relengapi.lib.tes... | mpl-2.0 | Python |
8a9be900a9a06cb3f5ef7e5e1faa8ad6f954297e | add extra imports for pyjamas.logging | minghuascode/pyj,minghuascode/pyj,minghuascode/pyj,minghuascode/pyj | library/pyjamas/logging/__init__.py | library/pyjamas/logging/__init__.py | """Logging module for Pyjamas, mimicking CPython's logging module.
Usage example:
from pyjamas import logging
log = logging.getConsoleLogger()
log.debug('This is a debug message')
"""
__author__ = 'Peter Bittner <peter.bittner@gmx.net>'
from pyjamas.logging.handlers import \
AlertHandler, AppendHandle... | """Logging module for Pyjamas, mimicking CPython's logging module.
Usage example:
from pyjamas import logging
log = logging.getConsoleLogger()
log.debug('This is a debug message')
"""
__author__ = 'Peter Bittner <peter.bittner@gmx.net>'
from pyjamas.logging.handlers import \
AlertHandler, AppendHandle... | apache-2.0 | Python |
116fa6ba156d51d85aca6b7ec3c30f1857926551 | Add CourseRun to admin (#2194) | mitodl/open-discussions,mitodl/open-discussions,mitodl/open-discussions,mitodl/open-discussions,mitodl/open-discussions | course_catalog/admin.py | course_catalog/admin.py | """ admin for course catalog """
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from course_catalog.models import (
Course,
Bootcamp,
Program,
UserList,
ProgramItem,
UserListItem,
CourseRun,
)
class CourseRunAdmin(admin.ModelAdmin):
... | """ admin for course catalog """
from django.contrib import admin
from course_catalog.models import (
Course,
Bootcamp,
Program,
UserList,
ProgramItem,
UserListItem,
)
class CourseAdmin(admin.ModelAdmin):
"""Course Admin"""
model = Course
search_fields = ("course_id", "title")
... | bsd-3-clause | Python |
19ec4ae0b272caef30f7c0ffcb923f1e58d7a687 | add end of line to example file | MassimoCimmino/pygfunction | pygfunction/examples/custom_borehole.py | pygfunction/examples/custom_borehole.py | # -*- coding: utf-8 -*-
""" Example of definition of a bore field using custom borehole positions.
"""
from __future__ import absolute_import, division, print_function
import pygfunction as gt
def main():
a = 1
if __name__ == '__main__':
main()
| # -*- coding: utf-8 -*-
""" Example of definition of a bore field using custom borehole positions.
"""
from __future__ import absolute_import, division, print_function
import pygfunction as gt
def main():
a = 1
if __name__ == '__main__':
main() | bsd-3-clause | Python |
b803140b0474ab75f38a4d510feb3b0355414306 | Fix vulnerability_ticket sample plugin. | dafrito/trac-mirror,moreati/trac-gitsvn,dokipen/trac,dafrito/trac-mirror,moreati/trac-gitsvn,moreati/trac-gitsvn,dafrito/trac-mirror,moreati/trac-gitsvn,exocad/exotrac,dafrito/trac-mirror,exocad/exotrac,exocad/exotrac,dokipen/trac,dokipen/trac,exocad/exotrac | sample-plugins/permissions/vulnerability_tickets.py | sample-plugins/permissions/vulnerability_tickets.py | from trac.core import *
from trac.perm import IPermissionPolicy, IPermissionRequestor
revision = "$Rev$"
url = "$URL$"
class SecurityTicketsPolicy(Component):
"""Prevent public access to security sensitive tickets.
Add the VULNERABILITY_VIEW permission as a pre-requisite for any
other permission chec... | from trac.core import *
from trac.perm import IPermissionPolicy, IPermissionRequestor
revision = "$Rev$"
url = "$URL$"
class SecurityTicketsPolicy(Component):
"""Prevent public access to security sensitive tickets.
Add the VULNERABILITY_VIEW permission as a pre-requisite for any
other permission chec... | bsd-3-clause | Python |
00881f0c42ccdd8df2415df7022244b4adb66e61 | use aboslute path in settings | dannyroberts/couchpulse | couchpulse/settings.py | couchpulse/settings.py | from ConfigParser import ConfigParser
import os
_parser = ConfigParser()
_filepath = os.path.join(
os.path.dirname(__file__),
'..',
'alembic.ini'
)
print _filepath
_parser.read(_filepath)
SQLALCHEMY_URL = _parser.get('alembic', 'sqlalchemy.url')
| from ConfigParser import ConfigParser
_parser = ConfigParser()
_parser.read('alembic.ini')
SQLALCHEMY_URL = _parser.get('alembic', 'sqlalchemy.url')
| mit | Python |
b994f74c65e100ccb313e683a4513fa276d80645 | Remove a setting that's no longer used in SATCHMO_SETTINGS. It has been moved to L10n. | Ryati/satchmo,ringemup/satchmo,ringemup/satchmo,twidi/satchmo,dokterbob/satchmo,twidi/satchmo,dokterbob/satchmo,Ryati/satchmo | satchmo/apps/satchmo_store/shop/satchmo_settings.py | satchmo/apps/satchmo_store/shop/satchmo_settings.py | """A central mechanism for shop-wide settings which have defaults.
Repurposed from Sphene Community Tools: http://sct.sphene.net
"""
from django.conf import settings
satchmo_settings_defaults = {
# Only settings for core `satchmo` applications are defined here,
# (or global settings) -- all other defaults sh... | """A central mechanism for shop-wide settings which have defaults.
Repurposed from Sphene Community Tools: http://sct.sphene.net
"""
from django.conf import settings
satchmo_settings_defaults = {
# Only settings for core `satchmo` applications are defined here,
# (or global settings) -- all other defaults sh... | bsd-3-clause | Python |
1e5bce8e34e834a607ff58666fdd88aa1e30d0cd | increment version due to user interrupt change | mujin/mujincontrollerclientpy | python/mujincontrollerclient/version.py | python/mujincontrollerclient/version.py | __version__ = '0.3.3'
| __version__ = '0.3.2'
| apache-2.0 | Python |
41dc0902d5d9b36e8081f95355863f3e0b02246d | Test gArgs erroring on unknown args | DigitalPandacoin/pandacoin,peercoin/peercoin,DigitalPandacoin/pandacoin,peercoin/peercoin,peercoin/peercoin,peercoin/peercoin,DigitalPandacoin/pandacoin,DigitalPandacoin/pandacoin,peercoin/peercoin,DigitalPandacoin/pandacoin,DigitalPandacoin/pandacoin,peercoin/peercoin | test/functional/feature_help.py | test/functional/feature_help.py | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Verify that starting bitcoin with -h works as expected."""
import subprocess
from test_framework.test_frame... | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Verify that starting bitcoin with -h works as expected."""
import subprocess
from test_framework.test_frame... | mit | Python |
41b10cf61135eda6425847c50f10faaca77361b7 | test the separator= argument | yiannist/ganeti,leshchevds/ganeti,apyrgio/snf-ganeti,andir/ganeti,ganeti/ganeti,ganeti-github-testing/ganeti-test-1,ganeti-github-testing/ganeti-test-1,ganeti/ganeti,yiannist/ganeti,dimara/ganeti,leshchevds/ganeti,grnet/snf-ganeti,mbakke/ganeti,andir/ganeti,onponomarev/ganeti,apyrgio/ganeti,dimara/ganeti,onponomarev/ga... | test/ganeti.uidpool_unittest.py | test/ganeti.uidpool_unittest.py | #!/usr/bin/python
#
# Copyright (C) 2010 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program... | #!/usr/bin/python
#
# Copyright (C) 2010 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program... | bsd-2-clause | Python |
520479d33ce508ef531f8c9dd4a981d79e35da9c | handle the case where a package has no downloads | crateio/crate.web,crateio/crate.web | crate_project/apps/packages/stats/views.py | crate_project/apps/packages/stats/views.py | import collections
import json
import time
import isoweek
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from packages.models import Package, Release, DownloadDelta, DownloadStatsCache
def fetch_stats(package):
releases = Release.objects.filter(package=package)
releases... | import collections
import json
import time
import isoweek
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from packages.models import Package, Release, DownloadDelta, DownloadStatsCache
def fetch_stats(package):
releases = Release.objects.filter(package=package)
releases... | bsd-2-clause | Python |
dedf620bba97541505790b6b3f66468113e9488f | Add a hack for fixing failing tests | MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS | server/tests/base.py | server/tests/base.py | import tempfile
import unittest
import os
from server import app
from server.models import db
class BaseTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, self.test_db_path = tempfile.mkstemp('.db')
# test_db_uri = 'sqlite:///{}'.format(self.test_db_path)
# app.config['SQLALCHEMY_D... | import tempfile
import unittest
import os
from server import app
from server.models import db
class BaseTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, self.test_db_path = tempfile.mkstemp('.db')
test_db_uri = 'sqlite:///{}'.format(self.test_db_path)
app.config['SQLALCHEMY_DATAB... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.