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 |
|---|---|---|---|---|---|---|---|---|
802926f151d9a1337c2a07adbc485b6193e91733 | Add template string calling to the state module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/state.py | salt/modules/state.py | '''
Control the state system on the minion
'''
# Import Python modules
import os
# Import salt modules
import salt.state
def low(data):
'''
Execute a single low data call
'''
st_ = salt.state.State(__opts__)
err = st_.verify_data(data)
if err:
return err
return st_.call(data)
def ... | '''
Control the state system on the minion
'''
# Import Python modules
import os
# Import salt modules
import salt.state
def low(data):
'''
Execute a single low data call
'''
st_ = salt.state.State(__opts__)
err = st_.verify_data(data)
if err:
return err
return st_.call(data)
def ... | apache-2.0 | Python |
ac8d29c5855ea05bd42766cd142808704aded867 | Add space to trigger travis | masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api | web/impact/impact/permissions/graphql_permissions.py | web/impact/impact/permissions/graphql_permissions.py | from accelerator.models import (
UserRole,
)
from accelerator_abstract.models.base_user_utils import is_employee
from accelerator.models import ACTIVE_PROGRAM_STATUS
BASIC_ALLOWED_USER_ROLES = [
UserRole.FINALIST,
UserRole.AIR,
UserRole.MENTOR,
UserRole.PARTNER,
UserRole.ALUM
]
BASIC_VISIBLE_U... | from accelerator.models import (
UserRole,
)
from accelerator_abstract.models.base_user_utils import is_employee
from accelerator.models import ACTIVE_PROGRAM_STATUS
BASIC_ALLOWED_USER_ROLES = [
UserRole.FINALIST,
UserRole.AIR,
UserRole.MENTOR,
UserRole.PARTNER,
UserRole.ALUM
]
BASIC_VISIBLE_U... | mit | Python |
7ad6da17a72010967ccd82d3393a86762cf2a786 | Mark import-std-module/empty-module as libc++ test | llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb | packages/Python/lldbsuite/test/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py | packages/Python/lldbsuite/test/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py | """
Test that LLDB doesn't crash if the std module we load is empty.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import os
class ImportStdModule(TestBase):
mydir = TestBase.compute_mydir(__file__)
# We only emulate a fake libc++ in th... | """
Test that LLDB doesn't crash if the std module we load is empty.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import os
class ImportStdModule(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(compiler=no_match("clang"))
... | apache-2.0 | Python |
973a7754623c330f0352979bf9e0f2a6020acf62 | reformat >80 char import line | Tendrl/commons | tendrl/commons/tests/objects/cluster/atoms/check_cluster_available/test_check_cluster_available_init.py | tendrl/commons/tests/objects/cluster/atoms/check_cluster_available/test_check_cluster_available_init.py | import etcd
import maps
import pytest
from tendrl.commons.objects.cluster.atoms.check_cluster_available import \
CheckClusterAvailable
from tendrl.commons.objects import AtomExecutionFailedError
class MockCluster(object):
def __init__(self, integration_id = 0):
self.is_managed = True
def load(self... | import etcd
import maps
import pytest
from tendrl.commons.objects.cluster.atoms.check_cluster_available import CheckClusterAvailable # noqa
from tendrl.commons.objects import AtomExecutionFailedError
class MockCluster(object):
def __init__(self, integration_id = 0):
self.is_managed = True
def load(se... | lgpl-2.1 | Python |
eea0c4fd610882ee748410063a62c30ce95da0ee | Fix the snapshot creation script for the new command line syntax. Review URL: http://codereview.chromium.org//8414015 | dartino/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-archive/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-archive/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-... | runtime/tools/create_snapshot_file.py | runtime/tools/create_snapshot_file.py | #!/usr/bin/env python
#
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Script to create snapshot files.
import getopt
import optparse
import string
im... | #!/usr/bin/env python
#
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Script to create snapshot files.
import getopt
import optparse
import string
im... | bsd-3-clause | Python |
788073cdf2a5e2ee142cbcf1263accad7baac153 | Move chmod | hatchery/genepool,hatchery/Genepool2 | genes/gnu_coreutils/commands.py | genes/gnu_coreutils/commands.py | #!/usr/bin/env python
from genes.posix.traits import only_posix
from genes.process.commands import run
@only_posix()
def chgrp(path, group):
run(['chgrp', group, path])
@only_posix()
def chown(path, user):
run(['chown', user, path])
@only_posix()
def chmod(*args):
# FIXME: this is ugly, name the ... | #!/usr/bin/env python
from genes.posix.traits import only_posix
from genes.process.commands import run
@only_posix()
def chgrp(path, group):
run(['chgrp', group, path])
@only_posix()
def chown(path, user):
run(['chown', user, path])
@only_posix()
def groupadd(*args):
run(['groupadd'] + list(args))
... | mit | Python |
394954fc80230e01112166db4fe133c107febead | Allow more than one GitHub repo from the same user | evoja/docker-Github-Gitlab-Auto-Deploy,evoja/docker-Github-Gitlab-Auto-Deploy | gitautodeploy/parsers/common.py | gitautodeploy/parsers/common.py |
class WebhookRequestParser(object):
"""Abstract parent class for git service parsers. Contains helper
methods."""
def __init__(self, config):
self._config = config
def get_matching_repo_configs(self, urls):
"""Iterates over the various repo URLs provided as argument (git://,
s... |
class WebhookRequestParser(object):
"""Abstract parent class for git service parsers. Contains helper
methods."""
def __init__(self, config):
self._config = config
def get_matching_repo_configs(self, urls):
"""Iterates over the various repo URLs provided as argument (git://,
s... | mit | Python |
d4fed426153105a9f8cab595848d5303003449b8 | revert last commit, import properly | Naught0/qtbot | cogs/games.py | cogs/games.py | import discord
import json
from discord.ext import commands
from datetime import datetime
from utils import aiohttp_wrap as aw
class Game:
""" Cog which allows fetching of video game information """
IG_URL = 'https://api-2445582011268.apicast.io/{}/'
with open('data/apikeys.json') as f:
KEY = ... | import discord
from discord.ext import commands
from datetime import datetime
from utils import aiohttp_wrap as aw
class Game:
""" Cog which allows fetching of video game information """
IG_URL = 'https://api-2445582011268.apicast.io/{}/'
with open('data/apikeys.json') as f:
KEY = json.load(f)... | mit | Python |
7adeb5e668a132ab540fa45c8e6c62cb8481930d | fix infinite recursion | qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | fluff/sync_couchdb.py | fluff/sync_couchdb.py | from django.db.models import signals
import os
from couchdbkit.ext.django.loading import get_db
from pillowtop.utils import import_pillows
from dimagi.utils.couch import sync_docs
FLUFF = 'fluff'
def sync_design_docs(temp=None):
dir = os.path.abspath(os.path.dirname(__file__))
for pillow in import_pillows(i... | from django.db.models import signals
import os
from couchdbkit.ext.django.loading import get_db
from pillowtop.utils import import_pillows
from dimagi.utils.couch.sync_docs import sync_design_docs as sync_docs
FLUFF = 'fluff'
def sync_design_docs(temp=None):
dir = os.path.abspath(os.path.dirname(__file__))
... | bsd-3-clause | Python |
9cc7218f2eef7135e5402a47c2783def31add9f3 | save screenshot in 800x480 too | michaelcontento/monkey-shovel | screenshots.py | screenshots.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, with_statement
from PIL import Image, ImageFile
from shovel import task
from meta.utils import path_meta, path_generated, depends
ImageFile.MAXBLOCK = 2**20
def save(image, filename):
image.save(filename, "JPEG", quality=98, optimize=Tru... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, with_statement
from PIL import Image, ImageFile
from shovel import task
from meta.utils import path_meta, path_generated, depends
ImageFile.MAXBLOCK = 2**20
def save(image, filename):
image.save(filename, "JPEG", quality=98, optimize=Tru... | apache-2.0 | Python |
bcb1c8d48532159f76708bdfd0e6868dbda92343 | make sure command processes run in test database when needed | frePPLe/frePPLe,frePPLe/frePPLe,frePPLe/frePPLe,frePPLe/frePPLe,frePPLe/frePPLe,frePPLe/frePPLe | freppledb/__init__.py | freppledb/__init__.py | r'''
A Django project implementing a web-based user interface for frePPLe.
'''
VERSION = '4.5.0'
def runCommand(taskname, *args, **kwargs):
'''
Auxilary method to run a django command. It is intended to be used
as a target for the multiprocessing module.
The code is put here, such that a child process load... | r'''
A Django project implementing a web-based user interface for frePPLe.
'''
VERSION = '4.5.0'
def runCommand(taskname, *args, **kwargs):
'''
Auxilary method to run a django command. It is intended to be used
as a target for the multiprocessing module.
The code is put here, such that a child process load... | agpl-3.0 | Python |
720c841d0930f73d1efe90518b0a2d9dcbd6425d | Document context | gchrupala/funktional,kadarakos/funktional | funktional/context.py | funktional/context.py | import sys
from contextlib import contextmanager
# Are we training (or testing)
training = False
@contextmanager
def context(**kwargs):
"""Temporarily change the values of context variables passed.
Enables the `with` syntax:
>>> with context(training=True):
...
"""
current = dict((k, geta... | import sys
from contextlib import contextmanager
training = False
@contextmanager
def context(**kwargs):
current = dict((k, getattr(sys.modules[__name__], k)) for k in kwargs)
for k,v in kwargs.items():
setattr(sys.modules[__name__], k, v)
yield
for k,v in current.items():
setattr(sys... | mit | Python |
55987e48997f7f5a94adc3c53fcb8ae58e672c3c | increase version number | NCI-GDC/gdc-client,NCI-GDC/gdc-client | gdc_client/version.py | gdc_client/version.py | __version__ = 'v1.4.0'
| __version__ = 'v1.3.0'
| apache-2.0 | Python |
ed7f0e555b438b611f4a9b0fdf6de1fca6ec2914 | fix incorrect use of str replace | UC3Music/genSongbook,UC3Music-e/genSongbook,UC3Music/songbook-tools | genSongbook.py | genSongbook.py | #!/usr/bin/python
import sys, os
def query(question, default):
sys.stdout.write(question + " [" + default + "] ? ")
choice = raw_input()
if choice == '':
return default
return choice
if __name__ == '__main__':
print("----------------------")
print("Welcome to genSongbook")
print(... | #!/usr/bin/python
import sys, os
def query(question, default):
sys.stdout.write(question + " [" + default + "] ? ")
choice = raw_input()
if choice == '':
return default
return choice
if __name__ == '__main__':
print("----------------------")
print("Welcome to genSongbook")
print(... | unlicense | Python |
c7067fce8723f810ed48de6513c6f756d499d807 | add whitelist tags. | why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado | dp_tornado/helper/html.py | dp_tornado/helper/html.py | # -*- coding: utf-8 -*-
from dp_tornado.engine.helper import Helper as dpHelper
try:
# py 2.x
import HTMLParser
html_parser = HTMLParser.HTMLParser()
except:
# py 3.4-
try:
import html.parser
html_parser = html.parser.HTMLParser()
except:
# py 3.4+
import html... | # -*- coding: utf-8 -*-
from dp_tornado.engine.helper import Helper as dpHelper
try:
# py 2.x
import HTMLParser
html_parser = HTMLParser.HTMLParser()
except:
# py 3.4-
try:
import html.parser
html_parser = html.parser.HTMLParser()
except:
# py 3.4+
import html... | mit | Python |
ab6d09c93a9d43ffbf442880633170f5fc678edd | add verbose mode to print processing module | thaim/get_module | get_modules.py | get_modules.py | #!/usr/bin/env python3
import os
import sys
import requests
import yaml
import git
import svn.remote
import zipfile
import argparse
def get_modules(yml_file, dest, verbose):
f = open(yml_file)
for data in yaml.load(f):
if (not dest.endswith('/')):
dest = dest + '/'
if not 'version'... | #!/usr/bin/env python3
import os
import sys
import requests
import yaml
import git
import svn.remote
import zipfile
import argparse
def get_modules(yml_file, dest):
f = open(yml_file)
for data in yaml.load(f):
if (not dest.endswith('/')):
dest = dest + '/'
if not 'version' in data:... | mit | Python |
740cf4e1a25533b4d3279a17e23b1ff9f6c13006 | Update Watchers.py | possoumous/Watchers,possoumous/Watchers,possoumous/Watchers,possoumous/Watchers | examples/Watchers.py | examples/Watchers.py | from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open('stockstwits.com') # Navigate to the web page
self.assert_element('sentiment-tab') # Assert element on page
self.click('sentiment-tab') # Click element on page
... | Import openpyxl
from seleniumbase import BaseCase
los = []
url = 'https://stocktwits.com/symbol/'
workbook = openpyxl.load_workbook('Test.xlsx')
worksheet = workbook.get_sheet_by_name(name = 'Sheet1')
for col in worksheet['A']:
los.append(col.value)
los2 = []
print(los)
class MyTestClass(BaseCase):
#for i in ... | mit | Python |
3462a4755eac0ea74b9c90f867e769c47504c5bd | add license to top of __init__ in examples | cloudkick/cloudkick-py | examples/__init__.py | examples/__init__.py | # Licensed to the Cloudkick, Inc under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# libcloud.org licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file exc... | apache-2.0 | Python | |
87da5bcf5b11762605c60f57b3cb2019d458fcd3 | Set version to v2.1.0a3 | explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy | spacy/about.py | spacy/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__title__ = 'spacy-nightly'
__version__ = '2.1.0a3'
__summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython'... | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__title__ = 'spacy-nightly'
__version__ = '2.1.0a3.dev0'
__summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cy... | mit | Python |
939f7a9e91022c8dab5da13e9e3f738f6c25c524 | Update perception_obstacle_sender.py | msbeta/apollo,msbeta/apollo,msbeta/apollo,msbeta/apollo,msbeta/apollo,msbeta/apollo | modules/tools/record_analyzer/tools/perception_obstacle_sender.py | modules/tools/record_analyzer/tools/perception_obstacle_sender.py | #!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo 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 ... | #!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo 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 ... | apache-2.0 | Python |
203cba83527ed39cc478c4f0530e513c71f2a6ad | format date in title | matplotlib/basemap,guziy/basemap,guziy/basemap,matplotlib/basemap | examples/daynight.py | examples/daynight.py | import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from datetime import datetime
# example showing how to compute the day/night terminator and shade nightime
# areas on a map.
# miller projection
map = Basemap(projection='mill',lon_0=180)
# plot coastlines, draw label meridia... | import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from datetime import datetime
# example showing how to compute the day/night terminator and shade nightime
# areas on a map.
# miller projection
map = Basemap(projection='mill',lon_0=180)
# plot coastlines, draw label meridia... | mit | Python |
ddb0a5d3b684c96b8fe8c4678cdb5e018f1b3d7b | Revert last change. Just in case... | notapresent/rbm2m,notapresent/rbm2m | rbm2m/action/downloader.py | rbm2m/action/downloader.py | # -*- coding: utf-8 -*-
import urllib
import sys
import requests
from .debug import dump_exception
HOST = 'http://www.recordsbymail.com/'
GENRE_LIST_URL = '{host}browse.php'.format(host=HOST)
SEARCH_URL = '{host}search.php?genre={genre_slug}&format=LP&instock=1'
IMAGE_LIST_URL = '{host}php/getImageArray.php?item={r... | # -*- coding: utf-8 -*-
import urllib
import sys
import requests
from .debug import dump_exception
HOST = 'http://www.recordsbymail.com/'
GENRE_LIST_URL = '{host}browse.php'.format(host=HOST)
SEARCH_URL = '{host}search.php?genre={genre_slug}&instock=1'
IMAGE_LIST_URL = '{host}php/getImageArray.php?item={rec_id}'
TI... | apache-2.0 | Python |
480e55794c5f06129b8b2fb7ed02a787f70275e2 | add --silent option to update-toplist | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo/directory/management/commands/update-toplist.py | mygpo/directory/management/commands/update-toplist.py | from datetime import datetime
from optparse import make_option
from django.core.management.base import BaseCommand
from mygpo.core.models import Podcast, SubscriberData
from mygpo.users.models import PodcastUserState
from mygpo.utils import progress
from mygpo.decorators import repeat_on_conflict
class Command(Base... | from datetime import datetime
from django.core.management.base import BaseCommand
from mygpo.core.models import Podcast, SubscriberData
from mygpo.users.models import PodcastUserState
from mygpo.utils import progress
from mygpo.decorators import repeat_on_conflict
class Command(BaseCommand):
def handle(self, *... | agpl-3.0 | Python |
006e6b67af6cfb2cca214666ac48dc9fd2cc0339 | Update test values | jkitchin/scopus,scopus-api/scopus | scopus/tests/test_CitationOverview.py | scopus/tests/test_CitationOverview.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `CitationOverview` module."""
from collections import namedtuple
from nose.tools import assert_equal, assert_true
import scopus
co = scopus.CitationOverview("2-s2.0-84930616647", refresh=True,
start=2015, end=2018)
def test_a... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `CitationOverview` module."""
from collections import namedtuple
from nose.tools import assert_equal, assert_true
import scopus
co = scopus.CitationOverview("2-s2.0-84930616647", refresh=True,
start=2015, end=2017)
def test_a... | mit | Python |
4464b72eac2cc995a3276341f066bee30497d621 | Bump version to 1.1.0 for release | sirosen/globus-sdk-python,globus/globus-sdk-python,aaschaer/globus-sdk-python,globus/globus-sdk-python,globusonline/globus-sdk-python | globus_sdk/version.py | globus_sdk/version.py | # single source of truth for package version,
# see https://packaging.python.org/en/latest/single_source_version/
__version__ = "1.1.0"
| # single source of truth for package version,
# see https://packaging.python.org/en/latest/single_source_version/
__version__ = "1.0.0"
| apache-2.0 | Python |
bb9d1255548b46dc2ba7a85e26606b7dd4c926f3 | Update original "Hello, World!" parser to latest coding, plus runTests | pyparsing/pyparsing,pyparsing/pyparsing | examples/greeting.py | examples/greeting.py | # greeting.py
#
# Demonstration of the pyparsing module, on the prototypical "Hello, World!"
# example
#
# Copyright 2003, 2019 by Paul McGuire
#
import pyparsing as pp
# define grammar
greet = pp.Word(pp.alphas) + "," + pp.Word(pp.alphas) + pp.oneOf("! ? .")
# input string
hello = "Hello, World!"
# parse input stri... | # greeting.py
#
# Demonstration of the pyparsing module, on the prototypical "Hello, World!"
# example
#
# Copyright 2003, by Paul McGuire
#
from pyparsing import Word, alphas
# define grammar
greet = Word( alphas ) + "," + Word( alphas ) + "!"
# input string
hello = "Hello, World!"
# parse input stri... | mit | Python |
04d0bb1bf71ee3a17efbb4bb15bb808cc832f04b | Update examples.py | Slater-Victoroff/PyFuzz | examples/examples.py | examples/examples.py | from py_fuzz.generator import *
print random_language(language="russian")
print random_ascii(
seed="this is a test", randomization="byte_jitter",
mutation_rate=0.25
)
print random_regex(
length=20, regex="[a-zA-Z]"
)
print random_utf8(
min_length=10,
max_length=50
)
print random_bytes()
print ra... | from py_fuzz import *
print random_language(language="russian")
print random_ascii(
seed="this is a test", randomization="byte_jitter",
mutation_rate=0.25
)
print random_regex(
length=20, regex="[a-zA-Z]"
)
print random_utf8(
min_length=10,
max_length=50
)
print random_bytes()
print random_utf8(... | mit | Python |
bc6c3834cd8383f7e1f9e109f0413bb6015a92bf | Remove unneeded datetime from view | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/scheduler/views.py | go/scheduler/views.py | from django.views.generic import ListView
from go.scheduler.models import Task
class SchedulerListView(ListView):
paginate_by = 12
context_object_name = 'tasks'
template = 'scheduler/task_list.html'
def get_queryset(self):
return Task.objects.filter(
account_id=self.request.user_... | import datetime
from django.views.generic import ListView
from go.scheduler.models import Task
class SchedulerListView(ListView):
paginate_by = 12
context_object_name = 'tasks'
template = 'scheduler/task_list.html'
def get_queryset(self):
now = datetime.datetime.utcnow()
return Task.... | bsd-3-clause | Python |
654034d3a0c6ec4e023af6118d6e628336bc39dd | Upgrade to Python 3 | 16bytes/rpt2csv.py | rpt2csv.py | rpt2csv.py | import sys
import csv
import codecs
def convert(inputFile,outputFile):
"""
Convert a RPT file to a properly escaped CSV file
RPT files are usually sourced from old versions of Microsoft SQL Server Management Studio
RPT files are fixed width with column names on the first line, a second line with dashes and space... | import sys
import csv
def convert(inputFile,outputFile):
"""
Convert a RPT file to a properly escaped CSV file
RPT files are usually sourced from old versions of Microsoft SQL Server Management Studio
RPT files are fixed width with column names on the first line, a second line with dashes and spaces,
and then o... | mit | Python |
4d5edd17d7382108b90d3f60f2f11317da228603 | Add kafka start/stop script | wangyangjun/RealtimeStreamBenchmark,wangyangjun/RealtimeStreamBenchmark,wangyangjun/RealtimeStreamBenchmark,wangyangjun/RealtimeStreamBenchmark,wangyangjun/RealtimeStreamBenchmark,wangyangjun/StreamBench,wangyangjun/StreamBench,wangyangjun/StreamBench,wangyangjun/RealtimeStreamBenchmark,wangyangjun/StreamBench,wangyang... | script/kafkaServer.py | script/kafkaServer.py | #!/bin/python
from __future__ import print_function
import subprocess
import sys
import json
from util import appendline, get_ip_address
if __name__ == "__main__":
# start server one by one
if len(sys.argv) < 2 or sys.argv[1] not in ['start', 'stop']:
sys.stderr.write("Usage: python %s start or stop\n" % (sys.arg... | #!/bin/python
from __future__ import print_function
import subprocess
import sys
import json
from util import appendline, get_ip_address
if __name__ == "__main__":
# start server one by one
if len(sys.argv) < 2 or sys.argv[1] not in ['start', 'stop']:
sys.stderr.write("Usage: python %s start or stop\n" % (sys.arg... | apache-2.0 | Python |
ebfaf30fca157e83ea9e4bf33173221fc9525caf | Fix emplorrs demo salary db error | viewflow/django-material,viewflow/django-material,viewflow/django-material | demo/examples/employees/forms.py | demo/examples/employees/forms.py | from django import forms
from .models import Employee, DeptManager, Title, Salary
class ChangeManagerForm(forms.Form):
manager = forms.ModelChoiceField(queryset=Employee.objects.all()[:100])
def __init__(self, *args, **kwargs):
self.department = kwargs.pop('department')
super(ChangeManagerFo... | from datetime import date
from django import forms
from django.utils import timezone
from .models import Employee, DeptManager, Title, Salary
class ChangeManagerForm(forms.Form):
manager = forms.ModelChoiceField(queryset=Employee.objects.all()[:100])
def __init__(self, *args, **kwargs):
self.depart... | bsd-3-clause | Python |
06f78c21e6b7e3327244e89e90365169f4c32ea1 | Fix style issues raised by pep8. | myersjustinc/django-calaccess-campaign-browser,dwillis/django-calaccess-campaign-browser,myersjustinc/django-calaccess-campaign-browser,california-civic-data-coalition/django-calaccess-campaign-browser,dwillis/django-calaccess-campaign-browser,california-civic-data-coalition/django-calaccess-campaign-browser | calaccess_campaign_browser/api.py | calaccess_campaign_browser/api.py | from tastypie.resources import ModelResource, ALL
from .models import Filer, Filing
from .utils.serializer import CIRCustomSerializer
class FilerResource(ModelResource):
class Meta:
queryset = Filer.objects.all()
serializer = CIRCustomSerializer()
filtering = {'filer_id_raw': ALL}
... | from tastypie.resources import ModelResource, ALL
from .models import Filer, Filing
from .utils.serializer import CIRCustomSerializer
class FilerResource(ModelResource):
class Meta:
queryset = Filer.objects.all()
serializer = CIRCustomSerializer()
filtering = { 'filer_id_raw': ALL }
... | mit | Python |
a473b2cb9af95c1296ecae4d2138142f2be397ee | Add variant extension in example script | cihai/cihai,cihai/cihai-python,cihai/cihai | examples/variants.py | examples/variants.py | #!/usr/bin/env python
# -*- coding: utf8 - *-
from __future__ import print_function, unicode_literals
from cihai.bootstrap import bootstrap_unihan
from cihai.core import Cihai
def variant_list(unihan, field):
for char in unihan.with_fields(field):
print("Character: {}".format(char.char))
for var... | #!/usr/bin/env python
# -*- coding: utf8 - *-
from __future__ import print_function, unicode_literals
from cihai.bootstrap import bootstrap_unihan
from cihai.core import Cihai
def variant_list(unihan, field):
for char in unihan.with_fields(field):
print("Character: {}".format(char.char))
for var... | mit | Python |
eeebe264c4d873369f3d24b2e7b676e004eb6671 | Fix path bug in update_source. | yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD | neuroimaging/externals/pynifti/utils/update_source.py | neuroimaging/externals/pynifti/utils/update_source.py | #!/usr/bin/env python
"""Copy source files from pynifti git directory into nipy source directory.
We only want to copy the files necessary to build pynifti and the nifticlibs,
and use them within nipy. We will not copy docs, tests, etc...
Pynifti should be build before this script is run so swig generates the
wrappe... | #!/usr/bin/env python
"""Copy source files from pynifti git directory into nipy source directory.
We only want to copy the files necessary to build pynifti and the nifticlibs,
and use them within nipy. We will not copy docs, tests, etc...
Pynifti should be build before this script is run so swig generates the
wrappe... | bsd-3-clause | Python |
ccb6728111a3142830bd4b3fccb8a956002013f0 | Update example to remove upload, not relevant for plotly! | liquidinstruments/pymoku,benizl/pymoku | examples/plotly_datalogger.py | examples/plotly_datalogger.py | from pymoku import Moku, MokuException
from pymoku.instruments import *
import pymoku.plotly_support as pmp
import time, logging, traceback
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.INFO)
# Use Moku.get_by_serial() or get_by_name() if ... | from pymoku import Moku, MokuException
from pymoku.instruments import *
import pymoku.plotly_support as pmp
import time, logging, traceback
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.DEBUG)
# Use Moku.get_by_serial() or get_by_name() if... | mit | Python |
09bd40bc8d29fab157630d6411aa8316148a10d6 | Fix indentation bug | SPIhub/hummingbird,FXIhub/hummingbird,FXIhub/hummingbird | src/backend.py | src/backend.py | import os
import logging
import imp
import translation
#from mpi4py import MPI
class Backend(object):
def __init__(self, config_file):
if(config_file is None):
# Try to load an example configuration file
config_file = os.path.abspath(os.path.dirname(__file__)+
... | import os
import logging
import imp
import translation
#from mpi4py import MPI
class Backend(object):
def __init__(self, config_file):
if(config_file is None):
# Try to load an example configuration file
config_file = os.path.abspath(os.path.dirname(__file__)+
... | bsd-2-clause | Python |
2e5f5fc689ee55f32556be69dcbf0672ea7fdbed | change deprecation warning | nikitanovosibirsk/district42 | district42/json_schema/schema.py | district42/json_schema/schema.py | import warnings
from copy import deepcopy
from ..errors import DeclarationError
from .types import (Any, AnyOf, Array, ArrayOf, Boolean, Enum, Null, Number,
Object, OneOf, SchemaType, String, Timestamp, Undefined)
class Schema:
def ref(self, schema):
return deepcopy(schema)
def ... | import warnings
from copy import deepcopy
from ..errors import DeclarationError
from .types import (Any, AnyOf, Array, ArrayOf, Boolean, Enum, Null, Number,
Object, OneOf, SchemaType, String, Timestamp, Undefined)
class Schema:
def ref(self, schema):
return deepcopy(schema)
def ... | apache-2.0 | Python |
a0e1183d9da98dd9f79c496b055cab0bb2638532 | Update h_RNN | carefree0910/MachineLearning | h_RNN/Mnist.py | h_RNN/Mnist.py | import os
import sys
root_path = os.path.abspath("../")
if root_path not in sys.path:
sys.path.append(root_path)
import time
import numpy as np
import tensorflow as tf
from h_RNN.RNN import RNNWrapper, Generator
from h_RNN.SpRNN import SparseRNN
from Util.Util import DataUtil
class MnistGenerator... | import time
import tflearn
import numpy as np
import tensorflow as tf
from h_RNN.RNN import RNNWrapper, Generator
from h_RNN.SpRNN import SparseRNN
from Util.Util import DataUtil
class MnistGenerator(Generator):
def __init__(self, im=None, om=None, one_hot=True):
super(MnistGenerator, self)._... | mit | Python |
b9cc76d410ca034918c615402e3fbe82b226859e | Add public address validation test. | joeyespo/path-and-address | path_and_address/tests/test_validation.py | path_and_address/tests/test_validation.py | from itertools import product
from ..validation import valid_address, valid_hostname, valid_port
def _join(host_and_port):
return '%s:%s' % host_and_port
def _join_all(hostnames, ports):
return map(_join, product(hostnames, ports))
hostnames = [
'0.0.0.0',
'127.0.0.1',
'localhost',
'exampl... | from itertools import product
from ..validation import valid_address, valid_hostname, valid_port
def _join(host_and_port):
return '%s:%s' % host_and_port
def _join_all(hostnames, ports):
return map(_join, product(hostnames, ports))
hostnames = [
'127.0.0.1',
'localhost',
'example.com',
'ex... | mit | Python |
fd7454610f4cffcfc8c289539b3824f023fe973f | change cruise input dim | msbeta/apollo,msbeta/apollo,msbeta/apollo,msbeta/apollo,msbeta/apollo,msbeta/apollo | modules/tools/prediction/mlp_train/common/configure.py | modules/tools/prediction/mlp_train/common/configure.py | #!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo 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 ... | #!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo 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 ... | apache-2.0 | Python |
8092efdd0bf5f5ca8d5498cf679b019920c00bfd | format with black | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | plugins/feeds/public/virustotal_apiv3.py | plugins/feeds/public/virustotal_apiv3.py | import logging
import re
import json
from datetime import timedelta, datetime
from core import Feed
from core.config.config import yeti_config
from core.observables import Hash, File
# Variable
VTAPI = yeti_config.get("vt", "key")
headers = {"x-apikey": VTAPI}
limit = 10
params = {"limit": limit}
regex = "[A-Fa-f0-9]... | import logging
import re
import json
from datetime import timedelta, datetime
from core import Feed
from core.config.config import yeti_config
from core.observables import Hash, File
# Variable
VTAPI = yeti_config.get('vt', 'key')
headers = {"x-apikey": VTAPI}
limit = 10
params = {'limit': limit}
regex = "[A-Fa-f0-9]... | apache-2.0 | Python |
51a9a02ccf4a133818f14f3ff6e864c1e041ec37 | Update event_chat.py | f4ble/pyarc,f4ble/Arkon | ark/events/event_chat.py | ark/events/event_chat.py | from ark.chat_commands import ChatCommands
from ark.cli import *
from ark.database import Db
from ark.rcon import Rcon
class EventChat(object):
@classmethod
def output_chat_from_server(cls,text,line):
out(line)
@classmethod
def parse_chat_command(cls,steam_name,player_name,text,line):
... | from ark.chat_commands import ChatCommands
from ark.cli import *
from ark.database import Db
from ark.rcon import Rcon
class EventChat(object):
@classmethod
def output_chat_from_server(cls,text,line):
out(line)
@classmethod
def parse_chat_command(cls,steam_name,player_name,text,line):
... | apache-2.0 | Python |
e236b7d34cdf156cc16ba8c95b0526785e717898 | update scenario | pkimber/enquiry,pkimber/enquiry,pkimber/enquiry | enquiry/tests/scenario.py | enquiry/tests/scenario.py | from datetime import datetime
from dateutil.relativedelta import relativedelta
from enquiry.tests.model_maker import make_enquiry
def default_scenario_enquiry():
make_enquiry(
'Rick',
'Can I buy some hay?',
'',
'07840 538 357',
)
make_enquiry(
'Ryan',
(
... | from enquiry.tests.model_maker import make_enquiry
def default_scenario_enquiry():
make_enquiry(
'Rick',
'Can I buy some hay?',
'',
'07840 538 357',
)
make_enquiry(
'Ryan',
(
'Can I see some of the fencing you have done?\n'
"I would l... | apache-2.0 | Python |
f113aaae2232d0041e01a6f12ab2ba083df65d44 | Change submit module to use new interface. | appeltel/AutoCMS,appeltel/AutoCMS,appeltel/AutoCMS | autocms/submit.py | autocms/submit.py | """Functions to submit and register new jobs."""
import os
def submit_and_stamp(counter, testname, scheduler, config):
"""Submit a job to the scheduler and produce a newstamp file.
The full path of the newstamp file is returned."""
result = scheduler.submit_job(counter, testname, config)
stamp_filen... | """Functions to submit and register new jobs."""
import os
import socket
def submit_and_stamp(counter, testname, scheduler, config):
"""Submit a job to the scheduler and produce a newstamp file.
This function should be run from within the test directory.
If the submission fails an output log will be pro... | mit | Python |
0973acf04fd2fd59db4880d5ba4d994f4c1733db | Add length detection for PNG images. | Bindernews/TheHound | identifiers/image_identifier.py | identifiers/image_identifier.py |
import io
from struct import unpack
import sys
from identifier import Result
#############
# Constants #
#############
PNG_CHUNK_IEND = b'IEND'
PNG_CHUNK_IHDR = b'IHDR'
#######################
# Identifier Patterns #
#######################
JPEG_PATTERNS = [
'FF D8 FF E0',
'FF D8 FF E1',
'FF D8 FF FE',
]
GIF_P... |
# Identifier for basic image files
from identifier import Result
JPEG_PATTERNS = [
'FF D8 FF E0',
'FF D8 FF E1',
'FF D8 FF FE',
]
GIF_PATTERNS = [
'47 49 46 38 39 61',
'47 49 46 38 37 61',
]
PNG_PATTERNS = [
'89 50 4E 47'
]
BMP_PATTERNS = [
'42 4D 62 25',
'42 4D F8 A9',
'42 4D 76 02',
]
ICO_PATTERNS = [
... | mit | Python |
d7c5b8784fd747355884e3371f1c85ede9a9bf6f | Disable some packages for now, so that packaging can finish on the buildbots as they are. This should let wrench run the Mono test suite. | BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,mono/bockbuild,mono/bockbuild,BansheeMediaPlayer/bockbuild | profiles/mono-mac-release-64/packages.py | profiles/mono-mac-release-64/packages.py | import os
from bockbuild.darwinprofile import DarwinProfile
class MonoReleasePackages:
def __init__(self):
# Toolchain
#package order is very important.
#autoconf and automake don't depend on CC
#ccache uses a different CC since it's not installed yet
#every thing after ccache needs a working ccache
self... | import os
from bockbuild.darwinprofile import DarwinProfile
class MonoReleasePackages:
def __init__(self):
# Toolchain
#package order is very important.
#autoconf and automake don't depend on CC
#ccache uses a different CC since it's not installed yet
#every thing after ccache needs a working ccache
self... | mit | Python |
fe0d872c69280b5713a4ad6f0a1cd4a5623fdd75 | Add createnapartcommand contents | scholer/cadnano2.5 | cadnano/part/createnapartcommand.py | cadnano/part/createnapartcommand.py | from ast import literal_eval
from cadnano.cnproxy import UndoCommand
from cadnano.part.nucleicacidpart import NucleicAcidPart
class CreateNucleicAcidPartCommand(UndoCommand):
def __init__(self, document, grid_type, use_undostack):
# TODO[NF]: Docstring
super(CreateNucleicAcidPartCommand, self)._... | mit | Python | |
899254d3bd064ba8e5653ad9081674b7af1495fa | fix capture=True | kjtanaka/fabric_hadoop | fabfile/openstack.py | fabfile/openstack.py | #!/usr/bin/env python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import os
import yaml
from fabric.api import task, local, settings, warn_only
from cuisine import file_exists
@task
def up():
""" Boot instances """
# call class OpenStack
op = OpenStack()
# Check if fingerprint exis... | #!/usr/bin/env python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import os
import yaml
from fabric.api import task, local, settings, warn_only
from cuisine import file_exists
@task
def up():
""" Boot instances """
# call class OpenStack
op = OpenStack()
# Check if fingerprint exis... | mit | Python |
0727ad29721a3dad4c36113a299f5c67bda70822 | Sort everything alphabetically on separate lines. | python/importlib_resources | importlib_resources/__init__.py | importlib_resources/__init__.py | """Read resources contained within a package."""
import sys
__all__ = [
'Package',
'Resource',
'ResourceReader',
'contents',
'is_resource',
'open_binary',
'open_text',
'path',
'read_binary',
'read_text',
]
if sys.version_info >= (3,):
from importlib_resources._py3 im... | """Read resources contained within a package."""
import sys
__all__ = [
'contents',
'is_resource',
'open_binary',
'open_text',
'path',
'read_binary',
'read_text',
'Package',
'Resource',
'ResourceReader',
]
if sys.version_info >= (3,):
from importlib_resources._py3 im... | apache-2.0 | Python |
4d1c465e5c946ac17334e29e0ded7b6134533d12 | Disable save in Crop multi roi and show the image instead | hadim/fiji_tools,hadim/fiji_tools,hadim/fiji_scripts,hadim/fiji_scripts,hadim/fiji_scripts | plugins/Scripts/Plugins/Crop_Multi_Roi.py | plugins/Scripts/Plugins/Crop_Multi_Roi.py | from ij import IJ
from ij.plugin.frame import RoiManager
from io.scif.config import SCIFIOConfig
from io.scif.img import ImageRegion
from io.scif.img import ImgOpener
from io.scif.img import ImgSaver
from net.imagej.axis import Axes
from net.imglib2.img.display.imagej import ImageJFunctions
import os
def main():
... | from ij import IJ
from ij.plugin.frame import RoiManager
from io.scif.config import SCIFIOConfig
from io.scif.img import ImageRegion
from io.scif.img import ImgOpener
from io.scif.img import ImgSaver
from net.imagej.axis import Axes
import os
def main():
# Get current image filename
imp = IJ.getImage()
f... | bsd-3-clause | Python |
9a19c34a104aabd0c5b34734f587573d5766a4bd | support multi-file results | rtmclay/Themis,rtmclay/Themis,rtmclay/Themis | finishTest/Finish.py | finishTest/Finish.py | from __future__ import print_function
from BaseTask import BaseTask
from Engine import MasterTbl, Error, get_platform
from Dbg import Dbg
import os, json, time, platform
dbg = Dbg()
validA = ("passed", "failed", "diff")
comment_block = """
Test Results:
'notfinished': means that the test has s... | from __future__ import print_function
from BaseTask import BaseTask
from Engine import MasterTbl, Error, get_platform
from Dbg import Dbg
import os, json, time, platform
dbg = Dbg()
validA = ("passed", "failed", "diff")
comment_block = """
Test Results:
'notfinished': means that the test has s... | mit | Python |
38efb136609b645b0076c0aa1481330f9e28ee51 | Add a rule for matching packages by regex. | fedora-infra/fmn.rules,jeremycline/fmn,jeremycline/fmn,jeremycline/fmn | fmn/rules/generic.py | fmn/rules/generic.py | # Generic rules for FMN
import re
import fedmsg
import fmn.rules.utils
def user_filter(config, message, fasnick=None, *args, **kw):
""" All messages for a certain user
Use this rule to include messages that are associated with a
specific user.
"""
fasnick = kw.get('fasnick', fasnick)
if fa... | # Generic rules for FMN
import fedmsg
import fmn.rules.utils
def user_filter(config, message, fasnick=None, *args, **kw):
""" All messages for a certain user
Use this rule to include messages that are associated with a
specific user.
"""
fasnick = kw.get('fasnick', fasnick)
if fasnick:
... | lgpl-2.1 | Python |
7f974b87c278ef009535271461b5e49686057a9a | Fix for django >= 1.10 | grantmcconnaughey/django-avatar,jezdez/django-avatar,grantmcconnaughey/django-avatar,ad-m/django-avatar,ad-m/django-avatar,jezdez/django-avatar | avatar/management/commands/rebuild_avatars.py | avatar/management/commands/rebuild_avatars.py | from django.core.management.base import BaseCommand
from avatar.conf import settings
from avatar.models import Avatar
class Command(BaseCommand):
help = ("Regenerates avatar thumbnails for the sizes specified in "
"settings.AVATAR_AUTO_GENERATE_SIZES.")
def handle(self, *args, **options):
... | from django.core.management.base import NoArgsCommand
from avatar.conf import settings
from avatar.models import Avatar
class Command(NoArgsCommand):
help = ("Regenerates avatar thumbnails for the sizes specified in "
"settings.AVATAR_AUTO_GENERATE_SIZES.")
def handle_noargs(self, **options):
... | bsd-3-clause | Python |
0da189464703837e212bff06c24cc6eb5b62eeea | Fix name of room | apiaryio/black-belt | blackbelt/slack.py | blackbelt/slack.py | from slacker import Slacker
from blackbelt.config import config
class Slack(object):
def __init__(self, token=None):
if not token:
token = config['slack']['access_token']
slack = Slacker(token)
self.slack = slack
if not token:
raise ValueError("Can't ... | from slacker import Slacker
from blackbelt.config import config
class Slack(object):
def __init__(self, token=None):
if not token:
token = config['slack']['access_token']
slack = Slacker(token)
self.slack = slack
if not token:
raise ValueError("Can't ... | mit | Python |
eb3a332cf5aeb6b213c333cbfba78b26b776db49 | fix facebook api | scailer/django-social-publisher,scailer/django-social-publisher | social_publisher/backends/facebook.py | social_publisher/backends/facebook.py | # -*- coding: utf-8 -*-
from social_publisher import facebook
from social_publisher.backends import base
class FacebookBackend(base.BaseBackend):
name = 'facebook'
auth_provider = 'facebook'
def get_api(self, social_user):
return facebook.GraphAPI(social_user.extra_data.get('access_token'))
... | # -*- coding: utf-8 -*-
from social_publisher import facebook
from social_publisher.backends import base
class FacebookBackend(base.BaseBackend):
name = 'facebook'
auth_provider = 'facebook'
def get_api(self, social_user):
return facebook.GraphAPI(social_user.extra_data.get('access_token'))
... | mit | Python |
07c8888a3623ea40c4f2047e11445726e61e2438 | Fix lint. | StackStorm/st2contrib,pearsontechnology/st2contrib,armab/st2contrib,tonybaloney/st2contrib,psychopenguin/st2contrib,pearsontechnology/st2contrib,pidah/st2contrib,StackStorm/st2contrib,armab/st2contrib,pidah/st2contrib,pearsontechnology/st2contrib,StackStorm/st2contrib,psychopenguin/st2contrib,armab/st2contrib,tonybalon... | packs/csv/tests/test_action_parse.py | packs/csv/tests/test_action_parse.py | import unittest2
from parse_csv import ParseCSVAction
__all__ = [
'ParseCSVActionTestCase'
]
MOCK_DATA = """
first,last,year
name1,surename1,1990
""".strip()
class ParseCSVActionTestCase(unittest2.TestCase):
def test_run(self):
result = ParseCSVAction().run(data=MOCK_DATA, delimiter=',')
ex... | import unittest2
from parse_csv import ParseCSVAction
__all__ = [
'ParseCSVActionTestCase'
]
MOCK_DATA = """
first,last,year
name1,surename1,1990
""".strip()
class ParseCSVActionTestCase(unittest2.TestCase):
def test_run(self):
result = ParseCSVAction().run(data=MOCK_DATA, delimiter=',')
exp... | apache-2.0 | Python |
9c898d7e547b13bb289c0d1cada0bbd4078803dc | Allow passing of size_cutoff to preassembler methods. | pvtodorov/indra,johnbachman/belpy,sorgerlab/belpy,sorgerlab/indra,sorgerlab/indra,johnbachman/indra,johnbachman/indra,johnbachman/indra,johnbachman/belpy,bgyori/indra,sorgerlab/indra,pvtodorov/indra,bgyori/indra,johnbachman/belpy,pvtodorov/indra,sorgerlab/belpy,sorgerlab/belpy,bgyori/indra,pvtodorov/indra | indra/db/pre_assemble_script.py | indra/db/pre_assemble_script.py | import indra.tools.assemble_corpus as ac
from indra.db.util import get_statements, insert_pa_stmts
from indra.preassembler import Preassembler
from indra.preassembler.hierarchy_manager import hierarchies
def make_unique_statement_set(preassembler, stmts):
stmt_groups = preassembler.get_stmt_matching_groups(stmts)... | import indra.tools.assemble_corpus as ac
from indra.db.util import get_statements, insert_pa_stmts
from indra.preassembler import Preassembler
from indra.preassembler.hierarchy_manager import hierarchies
def make_unique_statement_set(preassembler, stmts):
stmt_groups = preassembler.get_stmt_matching_groups(stmts)... | bsd-2-clause | Python |
37c65efa1b78abcc75d506554e6fb877678ec2f2 | Fix a typo | editorsnotes/editorsnotes,editorsnotes/editorsnotes | editorsnotes/api/views/topics.py | editorsnotes/api/views/topics.py | from editorsnotes.main.models import Topic
from .. import filters as es_filters
from ..serializers.topics import TopicSerializer
from .base import BaseListAPIView, BaseDetailView, DeleteConfirmAPIView
from .mixins import (ElasticSearchListMixin, EmbeddedMarkupReferencesMixin,
HydraProjectPermissi... | from editorsnotes.main.models import Topic
from .. import filters as es_filters
from ..serializers.topics import TopicSerializer
from .base import BaseListAPIView, BaseDetailView, DeleteConfirmAPIView
from .mixins import (ElasticSearchListMixin, EmbeddedMarkupReferencesMixin,
HydraProjectPermissi... | agpl-3.0 | Python |
0091c41d8dd064b40ccf35d4d24c01ae4438f028 | Set sender in signal handlers | NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor | cityhallmonitor/signals/handlers.py | cityhallmonitor/signals/handlers.py | from django.db.models.signals import pre_save, post_save
from django.dispatch import receiver
from django.utils import timezone
from cityhallmonitor.models import DirtyFieldsModel
@receiver(pre_save, sender=DirtyFieldsModel)
def handle_pre_save(sender, instance, *args, **kwargs):
"""Set updated_at timestamp if mo... | from django.db.models.signals import pre_save, post_save
from django.dispatch import receiver
from django.utils import timezone
@receiver(pre_save)
def handle_pre_save(sender, instance, *args, **kwargs):
"""
Set updated_at timestamp if model is actually dirty
"""
if hasattr(sender, 'is_dirty'):
... | mit | Python |
41d6c18aee851c9b2430d74c51ef51b49948b0f4 | raise version | xiezhen/brilws,xiezhen/brilws | brilws/_version.py | brilws/_version.py | __version__ = "3.5.0"
| __version__ = "3.4.1"
| mit | Python |
6e2362351d9ccaa46a5a2bc69c4360e4faff166d | Add encoding spec to comply Python 2 | fikr4n/iclib-python | iclib/qibla.py | iclib/qibla.py | # -*- coding: utf-8 -*-
from . import formula
def direction(lat, lng):
return formula.qibla(lat, lng)
def direction_dms(lat, lng):
return _dms(formula.qibla(lat, lng))
def direction_str(lat, lng, prec=0):
d, m, s = direction_dms(lat, lng)
# negative input might returns wrong result
return '{}° {}\' {:.{}f}"'.fo... | from . import formula
def direction(lat, lng):
return formula.qibla(lat, lng)
def direction_dms(lat, lng):
return _dms(formula.qibla(lat, lng))
def direction_str(lat, lng, prec=0):
d, m, s = direction_dms(lat, lng)
# negative input might returns wrong result
return '{}° {}\' {:.{}f}"'.format(d, m, s, prec)
def... | apache-2.0 | Python |
9f1913ca658228c2c6551b2c8de1d48ddd73c8aa | raise version to 2 | xiezhen/brilws,xiezhen/brilws | brilws/_version.py | brilws/_version.py | __version__ = "2.0.0"
| __version__ = "1.0.3"
| mit | Python |
97831652f0d06236d83d0731813ffcdc44a4e190 | Update pypi version | glasslion/fontdump | fontdump/__init__.py | fontdump/__init__.py | __version__ = '1.1.0' | __version__ = '0.1.0' | mit | Python |
22461c6ddc1a6bff0ee8637139146b8531b3e0b4 | improve python error message when tp fails to start | google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto | python/perfetto/trace_processor/shell.py | python/perfetto/trace_processor/shell.py | #!/usr/bin/env python3
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | #!/usr/bin/env python3
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | apache-2.0 | Python |
c182e4f3d7df431fe5c542988fcef9f05825913c | Update the raw_parameter_script | mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase | examples/raw_parameter_script.py | examples/raw_parameter_script.py | """ The main purpose of this file is to demonstrate running SeleniumBase
scripts without the use of Pytest by calling the script directly
with Python or from a Python interactive interpreter. Based on
whether relative imports work or don't, the script can autodetect
how this file was run. With pure Pyth... | """ The main purpose of this file is to demonstrate running SeleniumBase
scripts without the use of Pytest by calling the script directly
with Python or from a Python interactive interpreter. Based on
whether relative imports work or don't, the script can autodetect
how this file was run. With pure Pyth... | mit | Python |
a713bbb1226863b4417362019431de0266faa2d9 | Update automateprojectscript.py | TomHulme/306-Swarm-Robotics-Project,TomHulme/306-Swarm-Robotics-Project,TomHulme/306-Swarm-Robotics-Project | automateprojectscript.py | automateprojectscript.py | #!/usr/bin/python
"""
This python file just runs all of the terminal commands needed to run the project. It just saves time not having to manually type in these commands every time you want to run the project.
At the moment it only works for the example project, as the project later develops this script might be upda... | #!/usr/bin/python
"""
This python file just runs all of the terminal commands needed to run the project. It just saves time not having to manually type in these commands every time you want to run the project.
At the moment it only works for the example project, as the project later develops this script might be upda... | apache-2.0 | Python |
3f1d30c2aeff73bb4863f2d0fd0660a264715739 | Tidy up | petr-tik/chess_app,petr-tik/chess_app,petr-tik/chess_app | src/planner.py | src/planner.py | from collections import deque
class GamePlan(object):
"""
initialise the tournament object with an overall list of players' IDs
input:
a list of players
output:
a list (len = number of rounds) of lists of tuples
with players' names (maybe change to IDs from db) in white, black order
... | from collections import deque
class GamePlan(object):
"""
initialise the tournament object with an overall list of players' IDs
input:
a list of players
output:
a list (len = number of rounds) of lists of tuples
with players' names (maybe change to IDs from db) in white, black order
... | mit | Python |
65783ec0baac5886232a5334905a748750b3c0c2 | fix NameError | onelab-eu/sfa,yippeecw/sfa,yippeecw/sfa,onelab-eu/sfa,yippeecw/sfa,onelab-eu/sfa | sfa/methods/Update.py | sfa/methods/Update.py | ### $Id: update.py 16477 2010-01-05 16:31:37Z thierry $
### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/update.py $
import time
from sfa.util.faults import *
from sfa.util.method import Method
from sfa.util.parameter import Parameter, Mixed
from sfa.trust.credential import Credential
class Update(Metho... | ### $Id: update.py 16477 2010-01-05 16:31:37Z thierry $
### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/update.py $
import time
from sfa.util.faults import *
from sfa.util.method import Method
from sfa.util.parameter import Parameter, Mixed
from sfa.trust.credential import Credential
class Update(Metho... | mit | Python |
d307b65f8bf5f9ae8eaaefa071fd2055304a6725 | Remove custom form from admin. | tiagovaz/saskatoon,tiagovaz/saskatoon,tiagovaz/saskatoon,tiagovaz/saskatoon | saskatoon/harvest/admin.py | saskatoon/harvest/admin.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from forms import RFPForm, PropertyForm, HarvestForm, HarvestYieldForm, EquipmentForm
from member.models import *
from harvest.models import *
from harvest.forms import *
class PropertyInline(admin.TabularInline):
model = Property
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from forms import RFPForm, PropertyForm, HarvestForm, HarvestYieldForm, EquipmentForm
from member.models import *
from harvest.models import *
from harvest.forms import *
class PropertyInline(admin.TabularInline):
model = Property
... | agpl-3.0 | Python |
5bb92bea9d910c788efa3ea5b7ca41499d92be26 | update cuba.py with the autogenerated one | simphony/simphony-common | simphony/core/cuba.py | simphony/core/cuba.py | # code auto-generated by the cuba-generate.py script.
from enum import IntEnum, unique
@unique
class CUBA(IntEnum):
NAME = 1
DIRECTION = 3
STATUS = 4
LABEL = 5
MATERIAL_ID = 6
CHEMICAL_SPECIE = 7
MATERIAL_TYPE = 8
SHAPE_CENTER = 9
SHAPE_LENGTH_UC = 10
SHAPE_LENGTH = 11
SHA... | from enum import IntEnum, unique
@unique
class CUBA(IntEnum):
NAME = 0
DIRECTION = 1
STATUS = 2
LABEL = 3
MATERIAL_ID = 4
MATERIAL_TYPE = 5
SHAPE_CENTER = 6
SHAPE_LENGTH_UC = 7
SHAPE_LENGTH = 8
SHAPE_RADIUS = 9
SHAPE_SIDE = 10
CRYSTAL_STORAGE = 11
NAME_UC = 12
... | bsd-2-clause | Python |
e28a41e5996651aefdf7966ead73310a5a761040 | fix flake8 violation | simphony/simphony-common | simphony/cuds/bond.py | simphony/cuds/bond.py | class Bond(object):
"""
Bond entity
"""
def __init__(self, id, particles, data=None):
self.id = id
self.particles = particles
if data is None:
self.data = {}
else:
self.data = data
def __eq__(self, other):
if isinstance(other, self.__c... | class Bond(object):
"""
Bond entity
"""
def __init__(self, id, particles, data=None):
self.id = id
self.particles = particles
if data is None:
self.data = {}
else:
self.data = data
def __eq__(self, other):
if isinstance(other, self.__... | bsd-2-clause | Python |
2e2f6d2a6480a4ca43c76e6559cfe6aadc434a8b | change to dumps | lordmuffin/aws-cfn-lambdawebhook,lordmuffin/aws-cfn-lambdawebhook | functions/webhook.py | functions/webhook.py | #!/usr/bin/python
# Written by: Andrew Jackson
# This is used to send a JSON payload to a webhook.
import json
import logging
import os
import time
import uuid
import boto3
import requests
import decimal
#def default(obj):
# if isinstance(obj, decimal.Decimal):
# return int(obj)
# return o.__dict__
def h... | #!/usr/bin/python
# Written by: Andrew Jackson
# This is used to send a JSON payload to a webhook.
import json
import logging
import os
import time
import uuid
import boto3
import requests
import decimal
#def default(obj):
# if isinstance(obj, decimal.Decimal):
# return int(obj)
# return o.__dict__
def h... | mit | Python |
f83369a263fb606a6f92b62a45d72e8faf0f1770 | Add RunGM and RunBench steps for Android Review URL: https://codereview.appspot.com/5987049 | google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbo... | master/skia_master_scripts/android_factory.py | master/skia_master_scripts/android_factory.py | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility class to build the Skia master BuildFactory's for Android buildbots.
Overrides SkiaFactory with any Android-specific steps."""
from skia_mas... | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility class to build the Skia master BuildFactory's for Android buildbots.
Overrides SkiaFactory with any Android-specific steps."""
from skia_mas... | bsd-3-clause | Python |
984422fe3fb0b34a17e42910a9c1b98afa572452 | Revert r9607 -- it caused a BuildbotSelfTest failure | Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbo... | master/skia_master_scripts/android_factory.py | master/skia_master_scripts/android_factory.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility class to build the Skia master BuildFactory's for Android buildbots.
Overrides SkiaFactory with any Android-specific steps."""
from buildb... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility class to build the Skia master BuildFactory's for Android buildbots.
Overrides SkiaFactory with any Android-specific steps."""
from buildb... | bsd-3-clause | Python |
4b740ddb11fb5c4b2b29bc6eef0a5569349272f8 | make random_metadata compliant | planetlabs/datalake,planetlabs/datalake-common,planetlabs/datalake,planetlabs/atl,planetlabs/datalake,planetlabs/datalake | datalake_common/tests/conftest.py | datalake_common/tests/conftest.py | import pytest
import random
import string
from datetime import datetime, timedelta
@pytest.fixture
def basic_metadata():
return {
'version': 0,
'start': 1426809600000,
'end': 1426895999999,
'where': 'nebraska',
'what': 'apache',
'hash': '12345'
}
def random_wo... | import pytest
import random
import string
from datetime import datetime, timedelta
@pytest.fixture
def basic_metadata():
return {
'version': 0,
'start': 1426809600000,
'end': 1426895999999,
'where': 'nebraska',
'what': 'apache',
'hash': '12345'
}
def random_wo... | apache-2.0 | Python |
5d82c2d9f6d2874ae4621edb4dc1e6455652666b | Remove Dropout and unnecessary imports | kemaswill/keras | examples/imdb_fasttext.py | examples/imdb_fasttext.py | '''This example demonstrates the use of fasttext for text classification
Based on Joulin et al's paper:
Bags of Tricks for Efficient Text Classification
https://arxiv.org/abs/1607.01759
Can achieve accuracy around 88% after 5 epochs in 70s.
'''
from __future__ import print_function
import numpy as np
np.random.see... | '''This example demonstrates the use of fasttext for text classification
Based on Joulin et al's paper:
Bags of Tricks for Efficient Text Classification
https://arxiv.org/abs/1607.01759
Can achieve accuracy around 88% after 5 epochs in 70s.
'''
from __future__ import print_function
import numpy as np
np.random.see... | mit | Python |
20ef3aed661d5b77bedf48df9ed6917e24319c01 | Fix typo | holzman/glideinwms-old,bbockelm/glideinWMS,bbockelm/glideinWMS,holzman/glideinwms-old,bbockelm/glideinWMS,holzman/glideinwms-old,bbockelm/glideinWMS | factory/glideFactoryLogParser.py | factory/glideFactoryLogParser.py | #
# Description:
# This module implements classes to track
# changes in glidein status logs
#
# Author:
# Igor Sfiligoi (Feb 2nd 2007)
#
import os, os.path
import condorLogParser
# for now it is just a constructor wrapper
# Further on it will need to implement glidein exit code checks
class dirSummaryTimings(c... | #
# Description:
# This module implements classes to track
# changes in glidein status logs
#
# Author:
# Igor Sfiligoi (Feb 2nd 2007)
#
import os, os.path
import condorLogParser
# for now it is just a constructor wrapper
# Further on it will need to implement glidein exit code checks
class dirSummaryTimings(c... | bsd-3-clause | Python |
c47a51db4f7ccc514aa687a1859ed592574d1a58 | Change API Endpoint to BzAPI Compatibility Layer | mozilla/bztools,anoopvalluthadam/bztools,mozilla/relman-auto-nag,mozilla/relman-auto-nag,mozilla/relman-auto-nag | bugzilla/agents.py | bugzilla/agents.py | from bugzilla.models import *
from bugzilla.utils import *
class InvalidAPI_ROOT(Exception):
def __str__(self):
return "Invalid API url specified. " + \
"Please set BZ_API_ROOT in your environment " + \
"or pass it to the agent constructor"
class BugzillaAgent(object):
de... | from bugzilla.models import *
from bugzilla.utils import *
class InvalidAPI_ROOT(Exception):
def __str__(self):
return "Invalid API url specified. " + \
"Please set BZ_API_ROOT in your environment " + \
"or pass it to the agent constructor"
class BugzillaAgent(object):
de... | bsd-3-clause | Python |
14c31307fd31631ecce0378aedbef95cec8531f2 | Fix autodiscovery | nkovshov/gargoyle,roverdotcom/gargoyle,nkovshov/gargoyle,YPlan/gargoyle,roverdotcom/gargoyle,roverdotcom/gargoyle,YPlan/gargoyle,YPlan/gargoyle,nkovshov/gargoyle | gargoyle/__init__.py | gargoyle/__init__.py | """
gargoyle
~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from django.utils.module_loading import autodiscover_modules
from gargoyle.manager import gargoyle
__version__ = '1.2.0'
VERSION = __version__ # old version compat
__all__ = ('gargoyle', 'autodiscover... | """
gargoyle
~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from django.utils.module_loading import autodiscover_modules
from gargoyle.manager import gargoyle
__version__ = '1.2.0'
VERSION = __version__ # old version compat
__all__ = ('gargoyle', 'autodiscover... | apache-2.0 | Python |
f4063d86404adbb5489edefd6c12d855de246dee | test that we can decode all doubly-encoded characters (doesn't pass yet) | rspeer/python-ftfy | ftfy/test_unicode.py | ftfy/test_unicode.py | # -*- coding: utf-8 -*-
from ftfy.fixes import fix_text_encoding
import unicodedata
import sys
from nose.tools import eq_
if sys.hexversion >= 0x03000000:
unichr = chr
# Most single-character strings which have been misencoded should be restored.
def test_all_bmp_characters():
for index in range(0xa0, 0xfffd)... | # -*- coding: utf-8 -*-
from ftfy.fixes import fix_text_encoding
import unicodedata
import sys
if sys.hexversion >= 0x03000000:
unichr = chr
# Most single-character strings which have been misencoded should be restored.
def test_all_bmp_characters():
for index in range(0xa0, 0xfffd):
char = unichr(ind... | mit | Python |
c9e37f9b241c2bef2ffdb4811cec41c951b21ef9 | Update fluid_cat_slim.py | leios/OIST.CSC,leios/OIST.CSC,leios/OIST.CSC | cat_boxing/caged_cat/python/fluid_cat_slim.py | cat_boxing/caged_cat/python/fluid_cat_slim.py | from random import randint
def generate_cat():
cat_size = randint(1,100)
return cat_size
def fill_box():
empty_room = 400
j = 0
while empty_room > 0:
cat = generate_cat()
empty_room = empty_room - cat
j = j + 1
return j
def fill_truck():
truck_size = 40
ca... | from random import randint
def generate_cat():
cat_size = randint(1,100)
return cat_size
def fill_box():
box_size = 400
empty_room = 400
j = 0
while empty_room > 0:
cat = generate_cat()
empty_room = empty_room - cat
j = j + 1
return j
def fill_truck():
tru... | mit | Python |
d1e66c414aac60cc7770ddeff091dedc5c0047f6 | Remove debug `print` from feature extraction | widoptimization-willett/feature-extraction | feature_extraction/extraction.py | feature_extraction/extraction.py | import numpy as np
import skimage.exposure as exposure
from .util import AttributeDict
def extract_features(image, measurements):
"""
Given an image as a Numpy array and a set of measurement objects
implementing a compute method returning a feature vector, return a combined
feature vector.
"""
# TODO(liam): par... | import numpy as np
import skimage.exposure as exposure
from .util import AttributeDict
def extract_features(image, measurements):
"""
Given an image as a Numpy array and a set of measurement objects
implementing a compute method returning a feature vector, return a combined
feature vector.
"""
# TODO(liam): par... | apache-2.0 | Python |
15652a0b80b0fa0c87ac9ccd33eaada22859bfa2 | Update the_most_numbers.py | JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking | checkio/python/elementary/the_most_numbers.py | checkio/python/elementary/the_most_numbers.py | def distance(*args):
if args:
min = args[0]
max = args[0]
for x in args:
if x < min:
min = x
if x > max:
max = x
else:
min = 0
max = 0
return max - min
| mit | Python | |
2e3341c7e32182cc35f6a658d613c77a72b9b377 | Modify comments | Skalman/owl_analytics | src/marketdata/access/remote/google.py | src/marketdata/access/remote/google.py | import urllib2
import urllib
from marketdata.utils.transform.google.rawquote_intraday import TranformIntradayQuote
def _getUrl(url, urlconditions):
url_values = urllib.urlencode(urlconditions)
return url + '?' + url_values
def _pullQuote(url, urlconditions):
req = urllib2.Request(_getUrl(url, urlconditi... | import urllib2
import urllib
from marketdata.utils.transform.google.rawquote_intraday import TranformIntradayQuote
def _getUrl(url, urlconditions):
url_values = urllib.urlencode(urlconditions)
return url + '?' + url_values
def _pullQuote(url, urlconditions):
req = urllib2.Request(_getUrl(url, urlconditi... | mpl-2.0 | Python |
3577de6383053e0f8e05d531c8a632be12e89ca6 | fix for route parser to handle when path=None | bretthandrews/marvin,albireox/marvin,albireox/marvin,sdss/marvin,sdss/marvin,albireox/marvin,albireox/marvin,sdss/marvin,sdss/marvin,bretthandrews/marvin,bretthandrews/marvin,bretthandrews/marvin | python/marvin/utils/general/decorators.py | python/marvin/utils/general/decorators.py |
from functools import wraps
# General Decorators
def parseRoutePath(f):
''' Decorator to parse generic route path '''
@wraps(f)
def decorated_function(inst, *args, **kwargs):
if 'path' in kwargs and kwargs['path']:
for kw in kwargs['path'].split('/'):
if len(kw) == 0:... |
from functools import wraps
# General Decorators
def parseRoutePath(f):
''' Decorator to parse generic route path '''
@wraps(f)
def decorated_function(inst, *args, **kwargs):
for kw in kwargs['path'].split('/'):
if len(kw) == 0:
continue
var, value = kw.sp... | bsd-3-clause | Python |
27acea8beae7876159f142add8d3e55b62d61f8f | Add read method to modulators | watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder | feder/questionaries/modulator.py | feder/questionaries/modulator.py | from django import forms
from django.utils.translation import ugettext as _
class BaseBlobFormModulator(object):
description = None
def __init__(self, blob=None):
self.blob = blob or {}
super(BaseBlobFormModulator, self).__init__()
def create(self, fields):
raise NotImplementedEr... | from django import forms
from django.utils.translation import ugettext as _
class BaseBlobFormModulator(object):
description = None
def __init__(self, blob=None):
self.blob = blob or {}
super(BaseBlobFormModulator, self).__init__()
def create(self):
raise NotImplementedError("")
... | mit | Python |
90e1b254266155abded62bc3155785961acc0ff0 | Split filepath and count in credential module | CIRCL/AIL-framework,CIRCL/AIL-framework,CIRCL/AIL-framework,CIRCL/AIL-framework | bin/Credential.py | bin/Credential.py | #!/usr/bin/env python2
# -*-coding:UTF-8 -*
import time
from packages import Paste
from pubsublogger import publisher
from Helper import Process
import re
if __name__ == "__main__":
publisher.port = 6380
publisher.channel = "Script"
config_section = "Credential"
p = Process(config_section)
publishe... | #!/usr/bin/env python2
# -*-coding:UTF-8 -*
import time
from packages import Paste
from pubsublogger import publisher
from Helper import Process
import re
if __name__ == "__main__":
publisher.port = 6380
publisher.channel = "Script"
config_section = "Credential"
p = Process(config_section)
publishe... | agpl-3.0 | Python |
e18047a3cb3c8303bf64dc9ce5fc230e29b25b56 | Fix fac-gitall.py | lnls-fac/scripts,lnls-fac/scripts | bin/fac-gitall.py | bin/fac-gitall.py | #!/usr/bin/env python3
import sys
import os
import lnls
#import git
from termcolor import colored
import subprocess
git_functions = ('pull','push','status','diff','clone')
def run_git_clone():
if not os.path.exists(lnls.folder_code):
print('fac-gitall.py: please create ' + lnls.folder_code + ' folder ... | #!/usr/bin/env python3
import sys
import os
import lnls
#import git
from termcolor import colored
import subprocess
git_functions = ('pull','push','status','diff','clone')
def run_git_clone():
if not os.path.exists(lnls.folder_code):
print('gitall.py: please create ' + lnls.folder_code + ' folder with... | mit | Python |
1b172c592bb5efc1a0dcf8f18d6ea6a1037ec9ff | Clean things up a bit | jhaals/filebutler-upload | filebutler_upload/filehandler.py | filebutler_upload/filehandler.py | import requests
class Filemanager:
def __init__(self, url, username, password):
self.headers = {'Accept': 'application/json'}
self.username = username
self.password = password
self.url = url
def list(self):
'''
List all files uploaded by user
'''
... | import requests
#import os
#from ConfigParser import RawConfigParser
#from text_table import TextTable
class Filemanager:
def __init__(self, url, username, password):
self.headers = {'Accept': 'application/json'}
self.username = username
self.password = password
self.url = url
... | bsd-3-clause | Python |
3fea731e62653dfc847e82b8185feb029d844fd8 | Revert "minifiying doctype json's" | elba7r/frameworking,paurosello/frappe,maxtorete/frappe,mbauskar/frappe,rmehta/frappe,neilLasrado/frappe,aboganas/frappe,bohlian/frappe,paurosello/frappe,adityahase/frappe,frappe/frappe,elba7r/builder,maxtorete/frappe,manassolanki/frappe,vqw/frappe,rmehta/frappe,ESS-LLP/frappe,saurabh6790/frappe,StrellaGroup/frappe,paur... | frappe/modules/export_file.py | frappe/modules/export_file.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, os, json
import frappe.model
from frappe.modules import scrub, get_module_path, lower_case_files_for, scrub_dt_dn
def export_doc(doc):
export_to_files([[doc.doct... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, os, json
import frappe.model
from frappe.modules import scrub, get_module_path, lower_case_files_for, scrub_dt_dn
def export_doc(doc):
export_to_files([[doc.doct... | mit | Python |
f03ba99cd7c4db064b2ece3d226b30c8e9ca63bf | Add a test for scipy.integrate.newton_cotes. A more comprehensive set of tests would be better, but it's a start. | lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,scipy/scipy-svn,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,scipy/scipy-svn,jasonmccampbell/scipy-refactor,scipy/scipy-svn,scipy/scipy-svn | scipy/integrate/tests/test_quadrature.py | scipy/integrate/tests/test_quadrature.py |
import numpy
from numpy import cos, sin, pi
from numpy.testing import *
from scipy.integrate import quadrature, romberg, romb, newton_cotes
class TestQuadrature(TestCase):
def quad(self, x, a, b, args):
raise NotImplementedError
def test_quadrature(self):
# Typical function with two extra ar... |
import numpy
from numpy import cos, sin, pi
from numpy.testing import *
from scipy.integrate import quadrature, romberg, romb
class TestQuadrature(TestCase):
def quad(self, x, a, b, args):
raise NotImplementedError
def test_quadrature(self):
# Typical function with two extra arguments:
... | bsd-3-clause | Python |
a9b2b6fe868ab564653f40e611ce6a788f396981 | Fix wrong variable replacement | vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks | backend/globaleaks/tests/jobs/test_pgp_check_sched.py | backend/globaleaks/tests/jobs/test_pgp_check_sched.py | # -*- coding: utf-8 -*-
from twisted.internet.defer import inlineCallbacks
from globaleaks.tests import helpers
from globaleaks.jobs import pgp_check_sched
class TestPGPCheckSchedule(helpers.TestGLWithPopulatedDB):
encryption_scenario = 'ONE_VALID_ONE_EXPIRED'
@inlineCallbacks
def test_pgp_check_schedul... | # -*- coding: utf-8 -*-
from twisted.internet.defer import inlineCallbacks
from globaleaks.tests import helpers
from globaleaks.jobs import secure_file_delete_sched
class TestPGPCheckSchedule(helpers.TestGLWithPopulatedDB):
encryption_scenario = 'ONE_VALID_ONE_EXPIRED'
@inlineCallbacks
def test_pgp_chec... | agpl-3.0 | Python |
6ef76159ab32e454241f7979a1cdf320c463dd9e | add config file option | wathsalav/xos,zdw/xos,zdw/xos,opencord/xos,zdw/xos,jermowery/xos,xmaruto/mcord,wathsalav/xos,jermowery/xos,wathsalav/xos,cboling/xos,open-cloud/xos,cboling/xos,jermowery/xos,opencord/xos,wathsalav/xos,cboling/xos,cboling/xos,xmaruto/mcord,cboling/xos,open-cloud/xos,opencord/xos,jermowery/xos,open-cloud/xos,zdw/xos,xmar... | planetstack/planetstack-backend.py | planetstack/planetstack-backend.py | #!/usr/bin/env python
import os
import argparse
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
from observer.backend import Backend
from planetstack.config import Config
config = Config()
# after http://www.erlenstar.demon.co.uk/unix/faq_2.html
def daemon():
"""Daemonize the current proc... | #!/usr/bin/env python
import os
import argparse
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
from observer.backend import Backend
from planetstack.config import Config
config = Config()
# after http://www.erlenstar.demon.co.uk/unix/faq_2.html
def daemon():
"""Daemonize the current proc... | apache-2.0 | Python |
a5942402fdf8f8013dbe62636ea29582538e33c6 | fix argument name | EBIvariation/eva-cttv-pipeline | bin/trait_mapping/create_table_for_manual_curation.py | bin/trait_mapping/create_table_for_manual_curation.py | #!/usr/bin/env python3
import argparse
from eva_cttv_pipeline.trait_mapping.ols import (
get_ontology_label_from_ols, is_current_and_in_efo, is_in_efo,
)
def find_previous_mapping(trait_name, previous_mappings):
if trait_name not in previous_mappings:
return ''
uri = previous_mappings[trait_name... | #!/usr/bin/env python3
import argparse
from eva_cttv_pipeline.trait_mapping.ols import (
get_ontology_label_from_ols, is_current_and_in_efo, is_in_efo,
)
def find_previous_mapping(trait_name, previous_mappings):
if trait_name not in previous_mappings:
return ''
uri = previous_mappings[trait_name... | apache-2.0 | Python |
662608e6a183810072cb5e9dc7545145c866cf34 | Add missing import | m-ober/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps | byceps/services/shop/order/action_registry_service.py | byceps/services/shop/order/action_registry_service.py | """
byceps.services.shop.order.action_registry_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from ...seating.models.category import CategoryID
from ...user_badge.models.badge import BadgeID
from ..article.mod... | """
byceps.services.shop.order.action_registry_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from ...seating.models.category import CategoryID
from ...user_badge.models.badge import BadgeID
from ..article.mod... | bsd-3-clause | Python |
5cdf89e64ab9dabf277a867a774a88f12e1ece5e | Fix broken exception `BadHeader` | vuolter/pyload,vuolter/pyload,vuolter/pyload | src/pyload/core/network/http/exceptions.py | src/pyload/core/network/http/exceptions.py | # -*- coding: utf-8 -*-
PROPRIETARY_RESPONSES = {
440: "Login Timeout - The client's session has expired and must log in again.",
449: "Retry With - The server cannot honour the request because the user has not provided the required information",
451: "Redirect - Unsupported Redirect Header",
509: "Ban... | # -*- coding: utf-8 -*-
PROPRIETARY_RESPONSES = {
440: "Login Timeout - The client's session has expired and must log in again.",
449: "Retry With - The server cannot honour the request because the user has not provided the required information",
451: "Redirect - Unsupported Redirect Header",
509: "Ban... | agpl-3.0 | Python |
a23c6132792bd6aff420791cf4b78a955cc0dfad | add headless | huaying/ins-crawler | inscrawler/browser.py | inscrawler/browser.py | import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options
from time import sleep
class Browser:
def __init__(self):
dir_path = os.path.dirname(os.path.realpath(__f... | import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options
from time import sleep
class Browser:
def __init__(self):
dir_path = os.path.dirname(os.path.realpath(__f... | mit | Python |
b44a9dfbf26e07b9db6a31119044b8347907a5a5 | disable fid map | teuben/pyASC,teuben/pyASC,warnerem/pyASC,teuben/pyASC,teuben/pyASC,warnerem/pyASC,warnerem/pyASC,warnerem/pyASC,warnerem/pyASC,teuben/pyASC,teuben/masc,teuben/masc,teuben/pyASC,warnerem/pyASC,teuben/masc,warnerem/pyASC,teuben/pyASC | examples/fitsdiff2.py | examples/fitsdiff2.py | #! /usr/bin/env python
#
# This routine can diff images from its neighbors. For a series i=1,N
# this can loop over i=2,N to produce N-1 difference images
#
# B_i = A_i - A_i-1
#
from __future__ import print_function
import glob
import sys
import shutil
import os
from astropy.io import fits
import numpy as np
i... | #! /usr/bin/env python
#
# This routine can diff images from its neighbors. For a series i=1,N
# this can loop over i=2,N to produce N-1 difference images
#
# B_i = A_i - A_i-1
#
from __future__ import print_function
import glob
import sys
import shutil
import os
from astropy.io import fits
import numpy as np
i... | mit | Python |
304760823382e72efb8f98ab3b5a98147f98c0e8 | Improve userlist liveness guarentees | ekimekim/girc | geventirc/channel.py | geventirc/channel.py |
import gevent
from geventirc.message import Join, Part, Privmsg
from geventirc.replycodes import replies
from geventirc.userlist import UserList
class Channel(object):
"""Object representing an IRC channel.
This is the reccomended way to do operations like joins, or tracking user lists.
A channel may be join()e... |
import gevent
from geventirc.message import Join, Part, Privmsg
from geventirc.replycodes import replies
from geventirc.userlist import UserList
class Channel(object):
"""Object representing an IRC channel.
This is the reccomended way to do operations like joins, or tracking user lists.
A channel may be join()e... | mit | Python |
cda111aecdd650d1f08b75e2c92774526bf9e06d | Change Misc to Miscellaneous Utilities | demis001/scikit-bio,anderspitman/scikit-bio,johnchase/scikit-bio,SamStudio8/scikit-bio,jairideout/scikit-bio,Achuth17/scikit-bio,Kleptobismol/scikit-bio,jairideout/scikit-bio,xguse/scikit-bio,anderspitman/scikit-bio,wdwvt1/scikit-bio,colinbrislawn/scikit-bio,kdmurray91/scikit-bio,jensreeder/scikit-bio,colinbrislawn/sci... | bipy/util/misc.py | bipy/util/misc.py | #!/usr/bin/env python
r"""
Miscellaneous Utilities (:mod:`bipy.util.misc`)
============================
.. currentmodule:: bipy.util.misc
This module provides miscellaneous useful utility classes and methods that do
not fit in any specific module.
Functions
---------
.. autosummary::
:toctree: generated/
saf... | #!/usr/bin/env python
r"""
Misc (:mod:`bipy.util.misc`)
============================
.. currentmodule:: bipy.util.misc
This module provides miscellaneous useful utility classes and methods that do
not fit in any specific module.
Functions
---------
.. autosummary::
:toctree: generated/
safe_md5
"""
from __f... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.