commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
5f648d6c7f484ae5774d2dbb0a0d3bc7622b3de1 | CodeFights/tryFunctions.py | CodeFights/tryFunctions.py | #!/usr/local/bin/python
# Code Fights Try Functions Problem
import math
def tryFunctions(x, functions):
return [eval(func)(x) for func in functions]
def main():
tests = [
[1, ["math.sin", "math.cos", "lambda x: x * 2", "lambda x: x ** 2"],
[0.84147, 0.5403, 2, 1]],
[-20, ["abs"], [... | Solve Code Fights try functions problem | Solve Code Fights try functions problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/local/bin/python
+# Code Fights Try Functions Problem
+
+import math
+
+
+def tryFunctions(x, functions):
+ return [eval(func)(x) for func in functions]
+
+
+def main():
+ tests = [
+ [1, ["math.sin", "math.cos", "lambda x: x * 2", "lambda x: x ** 2"],
+ [0.84147,... | |
701238e19f4eaa6ce1f1c14e6e56d9544e402ed7 | test/test_language.py | test/test_language.py | import unittest
from charset_normalizer.normalizer import CharsetNormalizerMatches as CnM
from glob import glob
from os.path import basename
class TestLanguageDetection(unittest.TestCase):
SHOULD_BE = {
'sample.1.ar.srt': 'Arabic',
'sample.1.fr.srt': 'French',
'sample.1.gr.srt': 'Greek',
... | Add test to verify if language was detected properly | Add test to verify if language was detected properly
| Python | mit | Ousret/charset_normalizer,ousret/charset_normalizer,Ousret/charset_normalizer,ousret/charset_normalizer | ---
+++
@@ -0,0 +1,48 @@
+import unittest
+from charset_normalizer.normalizer import CharsetNormalizerMatches as CnM
+from glob import glob
+from os.path import basename
+
+
+class TestLanguageDetection(unittest.TestCase):
+ SHOULD_BE = {
+ 'sample.1.ar.srt': 'Arabic',
+ 'sample.1.fr.srt': 'French',
... | |
b08fd9c9770f524ec63d92c11905ab8b2f6ef35f | src/midonet/api.py | src/midonet/api.py | # Copyright 2012 Midokura Japan KK
class PortType:
MATERIALIZED_BRIDGE = "MaterializedBridge";
MATERIALIZED_ROUTER = "MaterializedRouter";
LOGICAL_BRIDGE = "LogicalBridge";
LOGICAL_ROUTER = "LogicalRouter";
| Add constants for port types | Add constants for port types
| Python | apache-2.0 | midokura/python-midonetclient,midokura/python-midonetclient,midonet/python-midonetclient,midonet/python-midonetclient | ---
+++
@@ -0,0 +1,8 @@
+# Copyright 2012 Midokura Japan KK
+
+class PortType:
+ MATERIALIZED_BRIDGE = "MaterializedBridge";
+ MATERIALIZED_ROUTER = "MaterializedRouter";
+ LOGICAL_BRIDGE = "LogicalBridge";
+ LOGICAL_ROUTER = "LogicalRouter";
+ | |
c86f915e324d7e66cb07cbcc9fb827c2dcdeda29 | rst2pdf/utils.py | rst2pdf/utils.py | # -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
#$HeadURL$
#$LastChangedDate$
#$LastChangedRevision$
import shlex
from reportlab.platypus import Spacer
from flowables import *
def parseRaw(data):
"""Parse and process a simple DSL to handle creation of flowables.
Supported (ca... | # -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
#$HeadURL$
#$LastChangedDate$
#$LastChangedRevision$
import shlex
from reportlab.platypus import Spacer
from flowables import *
from styles import adjustUnits
def parseRaw(data):
"""Parse and process a simple DSL to handle creation of f... | Add unit support for spacers | Add unit support for spacers
git-svn-id: 305ad3fa995f01f9ce4b4f46c2a806ba00a97020@779 3777fadb-0f44-0410-9e7f-9d8fa6171d72
| Python | mit | aquavitae/rst2pdf,aquavitae/rst2pdf,sychen/rst2pdf,aquavitae/rst2pdf-py3-dev,tonioo/rst2pdf,tonioo/rst2pdf,openpolis/rst2pdf-patched-docutils-0.8,aquavitae/rst2pdf-py3-dev,sychen/rst2pdf,openpolis/rst2pdf-patched-docutils-0.8 | ---
+++
@@ -9,7 +9,7 @@
from reportlab.platypus import Spacer
from flowables import *
-
+from styles import adjustUnits
def parseRaw(data):
"""Parse and process a simple DSL to handle creation of flowables.
@@ -34,7 +34,8 @@
else:
elements.append(MyPageBreak(tokens[1]))
... |
9dcfd729c9f71794b4a6de649fed92365595034f | tests/gl_test_2.py | tests/gl_test_2.py | #!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import pyglet.window
from pyglet.window.event import *
import time
from pyglet.GL.VERSION_1_1 import *
from pyglet.GLU.VERSION_1_1 import *
from pyglet import clock
factory = pyglet.window.WindowFactory()
factory.config._attribut... | Test two windows drawing GL with different contexts. | Test two windows drawing GL with different contexts.
| Python | bsd-3-clause | mammadori/pyglet,theblacklion/pyglet,niklaskorz/pyglet,theblacklion/pyglet,adamlwgriffiths/Pyglet,seeminglee/pyglet64,theblacklion/pyglet,adamlwgriffiths/Pyglet,oktayacikalin/pyglet,niklaskorz/pyglet,seeminglee/pyglet64,mammadori/pyglet,mammadori/pyglet,adamlwgriffiths/Pyglet,oktayacikalin/pyglet,niklaskorz/pyglet,okta... | ---
+++
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import pyglet.window
+from pyglet.window.event import *
+import time
+
+from pyglet.GL.VERSION_1_1 import *
+from pyglet.GLU.VERSION_1_1 import *
+from pyglet import clock
+
+factory = pyglet.win... | |
6c21b012c8ee8f4bb3f989c999f7d85ad99878b4 | compressImg2TrainData.py | compressImg2TrainData.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
Directory structure
TRAIN_DIR:
label0:
img0001.png
img0002.png
img0003.png
label1:
img0001.png
img0002.png
.
.
.
label9:
img0001.png
'''
import cv2, os
import numpy as np
LABEL_MAGIC_NUMBER = 2049
IMAGE_MAGIC_NUMBER = 2051
TR... | Add a utility file to make a train data for MNIST sample. | Add a utility file to make a train data for MNIST sample.
| Python | apache-2.0 | yoneken/train_tf | ---
+++
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# -*- coding:utf-8 -*-
+
+'''
+Directory structure
+TRAIN_DIR:
+ label0:
+ img0001.png
+ img0002.png
+ img0003.png
+ label1:
+ img0001.png
+ img0002.png
+ .
+ .
+ .
+ label9:
+ img0001.png
+'''
+
+import cv2, os
+import numpy as np
+
+LAB... | |
c613bd3995344bbb164a8f64b39c3a94f6b3ce48 | begood_sites/management/commands/fix_root_site_id.py | begood_sites/management/commands/fix_root_site_id.py | # coding=utf-8
from django.db import connection
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.contrib.sites.models import Site
class Command(BaseCommand):
args = '<id_or_name>'
help = 'Fix any broken article urls due to wrong root site id'
def h... | Add a management command to fix broken article urls when changing root site id. | Add a management command to fix broken article urls when changing root site id.
| Python | mit | AGoodId/begood-sites | ---
+++
@@ -0,0 +1,36 @@
+# coding=utf-8
+
+from django.db import connection
+from django.conf import settings
+from django.core.management.base import BaseCommand, CommandError
+from django.contrib.sites.models import Site
+
+
+class Command(BaseCommand):
+ args = '<id_or_name>'
+ help = 'Fix any broken article ur... | |
a9d5ac5a3ed0d43dfa3a7f7034d7f33771263f91 | tests/unit/utils/format_call_test.py | tests/unit/utils/format_call_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2013 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
tests.unit.utils.format_call_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test `salt.utils... | Add unit tests to `salt.utils.format_call()`. | Add unit tests to `salt.utils.format_call()`.
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+'''
+ :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
+ :copyright: © 2013 by the SaltStack Team, see AUTHORS for more details.
+ :license: Apache 2.0, see LICENSE for more details.
+
+
+ tests.unit.utils.format_call_test
+ ~~~~~~~~~~~~~~~~~~~... | |
67d3a8d5716e9c634c70388361a2fc0edbc80961 | old/request.py | old/request.py | from exchanges import helpers
from exchanges import bitfinex
from exchanges import bitstamp
from exchanges import okcoin
from exchanges import cex
from exchanges import btce
from time import sleep
from datetime import datetime
import csv
# PREPARE OUTPUT FILE
# tell computer where to put CSV
filename = datetime.now(... | Move original to this folder | Move original to this folder
Original was pulling back USD exchanges - now only looking at EUR
exchanges
| Python | mit | Humantrashcan/prices | ---
+++
@@ -0,0 +1,71 @@
+from exchanges import helpers
+from exchanges import bitfinex
+from exchanges import bitstamp
+from exchanges import okcoin
+from exchanges import cex
+from exchanges import btce
+from time import sleep
+from datetime import datetime
+import csv
+
+
+# PREPARE OUTPUT FILE
+
+# tell computer ... | |
80dd6f7c2b3b16e638ab5d836758d5b60c8a82d5 | distutils/tests/test_ccompiler.py | distutils/tests/test_ccompiler.py |
from distutils import ccompiler
def test_set_include_dirs(tmp_path):
"""
Extensions should build even if set_include_dirs is invoked.
In particular, compiler-specific paths should not be overridden.
"""
c_file = tmp_path / 'foo.c'
c_file.write_text('void PyInit_foo(void) {}\n')
compiler =... | Add test capturing failed expectation. | Add test capturing failed expectation.
| Python | mit | pypa/setuptools,pypa/setuptools,pypa/setuptools | ---
+++
@@ -0,0 +1,14 @@
+
+from distutils import ccompiler
+
+
+def test_set_include_dirs(tmp_path):
+ """
+ Extensions should build even if set_include_dirs is invoked.
+ In particular, compiler-specific paths should not be overridden.
+ """
+ c_file = tmp_path / 'foo.c'
+ c_file.write_text('void ... | |
8d9f8277e5d346512f1ecc4fd0be0f757c6dfae9 | ariia/weather_module.py | ariia/weather_module.py | # -*- coding: utf-8 -*-
# !/usr/bin/env python
# MIT License
#
# Copyright (c) 2017 Maxime Busy
#
# 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 limit... | Add the weather module class | Add the weather module class
| Python | mit | Pandhariix/ARIIA | ---
+++
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+# !/usr/bin/env python
+
+# MIT License
+#
+# Copyright (c) 2017 Maxime Busy
+#
+# 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... | |
7d82be33689d5734fd5ec247dafac5c58536e3c9 | tests/actor_test.py | tests/actor_test.py | import unittest
from pykka import Actor
class ActorInterruptTest(unittest.TestCase):
def setUp(self):
class ActorWithInterrupt(Actor):
def run_inside_try(self):
raise KeyboardInterrupt
self.actor = ActorWithInterrupt()
def test_issuing_keyboard_interrupt_stops_proc... | Test clean exit at keyboard interrupt | Test clean exit at keyboard interrupt
| Python | apache-2.0 | jodal/pykka,tempbottle/pykka,tamland/pykka | ---
+++
@@ -0,0 +1,17 @@
+import unittest
+
+from pykka import Actor
+
+class ActorInterruptTest(unittest.TestCase):
+ def setUp(self):
+ class ActorWithInterrupt(Actor):
+ def run_inside_try(self):
+ raise KeyboardInterrupt
+ self.actor = ActorWithInterrupt()
+
+ def tes... | |
c212216b98d3323073b0c2f8d71a2d4543abfcc2 | plots/plot-timing-histograms.py | plots/plot-timing-histograms.py | #!/usr/bin/env python
import climate
import joblib
import lmj.cubes
import lmj.plot
import numpy as np
def diffs(t):
t.load()
return 1000 * np.diff(t.index.values)
def main(root, pattern='*'):
trials = lmj.cubes.Experiment(root).trials_matching(pattern)
values = joblib.Parallel(-1)(joblib.delayed(d... | Add script for plotting time interval hists. | Add script for plotting time interval hists.
| Python | mit | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | ---
+++
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+import climate
+import joblib
+import lmj.cubes
+import lmj.plot
+import numpy as np
+
+
+def diffs(t):
+ t.load()
+ return 1000 * np.diff(t.index.values)
+
+
+def main(root, pattern='*'):
+ trials = lmj.cubes.Experiment(root).trials_matching(pattern)
+ v... | |
f71045f6bef5c8b9f7274ec41a965ccbe1044a01 | examples/test_markers.py | examples/test_markers.py | """ These tests demonstrate pytest marker use for finding and running tests.
Usage examples from this file:
pytest -v -m marker_test_suite # Runs A, B, C, D
pytest -v -m marker1 # Runs A
pytest -v -m marker2 # Runs B, C
... | """ These tests demonstrate pytest marker use for finding and running tests.
Usage examples from this file:
pytest -v -m marker_test_suite # Runs A, B, C, D
pytest -v -m marker1 # Runs A
pytest -v -m marker2 # Runs B, C
... | Update pytest marker test suite | Update pytest marker test suite
| Python | mit | mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase | ---
+++
@@ -4,7 +4,7 @@
pytest -v -m marker_test_suite # Runs A, B, C, D
pytest -v -m marker1 # Runs A
pytest -v -m marker2 # Runs B, C
- pytest -v -m xkcd_code # Runs C
+ pytest -v -m ... |
ce5247a01f5ef84336bd81636fb9c04d90de0c12 | ddm.py | ddm.py | from common import *
from urlgrab import Cache
from re import compile, DOTALL, MULTILINE, sub
from urlparse import urljoin
cache = Cache()
titlePattern = compile("<TITLE>(.*?)</TITLE>")
contentPattern = compile("(?:<BR>\s+<BLOCKQUOTE>|<H3 ALIGN=\"CENTER\">)(.+)</BLOCKQUOTE>.+?<A HREF=\"ancilpag.html#DP\">Dramatis per... | Add specialist creation script for Dark Distorted Mirror | Add specialist creation script for Dark Distorted Mirror
| Python | agpl-3.0 | palfrey/book-blog | ---
+++
@@ -0,0 +1,42 @@
+from common import *
+from urlgrab import Cache
+from re import compile, DOTALL, MULTILINE, sub
+from urlparse import urljoin
+
+cache = Cache()
+
+titlePattern = compile("<TITLE>(.*?)</TITLE>")
+contentPattern = compile("(?:<BR>\s+<BLOCKQUOTE>|<H3 ALIGN=\"CENTER\">)(.+)</BLOCKQUOTE>.+?<A HR... | |
6d6a566d93784022e5b769fc9d26b0f56ac3f18d | bin/2000/shape_msa_tract.py | bin/2000/shape_msa_tract.py | """shape_msa_blockgroup.py
Output one shapefile per MSA containing all the blockgroups it contains
"""
import os
import csv
import fiona
#
# Import MSA to tracts crosswalk
#
msa_to_tract = {}
with open('data/2000/crosswalks/tract.csv', 'r') as source:
reader = csv.reader(source, delimiter='\t')
reader.next(... | Add script to extract the tracts shapes in 2000 MSA | Add script to extract the tracts shapes in 2000 MSA
| Python | bsd-2-clause | scities/2000-us-metro-atlas | ---
+++
@@ -0,0 +1,56 @@
+"""shape_msa_blockgroup.py
+
+Output one shapefile per MSA containing all the blockgroups it contains
+"""
+import os
+import csv
+import fiona
+
+
+#
+# Import MSA to tracts crosswalk
+#
+msa_to_tract = {}
+with open('data/2000/crosswalks/tract.csv', 'r') as source:
+ reader = csv.reade... | |
72437b0ed11bfdc5ff82aeabf69130e683ddeb43 | numba/cuda/tests/cudapy/test_array_methods.py | numba/cuda/tests/cudapy/test_array_methods.py | from __future__ import print_function, absolute_import, division
from numba import unittest_support as unittest
import numpy as np
from numba import cuda
def reinterpret_array_type(byte_arr, start, stop, output):
# Tested with just one thread
val = byte_arr[start:stop].view(np.int32)[0]
output[0] = val
... | Add CUDA GPU test for the .view() array method | Add CUDA GPU test for the .view() array method
| Python | bsd-2-clause | pombredanne/numba,stuartarchibald/numba,GaZ3ll3/numba,pitrou/numba,pombredanne/numba,seibert/numba,cpcloud/numba,gdementen/numba,cpcloud/numba,gmarkall/numba,pitrou/numba,jriehl/numba,IntelLabs/numba,GaZ3ll3/numba,GaZ3ll3/numba,stefanseefeld/numba,stefanseefeld/numba,IntelLabs/numba,IntelLabs/numba,gmarkall/numba,ssara... | ---
+++
@@ -0,0 +1,36 @@
+from __future__ import print_function, absolute_import, division
+
+from numba import unittest_support as unittest
+import numpy as np
+from numba import cuda
+
+
+def reinterpret_array_type(byte_arr, start, stop, output):
+ # Tested with just one thread
+ val = byte_arr[start:stop].vi... | |
0b436265ad984f8750098e56712bb3ac8f917e86 | scripts/make_segue_subsample.py | scripts/make_segue_subsample.py | from astropy.io import fits, ascii
from astropy.table import Table
import numpy as np
sspp = fits.open("/Users/adrian/projects/segue-learn/data/ssppOut-dr9.fits")
all_data = sspp[1].data
best_data = all_data[all_data['FLAG'] == 'nnnnn']
best_data = best_data[(best_data['RV_ADOP'] != -9999) & \
(... | Add script for selecting a segue subsample | Add script for selecting a segue subsample
| Python | bsd-3-clause | adrn/d3po,adrn/d3po,adrn/d3po | ---
+++
@@ -0,0 +1,18 @@
+from astropy.io import fits, ascii
+from astropy.table import Table
+import numpy as np
+
+sspp = fits.open("/Users/adrian/projects/segue-learn/data/ssppOut-dr9.fits")
+all_data = sspp[1].data
+
+best_data = all_data[all_data['FLAG'] == 'nnnnn']
+best_data = best_data[(best_data['RV_ADOP'] !... | |
c4ff6052f6e4fd545ea1c7cb0cd2a53a28ed001d | scripts/state_and_transition.py | scripts/state_and_transition.py | #!/usr/bin/env python
#
# Copyright 2017 Robot Garden, Inc.
#
# 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 applicab... | Move state and transition enums file for re-use | Move state and transition enums file for re-use | Python | apache-2.0 | ProgrammingRobotsStudyGroup/robo_magellan,ProgrammingRobotsStudyGroup/robo_magellan,ProgrammingRobotsStudyGroup/robo_magellan,ProgrammingRobotsStudyGroup/robo_magellan | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Robot Garden, Inc.
+#
+# 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... | |
2b0c7304c1372997bc226d255ef22cc31f56f6fa | caminae/core/management.py | caminae/core/management.py | # http://djangosnippets.org/snippets/2311/
# Ensure South will update our custom SQL during a call to `migrate`.
from south.signals import post_migrate
def run_initial_sql(sender, **kwargs):
app_label = kwargs.get('app')
import os
from django.db import connection, transaction, models
app_dir = os.pat... | Enable auto-loading of raw SQL during South migration | Enable auto-loading of raw SQL during South migration
| Python | bsd-2-clause | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,camillemonchicourt/Geotrek,GeotrekCE/Geotrek-admin,johan--/Geotrek,johan--/Geotrek,mabhub/Geotrek,Anaethelion/Geotrek,mabhub/Geotrek,Anaethelion/Geotrek,camillemonchicourt/Geotrek,makinacorpus/Geotrek,Anaethelion/Geotrek,johan--/Geotrek,mabhub/Geotrek... | ---
+++
@@ -0,0 +1,34 @@
+# http://djangosnippets.org/snippets/2311/
+# Ensure South will update our custom SQL during a call to `migrate`.
+
+from south.signals import post_migrate
+
+
+def run_initial_sql(sender, **kwargs):
+ app_label = kwargs.get('app')
+ import os
+ from django.db import connection, tra... | |
eb9bae2803876f93957e6e2bdd00e57c83cff567 | pikos/monitors/focused_monitor_attach.py | pikos/monitors/focused_monitor_attach.py | # -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Package: Pikos toolkit
# File: monitors/monitor_attach.py
# License: LICENSE.TXT
#
# Copyright (c) 2012, Enthought, Inc.
# All rights reserved.
#----------------------------------------------------------------... | Add a new MonitorAttach class for Focused monitors | Add a new MonitorAttach class for Focused monitors
| Python | bsd-3-clause | enthought/pikos,enthought/pikos,enthought/pikos | ---
+++
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+#------------------------------------------------------------------------------
+# Package: Pikos toolkit
+# File: monitors/monitor_attach.py
+# License: LICENSE.TXT
+#
+# Copyright (c) 2012, Enthought, Inc.
+# All rights reserved.
+#----------------------------... | |
f4e49e2ee6b8ae7b1ab5132b3f900b0002acda54 | docs/source/powerline_autodoc.py | docs/source/powerline_autodoc.py | # vim:fileencoding=utf-8:noet
from sphinx.ext import autodoc
from inspect import formatargspec
from powerline.lint.inspect import getconfigargspec
from powerline.lib.threaded import ThreadedSegment
try:
from __builtin__ import unicode
except ImportError:
unicode = lambda s, enc: s # NOQA
def formatvalue(val):
if... | # vim:fileencoding=utf-8:noet
from sphinx.ext import autodoc
from inspect import formatargspec
from powerline.lint.inspect import getconfigargspec
from powerline.segments import Segment
try:
from __builtin__ import unicode
except ImportError:
unicode = lambda s, enc: s # NOQA
def formatvalue(val):
if type(val) i... | Make powerline autodoc add all Segments | Make powerline autodoc add all Segments
| Python | mit | lukw00/powerline,xfumihiro/powerline,dragon788/powerline,prvnkumar/powerline,magus424/powerline,S0lll0s/powerline,QuLogic/powerline,EricSB/powerline,xxxhycl2010/powerline,lukw00/powerline,firebitsbr/powerline,russellb/powerline,bartvm/powerline,dragon788/powerline,prvnkumar/powerline,S0lll0s/powerline,bartvm/powerline,... | ---
+++
@@ -2,7 +2,7 @@
from sphinx.ext import autodoc
from inspect import formatargspec
from powerline.lint.inspect import getconfigargspec
-from powerline.lib.threaded import ThreadedSegment
+from powerline.segments import Segment
try:
from __builtin__ import unicode
@@ -21,7 +21,7 @@
'''Specialized docum... |
7d7a3a6a71dccec3c44fe8f1dd6576423d2ca278 | formalization/coq2latex.py | formalization/coq2latex.py | #!/usr/bin/python
import sys
import re
from string import Template
def rule2latex(name, premises, conclusion):
return Template(
r"""\newcommand{\rl$name}{\referTo{$name}{rul:$name}}
\newcommand{\show$name}{%
\infer[\rulename{$name}]
{$premises}
{$conclusion}
}""").substitute({"name" : name,
... | Prepare for coq -> latex translation | Prepare for coq -> latex translation
| Python | mit | TheoWinterhalter/formal-type-theory | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+import sys
+import re
+from string import Template
+
+def rule2latex(name, premises, conclusion):
+ return Template(
+r"""\newcommand{\rl$name}{\referTo{$name}{rul:$name}}
+\newcommand{\show$name}{%
+ \infer[\rulename{$name}]
+ {$premises}
+ {$conclusion}
+}"""... | |
9b9582a1b7226ceb9cc65657ffb7fd7d51c8ea2a | lib/exp/featx/__init__.py | lib/exp/featx/__init__.py | __all__ = []
from lib.exp.featx.base import Featx
from lib.exp.tools.slider import Slider
class SlideFeatx(Featx, Slider):
def __init__(self, root, name):
Featx.__init__(self, root, name)
Slider.__init__(self, root, name)
def get_feats(self):
imgl = self.get_slides(None, gray=True, r... | __all__ = []
from lib.exp.featx.base import Feats
from lib.exp.tools.slider import Slider
from lib.exp.tools.video import Video
from lib.exp.prepare import Prepare
class Featx(Feats):
def __init__(self, root, name):
Feats.__init__(self, root, name)
def get_slide_feats(self):
ss = Slider(self... | Change to use `featx` in package | Change to use `featx` in package
| Python | agpl-3.0 | speed-of-light/pyslider | ---
+++
@@ -1,14 +1,22 @@
__all__ = []
-from lib.exp.featx.base import Featx
+from lib.exp.featx.base import Feats
from lib.exp.tools.slider import Slider
+from lib.exp.tools.video import Video
+from lib.exp.prepare import Prepare
-class SlideFeatx(Featx, Slider):
+class Featx(Feats):
def __init__(self, ... |
8db49a2336e733479d8f1dd573b20807763c7681 | gem/migrations/0021_commentcountrule.py | gem/migrations/0021_commentcountrule.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-10-19 11:20
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtail_personalisation', '0012_... | Add migration for the segment | Add migration for the segment
| Python | bsd-2-clause | praekelt/molo-gem,praekelt/molo-gem,praekelt/molo-gem | ---
+++
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.13 on 2017-10-19 11:20
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+import modelcluster.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ... | |
41680da53d5059e3b1e2ce497916f26d4c06cf16 | lowfat/management/commands/fixcw19.py | lowfat/management/commands/fixcw19.py | import datetime
from django.core.management.base import BaseCommand
from lowfat.models import Claimant, Fund, Expense
class Command(BaseCommand):
help = "CW19 funding request"
def handle(self, *args, **options):
for claimant in Claimant.objects.filter(
application_year=2019
)... | Add fix related with CW19 | Add fix related with CW19
| Python | bsd-3-clause | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | ---
+++
@@ -0,0 +1,32 @@
+import datetime
+
+from django.core.management.base import BaseCommand
+
+from lowfat.models import Claimant, Fund, Expense
+
+class Command(BaseCommand):
+ help = "CW19 funding request"
+
+ def handle(self, *args, **options):
+ for claimant in Claimant.objects.filter(
+ ... | |
c2109312996fed550ddbfaf3f39c79b709757a8c | alembic/versions/66ecf0b2aed5_add_pages_table.py | alembic/versions/66ecf0b2aed5_add_pages_table.py | """add pages table
Revision ID: 66ecf0b2aed5
Revises: c7476118715f
Create Date: 2019-06-01 16:10:06.519049
"""
# revision identifiers, used by Alembic.
revision = '66ecf0b2aed5'
down_revision = 'c7476118715f'
import datetime
from alembic import op
import sqlalchemy as sa
def make_timestamp():
now = datetime.d... | Create the table via migration. | Create the table via migration.
| Python | agpl-3.0 | Scifabric/pybossa,Scifabric/pybossa | ---
+++
@@ -0,0 +1,37 @@
+"""add pages table
+
+Revision ID: 66ecf0b2aed5
+Revises: c7476118715f
+Create Date: 2019-06-01 16:10:06.519049
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '66ecf0b2aed5'
+down_revision = 'c7476118715f'
+
+import datetime
+from alembic import op
+import sqlalchemy as sa
+
... | |
b5e6cf14d6f6442e1fb855e0aa19368b2ce6db15 | polyaxon_schemas/pod_lifecycle.py | polyaxon_schemas/pod_lifecycle.py | from hestia.unknown import UNKNOWN
class PodLifeCycle(object):
CONTAINER_CREATING = 'ContainerCreating'
PENDING = 'Pending'
RUNNING = 'Running'
SUCCEEDED = 'Succeeded'
FAILED = 'Failed'
UNKNOWN = UNKNOWN
CHOICES = (
(RUNNING, RUNNING),
(PENDING, PENDING),
(CONTAINE... | Move pod lifecycle to schemas | Move pod lifecycle to schemas
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | ---
+++
@@ -0,0 +1,20 @@
+from hestia.unknown import UNKNOWN
+
+
+class PodLifeCycle(object):
+ CONTAINER_CREATING = 'ContainerCreating'
+ PENDING = 'Pending'
+ RUNNING = 'Running'
+ SUCCEEDED = 'Succeeded'
+ FAILED = 'Failed'
+ UNKNOWN = UNKNOWN
+
+ CHOICES = (
+ (RUNNING, RUNNING),
+ ... | |
649679d67f611e10a4d1821dcfacf01abf7ac5b2 | migrations/versions/0157_add_rate_limit_to_service.py | migrations/versions/0157_add_rate_limit_to_service.py | """
Revision ID: 0157_add_rate_limit_to_service
Revises: 0156_set_temp_letter_contact
Create Date: 2018-01-08 16:13:25.733336
"""
from alembic import op
import sqlalchemy as sa
revision = '0157_add_rate_limit_to_service'
down_revision = '0156_set_temp_letter_contact'
def upgrade():
op.add_column('services', s... | Add rate_limit column to service model | Add rate_limit column to service model
The API rate limit will be removed from the config and added to services
so that it is possible to change the rate_limit for individual services
in rare cases.
Pivotal story: https://www.pivotaltracker.com/story/show/153992529
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,23 @@
+"""
+
+Revision ID: 0157_add_rate_limit_to_service
+Revises: 0156_set_temp_letter_contact
+Create Date: 2018-01-08 16:13:25.733336
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+revision = '0157_add_rate_limit_to_service'
+down_revision = '0156_set_temp_letter_contact'
+
+
+def... | |
02ca253332acacc95e94f0fced2d37c64d804c22 | kqueen_ui/generic_views.py | kqueen_ui/generic_views.py | from flask import flash, session
from flask.views import View
from kqueen_ui.api import get_kqueen_client, get_service_client
import logging
logger = logging.getLogger(__name__)
class KQueenView(View):
"""
KQueen UI base view with methods to handle backend API calls.
"""
def _get_kqueen_client(self)... | Add base class for KQueen UI views | Add base class for KQueen UI views
| Python | mit | atengler/kqueen-ui,atengler/kqueen-ui,atengler/kqueen-ui,atengler/kqueen-ui | ---
+++
@@ -0,0 +1,70 @@
+from flask import flash, session
+from flask.views import View
+from kqueen_ui.api import get_kqueen_client, get_service_client
+
+import logging
+
+logger = logging.getLogger(__name__)
+
+
+class KQueenView(View):
+ """
+ KQueen UI base view with methods to handle backend API calls.
+... | |
b69462f1c671f84c379beca2eaf8b72386f4e2e4 | math/sum_of_digits/python/sum_of_digits.py | math/sum_of_digits/python/sum_of_digits.py | def sum_of_digits(n):
sum = 0;
for i in str(n):
sum += int(i)
return sum
print sum_of_digits(3) #3
print sum_of_digits(3454332) #24
| Implement Sum Of Digits in Python | Implement Sum Of Digits in Python
| Python | cc0-1.0 | ZoranPandovski/al-go-rithms,Deepak345/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,manikTharaka/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-rithms,Deepak345/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-rithms,Deepak34... | ---
+++
@@ -0,0 +1,9 @@
+def sum_of_digits(n):
+ sum = 0;
+ for i in str(n):
+ sum += int(i)
+
+ return sum
+
+print sum_of_digits(3) #3
+print sum_of_digits(3454332) #24 | |
4146e6cb20197ced3c5c62e9fc2ff7626920d6c0 | POST_TEST.py | POST_TEST.py | from posts.nc import *
import posts.iso
output('POST_TEST.txt')
program_begin(123, 'Test program')
absolute()
metric()
set_plane(0)
feedrate(420)
rapid(100,120)
rapid(z=50)
feed(z=0)
rapid(z=50)
rapid_home()
program_end()
| Test for ISO NC creator | Test for ISO NC creator
| Python | bsd-3-clause | silasb/heekscnc,silasb/heekscnc,silasb/heekscnc | ---
+++
@@ -0,0 +1,19 @@
+from posts.nc import *
+import posts.iso
+
+output('POST_TEST.txt')
+
+program_begin(123, 'Test program')
+absolute()
+metric()
+set_plane(0)
+
+feedrate(420)
+rapid(100,120)
+rapid(z=50)
+feed(z=0)
+rapid(z=50)
+
+rapid_home()
+
+program_end() | |
50b16f7e3996308ae720a3f186a7a3f8031c07a5 | split-hathitrust.py | split-hathitrust.py | import os
# Download up to date filelist
os.system("rsync -azv " +
"data.analytics.hathitrust.org::features/listing/htrc-ef-all-files.txt" +
" .")
# Load the file list
infile = open("htrc-ef-all-files.txt")
i = 0
j = 1
# Write out each set of 10000 files as their own list
curout = open("filelists... | Implement method for splitting files for batch processing | Implement method for splitting files for batch processing
| Python | mit | bacovcin/hathitrust-features-database,bacovcin/hathitrust-features-database,bacovcin/hathitrust-features-database | ---
+++
@@ -0,0 +1,22 @@
+import os
+
+# Download up to date filelist
+os.system("rsync -azv " +
+ "data.analytics.hathitrust.org::features/listing/htrc-ef-all-files.txt" +
+ " .")
+
+# Load the file list
+infile = open("htrc-ef-all-files.txt")
+i = 0
+j = 1
+
+# Write out each set of 10000 files as... | |
344b6d4a9675aaf38d3cce97f18be0c365c4110c | db/goalie_game.py | db/goalie_game.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .common import Base
class GoalieGame(Base):
__tablename__ = 'goalie_games'
__autoload__ = True
STANDARD_ATTRS = [
"position", "no", "goals", "assists", "primary_assists",
"secondary_assists", "points", "plus_minus", "penalties", "pim",
... | Add initial version of goalie game item | Add initial version of goalie game item
| Python | mit | leaffan/pynhldb | ---
+++
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from .common import Base
+
+
+class GoalieGame(Base):
+ __tablename__ = 'goalie_games'
+ __autoload__ = True
+
+ STANDARD_ATTRS = [
+ "position", "no", "goals", "assists", "primary_assists",
+ "secondary_assists", "poin... | |
f02ff643e341f92d6e75ef79b42fcd2f15d05e8d | exp/influence2/GensimExp.py | exp/influence2/GensimExp.py | import gensim
import gensim.matutils
import logging
import sys
import numpy
import sklearn.feature_extraction.text as text
import scipy.sparse
from exp.util.PorterTokeniser import PorterTokeniser
from gensim.models.ldamodel import LdaModel
from exp.util.SparseUtils import SparseUtils
from apgl.data.Standardiser im... | Check we are using LDA correctly | Check we are using LDA correctly | Python | bsd-3-clause | charanpald/APGL | ---
+++
@@ -0,0 +1,62 @@
+import gensim
+import gensim.matutils
+import logging
+import sys
+import numpy
+import sklearn.feature_extraction.text as text
+import scipy.sparse
+from exp.util.PorterTokeniser import PorterTokeniser
+from gensim.models.ldamodel import LdaModel
+from exp.util.SparseUtils import Spars... | |
97be289976d107f6ef72e797a67489319a980773 | steamweb/steamwebbrowsertk.py | steamweb/steamwebbrowsertk.py | from .steamwebbrowser import SteamWebBrowserCfg
from sys import version_info
from PIL.ImageTk import PhotoImage
if version_info.major >= 3: # Python3
import tkinter as tk
else: # Python 2
import Tkinter as tk
class SteamWebBrowserTk(SteamWebBrowserCfg):
''' SteamWebBrowserCfg with Tkinter UI for displaying... | Add Tkinter UI class from jbzdarkid | Add Tkinter UI class from jbzdarkid
| Python | agpl-3.0 | jayme-github/steamweb,jbzdarkid/steamweb | ---
+++
@@ -0,0 +1,34 @@
+from .steamwebbrowser import SteamWebBrowserCfg
+from sys import version_info
+from PIL.ImageTk import PhotoImage
+if version_info.major >= 3: # Python3
+ import tkinter as tk
+else: # Python 2
+ import Tkinter as tk
+
+class SteamWebBrowserTk(SteamWebBrowserCfg):
+ ''' SteamWebBrow... | |
99454f1b62f1770e08c29db727d3b790787a6fa0 | pcloudpy/core/filters/DisplayNormals.py | pcloudpy/core/filters/DisplayNormals.py | from vtk import vtkArrowSource, vtkGlyph3D, vtkPolyData
from vtk import vtkRenderer, vtkRenderWindowInteractor, vtkPolyDataMapper, vtkActor, vtkRenderWindow
from .base import FilterBase
class DisplayNormals(FilterBase):
def __init__(self):
super(DisplayNormals, self).__init__()
def set_input(self, ... | Add Filter that display normal vector (it needs the pre-computed normal vectors) | Add Filter that display normal vector (it needs the pre-computed normal vectors)
| Python | bsd-3-clause | mmolero/pcloudpy | ---
+++
@@ -0,0 +1,39 @@
+from vtk import vtkArrowSource, vtkGlyph3D, vtkPolyData
+from vtk import vtkRenderer, vtkRenderWindowInteractor, vtkPolyDataMapper, vtkActor, vtkRenderWindow
+
+
+from .base import FilterBase
+
+class DisplayNormals(FilterBase):
+
+ def __init__(self):
+ super(DisplayNormals, self)... | |
b16ac90d152bc4883162df235b837726c60ce94f | dacapo_analyzer.py | dacapo_analyzer.py | import re
BENCHMARKS = set(( 'avrora'
, 'batik'
, 'eclipse'
, 'fop'
, 'h2'
, 'jython'
, 'luindex'
, 'lusearch'
, 'pmd'
, 'sunflow'
... | Add basic dacapo wallclock analyzer. | [client] Add basic dacapo wallclock analyzer.
Signed-off-by: Michael Markert <5eb998b7ac86da375651a4cd767b88c9dad25896@googlemail.com>
| Python | mit | fhirschmann/penchy,fhirschmann/penchy | ---
+++
@@ -0,0 +1,26 @@
+import re
+
+BENCHMARKS = set(( 'avrora'
+ , 'batik'
+ , 'eclipse'
+ , 'fop'
+ , 'h2'
+ , 'jython'
+ , 'luindex'
+ , 'lusearch'
+ , 'pmd'
+ ... | |
f0e180387a37437fe7e8d37fa2806e7d47736bfc | pyheufybot/bothandler.py | pyheufybot/bothandler.py | import os
from twisted.internet import reactor
from heufybot import HeufyBot, HeufyBotFactory
from config import Config
class BotHandler(object):
factories = {}
globalConfig = None
def __init__(self):
print "--- Loading configs..."
self.globalConfig = Config("globalconfig.yml")
sel... | import os
from twisted.internet import reactor
from heufybot import HeufyBot, HeufyBotFactory
from config import Config
class BotHandler(object):
factories = {}
globalConfig = None
def __init__(self):
print "--- Loading configs..."
self.globalConfig = Config("globalconfig.yml")
... | Make sure the application doesn't continue without a config | Make sure the application doesn't continue without a config
| Python | mit | Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot | ---
+++
@@ -10,7 +10,9 @@
def __init__(self):
print "--- Loading configs..."
self.globalConfig = Config("globalconfig.yml")
- self.globalConfig.loadConfig(None)
+
+ if not self.globalConfig.loadConfig(None):
+ return
configList = self.getConfigList(... |
8fc31b8a5c36467ca44f88fedaf0e9f6b47bade9 | genealogio/migrations/0025_auto_20160316_2247.py | genealogio/migrations/0025_auto_20160316_2247.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('genealogio', '0024_auto_20160316_2039'),
]
operations = [
migrations.AlterModelOptions(
name='event',
... | Sort events by date, add missing migration | Sort events by date, add missing migration
| Python | bsd-3-clause | ugoertz/django-familio,ugoertz/django-familio,ugoertz/django-familio,ugoertz/django-familio | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('genealogio', '0024_auto_20160316_2039'),
+ ]
+
+ operations = [
+ migrations.AlterModelOpti... | |
a2708fcbf836c9ecb9efc546606ce6011a08f15a | firs_test_add_group.py | firs_test_add_group.py | # -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.action_chains import ActionChains
import time, unittest
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class firs_test_add_group(... | Add test by selenium builder | Add test by selenium builder
| Python | apache-2.0 | maximatorrus/automated_testing_python | ---
+++
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+from selenium.webdriver.firefox.webdriver import WebDriver
+from selenium.webdriver.common.action_chains import ActionChains
+import time, unittest
+
+def is_alert_present(wd):
+ try:
+ wd.switch_to_alert().text
+ return True
+ except:
+ re... | |
a387c0307f55d635d4a6064a3df2e77ecf9e1157 | st2common/tests/unit/test_util_types.py | st2common/tests/unit/test_util_types.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Add tests for OrderedSet type. | Add tests for OrderedSet type.
| Python | apache-2.0 | Plexxi/st2,StackStorm/st2,nzlosh/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2 | ---
+++
@@ -0,0 +1,37 @@
+# Licensed to the StackStorm, Inc ('StackStorm') under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (th... | |
906440692ae179c5ce4ee8211b13121e025c2651 | ideascube/conf/idb_de_dusseldorf.py | ideascube/conf/idb_de_dusseldorf.py | # -*- coding: utf-8 -*-
"""Ideaxbox for Welcome Point, Dusseldorf"""
from .idb import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_NAME = u"Welcome Point Dusseldorf"
IDEASCUBE_PLACE_NAME = _("city")
COUNTRIES_FIRST = ['DE']
TIME_ZONE = None
LANGUAGE_CODE = 'de'
LOAN_DURATION = 14
MONITOR... | Add conf file for Welcome Point Dusseldorf, DE | Add conf file for Welcome Point Dusseldorf, DE
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+"""Ideaxbox for Welcome Point, Dusseldorf"""
+from .idb import * # noqa
+from django.utils.translation import ugettext_lazy as _
+
+IDEASCUBE_NAME = u"Welcome Point Dusseldorf"
+IDEASCUBE_PLACE_NAME = _("city")
+COUNTRIES_FIRST = ['DE']
+TIME_ZONE = None
+LANGUAGE_C... | |
3849b0a5cae5ca7d214c864fa1722a9da98a3ec2 | indra/sources/minerva/id_mapping.py | indra/sources/minerva/id_mapping.py | from indra.databases import chebi_client
from indra.ontology.standardize import standardize_db_refs
minerva_to_indra_map = {
'UNIPROT': 'UP',
'REFSEQ': 'REFSEQ_PROT',
'ENTREZ': 'EGID',
'INTERPRO': 'IP',
}
def fix_id_standards(db_ns, db_id):
if db_ns == 'CHEBI':
if not db_id.startswith('C... | Move relevant parts of ID mapping from covid-19 | Move relevant parts of ID mapping from covid-19
| Python | bsd-2-clause | sorgerlab/belpy,sorgerlab/indra,bgyori/indra,bgyori/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,sorgerlab/indra,johnbachman/indra,bgyori/indra,johnbachman/indra,sorgerlab/belpy | ---
+++
@@ -0,0 +1,31 @@
+from indra.databases import chebi_client
+from indra.ontology.standardize import standardize_db_refs
+
+
+minerva_to_indra_map = {
+ 'UNIPROT': 'UP',
+ 'REFSEQ': 'REFSEQ_PROT',
+ 'ENTREZ': 'EGID',
+ 'INTERPRO': 'IP',
+}
+
+
+def fix_id_standards(db_ns, db_id):
+ if db_ns == 'C... | |
fa8099ebbf06fc45e62d8b1ed6a12b5a2405476c | stdnum/imo.py | stdnum/imo.py | # imo.py - functions for handling IMO numbers
# coding: utf-8
#
# Copyright (C) 2015 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, ... | Add int. maritime org. number (IMO) | Add int. maritime org. number (IMO)
This adds checks for the International Maritime Organization number used
to identify ships. However, there seem to be a lot of ships with an IMO
number that does not follow these rules (different check digits or even
length).
| Python | lgpl-2.1 | holvi/python-stdnum,holvi/python-stdnum,arthurdejong/python-stdnum,holvi/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum | ---
+++
@@ -0,0 +1,85 @@
+# imo.py - functions for handling IMO numbers
+# coding: utf-8
+#
+# Copyright (C) 2015 Arthur de Jong
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; ei... | |
1965291f9e67b1b7923353f1b8892e0fabb543d4 | dyngraph/cycledetect_ui.py | dyngraph/cycledetect_ui.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\cycledetect.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8... | Add compiled cycle detect ui. | Add compiled cycle detect ui.
| Python | isc | jaj42/dyngraph,jaj42/GraPhysio,jaj42/GraPhysio | ---
+++
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '.\cycledetect.ui'
+#
+# Created by: PyQt4 UI code generator 4.11.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+try:
+ _fromUtf8 = QtCore.QString.fromUtf8
+... | |
676fd73fa8c6b5a70e5caef6d6b195e4676a0a18 | tests/test_prefix_q_expression.py | tests/test_prefix_q_expression.py | from unittest import TestCase
from django.db.models import Q
from binder.views import prefix_q_expression
from binder.permissions.views import is_q_child_equal
from .testapp.models import Animal
class TestPrefixQExpression(TestCase):
def test_simple_prefix(self):
self.assertTrue(is_q_child_equal(
prefix_q_e... | Add tests for prefix Q expression | Add tests for prefix Q expression
| Python | mit | CodeYellowBV/django-binder | ---
+++
@@ -0,0 +1,53 @@
+from unittest import TestCase
+
+from django.db.models import Q
+
+from binder.views import prefix_q_expression
+from binder.permissions.views import is_q_child_equal
+
+from .testapp.models import Animal
+
+
+class TestPrefixQExpression(TestCase):
+
+ def test_simple_prefix(self):
+ self.a... | |
7389c85979127a48e0ce9b2f11e611c212a95524 | akhet/__init__.py | akhet/__init__.py | from akhet.static import add_static_route
def includeme(config):
"""Add certain useful methods to a Pyramid ``Configurator`` instance.
Currently this adds the ``.add_static_route()`` method. (See
``pyramid_sqla.static.add_static_route()``.)
"""
config.add_directive('add_static_route', add_static_r... | Add 'includeme' function. (Accidently put in SQLAHelper.) | Add 'includeme' function. (Accidently put in SQLAHelper.)
| Python | mit | Pylons/akhet,hlwsmith/akhet,hlwsmith/akhet,hlwsmith/akhet,Pylons/akhet | ---
+++
@@ -0,0 +1,9 @@
+from akhet.static import add_static_route
+
+def includeme(config):
+ """Add certain useful methods to a Pyramid ``Configurator`` instance.
+
+ Currently this adds the ``.add_static_route()`` method. (See
+ ``pyramid_sqla.static.add_static_route()``.)
+ """
+ config.add_directi... | |
a53cf07d2b6f246bae866210fef6ad9988bce885 | scripts/ttfaddemptyot.py | scripts/ttfaddemptyot.py | #!/usr/bin/python
from fontTools import ttLib
from fontTools.ttLib.tables import otTables
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('infont', help='Input font file')
parser.add_argument('outfont', help='Output font file')
parser.add_argument('-s','--script',default='DFLT', help... | Add a new fonttools based tool | Add a new fonttools based tool
| Python | mit | moyogo/pysilfont,moyogo/pysilfont | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+from fontTools import ttLib
+from fontTools.ttLib.tables import otTables
+from argparse import ArgumentParser
+
+parser = ArgumentParser()
+parser.add_argument('infont', help='Input font file')
+parser.add_argument('outfont', help='Output font file')
+parser.add_argument... | |
8718254272de33d77de03536b5fe26ad781b47b5 | astroid/tests/unittest_brain_numpy_core_fromnumeric.py | astroid/tests/unittest_brain_numpy_core_fromnumeric.py | # -*- encoding=utf-8 -*-
# Copyright (c) 2017-2018 hippo91 <guillaume.peillex@gmail.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
import unittest
import contextlib
try:
import numpy # pylint: d... | Add a unittest dedicated to the numpy_core_fromnumeric brain | Add a unittest dedicated to the numpy_core_fromnumeric brain
| Python | lgpl-2.1 | PyCQA/astroid | ---
+++
@@ -0,0 +1,77 @@
+# -*- encoding=utf-8 -*-
+# Copyright (c) 2017-2018 hippo91 <guillaume.peillex@gmail.com>
+
+# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
+# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
+import unittest
+import contextlib
+... | |
33bc340a84b597ae649c1c394bda3978cae1f789 | tests/test__chrooting.py | tests/test__chrooting.py | import os
import platform
import tempfile
from .test_utils import EnvironmentTestCase
_EXPECTED_FILE_IN_MOUNT_NAME = "{mount_name}_file"
class ChrootingTestCase(EnvironmentTestCase):
def setUp(self):
super(ChrootingTestCase, self).setUp()
if os.getuid() != 0:
self.skipTest("Not root")
... | Add chrooting test (requires vagrant environment) | Add chrooting test (requires vagrant environment)
| Python | bsd-3-clause | vmalloc/dwight,vmalloc/dwight,vmalloc/dwight | ---
+++
@@ -0,0 +1,21 @@
+import os
+import platform
+import tempfile
+from .test_utils import EnvironmentTestCase
+
+_EXPECTED_FILE_IN_MOUNT_NAME = "{mount_name}_file"
+
+class ChrootingTestCase(EnvironmentTestCase):
+ def setUp(self):
+ super(ChrootingTestCase, self).setUp()
+ if os.getuid() != 0:
... | |
14148af45fa9b6a0377df866e202edab561df12d | tests/api/tourney/match/comments/test_view_for_match_as_json.py | tests/api/tourney/match/comments/test_view_for_match_as_json.py | """
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import pytest
from byceps.services.tourney import match_comment_service, match_service
def test_view_for_match_as_json(api_client, api_client_authz_header, match, comment):
url = f'/api/tourney/matches/{match.id}... | Test tourney match comments retrieval as JSON | Test tourney match comments retrieval as JSON
| Python | bsd-3-clause | homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps | ---
+++
@@ -0,0 +1,51 @@
+"""
+:Copyright: 2006-2019 Jochen Kupperschmidt
+:License: Modified BSD, see LICENSE for details.
+"""
+
+import pytest
+
+from byceps.services.tourney import match_comment_service, match_service
+
+
+def test_view_for_match_as_json(api_client, api_client_authz_header, match, comment):
+ ... | |
41b1d7e8d4f719b979cb60db9a4e840cb69ec6d0 | scripts/MammalSuperTree.py | scripts/MammalSuperTree.py | #retriever
from retriever.lib.templates import DownloadOnlyTemplate
SCRIPT = DownloadOnlyTemplate(name="Mammal Super Tree",
shortname='mammsupertree',
ref='http://doi.org/10.1111/j.1461-0248.2009.01307.x',
description="Mammal Sup... | Add a script to download the mammal super tree | Add a script to download the mammal super tree
| Python | mit | davharris/retriever,henrykironde/deletedret,goelakash/retriever,henrykironde/deletedret,bendmorris/retriever,davharris/retriever,bendmorris/retriever,davharris/retriever,bendmorris/retriever,embaldridge/retriever,embaldridge/retriever,embaldridge/retriever,goelakash/retriever | ---
+++
@@ -0,0 +1,8 @@
+#retriever
+from retriever.lib.templates import DownloadOnlyTemplate
+
+SCRIPT = DownloadOnlyTemplate(name="Mammal Super Tree",
+ shortname='mammsupertree',
+ ref='http://doi.org/10.1111/j.1461-0248.2009.01307.x',
+ ... | |
c3cb492aed8140e3a58fb09212d236689a677437 | scripts/draw_square.ext.py | scripts/draw_square.ext.py | from nxt.motor import PORT_A, PORT_B, PORT_C
from .helpers.robot import Robot, SERVO_NICE
def main():
robot = Robot(debug=True, verbose=True)
# Motors
robot.init_synchronized_motors(PORT_A, PORT_C)
robot.init_servo(PORT_B)
robot.set_servo(SERVO_NICE)
sides = 4 # Spoiler alert! It's a square... | Add experimental version of 'Draw a square' :fire: | Add experimental version of 'Draw a square' :fire:
| Python | mit | richin13/nxt-scripts | ---
+++
@@ -0,0 +1,25 @@
+from nxt.motor import PORT_A, PORT_B, PORT_C
+from .helpers.robot import Robot, SERVO_NICE
+
+
+def main():
+ robot = Robot(debug=True, verbose=True)
+
+ # Motors
+ robot.init_synchronized_motors(PORT_A, PORT_C)
+ robot.init_servo(PORT_B)
+
+ robot.set_servo(SERVO_NICE)
+ s... | |
95a1c54cc728c11d693e19a70e0691c077251d2f | tests/quick_test.py | tests/quick_test.py | #!/usr/bin/env python3
import dirty_water
rxn = dirty_water.Reaction()
rxn.num_reactions = 10
rxn['Cas9'].std_volume = 1, 'μL'
rxn['Cas9'].std_stock_conc = 20, 'μM'
rxn['Cas9'].master_mix = True
rxn['Cas9'].conc = 4
rxn['buffer'].std_volume = 1, 'μL'
rxn['buffer'].std_stock_conc = '10x'
rxn['buffer'].master_mix = T... | Add a very weak test of the Reaction API. | Add a very weak test of the Reaction API.
| Python | mit | kalekundert/dirty_water | ---
+++
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+
+import dirty_water
+
+rxn = dirty_water.Reaction()
+rxn.num_reactions = 10
+
+rxn['Cas9'].std_volume = 1, 'μL'
+rxn['Cas9'].std_stock_conc = 20, 'μM'
+rxn['Cas9'].master_mix = True
+rxn['Cas9'].conc = 4
+
+rxn['buffer'].std_volume = 1, 'μL'
+rxn['buffer'].std_stock_... | |
5d1b7b38b70dfa17bc7c468fb49e3e576c9accc0 | tests/range_test.py | tests/range_test.py | """Tests for the range class."""
from sympy import sympify
from drudge import Range
def test_range_has_basic_operations():
"""Test the basic operations on ranges."""
a_symb = sympify('a')
b_symb = sympify('b')
bound0 = Range('B', 'a', 'b')
bound1 = Range('B', a_symb, b_symb)
symb0 = Range(... | Add tests for the symbolic ranges | Add tests for the symbolic ranges
| Python | mit | tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge | ---
+++
@@ -0,0 +1,36 @@
+"""Tests for the range class."""
+
+from sympy import sympify
+
+from drudge import Range
+
+
+def test_range_has_basic_operations():
+ """Test the basic operations on ranges."""
+
+ a_symb = sympify('a')
+ b_symb = sympify('b')
+
+ bound0 = Range('B', 'a', 'b')
+ bound1 = Ran... | |
32f3a42c04a1ae8729e08bf7ce67a1f01f7ac2b3 | lib/receiving_widget.py | lib/receiving_widget.py | from PyQt4.QtGui import *
from PyQt4.QtCore import *
from i18n import _
class ReceivingWidget(QTreeWidget):
def toggle_used(self):
if self.hide_used:
self.hide_used = False
self.setColumnHidden(2, False)
else:
self.hide_used = True
self.setColumnHidd... | Add receiving widget for lite gui | Add receiving widget for lite gui
| Python | mit | molecular/electrum,cryptapus/electrum-uno,pknight007/electrum-vtc,cryptapus/electrum-myr,molecular/electrum,cryptapus/electrum-uno,dashpay/electrum-dash,lbryio/lbryum,dabura667/electrum,procrasti/electrum,digitalbitbox/electrum,wakiyamap/electrum-mona,cryptapus/electrum-myr,kyuupichan/electrum,neocogent/electrum,spesmi... | ---
+++
@@ -0,0 +1,72 @@
+from PyQt4.QtGui import *
+from PyQt4.QtCore import *
+from i18n import _
+
+class ReceivingWidget(QTreeWidget):
+
+ def toggle_used(self):
+ if self.hide_used:
+ self.hide_used = False
+ self.setColumnHidden(2, False)
+ else:
+ self.hide_use... | |
36efa6e2615bdd600d80cc87ada27984c9806135 | articles/search_indexes.py | articles/search_indexes.py | from haystack.indexes import *
from haystack import site
from models import Article
class ArticleIndex(SearchIndex):
name = CharField(model_attr='title')
text = CharField(document=True, use_template=True)
def get_queryset(self):
"""Used when the entire index for model is updated."""
return... | Add search index file - currently search across Articles, extend to search across Categories? | Add search index file - currently search across Articles, extend to search across Categories?
| Python | bsd-2-clause | incuna/feincms-articles,michaelkuty/feincms-articles,incuna/feincms-articles,michaelkuty/feincms-articles | ---
+++
@@ -0,0 +1,14 @@
+from haystack.indexes import *
+from haystack import site
+from models import Article
+
+class ArticleIndex(SearchIndex):
+ name = CharField(model_attr='title')
+ text = CharField(document=True, use_template=True)
+
+ def get_queryset(self):
+ """Used when the entire index fo... | |
b2bc2f08d69ea42f9cecf6f994b1ed3c8e9f8022 | py/minimum-number-of-arrows-to-burst-balloons.py | py/minimum-number-of-arrows-to-burst-balloons.py | from operator import itemgetter
class Solution(object):
def findMinArrowShots(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
points.sort(key=itemgetter(1))
end = None
ans = 0
for p in points:
if end is None or end < p[0]:
... | Add py solution for 452. Minimum Number of Arrows to Burst Balloons | Add py solution for 452. Minimum Number of Arrows to Burst Balloons
452. Minimum Number of Arrows to Burst Balloons: https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,15 @@
+from operator import itemgetter
+class Solution(object):
+ def findMinArrowShots(self, points):
+ """
+ :type points: List[List[int]]
+ :rtype: int
+ """
+ points.sort(key=itemgetter(1))
+ end = None
+ ans = 0
+ for p in points:
+ ... | |
1360b8c4f6422dc8149ba40bb9a0717e796049e0 | tests/test_posix.py | tests/test_posix.py |
import sys
import nose.tools
from simuvex import SimState
def test_file_create():
# Create a state first
state = SimState(arch="AMD64", mode='symbolic')
# Create a file
fd = state.posix.open("test", "wb")
nose.tools.assert_equal(fd, 3)
def test_file_read():
state = SimState(arch="AMD64", ... | Add a very simple test case for posix file support. | Add a very simple test case for posix file support.
| Python | bsd-2-clause | angr/angr,f-prettyland/angr,axt/angr,schieb/angr,schieb/angr,chubbymaggie/angr,iamahuman/angr,tyb0807/angr,axt/angr,chubbymaggie/simuvex,schieb/angr,angr/angr,chubbymaggie/simuvex,tyb0807/angr,angr/angr,chubbymaggie/simuvex,f-prettyland/angr,f-prettyland/angr,axt/angr,angr/simuvex,chubbymaggie/angr,iamahuman/angr,iamah... | ---
+++
@@ -0,0 +1,76 @@
+
+import sys
+
+import nose.tools
+
+from simuvex import SimState
+
+def test_file_create():
+ # Create a state first
+ state = SimState(arch="AMD64", mode='symbolic')
+
+ # Create a file
+ fd = state.posix.open("test", "wb")
+
+ nose.tools.assert_equal(fd, 3)
+
+def test_file... | |
328c373495e94005a97a907ac023cb52bc47e20c | find_dups.py | find_dups.py | import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt
import store, config
try:
config = config.Config(sys.argv[1], 'webui')
except IndexError:
print "Usage: find_dups.py config.ini"
raise SystemExit
store = store.Store(config)
store.open()
def owner_email(p):
result = set()
for r,u ... | Add script to email users of name-conflicting packages. | Add script to email users of name-conflicting packages.
git-svn-id: 757818eefc3e095bf4f5c16d67ad3f55b5150c3d@532 072f9a9a-8cf7-0310-8ca5-bf92c90cb7c1
| Python | bsd-3-clause | ericholscher/pypi,ericholscher/pypi | ---
+++
@@ -0,0 +1,46 @@
+import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt
+import store, config
+
+try:
+ config = config.Config(sys.argv[1], 'webui')
+except IndexError:
+ print "Usage: find_dups.py config.ini"
+ raise SystemExit
+
+store = store.Store(config)
+store.open()
+
+def owner_e... | |
c6928a6070aaf0fadfb1d9f4071a8440224a247a | tests/printInput.py | tests/printInput.py | #!/usr/bin/env python3
import sys
if len(sys.argv) != 2:
sys.exit("Usage:\n\t%s <testcase>" % (sys.argv[0],))
testcase = sys.argv[1]
exec(open(testcase).read())
for i in ['input']:
if i not in locals():
sys.exit("Testcase %s does not provide variable '%s'" % (testcase, i))
print(input)
| Add script to extract input from testcases. | Add script to extract input from testcases.
| Python | apache-2.0 | alviano/wasp,alviano/wasp,alviano/wasp,Yarrick13/hwasp,gaste/dwasp,gaste/dwasp,Yarrick13/hwasp,gaste/dwasp,Yarrick13/hwasp | ---
+++
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import sys
+
+if len(sys.argv) != 2:
+ sys.exit("Usage:\n\t%s <testcase>" % (sys.argv[0],))
+
+testcase = sys.argv[1]
+
+exec(open(testcase).read())
+for i in ['input']:
+ if i not in locals():
+ sys.exit("Testcase %s does not provide variable '%s'" % (... | |
ff179b6215366676d92d39f255682781fe6b40eb | oscarapi/tests/testvoucher.py | oscarapi/tests/testvoucher.py | from django.utils import timezone
from oscar.core.loading import get_model
from oscarapi.tests.utils import APITest
Basket = get_model('basket', 'Basket')
ConditionalOffer = get_model('offer', 'ConditionalOffer')
Voucher = get_model('voucher', 'Voucher')
class VoucherTest(APITest):
fixtures = [
'produ... | Add a test for the api-basket-add-voucher view | Add a test for the api-basket-add-voucher view
| Python | bsd-3-clause | regulusweb/django-oscar-api,crgwbr/django-oscar-api | ---
+++
@@ -0,0 +1,57 @@
+from django.utils import timezone
+
+from oscar.core.loading import get_model
+
+from oscarapi.tests.utils import APITest
+
+
+Basket = get_model('basket', 'Basket')
+ConditionalOffer = get_model('offer', 'ConditionalOffer')
+Voucher = get_model('voucher', 'Voucher')
+
+
+class VoucherTest(A... | |
dbaccbddfe36c32444c61df5ac6ffd238d3d022b | py/longest-word-in-dictionary.py | py/longest-word-in-dictionary.py | class Solution(object):
def longestWord(self, words):
"""
:type words: List[str]
:rtype: str
"""
words = sorted(words, key=lambda w:(len(w), w))
prefix_dict = set()
max_word = ''
for w in words:
if len(w) == 1 or w[:-1] in prefix_dict:
... | Add py solution for 720. Longest Word in Dictionary | Add py solution for 720. Longest Word in Dictionary
720. Longest Word in Dictionary: https://leetcode.com/problems/longest-word-in-dictionary/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,15 @@
+class Solution(object):
+ def longestWord(self, words):
+ """
+ :type words: List[str]
+ :rtype: str
+ """
+ words = sorted(words, key=lambda w:(len(w), w))
+ prefix_dict = set()
+ max_word = ''
+ for w in words:
+ if len(... | |
e7be538e04e775ad63d0e7c54d7bea6b902e09fb | elo.py | elo.py | ##
# elo.py
# provides implementation of ELO algorithm to determine
# change in fitness given a malicious act of nature.
##
K_FACTOR = 50 # weighting factor. The larger the more significant a match
# ^ in chess it's usually 15-16 for grandmasters and 32 for weak players
BETA = 400
class ResultType:
WIN = 1
L... | Add ELO algorithm code, with small tests. | Add ELO algorithm code, with small tests.
| Python | mit | anishathalye/evolution-chamber,anishathalye/evolution-chamber,techx/hackmit-evolution-chamber,anishathalye/evolution-chamber,anishathalye/evolution-chamber,techx/hackmit-evolution-chamber,techx/hackmit-evolution-chamber,techx/hackmit-evolution-chamber | ---
+++
@@ -0,0 +1,55 @@
+##
+# elo.py
+# provides implementation of ELO algorithm to determine
+# change in fitness given a malicious act of nature.
+##
+
+
+K_FACTOR = 50 # weighting factor. The larger the more significant a match
+# ^ in chess it's usually 15-16 for grandmasters and 32 for weak players
+BETA = 400... | |
4c1953e570a15661cffa68c151e00bbc6345ad8d | ipaqe_provision_hosts/backend/loader.py | ipaqe_provision_hosts/backend/loader.py | # Author: Milan Kubik, 2017
import logging
from pkg_resources import iter_entry_points
RESOURCE_GROUP = "ipaqe_provision_hosts.backends"
log = logging.getLogger(__name__)
def load_backends(exclude=()):
log.debug("Loading entry points from %s.", RESOURCE_GROUP)
entry_points = {
ep.name: ep.load() f... | Add basic backend loading function | Add basic backend loading function
| Python | mit | apophys/ipaqe-provision-hosts | ---
+++
@@ -0,0 +1,18 @@
+# Author: Milan Kubik, 2017
+
+import logging
+
+from pkg_resources import iter_entry_points
+
+RESOURCE_GROUP = "ipaqe_provision_hosts.backends"
+
+log = logging.getLogger(__name__)
+
+
+def load_backends(exclude=()):
+ log.debug("Loading entry points from %s.", RESOURCE_GROUP)
+ entr... | |
cfc471de36961ff90a2131100fa7a87da69c656b | Motors/motorTest.py | Motors/motorTest.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
#
# Copyright (c) 2013 Nautilabs
#
# Licensed under the MIT License,
# https://github.com/baptistelabat/robokite
# Authors: Baptiste LABAT
import time
import serial
import numpy as np
def computeXORChecksum(chksumdata):
# Inspired from http://doschman.blogspot.fr/2013/01/c... | Add a script to check motor (and communication!) | Add a script to check motor (and communication!)
| Python | mit | baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+#
+# Copyright (c) 2013 Nautilabs
+#
+# Licensed under the MIT License,
+# https://github.com/baptistelabat/robokite
+# Authors: Baptiste LABAT
+import time
+import serial
+import numpy as np
+
+def computeXORChecksum(chksumdata):
+ # Inspired f... | |
f3984fd4fdcfa8ddad779fb934362d043a5f8a00 | tests/test_cli.py | tests/test_cli.py | #!/usr/bin/env python
import pytest
from click.testing import CliRunner
from compaction import cli
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecut... | Add a simple test for the command line interface. | Add a simple test for the command line interface.
| Python | mit | mcflugen/compaction | ---
+++
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+import pytest
+from click.testing import CliRunner
+
+from compaction import cli
+
+
+@pytest.fixture
+def response():
+ """Sample pytest fixture.
+
+ See more at: http://doc.pytest.org/en/latest/fixture.html
+ """
+ # import requests
+ # return requests... | |
9397ebff413e557fff6aa08a3160cdfecb74fc7e | pybo/demos/basic_pes.py | pybo/demos/basic_pes.py | import numpy as np
import benchfunk
import reggie
import mwhutils.plotting as mp
import mwhutils.grid as mg
from pybo import inits
from pybo import policies
from pybo import solvers
from pybo import recommenders
if __name__ == '__main__':
# grab a test function and points at which to plot things
s = 0.001
... | Add a PES basic demo. | Add a PES basic demo.
| Python | bsd-2-clause | mwhoffman/pybo | ---
+++
@@ -0,0 +1,55 @@
+import numpy as np
+import benchfunk
+import reggie
+
+import mwhutils.plotting as mp
+import mwhutils.grid as mg
+
+from pybo import inits
+from pybo import policies
+from pybo import solvers
+from pybo import recommenders
+
+
+if __name__ == '__main__':
+ # grab a test function and poin... | |
5516b9997671d03c06549dcd99611df56d79b779 | cors_webserver.py | cors_webserver.py | #!/usr/bin/env python
# @license
# Copyright 2017 Google Inc.
# 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 applicab... | Add simple web server for testing Neuroglancer with local data | feat: Add simple web server for testing Neuroglancer with local data
| Python | apache-2.0 | seung-lab/neuroglancer,seung-lab/neuroglancer,google/neuroglancer,janelia-flyem/neuroglancer,seung-lab/neuroglancer,google/neuroglancer,seung-lab/neuroglancer,seung-lab/neuroglancer,google/neuroglancer,google/neuroglancer,janelia-flyem/neuroglancer,janelia-flyem/neuroglancer,seung-lab/neuroglancer,janelia-flyem/neurogl... | ---
+++
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+# @license
+# Copyright 2017 Google Inc.
+# 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-... | |
9a6c467ef34596c8adccc294f3132fe67c983608 | scripts/copy_overlay.py | scripts/copy_overlay.py | """Copy overlay from one dataset to a derived dataset."""
import click
import dtoolcore
def ensure_uri(path_or_uri):
if ':' in path_or_uri:
return path_or_uri
else:
return "disk:{}".format(path_or_uri)
@click.command()
@click.argument('src_dataset_path')
@click.argument('dst_dataset_path'... | Add script to copy overlay from one dataset to another | Add script to copy overlay from one dataset to another
| Python | mit | JIC-Image-Analysis/senescence-in-field,JIC-Image-Analysis/senescence-in-field,JIC-Image-Analysis/senescence-in-field | ---
+++
@@ -0,0 +1,40 @@
+"""Copy overlay from one dataset to a derived dataset."""
+
+import click
+
+import dtoolcore
+
+
+def ensure_uri(path_or_uri):
+
+ if ':' in path_or_uri:
+ return path_or_uri
+ else:
+ return "disk:{}".format(path_or_uri)
+
+
+@click.command()
+@click.argument('src_datas... | |
63203ab1069999f81b9518c11da29eb8ca537077 | openstack_dashboard/api/__init__.py | openstack_dashboard/api/__init__.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | Resolve API import issues (quantum) | Resolve API import issues (quantum)
Restore the imports in the api init file, without including the "from"
to ensure api calls still must specify "api.nova", "api.quantum", etc.
Fixes bug #1125632
Change-Id: I981105ce0ed7f1352de42fe2c0620665ba378823
| Python | apache-2.0 | vladryk/horizon,mrunge/openstack_horizon,redhat-openstack/horizon,citrix-openstack-build/horizon,Hodorable/0602,citrix-openstack-build/horizon,doug-fish/horizon,VaneCloud/horizon,tanglei528/horizon,karthik-suresh/horizon,j4/horizon,NeCTAR-RC/horizon,Solinea/horizon,wangxiangyu/horizon,luhanhan/horizon,newrocknj/horizon... | ---
+++
@@ -0,0 +1,42 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 United States Government as represented by the
+# Administrator of the National Aeronautics and Space Administration.
+# All Rights Reserved.
+#
+# Copyright 2012 Nebula, Inc.
+#
+# Licensed under the Apache License, Version ... | |
6bf80a7f367593e71fad788a933819c6849c3723 | day-06/p1.py | day-06/p1.py | import re
from numpy import matrix
instructions = []
with open('input.txt', 'r') as f:
regex = re.compile(r'([\w ]+) (\d+),(\d+) .+ (\d+),(\d+)')
for line in f:
match = regex.match(line)
instructions.append((
match.group(1),
(int(match.group(2)), int(match.group(3))),
... | Add currently-incorrect day 6 part 1 | Add currently-incorrect day 6 part 1
| Python | mit | foxscotch/advent-of-code,foxscotch/advent-of-code | ---
+++
@@ -0,0 +1,34 @@
+import re
+from numpy import matrix
+
+
+instructions = []
+
+with open('input.txt', 'r') as f:
+ regex = re.compile(r'([\w ]+) (\d+),(\d+) .+ (\d+),(\d+)')
+ for line in f:
+ match = regex.match(line)
+ instructions.append((
+ match.group(1),
+ (int... | |
f9f7493d89aa842fffc085758a1fe5791cd65704 | monitors/migrations/post/0004_migrate_subscriptions.py | monitors/migrations/post/0004_migrate_subscriptions.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.apps import apps
def populate_subscriptions(apps):
print("entering populate_subscriptions")
Certificates = apps.get_model("monitors","CertificateMonitor")
Subscription = apps.get_model("mon... | Add script to migrate data to certificatesubscription table | Add script to migrate data to certificatesubscription table
| Python | mit | gdit-cnd/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID | ---
+++
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from django.apps import apps
+
+def populate_subscriptions(apps):
+ print("entering populate_subscriptions")
+ Certificates = apps.get_model("monitors","CertificateMonitor")
+ ... | |
b614fae93ff965abb45ee26e1a72198b4b4af8ec | saltcloud/clouds/ec2.py | saltcloud/clouds/ec2.py | '''
The generic libcloud template used to create the connections and deploy the
cloud virtual machines
'''
# Import python libs
import os
import tempfile
import shutil
#
# Import libcloud
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
from libcloud.compute.deployment imp... | Add initial testing module for cloud creation | Add initial testing module for cloud creation
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,113 @@
+'''
+The generic libcloud template used to create the connections and deploy the
+cloud virtual machines
+'''
+
+# Import python libs
+import os
+import tempfile
+import shutil
+
+#
+# Import libcloud
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_d... | |
28460efa5c8add33c36f45ac3bdefbd4c94ac0af | py/desisurvey/test/test_optimize.py | py/desisurvey/test/test_optimize.py | import unittest
import numpy as np
from desisurvey.optimize import *
class TestUtils(unittest.TestCase):
def test_wrap_unwrap(self):
x = np.linspace(0., 350., 97)
for dx in (-60, 0, 60):
w = wrap(x, dx)
assert np.all(w >= dx)
assert np.all(w < dx + 360)
| Add simple unit test for optimize module | Add simple unit test for optimize module
| Python | bsd-3-clause | desihub/desisurvey,desihub/desisurvey | ---
+++
@@ -0,0 +1,15 @@
+import unittest
+
+import numpy as np
+
+from desisurvey.optimize import *
+
+
+class TestUtils(unittest.TestCase):
+
+ def test_wrap_unwrap(self):
+ x = np.linspace(0., 350., 97)
+ for dx in (-60, 0, 60):
+ w = wrap(x, dx)
+ assert np.all(w >= dx)
+ ... | |
f55d01d3b2b96af4394107404a452101c3aa7104 | circle_transform.py | circle_transform.py | # License: Public Domain
# (C) 2014 Toshimitsu Kimura
import sys
import cv2
import numpy as np
import math
def main():
if len(sys.argv) != 3:
print "./circle_transform.py <in_file> <out_file>"
quit()
filename = sys.argv[1]
outfile = sys.argv[2]
image = cv2.imread(filename, cv2.IMREAD... | Add circle transform script that may be useful for OCR | Add circle transform script that may be useful for OCR
| Python | lgpl-2.1 | nazodane/binarization_for_ocr | ---
+++
@@ -0,0 +1,49 @@
+# License: Public Domain
+# (C) 2014 Toshimitsu Kimura
+
+import sys
+import cv2
+import numpy as np
+import math
+
+def main():
+ if len(sys.argv) != 3:
+ print "./circle_transform.py <in_file> <out_file>"
+ quit()
+
+ filename = sys.argv[1]
+ outfile = sys.argv[2]
+
... | |
794b5297c96529d895705214b1fb2ff9ba1510a9 | into/backends/aws.py | into/backends/aws.py | from __future__ import print_function, division, absolute_import
from into import discover, CSV, resource, convert
import pandas as pd
from ..utils import cls_name
from toolz import memoize
from datashape import var
class S3(object):
"""An object that holds a resource that lives in an S3 bucket
Examples
... | Implement part of the s3 csv into interface | Implement part of the s3 csv into interface
| Python | bsd-3-clause | ywang007/odo,alexmojaki/odo,blaze/odo,blaze/odo,ContinuumIO/odo,cowlicks/odo,alexmojaki/odo,Dannnno/odo,cpcloud/odo,quantopian/odo,cpcloud/odo,cowlicks/odo,ContinuumIO/odo,Dannnno/odo,ywang007/odo,quantopian/odo | ---
+++
@@ -0,0 +1,62 @@
+from __future__ import print_function, division, absolute_import
+
+from into import discover, CSV, resource, convert
+import pandas as pd
+from ..utils import cls_name
+from toolz import memoize
+from datashape import var
+
+
+class S3(object):
+ """An object that holds a resource that l... | |
b7212b9aa393faea3cfaf94c3dfaf17487461d62 | lib/pegasus/python/Pegasus/test/service/test_service.py | lib/pegasus/python/Pegasus/test/service/test_service.py | # Copyright 2007-2014 University Of Southern California
#
# 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 ... | Add unit test to see if pegasus-service imports are succesful | Add unit test to see if pegasus-service imports are succesful
| Python | apache-2.0 | pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus | ---
+++
@@ -0,0 +1,23 @@
+# Copyright 2007-2014 University Of Southern California
+#
+# 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
+... | |
ee0f949da82f249684c63cefe49ee546aca76299 | programs/utils/fix_json.py | programs/utils/fix_json.py | #!/usr/bin/python
def isfloat(value):
try:
float(value)
return True
except ValueError:
return False
import sys
if len(sys.argv) == 3:
infile = sys.argv[1]
outfile = sys.argv[2]
else:
infile = raw_input("Enter input file:")
outfile = raw_input("Enter output file:")
with open(infile, "r") as g... | Add simple script that changes floating points in genesis.json to ints | Add simple script that changes floating points in genesis.json to ints
| Python | unlicense | camponez/bitshares,jakeporter/Bitshares,jakeporter/Bitshares,frrp/bitshares,bitsuperlab/cpp-play,FollowMyVote/bitshares,frrp/bitshares,bitshares/devshares,frrp/bitshares,bitshares/bitshares,bitsuperlab/cpp-play,FollowMyVote/bitshares,bitsuperlab/cpp-play,Ziftr/bitshares,camponez/bitshares,bitshares/bitshares,bitshares/... | ---
+++
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+def isfloat(value):
+ try:
+ float(value)
+ return True
+ except ValueError:
+ return False
+
+import sys
+
+if len(sys.argv) == 3:
+ infile = sys.argv[1]
+ outfile = sys.argv[2]
+else:
+ infile = raw_input("Enter input file:")
+ outfile = raw_input("Enter... | |
436840ee3d41ca06c6a94745144ed3b8453816d8 | geotrek/common/management/commands/clean_attachments.py | geotrek/common/management/commands/clean_attachments.py | from pathlib import Path
from django.core.management.base import BaseCommand
from django.conf import settings
from geotrek.common.models import Attachment
from easy_thumbnails.models import Thumbnail
class Command(BaseCommand):
help = "Remove files for deleted attachments"
def handle(self, *args, **options... | Add a command to clean attachments | Add a command to clean attachments
| Python | bsd-2-clause | GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin | ---
+++
@@ -0,0 +1,39 @@
+from pathlib import Path
+
+from django.core.management.base import BaseCommand
+from django.conf import settings
+
+from geotrek.common.models import Attachment
+from easy_thumbnails.models import Thumbnail
+
+
+class Command(BaseCommand):
+ help = "Remove files for deleted attachments"
... | |
4e1f68f1c033dc76930b2d651fe256dff11970e1 | examples/scripts/weatherValuesNamed.py | examples/scripts/weatherValuesNamed.py | from medea import Tokenizer
from examples.scripts import timeit
def run():
source = open('examples/data/weathermap.json')
tokenizer = Tokenizer(source)
for tok, val in tokenizer.tokenizeValuesNamed("rain"):
print(tok, val)
timeit(run) | Bring in timeit, and implicitly overclock with freq | Bring in timeit, and implicitly overclock with freq
| Python | agpl-3.0 | ShrimpingIt/medea,ShrimpingIt/medea | ---
+++
@@ -0,0 +1,11 @@
+from medea import Tokenizer
+from examples.scripts import timeit
+
+def run():
+ source = open('examples/data/weathermap.json')
+ tokenizer = Tokenizer(source)
+
+ for tok, val in tokenizer.tokenizeValuesNamed("rain"):
+ print(tok, val)
+
+timeit(run) | |
8d4255538203336e6f4d72845723c179c38547e0 | datastore/migrations/0028_auto_20160713_0000.py | datastore/migrations/0028_auto_20160713_0000.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-13 00:00
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('datastore', '0027_auto_20160712_2251'),
]
operations = [
migrations.RemoveField(
... | Add migration for deleted gunk | Add migration for deleted gunk
| Python | mit | impactlab/oeem-energy-datastore,impactlab/oeem-energy-datastore,impactlab/oeem-energy-datastore | ---
+++
@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.5 on 2016-07-13 00:00
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('datastore', '0027_auto_20160712_2251'),
+ ]
+
+ operation... | |
59882da97dafa0e103550d24795105e4e73f6ff5 | statsmodels/base/tests/test_optimize.py | statsmodels/base/tests/test_optimize.py | from numpy.testing import assert_
from statsmodels.base.model import (_fit_mle_newton, _fit_mle_nm,
_fit_mle_bfgs, _fit_mle_cg,
_fit_mle_ncg, _fit_mle_powell)
fit_funcs = {
'newton': _fit_mle_newton,
'nm': _fit_mle_nm, # Nelder-Mead
'... | Test fit funcs for full_output = False | TST: Test fit funcs for full_output = False
| Python | bsd-3-clause | bsipocz/statsmodels,bavardage/statsmodels,jseabold/statsmodels,DonBeo/statsmodels,waynenilsen/statsmodels,detrout/debian-statsmodels,josef-pkt/statsmodels,kiyoto/statsmodels,cbmoore/statsmodels,Averroes/statsmodels,statsmodels/statsmodels,ChadFulton/statsmodels,adammenges/statsmodels,bashtage/statsmodels,YihaoLu/statsm... | ---
+++
@@ -0,0 +1,49 @@
+from numpy.testing import assert_
+from statsmodels.base.model import (_fit_mle_newton, _fit_mle_nm,
+ _fit_mle_bfgs, _fit_mle_cg,
+ _fit_mle_ncg, _fit_mle_powell)
+
+fit_funcs = {
+ 'newton': _fit_mle_newton,
+ 'nm'... | |
d2018ec07a79b1d0fd7c0ee3c34faa0c4c5bf723 | src/python/borg/tools/plot_performance.py | src/python/borg/tools/plot_performance.py | """
@author: Bryan Silverthorn <bcs@cargo-cult.org>
"""
if __name__ == "__main__":
from borg.tools.plot_performance import main
raise SystemExit(main())
from cargo.log import get_logger
log = get_logger(__name__, default_level = "INFO")
def plot_trial(session, trial_row):
"""
Plot the specified tri... | Add a simple performance plotting tool. | Add a simple performance plotting tool.
| Python | mit | borg-project/borg | ---
+++
@@ -0,0 +1,109 @@
+"""
+@author: Bryan Silverthorn <bcs@cargo-cult.org>
+"""
+
+if __name__ == "__main__":
+ from borg.tools.plot_performance import main
+
+ raise SystemExit(main())
+
+from cargo.log import get_logger
+
+log = get_logger(__name__, default_level = "INFO")
+
+def plot_trial(session, tria... | |
ce9ff3ac42d388d7898ea3e88dce3d2eb4168c30 | hc/accounts/migrations/0042_remove_member_rw.py | hc/accounts/migrations/0042_remove_member_rw.py | # Generated by Django 3.2.4 on 2021-07-22 14:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0041_fill_role'),
]
operations = [
migrations.RemoveField(
model_name='member',
name='rw',
),
]
| Add a migration to remove Member.rw | Add a migration to remove Member.rw
| Python | bsd-3-clause | iphoting/healthchecks,healthchecks/healthchecks,iphoting/healthchecks,healthchecks/healthchecks,healthchecks/healthchecks,iphoting/healthchecks,healthchecks/healthchecks,iphoting/healthchecks | ---
+++
@@ -0,0 +1,17 @@
+# Generated by Django 3.2.4 on 2021-07-22 14:39
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('accounts', '0041_fill_role'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='member',
+ ... | |
814974c6736f1a9aef6fec7abf4153f194a231c7 | simpleubjson/exceptions.py | simpleubjson/exceptions.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
class DecodeError(ValueError):
"""UBJSON data decoding error."""
class MarkerError(DecodeError):... | Add missed exception module. Ooops. | Add missed exception module. Ooops.
| Python | bsd-2-clause | samipshah/simpleubjson,brainwater/simpleubjson,498888197/simpleubjson,kxepal/simpleubjson | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2013 Alexander Shorin
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution.
+#
+
+
+class DecodeError(ValueError):
+ """UBJSON data decoding erro... | |
bb0d7bf6dc36e8d013befc7f13da3cb6c3830c46 | core/admin/migrations/versions/049fed905da7_.py | core/admin/migrations/versions/049fed905da7_.py | """ Enforce the nocase collation on the email table
Revision ID: 049fed905da7
Revises: 49d77a93118e
Create Date: 2018-04-21 13:23:56.571524
"""
# revision identifiers, used by Alembic.
revision = '049fed905da7'
down_revision = '49d77a93118e'
from alembic import op
import sqlalchemy as sa
def upgrade():
with o... | Enforce the nocase collation on the email table | Enforce the nocase collation on the email table
| Python | mit | kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io | ---
+++
@@ -0,0 +1,25 @@
+""" Enforce the nocase collation on the email table
+
+Revision ID: 049fed905da7
+Revises: 49d77a93118e
+Create Date: 2018-04-21 13:23:56.571524
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '049fed905da7'
+down_revision = '49d77a93118e'
+
+from alembic import op
+import sql... | |
cff8e237afb567ba980b8790d9c7416b8be21fdd | solutions/uri/1010/1010.py | solutions/uri/1010/1010.py | import sys
s = 0.0
for line in sys.stdin:
a, b, c = line.split()
a, b, c = int(a), int(b), float(c)
s += c * b
print(f'VALOR A PAGAR: R$ {s:.2f}')
| Solve Simple Calculate in python | Solve Simple Calculate in python
| Python | mit | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr... | ---
+++
@@ -0,0 +1,10 @@
+import sys
+
+s = 0.0
+
+for line in sys.stdin:
+ a, b, c = line.split()
+ a, b, c = int(a), int(b), float(c)
+ s += c * b
+
+print(f'VALOR A PAGAR: R$ {s:.2f}') | |
12c3d91f3a0ae571300f7729d09766aba12c81ac | CurveAnalysis/fourier_analysis.py | CurveAnalysis/fourier_analysis.py | #!/usr/bin/env python
import csv
import numpy as np
from scipy import signal
from scipy.fftpack import fft, ifft
from scipy import fftpack
import matplotlib.pyplot as plt
note_name = '77726_MS-DAR-00205-00001-000-00096'
base_dir = '/home/ibanez/data/amnh/darwin_notes/'
images_dir = base_dir + 'images/'
curves_dir = ba... | Add python script to compute fast fourier transforms. | Add python script to compute fast fourier transforms.
| Python | apache-2.0 | HackTheStacks/darwin-notes-image-processing,HackTheStacks/darwin-notes-image-processing | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+import csv
+import numpy as np
+from scipy import signal
+from scipy.fftpack import fft, ifft
+from scipy import fftpack
+import matplotlib.pyplot as plt
+
+note_name = '77726_MS-DAR-00205-00001-000-00096'
+base_dir = '/home/ibanez/data/amnh/darwin_notes/'
+images_dir ... | |
fd80e8088c840fb836f00f4d41b0fcfd0a132d0a | calaccess_processed/migrations/0023_auto_20170206_0037.py | calaccess_processed/migrations/0023_auto_20170206_0037.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-06 00:37
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('calaccess_processed', '0022_ballotmeasurecontestidentifier'),
]
operations = [
migr... | Add migration for Party meta option changes | Add migration for Party meta option changes
| Python | mit | california-civic-data-coalition/django-calaccess-processed-data,california-civic-data-coalition/django-calaccess-processed-data | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-02-06 00:37
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('calaccess_processed', '0022_ballotmeasurecontestidentifier'),
... | |
22df7a89020cbbcf80a88bcf3572dea591884861 | avatar/urls.py | avatar/urls.py | from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('avatar.views',
url('^add/$', 'add', name='avatar_add'),
url('^change/$', 'change', name='avatar_change'),
url('^delete/$', 'delete', name='avatar_delete'),
url('^render_primary/(?P<user>[\+\w]+)/(?P<size>[\d]+)/$', 'render_prim... | from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('avatar.views',
url('^add/$', 'add', name='avatar_add'),
url('^change/$', 'change', name='avatar_change'),
url('^delete/$', 'delete', name='avatar_delete'),
url('^render_primary/(?P<user>[\w\d\.\-_]{3,30})/(?P<size>[\d]+)/$', 'r... | Support for username with extra chars. | Support for username with extra chars.
| Python | bsd-3-clause | tbabej/django-avatar,Brendtron5000/django-avatar,Nuevosmedios/django-avatar,stellalie/django-avatar,barbuza/django-avatar,allenling/django-avatar,allenling/django-avatar,tbabej/django-avatar,z4r/django-avatar,imgmix/django-avatar,hexenxp14/django-avatar,MachineandMagic/django-avatar,brajeshvit/avatarmodule,integricho/d... | ---
+++
@@ -4,5 +4,5 @@
url('^add/$', 'add', name='avatar_add'),
url('^change/$', 'change', name='avatar_change'),
url('^delete/$', 'delete', name='avatar_delete'),
- url('^render_primary/(?P<user>[\+\w]+)/(?P<size>[\d]+)/$', 'render_primary', name='avatar_render_primary'),
+ url('^render_pri... |
f7008616465267906dd7ca75e0339812549e2988 | tests/unit_tests/test_deplete_operator.py | tests/unit_tests/test_deplete_operator.py | """Basic unit tests for openmc.deplete.Operator instantiation
Modifies and resets environment variable OPENMC_CROSS_SECTIONS
to a custom file with new depletion_chain node
"""
from os import remove
from os import environ
from unittest import mock
from pathlib import Path
import pytest
from openmc.deplete.abc import ... | Add test for the instantiation of deplete.Operator | Add test for the instantiation of deplete.Operator
Construct a minimal cross sections xml file that only
contains the depletion_chain node required by
the Operator. The path to this file is set to the
OPENMC_CROSS_SECTIONS file, and reverted after the test.
The depletion_chain points towards the chain_simple.xml
file... | Python | mit | paulromano/openmc,smharper/openmc,paulromano/openmc,liangjg/openmc,mit-crpg/openmc,shikhar413/openmc,liangjg/openmc,amandalund/openmc,smharper/openmc,amandalund/openmc,walshjon/openmc,liangjg/openmc,paulromano/openmc,mit-crpg/openmc,walshjon/openmc,mit-crpg/openmc,amandalund/openmc,shikhar413/openmc,shikhar413/openmc,w... | ---
+++
@@ -0,0 +1,72 @@
+"""Basic unit tests for openmc.deplete.Operator instantiation
+
+Modifies and resets environment variable OPENMC_CROSS_SECTIONS
+to a custom file with new depletion_chain node
+"""
+
+from os import remove
+from os import environ
+from unittest import mock
+from pathlib import Path
+import p... | |
657e74878179b505c12cdf8e607cd9b3ae549420 | towel/templatetags/verbose_name_tags.py | towel/templatetags/verbose_name_tags.py | import itertools
from django import template
register = template.Library()
PATHS = [
'_meta', # model
'queryset.model._meta',
'instance._meta',
'model._meta',
]
def _resolve(instance, last_part):
for path in PATHS:
o = instance
found = True
for part in itertools.chain(p... | Add helpers to determine verbose_name(_plural)? of arbitrary objects | Add helpers to determine verbose_name(_plural)? of arbitrary objects
| Python | bsd-3-clause | matthiask/towel,matthiask/towel,matthiask/towel,matthiask/towel | ---
+++
@@ -0,0 +1,37 @@
+import itertools
+
+from django import template
+
+
+register = template.Library()
+
+
+PATHS = [
+ '_meta', # model
+ 'queryset.model._meta',
+ 'instance._meta',
+ 'model._meta',
+]
+
+def _resolve(instance, last_part):
+ for path in PATHS:
+ o = instance
+ foun... | |
beef7ad662e67a39e9ca387f7643129f88cda7df | tools/supervisor/rotate_supervisor_logs.py | tools/supervisor/rotate_supervisor_logs.py | #!/usr/bin/env python3
#
# Rotates and (optionally) compresses Supervisor logs using `logrotate`
#
# See:
#
# * https://www.rounds.com/blog/easy-logging-with-logrotate-and-supervisord/
# * https://gist.github.com/glarrain/6165987
#
import os
import subprocess
import tempfile
from mediawords.util.config import get_con... | Add script to rotate Supervisor log files | Add script to rotate Supervisor log files
| Python | agpl-3.0 | berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+#
+# Rotates and (optionally) compresses Supervisor logs using `logrotate`
+#
+# See:
+#
+# * https://www.rounds.com/blog/easy-logging-with-logrotate-and-supervisord/
+# * https://gist.github.com/glarrain/6165987
+#
+
+import os
+import subprocess
+import tempfile
+
+... | |
38499870ade3e96e003373d599bb94f089e57768 | cptm/tabular2cpt_input.py | cptm/tabular2cpt_input.py | """Script that converts a field in a tabular data file to cptm input files
Used for the CAP vragenuurtje data.
Uses frog to pos-tag and lemmatize the data.
Usage: python tabular2cpt_input.py <csv of excel file> <full text field name>
<dir out>
"""
import pandas as pd
import logging
import sys
import argparse
import... | Add script that converts a field in a tabular data file to cptm input | Add script that converts a field in a tabular data file to cptm input
| Python | apache-2.0 | NLeSC/cptm,NLeSC/cptm | ---
+++
@@ -0,0 +1,62 @@
+"""Script that converts a field in a tabular data file to cptm input files
+
+Used for the CAP vragenuurtje data.
+
+Uses frog to pos-tag and lemmatize the data.
+
+Usage: python tabular2cpt_input.py <csv of excel file> <full text field name>
+<dir out>
+"""
+
+import pandas as pd
+import lo... | |
c32514d224704cdd247a3b1da3519af277065d8e | nettests/experimental/dns_injection.py | nettests/experimental/dns_injection.py | # -*- encoding: utf-8 -*-
from twisted.python import usage
from twisted.internet import defer
from ooni.templates import dnst
from ooni import nettest
from ooni.utils import log
class UsageOptions(usage.Options):
optParameters = [
['resolver', 'r', '8.8.8.1', 'an invalid DNS resolver'],
['... | Add DNS injection test for detecting censorship when DNS inject happens | Add DNS injection test for detecting censorship when DNS inject happens
| Python | bsd-2-clause | lordappsec/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,kdmurray91/o... | ---
+++
@@ -0,0 +1,63 @@
+# -*- encoding: utf-8 -*-
+from twisted.python import usage
+from twisted.internet import defer
+
+from ooni.templates import dnst
+from ooni import nettest
+from ooni.utils import log
+
+class UsageOptions(usage.Options):
+ optParameters = [
+ ['resolver', 'r', '8.8.8.1', 'an ... | |
ebc4f60368a1ca3216621c74733059125b565940 | src/lexus/kucera_francis.py | src/lexus/kucera_francis.py | __author__ = 's7a'
# The Kucera Francis class
class KuceraFrancis:
# Constructor for the Kucera Francis class
def __init__(self, dict_file):
dict = open(dict_file, 'r')
# Construct the Kucera Francis frequency dictionary
self.kucera_francis_frequency = {}
for line in dict.re... | Add the Kucera Francis library | Add the Kucera Francis library
| Python | mit | Somsubhra/Simplify,Somsubhra/Simplify,Somsubhra/Simplify | ---
+++
@@ -0,0 +1,33 @@
+__author__ = 's7a'
+
+
+# The Kucera Francis class
+class KuceraFrancis:
+
+ # Constructor for the Kucera Francis class
+ def __init__(self, dict_file):
+ dict = open(dict_file, 'r')
+
+ # Construct the Kucera Francis frequency dictionary
+ self.kucera_francis_freq... | |
f144f3a36c6011203a6b1d396233e64e7a8dc089 | examples/speed_test.py | examples/speed_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import initExample
from lase.core import KClient
from lase.drivers import Oscillo
import numpy as np
import matplotlib.pyplot as plt
import time
def speed_test(host, n_pts=200):
time_array = np.zeros(n_pts)
client = KClient(host)
driver = Oscillo(client)
... | Add speed test in examples | Add speed test in examples
| Python | mit | Koheron/lase | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import initExample
+from lase.core import KClient
+from lase.drivers import Oscillo
+
+import numpy as np
+import matplotlib.pyplot as plt
+import time
+
+def speed_test(host, n_pts=200):
+ time_array = np.zeros(n_pts)
+ client = KClien... | |
8661b02ca1bcfb3fab9c41c9ec6d620d4d62355b | src/rgb.py | src/rgb.py | #!/usr/bin/env python
### Class to control the RGB LED Indicator ###
import Adafruit_BBIO.GPIO as GPIO
import time
class RGBController(object):
def __init__(self, red_pin = "P8_10", green_pin = "P8_12", blue_pin = "P8_14"):
self.red_pin = red_pin
self.green_pin = green_pin
self.blue_pin... | Add RGBController class for LED indicator control | Add RGBController class for LED indicator control | Python | mit | swbooking/RobotMaria | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+### Class to control the RGB LED Indicator ###
+
+import Adafruit_BBIO.GPIO as GPIO
+import time
+
+class RGBController(object):
+ def __init__(self, red_pin = "P8_10", green_pin = "P8_12", blue_pin = "P8_14"):
+
+ self.red_pin = red_pin
+ self.gree... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.