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 |
|---|---|---|---|---|---|---|---|---|---|---|
57c4bcff678d65262463f94ea7996367a1c1ec35 | analytics/tshirt_size_distribution.py | analytics/tshirt_size_distribution.py | import csv
import plotly.plotly as py
import sys
from collections import defaultdict
from plotly.graph_objs import *
city = sys.argv[1].lower()
path_to_csv_file = sys.argv[2]
column_number = int(sys.argv[3])
with open(path_to_csv_file) as csv_file:
csv_data = csv.reader(csv_file)
next(csv_data, None)
tsh... | Add script to determine and plot tshirt size distribution | Add script to determine and plot tshirt size distribution
| Python | mit | wearhacks/wearhacks_analytics | ---
+++
@@ -0,0 +1,47 @@
+import csv
+import plotly.plotly as py
+import sys
+
+from collections import defaultdict
+from plotly.graph_objs import *
+
+city = sys.argv[1].lower()
+path_to_csv_file = sys.argv[2]
+column_number = int(sys.argv[3])
+
+with open(path_to_csv_file) as csv_file:
+ csv_data = csv.reader(cs... | |
9b17918bc992481efb51d8df972b879499424e79 | lib/ansible/utils/module_docs_fragments/openstack.py | lib/ansible/utils/module_docs_fragments/openstack.py | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option... | Add doc fragment for new OpenStack modules | Add doc fragment for new OpenStack modules
| Python | mit | thaim/ansible,thaim/ansible | ---
+++
@@ -0,0 +1,88 @@
+# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of... | |
dc0a1b2777acc4b9b97de6c471eb8e35dcac2254 | tools/telemetry/telemetry/page/actions/action_runner_unittest.py | tools/telemetry/telemetry/page/actions/action_runner_unittest.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.core.backends.chrome import tracing_backend
from telemetry.core.timeline import model
from telemetry.page.actions import action_runner as actio... | Add test for action_runner.BeginInteraction and action_runner.EndInteraction. | Add test for action_runner.BeginInteraction and action_runner.EndInteraction.
BUG=368767
Review URL: https://codereview.chromium.org/294943006
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@272549 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | PeterWangIntel/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,ltilve/chromium,chuan9/chromium-crosswalk,M4sse/chromium.src,chuan9/chromium-crosswalk,ltilve/chromium,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,littlstar/chrom... | ---
+++
@@ -0,0 +1,31 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+from telemetry.core.backends.chrome import tracing_backend
+from telemetry.core.timeline import model
+from telemetry.page.acti... | |
bec07279b0e14a9a0e3f11efc7ecbc6e908aa1ef | latex_utils.py | latex_utils.py | """
Utilities to work with LaTeX files.
"""
import argparse
import re
def read_tex_file(tex_file, encoding="utf-8"):
with open(tex_file, 'r', encoding=encoding) as data:
tex_source = data.read()
return tex_source
def write_tex_file(tex_file, tex_source):
with open(tex_file, 'w') as open_file:
... | Add utilities to work with LaTeX files | Add utilities to work with LaTeX files
| Python | mit | teunzwart/latex-production-tools | ---
+++
@@ -0,0 +1,41 @@
+"""
+Utilities to work with LaTeX files.
+"""
+
+import argparse
+import re
+
+def read_tex_file(tex_file, encoding="utf-8"):
+ with open(tex_file, 'r', encoding=encoding) as data:
+ tex_source = data.read()
+ return tex_source
+
+
+def write_tex_file(tex_file, tex_source):
+ ... | |
334695484d61693c41c8a30aea6cf753b9ed8267 | lstm.py | lstm.py | import tensorflow as tf
import numpy as np
tf.set_random_seed(5)
n_inputs = 28
n_neurons = 150
n_layers = 3
n_steps = 28
n_outputs = 10
learning_rate = 0.001
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/")
X_test = mnist.test.images.reshape((-1, n_steps, n_... | Add code for LSTM based MNIST | Add code for LSTM based MNIST
Training takes time but accuracy is great after few
iterations.
| Python | mit | KT12/hands_on_machine_learning | ---
+++
@@ -0,0 +1,51 @@
+import tensorflow as tf
+import numpy as np
+
+tf.set_random_seed(5)
+
+n_inputs = 28
+n_neurons = 150
+n_layers = 3
+n_steps = 28
+n_outputs = 10
+
+learning_rate = 0.001
+
+from tensorflow.examples.tutorials.mnist import input_data
+mnist = input_data.read_data_sets("/tmp/data/")
+X_test =... | |
0da81aee8d1d1c1badee561c594e191dbbffdc9c | pyres/failure/base.py | pyres/failure/base.py | import sys
import traceback
class BaseBackend(object):
"""Provides a base class that custom backends can subclass. Also provides basic
traceback and message parsing.
The ``__init__`` takes these keyword arguments:
``exp`` -- The exception generated by your failure.
``queu... | import sys
import traceback
class BaseBackend(object):
"""Provides a base class that custom backends can subclass. Also provides basic
traceback and message parsing.
The ``__init__`` takes these keyword arguments:
``exp`` -- The exception generated by your failure.
``queue`` -- The queue... | Save our backtraces in a compatible manner with resque. | Save our backtraces in a compatible manner with resque.
| Python | mit | binarydud/pyres,guaijiao/pyres,TylerLubeck/pyres,Affectiva/pyres | ---
+++
@@ -4,33 +4,36 @@
class BaseBackend(object):
"""Provides a base class that custom backends can subclass. Also provides basic
traceback and message parsing.
-
+
The ``__init__`` takes these keyword arguments:
-
+
``exp`` -- The exception generated by your failure.
-
+
... |
a4845aff79b1efb89a210b3b2cc57739cc27bebf | chatterbot/ext/django_chatterbot/migrations/0018_text_max_length.py | chatterbot/ext/django_chatterbot/migrations/0018_text_max_length.py | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_chatterbot', '0017_tags_unique'),
]
operations = [
migrations.AlterField(
model_name='statement',
name='in_response_to',
field=models.CharField(ma... | Create Django migrations for statement text max length | Create Django migrations for statement text max length
| Python | bsd-3-clause | gunthercox/ChatterBot,vkosuri/ChatterBot | ---
+++
@@ -0,0 +1,31 @@
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('django_chatterbot', '0017_tags_unique'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='statement',
+ name='in_response_to... | |
5c3a54a79a763b3b761f053f7360ad2d670ae5cb | bssrdf_estimate/interface/bssrdf_redner_widget.py | bssrdf_estimate/interface/bssrdf_redner_widget.py | # -*- coding: utf-8 -*-
from .image_widget import ImageWidget
class BSSRDFRenderWidget(ImageWidget):
def __init__(self, parent=None):
super(BSSRDFRenderWidget, self).__init__(parent)
| Add BSSRDF render widget file. | Add BSSRDF render widget file.
| Python | mit | tatsy/bssrdf-estimate,tatsy/bssrdf-estimate | ---
+++
@@ -0,0 +1,7 @@
+# -*- coding: utf-8 -*-
+
+from .image_widget import ImageWidget
+
+class BSSRDFRenderWidget(ImageWidget):
+ def __init__(self, parent=None):
+ super(BSSRDFRenderWidget, self).__init__(parent) | |
6a3d0ae17efd09bbfc184a4c28115cb61b2006e7 | bjcp/style_parser.py | bjcp/style_parser.py | #! /usr/bin/env python
import csv
import pprint
import string
"""
Parse the BJCP 2015 Styles CSV file
"""
def main():
styles = {}
filename = '2015_Styles.csv'
with open(filename, 'rb') as f:
reader = csv.reader(f)
stylename = ''
for row in reader:
if row[0] and row[1... | Add a utility to parse the BJCP 2015 Styles csv | Add a utility to parse the BJCP 2015 Styles csv
| Python | mit | chrisgilmerproj/brewdata,chrisgilmerproj/brewdata | ---
+++
@@ -0,0 +1,60 @@
+#! /usr/bin/env python
+
+import csv
+import pprint
+import string
+
+"""
+Parse the BJCP 2015 Styles CSV file
+"""
+
+
+def main():
+ styles = {}
+
+ filename = '2015_Styles.csv'
+ with open(filename, 'rb') as f:
+ reader = csv.reader(f)
+ stylename = ''
+ for ... | |
3763078a5a9a1973b17fd1c11411c29e176a034f | py/baseball-game.py | py/baseball-game.py | class Solution(object):
def calPoints(self, ops):
"""
:type ops: List[str]
:rtype: int
"""
s = 0
stack = []
for c in ops:
try:
v = int(c)
stack.append(v)
except ValueError:
if c == 'C':
... | Add py solution for 682. Baseball Game | Add py solution for 682. Baseball Game
682. Baseball Game: https://leetcode.com/problems/baseball-game/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,22 @@
+class Solution(object):
+ def calPoints(self, ops):
+ """
+ :type ops: List[str]
+ :rtype: int
+ """
+ s = 0
+ stack = []
+ for c in ops:
+ try:
+ v = int(c)
+ stack.append(v)
+ except Val... | |
f25364ba8dbbd7924e068146599f56e5bd797c4e | test/python_api/lldbutil/TestLLDBIterator.py | test/python_api/lldbutil/TestLLDBIterator.py | """
Test lldbutil.lldb_iter() which returns an iterator object for lldb's aggregate
data structures.
"""
import os, time
import re
import unittest2
import lldb
from lldbtest import *
class LLDBIteratorTestCase(TestBase):
mydir = "python_api/lldbutil"
def setUp(self):
# Call super's setUp().
... | Add a test case for lldbutil.lldb_iter() which returns an iterator object for lldb objects which can contain other lldb objects. Examples are: SBTarget contains SBModule, SBModule contains SBSymbols, SBProcess contains SBThread, SBThread contains SBFrame, etc. | Add a test case for lldbutil.lldb_iter() which returns an iterator object
for lldb objects which can contain other lldb objects. Examples are:
SBTarget contains SBModule, SBModule contains SBSymbols, SBProcess contains
SBThread, SBThread contains SBFrame, etc.
git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@130... | Python | apache-2.0 | apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb | ---
+++
@@ -0,0 +1,64 @@
+"""
+Test lldbutil.lldb_iter() which returns an iterator object for lldb's aggregate
+data structures.
+"""
+
+import os, time
+import re
+import unittest2
+import lldb
+from lldbtest import *
+
+class LLDBIteratorTestCase(TestBase):
+
+ mydir = "python_api/lldbutil"
+
+ def setUp(self... | |
aa837386f4cce1ff23fbdf58a633d0e4bf1cc846 | setup-utils/passhash_pbkdf2.py | setup-utils/passhash_pbkdf2.py | import sys
sys.path.append("..") # This needs to work from the setup-utils subdirectory
from txircd.modules.hash_pbkdf2 import HashPBKDF2
if len(sys.argv) < 2:
print("Usage: {} password".format(__file__))
else:
hasher = HashPBKDF2()
hashedPass = hasher.hash(sys.argv[1])
print(hashedPass) | Add a password hasher for opers | Add a password hasher for opers
| Python | bsd-3-clause | ElementalAlchemist/txircd,Heufneutje/txircd | ---
+++
@@ -0,0 +1,10 @@
+import sys
+sys.path.append("..") # This needs to work from the setup-utils subdirectory
+from txircd.modules.hash_pbkdf2 import HashPBKDF2
+
+if len(sys.argv) < 2:
+ print("Usage: {} password".format(__file__))
+else:
+ hasher = HashPBKDF2()
+ hashedPass = hasher.hash(sys.argv[1])
+ print(h... | |
bee9396a4a8bdef3a22b2010cf873637d5bf56db | numberutils.py | numberutils.py | ##-*- coding: utf-8 -*-
#!/usr/bin/python
'''
Number to Hangul string util.
'''
__author__ = 'SeomGi, Han'
__credits__ = ['SeomGi, Han']
__copyright__ = 'Copyright 2015, Python Utils Project'
__license__ = 'MIT'
__version__ = '0.0.1'
__maintainer__ = 'SeomGi, Han'
__email__ = 'iandmyhand@gmail.com'
__status__ = 'Pro... | Add a function can convert number to Hangul string. | Add a function can convert number to Hangul string.
| Python | mit | iandmyhand/python-utils | ---
+++
@@ -0,0 +1,53 @@
+##-*- coding: utf-8 -*-
+#!/usr/bin/python
+'''
+Number to Hangul string util.
+'''
+
+__author__ = 'SeomGi, Han'
+__credits__ = ['SeomGi, Han']
+__copyright__ = 'Copyright 2015, Python Utils Project'
+
+__license__ = 'MIT'
+__version__ = '0.0.1'
+__maintainer__ = 'SeomGi, Han'
+__email__ =... | |
d116c4013ebf8b5831d450ae12932446056e7a84 | dump_model.py | dump_model.py |
import pickle
import numpy as np
import random
import os
import struct
from config import *
def binary(num):
"""
Float to IEEE-754 single precision binary string.
"""
return ''.join(bin(ord(c)).replace('0b', '').rjust(8, '0') for c in struct.pack('!f', num))
def test_manual_classification(model)... | Add means to dump model for manual classification | Add means to dump model for manual classification
| Python | mit | hptruong93/MouseGestureRecognition,hptruong93/MouseGestureRecognition | ---
+++
@@ -0,0 +1,76 @@
+
+import pickle
+import numpy as np
+import random
+import os
+import struct
+
+from config import *
+
+def binary(num):
+ """
+ Float to IEEE-754 single precision binary string.
+ """
+ return ''.join(bin(ord(c)).replace('0b', '').rjust(8, '0') for c in struct.pack('!f', num... | |
a49adce8b7822d972bfef5046d69366a4b26e0bb | jjvm.py | jjvm.py | #!/usr/bin/python
import argparse
import sys
class MyParser(argparse.ArgumentParser):
def error(self, message):
sys.stderr.write('error: %s\n' % message)
self.print_help()
sys.exit(2)
parser = MyParser('Run bytecode in jjvm')
parser.add_argument('path', help='path to class')
args = parser... | Print sequence of bytes that comprise the class file | Print sequence of bytes that comprise the class file
| Python | apache-2.0 | justinccdev/jjvm | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import argparse
+import sys
+
+class MyParser(argparse.ArgumentParser):
+ def error(self, message):
+ sys.stderr.write('error: %s\n' % message)
+ self.print_help()
+ sys.exit(2)
+
+parser = MyParser('Run bytecode in jjvm')
+parser.add_argument('pa... | |
0c4d113b7379ac4eea6a51f1c510881095caf9e8 | contrib/session_generator.py | contrib/session_generator.py | #!/usr/bin/env python
# Works with both python2 and python3; please preserve this property
# Copyright (C) 2016 mod_auth_gssapi contributors - See COPYING for (C) terms
# Simple script to generate GssapiSessionKey values
import base64
import os
bits = base64.b64encode(os.urandom(32))
print("GssapiSessionKey key:" +... | Add simple script for generating session keys | Add simple script for generating session keys
Signed-off-by: Robbie Harwood <3f8631879978f4cea53bf1163760f1ac18f9cb08@redhat.com>
Reviewed-by: Simo Sorce <65f99581a93cf30dafc32b5c178edc6b0294a07f@redhat.com>
Closes #105
| Python | mit | frenche/mod_auth_gssapi,frenche/mod_auth_gssapi,frenche/mod_auth_gssapi,frenche/mod_auth_gssapi | ---
+++
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+# Works with both python2 and python3; please preserve this property
+
+# Copyright (C) 2016 mod_auth_gssapi contributors - See COPYING for (C) terms
+
+# Simple script to generate GssapiSessionKey values
+
+import base64
+import os
+
+bits = base64.b64encode(os.urando... | |
7e0f1552ebdadb8f2023167afcd557bdc09b06f9 | scripts/analysis/plot_velocity_based_position_controller_data.py | scripts/analysis/plot_velocity_based_position_controller_data.py | import numpy as np
import matplotlib.pyplot as plt
import sys
if sys.argc < 2:
print "Usage ./plot_velocity_based_position_controller.py [File_name]"
sys.exit(-1)
data = np.genfromtxt(sys.argv[-1], delimiter=',')
# 0 for x, 1 for y 2 for z and 3 for yaw
plot_axis = 3;
ts = (data[:,0] - data[0, 0])/1e9
plt.fi... | Add plotting script for analyzing velocity based position controller | Add plotting script for analyzing velocity based position controller
| Python | mpl-2.0 | jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy | ---
+++
@@ -0,0 +1,25 @@
+import numpy as np
+import matplotlib.pyplot as plt
+import sys
+
+if sys.argc < 2:
+ print "Usage ./plot_velocity_based_position_controller.py [File_name]"
+ sys.exit(-1)
+
+data = np.genfromtxt(sys.argv[-1], delimiter=',')
+# 0 for x, 1 for y 2 for z and 3 for yaw
+plot_axis = 3;
+t... | |
26c413ca10550454c773829d4fa7fceafe2e9504 | tests/test_data_checksums.py | tests/test_data_checksums.py | """ test data_checksums"""
from nose.tools import assert_equal
def test_data_checksums():
from pyne.data import data_checksums
assert_equal(len(data_checksums), 6)
assert_equal(data_checksums['/neutron/simple_xs'], '3d6e086977783dcdf07e5c6b0c2416be') | Add basic test of data_checksums | Add basic test of data_checksums
| Python | bsd-3-clause | pyne/simplesim | ---
+++
@@ -0,0 +1,8 @@
+""" test data_checksums"""
+from nose.tools import assert_equal
+
+
+def test_data_checksums():
+ from pyne.data import data_checksums
+ assert_equal(len(data_checksums), 6)
+ assert_equal(data_checksums['/neutron/simple_xs'], '3d6e086977783dcdf07e5c6b0c2416be') | |
4eb18bb737cd878fb684d7ce4a0718ff88a1238d | chrome/installer/tools/shortcut_properties.py | chrome/installer/tools/shortcut_properties.py | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Dumps a Windows shortcut's property bag to stdout.
This is required to confirm correctness of properties that aren't readily
available in Windows UI.
"""... | Add a script to installer/tools to dump a shortcut's property bag. | Add a script to installer/tools to dump a shortcut's property bag.
This is required to verify DualMode and AppUserModelId properties which
are not otherwise visible in Windows shortcut properties UI.
BUG=501166
Review URL: https://codereview.chromium.org/1259213005
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e0... | Python | bsd-3-clause | ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,CapOM/... | ---
+++
@@ -0,0 +1,58 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Dumps a Windows shortcut's property bag to stdout.
+
+This is required to confirm correctness of properties that aren't re... | |
4ed4baae070cd6be5164e03369aa28c75e7684f2 | spec/bottling_specs/factory_specs/BottleSingletonAppLoader_specs.py | spec/bottling_specs/factory_specs/BottleSingletonAppLoader_specs.py | import fudge
from bottling.factory import BottleSingletonAppLoader
class describe_init:
def it_initializes_with_given_options(self):
ref = 'my_module:app'
kind = None
loader = BottleSingletonAppLoader(ref, kind)
assert loader.ref == ref
assert loader.kind == None... | Add loader for singleton apps | Add loader for singleton apps
| Python | mit | datamora/datamora,datamora/datamora | ---
+++
@@ -0,0 +1,30 @@
+import fudge
+from bottling.factory import BottleSingletonAppLoader
+
+
+class describe_init:
+
+ def it_initializes_with_given_options(self):
+ ref = 'my_module:app'
+ kind = None
+
+ loader = BottleSingletonAppLoader(ref, kind)
+
+ assert loader.ref =... | |
5496ccfc164a235521d2b6412b836c3ad84eebc1 | alembic/versions/4fe474604dbb_add_stores_managers_.py | alembic/versions/4fe474604dbb_add_stores_managers_.py | """Add `stores_managers` table
Revision ID: 4fe474604dbb
Revises: 5a0e003fafb2
Create Date: 2013-06-28 22:18:42.292040
"""
# revision identifiers, used by Alembic.
revision = '4fe474604dbb'
down_revision = '5a0e003fafb2'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated... | Add database revision which adds `stores_managers` table | Add database revision which adds `stores_managers` table
| Python | mit | beni55/overholt,mattupstate/overholt,RohithKP/overholt,beni55/overholt,jstacoder/overholt,alexmerser/overholt,jstacoder/overholt,bbuneci/overholt,jstacoder/overholt,qpxu007/overholt,mattupstate/overholt,qpxu007/overholt,qpxu007/overholt,alexmerser/overholt,RohithKP/overholt,jamesblunt/overholt,manhtuhtk/overholt,Rohith... | ---
+++
@@ -0,0 +1,32 @@
+"""Add `stores_managers` table
+
+Revision ID: 4fe474604dbb
+Revises: 5a0e003fafb2
+Create Date: 2013-06-28 22:18:42.292040
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '4fe474604dbb'
+down_revision = '5a0e003fafb2'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+de... | |
b096b3aee871596a535b05266a63fe2655883e91 | compare_rankings.py | compare_rankings.py | """
Copyright 2017 Ronald J. Nowling
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | Add script for comparing rankings | Add script for comparing rankings
| Python | apache-2.0 | rnowling/asaph,rnowling/asaph,rnowling/aranyani | ---
+++
@@ -0,0 +1,64 @@
+"""
+Copyright 2017 Ronald J. Nowling
+
+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... | |
bc2a6a9bc692c48efd894eaa4dce87a1dbb1b712 | journal/migrations/0009_auto_20190211_1515.py | journal/migrations/0009_auto_20190211_1515.py | # Generated by Django 2.1.6 on 2019-02-11 15:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('journal', '0008_remove_userinfo_deleted'),
]
operations = [
migrations.AlterField(
model_name='entry',
name='content... | Add a migration for django 2.1. | Add a migration for django 2.1.
Before this version django itself ignored the editale directive,
so it now created a migration for it. Though it doesn't really
matter as we marked it as such for drf.
| Python | agpl-3.0 | etesync/journal-manager | ---
+++
@@ -0,0 +1,38 @@
+# Generated by Django 2.1.6 on 2019-02-11 15:15
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('journal', '0008_remove_userinfo_deleted'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ mode... | |
4f2f5c5e8bfda8a2ca383843e604c2faf6fcb817 | tests/chainer_tests/dataset_tests/test_download.py | tests/chainer_tests/dataset_tests/test_download.py | import os
import unittest
from chainer import dataset
from chainer import testing
class TestGetSetDatasetRoot(unittest.TestCase):
def test_set_dataset_root(self):
orig_root = dataset.get_dataset_root()
new_root = '/tmp/dataset_root'
try:
dataset.set_dataset_root(new_root)
... | Add some tests on download.py | Add some tests on download.py
| Python | mit | wkentaro/chainer,niboshi/chainer,jnishi/chainer,okuta/chainer,cupy/cupy,niboshi/chainer,ysekky/chainer,cupy/cupy,pfnet/chainer,kashif/chainer,cupy/cupy,delta2323/chainer,chainer/chainer,anaruse/chainer,chainer/chainer,cupy/cupy,keisuke-umezawa/chainer,wkentaro/chainer,kikusu/chainer,ktnyt/chainer,chainer/chainer,keisuk... | ---
+++
@@ -0,0 +1,28 @@
+import os
+import unittest
+
+from chainer import dataset
+from chainer import testing
+
+
+class TestGetSetDatasetRoot(unittest.TestCase):
+
+ def test_set_dataset_root(self):
+ orig_root = dataset.get_dataset_root()
+ new_root = '/tmp/dataset_root'
+ try:
+ ... | |
717dc2de1c605190127067263bd8fb1581d7d57d | lib/python2.6/aquilon/server/locks.py | lib/python2.6/aquilon/server/locks.py | # ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
import logging
from threading import Condition, Lock
from aquilon.locks import LockQueue, LockKey
from aquilon.exceptions_ import InternalError
from aquilon.server.logger import CLIENT_INFO
LOGGER = logging.getLogger(... | Introduce the LockQueue into the broker. | Introduce the LockQueue into the broker.
The aquilon.server.locks module instantiates a lock_queue for use
by the broker.
It also defines a number of keys that can be used by the broker.
Each of these keys carve out a swath of the namespace available
and define the layers of the key.
| Python | apache-2.0 | quattor/aquilon,quattor/aquilon,guillaume-philippon/aquilon,guillaume-philippon/aquilon,stdweird/aquilon,guillaume-philippon/aquilon,stdweird/aquilon,stdweird/aquilon,quattor/aquilon | ---
+++
@@ -0,0 +1,74 @@
+# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
+
+
+import logging
+from threading import Condition, Lock
+
+from aquilon.locks import LockQueue, LockKey
+from aquilon.exceptions_ import InternalError
+from aquilon.server.logger import CLIE... | |
5ca2e6cbb7056d0bc25ee52815e0742b4f13a703 | tests/functional/test_six_imports.py | tests/functional/test_six_imports.py | import os
import botocore
import ast
ROOTDIR = os.path.dirname(botocore.__file__)
def test_no_bare_six_imports():
for rootdir, dirnames, filenames in os.walk(ROOTDIR):
if 'vendored' in dirnames:
# We don't need to lint our vendored packages.
dirnames.remove('vendored')
fo... | Add linting for bare six imports | Add linting for bare six imports
| Python | apache-2.0 | pplu/botocore,boto/botocore | ---
+++
@@ -0,0 +1,54 @@
+import os
+import botocore
+import ast
+
+
+ROOTDIR = os.path.dirname(botocore.__file__)
+
+
+def test_no_bare_six_imports():
+ for rootdir, dirnames, filenames in os.walk(ROOTDIR):
+ if 'vendored' in dirnames:
+ # We don't need to lint our vendored packages.
+ ... | |
c172d9a13e3abde902f743b2179bc396248d9fa9 | magpy/server/_ejdb.py | magpy/server/_ejdb.py | """EJDB driver for Magpy.
Currently does not do much except support certain command line scripts.
"""
import pyejdb
class Database(object):
"""Simple database connection for use in serverside scripts etc."""
def __init__(self,
database_name=None,
config_file=None):
se... | Add a little support for ejdb. | Add a little support for ejdb.
| Python | bsd-3-clause | zeth/magpy,catsmith/magpy,zeth/magpy,catsmith/magpy | ---
+++
@@ -0,0 +1,41 @@
+"""EJDB driver for Magpy.
+Currently does not do much except support certain command line scripts.
+"""
+import pyejdb
+
+
+class Database(object):
+ """Simple database connection for use in serverside scripts etc."""
+ def __init__(self,
+ database_name=None,
+ ... | |
70c69291358a606a21d77d7ae9a9270e98438ddc | mapnik/conversions.py | mapnik/conversions.py | """Unit conversion helpers."""
def m2pt(x, pt_size=0.0254/72.0):
"""Converts distance from meters to points. Default value is PDF point size."""
return x / pt_size
def pt2m(x, pt_size=0.0254/72.0):
"""Converts distance from points to meters. Default value is PDF point size."""
return x * pt_size
def ... | Move the conversion helpers into a separate module | Move the conversion helpers into a separate module
No change in behaviour except more flexibility for m2pt pt_size
| Python | lgpl-2.1 | tomhughes/python-mapnik,mapnik/python-mapnik,tomhughes/python-mapnik,tomhughes/python-mapnik,mapnik/python-mapnik,mapnik/python-mapnik | ---
+++
@@ -0,0 +1,17 @@
+"""Unit conversion helpers."""
+
+def m2pt(x, pt_size=0.0254/72.0):
+ """Converts distance from meters to points. Default value is PDF point size."""
+ return x / pt_size
+
+def pt2m(x, pt_size=0.0254/72.0):
+ """Converts distance from points to meters. Default value is PDF point si... | |
1757b2fef3d617338bfc07802eaa8ac6e75c14e9 | raiden/tests/integration/cli/conftest.py | raiden/tests/integration/cli/conftest.py | import os
import pytest
from raiden.tests.utils.smoketest import (
load_smoketest_config,
start_ethereum
)
@pytest.fixture(scope='session')
def blockchain_provider():
print("fixture init")
smoketest_config = load_smoketest_config()
ethereum, ethereum_config = start_ethereum(smoketest_config['gene... | Add CLI tests session scoped fixture. | tests/integration/cli: Add CLI tests session scoped fixture.
The test fixture starts the blockchain with preconfigured
smoketest network, retrieves contract addresses and returns
an object to be accessed by test cases.
Refs: #1408
| Python | mit | hackaugusto/raiden,hackaugusto/raiden | ---
+++
@@ -0,0 +1,32 @@
+import os
+import pytest
+
+from raiden.tests.utils.smoketest import (
+ load_smoketest_config,
+ start_ethereum
+)
+
+
+@pytest.fixture(scope='session')
+def blockchain_provider():
+ print("fixture init")
+ smoketest_config = load_smoketest_config()
+ ethereum, ethereum_confi... | |
0eb9964f42f74596b38d9031b329f8ce2e0c1e9f | directory_lister.py | directory_lister.py | #Test to see recursive directory lister
import os
def lister(dir_name):
os.chdir(dir_name)
dirs = os.listdir(os.getcwd())
for file in dirs:
if not os.path.isdir(file):
print(file + "Location: "+os.getcwd())
else:
lister(file)
all_files = []
dir_name = input("Directory... | Test for a recursive directory lister. | Test for a recursive directory lister.
| Python | mit | cvhariharan/Offline,cvhariharan/Offline,cvhariharan/Offline | ---
+++
@@ -0,0 +1,15 @@
+#Test to see recursive directory lister
+import os
+def lister(dir_name):
+ os.chdir(dir_name)
+ dirs = os.listdir(os.getcwd())
+ for file in dirs:
+ if not os.path.isdir(file):
+ print(file + "Location: "+os.getcwd())
+ else:
+ lister(file)
+all_... | |
7598bb04c2826f5f6bbcf8ff26f9a799ded7cbe3 | tests/nose_plugins.py | tests/nose_plugins.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2010-2012 Cidadania S. Coop. Galega
#
# This file is part of e-cidadania.
#
# e-cidadania is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | Add a nose plugin to clear the database after every test. | Add a nose plugin to clear the database after every test.
| Python | apache-2.0 | cidadania/e-cidadania,cidadania/e-cidadania | ---
+++
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2010-2012 Cidadania S. Coop. Galega
+#
+# This file is part of e-cidadania.
+#
+# e-cidadania is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Found... | |
b45b6256b442942564ba447913ad4a1bec77db19 | Problem063/Python/solution_1.py | Problem063/Python/solution_1.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © Manoel Vilela 2017
#
# @team: DestructHub
# @project: ProjectEuler
# @author: Manoel Vilela
# @email: manoel_vilela@engineer.com
#
print(len([a ** n
for a in range(1, 10)
for n in range(1, 22)
if len(s... | Add solution for Problem063 written in Python | Add solution for Problem063 written in Python
| Python | mit | DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectE... | ---
+++
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright © Manoel Vilela 2017
+#
+# @team: DestructHub
+# @project: ProjectEuler
+# @author: Manoel Vilela
+# @email: manoel_vilela@engineer.com
+#
+
+
+print(len([a ** n
+ for a in range(1, 10)
+ ... | |
5c91a2c8dda69d37fd3cd0989ff6c3883851eaef | saleor/product/templatetags/product_images.py | saleor/product/templatetags/product_images.py | import logging
import warnings
from django.template.context_processors import static
from django import template
from django.conf import settings
logger = logging.getLogger(__name__)
register = template.Library()
# cache available sizes at module level
def get_available_sizes():
all_sizes = set()
keys = set... | Introduce templatetag for fetching image thumbnails | Introduce templatetag for fetching image thumbnails
| Python | bsd-3-clause | tfroehlich82/saleor,itbabu/saleor,UITools/saleor,maferelo/saleor,tfroehlich82/saleor,tfroehlich82/saleor,car3oon/saleor,KenMutemi/saleor,KenMutemi/saleor,jreigel/saleor,maferelo/saleor,car3oon/saleor,KenMutemi/saleor,mociepka/saleor,car3oon/saleor,HyperManTT/ECommerceSaleor,HyperManTT/ECommerceSaleor,maferelo/saleor,UI... | ---
+++
@@ -0,0 +1,43 @@
+import logging
+import warnings
+
+from django.template.context_processors import static
+from django import template
+from django.conf import settings
+
+logger = logging.getLogger(__name__)
+register = template.Library()
+
+
+# cache available sizes at module level
+def get_available_sizes... | |
761ec2bd6492b041eb658ee836a63ffb877469d5 | cbv/management/commands/load_all_django_versions.py | cbv/management/commands/load_all_django_versions.py | import os
import re
from django.conf import settings
from django.core.management import call_command, BaseCommand
class Command(BaseCommand):
"""Load the Django project fixtures and all version fixtures"""
def handle(self, **options):
fixtures_dir = os.path.join(settings.DIRNAME, 'cbv', 'fixtures')
... | Add management command to load all version fixtures | Add management command to load all version fixtures
Because life's too short
| Python | bsd-2-clause | refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector | ---
+++
@@ -0,0 +1,22 @@
+import os
+import re
+
+from django.conf import settings
+from django.core.management import call_command, BaseCommand
+
+
+class Command(BaseCommand):
+ """Load the Django project fixtures and all version fixtures"""
+
+ def handle(self, **options):
+ fixtures_dir = os.path.joi... | |
eb429be1fdc7335bec5ba036fcece309778b23f0 | examples/rmg/heptane-filterReactions/input.py | examples/rmg/heptane-filterReactions/input.py | # Data sources
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = 'default',
kineticsEstimator = 'rate rules',
)
# Constraints on generated species
generatedSpeciesConstraints(
maximumCa... | Add an example that uses filterReactions AND pdep at the same time | Add an example that uses filterReactions AND pdep at the same time
| Python | mit | pierrelb/RMG-Py,nyee/RMG-Py,nickvandewiele/RMG-Py,nyee/RMG-Py,chatelak/RMG-Py,chatelak/RMG-Py,pierrelb/RMG-Py,nickvandewiele/RMG-Py | ---
+++
@@ -0,0 +1,75 @@
+# Data sources
+database(
+ thermoLibraries = ['primaryThermoLibrary'],
+ reactionLibraries = [],
+ seedMechanisms = [],
+ kineticsDepositories = ['training'],
+ kineticsFamilies = 'default',
+ kineticsEstimator = 'rate rules',
+)
+
+# Constraints on generated species
+gen... | |
3a240005142da25aa49938a15d39ddf68dd7cead | nova/tests/functional/api/openstack/placement/test_verify_policy.py | nova/tests/functional/api/openstack/placement/test_verify_policy.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Add functional test to verify presence of policy | [placement] Add functional test to verify presence of policy
Add a test that traverses all available placement URLs at the latest
microversion and tries to access them as non-admin. If something other
than a 403 response is given a failed test with a message like
method POST on route /resource_providers/{uuid}/in... | Python | apache-2.0 | mahak/nova,rahulunair/nova,klmitch/nova,openstack/nova,mikalstill/nova,rahulunair/nova,gooddata/openstack-nova,mikalstill/nova,gooddata/openstack-nova,rahulunair/nova,klmitch/nova,mikalstill/nova,klmitch/nova,mahak/nova,openstack/nova,klmitch/nova,openstack/nova,mahak/nova,gooddata/openstack-nova,gooddata/openstack-nov... | ---
+++
@@ -0,0 +1,50 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agr... | |
8f6db5945348879a7340f8a4c7da6111a06cd062 | python/smqtk/web/search_app/modules/static_host.py | python/smqtk/web/search_app/modules/static_host.py | import flask
__author__ = 'paul.tunison@kitware.com'
class StaticDirectoryHost (flask.Blueprint):
"""
Module that will host a given directory to the given URL prefix (relative to
the parent module's prefix).
Instances of this class will have nothing set to their static URL path, as a
blank stri... | Add new module to statically host an arbitrary directory | Add new module to statically host an arbitrary directory
| Python | bsd-3-clause | Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,Purg/SMQTK,Purg/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK | ---
+++
@@ -0,0 +1,25 @@
+import flask
+
+
+__author__ = 'paul.tunison@kitware.com'
+
+
+class StaticDirectoryHost (flask.Blueprint):
+ """
+ Module that will host a given directory to the given URL prefix (relative to
+ the parent module's prefix).
+
+ Instances of this class will have nothing set to the... | |
fdb8f36fd4eed11d5d757d8477b3c2b8619aae8a | corehq/apps/commtrack/management/commands/product_program_last_modified.py | corehq/apps/commtrack/management/commands/product_program_last_modified.py | from django.core.management.base import BaseCommand
from corehq.apps.commtrack.models import Product, Program
from dimagi.utils.couch.database import iter_docs
from datetime import datetime
import json
class Command(BaseCommand):
help = 'Populate last_modified field for products and programs'
def handle(self,... | Add management command to populate last_modified fields | Add management command to populate last_modified fields
| Python | bsd-3-clause | qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttara... | ---
+++
@@ -0,0 +1,53 @@
+from django.core.management.base import BaseCommand
+from corehq.apps.commtrack.models import Product, Program
+from dimagi.utils.couch.database import iter_docs
+from datetime import datetime
+import json
+
+class Command(BaseCommand):
+ help = 'Populate last_modified field for products ... | |
bbc4351a5611a035bbee1f18cb55b74d9583cdcd | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Add_Object.py | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Add_Object.py | #!/usr/bin/env python
# encoding=utf8
import json
import requests
from flexbe_core import EventState, Logger
class Wonderland_Add_Object(EventState):
'''
Add an object to Wonderland.
For the room, enter only ID or Name, not both.
Return the ID of the added human.
># name string name of the human
... | Create a state for add an object | Create a state for add an object
| Python | bsd-3-clause | WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors | ---
+++
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+# encoding=utf8
+
+import json
+import requests
+from flexbe_core import EventState, Logger
+
+
+class Wonderland_Add_Object(EventState):
+ '''
+ Add an object to Wonderland.
+ For the room, enter only ID or Name, not both.
+ Return the ID of the added human.
+
+ ># na... | |
78bc96307fb52d95e36eab1da6fa57a66af736e8 | corehq/apps/sms/management/commands/delete_messaging_couch_phone_numbers.py | corehq/apps/sms/management/commands/delete_messaging_couch_phone_numbers.py | from corehq.apps.sms.mixin import VerifiedNumber
from corehq.apps.sms.models import PhoneNumber
from dimagi.utils.couch.database import iter_docs_with_retry, iter_bulk_delete_with_doc_type_verification
from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
... | Add script to delete couch phone numbers | Add script to delete couch phone numbers
| Python | bsd-3-clause | qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,60 @@
+from corehq.apps.sms.mixin import VerifiedNumber
+from corehq.apps.sms.models import PhoneNumber
+from dimagi.utils.couch.database import iter_docs_with_retry, iter_bulk_delete_with_doc_type_verification
+from django.core.management.base import BaseCommand
+from optparse import make_option
+... | |
e0770c4a671c650f4569036350b4047fcf925506 | AnalysisDemo.py | AnalysisDemo.py | import wx
#import matplotlib
class AnalysisDemo(wx.Frame):
def __init__(self, *args, **kw):
super(AnalysisDemo, self).__init__(*args, **kw)
self.initMain()
def initMain(self):
pn = wx.Panel(self)
self.showPackage = wx.RadioButton(pn, label='Organize in package')
self.s... | Add a demo app to illustrate the result | Add a demo app to illustrate the result
| Python | mit | plumer/codana,plumer/codana | ---
+++
@@ -0,0 +1,44 @@
+import wx
+#import matplotlib
+
+class AnalysisDemo(wx.Frame):
+ def __init__(self, *args, **kw):
+ super(AnalysisDemo, self).__init__(*args, **kw)
+ self.initMain()
+
+ def initMain(self):
+ pn = wx.Panel(self)
+
+ self.showPackage = wx.RadioButton(pn, labe... | |
c3a83ed6158fcd9335f9253417ca4b24e9ab7934 | tests/pytests/unit/modules/test_network.py | tests/pytests/unit/modules/test_network.py | import threading
import pytest
import salt.modules.network as networkmod
from tests.support.mock import patch
@pytest.fixture
def configure_loader_modules():
return {networkmod: {}}
@pytest.fixture
def socket_errors():
# Not sure what kind of errors could be returned by getfqdn or
# gethostbyaddr, but ... | Add test for fqdn thread leak | Add test for fqdn thread leak
I wasn't positive what other errors could be raised here, but we did
have a user reporting thread leaks, and the existing code *could* have
thread leaks if unhandled exceptions are raised on the ThreadPool.
This test *should* work - there might be some weird circumstances where
other thr... | Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,30 @@
+import threading
+
+import pytest
+import salt.modules.network as networkmod
+from tests.support.mock import patch
+
+
+@pytest.fixture
+def configure_loader_modules():
+ return {networkmod: {}}
+
+
+@pytest.fixture
+def socket_errors():
+ # Not sure what kind of errors could be return... | |
9925f3a677b7a855a2242176139bde4ab9d62ba0 | labonneboite/scripts/nb_hirings/rome_nb_bonne_boite.py | labonneboite/scripts/nb_hirings/rome_nb_bonne_boite.py | import pandas as pd
if __name__ == '__main__':
df = pd.read_csv('prediction_per_company_per_rome2019-11-08.csv')
df_rome_nb_bonne_boite = df.groupby(['rome'])['is a bonne boite ?'].sum()
df_rome_nb_bonne_boite.to_csv('nb_bonne_boite_per_rome2019-11-089.csv')
| Add script which will compute the number of 'bonnes boites' per rome | Add script which will compute the number of 'bonnes boites' per rome
| Python | agpl-3.0 | StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite | ---
+++
@@ -0,0 +1,7 @@
+import pandas as pd
+
+if __name__ == '__main__':
+
+ df = pd.read_csv('prediction_per_company_per_rome2019-11-08.csv')
+ df_rome_nb_bonne_boite = df.groupby(['rome'])['is a bonne boite ?'].sum()
+ df_rome_nb_bonne_boite.to_csv('nb_bonne_boite_per_rome2019-11-089.csv') | |
a6c8176e3f4602e846888293093fc64b7b20233b | corehq/motech/repeaters/management/commands/send_cancelled_records.py | corehq/motech/repeaters/management/commands/send_cancelled_records.py | import csv
import datetime
import re
import time
from django.core.management.base import BaseCommand
from corehq.motech.repeaters.const import RECORD_CANCELLED_STATE
from corehq.motech.repeaters.dbaccessors import iter_repeat_records_by_domain
class Command(BaseCommand):
help = """
Send cancelled repeat rec... | Add cmd to force send of cancelled repeat records | Add cmd to force send of cancelled repeat records
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,85 @@
+import csv
+import datetime
+import re
+import time
+
+from django.core.management.base import BaseCommand
+
+from corehq.motech.repeaters.const import RECORD_CANCELLED_STATE
+from corehq.motech.repeaters.dbaccessors import iter_repeat_records_by_domain
+
+
+class Command(BaseCommand):
+ ... | |
bf66372b2b5b49ba4a93d8ac4f573ceb7857f5b8 | python/helpers/pydev/pydevd_attach_to_process/linux/lldb_threads_settrace.py | python/helpers/pydev/pydevd_attach_to_process/linux/lldb_threads_settrace.py | # This file is meant to be run inside lldb as a command after
# the attach_linux.dylib dll has already been loaded to settrace for all threads.
def __lldb_init_module(debugger, internal_dict):
# Command Initialization code goes here
print('Startup LLDB in Python!')
try:
show_debug_info = 0
... | # This file is meant to be run inside lldb as a command after
# the attach_linux.dylib dll has already been loaded to settrace for all threads.
def __lldb_init_module(debugger, internal_dict):
# Command Initialization code goes here
print('Startup LLDB in Python!')
import lldb
try:
show_debug_i... | Fix attach in case of multiple threads. | Fix attach in case of multiple threads.
| Python | apache-2.0 | kool79/intellij-community,da1z/intellij-community,retomerz/intellij-community,blademainer/intellij-community,SerCeMan/intellij-community,retomerz/intellij-community,ol-loginov/intellij-community,holmes/intellij-community,kool79/intellij-community,lucafavatella/intellij-community,xfournet/intellij-community,adedayo/inte... | ---
+++
@@ -3,20 +3,34 @@
def __lldb_init_module(debugger, internal_dict):
# Command Initialization code goes here
print('Startup LLDB in Python!')
+ import lldb
try:
- show_debug_info = 0
+ show_debug_info = 1
is_debug = 0
target = debugger.GetSelectedTarget()
... |
efb6072e097a816bb46fdd83541c763e222816c9 | clic/dickens/test_concordance.py | clic/dickens/test_concordance.py | import unittest
from concordance_new import Concordancer_New
class TestConcordancerNewChapterIndex(unittest.TestCase):
def test_create_concordance(self):
"""
This is a very naive test to run whilst reviewing the create
concordance code. It's goal is simply to evaluate whether that
... | Add initial tests for the concordance view | Add initial tests for the concordance view
These tests can be run simply using `python test_concordance.py`.
The test suite is currently very limited. It is a tool to refactoring
the current code.
| Python | mit | CentreForResearchInAppliedLinguistics/clic,CentreForResearchInAppliedLinguistics/clic,CentreForCorpusResearch/clic,CentreForCorpusResearch/clic,CentreForResearchInAppliedLinguistics/clic,CentreForCorpusResearch/clic | ---
+++
@@ -0,0 +1,42 @@
+import unittest
+from concordance_new import Concordancer_New
+
+
+class TestConcordancerNewChapterIndex(unittest.TestCase):
+
+ def test_create_concordance(self):
+ """
+ This is a very naive test to run whilst reviewing the create
+ concordance code. It's goal ... | |
c131e6108a72c57af4d3bdbe67d182d6c0ddb1eb | geotrek/feedback/migrations/0008_auto_20200326_1252.py | geotrek/feedback/migrations/0008_auto_20200326_1252.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-03-26 12:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('feedback', '0007_auto_20200324_1412'),
]
operatio... | Add migration to modify on_delete | Add migration to modify on_delete
| Python | bsd-2-clause | GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin | ---
+++
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.27 on 2020-03-26 12:52
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('feedback', '0007_au... | |
b42c13de01a49e7fe3fb7caa22089ea1cd87f7bf | ironicclient/tests/functional/osc/v1/test_baremetal_node_power_states.py | ironicclient/tests/functional/osc/v1/test_baremetal_node_power_states.py | # Copyright (c) 2016 Mirantis, 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 applicable law... | Add sanity tests for baremetal power state commands | Add sanity tests for baremetal power state commands
Add sanity testcases for commands:
openstack baremetal node reboot,
openstack baremetal node power on,
openstack baremetal node power off.
Change-Id: I24bc2dcd1ef27d918b072ea686d53c0c8aa8b7ab
Partial-Bug: #1642597
| Python | apache-2.0 | openstack/python-ironicclient,openstack/python-ironicclient | ---
+++
@@ -0,0 +1,58 @@
+# Copyright (c) 2016 Mirantis, 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
+#
+# ... | |
5dde9f6aca671440253729c29530e93974921ea0 | moderation_queue/migrations/0007_auto_20150303_1420.py | moderation_queue/migrations/0007_auto_20150303_1420.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('moderation_queue', '0006_auto_20150303_0838'),
]
operations = [
migrations.AlterField(
model_name='queuedimage',... | Add a migration to add the 'Other' field to QueuedImage.why_allowed | Add a migration to add the 'Other' field to QueuedImage.why_allowed
| Python | agpl-3.0 | mysociety/yournextrepresentative,YoQuieroSaber/yournextrepresentative,mysociety/yournextmp-popit,neavouli/yournextrepresentative,datamade/yournextmp-popit,mysociety/yournextrepresentative,openstate/yournextrepresentative,YoQuieroSaber/yournextrepresentative,mysociety/yournextrepresentative,neavouli/yournextrepresentati... | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('moderation_queue', '0006_auto_20150303_0838'),
+ ]
+
+ operations = [
+ migrations.AlterFie... | |
f627f04ebe0186b19d58619cab8b7098f5ca2e4c | plugins/openstack/nova/nova-server-state-metrics.py | plugins/openstack/nova/nova-server-state-metrics.py | #!/usr/bin/env python
from argparse import ArgumentParser
import socket
import time
from novaclient.v3 import Client
DEFAULT_SCHEME = '{}.nova.states'.format(socket.gethostname())
def output_metric(name, value):
print '{}\t{}\t{}'.format(name, value, int(time.time()))
def main():
parser = ArgumentParser()
... | Add plugin for Nova server state metrics | Add plugin for Nova server state metrics
| Python | mit | giorgiosironi/sensu-community-plugins,Squarespace/sensu-community-plugins,zerOnepal/sensu-community-plugins,lfdesousa/sensu-community-plugins,maoe/sensu-community-plugins,aryeguy/sensu-community-plugins,royalj/sensu-community-plugins,lenfree/sensu-community-plugins,new23d/sensu-community-plugins,tuenti/sensu-community-... | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+from argparse import ArgumentParser
+import socket
+import time
+
+from novaclient.v3 import Client
+
+DEFAULT_SCHEME = '{}.nova.states'.format(socket.gethostname())
+
+def output_metric(name, value):
+ print '{}\t{}\t{}'.format(name, value, int(time.time()))
+
+def... | |
9aeb9d35cd49ccd7ab1ede87d70666e34b80320c | readthedocs/rtd_tests/tests/test_core_management.py | readthedocs/rtd_tests/tests/test_core_management.py | from StringIO import StringIO
from django.test import TestCase
from mock import patch
from core.management.commands import run_docker
from projects.models import Project
from builds.models import Version
class TestRunDocker(TestCase):
'''Test run_docker command with good input and output'''
fixtures = ['te... | Add tests for run docker mgmt command | Add tests for run docker mgmt command
| Python | mit | Tazer/readthedocs.org,rtfd/readthedocs.org,soulshake/readthedocs.org,davidfischer/readthedocs.org,takluyver/readthedocs.org,sid-kap/readthedocs.org,sunnyzwh/readthedocs.org,pombredanne/readthedocs.org,laplaceliu/readthedocs.org,takluyver/readthedocs.org,espdev/readthedocs.org,sils1297/readthedocs.org,wijerasa/readthedo... | ---
+++
@@ -0,0 +1,68 @@
+from StringIO import StringIO
+
+from django.test import TestCase
+from mock import patch
+
+from core.management.commands import run_docker
+from projects.models import Project
+from builds.models import Version
+
+
+class TestRunDocker(TestCase):
+ '''Test run_docker command with good i... | |
cbaf4e86c4409735a8f011f5a8f801a34278c21c | src/ggrc/migrations/versions/20170112013716_421b2179c02e_update_fulltext_index.py | src/ggrc/migrations/versions/20170112013716_421b2179c02e_update_fulltext_index.py | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Update fulltext index.
Create Date: 2017-01-12 01:37:16.801973
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
import sqlalchemy as sa
... | Increase text index property size | Increase text index property size
The index property size should support strings of the same length as
custom attribute definition titles.
| Python | apache-2.0 | VinnieJohns/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,plamut/ggrc-core | ---
+++
@@ -0,0 +1,39 @@
+# Copyright (C) 2017 Google Inc.
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+
+"""Update fulltext index.
+
+Create Date: 2017-01-12 01:37:16.801973
+"""
+# disable Invalid constant name pylint warning for mandatory Alembic variables.
+# pylint: disable=in... | |
241ac6d844febf829f6442897ebf547a291e5db4 | summarization/summarization.py | summarization/summarization.py | import indicoio
import csv
indicoio.config.api_key = 'YOUR_API_KEY'
def clean_article(article):
return article.replace("\n", " ").decode('cp1252').encode('utf-8', 'replace')
def clean_articles(article_list):
# data processing: clean up new lines and convert strings into utf-8 so the indico API can read the d... | Add Summarization API code for blog post | Add Summarization API code for blog post | Python | mit | IndicoDataSolutions/SuperCell | ---
+++
@@ -0,0 +1,28 @@
+import indicoio
+import csv
+
+indicoio.config.api_key = 'YOUR_API_KEY'
+
+def clean_article(article):
+ return article.replace("\n", " ").decode('cp1252').encode('utf-8', 'replace')
+
+def clean_articles(article_list):
+ # data processing: clean up new lines and convert strings into u... | |
bb43a2e63f7f7c337b01ef855d426a84b73eeee5 | telemeta/management/commands/telemeta-export-items-from-user-playlists.py | telemeta/management/commands/telemeta-export-items-from-user-playlists.py | from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from django.utils import translation
from telemeta.models import Playlist, MediaCollection, ... | Add a command prototype to list all items from a playlist | Add a command prototype to list all items from a playlist
| Python | agpl-3.0 | Parisson/Telemeta,Parisson/Telemeta,Parisson/Telemeta,Parisson/Telemeta | ---
+++
@@ -0,0 +1,33 @@
+from optparse import make_option
+from django.conf import settings
+from django.core.management.base import BaseCommand, CommandError
+from django.contrib.auth.models import User
+from django.template.defaultfilters import slugify
+from django.utils import translation
+
+from telemeta.models... | |
a62dc18745f952b3fcb05ddf4768758e25883698 | accelerator/migrations/0058_grant_staff_clearance_for_existing_staff_members.py | accelerator/migrations/0058_grant_staff_clearance_for_existing_staff_members.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-06-12 19:38
from __future__ import unicode_literals
from django.db import migrations
STAFF = "Staff" # don't import from models in migrations.
def grant_staff_clearances_for_role_grantees(apps, program_role):
Clearance = apps.get_model('accelerator', ... | Add datamigration to create staff clearances | [AC-6516] Add datamigration to create staff clearances
| Python | mit | masschallenge/django-accelerator,masschallenge/django-accelerator | ---
+++
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2019-06-12 19:38
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+STAFF = "Staff" # don't import from models in migrations.
+
+def grant_staff_clearances_for_role_grantees(apps, program_role):
+ Clear... | |
2d18583309a189e263bda13e19f7a05ba832c14d | backend/scripts/templates/templates2file.py | backend/scripts/templates/templates2file.py | #!/usr/bin/env python
import rethinkdb as r
from optparse import OptionParser
import json
import os
if __name__ == "__main__":
parser = OptionParser()
parser.add_option("-P", "--port", dest="port", type="int",
help="rethinkdb port", default=30815)
(options, args) = parser.parse_args(... | Add file to write templates to json | Add file to write templates to json
| Python | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import rethinkdb as r
+from optparse import OptionParser
+import json
+import os
+
+if __name__ == "__main__":
+ parser = OptionParser()
+ parser.add_option("-P", "--port", dest="port", type="int",
+ help="rethinkdb port", default=30815)
+ ... | |
6df873a26ff71b07e68dcb2e9fa9c4b1725a70ce | src/nodeconductor_assembly_waldur/experts/migrations/0003_expertbid.py | src/nodeconductor_assembly_waldur/experts/migrations/0003_expertbid.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-07-07 15:09
from __future__ import unicode_literals
from decimal import Decimal
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import nodeconductor.core.fields
class Migration(migrations.Migration):
... | Add migration for expert bid | Add migration for expert bid [WAL-976]
| Python | mit | opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur | ---
+++
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.1 on 2017-07-07 15:09
+from __future__ import unicode_literals
+
+from decimal import Decimal
+import django.core.validators
+from django.db import migrations, models
+import django.db.models.deletion
+import nodeconductor.core.fields
+
+
+... | |
8e983472134817c1312e3713ca45c7359300dedf | academics/management/commands/set_student_current.py | academics/management/commands/set_student_current.py | #!/usr/bin/python
import logging
from datetime import date
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from academics.models import Student, Enrollment, AcademicYear
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Import reset stu... | Set students current flag based on enrolled and attending | Set students current flag based on enrolled and attending
| Python | mit | rectory-school/rectory-apps,rectory-school/rectory-apps,rectory-school/rectory-apps,rectory-school/rectory-apps,rectory-school/rectory-apps | ---
+++
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+import logging
+from datetime import date
+
+from django.core.management.base import BaseCommand, CommandError
+from django.db import transaction
+
+from academics.models import Student, Enrollment, AcademicYear
+
+logger = logging.getLogger(__name__)
+
+class Command(Ba... | |
b0d50f52f45d8f1c7de261c7fe8d15e621d0e641 | scripts/theanets-untie.py | scripts/theanets-untie.py | #!/usr/bin/env python
import climate
import cPickle as pickle
import gzip
import numpy as np
logging = climate.get_logger('theanets-untie')
@climate.annotate(
source='load a saved network from FILE',
target='save untied network weights to FILE',
)
def main(source, target):
opener = gzip.open if source.en... | Add a script to "untie" tied model weights. | Add a script to "untie" tied model weights.
Might need some more work in updating "layers" parameter.
Could help address issue #39.
| Python | mit | lmjohns3/theanets,devdoer/theanets,chrinide/theanets | ---
+++
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+import climate
+import cPickle as pickle
+import gzip
+import numpy as np
+
+logging = climate.get_logger('theanets-untie')
+
+@climate.annotate(
+ source='load a saved network from FILE',
+ target='save untied network weights to FILE',
+)
+def main(source, tar... | |
339fdd927f9da0f7e15726d087c9916301aef935 | softMarginSVMwithKernels/howItWorksSoftMarginSVM.py | softMarginSVMwithKernels/howItWorksSoftMarginSVM.py | # -*- coding: utf-8 -*-
"""Soft Margin SVM classification with kernels for machine learning.
Soft margin SVM is basically an SVM (see folder **supportVectorMachine**) which
has some 'slack' and allows features to be 'wrongly' classified to avoid
overfitting the classifier. This also includes kernels. Kernels use the i... | Add soft margin SVM and added kernels and class | Add soft margin SVM and added kernels and class
| Python | mit | a-holm/MachinelearningAlgorithms,a-holm/MachinelearningAlgorithms | ---
+++
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+"""Soft Margin SVM classification with kernels for machine learning.
+
+Soft margin SVM is basically an SVM (see folder **supportVectorMachine**) which
+has some 'slack' and allows features to be 'wrongly' classified to avoid
+overfitting the classifier. This also in... | |
8601790648a17dd1794be4f88d61e4af01349a80 | tests/test_pipeline_chipseq.py | tests/test_pipeline_chipseq.py | """
.. Copyright 2017 EMBL-European Bioinformatics Institute
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 applic... | Test for the chipseq pipeline code | Test for the chipseq pipeline code
| Python | apache-2.0 | Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq | ---
+++
@@ -0,0 +1,71 @@
+"""
+.. Copyright 2017 EMBL-European Bioinformatics Institute
+
+ 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/LICENS... | |
4155d6ca5db149d8b213cc4078580fc2e85d7f4d | vinotes/apps/api/migrations/0002_auto_20150325_1104.py | vinotes/apps/api/migrations/0002_auto_20150325_1104.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='wine',
name='description',
... | Migrate database for model changes. | Migrate database for model changes.
| Python | unlicense | rcutmore/vinotes-api,rcutmore/vinotes-api | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_nam... | |
7ab37e931a836faa78a78f5d8358d845f72cdf49 | point/gemini_cmd.py | point/gemini_cmd.py | #!/usr/bin/env python3
"""
A simple script for sending raw serial commands to Gemini.
"""
import time
import serial
import readline
def main():
ser = serial.Serial('/dev/ttyACM0', baudrate=9600)
while True:
cmd = input('> ')
if len(cmd) == 0:
continue
# losmandy native... | Add low level Gemini serial command script | Add low level Gemini serial command script
| Python | mit | bgottula/point | ---
+++
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+
+"""
+A simple script for sending raw serial commands to Gemini.
+"""
+
+import time
+import serial
+import readline
+
+def main():
+
+ ser = serial.Serial('/dev/ttyACM0', baudrate=9600)
+
+ while True:
+ cmd = input('> ')
+
+ if len(cmd) == 0:
+ ... | |
55fa30c236095006e6f9c970ef668598c4348a96 | src/satosa/micro_service/attribute_modifications.py | src/satosa/micro_service/attribute_modifications.py | import os
import yaml
from satosa.internal_data import DataConverter
from satosa.micro_service.service_base import ResponseMicroService
class AddStaticAttributes(ResponseMicroService):
"""
Add static attributes to the responses.
The path to the file describing the mapping (as YAML) of static attributes... | Add microservice plugin for adding static attributes to responses. | Add microservice plugin for adding static attributes to responses.
| Python | apache-2.0 | irtnog/SATOSA,irtnog/SATOSA,SUNET/SATOSA,its-dirg/SATOSA,SUNET/SATOSA | ---
+++
@@ -0,0 +1,31 @@
+import os
+
+import yaml
+
+from satosa.internal_data import DataConverter
+from satosa.micro_service.service_base import ResponseMicroService
+
+
+class AddStaticAttributes(ResponseMicroService):
+ """
+ Add static attributes to the responses.
+
+ The path to the file describing th... | |
94f5f630c315bc6951c98cd2a9f4908ce05d59a4 | fedmsg/tests/test_encoding.py | fedmsg/tests/test_encoding.py | import unittest
import fedmsg.encoding
from nose.tools import eq_
class TestEncoding(unittest.TestCase):
def test_float_precision(self):
""" Ensure that float precision is limited to 3 decimal places. """
msg = dict(some_number=1234.123456)
json_str = fedmsg.encoding.dumps(msg)
pr... | Test float precision in json encoding. | Test float precision in json encoding.
| Python | lgpl-2.1 | cicku/fedmsg,mathstuf/fedmsg,fedora-infra/fedmsg,maxamillion/fedmsg,fedora-infra/fedmsg,chaiku/fedmsg,vivekanand1101/fedmsg,pombredanne/fedmsg,chaiku/fedmsg,pombredanne/fedmsg,vivekanand1101/fedmsg,maxamillion/fedmsg,mathstuf/fedmsg,fedora-infra/fedmsg,cicku/fedmsg,mathstuf/fedmsg,chaiku/fedmsg,cicku/fedmsg,pombredanne... | ---
+++
@@ -0,0 +1,14 @@
+import unittest
+import fedmsg.encoding
+
+from nose.tools import eq_
+
+
+class TestEncoding(unittest.TestCase):
+ def test_float_precision(self):
+ """ Ensure that float precision is limited to 3 decimal places. """
+ msg = dict(some_number=1234.123456)
+ json_str =... | |
dfb4c5422c79fcd413d0d9a028cb5548e2678454 | generate_test_certificates.py | generate_test_certificates.py | import trustme
# Create a CA
ca = trustme.CA()
# Issue a cert signed by this CA
server_cert = ca.issue_cert(u"www.good.com")
# Save the PEM-encoded data to a file
ca.cert_pem.write_to_path("GoodRootCA.pem")
server_cert.private_key_and_cert_chain_pem.write_to_path("www.good.com.pem")
| Add script for generating test certificates | Add script for generating test certificates
| Python | mit | datatheorem/TrustKit,datatheorem/TrustKit,datatheorem/TrustKit,datatheorem/TrustKit | ---
+++
@@ -0,0 +1,11 @@
+import trustme
+
+# Create a CA
+ca = trustme.CA()
+
+# Issue a cert signed by this CA
+server_cert = ca.issue_cert(u"www.good.com")
+
+# Save the PEM-encoded data to a file
+ca.cert_pem.write_to_path("GoodRootCA.pem")
+server_cert.private_key_and_cert_chain_pem.write_to_path("www.good.com.p... | |
00cdcceb131814b24546c36810682ed78ba866c6 | pyfwk/struc/dbcol.py | pyfwk/struc/dbcol.py | #!/usr/bin/env python
"""
dbcol.py: DBCol is a struct describing an sqlite database table column
"""
# ----------------------------DATABASE-COLUMN-----------------------------#
class DBCol:
name = None
datatype = None
def __init__(self, name, datatype):
self.name = name
self.datatype =... | Create database column class (DBCol) | Create database column class (DBCol)
| Python | mit | rlinguri/pyfwk | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+"""
+ dbcol.py: DBCol is a struct describing an sqlite database table column
+"""
+
+
+# ----------------------------DATABASE-COLUMN-----------------------------#
+class DBCol:
+ name = None
+ datatype = None
+
+ def __init__(self, name, datatype):
+ ... | |
51466e360320267afab41704caecebac0dff1dc2 | src/example/bench_wsh.py | src/example/bench_wsh.py | # Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | Add a handler for performing client load testing. | Add a handler for performing client load testing.
Review URL: http://codereview.appspot.com/3844044
git-svn-id: a751b5b3dcfba0ee4592a85c40d2fdd063ca0d53@379 4ff78f4a-9131-11de-b045-6380ec9940d4
| Python | bsd-3-clause | XiaonuoGantan/pywebsocket,XiaonuoGantan/pywebsocket | ---
+++
@@ -0,0 +1,60 @@
+# Copyright 2011, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notic... | |
f531eb7d1734d6d715893356a50d11eee6bc009a | corehq/apps/users/tests/forms.py | corehq/apps/users/tests/forms.py | from collections import namedtuple
from django.contrib.auth import get_user_model
from django.test import TestCase
from corehq.apps.users.forms import SetUserPasswordForm
Project = namedtuple('Project', ['name', 'strong_mobile_passwords'])
class TestSetUserPasswordForm(TestCase):
def setUp(self):
super(T... | Test mobile set password form | Test mobile set password form
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | ---
+++
@@ -0,0 +1,31 @@
+from collections import namedtuple
+from django.contrib.auth import get_user_model
+from django.test import TestCase
+from corehq.apps.users.forms import SetUserPasswordForm
+
+Project = namedtuple('Project', ['name', 'strong_mobile_passwords'])
+
+
+class TestSetUserPasswordForm(TestCase):
... | |
86c2441be14dbc3303b0bc65356372728a62fd4a | test/performance.py | test/performance.py | from contextlib import contextmanager
import json
import os
import re
import sys
from django.conf import settings
from django.db import connection, reset_queries
count = {}
@contextmanager
def count_queries(k):
q = 0
debug = settings.DEBUG
try:
settings.DEBUG = True
reset_queries()
... | Add infrastructure for counting database queries | Add infrastructure for counting database queries
| Python | agpl-3.0 | terceiro/squad,terceiro/squad,terceiro/squad,terceiro/squad | ---
+++
@@ -0,0 +1,66 @@
+from contextlib import contextmanager
+import json
+import os
+import re
+import sys
+from django.conf import settings
+from django.db import connection, reset_queries
+
+
+count = {}
+
+
+@contextmanager
+def count_queries(k):
+ q = 0
+ debug = settings.DEBUG
+ try:
+ settin... | |
b5568053325bd78c277d4bc0adff59cd12e10f48 | build-plugin.py | build-plugin.py | import os
UnrealEnginePath='/home/qiuwch/workspace/UnrealEngine'
UATScript = os.path.join(UnrealEnginePath, 'Engine/Build/BatchFiles/RunUAT.sh')
FullPluginFile = os.path.abspath('UnrealCV.uplugin')
os.system('%s BuildPlugin -plugin=%s' % (UATScript, FullPluginFile))
| Add a script to build plugin. | Add a script to build plugin.
| Python | mit | qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv | ---
+++
@@ -0,0 +1,5 @@
+import os
+UnrealEnginePath='/home/qiuwch/workspace/UnrealEngine'
+UATScript = os.path.join(UnrealEnginePath, 'Engine/Build/BatchFiles/RunUAT.sh')
+FullPluginFile = os.path.abspath('UnrealCV.uplugin')
+os.system('%s BuildPlugin -plugin=%s' % (UATScript, FullPluginFile)) | |
21d931e35d9e0b32415a408f28e45894f0c3e800 | django_backend_test/noras_menu/tasks.py | django_backend_test/noras_menu/tasks.py | # -*- encoding: utf-8 -*-
#app_mail/tasks.py
import requests
import simplejson as json
from django_backend_test.celery import app
from django.template.loader import render_to_string
from django.utils.html import strip_tags
from django.core.mail import EmailMultiAlternatives
from .models import Subscribers, MenuItems
... | Add task files for celery async process | Add task files for celery async process
| Python | mit | semorale/backend-test,semorale/backend-test,semorale/backend-test | ---
+++
@@ -0,0 +1,32 @@
+# -*- encoding: utf-8 -*-
+
+#app_mail/tasks.py
+import requests
+import simplejson as json
+
+from django_backend_test.celery import app
+from django.template.loader import render_to_string
+from django.utils.html import strip_tags
+from django.core.mail import EmailMultiAlternatives
+from ... | |
849a29b22d656c8079b4ccaf922848fb057c80c5 | forms/migrations/0023_assign_sheets_to_transnational.py | forms/migrations/0023_assign_sheets_to_transnational.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations
def assign_transnational_region_to_sheets(apps, schema_editor):
from forms.models import sheet_models
CountryRegion = apps.get_model("forms", "CountryRegion"... | Add migration to assign appropriate sheets to Transnational CountryRegion | Add migration to assign appropriate sheets to Transnational CountryRegion
| Python | apache-2.0 | Code4SA/gmmp,Code4SA/gmmp,Code4SA/gmmp | ---
+++
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.core.exceptions import ObjectDoesNotExist
+from django.db import migrations
+
+
+def assign_transnational_region_to_sheets(apps, schema_editor):
+ from forms.models import sheet_models
+
+ CountryRegion = a... | |
eeb9b9877f1aa5bc1f22ac4883fe58a57ee0474a | scripts/test_hots.py | scripts/test_hots.py | import numpy as np
events = [
(1162704874, -5547),
(1179727586, -5548),
(1209562198, -5547),
(1224960594, -5548),
]
t, x = zip(*events)
t = np.array(t)
x = np.array(x)
t = t - t[0] # redefine zero time
alpha = 1/t[-1]
t = alpha*t # scale time values
A = np.ones((4, 4))
A[:, -2] = np.array(t)
fo... | Add script to test HOTS | Add script to test HOTS
Add Python script to test Higher-Order Encoder Time Stamping with
sampled data.
| Python | bsd-2-clause | oliverlee/phobos,oliverlee/phobos,oliverlee/phobos,oliverlee/phobos | ---
+++
@@ -0,0 +1,37 @@
+import numpy as np
+
+
+events = [
+ (1162704874, -5547),
+ (1179727586, -5548),
+ (1209562198, -5547),
+ (1224960594, -5548),
+ ]
+
+t, x = zip(*events)
+t = np.array(t)
+x = np.array(x)
+
+t = t - t[0] # redefine zero time
+alpha = 1/t[-1]
+t = alpha*t # scale time values
+
... | |
ee169acf82eff08daa40c461263712f2af2a1131 | scripts/simulate.py | scripts/simulate.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script runs stand-alone simulation on an RMG job. This is effectively the
same script as sensitivity.py
"""
import os.path
import argparse
from rmgpy.tools.sensitivity import runSensitivity
#####################################################################... | Add a standalone simulation script (really a duplicate of sensitivity.py) | Add a standalone simulation script (really a duplicate of sensitivity.py)
| Python | mit | chatelak/RMG-Py,pierrelb/RMG-Py,chatelak/RMG-Py,nyee/RMG-Py,pierrelb/RMG-Py,nickvandewiele/RMG-Py,nyee/RMG-Py,nickvandewiele/RMG-Py | ---
+++
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+This script runs stand-alone simulation on an RMG job. This is effectively the
+same script as sensitivity.py
+"""
+
+import os.path
+import argparse
+
+from rmgpy.tools.sensitivity import runSensitivity
+
+############################... | |
eeb0187b9d474b9b5d1710e8f45f8116894eb15c | temp-sensor02/main.py | temp-sensor02/main.py | from machine import Pin
from ds18x20 import DS18X20
import onewire
import time
import machine
import ujson
import urequests
def posttocloud(temperature):
keystext = open("sparkfun_keys.json").read()
keys = ujson.loads(keystext)
url = keys['inputUrl'] + "?private_key=" + keys['privateKey'] + "&temp=" + str(temper... | Read Temperature from DS18B20. Post the data to data.sparkfun.com | Read Temperature from DS18B20. Post the data to data.sparkfun.com
| Python | mit | fuzzyhandle/esp8266hangout,fuzzyhandle/esp8266hangout,fuzzyhandle/esp8266hangout | ---
+++
@@ -0,0 +1,35 @@
+from machine import Pin
+from ds18x20 import DS18X20
+import onewire
+import time
+import machine
+import ujson
+import urequests
+
+def posttocloud(temperature):
+ keystext = open("sparkfun_keys.json").read()
+ keys = ujson.loads(keystext)
+ url = keys['inputUrl'] + "?private_key=" + key... | |
632f71651864517cc977f79dcdac7f3b0f516b49 | scripts/post_data.py | scripts/post_data.py | #!/usr/bin/env python3
import requests
domain = 'http://dakis.gimbutas.lt/api/'
exp_data = {
"description": "First successful post through API",
"algorithm": "TestTasks",
"neighbours": "Nearest",
"stopping_criteria": "x_dist",
"stopping_accuracy": "0.01",
"subregion": "simplex",
"inner_pr... | Add example script to post experiment and task data | Add example script to post experiment and task data
| Python | agpl-3.0 | niekas/dakis,niekas/dakis,niekas/dakis | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/env python3
+
+import requests
+
+
+domain = 'http://dakis.gimbutas.lt/api/'
+exp_data = {
+ "description": "First successful post through API",
+ "algorithm": "TestTasks",
+ "neighbours": "Nearest",
+ "stopping_criteria": "x_dist",
+ "stopping_accuracy": "0.01",
+ ... | |
e04bf5dd12a1f5e28258541dcf9d2eb8c5567ad0 | tests/lead_price_tests.py | tests/lead_price_tests.py | import unittest
import datetime
import json
import sys
sys.path.append('..')
import sabre_dev_studio
import sabre_dev_studio.sabre_exceptions as sabre_exceptions
'''
requires config.json in the same directory for api authentication
{
"sabre_client_id": -----,
"sabre_client_secret": -----
}
'''
class TestBasicLead... | Add tests for lead price | Add tests for lead price
| Python | mit | Jamil/sabre_dev_studio | ---
+++
@@ -0,0 +1,55 @@
+import unittest
+import datetime
+import json
+import sys
+
+sys.path.append('..')
+import sabre_dev_studio
+import sabre_dev_studio.sabre_exceptions as sabre_exceptions
+
+'''
+requires config.json in the same directory for api authentication
+
+{
+ "sabre_client_id": -----,
+ "sabre_client... | |
b7c22cddecb743e9597c92160e3aa0100e149e19 | tests/model/test_hades.py | tests/model/test_hades.py | from datetime import datetime, timedelta
from pycroft.model import session
from pycroft.model.hades import radgroup_property_mappings, radcheck
from tests import FactoryDataTestBase
from tests.factories import PropertyGroupFactory, MembershipFactory, UserWithHostFactory, \
SwitchFactory, PatchPortFactory
class H... | Introduce hades test fixtures and first tests. | Introduce hades test fixtures and first tests.
| Python | apache-2.0 | agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft | ---
+++
@@ -0,0 +1,66 @@
+from datetime import datetime, timedelta
+
+from pycroft.model import session
+from pycroft.model.hades import radgroup_property_mappings, radcheck
+from tests import FactoryDataTestBase
+from tests.factories import PropertyGroupFactory, MembershipFactory, UserWithHostFactory, \
+ SwitchF... | |
d9b4b0d913304b19365854b0ffceab179237d8f8 | numba/tests/test_floatsyms.py | numba/tests/test_floatsyms.py | from __future__ import print_function
import numba.unittest_support as unittest
from numba.compiler import compile_isolated
from numba import types
class TestFloatSymbols(unittest.TestCase):
"""
Test ftol symbols on windows
"""
def _test_template(self, realty, intty):
def cast(x):
... | Add tests for float->int symbols (esp for 32-bit windows and linux) | Add tests for float->int symbols (esp for 32-bit windows and linux)
| Python | bsd-2-clause | numba/numba,stonebig/numba,stefanseefeld/numba,sklam/numba,seibert/numba,pitrou/numba,GaZ3ll3/numba,IntelLabs/numba,pombredanne/numba,stonebig/numba,gdementen/numba,pitrou/numba,pombredanne/numba,pitrou/numba,sklam/numba,ssarangi/numba,numba/numba,cpcloud/numba,stuartarchibald/numba,pombredanne/numba,seibert/numba,jrie... | ---
+++
@@ -0,0 +1,46 @@
+from __future__ import print_function
+import numba.unittest_support as unittest
+from numba.compiler import compile_isolated
+from numba import types
+
+
+class TestFloatSymbols(unittest.TestCase):
+ """
+ Test ftol symbols on windows
+ """
+
+ def _test_template(self, realty, i... | |
4f3854eaf8d6e4b0ad9a77e871a946916ab3fec6 | listings/syndication/migrations/0002_auto__del_unique_feedtype_content_type.py | listings/syndication/migrations/0002_auto__del_unique_feedtype_content_type.py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'FeedType', fields ['content_type']
db.delete_unique('syndication_feedtype',... | Migrate listings.syndication, FeedType.content_type should not be unique. | Migrate listings.syndication, FeedType.content_type should not be unique.
| Python | mit | wtrevino/django-listings,wtrevino/django-listings | ---
+++
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Removing unique constraint on 'FeedType', fields ['content_type']
+ d... | |
c5fba0cc8acb482a0bc1c49ae5187ebc1232dba3 | tests/test_directions.py | tests/test_directions.py | import unittest
from shapely.geometry import LineString, Point
from directions.base import _parse_points
class DirectionsTest(unittest.TestCase):
def setUp(self):
self.p = [(1,2), (3,4), (5,6), (7,8)]
self.line = LineString(self.p)
def test_origin_dest(self):
result = _parse_points(s... | Add tests for the different input variations. | Add tests for the different input variations.
| Python | bsd-3-clause | asfaltboy/directions.py,jwass/directions.py,samtux/directions.py | ---
+++
@@ -0,0 +1,53 @@
+import unittest
+
+from shapely.geometry import LineString, Point
+
+from directions.base import _parse_points
+
+class DirectionsTest(unittest.TestCase):
+ def setUp(self):
+ self.p = [(1,2), (3,4), (5,6), (7,8)]
+ self.line = LineString(self.p)
+
+ def test_origin_dest(... | |
635682c9d206cd9ae6ea184f9361937b0a272b90 | wqflask/utility/monads.py | wqflask/utility/monads.py | """Monadic utilities
This module is a collection of monadic utilities for use in
GeneNetwork. It includes:
* MonadicDict - monadic version of the built-in dictionary
* MonadicDictCursor - monadic version of MySQLdb.cursors.DictCursor
that returns a MonadicDict instead of the built-in dictionary
"""
from collection... | Add monadic utilities MonadicDict and MonadicDictCursor. | Add monadic utilities MonadicDict and MonadicDictCursor.
* wqflask/utility/monads.py: New file.
| Python | agpl-3.0 | genenetwork/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2 | ---
+++
@@ -0,0 +1,80 @@
+"""Monadic utilities
+
+This module is a collection of monadic utilities for use in
+GeneNetwork. It includes:
+
+* MonadicDict - monadic version of the built-in dictionary
+* MonadicDictCursor - monadic version of MySQLdb.cursors.DictCursor
+ that returns a MonadicDict instead of the built... | |
40154d7de207df9689ac220cc8966735cb3ed5af | tests/test_asyncio.py | tests/test_asyncio.py | import asyncio
async def routine0(s,n):
print('CRT:',s,':',n)
async def routine(id, n):
print('TEST[%s] %d'%(id,n))
if not n:
return
n -= 1
await routine(id, n)
await routine0(id, n)
loop = asyncio.get_event_loop()
tasks = [
asyncio.ensure_future(routine('a',5)),
asyncio.ensure_future(routine('b'... | Test asyncio in python 3.6 | Test asyncio in python 3.6
| Python | apache-2.0 | theia-log/theia,theia-log/theia | ---
+++
@@ -0,0 +1,22 @@
+import asyncio
+
+async def routine0(s,n):
+ print('CRT:',s,':',n)
+
+async def routine(id, n):
+ print('TEST[%s] %d'%(id,n))
+ if not n:
+ return
+ n -= 1
+ await routine(id, n)
+ await routine0(id, n)
+
+loop = asyncio.get_event_loop()
+tasks = [
+ asyncio.ensure_future(routine('... | |
7963e426e2d1f58105d8712c0379114d93d32b07 | examples/plot_feature_extraction_classification.py | examples/plot_feature_extraction_classification.py | """
UMAP as a Feature Extraction Technique for Classification
---------------------------------------------------------
The following script shows how UMAP can be used as a feature extraction
technique to improve the accuracy on a classification task. It also shows
how UMAP can be integrated in standard scikit-learn p... | Add example with sklearn pipeline | Add example with sklearn pipeline
| Python | bsd-3-clause | lmcinnes/umap,lmcinnes/umap | ---
+++
@@ -0,0 +1,58 @@
+"""
+UMAP as a Feature Extraction Technique for Classification
+---------------------------------------------------------
+
+The following script shows how UMAP can be used as a feature extraction
+technique to improve the accuracy on a classification task. It also shows
+how UMAP can be int... | |
bcaa60ce73134e80e11e7df709e7ba7dbc07d349 | tests/test_systemd.py | tests/test_systemd.py | #!/usr/bin/env python3
import unittest
from unittest import mock
from unittest.mock import MagicMock, patch
from portinus import systemd
class testSystemd(unittest.TestCase):
def setUp(self):
systemd.subprocess.check_output = MagicMock(return_value=True)
self.unit = systemd.Unit('foo')
def ... | Add tests for systemd module | Add tests for systemd module
| Python | mit | justin8/portinus,justin8/portinus | ---
+++
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+import unittest
+from unittest import mock
+from unittest.mock import MagicMock, patch
+
+from portinus import systemd
+
+class testSystemd(unittest.TestCase):
+
+ def setUp(self):
+ systemd.subprocess.check_output = MagicMock(return_value=True)
+ sel... | |
0c3107739671398de1a206cfbb7673c25c543e60 | driver27/migrations/0009_populate_driver_in_seats.py | driver27/migrations/0009_populate_driver_in_seats.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def populate_driver_in_seats(apps, schema_editor):
Seat = apps.get_model("driver27", "Seat")
for seat in Seat.objects.all():
driver = seat.contender.driver
seat.driver = driver
sea... | Update driver value in Seat model. | Update driver value in Seat model.
| Python | mit | SRJ9/django-driver27,SRJ9/django-driver27,SRJ9/django-driver27 | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+def populate_driver_in_seats(apps, schema_editor):
+ Seat = apps.get_model("driver27", "Seat")
+ for seat in Seat.objects.all():
+ driver = seat.contender.driver
+ ... | |
8fe57fbbc5764d3e13c3513afcdb2c49d04b117e | src/yunohost/data_migrations/0003_php5_to_php7_pools.py | src/yunohost/data_migrations/0003_php5_to_php7_pools.py | import os
import glob
from shutil import copy2
from moulinette.utils.log import getActionLogger
from yunohost.tools import Migration
from yunohost.service import _run_service_command
logger = getActionLogger('yunohost.migration')
PHP5_POOLS = "/etc/php5/fpm/pool.d"
PHP7_POOLS = "/etc/php/7.0/fpm/pool.d"
PHP5_SOCKE... | Add a migration for php5-fpm pools to php7 | Add a migration for php5-fpm pools to php7
| Python | agpl-3.0 | YunoHost/yunohost,YunoHost/yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost | ---
+++
@@ -0,0 +1,67 @@
+import os
+import glob
+from shutil import copy2
+
+from moulinette.utils.log import getActionLogger
+
+from yunohost.tools import Migration
+from yunohost.service import _run_service_command
+
+logger = getActionLogger('yunohost.migration')
+
+PHP5_POOLS = "/etc/php5/fpm/pool.d"
+PHP7_POOLS... | |
bf34c1dbb37865e62e97e3463645c7df16a4ca08 | markov_chain.py | markov_chain.py | from random import choice
class MarkovChain(object):
""" An interface for signle-word states Markov Chains """
def __init__(self, text=None):
self._states_map = {}
if text is not None:
self.add_text(text)
def add_text(self, text, separator=" "):
""" Adds text ... | Add an interface for Markov Chains | Add an interface for Markov Chains
| Python | mit | iluxonchik/lyricist | ---
+++
@@ -0,0 +1,22 @@
+from random import choice
+
+class MarkovChain(object):
+ """ An interface for signle-word states Markov Chains """
+
+ def __init__(self, text=None):
+ self._states_map = {}
+
+ if text is not None:
+ self.add_text(text)
+
+ def add_text(self, text,... | |
e29de047d770de70f3745ae410b62d0ddad4b0b4 | lib/oeqa/runtime/misc/appFW.py | lib/oeqa/runtime/misc/appFW.py | from oeqa.oetest import oeRuntimeTest
class AppFwTest(oeRuntimeTest):
""" App Framework testing """
def test_sqlite_integration(self):
""" test sqlite is integrated in image """
(status,output) = self.target.run("rpm -qa | grep sqlite")
self.assertEqual(status, 0, output)
| Add one test case for IOTOS-358 | Add one test case for IOTOS-358
To check SQlite is integrated in image
Signed-off-by: Wu Dawei <b8fdb5b9f0b6b29b63287bce074c688ca08d8ead@intel.com>
| Python | mit | ostroproject/meta-iotqa,ostroproject/meta-iotqa,wanghongjuan/meta-iotqa-1,ostroproject/meta-iotqa,daweiwu/meta-iotqa-1,ostroproject/meta-iotqa,daweiwu/meta-iotqa-1,ostroproject/meta-iotqa,wanghongjuan/meta-iotqa-1,wanghongjuan/meta-iotqa-1,daweiwu/meta-iotqa-1,daweiwu/meta-iotqa-1,wanghongjuan/meta-iotqa-1,wanghongjuan... | ---
+++
@@ -0,0 +1,12 @@
+from oeqa.oetest import oeRuntimeTest
+
+class AppFwTest(oeRuntimeTest):
+
+ """ App Framework testing """
+
+ def test_sqlite_integration(self):
+
+ """ test sqlite is integrated in image """
+
+ (status,output) = self.target.run("rpm -qa | grep sqlite")
+ self.as... | |
0782e8786272fcd6e3e1a41d31bea253865c468b | pastas/timer.py | pastas/timer.py | try:
from tqdm.auto import tqdm
except ModuleNotFoundError:
raise ModuleNotFoundError("SolveTimer requires 'tqdm' to be installed.")
class SolveTimer(tqdm):
"""Progress indicator for model optimization.
Usage
-----
Print timer and number of iterations in console while running
`ml.solve()... | Add SolveTimer - print number of iterations and elapsed time to console while running ml.solve() - see docstring for usage | Add SolveTimer
- print number of iterations and elapsed time to console while running ml.solve()
- see docstring for usage
| Python | mit | pastas/pastas | ---
+++
@@ -0,0 +1,37 @@
+try:
+ from tqdm.auto import tqdm
+except ModuleNotFoundError:
+ raise ModuleNotFoundError("SolveTimer requires 'tqdm' to be installed.")
+
+
+class SolveTimer(tqdm):
+ """Progress indicator for model optimization.
+
+ Usage
+ -----
+ Print timer and number of iterations i... | |
6ece957e5317a9f54499714f9a7cb9bca221d4e5 | bin/debug/intake_single_user.py | bin/debug/intake_single_user.py | import json
import logging
import argparse
import numpy as np
import uuid
import emission.pipeline.intake_stage as epi
import emission.core.wrapper.user as ecwu
if __name__ == '__main__':
np.random.seed(61297777)
parser = argparse.ArgumentParser(prog="intake_single_user")
group = parser.add_mutually_excl... | Add a simple script that runs the pipeline for the single specified user | Add a simple script that runs the pipeline for the single specified user
User can be specified by either email or UUID.
Calls the pipeline functions.
| Python | bsd-3-clause | sunil07t/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server | ---
+++
@@ -0,0 +1,25 @@
+import json
+import logging
+import argparse
+import numpy as np
+import uuid
+
+import emission.pipeline.intake_stage as epi
+import emission.core.wrapper.user as ecwu
+
+if __name__ == '__main__':
+ np.random.seed(61297777)
+
+ parser = argparse.ArgumentParser(prog="intake_single_use... | |
4c5f750801cef0424fd93432b688fb74b079f4c5 | temba/msgs/migrations/0037_backfill_recipient_counts.py | temba/msgs/migrations/0037_backfill_recipient_counts.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('msgs', '0036_auto_20151103_1014'),
]
def backfill_recipient_counts(apps, schema):
Broadcast = apps.get_model('msgs', 'Broadc... | Add migration to backfill recipient counts | Add migration to backfill recipient counts
| Python | agpl-3.0 | tsotetsi/textily-web,reyrodrigues/EU-SMS,pulilab/rapidpro,reyrodrigues/EU-SMS,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,reyrodrigues/EU-SMS,tsotetsi/textily-web,ewheeler/rapidpro,ewheeler/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,ewheeler/rapidpro,pulilab/rapidpro,ewheeler/rapidpr... | ---
+++
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('msgs', '0036_auto_20151103_1014'),
+ ]
+
+ def backfill_recipient_counts(apps, schema):
+ B... | |
b44f13bfa1ac8b3c1bd24e528fc7874a06df0121 | dev_tools/src/d1_dev/update-requirements-txt.py | dev_tools/src/d1_dev/update-requirements-txt.py | #!/usr/bin/env python
import shutil
import d1_dev.util
import os
import pip._internal.utils.misc
import re
REQUIREMENTS_FILENAME = 'requirements.txt'
# Modules in my dev environment that are not required by the stack
MODULE_FILTER_REGEX_LIST = {
'beautifulsoup',
'black',
'bs4',
'dataone.*',
'e... | Add script that creates a filtered list of required packages | Add script that creates a filtered list of required packages
| Python | apache-2.0 | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | ---
+++
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+import shutil
+import d1_dev.util
+import os
+import pip._internal.utils.misc
+import re
+
+
+REQUIREMENTS_FILENAME = 'requirements.txt'
+
+
+# Modules in my dev environment that are not required by the stack
+
+MODULE_FILTER_REGEX_LIST = {
+ 'beautifulsoup',
+ ... | |
6f2529d1891b5c256394b9c8aa991b25a029b5f1 | migrations/004_load_seed_file.py | migrations/004_load_seed_file.py | """
Load initial user and bucket data from seed files.
"""
import logging
import os
import subprocess
import sys
log = logging.getLogger(__name__)
def up(db):
names = db.collection_names()
if "users" in names:
log.info("users collection already created")
return
if "buckets" in names:
... | Add a migration to load users and buckets | Add a migration to load users and buckets
| Python | mit | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | ---
+++
@@ -0,0 +1,24 @@
+"""
+Load initial user and bucket data from seed files.
+"""
+import logging
+import os
+import subprocess
+import sys
+
+log = logging.getLogger(__name__)
+
+
+def up(db):
+ names = db.collection_names()
+
+ if "users" in names:
+ log.info("users collection already created")
+ ... | |
99282d42a3948b9ed45b02df657c344667ec0cf2 | src/ggrc/migrations/versions/20150521125008_324d461206_migrate_directive_sections_to_.py | src/ggrc/migrations/versions/20150521125008_324d461206_migrate_directive_sections_to_.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""Migrate directive_sections to relationships
Revision ID: 324d461206
Revises:... | Add a migration for directive_sections -> relationships | Add a migration for directive_sections -> relationships
| Python | apache-2.0 | AleksNeStu/ggrc-core,jmakov/ggrc-core,hyperNURb/ggrc-core,josthkko/ggrc-core,hasanalom/ggrc-core,jmakov/ggrc-core,hasanalom/ggrc-core,edofic/ggrc-core,kr41/ggrc-core,kr41/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,prasannav7/ggrc-core,hyperNURb/ggrc-core,NejcZupec/ggrc-core,VinnieJohns/ggrc-core,selah... | ---
+++
@@ -0,0 +1,56 @@
+# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+# Created By: anze@reciprocitylabs.com
+# Maintained By: anze@reciprocitylabs.com
+
+"""Migrate directive_sections to relationships
... | |
5b9d9f531e3544f6d3dfe0a2e48dcaaebf132921 | test/services/appmanager/test_http.py | test/services/appmanager/test_http.py | import time
import requests
from weavelib.messaging import Receiver
from weavelib.rpc import RPCServer, ServerAPI
from weavelib.services import BaseService
from weaveserver.core.services import ServiceManager
from weaveserver.services.appmanager import ApplicationService
AUTH = {
"auth1": {
"type": "SYS... | Test case for RPC HTTP handler. | Test case for RPC HTTP handler.
| Python | mit | supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer | ---
+++
@@ -0,0 +1,82 @@
+import time
+
+import requests
+from weavelib.messaging import Receiver
+from weavelib.rpc import RPCServer, ServerAPI
+from weavelib.services import BaseService
+
+from weaveserver.core.services import ServiceManager
+from weaveserver.services.appmanager import ApplicationService
+
+
+AUTH ... | |
8ba5b29200520d853791943341d41798ff80a248 | src/repository/migrations/0003_auto_20170524_1503.py | src/repository/migrations/0003_auto_20170524_1503.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-24 15:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('repository', '0002_auto_20170522_2021'),
]
operations = [
migrations.AlterModelOpti... | Change meta option for Github | Change meta option for Github
| Python | bsd-3-clause | lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-05-24 15:03
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('repository', '0002_auto_20170522_2021'),
+ ]
+
+ operati... | |
21a0948eb1d25e9126e2940cbc7d0496181d6a93 | setup.py | setup.py | import os
from setuptools import setup, find_packages
NAME = 'djangae'
PACKAGES = find_packages()
DESCRIPTION = 'Django integration with Google App Engine'
URL = "https://github.com/potatolondon/djangae"
LONG_DESCRIPTION = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
AUTHOR = 'Potato London Ltd.'... | import os
from setuptools import setup, find_packages
NAME = 'djangae'
PACKAGES = find_packages()
DESCRIPTION = 'Django integration with Google App Engine'
URL = "https://github.com/potatolondon/djangae"
LONG_DESCRIPTION = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
AUTHOR = 'Potato London Ltd.'... | Add Django version trove classifiers. | Add Django version trove classifiers.
| Python | bsd-3-clause | grzes/djangae,asendecka/djangae,grzes/djangae,kirberich/djangae,asendecka/djangae,kirberich/djangae,armirusco/djangae,grzes/djangae,armirusco/djangae,potatolondon/djangae,chargrizzle/djangae,potatolondon/djangae,armirusco/djangae,kirberich/djangae,asendecka/djangae,chargrizzle/djangae,chargrizzle/djangae | ---
+++
@@ -27,6 +27,8 @@
classifiers=[
'Development Status :: 3 - Alpha',
'Framework :: Django',
+ 'Framework :: Django :: 1.7',
+ 'Framework :: Django :: 1.8',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating Syst... |
c45ccd0f258fcbb152ffa9597ceb1bacd472f73b | web/impact/impact/tests/test_impact_email_backend.py | web/impact/impact/tests/test_impact_email_backend.py | from mock import patch
from django.core import mail
from django.test import TestCase
from django.urls import reverse
from impact.minimal_email_handler import MinimalEmailHandler
class TestEmailBackend(TestCase):
@patch("impact.impact_email_backend.ImpactEmailBackend._add_logging_headers")
@patch("django.core... | Add test for email backend coverage | [AC-7570] Add test for email backend coverage
| Python | mit | masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api | ---
+++
@@ -0,0 +1,40 @@
+from mock import patch
+from django.core import mail
+from django.test import TestCase
+from django.urls import reverse
+
+from impact.minimal_email_handler import MinimalEmailHandler
+
+class TestEmailBackend(TestCase):
+
+ @patch("impact.impact_email_backend.ImpactEmailBackend._add_logg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.