commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
69db18ef0f6898ac3b1709988a12e96a88383530 | allow update of view | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/hr_timesheet_attendance/report/hr_timesheet_attendance_report.py | addons/hr_timesheet_attendance/report/hr_timesheet_attendance_report.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, tools
class TimesheetAttendance(models.Model):
_name = 'hr.timesheet.attendance.report'
_auto = False
user_id = fields.Many2one('res.users')
date = fields.Date()
... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class TimesheetAttendance(models.Model):
_name = 'hr.timesheet.attendance.report'
_auto = False
user_id = fields.Many2one('res.users')
date = fields.Date()
tota... | agpl-3.0 | Python |
584dcd7fa2703914ace833d9ab82a93da0d1f31b | Update P02_char_pic_grid: working solution | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter04/PracticeProjects/P02_char_pic_grid.py | books/AutomateTheBoringStuffWithPython/Chapter04/PracticeProjects/P02_char_pic_grid.py | # Character Picture Grid: This program converts a matrix to an image
#
# Say you have a list of lists where each value in the inner lists is a one-character string, like this:
# grid = [['.', '.', '.', '.', '.', '.'],
# ['.', 'O', 'O', '.', '.', '.'],
# ['O', 'O', 'O', 'O', '.', '.'],
# ['O', 'O... | # Character Picture Grid: This program converts a matrix to an image
#
# Say you have a list of lists where each value in the inner lists is a one-character string, like this:
# grid = [['.', '.', '.', '.', '.', '.'],
# ['.', 'O', 'O', '.', '.', '.'],
# ['O', 'O', 'O', 'O', '.', '.'],
# ['O', 'O... | mit | Python |
ecafd4eab0aca93b17de8f895e402fb917131da6 | Format output test_nodemap | kewitz/master,kewitz/master,kewitz/master | test_nodemap.py | test_nodemap.py | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 1 16:46:00 2015
@author: leo
"""
from numpy import *
import NScheme as ns
import matplotlib.pyplot as plt
path = """./res/"""
split = ns.split
m = 1
print "DOF\tCUDA\tTime\tIter.\tErr."
for c in [(c, f) for f in ['teste1_1.msh', 'teste1_2.msh', 'teste1_3.msh', 'teste1... | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 1 16:46:00 2015
@author: leo
"""
from numpy import *
import NScheme as ns
import matplotlib.pyplot as plt
path = """./res/"""
split = ns.split
m = 1
print "DOF\tCUDA\tTime\t\tIterations\tErr."
for c in [(c, f) for f in ['teste1_1.msh', 'teste1_2.msh', 'teste1_3.msh', ... | mit | Python |
d0271db1adbae453d8461a26c055387fac0da174 | Add eval ratio kwarg to fix melody rnn dataset script. (#1347) | jesseengel/magenta,magenta/magenta,magenta/magenta,adarob/magenta,jesseengel/magenta,adarob/magenta | magenta/models/melody_rnn/melody_rnn_create_dataset.py | magenta/models/melody_rnn/melody_rnn_create_dataset.py | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | apache-2.0 | Python |
1591ab302effbaa2abd6d0d07b75567930fa032e | Update extend schema test | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | corehq/ex-submodules/couchexport/tests/test_extend_schema.py | corehq/ex-submodules/couchexport/tests/test_extend_schema.py | from django.test import SimpleTestCase
from couchexport.schema import extend_schema
class ExtendSchemaTest(SimpleTestCase):
def setUp(self):
pass
def test_simple_schema(self):
"""
Testing the initial generation of the schema
"""
schema = {
'question1': 'st... | from django.test import SimpleTestCase
from couchexport.schema import extend_schema
class ExtendSchemaTest(SimpleTestCase):
def setUp(self):
pass
def test_simple_schema(self):
"""
Testing the initial generation of the schema
"""
schema = {
'question1': 'st... | bsd-3-clause | Python |
ca51f06f13f6ae3f5dff1a0e71f1d6670db1f607 | add support for pluralizing source in email body text | greglinch/sourcelist,greglinch/sourcelist | sources/management/commands/email_admin.py | sources/management/commands/email_admin.py | from django.core.management.base import BaseCommand, CommandError
from django.core.mail import send_mail
# from django.utils import timezone
from sources.models import Person
from sourcelist.settings import PROJECT_NAME, EMAIL_SENDER, SITE_URL
def email_admin():
path = '/admin/sources/sourceforadmin/'
path +=... | from django.core.management.base import BaseCommand, CommandError
from django.core.mail import send_mail
# from django.utils import timezone
from sources.models import Person
from sourcelist.settings import PROJECT_NAME, EMAIL_SENDER, SITE_URL
def email_admin():
path = '/admin/sources/sourceforadmin/'
path +=... | mit | Python |
9fada96919a1e6d2acc2d03549eb2f5b8db6c977 | Use LocMemCache while testing | potatolondon/djangae,potatolondon/djangae | test_settings.py | test_settings.py | import os
from django.urls import (
include,
path,
)
BASE_DIR = os.path.dirname(__file__)
STATIC_URL = "/static/"
# Set the cache during tests to local memory, which is threadsafe
# then our TestCase clears the cache in setUp()
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem... | import os
from django.urls import (
include,
path,
)
BASE_DIR = os.path.dirname(__file__)
STATIC_URL = "/static/"
# Default Django middleware
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMid... | bsd-3-clause | Python |
8fa0c2dbc1d535fcaec2cbf54e0315446aaf7a60 | fix cos dense test | stygstra/keras-contrib,keras-team/keras-contrib,farizrahman4u/keras-contrib,keras-team/keras-contrib,keras-team/keras-contrib | tests/keras_contrib/layers/test_core.py | tests/keras_contrib/layers/test_core.py | import pytest
import numpy as np
from keras import backend as K
from keras_contrib import backend as KC
from keras_contrib.layers import core
from keras.utils.test_utils import layer_test, keras_test
from numpy.testing import assert_allclose
@keras_test
def test_cosinedense():
from keras import regularizers
... | import pytest
import numpy as np
from keras import backend as K
from keras_contrib import backend as KC
from keras_contrib.layers import core
from keras.utils.test_utils import layer_test, keras_test
from numpy.testing import assert_allclose
@keras_test
def test_cosinedense():
from keras import regularizers
... | mit | Python |
cb0862f7da69dec4e865543b0565091980f2463e | Fix dig check test | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | tests/scoring_engine/checks/test_dns.py | tests/scoring_engine/checks/test_dns.py | from tests.scoring_engine.checks.check_test import CheckTest
class TestDNSCheck(CheckTest):
check_name = 'DNSCheck'
properties = {
'qtype': 'A',
'domain': 'www.google.com'
}
cmd = "dig +noedns @'127.0.0.1' -p 1234 -t 'A' -q 'www.google.com'"
| from tests.scoring_engine.checks.check_test import CheckTest
class TestDNSCheck(CheckTest):
check_name = 'DNSCheck'
properties = {
'qtype': 'A',
'domain': 'www.google.com'
}
cmd = "dig @'127.0.0.1' -p 1234 -t 'A' -q 'www.google.com'"
| mit | Python |
13c1745e73b7d3be162ce228d6c6ccf53f2438eb | Mark build 90 as 1.6.6 final | alby128/syncplay,Syncplay/syncplay,Syncplay/syncplay,alby128/syncplay | syncplay/__init__.py | syncplay/__init__.py | version = '1.6.6'
revision = ''
milestone = 'Yoitsu'
release_number = '90'
projectURL = 'https://syncplay.pl/'
| version = '1.6.6'
revision = ' beta 2'
milestone = 'Yoitsu'
release_number = '89'
projectURL = 'https://syncplay.pl/'
| apache-2.0 | Python |
0943d0629488f4263c9403ccfcc52cb3ea2df8b0 | Fix tests | slackapi/python-slackclient,slackhq/python-slackclient,slackapi/python-slackclient,slackapi/python-slackclient | tests/test_proxy_env_variable_loader.py | tests/test_proxy_env_variable_loader.py | import os
import unittest
from slack_sdk.proxy_env_variable_loader import load_http_proxy_from_env
from tests.helpers import remove_os_env_temporarily, restore_os_env
class TestProxyEnvVariableLoader(unittest.TestCase):
def setUp(self):
self.old_env = remove_os_env_temporarily()
def tearDown(self):
... | import os
import unittest
from slack_sdk.proxy_env_variable_loader import load_http_proxy_from_env
from tests.helpers import remove_os_env_temporarily, restore_os_env
class TestProxyEnvVariableLoader(unittest.TestCase):
def setUp(self):
self.old_env = remove_os_env_temporarily()
def tearDown(self):
... | mit | Python |
8d4d22d17ff10cb3d95b6524221c2a6c01c0923c | Fix Python3 builds | avanov/Rhetoric,avanov/Rhetoric | tests/testapp/testapp/articles/views.py | tests/testapp/testapp/articles/views.py | from rhetoric.view import view_config, view_defaults
from ..types import Language
@view_defaults(route_name='articles.regional.index', renderer='json')
class ArticlesHandler(object):
def __init__(self, request, language):
self.request = request
self.language = language
self.region_strategy... | from rhetoric.view import view_config, view_defaults
from ..types import Language
@view_defaults(route_name='articles.regional.index', renderer='json')
class ArticlesHandler(object):
def __init__(self, request, language):
self.request = request
self.language = language
self.region_strategy... | mit | Python |
3177cdf564f8d16b090506d3adf479959698bebd | Add component count. | barbarahui/nuxeo-calisphere,barbarahui/nuxeo-calisphere | utils/get_collection_object_count.py | utils/get_collection_object_count.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
import sys, os
import argparse
from deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo
def main(argv=None):
parser = argparse.ArgumentParser(description='Print count of objects for a given collection.')
parser.add_argument('path', help="Nuxeo path to collection... | #!/usr/bin/env python
# -*- coding: utf8 -*-
import sys, os
import argparse
from deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo
def main(argv=None):
parser = argparse.ArgumentParser(description='Print count of objects for a given collection.')
parser.add_argument('path', help="Nuxeo path to collection... | bsd-3-clause | Python |
bc0d314aad61fd252d4b85666fad5ea34706404f | remove unused operator classes | kishkaru/python-driver,stef1927/python-driver,thelastpickle/python-driver,coldeasy/python-driver,kishkaru/python-driver,datastax/python-driver,coldeasy/python-driver,markflorisson/python-driver,markflorisson/python-driver,thobbs/python-driver,vipjml/python-driver,vipjml/python-driver,datastax/python-driver,mambocab/pyt... | cassandra/cqlengine/operators.py | cassandra/cqlengine/operators.py | # Copyright 2013-2016 DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | # Copyright 2013-2016 DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | apache-2.0 | Python |
52c7729e5423fc53281f2fa367d93c5bf3821f03 | Adjust translate.py for python3 support | sukeesh/Jarvis,appi147/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis,appi147/Jarvis | jarviscli/packages/translate.py | jarviscli/packages/translate.py | from googletrans import Translator
from utilities.GeneralUtilities import print_say
from googletrans.constants import LANGCODES, LANGUAGES, SPECIAL_CASES
import six
def main(self):
'''
source language
'''
print_say('\nEnter source language ', self)
if six.PY2:
srcs = raw_input()
... | from googletrans import Translator
from utilities.GeneralUtilities import print_say
from googletrans.constants import LANGCODES, LANGUAGES, SPECIAL_CASES
def main(self):
'''
source language
'''
print_say('\nEnter source language ', self)
srcs = raw_input()
while (srcs not in LANGUAGES) a... | mit | Python |
f7b24b160ecd8e634310ad4a98aefb894c330c93 | Revert "Revert "Added `-fno-tree-sink` to cflags_cc list."" | royalpinto/node-cares,royalpinto/node-cares,royalpinto/node-cares | binding.gyp | binding.gyp | {
"targets": [{
"target_name": "cares_wrap",
"include_dirs": [
"<!(node -e \"require('nan')\")",
"deps/cares/include",
"deps/cares/src",
"deps/utils"
],
"sources": [
"src/cares_wrap.cc"
],
"dependencies": [ "... | {
"targets": [{
"target_name": "cares_wrap",
"include_dirs": [
"<!(node -e \"require('nan')\")",
"deps/cares/include",
"deps/cares/src",
"deps/utils"
],
"sources": [
"src/cares_wrap.cc"
],
"dependencies": [ "... | mit | Python |
b0451cd77ed97373cb6748e6cca17b11220f74d0 | Add missing source file | thomasjo/node-cmark,thomasjo/node-cmark,thomasjo/node-cmark | binding.gyp | binding.gyp | {
'targets': [
{
'target_name': 'cmark',
'include_dirs': [
'<!(node -e "require(\'nan\')")',
'vendor/cmark/src',
'vendor/cmark/extensions',
'vendor/cmark/build/src',
'vendor/cmark/build/extensions',
],
'sources': [
'src/cmark.cpp',
's... | {
'targets': [
{
'target_name': 'cmark',
'include_dirs': [
'<!(node -e "require(\'nan\')")',
'vendor/cmark/src',
'vendor/cmark/extensions',
'vendor/cmark/build/src',
'vendor/cmark/build/extensions',
],
'sources': [
'src/cmark.cpp',
's... | mit | Python |
cb028376c813b001d59de56b6973cd745b224279 | Fix test addressing object | storax/qmenuview | test/test_view.py | test/test_view.py | from PySide import QtGui
import qmenuview
def test_title(qtbot):
title = 'Test title'
mv = qmenuview.MenuView(title)
assert mv.title() == title
def test_parent(qtbot):
p = QtGui.QWidget()
mv = qmenuview.MenuView(parent=p)
assert mv.parent() is p
| from PySide import QtGui
import qmenuview
def test_title(qtbot):
title = 'Test title'
qmenuview.MenuView(title)
assert qmenuview.title() == title
def test_parent(qtbot):
p = QtGui.QWidget()
qmenuview.MenuView(parent=p)
assert qmenuview.parent() is p
| bsd-3-clause | Python |
78a681055722b181312cedf0c735366c9b90bdb5 | Revert "Revert "Задание 2"" | VLovets/python_01 | test_add_group.py | test_add_group.py | # -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
import unittest
from group import Group
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_add_group(unittest.TestCase):
def setUp(self):
sel... | # -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.action_chains import ActionChains
import time, unittest
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_add_group(unitt... | apache-2.0 | Python |
9a7b8c72ced3e051154646be16ebd6b48f8c1333 | implement list_reachable_roles() | darren-wang/ks3,darren-wang/ks3 | keystone/role_hierarchy/core.py | keystone/role_hierarchy/core.py | import abc
from keystone.common import dependency
from keystone.common import manager
from keystone import exception
import six
@dependency.provider('rh_api')
@dependency.requires('role_api')
class Manager(manager.Manager):
def add_inheritance(self, asc_role_id, desc_role_id):
return self.driver.add_in... | import abc
from keystone.common import dependency
from keystone.common import manager
from keystone import exception
import six
@dependency.provider('rh_api')
@dependency.requires('role_api')
class Manager(manager.Manager):
def add_inheritance(self, asc_role_id, desc_role_id):
return self.driver.add_in... | apache-2.0 | Python |
1c038d6c79b7da9149af42b76377a5c25d4f1551 | Update wallarm.py | sandrogauci/wafw00f,EnableSecurity/wafw00f | wafw00f/plugins/wallarm.py | wafw00f/plugins/wallarm.py | #!/usr/bin/env python
NAME = 'Wallarm'
def is_waf(self):
return self.matchheader(('server', "nginx-wallarm"))
| #!/usr/bin/env python
NAME = 'Wallarm'
def is_waf(self):
if self.matchheader(('server', "nginx-wallarm")):
return True
| bsd-3-clause | Python |
de13352c488cf7c18490ba2e0e61307456402a4c | migrate res.company object to new API | akretion/l10n-brazil,OCA/l10n-brazil,akretion/l10n-brazil,OCA/l10n-brazil,akretion/l10n-brazil,OCA/l10n-brazil | l10n_br_purchase/res_company.py | l10n_br_purchase/res_company.py | # -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2009 Renato Lima - Akretion #
# ... | # -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2009 Renato Lima - Akretion #
# ... | agpl-3.0 | Python |
2650d2555a6adb9eee8beff4fb6751dfdd784c48 | Fix a style error. | datawagovau/datacats,datacats/datacats,JJediny/datacats,JJediny/datacats,poguez/datacats,JackMc/datacats,reneenoble/datacats,florianm/datacats,florianm/datacats,datacats/datacats,dborzov/datacats,wardi/datacats,deniszgonjanin/datacats,reneenoble/datacats,dborzov/datacats,JackMc/datacats,datawagovau/datacats,deniszgonja... | datacats/cli/lesscd.py | datacats/cli/lesscd.py | """
Watches a CKAN environment for changes in its .less files, and recompiles them when they do.
Usage:
datacats-lesscd [--help] TARGET
--help -h Show this help and quit.
"""
from os.path import expanduser, join as path_join, exists
import signal
from docopt import docopt
from datacats.version import __... | """
Watches a CKAN environment for changes in its .less files, and recompiles them when they do.
Usage:
datacats-lesscd [--help] TARGET
--help -h Show this help and quit.
"""
from os.path import expanduser, join as path_join, split as path_split, exists
import signal
from docopt import docopt
from datac... | agpl-3.0 | Python |
37ef9412a39972229f253bba4963b1eb840f2572 | add a db cleanup for items over a year old | Flexget/Flexget,Flexget/Flexget,crawln45/Flexget,Flexget/Flexget,crawln45/Flexget,Flexget/Flexget,crawln45/Flexget,crawln45/Flexget | flexget/components/history/db.py | flexget/components/history/db.py | from datetime import datetime, timedelta
from loguru import logger
from sqlalchemy import Column, DateTime, Integer, String, Unicode
from flexget.event import event
from flexget.manager import Base
logger = logger.bind(name='history.db')
class History(Base):
__tablename__ = 'history'
id = Column(Integer, ... | from datetime import datetime
from sqlalchemy import Column, DateTime, Integer, String, Unicode
from flexget.manager import Base
class History(Base):
__tablename__ = 'history'
id = Column(Integer, primary_key=True)
task = Column('feed', String)
filename = Column(String)
url = Column(String)
... | mit | Python |
dbd0a79ffc7e3672e42de6fd635ac4951e6470dd | move timeline and link to dynamic links | frappe/frappe,saurabh6790/frappe,almeidapaulopt/frappe,yashodhank/frappe,mhbu50/frappe,almeidapaulopt/frappe,almeidapaulopt/frappe,vjFaLk/frappe,almeidapaulopt/frappe,frappe/frappe,vjFaLk/frappe,saurabh6790/frappe,StrellaGroup/frappe,yashodhank/frappe,adityahase/frappe,saurabh6790/frappe,vjFaLk/frappe,vjFaLk/frappe,sau... | frappe/patches/v12_0/move_timeline_links_to_dynamic_links.py | frappe/patches/v12_0/move_timeline_links_to_dynamic_links.py | from __future__ import unicode_literals
import frappe
def execute():
comm_lists = []
for communication in frappe.get_list("Communication", filters={"communication_medium": "Email"},
fields=[
"name", "creation", "modified", "modified_by",
"timeline_doctype", "timeline_name",
"link_doctype", "link_name... | from __future__ import unicode_literals
import frappe
def execute():
comm_lists = []
for communication in frappe.get_list("Communication", filters={"communication_medium": "Email"},
fields=[
"name", "creation", "modified", "modified_by",
"timeline_doctype", "timeline_name",
]):
if communication.time... | mit | Python |
38891fee1afb02b4b92391f85839af93c820663b | order persons by | danielbaak/imperii-viz,danielbaak/imperii-viz,danielbaak/imperii-viz,danielbaak/imperii-viz | person/views.py | person/views.py | from person.serializers import PersonSerializer
from person.models import Person
from django.shortcuts import get_object_or_404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.decorators import api_view
from regeste.models import Regeste
from regeste.serializers... | from person.serializers import PersonSerializer
from person.models import Person
from django.shortcuts import get_object_or_404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.decorators import api_view
from regeste.models import Regeste
from regeste.serializers... | mit | Python |
588f3046dbd13e737f5e9c665b981dfaa401e6ab | move logging verbosity to top | eywalker/datajoint-python,datajoint/datajoint-python,dimitri-yatsenko/datajoint-python,fabiansinz/datajoint-python | tests/__init__.py | tests/__init__.py | """
Package for testing datajoint. Setup fixture will be run
to ensure that proper database connection and access privilege
exists. The content of the test database will be destroyed
after the test.
"""
__author__ = 'Edgar Walker, Fabian Sinz, Dimitri Yatsenko'
import logging
from os import environ
# turn on verbose... | """
Package for testing datajoint. Setup fixture will be run
to ensure that proper database connection and access privilege
exists. The content of the test database will be destroyed
after the test.
"""
__author__ = 'Edgar Walker, Fabian Sinz, Dimitri Yatsenko'
import logging
from os import environ
import datajoint a... | lgpl-2.1 | Python |
9ac0a34c7853bfe03d81f0b4ddf233b307dccf3c | Remove debug print (oops) | shohei/Octoprint,masterhou/OctoPrint,beeverycreative/BEEweb,abinashk-inf/AstroBox,foosel/OctoPrint,shaggythesheep/OctoPrint,dragondgold/OctoPrint,mrbeam/OctoPrint,CapnBry/OctoPrint,MolarAmbiguity/OctoPrint,nickverschoor/OctoPrint,ryanneufeld/OctoPrint,SeveQ/OctoPrint,MaxOLydian/OctoPrint,abinashk-inf/AstroBox,ryanneufe... | SkeinPyPy_NewUI/newui/skeinRun.py | SkeinPyPy_NewUI/newui/skeinRun.py | from __future__ import absolute_import
import platform, os, subprocess, sys
from skeinforge_application.skeinforge_utilities import skeinforge_craft
def getPyPyExe():
"Return the path to the pypy executable if we can find it. Else return False"
if platform.system() == "Windows":
checkSSE2exe = os.path.dirname(os... | from __future__ import absolute_import
import platform, os, subprocess, sys
from skeinforge_application.skeinforge_utilities import skeinforge_craft
def getPyPyExe():
"Return the path to the pypy executable if we can find it. Else return False"
if platform.system() == "Windows":
checkSSE2exe = os.path.dirname(os... | agpl-3.0 | Python |
9ef425adc683b173b34880e692177e6a35c89b70 | Update longest-substring-with-at-most-k-distinct-characters.py | yiwen-luo/LeetCode,jaredkoontz/leetcode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,githubutilities/LeetCode,kamyu104/LeetCode,githubutilities/LeetCode,jaredkoontz/leetcode,jaredkoontz/leetcode,kamyu104/LeetCode,jaredkoontz/leetcode,githubutilities/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,githubutil... | Python/longest-substring-with-at-most-k-distinct-characters.py | Python/longest-substring-with-at-most-k-distinct-characters.py | # Time: O(n)
# Space: O(1)
class Solution(object):
def lengthOfLongestSubstringKDistinct(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
longest, start, distinct_count, visited = 0, 0, 0, [0 for _ in xrange(256)]
for i, char in enumerate(s):
... | # Time: O(n^2)
# Space: O(1)
class Solution(object):
def lengthOfLongestSubstringKDistinct(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
longest, start, distinct_count, visited = 0, 0, 0, [0 for _ in xrange(256)]
for i, char in enumerate(s):
... | mit | Python |
413d879a973f845ca5920167c4ab54676f145578 | bump version | facebookresearch/detectron2,facebookresearch/detectron2,facebookresearch/detectron2 | detectron2/__init__.py | detectron2/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
from .utils.env import setup_environment
setup_environment()
# This line will be programatically read/write by setup.py.
# Leave them at the bottom of this file and don't touch them.
__version__ = "0.4.1"
| # Copyright (c) Facebook, Inc. and its affiliates.
from .utils.env import setup_environment
setup_environment()
# This line will be programatically read/write by setup.py.
# Leave them at the bottom of this file and don't touch them.
__version__ = "0.4"
| apache-2.0 | Python |
a611d0141d9273260da68ade308f613e5f1986e3 | add heterogenous results plot | kondra/latent_ssvm | plot_results.py | plot_results.py | import numpy as np
import pylab as pl
import os
def plot_full_weak():
weak_results = np.genfromtxt('weak_labeled.csv', delimiter=',')
full_results = np.genfromtxt('full_labeled.csv', delimiter=',')
weak_results[0, 2] = 0.5
full_results[0, 1] = 0.5
y = np.mean(weak_results[:17, :6], axis=0)
... | import numpy as np
import pylab as pl
import os
os.chdir("results")
weak_results = np.genfromtxt('weak_labeled.csv', delimiter=',')
full_results = np.genfromtxt('full_labeled.csv', delimiter=',')
weak_results[0, 2] = 0.5
full_results[0, 1] = 0.5
y = np.mean(weak_results[:17, :6], axis=0)
y_min = np.min(weak_result... | bsd-2-clause | Python |
6c3a7ff4ba2c680294ee67ce5efc42380d426236 | order mentors/mentees by crsid | rjw57/edpcmentoring,cuedpc/edpcmentoring,rjw57/edpcmentoring,rjw57/edpcmentoring,rjw57/edpcmentoring,cuedpc/edpcmentoring,cuedpc/edpcmentoring,cuedpc/edpcmentoring | frontend/views.py | frontend/views.py | from django.shortcuts import render
from cuedmembers.decorators import member_required
from matching.models import Preferences
from mentoring.models import Relationship
from .forms import MentoringPreferencesForm
from .queries import select_member_details
@member_required
def index(request):
mentees = select_mem... | from django.shortcuts import render
from cuedmembers.decorators import member_required
from matching.models import Preferences
from mentoring.models import Relationship
from .forms import MentoringPreferencesForm
from .queries import select_member_details
@member_required
def index(request):
mentees = select_mem... | mit | Python |
f3ccd8df07c6834dcbdba6a7be0b66fb711ae826 | update shuffling | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | disaggregator/utils.py | disaggregator/utils.py | import appliance
import pandas as pd
import numpy as np
import os
import pickle
def aggregate_instances(instances, metadata, how="strict"):
'''
Given a list of temporally aligned instances, aggregate them into a single
signal.
'''
if how == "strict":
traces = [instance.traces for instance i... | import appliance
import pandas as pd
import numpy as np
import os
import pickle
def concatenate_traces(traces, metadata=None, how="strict"):
'''
Given a list of appliance traces, returns a single concatenated
trace. With how="strict" option, must be sampled at the same rate and
consecutive, without ove... | mit | Python |
1017facb639d974de3c8d90a6e0642bbd86a1b4d | update .ycm_extra_conf.py | xu-cheng/pbc-bindings,xu-cheng/pbc-bindings,xu-cheng/pbc-bindings | .ycm_extra_conf.py | .ycm_extra_conf.py | import subprocess
def SystemIncludePathasFlags():
cmd = "c++ -E -x c++ - -v </dev/null 2>&1"
out = subprocess.check_output(cmd, shell=True).decode("utf-8")
out = out.split("\n")
out = out[out.index("#include <...> search starts here:") + 1:-1]
out = out[0:out.index("End of search list.")]
out =... | import os
import subprocess
def SystemIncludePathasFlags():
cmd = "c++ -E -x c++ - -v </dev/null 2>&1"
out = subprocess.check_output(cmd, shell=True).decode("utf-8")
out = out.split("\n")
out = out[out.index("#include <...> search starts here:") + 1:-1]
out = out[0:out.index("End of search list.")]... | mit | Python |
dc58eb174f65c508e63aedc617a51d7478db0358 | Update vouch flags when migrating autovouches. | akatsoulas/mozillians,mozilla/mozillians,mozilla/mozillians,mozilla/mozillians,akatsoulas/mozillians,mozilla/mozillians,akatsoulas/mozillians,akatsoulas/mozillians | mozillians/users/migrations/0038_auto_20180815_0108.py | mozillians/users/migrations/0038_auto_20180815_0108.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-08-15 08:08
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
from django.utils.timezone import now
def add_missing_employee_vouches(apps, schema_editor):
UserProfile = apps.get_model('users', 'U... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-08-15 08:08
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
from django.utils.timezone import now
def add_missing_employee_vouches(apps, schema_editor):
UserProfile = apps.get_model('users', 'U... | bsd-3-clause | Python |
7716a82ffba6881e34f6e497c4bbf3704bc0ac23 | change padding char | lvxunDev/yunhetong-python-sdk | lib/aes.py | lib/aes.py | import base64
import json
import time
from Crypto.Cipher import AES
from Crypto import Random
class aes:
def __init__(self, key=''):
self.bs = 16
if '' != key:
self.key = json.loads(key)
self.secretKey = base64.b64decode(self.key['key'])
self.iv = base64.b64deco... | import base64
import json
import time
from Crypto.Cipher import AES
from Crypto import Random
class aes:
def __init__(self, key=''):
self.bs = 16
if '' != key:
self.key = json.loads(key)
self.secretKey = base64.b64decode(self.key['key'])
self.iv = base64.b64deco... | mit | Python |
eb84ba559d7d83f0917e257a6631b8eedcf33f92 | Fix Moshe's typos | SocialNPHS/SocialNPHS | tests/language.py | tests/language.py | """
Unit tests for the portion of this project which processes raw text using
natural language processing techniques.
"""
import sys
import unittest
from os import path
# PATH MAGIC
# Project root
base = path.abspath(path.join(path.dirname(path.abspath(__file__)), ".."))
sys.path.insert(0, base)
from SocialNPHS.lan... | """
Unit tests for the portion of this project which processes raw text using
natural language processing techniques.
"""
import sys
import unittest
from os import path
# PATH MAGIC
# Project root
base = path.abspath(path.join(path.dirname(path.abspath(__file__)), ".."))
sys.path.insert(0, base)
from SocialNPHS.lan... | mit | Python |
f40e72362c0992700eda182e4dbf3da6d46f5fec | Refactor and documented cdms_pi.tests.utils.populate_data | UKTradeInvestment/crm-poc,UKTradeInvestment/crm-poc | crm-poc/apps/cdms_api/tests/utils.py | crm-poc/apps/cdms_api/tests/utils.py | import datetime
from unittest import mock
from django.utils import timezone
from cdms_api.base import CDMSApi
from cdms_api.utils import datetime_to_cdms_datetime
def populate_data(service, data={}, guid=None):
"""
Returns a dict of cdms data to be used as return value of mocked cdms api calls.
This d... | import datetime
from unittest import mock
from django.utils import timezone
from cdms_api.base import CDMSApi
from cdms_api.utils import datetime_to_cdms_datetime
def populate_data(data, service, guid=None):
_data = dict(data)
_data['ModifiedOn'] = _data.get('ModifiedOn', timezone.now())
_data['Created... | bsd-3-clause | Python |
ea989e0df29d9f000a0e841d56a321e9edea0427 | bump to 0.3.1 | tito/telenium,tito/telenium,tito/telenium | telenium/__init__.py | telenium/__init__.py | # coding=utf-8
__version__ = "0.3.1"
| # coding=utf-8
__version__ = "0.3.0"
| mit | Python |
076502a20d2a69b4d6f82dd411de6e2b0a50139f | add state to the instance and adjust status | tsuru/varnishapi,tsuru/varnishapi | tests/managers.py | tests/managers.py | # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from varnishapi import storage
class FakeInstance(object):
def __init__(self, name, state):
self.name = name
self.state = state
... | # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from varnishapi import storage
class FakeInstance(object):
def __init__(self, name):
self.name = name
self.bound = []
def bind(self... | bsd-3-clause | Python |
fa2ecdc0bcb30415699baf4f014b390d4473d43c | Fix Sphinx warnings about duplicate objects | astropy/photutils,larrybradley/photutils | photutils/psf/__init__.py | photutils/psf/__init__.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage contains tools to perform point-spread-function (PSF)
photometry.
"""
from . import epsf
from .epsf import * # noqa
from . import epsf_stars
from .epsf_stars import * # noqa
from . import groupstars
from .groupstars import * # noqa
... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage contains tools to perform point-spread-function (PSF)
photometry.
"""
from .epsf import * # noqa
from .epsf_stars import * # noqa
from .groupstars import * # noqa
from .matching import * # noqa
from .models import * # noqa
from .p... | bsd-3-clause | Python |
a76865c3009e6f890b0cecc8d3e744ea22559d02 | test project: add default values to BooleanFields | askinteractive/mezzanine-advanced-admin,IMAmuseum/django-admin-bootstrapped,andrewyager/django-admin-bootstrapped,avara1986/django-admin-bootstrapped,askinteractive/mezzanine-advanced-admin,avara1986/django-admin-bootstrapped,benthomasson/django-admin-bootstrapped,mynksngh/django-admin-bootstrapped,sn0wolf/django-admin... | test_django_admin_bootstrapped/test_django_admin_bootstrapped/models.py | test_django_admin_bootstrapped/test_django_admin_bootstrapped/models.py | from django.db import models
class TestMe(models.Model):
test_m2m = models.ManyToManyField('self', blank=True, help_text="Lorem dolor")
test_ip = models.IPAddressField(help_text="Lorem dolor")
test_url = models.URLField(help_text="Lorem dolor")
test_int = models.IntegerField(help_text="Lorem dolor")
... | from django.db import models
class TestMe(models.Model):
test_m2m = models.ManyToManyField('self', blank=True, help_text="Lorem dolor")
test_ip = models.IPAddressField(help_text="Lorem dolor")
test_url = models.URLField(help_text="Lorem dolor")
test_int = models.IntegerField(help_text="Lorem dolor")
... | apache-2.0 | Python |
0648b377b4e764514491623e20b38d9ec19f71af | Fix formatting | breznak/nupic,breznak/nupic,breznak/nupic | tests/unit/py2/nupic/support/consoleprinter_test/consoleprinter_test.py | tests/unit/py2/nupic/support/consoleprinter_test/consoleprinter_test.py | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | agpl-3.0 | Python |
c7b4be1ee3597c8b9521e27dd0adfbe36efe17f1 | Update test_ADC.py | IEEERobotics/bot,deepakiam/bot,deepakiam/bot,IEEERobotics/bot,deepakiam/bot,IEEERobotics/bot | tests/test_ADC.py | tests/test_ADC.py | """Test cases for the ADS7830 ADC. """
import time
from unittest import TestCase, expectedFailure
import struct
import bot.lib.lib as lib
from i2c_device.i2c_device import I2CDevice
from bot.hardware.ADC import ADC
config_file = path.dirname(path.realpath(__file__))+"/test_config.yaml"
config = lib.get_config(config... | """Test cases for the ADS7830 ADC. ""
import time
from unittest import TestCase, expectedFailure
import struct
import bot.lib.lib as lib
from i2c_device.i2c_device import I2CDevice
from bot.hardware.ADC import ADC
config_file = path.dirname(path.realpath(__file__))+"/test_config.yaml"
config = lib.get_config(config_... | bsd-2-clause | Python |
612d2aa966329c7a953fb6a0f36830a5f0e567bd | change description field to optional in poll model | kamarkiewicz/django-polls,byteweaver/django-polls,miraculixx/django-polls,miraculixx/django-polls,kamarkiewicz/django-polls,byteweaver/django-polls | polls/models.py | polls/models.py | from django.db import models
from django.contrib.auth.models import User
class Poll(models.Model):
question = models.CharField(max_length=255)
description = models.TextField(blank=True)
def __unicode__(self):
return self.question
class Choice(models.Model):
poll = models.ForeignKey(Poll)
... | from django.db import models
from django.contrib.auth.models import User
class Poll(models.Model):
question = models.CharField(max_length=255)
description = models.TextField()
def __unicode__(self):
return self.question
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice =... | bsd-3-clause | Python |
2032a37dd8c8b528971c58c3309424e8b8d0f7b9 | Fix missing import in volunteer views | mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign | src/volunteers/views.py | src/volunteers/views.py | # coding: utf-8
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.core import signing
from utils import string_template
from campaigns.models import Campaign, CampaignLocationShift
from .models import Volunteer
TEMPLATE = u'''{% extends "campaigns/base.html" %}
... | # coding: utf-8
from django.shortcuts import get_object_or_404
from django.http import HttpResponse
from django.core import signing
from utils import string_template
from campaigns.models import Campaign, CampaignLocationShift
from .models import Volunteer
TEMPLATE = u'''{% extends "campaigns/base.html" %}
{% block... | mit | Python |
9e7c88dc031b24eafcfde7bda7585ce5828281f0 | remove debugging statement | datascopeanalytics/scrubadub,datascopeanalytics/scrubadub,deanmalmgren/scrubadub,deanmalmgren/scrubadub | tests/test_api.py | tests/test_api.py | import unittest
import scrubadub
class APITestCase(unittest.TestCase):
def test_clean(self):
"""Test the top level clean api"""
self.assertEqual(
scrubadub.clean("This is a test message for example@exampe.com"),
"This is a test message for {{EMAIL}}",
)
def te... | import unittest
import scrubadub
class APITestCase(unittest.TestCase):
def test_clean(self):
"""Test the top level clean api"""
self.assertEqual(
scrubadub.clean("This is a test message for example@exampe.com"),
"This is a test message for {{EMAIL}}",
)
def te... | mit | Python |
ffda8a65517678f7bbd6e8c8f3bbe44ca31b3727 | Change order in 2D template | mchels/FolderBrowser | templates/plot_2D.py | templates/plot_2D.py | import sys
sys.path.append({path_to_folderbrowser_dir})
import numpy as np
from plothandler import plot_handler_factory
from datahandler import data_handler_factory
from custom_colormap import get_colormap
from sweep import Sweep
import matplotlib.pyplot as plt
import importlib.util
pcols_path = {pcols_path}
spec = im... | import sys
sys.path.append({path_to_folderbrowser_dir})
import numpy as np
from plothandler import plot_handler_factory
from datahandler import data_handler_factory
from custom_colormap import get_colormap
from sweep import Sweep
import matplotlib.pyplot as plt
import importlib.util
pcols_path = {pcols_path}
spec = im... | mit | Python |
c8cd5502f685a83a026d4584c95860e6feb7c74a | Update setup.py | analyst-collective/dbt,analyst-collective/dbt | plugins/bigquery/setup.py | plugins/bigquery/setup.py | #!/usr/bin/env python
import os
import sys
if sys.version_info < (3, 6):
print('Error: dbt does not support this version of Python.')
print('Please upgrade to Python 3.6 or higher.')
sys.exit(1)
from setuptools import setup
try:
from setuptools import find_namespace_packages
except ImportError:
#... | #!/usr/bin/env python
import os
import sys
if sys.version_info < (3, 6):
print('Error: dbt does not support this version of Python.')
print('Please upgrade to Python 3.6 or higher.')
sys.exit(1)
from setuptools import setup
try:
from setuptools import find_namespace_packages
except ImportError:
#... | apache-2.0 | Python |
98b7920f267b42d4da7f108e801323ea99b81644 | Fix title string issues, for real this time | rrttyy/google-tasks-porter,romans74/google-tasks-porter,cztchoice/cztchoice-gtask-porter,Jagsir/google-tasks-porter,Froleyks/google-tasks-porter,Jagsir/google-tasks-porter,theloniuser/google-tasks-porter,rrttyy/google-tasks-porter,karalan/google-tasks-porter,romans74/google-tasks-porter,cztchoice/cztchoice-gtask-porter... | model.py | model.py | #!/usr/bin/python2.5
#
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | #!/usr/bin/python2.5
#
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 | Python |
ccfa54c3845985b6ee85f1ad635cb93a2dc9e80f | remove leftover debug print | SoftwareHeritage/swh-web-ui,SoftwareHeritage/swh-web-ui,SoftwareHeritage/swh-web-ui | swh/web/ui/service.py | swh/web/ui/service.py | # Copyright (C) 2015 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
from swh.web.ui import main
from swh.web.ui import query
def lo... | # Copyright (C) 2015 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
from swh.web.ui import main
from swh.web.ui import query
def lo... | agpl-3.0 | Python |
396e8077a1a0798bd6586bc37d10028ba69ca256 | bump version | dxiao2003/katapal_util | katapal_util/__init__.py | katapal_util/__init__.py | # -*- coding: utf-8 -*-
__title__ = 'katapal_util'
__version__ = '0.5'
__author__ = 'David Xiao'
__license__ = 'MIT'
__copyright__ = 'Copyright 2016 Katapal, Inc.'
# Version synonym
VERSION = __version__
| # -*- coding: utf-8 -*-
__title__ = 'katapal_util'
__version__ = '0.4'
__author__ = 'David Xiao'
__license__ = 'MIT'
__copyright__ = 'Copyright 2016 Katapal, Inc.'
# Version synonym
VERSION = __version__
| mit | Python |
c4a31578b40bab83abcd3dadf1d3b04ead33f376 | Add test for jungle ec2 ls -l | achiku/jungle | tests/test_ec2.py | tests/test_ec2.py | # -*- coding: utf-8 -*-
import boto3
import pytest
from moto import mock_ec2
from jungle import cli
@pytest.yield_fixture(scope='function')
def ec2():
"""EC2 mock service"""
mock = mock_ec2()
mock.start()
ec2 = boto3.resource('ec2')
ec2.create_instances(ImageId='ami-xxxxx', MinCount=1, MaxCount=... | # -*- coding: utf-8 -*-
import boto3
import pytest
from moto import mock_ec2
from jungle import cli
@pytest.yield_fixture(scope='function')
def ec2():
"""EC2 mock service"""
mock = mock_ec2()
mock.start()
ec2 = boto3.resource('ec2')
ec2.create_instances(ImageId='ami-xxxxx', MinCount=1, MaxCount=... | mit | Python |
08244ad58a4641857e3514331a98fdf01790d2fa | add repr method to changes | dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | pillowtop/feed/interface.py | pillowtop/feed/interface.py | from abc import ABCMeta, abstractmethod
class Change(object):
"""
A record of a change. Provides a dict-like interface for backwards compatibility with couch changes.
"""
PROPERTY_DICT_MAP = {
'id': 'id',
'sequence_id': 'seq',
'document': 'doc',
'deleted': 'deleted'
... | from abc import ABCMeta, abstractmethod
class Change(object):
"""
A record of a change. Provides a dict-like interface for backwards compatibility with couch changes.
"""
PROPERTY_DICT_MAP = {
'id': 'id',
'sequence_id': 'seq',
'document': 'doc',
'deleted': 'deleted'
... | bsd-3-clause | Python |
ad945381a1477509204a4ec952e5e822034823c1 | Implement some neutral epic minions | liujimj/fireplace,Ragowit/fireplace,butozerca/fireplace,oftc-ftw/fireplace,butozerca/fireplace,Meerkov/fireplace,amw2104/fireplace,NightKev/fireplace,smallnamespace/fireplace,Ragowit/fireplace,oftc-ftw/fireplace,jleclanche/fireplace,smallnamespace/fireplace,liujimj/fireplace,beheh/fireplace,amw2104/fireplace,Meerkov/fi... | fireplace/carddata/minions/neutral/epic.py | fireplace/carddata/minions/neutral/epic.py | from ...card import *
from fireplace.enums import Race
# Big Game Hunter
class EX1_005(Card):
action = destroyTarget
# Murloc Warleader
class EX1_507(Card):
aura = "EX1_507e"
class EX1_507e(Card):
atk = 2
health = 1
def isValidTarget(self, target):
return target.race == Race.MURLOC and target is not self.so... | from ...card import *
| agpl-3.0 | Python |
e297b5d9c91743f68e333bac88e154d06406c908 | add unit test | Wolfium/pyjwt,dotsbb/pyjwt,mark-adams/pyjwt,mindw/pyjwt,progrium/pyjwt,jpadilla/pyjwt,rainierwolfcastle/pyjwt,jmgamboa/pyjwt | tests/test_jwt.py | tests/test_jwt.py | import unittest
import time
import jwt
class TestJWT(unittest.TestCase):
def setUp(self):
self.payload = {"iss": "jeff", "exp": int(time.time()), "claim": "insanity"}
def test_encode_decode(self):
secret = 'secret'
jwt_message = jwt.encode(self.payload, secret)
decoded_payloa... | import unittest
import time
import jwt
class TestJWT(unittest.TestCase):
def setUp(self):
self.payload = {"iss": "jeff", "exp": int(time.time()), "claim": "insanity"}
def test_encode_decode(self):
secret = 'secret'
jwt_message = jwt.encode(self.payload, secret)
decoded_payloa... | mit | Python |
ca8bdf9385b0dea52293b1ac55dc3e8bb2183c92 | use `Functor` rather than `Monad` in `Zip.apzip` | tek/amino | amino/tc/zip.py | amino/tc/zip.py | import abc
from typing import TypeVar, Generic, Callable, Tuple
from amino.tc.base import TypeClass, tc_prop
from amino.tc.monoid import Monoid
from amino.tc.foldable import Foldable
from amino.tc.applicative import Applicative
from amino.tc.functor import Functor
F = TypeVar('F')
A = TypeVar('A')
B = TypeVar('B')
... | import abc
from typing import TypeVar, Generic, Callable, Tuple
from amino.tc.base import TypeClass, tc_prop
from amino.tc.monad import Monad
from amino.tc.monoid import Monoid
from amino.tc.foldable import Foldable
from amino.tc.applicative import Applicative
F = TypeVar('F')
A = TypeVar('A')
B = TypeVar('B')
clas... | mit | Python |
85c6252b54108750291021a74dc00895f79a7ccf | update test_git.py to use the new single-character flag style | pengshp/GitPython,roidelapluie/GitPython,Conjuro/GitPython,nvie/GitPython,zsjohny/GitPython,cool-RR/GitPython,zsjohny/GitPython,bwrsandman/GitPython,hvnsweeting/GitPython,bwrsandman/GitPython,jeblair/GitPython,cool-RR/GitPython,dpursehouse/GitPython,h4ck3rm1k3/GitPython,Conjuro/GitPython,StyXman/GitPython,breavo/GitPyt... | test/git/test_git.py | test/git/test_git.py | import os
from test.testlib import *
from git_python import *
class TestGit(object):
def setup(self):
base = os.path.join(os.path.dirname(__file__), "../..")
self.git = Git(base)
@patch(Git, 'execute')
def test_method_missing_calls_execute(self, git):
git.return_value = ''
... | import os
from test.testlib import *
from git_python import *
class TestGit(object):
def setup(self):
base = os.path.join(os.path.dirname(__file__), "../..")
self.git = Git(base)
@patch(Git, 'execute')
def test_method_missing_calls_execute(self, git):
git.return_value = ''
... | bsd-3-clause | Python |
a22d05c15be5c84dacfe35817cc843ba236b112b | remove unused space. | jonhadfield/acli,jonhadfield/acli | tests/test_vpc.py | tests/test_vpc.py | from __future__ import (absolute_import, print_function, unicode_literals)
from acli.services.vpc import (vpc_list, vpc_info)
from acli.config import Config
from moto import mock_ec2
import pytest
from boto3.session import Session
session = Session(region_name="eu-west-1")
config = Config(cli_args={'--region': 'eu-w... | from __future__ import (absolute_import, print_function, unicode_literals)
from acli.services.vpc import (vpc_list, vpc_info)
from acli.config import Config
from moto import mock_ec2
import pytest
from boto3.session import Session
session = Session(region_name="eu-west-1")
config = Config(cli_args={'--region': 'eu-w... | mit | Python |
89dd0572acbf97bd6df0a9772c25dc66b674a10f | change default for read_files to look for stan suffix | jburos/survivalstan,jburos/survivalstan | survivalstan/utils.py | survivalstan/utils.py | import os
from fnmatch import fnmatch
import ntpath
import pkg_resources
## indexes a directory of stan files
## returns as dictionary containing contents of files
def _list_files_in_path(path, pattern = "*.stan"):
results = []
for dirname, subdirs, files in os.walk(path):
for name in files:
... | import os
from fnmatch import fnmatch
import ntpath
import pkg_resources
## indexes a directory of stan files
## returns as dictionary containing contents of files
def _list_files_in_path(path, pattern = "*.stan"):
results = []
for dirname, subdirs, files in os.walk(path):
for name in files:
... | apache-2.0 | Python |
55e29c2a39b40bf136f41819bb08623e858fffef | update who test | openhealthalgorithms/openhealthalgorithms | tests/test_who.py | tests/test_who.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from nose_parameterized import parameterized
from OHA.WHO import WHO
from OHA.param_builders.who_param_builder import WhoParamsBuilder
from tests.helpers.DataHelper import DataHelper
class WhoTest(unittest.TestCase):
def test_should_produce_except... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from nose_parameterized import parameterized
from OHA.WHO import WHO
from OHA.param_builders.who_param_builder import WhoParamsBuilder
from tests.helpers.DataHelper import DataHelper
class WhoTest(unittest.TestCase):
def test_should_produce_except... | apache-2.0 | Python |
01358a34c59281dd19ced11eb6eb9b2a59856e70 | fix parser bugs | lonelyandrew/IRC | proj_1/bool_re/bool_re.py | proj_1/bool_re/bool_re.py | #! /usr/local/bin Python3
def parser(command):
main_q = []
branch_q = []
command = command.strip()
command = command.replace('AND NOT', '^')
command = command.replace('AND', '&')
command = command.replace('OR', '|')
return command
| #! /usr/local/bin Python3
def parser(command):
main_q = []
branch_q = []
command.replace('AND NOT', '^')
command.replace('AND', '&')
command.replace('OR', '|')
return command
| mit | Python |
2ced12bdb90754e12521e7bbe46b57bb11f4eff6 | Update tests/test_zmq.py | pyghassen/zerorpc-python,danielrowles-wf/zerorpc-python,kencochrane/zerorpc-python,madscheme/zerorpc-python,yishilin/zerorpc-python,wfxiang08/zerorpc-python,alemic/zerorpc-python,pramukta/zerorpc-python,psantann/zerorpc-python,vidyacraghav/zerorpc-python,pchomik/zerorpc-python,gmarceau/zerorpc-python,abarnert/zerorpc-p... | tests/test_zmq.py | tests/test_zmq.py | # -*- coding: utf-8 -*-
# Open Source Initiative OSI - The MIT License (MIT):Licensing
#
# The MIT License (MIT)
# Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Softwa... | # -*- coding: utf-8 -*-
# Open Source Initiative OSI - The MIT License (MIT):Licensing
#
# The MIT License (MIT)
# Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Softwa... | mit | Python |
a80b1292e9c9a29921a3e42c7c60d861b4bf7965 | Enable with statement tests for Python 2.5 | frankier/mock,dannybtran/mock,testing-cabal/mock,sorenh/mock,scorphus/mock,nett55/mock,rbtcollins/mock,fladi/mock,OddBloke/mock,derwiki-adroll/mock,kostyll/mock,pypingou/mock,lord63-forks/mock,johndeng/mock | tests/testwith.py | tests/testwith.py | import sys
if sys.version_info[:2] >= (2, 5):
from tests._testwith import *
else:
from tests.support import unittest2
class TestWith(unittest2.TestCase):
@unittest2.skip('tests using with statement skipped on Python 2.4')
def testWith(self):
pass
if __name__ == '... | import sys
if sys.version_info[:2] > (2, 5):
from tests._testwith import *
else:
from tests.support import unittest2
class TestWith(unittest2.TestCase):
@unittest2.skip('tests using with statement skipped on Python 2.4')
def testWith(self):
pass
if __name__ == '_... | bsd-2-clause | Python |
1bfa91ebc84f1bf1866eb3fc5751ce3187d90790 | Update urls.py | funkybob/antfarm | antfarm/urls.py | antfarm/urls.py | '''
Django-style URL dispatcher view.
App(root_url=url_dispatcher([
(r'^/$', views.index),
(re.compile(r'^/(?P<foo>\d+)/'), views.detail, {'bar': True}),
])
The view will be called with the request, and any matched _named_ groups.
Extra kwargs can be passed as a 3rd positional argument.
There... | '''
Django-style URL dispatcher view.
App(root_url=url_dispatcher([
(r'^/$', views.index),
(re.compile(r'^/(?P<foo>\d+)/'), views.detail, {'bar': True}),
])
The view will be called with the request, and any matched _named_ groups.
Extra kwargs can be passed as a 3rd positional argument.
There... | mit | Python |
9e27327d942b576551671c9800cea2d772ce1b08 | Remove Account | brunoliveira8/managyment,brunoliveira8/managyment,brunoliveira8/managyment | project/gym_app/models.py | project/gym_app/models.py | from django.db import models
# Create your models here.
class WeightProgress(models.Model):
startDate = models.DateField(auto_now_add=True)
startWeight = models.IntegerField(max_length=4)
previousDate = models.DateField()
previousWeight = models.IntegerField(max_length=4)
lastDate = models.DateFi... | from django.db import models
# Create your models here.
#Abstract class that all user accounts will inherit from
class Account(models.Model):
firstName = models.CharField(max_length=32)
lastName = models.CharField(max_length=32)
username = models.CharField(max_length=32, unique=True)
password = models... | mit | Python |
6055b7eb6b34ed22eb3c7cd17a975d4728be1360 | Add test for new edge sampling | Eigenstate/msmbuilder,Eigenstate/msmbuilder,msmbuilder/msmbuilder,msmbuilder/msmbuilder,Eigenstate/msmbuilder,brookehus/msmbuilder,brookehus/msmbuilder,brookehus/msmbuilder,brookehus/msmbuilder,Eigenstate/msmbuilder,msmbuilder/msmbuilder,msmbuilder/msmbuilder,brookehus/msmbuilder,msmbuilder/msmbuilder,Eigenstate/msmbui... | msmbuilder/tests/test_sampling.py | msmbuilder/tests/test_sampling.py | import numpy as np
from msmbuilder.decomposition import tICA
from msmbuilder.io.sampling import sample_dimension
def test_sample_dimension():
np.random.seed(42)
X = np.random.randn(500, 5)
data = [X, X, X]
tica = tICA(n_components=2, lag_time=1).fit(data)
tica_trajs = {k: tica.partial_transform(... | import numpy as np
from msmbuilder.decomposition import tICA
from msmbuilder.io.sampling import sample_dimension
def test_sample_dimension():
np.random.seed(42)
X = np.random.randn(500, 5)
data = [X, X, X]
tica = tICA(n_components=2, lag_time=1).fit(data)
tica_trajs = {k: tica.partial_transform(... | lgpl-2.1 | Python |
9d4afec3fd71b017da0a9911872fd56ba81a6f1c | Rename eul2quat() as angle2quat() as agreed upon. Rename input_check_1d() to input_check_Nx1() for clarity. Begin quat2angle(), still emtpy. | NavPy/NavPy,hamid-m/NavPy,adhika/NavPy | navpy.py | navpy.py | import numpy as np
def angle2quat(rotAngle1,rotAngle2,rotAngle3,
input_unit='rad',rotation_sequence='ZYX'):
"""
"""
# INPUT CHECK
rotAngle1,N1 = input_check_Nx1(rotAngle1)
rotAngle2,N2 = input_check_Nx1(rotAngle2)
rotAngle3,N3 = input_check_Nx1(rotAngle3)
if( ... | import numpy as np
def eul2quat(rotAngle1,rotAngle2,rotAngle3,
input_unit='rad',rotation_sequence='ZYX'):
"""
"""
# INPUT CHECK
rotAngle1,N1 = input_check_1d(rotAngle1)
rotAngle2,N2 = input_check_1d(rotAngle2)
rotAngle3,N3 = input_check_1d(rotAngle3)
if( (N1!=... | bsd-3-clause | Python |
cebd4f1ee9a87cc2652ebf8981df20121ec257b2 | Raise ValueError instead of struct.error | gulopine/steel-experiment | steel/fields/numbers.py | steel/fields/numbers.py | import struct
from steel.fields import Field
__all__ = ['Integer']
class Integer(Field):
"An integer represented as a sequence and bytes"
# These map a number of bytes to a struct format code
size_formats = {
1: 'B', # char
2: 'H', # short
4: 'L', # long
8: 'Q', # lon... | import struct
from steel.fields import Field
__all__ = ['Integer']
class Integer(Field):
"An integer represented as a sequence and bytes"
# These map a number of bytes to a struct format code
size_formats = {
1: 'B', # char
2: 'H', # short
4: 'L', # long
8: 'Q', # lon... | bsd-3-clause | Python |
fc37e171edb11ecc2aa0096ceea14bc539d61d70 | bump dev version | pyconau2017/symposion,TheOpenBastion/symposion,faulteh/symposion,euroscipy/symposion,euroscipy/symposion,pydata/symposion,faulteh/symposion,pyohio/symposion,mbrochh/symposion,TheOpenBastion/symposion,pinax/symposion,python-spain/symposion,pydata/symposion,mbrochh/symposion,toulibre/symposion,NelleV/pyconfr-test,miurahr... | symposion/__init__.py | symposion/__init__.py | __version__ = "1.0b1.dev50"
| __version__ = "1.0b1.dev49"
| bsd-3-clause | Python |
148ac18c2660b9ec6482a3026dda7e42542a27d5 | bump dev version | mbrochh/symposion,pyconau2017/symposion,pyconca/2013-web,TheOpenBastion/symposion,pydata/symposion,pyohio/symposion,pydata/symposion,mbrochh/symposion,miurahr/symposion,python-spain/symposion,NelleV/pyconfr-test,pinax/symposion,pinax/symposion,NelleV/pyconfr-test,euroscipy/symposion,python-spain/symposion,toulibre/symp... | symposion/__init__.py | symposion/__init__.py | __version__ = "1.0b1.dev49"
| __version__ = "1.0b1.dev48"
| bsd-3-clause | Python |
0641e55bd6a87557c5cb89d073ae067e8a57fcc1 | Fix a path issue | amperser/proselint,amperser/proselint,jstewmon/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint | proselint/command_line.py | proselint/command_line.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Command line utility for proselint."""
import click
import os
import imp
base_url = "prose.lifelinter.com/"
proselint_path = os.path.dirname(os.path.realpath(__file__))
def log_error(line, column, error_code, msg):
"""Print a message to the command line."""
clic... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Command line utility for proselint."""
import click
import os
import imp
base_url = "prose.lifelinter.com/"
def log_error(line, column, error_code, msg):
"""Print a message to the command line."""
click.echo(str(line) + ":" +
str(column) + " \t" +... | bsd-3-clause | Python |
92f6cd6804e71245ba9b91e5bedf4c0b4b07e30b | Make retrieval of the detectron ops lib more robust | facebookresearch/Detectron,facebookresearch/Detectron,facebookresearch/Detectron | lib/utils/env.py | lib/utils/env.py | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | apache-2.0 | Python |
856b3420a5c580aa93cc79d4f977e268a6364268 | remove migration stuff from the alembic script, apparently I don't know how that works yet | Lancey6/redwind,Lancey6/redwind,Lancey6/redwind | migrations/versions/93bd528a83_add_attachment_element.py | migrations/versions/93bd528a83_add_attachment_element.py | """add Attachment element
Revision ID: 93bd528a83
Revises: 51d6e03ecba
Create Date: 2015-06-04 22:02:36.082013
"""
# revision identifiers, used by Alembic.
revision = '93bd528a83'
down_revision = '51d6e03ecba'
from alembic import op
import sqlalchemy as sa
from redwind import create_app
from redwind import util
f... | """add Attachment element
Revision ID: 93bd528a83
Revises: 51d6e03ecba
Create Date: 2015-06-04 22:02:36.082013
"""
# revision identifiers, used by Alembic.
revision = '93bd528a83'
down_revision = '51d6e03ecba'
from alembic import op
import sqlalchemy as sa
from redwind import create_app
from redwind import util
f... | bsd-2-clause | Python |
32f99cd7a9f20e2c8d7ebd140c23ac0e43b1284c | Add logging to track down a bug | xchewtoyx/pulldb | pulldb/users.py | pulldb/users.py | # Copyright 2013 Russell Heilling
import logging
from google.appengine.api import users
from pulldb import base
from pulldb import session
from pulldb.models.users import User
class Profile(session.SessionHandler):
def get(self):
app_user = users.get_current_user()
template_values = self.base_template_valu... | # Copyright 2013 Russell Heilling
import logging
from google.appengine.api import users
from pulldb import base
from pulldb import session
from pulldb.models.users import User
class Profile(session.SessionHandler):
def get(self):
app_user = users.get_current_user()
template_values = self.base_template_valu... | mit | Python |
2d6f8b7b64a2d3e5d99254efd4cf79556692822b | Initialize flask-babel | finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is | app/__init__.py | app/__init__.py | import logging
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
from flask.ext.mail import Mail
from flask.ext.whooshalchemy import whoosh_index
from ... | import logging
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
from flask.ext.mail import Mail
from flask.ext.whooshalchemy import whoosh_index
from... | mit | Python |
38dc0f85d4a147591d1815834113541e517a5ffb | bump to 1.0.0b3 | dmpetrov/dataversioncontrol,dmpetrov/dataversioncontrol,efiop/dvc,efiop/dvc | dvc/version.py | dvc/version.py | # Used in setup.py, so don't pull any additional dependencies
#
# Based on:
# - https://github.com/python/mypy/blob/master/mypy/version.py
# - https://github.com/python/mypy/blob/master/mypy/git.py
import os
import subprocess
_BASE_VERSION = "1.0.0b3"
def _generate_version(base_version):
"""Generate a versio... | # Used in setup.py, so don't pull any additional dependencies
#
# Based on:
# - https://github.com/python/mypy/blob/master/mypy/version.py
# - https://github.com/python/mypy/blob/master/mypy/git.py
import os
import subprocess
_BASE_VERSION = "1.0.0b2"
def _generate_version(base_version):
"""Generate a versio... | apache-2.0 | Python |
c3e5d3b13f9f074efe9797897ffb6429a2e8c6fe | improve hpd.py | tomba/kmsxx,tomba/kmsxx,tomba/kmsxx,tomba/kmsxx | py/tests/hpd.py | py/tests/hpd.py | #!/usr/bin/python3
import pyudev
import pykms
card = pykms.Card()
conns = card.connectors
context = pyudev.Context()
dev = pyudev.Devices.from_name(context, 'drm', 'card0')
monitor = pyudev.Monitor.from_netlink(context)
monitor.filter_by('drm')
for device in iter(monitor.poll, None):
if 'HOTPLUG' in device:
pr... | #!/usr/bin/python3
import pyudev
import pykms
card = pykms.Card()
res = pykms.ResourceManager(card)
conn = res.reserve_connector("hdmi")
context = pyudev.Context()
dev = pyudev.Devices.from_name(context, 'drm', 'card0')
monitor = pyudev.Monitor.from_netlink(context)
monitor.filter_by('drm')
for device in iter(mon... | mpl-2.0 | Python |
448d3213860d377e146aa4afa5087f5f3ccfcdb9 | test file updated | DiCarloLab-Delft/PycQED_py3,DiCarloLab-Delft/PycQED_py3,DiCarloLab-Delft/PycQED_py3 | pycqed/tests/analysis_v2/test_Two_state_T1_analysis.py | pycqed/tests/analysis_v2/test_Two_state_T1_analysis.py | import unittest
import pycqed as pq
import os
from pycqed.analysis_v2 import measurement_analysis as ma
from pycqed.analysis_v2 import Two_state_T1_analysis as Ta
class Test_efT1_analysis(unittest.TestCase):
@classmethod
def setUpClass(self):
self.datadir = os.path.join(pq.__path__[0], 'tests', 'test... | import unittest
import pycqed as pq
import os
from pycqed.analysis_v2 import measurement_analysis as ma
from pycqed.analysis_v2 import Two_state_T1_analysis as Ta
class Test_efT1_analysis(unittest.TestCase):
@classmethod
def setUpClass(self):
self.datadir = os.path.join(pq.__path__[0], 'tests', 'test... | mit | Python |
9c528a9ce2d768fa44e821dce0104636d2de19db | Fix tests | NickVolynkin/SmokeDetector,Charcoal-SE/SmokeDetector,Charcoal-SE/SmokeDetector,ArtOfCode-/SmokeDetector,NickVolynkin/SmokeDetector,ArtOfCode-/SmokeDetector | test/test_regexes.py | test/test_regexes.py | from findspam import FindSpam
import pytest
@pytest.mark.parametrize("title, body, username, site, match", [
('18669786819 gmail customer service number 1866978-6819 gmail support number', '', '', '', True),
('Is there any http://www.hindawi.com/ template for Cloud-Oriented Data Center Networking?', '',... | from findspam import FindSpam
import pytest
@pytest.mark.parametrize("title, body, username, site, match", [
('18669786819 gmail customer service number 1866978-6819 gmail support number', '', '', '', True),
('Is there any http://www.hindawi.com/ template for Cloud-Oriented Data Center Networking?', '',... | apache-2.0 | Python |
57e58772ef95f56b8cb0207469f6b1721811d5cc | update dev version after 1.0.0 tag [ci skip] | desihub/desitarget,desihub/desitarget | py/desitarget/_version.py | py/desitarget/_version.py | __version__ = '1.0.0.dev5020'
| __version__ = '1.0.0'
| bsd-3-clause | Python |
27bd3012ca38e08d5c8b2f0e0144c649f1726a26 | make stat example work | osmcode/pyosmium,osmcode/pyosmium,osmcode/pyosmium | examples/osm_file_stats.py | examples/osm_file_stats.py | import osmium as o
import sys
class FileStatsHandler(o.SimpleHandler):
def __init__(self):
o.SimpleHandler.__init__(self)
self.nodes = 0
self.ways = 0
self.rels = 0
def node(self, n):
self.nodes += 1
def way(self, w):
self.ways += 1
def relation(self, ... | import osmium as o
import sys
class FileStatsHandler(o.SimpleHandler):
def __init__(self):
o.SimpleHandler.__init__(self)
self.nodes = 0
self.ways = 0
self.rels = 0
def node(self, n):
pass self.nodes += 1
def way(self, w):
pass self.ways += 1
def relat... | bsd-2-clause | Python |
84ced24ccfea8402e0fce1847b6f44bac470c58c | fix the old function using yaml input so that it is consistent with the new format | necozay/tulip-control,necozay/tulip-control,necozay/tulip-control,tulip-control/tulip-control,tulip-control/tulip-control,tulip-control/tulip-control,necozay/tulip-control,necozay/tulip-control,tulip-control/tulip-control | tools/autopart.py | tools/autopart.py | #!/usr/bin/env python
"""
Read data for a continuous transition system from a YAML file,
optionally visualize the partition, and save the result into a
tulipcon XML file.
Flags: -v verbose;
-p generate figure using functions in polytope.plot module.
SCL; 1 Apr 2012.
"""
import numpy as np
import sys
from S... | #!/usr/bin/env python
"""
Read data for a continuous transition system from a YAML file,
optionally visualize the partition, and save the result into a
tulipcon XML file.
Flags: -v verbose;
-p generate figure using functions in polytope.plot module.
SCL; 1 Apr 2012.
"""
import numpy as np
import sys
from S... | bsd-3-clause | Python |
fc73dfb33f4e19d649672f19a1dc4cf09b229d29 | Add response_ok and response_error methods which return byte strings. | bm5w/network_tools | echo_server.py | echo_server.py | #! /usr/bin/env python
"""Echo server in socket connection: receives and sends back a message."""
import socket
def response_ok():
"""Return byte string 200 ok response."""
return u"HTTP/1.1 200 OK\nContent-Type: text/plain\nContent-length: 18\n\r\neverything is okay".encode('utf-8')
def reponse_error(error... | #! /usr/bin/env python
"""Echo server in socket connection: receives and sends back a message."""
import socket
if __name__ == '__main__':
"""Run from terminal, this will recieve a messages and send them back."""
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM,
... | mit | Python |
f20902b941e2f0b10ba6fab18f902f38b9cb7241 | Fix up time stamps | bbayles/py3flowtools | py3flowtools/flow_line.py | py3flowtools/flow_line.py | # flow_line.py
# Copyright 2014 Bo Bayles (bbayles@gmail.com)
# See http://github.com/bbayles/py3flowtools for documentation and license
from __future__ import division, print_function, unicode_literals
import datetime
import socket
import struct
inet_aton = lambda x: ipv4_struct.unpack(socket.inet_aton(x))[0]
ipv4_s... | # flow_line.py
# Copyright 2014 Bo Bayles (bbayles@gmail.com)
# See http://github.com/bbayles/py3flowtools for documentation and license
from __future__ import division, print_function, unicode_literals
import datetime
import socket
import struct
inet_aton = lambda x: ipv4_struct.unpack(socket.inet_aton(x))[0]
ipv4_s... | mit | Python |
3d4d9a69190c3d5b8d40a6eeee0b49a59e831606 | Use max to get the number of RNA sequences | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | rnacentral/portal/management/commands/xml_export_parallel.py | rnacentral/portal/management/commands/xml_export_parallel.py | """
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | """
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | apache-2.0 | Python |
2dde9c34499e73d2fa317111745ce9ea7cdfe903 | add compat for celery 5.x | ulule/django-courriers,ulule/django-courriers | courriers/tasks.py | courriers/tasks.py | try:
from celery.task import task
except ImportError:
from celery import shared_task as task
@task(bind=True)
def subscribe(self, email, newsletter_list_id, user_id=None, **kwargs):
from courriers.backends import get_backend
from courriers.models import NewsletterList
from courriers import signals... | from __future__ import absolute_import
from celery.task import task
@task(bind=True)
def subscribe(self, email, newsletter_list_id, user_id=None, **kwargs):
from courriers.backends import get_backend
from courriers.models import NewsletterList
from courriers import signals
from django.contrib.auth i... | mit | Python |
4eabdfeb2a228e650fc5822df405ac51b448a167 | Clarify monitor command help text and log message | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | cla_backend/apps/cla_butler/management/commands/monitor_missing_outcome_codes.py | cla_backend/apps/cla_butler/management/commands/monitor_missing_outcome_codes.py | # coding=utf-8
import logging
from django.core.management.base import BaseCommand
from cla_butler.stack import is_first_instance, InstanceNotInAsgException, StackException
from cla_eventlog.constants import LOG_LEVELS, LOG_TYPES
from cla_eventlog.models import Log
from legalaid.models import Case
logger = logging.ge... | # coding=utf-8
import logging
from django.core.management.base import BaseCommand
from cla_butler.stack import is_first_instance, InstanceNotInAsgException, StackException
from cla_eventlog.constants import LOG_LEVELS, LOG_TYPES
from cla_eventlog.models import Log
from legalaid.models import Case
logger = logging.ge... | mit | Python |
d97144e2b45750c416d3adbf9f49f78bfa8e7e6e | Set def arguments to immutable to avoid nasty side effect. | scipy/scipy-svn,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,scipy/scipy-svn,lesserwhirls/scipy-cwt,scipy/scipy-svn,scipy/scipy-svn,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor | Lib/sandbox/pyem/misc.py | Lib/sandbox/pyem/misc.py | # Last Change: Sat Jun 09 08:00 PM 2007 J
#========================================================
# Constants used throughout the module (def args, etc...)
#========================================================
# This is the default dimension for representing confidence ellipses
DEF_VIS_DIM = (0, 1)
DEF_ELL_NP = ... | # Last Change: Sat Jun 09 07:00 PM 2007 J
#========================================================
# Constants used throughout the module (def args, etc...)
#========================================================
# This is the default dimension for representing confidence ellipses
DEF_VIS_DIM = [0, 1]
DEF_ELL_NP = ... | bsd-3-clause | Python |
de2e3dd947660b4b1222820141c5c7cd66098349 | Add an explicit related name | prophile/django_split | django_split/models.py | django_split/models.py | from django.db import models
class ExperimentGroup(models.Model):
experiment = models.CharField(max_length=48)
user = models.ForeignKey(
'auth.User',
related_name='django_split_experiment_groups',
)
group = models.IntegerField()
class Meta:
unique_together = (
... | from django.db import models
class ExperimentGroup(models.Model):
experiment = models.CharField(max_length=48)
user = models.ForeignKey('auth.User', related_name=None)
group = models.IntegerField()
class Meta:
unique_together = (
('experiment', 'user'),
)
class Experimen... | mit | Python |
f8be19809f5614482e7e3d3ea673c08a97f09163 | Clean up | Koheron/koheron-server,Koheron/koheron-server,Koheron/koheron-server,Koheron/tcp-server,Koheron/koheron-server,Koheron/tcp-server,Koheron/tcp-server,Koheron/tcp-server,Koheron/tcp-server | APIs/python/connect_test.py | APIs/python/connect_test.py | from koheron_tcp_client import KClient, command
class Tests:
def __init__(self, client):
self.client = client
@command('TESTS')
def set_mean(self, mean): pass
@command('TESTS')
def send_std_array(self):
return client.recv_buffer(10, data_type='float32')
client = KClient('127.0.0.1', 36000, verbose=True)
c... | from koheron_tcp_client import KClient, command
class Tests:
def __init__(self, client):
self.client = client
@command('TESTS')
def set_mean(self, mean): pass
@command('TESTS')
def send_std_array(self):
return client.recv_buffer(10, data_type='float32')
client = KClient('127.0.0.1', 36000, verbose=True)
c... | agpl-3.0 | Python |
0447cc261f54a46d712a78009bb1c1a5a5cddb74 | update version to fb8 | cvubrugier/targetcli-fb,cloud4life/targetcli-fb,agrover/targetcli-fb | targetcli/__init__.py | targetcli/__init__.py | '''
This file is part of targetcli.
Copyright (c) 2011 by RisingTide Systems LLC
This program 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, version 3 (AGPLv3).
This program is distributed in the hope th... | '''
This file is part of targetcli.
Copyright (c) 2011 by RisingTide Systems LLC
This program 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, version 3 (AGPLv3).
This program is distributed in the hope th... | apache-2.0 | Python |
386edcc628ad39ce63d39f6d597711552bf5b67a | Add dmoj crate for Rust submissions (#215) | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/executors/RUST.py | dmoj/executors/RUST.py | import os
from .base_executor import CompiledExecutor
CARGO_TOML = '''\
[package]
name = "{name}"
version = "1.0.0"
'''
HELLO_WORLD_PROGRAM = '''\
fn main() {
println!("echo: Hello, World!");
}
'''
class Executor(CompiledExecutor):
name = 'RUST'
command = 'cargo'
test_program = HELLO_WORLD_PROGRAM... | import os
from .base_executor import CompiledExecutor
CARGO_TOML = '''\
[package]
name = "{name}"
version = "0.0.0"
'''
class Executor(CompiledExecutor):
name = 'RUST'
command = 'cargo'
test_program = 'fn main() { println!("echo: Hello, World!"); }'
def create_files(self, problem_id, source_code, ... | agpl-3.0 | Python |
972a3b7e719316db3befc673a5a22b76120098d3 | add pixel size and orientation to telescope properties | MaxNoe/cta_event_viewer | telescope/__init__.py | telescope/__init__.py | import pandas as pd
lst_mapping = pd.read_csv('telescope/lst.csv')
class Telescope(object):
"""The base Telescope class"""
def __init__(self, position_x, position_y, telescope_id):
"""
:position_x: x position of the telescope in meter
:position_y: y position of the telescope in meter... | import pandas as pd
lst_mapping = pd.read_csv('telescope/lst.csv')
class Telescope(object):
"""The base Telescope class"""
def __init__(self, position_x, position_y, telescope_id):
"""
:position_x: x position of the telescope in meter
:position_y: y position of the telescope in meter... | mit | Python |
50163035d306e4cbd57937ec4f74d939b420f6b3 | move pd.DataFrame logic into separate fn | eltonlaw/impyute | impyute/util/preprocess.py | impyute/util/preprocess.py | """ impyute.util.preprocess """
from functools import wraps
# Hacky way to handle python2 not having `ModuleNotFoundError`
# pylint: disable=redefined-builtin, missing-docstring
try:
raise ModuleNotFoundError
except NameError:
class ModuleNotFoundError(Exception):
pass
except ModuleNotFoundError:
p... | """ impyute.util.preprocess """
from functools import wraps
# Hacky way to handle python2 not having `ModuleNotFoundError`
# pylint: disable=redefined-builtin, missing-docstring
try:
raise ModuleNotFoundError
except NameError:
class ModuleNotFoundError(Exception):
pass
except ModuleNotFoundError:
p... | mit | Python |
4299f4f410f768066aaacf885ff0a38e8af175c9 | Add custom form validation enforcing that each new book is unique | nirajkvinit/python3-study,nirajkvinit/python3-study,nirajkvinit/python3-study,nirajkvinit/python3-study | intro-django/readit/books/forms.py | intro-django/readit/books/forms.py | from django import forms
from .models import Book
class ReviewForm(forms.Form):
"""
Form for reviewing a book
"""
is_favourite = forms.BooleanField(
label = 'Favourite?',
help_text = 'In your top 100 books of all time?',
required = False,
)
review = forms.CharField(
widget = forms.Textarea,
min_lengt... | from django import forms
from .models import Book
class ReviewForm(forms.Form):
"""
Form for reviewing a book
"""
is_favourite = forms.BooleanField(
label = 'Favourite?',
help_text = 'In your top 100 books of all time?',
required = False,
)
review = forms.CharField(
widget = forms.Textarea,
min_lengt... | mit | Python |
7910c191d687148055878ec3cf4851efb6e064a4 | reduce bsize | minggli/fisheries-convnet,minggli/fisheries-convnet | app/settings.py | app/settings.py | # -*- coding: utf-8 -*-
MODEL_PATH = './trained_models/'
IMAGE_PATH = './data/'
IMAGE_SHAPE = (45, 80, 3)
# IMAGE_SHAPE = (720, 1280, 3)
BATCH_SIZE = 32
MAX_STEPS = 1500
ALPHA = 1e-3
| # -*- coding: utf-8 -*-
MODEL_PATH = './trained_models/'
IMAGE_PATH = './data/'
IMAGE_SHAPE = (45, 80, 3)
# IMAGE_SHAPE = (720, 1280, 3)
BATCH_SIZE = 128
MAX_STEPS = 1000
ALPHA = 1e-3
| mit | Python |
286c7d43707439373c5e5e2e021ee3c6d5f3bed3 | fix password change test by logging out before trying | anthraxx/arch-security-tracker,jelly/arch-security-tracker,jelly/arch-security-tracker,anthraxx/arch-security-tracker,archlinux/arch-security-tracker,archlinux/arch-security-tracker,anthraxx/arch-security-tracker | test/test_profile.py | test/test_profile.py | from flask import url_for
from flask_login import current_user
from .conftest import logged_in, assert_logged_in, assert_not_logged_in, DEFAULT_USERNAME
@logged_in
def test_change_password(db, client):
new_password = DEFAULT_USERNAME + '1'
resp = client.post(url_for('edit_own_user_profile'), follow_redirects... | from flask import url_for
from flask_login import current_user
from .conftest import logged_in, assert_logged_in, DEFAULT_USERNAME
@logged_in
def test_change_password(db, client):
new_password = DEFAULT_USERNAME + '1'
resp = client.post(url_for('edit_own_user_profile'), follow_redirects=True,
... | mit | Python |
c2f3e4b22783aaa34671d5779436cea4b21f3226 | fix redirect to episode page after posted shownote. | gmkou/FikaNote,sassy/FikaNote,sassy/FikaNote,gmkou/FikaNote,gmkou/FikaNote,sassy/FikaNote | app/shownote.py | app/shownote.py | #!/usr/bin/env python
#coding:utf-8
from django.http import Http404,HttpResponseRedirect
from app.models import FikanoteDB, AgendaDB, Shownote
from shownoteform import ShownoteForm
from agendaform import AgendaForm
from django.shortcuts import render
from app.views import episode
import datetime
def shownote(request)... | #!/usr/bin/env python
#coding:utf-8
from django.http import Http404,HttpResponseRedirect
from app.models import FikanoteDB, AgendaDB, Shownote
from shownoteform import ShownoteForm
from agendaform import AgendaForm
from django.shortcuts import render
import datetime
def shownote(request):
if request.method == 'GE... | mit | Python |
5afec1ecdd550eb28c0ec9a789fb215d9799563c | Fix init container delete command | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/scheduler/spawners/templates/init_containers.py | polyaxon/scheduler/spawners/templates/init_containers.py | class InitCommands(object):
COPY = 'copy'
CREATE = 'create'
DELETE = 'delete'
@classmethod
def is_copy(cls, command):
return command == cls.COPY
@classmethod
def is_create(cls, command):
return command == cls.CREATE
@classmethod
def is_delete(cls, command):
... | class InitCommands(object):
COPY = 'copy'
CREATE = 'create'
DELETE = 'delete'
@classmethod
def is_copy(cls, command):
return command == cls.COPY
@classmethod
def is_create(cls, command):
return command == cls.CREATE
@classmethod
def is_delete(cls, command):
... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.