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
45aa4c43416fa7dd16fda795da20ed2a770a6dea
Use patch_object instead of patch.object so stuff works with Mock 0.6
Bitergia/allura,apache/allura,leotrubach/sourceforge-allura,lym/allura-git,lym/allura-git,heiths/allura,lym/allura-git,apache/allura,heiths/allura,apache/allura,apache/allura,heiths/allura,lym/allura-git,Bitergia/allura,leotrubach/sourceforge-allura,apache/allura,apache/incubator-allura,lym/allura-git,apache/incubator-...
Allura/allura/tests/unit/patches.py
Allura/allura/tests/unit/patches.py
from mock import Mock, patch, patch_object from pylons import c from allura.tests.unit.factories import create_project, create_app_config def fake_app_patch(test_case): project = create_project('myproject') app_config = create_app_config(project, 'my_app') app = Mock() app.__version__ = '0' app.c...
from mock import Mock, patch from pylons import c from allura.tests.unit.factories import create_project, create_app_config def fake_app_patch(test_case): project = create_project('myproject') app_config = create_app_config(project, 'my_app') app = Mock() app.__version__ = '0' app.config = app_co...
apache-2.0
Python
3e0eb1dbd5779ae472bcc34f2536a23da495c12a
Move NA to left logic change
prathamtandon/g4gproblems
Arrays/merge_smaller_into_larger.py
Arrays/merge_smaller_into_larger.py
import unittest """ Given two sorted arrays, one of size n and one of size m+n containing only m elements, merge the smaller array into the larger array such that output is sorted. Note: NA means empty slot Input: larger => 2 NA 7 NA NA 10 NA smaller => 5 8 12 14 Output: 2 5 7 8 10 12 14 """ """ Approach: 1. M...
import unittest """ Given two sorted arrays, one of size n and one of size m+n containing only m elements, merge the smaller array into the larger array such that output is sorted. Note: NA means empty slot Input: larger => 2 NA 7 NA NA 10 NA smaller => 5 8 12 14 Output: 2 5 7 8 10 12 14 """ """ Approach: 1. M...
mit
Python
ccfde57629f556f3a1ddad4e8d078189cb139ab7
replace uses of casegroups/groups_by_domain
dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq
corehq/apps/casegroups/dbaccessors.py
corehq/apps/casegroups/dbaccessors.py
from corehq.apps.casegroups.models import CommCareCaseGroup from corehq.apps.domain.dbaccessors import ( get_doc_ids_in_domain_by_class, get_docs_in_domain_by_class, ) def get_case_groups_in_domain(domain, limit=None, skip=None): def _get_case_groups_generator(domain_name): for case_group in get_d...
from corehq.apps.casegroups.models import CommCareCaseGroup def get_case_groups_in_domain(domain, limit=None, skip=None): extra_kwargs = {} if limit is not None: extra_kwargs['limit'] = limit if skip is not None: extra_kwargs['skip'] = skip return CommCareCaseGroup.view( 'caseg...
bsd-3-clause
Python
8dccce77f6c08a7c20f38b9f1bacc27b71ab56a1
Change the output of <<macros>>
treemo/circuits,eriol/circuits,treemo/circuits,eriol/circuits,nizox/circuits,treemo/circuits,eriol/circuits
examples/web/wiki/macros/utils.py
examples/web/wiki/macros/utils.py
"""Utils macros Utility macros """ from inspect import getdoc def macros(macro, environ, *args, **kwargs): """Return a list of available macros""" macros = environ["macros"].items() s = "\n".join(["== %s ==\n%s\n" % (k, getdoc(v)) for k, v in macros]) return environ["parser"].generate(s, environ=en...
"""Utils macros Utility macros """ def macros(macro, environ, *args, **kwargs): """Return a list of available macros""" s = "\n".join(["* %s" % k for k in environ["macros"].keys()]) return environ["parser"].generate(s, environ=environ)
mit
Python
b218886f778450b5965ff087974b6d93bd2bd9e4
Add page/ on opps urls
williamroot/opps,jeanmask/opps,opps/opps,YACOWS/opps,williamroot/opps,williamroot/opps,YACOWS/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,opps/opps,YACOWS/opps,opps/opps,jeanmask/opps,YACOWS/opps,opps/opps
opps/urls.py
opps/urls.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.conf.urls import patterns, url, include from django.contrib import admin urlpatterns = patterns( '', url(r'^admin/', include(admin.site.urls)), url(r'^redactor/', include('redactor.urls')), url(r'^sitemap', include('opps.sitemaps.urls')), ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.conf.urls import patterns, url, include from django.contrib import admin urlpatterns = patterns( '', url(r'^admin/', include(admin.site.urls)), url(r'^redactor/', include('redactor.urls')), url(r'^sitemap', include('opps.sitemaps.urls')), ...
mit
Python
0d1b8ba5f0325a9870715ee5be697faedaebc44a
Fix a small docstring bug in the CSRF decorators.
adieu/django-nonrel,adieu/django-nonrel,adieu/django-nonrel
django/views/decorators/csrf.py
django/views/decorators/csrf.py
from django.middleware.csrf import CsrfViewMiddleware from django.utils.decorators import decorator_from_middleware, available_attrs try: from functools import wraps except ImportError: from django.utils.functional import wraps # Python 2.4 fallback. csrf_protect = decorator_from_middleware(CsrfViewMiddlewar...
from django.middleware.csrf import CsrfViewMiddleware from django.utils.decorators import decorator_from_middleware, available_attrs try: from functools import wraps except ImportError: from django.utils.functional import wraps # Python 2.4 fallback. csrf_protect = decorator_from_middleware(CsrfViewMiddlewar...
bsd-3-clause
Python
8d99e97af16f0541d1a465e511acc2469b60a97e
check if video candidate has a src attribute
cronycle/python-goose,cronycle/python-goose,jetruby/python-goose,tanzaho/python-goose,tanzaho/python-goose,jetruby/python-goose,tanzaho/python-goose,cronycle/python-goose,jetruby/python-goose
goose/videos/extractors.py
goose/videos/extractors.py
# -*- coding: utf-8 -*- """\ This is a python port of "Goose" orignialy licensed to Gravity.com under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Python port was written by Xavier Grangier for Recrutae Gravity.co...
# -*- coding: utf-8 -*- """\ This is a python port of "Goose" orignialy licensed to Gravity.com under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Python port was written by Xavier Grangier for Recrutae Gravity.co...
apache-2.0
Python
bbd50d8fb89b43a0b4e78e944b708763c2284f0d
add qdb webhook
x89/botologist,x89/botologist,moopie/botologist,anlutro/botologist
plugins/redditeu_qdb.py
plugins/redditeu_qdb.py
import ircbot.plugin import json import socket import urllib.error import urllib.parse import urllib.request BASE_URL = 'http://qdb.lutro.me' def _get_quote_url(quote): return BASE_URL + '/' + quote['id'] def _get_qdb_data(urllib): request = urllib.request.Request(url) request.add_header('Accept', 'application/j...
import ircbot.plugin import json import socket import urllib.error import urllib.parse import urllib.request BASE_URL = 'http://qdb.lutro.me' def _get_qdb_data(urllib): request = urllib.request.Request(url) request.add_header('Accept', 'application/json') response = urllib.request.urlopen(request, timeout=2) con...
mit
Python
56506e725c850f0e2dcdc53fc375bb05b8739672
Make graphs show up at http://<domain-name> instead
Sierangho/opentuner,lazyparser/opentuner,lazyparser/opentuner,Sierangho/opentuner,Sierangho/opentuner,jbosboom/opentuner,ucb-sejits/opentuner,Sierangho/opentuner,lazyparser/opentuner,lazyparser/opentuner,jbosboom/opentuner,jansel/opentuner,ucb-sejits/opentuner,jansel/opentuner,phrb/opentuner,phrb/opentuner
stats_app/stats_app/urls.py
stats_app/stats_app/urls.py
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin import views.charts admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'stats_app.views.home', name='home'), # url(r'^stats_app/', include('stats_a...
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin import views.charts admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'stats_app.views.home', name='home'), # url(r'^stats_app/', include('stats_a...
mit
Python
38833f68daabe845650250e3edf9cb4b3cc9cb62
Print date in fr_CA locale
mlhamel/agendadulibre,mlhamel/agendadulibre,vcorreze/agendaEteAccoord,mlhamel/agendadulibre,vcorreze/agendaEteAccoord,vcorreze/agendaEteAccoord
events/templatetags/humantime.py
events/templatetags/humantime.py
# -*- encoding:utf-8 -*- # Template tag from django.template.defaultfilters import stringfilter from datetime import datetime, timedelta from django import template import locale register = template.Library() @register.filter def event_time(start, end): today = datetime.today () result = "" # Hack! get t...
# -*- encoding:utf-8 -*- # Template tag from django.template.defaultfilters import stringfilter from datetime import datetime, timedelta from django import template register = template.Library() @register.filter def event_time(start, end): today = datetime.today () result = "" if start == today: ...
agpl-3.0
Python
16885e93e6d6d8f021c83ea3f941af62db8593e3
Bump version
divio/djangocms-installer,divio/djangocms-installer,divio/djangocms-installer,FinalAngel/djangocms-installer,frost-nzcr4/djangocms-installer,FinalAngel/djangocms-installer,FinalAngel/djangocms-installer,nephila/djangocms-installer,nephila/djangocms-installer,frost-nzcr4/djangocms-installer
djangocms_installer/__init__.py
djangocms_installer/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Iacopo Spalletti' __email__ = 'i.spalletti@nephila.it' __version__ = '0.6.0'
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Iacopo Spalletti' __email__ = 'i.spalletti@nephila.it' __version__ = '0.6.b1'
bsd-3-clause
Python
5706db42ce1d62ef19a12e28526069dcab94ea77
Return None on cancel click for video_mode_dialog
wheeler-microfluidics/microdrop
microdrop/video_mode_dialog.py
microdrop/video_mode_dialog.py
from pprint import pprint from gst_video_source_caps_query import GstVideoSourceManager from utility.pygtkhelpers_widgets import Enum, Form from utility.gui import field_entry_dialog from utility.gui.form_view_dialog import FormViewDialog def select_video_mode(video_modes): format_cap = lambda c: '[%s] ' % c['d...
from pprint import pprint from gst_video_source_caps_query import GstVideoSourceManager from utility.pygtkhelpers_widgets import Enum, Form from utility.gui import field_entry_dialog from utility.gui.form_view_dialog import FormViewDialog def select_video_mode(video_modes): format_cap = lambda c: '[%s] ' % c['d...
bsd-3-clause
Python
504dca187170dd0901f5b8132a02736efdfd10a1
set an order by for paginator warning
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
custom/icds/data_management/views.py
custom/icds/data_management/views.py
from django.contrib import messages from django.core.paginator import Paginator from django.http import JsonResponse from django.shortcuts import redirect from django.utils.decorators import method_decorator from django.utils.functional import cached_property from django.utils.translation import ugettext as _ from djan...
from django.contrib import messages from django.core.paginator import Paginator from django.http import JsonResponse from django.shortcuts import redirect from django.utils.decorators import method_decorator from django.utils.functional import cached_property from django.utils.translation import ugettext as _ from djan...
bsd-3-clause
Python
e715dd65d3adf74624bc2102afd6a6d8f8706da6
Initialize from argument or using a uniform distribution
nusnlp/corelm
dlm/models/components/linear.py
dlm/models/components/linear.py
import numpy import theano import theano.tensor as T class Linear(): def __init__(self, rng, input, n_in, n_out, W_values=None, b_values=None): self.input = input if W_values is None: W_values = numpy.asarray( rng.uniform( low = -0.01, #low=-numpy.sqrt(6. / (n_in + n_out)), high = 0.01, #high=...
import numpy import theano import theano.tensor as T class Linear(): def __init__(self, rng, input, n_in, n_out, W=None, b=None): self.input = input if W is None: W_values = numpy.asarray( rng.uniform( low = -0.01, #low=-numpy.sqrt(6. / (n_in + n_out)), high = 0.01, #high=numpy.sqrt(6. / (n_in...
mit
Python
aed905b12277754a570eab7cec118ef69b667af8
Bump version as instructed by bamboo.
pbs/django-robots,pbs/django-robots,pbs/django-robots
robots/__init__.py
robots/__init__.py
VERSION = (0, 8, 4, "pbs", 8) __version__ = '.'.join(map(str, VERSION))
VERSION = (0, 8, 4, "pbs", 7) __version__ = '.'.join(map(str, VERSION))
bsd-3-clause
Python
56795ae7b189e9b5c649b9af02ef733705cabee3
Fix bug where people were redirected through oauth because the test failed for a silly reason
WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight
TWLight/view_mixins.py
TWLight/view_mixins.py
""" Commonly needed custom view mixins. """ from braces.views import UserPassesTestMixin from django.contrib.auth.models import User from TWLight.users.groups import coordinators class CoordinatorsOrSelf(UserPassesTestMixin): """ Restricts visibility to: * Coordinators; or * The Editor who owns (or ...
""" Commonly needed custom view mixins. """ from braces.views import UserPassesTestMixin from TWLight.users.groups import coordinators class CoordinatorsOrSelf(UserPassesTestMixin): """ Restricts visibility to: * Coordinators; or * The Editor who owns the object in the view; or * Superusers. ...
mit
Python
00c1a2c111595e3d96758a8995102b1d5efb669b
fix config schema
PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature
contrib/gn_module_occhab/config/conf_schema_toml.py
contrib/gn_module_occhab/config/conf_schema_toml.py
""" Spécification du schéma toml des paramètres de configurations La classe doit impérativement s'appeller GnModuleSchemaConf Fichier spécifiant les types des paramètres et leurs valeurs par défaut Fichier à ne pas modifier. Paramètres surcouchables dans config/config_gn_module.tml """ from marshmallow imp...
""" Spécification du schéma toml des paramètres de configurations La classe doit impérativement s'appeller GnModuleSchemaConf Fichier spécifiant les types des paramètres et leurs valeurs par défaut Fichier à ne pas modifier. Paramètres surcouchables dans config/config_gn_module.tml """ from marshmallow imp...
bsd-2-clause
Python
6429a2a91996e5bf085269e67545cc3bea4e7361
Fix hub decoding for GPT-2 BPE with <mask> tokens
pytorch/fairseq,pytorch/fairseq,pytorch/fairseq
fairseq/data/encoders/gpt2_bpe.py
fairseq/data/encoders/gpt2_bpe.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq import file_utils from fairseq.data.encoders import register_bpe from .gpt2_bpe_utils import get_encoder DEFAULT_ENCODER_JSON ...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq import file_utils from fairseq.data.encoders import register_bpe from .gpt2_bpe_utils import get_encoder DEFAULT_ENCODER_JSON ...
mit
Python
62f465b31eba115acdc862a65239b5ed8dc9c09f
Update version number.
EducationalTestingService/rsmtool
rsmtool/version.py
rsmtool/version.py
""" This module exists solely for version information so we only have to change it in one place. Based on the suggestion `here. <http://bit.ly/16LbuJF>`_ """ __version__ = '7.1.0' VERSION = tuple(int(x) for x in __version__.split('.'))
""" This module exists solely for version information so we only have to change it in one place. Based on the suggestion `here. <http://bit.ly/16LbuJF>`_ """ __version__ = '7.0.0' VERSION = tuple(int(x) for x in __version__.split('.'))
apache-2.0
Python
236e43c2899ad95e35cde437809666518ab73348
undo previous code
dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq
corehq/apps/users/dbaccessors/all_commcare_users.py
corehq/apps/users/dbaccessors/all_commcare_users.py
from itertools import imap from django.conf import settings from corehq.apps.users.models import CommCareUser from dimagi.utils.couch.database import iter_docs, iter_bulk_delete def get_all_commcare_users_by_domain(domain): """Returns all CommCareUsers by domain regardless of their active status""" from coreh...
from itertools import imap from django.conf import settings from corehq.apps.users.models import CommCareUser from dimagi.utils.couch.database import iter_docs, iter_bulk_delete def get_all_commcare_users_by_domain(domain): """Returns all CommCareUsers by domain regardless of their active status""" from coreh...
bsd-3-clause
Python
b64ff2d264ecb9291a32924db9cd3a6339bb6259
print current rostime in driver_event.py
startcode/apollo,startcode/apollo,startcode/apollo,startcode/apollo,startcode/apollo,startcode/apollo
modules/tools/rosbag/drive_event.py
modules/tools/rosbag/drive_event.py
#!/usr/bin/env python ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy ...
#!/usr/bin/env python ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy ...
apache-2.0
Python
e0091310ffdb39127f7138966026445b0bac53fc
Return proper results for 'test=True'
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/states/rdp.py
salt/states/rdp.py
# -*- coding: utf-8 -*- ''' Manage RDP Service on Windows servers ''' def __virtual__(): ''' Load only if network_win is loaded ''' return 'rdp' if 'rdp.enable' in __salt__ else False def enabled(name): ''' Enable RDP the service on the server ''' ret = {'name': name, 'res...
# -*- coding: utf-8 -*- ''' Manage RDP Service on Windows servers ''' def __virtual__(): ''' Load only if network_win is loaded ''' return 'rdp' if 'rdp.enable' in __salt__ else False def enabled(name): ''' Enable RDP the service on the server ''' ret = {'name': name, 'res...
apache-2.0
Python
c869cb0ea522b402c2e23b51f0f247d4f8437266
fix for python3
krbeverx/Firmware,acfloria/Firmware,krbeverx/Firmware,PX4/Firmware,PX4/Firmware,dagar/Firmware,dagar/Firmware,krbeverx/Firmware,PX4/Firmware,PX4/Firmware,krbeverx/Firmware,krbeverx/Firmware,krbeverx/Firmware,dagar/Firmware,acfloria/Firmware,acfloria/Firmware,acfloria/Firmware,acfloria/Firmware,PX4/Firmware,PX4/Firmware...
Tools/validate_yaml.py
Tools/validate_yaml.py
#! /usr/bin/env python """ Script to validate YAML file(s) against a YAML schema file """ from __future__ import print_function import argparse import os import sys try: import yaml except: print("Failed to import yaml.") print("You may need to install it with 'sudo pip install pyyaml'") print("") ...
#! /usr/bin/env python """ Script to validate YAML file(s) against a YAML schema file """ from __future__ import print_function import argparse import os import sys try: import yaml except: print("Failed to import yaml.") print("You may need to install it with 'sudo pip install pyyaml'") print("") ...
bsd-3-clause
Python
963ccd3a5708f1fe26438bd2c903aaa1101f0168
Add progress indication to blob importer
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
corehq/blobs/management/commands/run_blob_import.py
corehq/blobs/management/commands/run_blob_import.py
import subprocess import tarfile from concurrent.futures import ThreadPoolExecutor from functools import partial from django.core.management import BaseCommand from corehq.blobs import get_blob_db from corehq.util.log import with_progress_bar USAGE = "Usage: ./manage.py run_blob_import <filename>" NUM_WORKERS = 5 ...
import tarfile from concurrent.futures import ThreadPoolExecutor from functools import partial from django.core.management import BaseCommand from corehq.blobs import get_blob_db USAGE = "Usage: ./manage.py run_blob_import <filename>" NUM_WORKERS = 5 class Command(BaseCommand): help = USAGE def add_argume...
bsd-3-clause
Python
a37f3a1523a65b3c18d1f175c0ae63a6984a9c8b
add wasu.cn but continued...
lcplj123/video-dl,lcplj123/video-get
extractors/wasu.py
extractors/wasu.py
#!/usr/bin/env python3 import re import sys import json sys.path.append('..') from define import * from utils import * from extractor import BasicExtractor from xml.dom.minidom import parseString class WasuExtractor(BasicExtractor): ''' 华数视频下载器 ''' def __init__(self,c): super(WasuExtractor,self).__init__(c, WASU...
#!/usr/bin/env python3
mit
Python
4d0b9fc2428c55b3170b775865cd8e9e43e0c579
Expand cudasim test_deadlock_on_exception test case.
stonebig/numba,gmarkall/numba,cpcloud/numba,jriehl/numba,stonebig/numba,gmarkall/numba,cpcloud/numba,sklam/numba,seibert/numba,stuartarchibald/numba,IntelLabs/numba,stuartarchibald/numba,cpcloud/numba,gmarkall/numba,numba/numba,IntelLabs/numba,sklam/numba,sklam/numba,jriehl/numba,numba/numba,IntelLabs/numba,stonebig/nu...
numba/cuda/tests/cudasim/test_cudasim_issues.py
numba/cuda/tests/cudasim/test_cudasim_issues.py
from __future__ import absolute_import, print_function, division import threading import numpy as np from numba import unittest_support as unittest from numba import cuda from numba.cuda.testing import SerialMixin import numba.cuda.simulator as simulator class TestCudaSimIssues(SerialMixin, unittest.TestCase): ...
from __future__ import absolute_import, print_function, division import threading import numpy as np from numba import unittest_support as unittest from numba import cuda from numba.cuda.testing import SerialMixin import numba.cuda.simulator as simulator class TestCudaSimIssues(SerialMixin, unittest.TestCase): ...
bsd-2-clause
Python
7422fe31f9a18021812e9dfc2a11ef91e4912304
Bump to 0.0.3
Brogency/drf-writable-nested,dynamomobile/drf-writable-nested
drf_writable_nested/__init__.py
drf_writable_nested/__init__.py
__title__ = 'DRF writable nested' __version__ = '0.0.3' __author__ = 'Bro.engineering' __license__ = 'BSD 2-Clause' __copyright__ = 'Copyright 2014-2017 Bro.engineering' # Version synonym VERSION = __version__ from .mixins import NestedUpdateMixin, NestedCreateMixin, SavePriorityMixin from .serializers import Writab...
__title__ = 'DRF writable nested' __version__ = '0.0.2' __author__ = 'Bro.engineering' __license__ = 'BSD 2-Clause' __copyright__ = 'Copyright 2014-2017 Bro.engineering' # Version synonym VERSION = __version__ from .mixins import NestedUpdateMixin, NestedCreateMixin, SavePriorityMixin from .serializers import Writab...
bsd-2-clause
Python
361531e232bcf484f7b0db52e57fb59e2bc8dab0
Implement create_room
Alweezy/alvin-mutisya-dojo-project
app/app.py
app/app.py
#!/usr/bin/env python """ This is the dojo Usage: dojo create_room (Living|Office) <room_name>... dojo add_person <first_name> <last_name> (Fellow|Staff) [<wants_space>] dojo print_allocations [--o=filename.txt] dojo print_unallocated [--o=filename.txt] dojo reallocate_person <employee_id> <new_roo...
mit
Python
de393578b92b9324cb19b5a3fa32a535753c0f34
Increase coverage
CulturePlex/pybossa,geotagx/pybossa,geotagx/pybossa,PyBossa/pybossa,OpenNewsLabs/pybossa,harihpr/tweetclickers,Scifabric/pybossa,proyectos-analizo-info/pybossa-analizo-info,CulturePlex/pybossa,stefanhahmann/pybossa,PyBossa/pybossa,CulturePlex/pybossa,harihpr/tweetclickers,proyectos-analizo-info/pybossa-analizo-info,int...
pybossa/auth/taskrun.py
pybossa/auth/taskrun.py
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2013 SF Isle of Man Limited # # PyBossa 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...
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2013 SF Isle of Man Limited # # PyBossa 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...
agpl-3.0
Python
9f0530eed91f02bac7d25ae925e79bacd6b2eddd
make test case instance more readable
OEP/pyprika
pyprika/tests/recipe.py
pyprika/tests/recipe.py
import pyprika import yaml from pyprika import Recipe, ParseError, Ingredient, loads, LoadError from .common import BaseTest class StaticTest(BaseTest): def test_empty(self): d = {} self.assertRaises(KeyError, Recipe.from_dict, d) self.assertRaises(LoadError, loads, yaml.dump(d)) def test_invalid_key(...
import pyprika import yaml from pyprika import Recipe, ParseError, Ingredient, loads, LoadError from .common import BaseTest class StaticTest(BaseTest): def test_empty(self): d = {} self.assertRaises(KeyError, Recipe.from_dict, d) self.assertRaises(LoadError, loads, yaml.dump(d)) def test_invalid_key(...
mit
Python
e44df5e4f2689bada7b9cf4c5e5d246a5a35569a
Bump version to 2.7.dev
pyQode/pyqode.json,pyQode/pyqode.json
pyqode/json/__init__.py
pyqode/json/__init__.py
""" Provides JSON support to pyQode. """ __version__ = '2.7.dev0'
""" Provides JSON support to pyQode. """ __version__ = '2.6.0'
mit
Python
e7fed51d59178986271f8f4a62b7ba387f7600b5
change enter/exit to enter_state/exit_state
Catstyle/pysm
pysm/models/__init__.py
pysm/models/__init__.py
try: string_type = basestring except NameError: string_type = str from pysm.errors import InvalidStateTransition class State(object): def enter_state(self, from_state): raise NotImplementedError def exit_state(self, to_state): raise NotImplementedError def __eq__(self, other): ...
try: string_type = basestring except NameError: string_type = str from pysm.errors import InvalidStateTransition class State(object): def enter(self, from_state): raise NotImplementedError def exit(self, to_state): raise NotImplementedError def __eq__(self, other): if i...
mit
Python
c2b1d43acc82e567196186e78c9d3a695068752f
adjust to scoped enum value names
tim-janik/rapicorn,tim-janik/rapicorn,tim-janik/rapicorn,tim-janik/rapicorn,tim-janik/rapicorn
pytests/testrapicorn.py
pytests/testrapicorn.py
# Licensed CC0 Public Domain: http://creativecommons.org/publicdomain/zero/1.0 """ Rapicorn test program for Python """ import Rapicorn import sys # issue test message print " " + __file__, # Define main window Widget Tree my_window_xml = """ <interfaces> <Window id="my-window"> <VBox> <Button hexpand="1...
# Licensed CC0 Public Domain: http://creativecommons.org/publicdomain/zero/1.0 """ Rapicorn test program for Python """ import Rapicorn import sys # issue test message print " " + __file__, # Define main window Widget Tree my_window_xml = """ <interfaces> <Window id="my-window"> <VBox> <Button hexpand="1...
mpl-2.0
Python
e01ed6e6386d3e52642b7b62bd675291eadbb633
Fix to GPIO
REXUS-PIOneERS/Python-PIOneERS
python/Pi_1/__init__.py
python/Pi_1/__init__.py
""" The main thread for Pi_1 of the REXUS PIOneERS project, controlling most of the logic operations for the entire experiment. """ #Imports for the raspbeery pi import RPi.GPIO as GPIO #Imports for the program import time #Imports of local files and classes from REXUS import REXUS import IMU_1 #Setup all the pins on ...
""" The main thread for Pi_1 of the REXUS PIOneERS project, controlling most of the logic operations for the entire experiment. """ #Imports for the raspbeery pi import RPi.GPIO as GPIO #Imports for the program import time #Imports of local files and classes from REXUS import REXUS import IMU_1 #Setup all the pins on ...
mit
Python
8da2a3209c8a64e58c5cbbbdd2040c37e6e22673
add python io getters, mean helper, and image caffeinator/decaffeinator
nicodjimenez/caffe,yikeliu/caffe-future,shiquanwang/caffe,dculibrk/boosted_pooling,orentadmor/caffe,suixudongi8/caffe,vibhav-vineet/caffe,liuxianming/caffe_feedback,flickr/caffe,sichenucsd/caffe_si,xidianwlc/caffe,yikeliu/caffe-future,minghuam/caffe,nicodjimenez/caffe,liuxianming/caffe_feedback,liuxianming/caffe_feedba...
python/caffe/pycaffe.py
python/caffe/pycaffe.py
""" Wrap the internal caffe C++ module (_caffe.so) with a clean, Pythonic interface. """ from collections import OrderedDict import numpy as np from ._caffe import Net, SGDSolver # we directly update methods from Net here (rather than using composition or # inheritance) so that nets created by caffe (e.g., by SGDSol...
""" Wrap the internal caffe C++ module (_caffe.so) with a clean, Pythonic interface. """ from collections import OrderedDict import numpy as np from ._caffe import Net, SGDSolver # we directly update methods from Net here (rather than using composition or # inheritance) so that nets created by caffe (e.g., by SGDSol...
bsd-2-clause
Python
1a674e2f16b375007659eec0084dd96572a775b8
Update getrank.py
smallyear/linuxLearn,smallyear/linuxLearn,smallyear/linuxLearn,smallyear/linuxLearn
python/mongo/getrank.py
python/mongo/getrank.py
# -*- coding: utf-8 -*- import sys from pymongo import MongoClient def get_rank(user_id): client = MongoClient('127.0.0.1',27017) db = client.shiyanlou contests = db.contests res = {} list = contests.aggregate( [{"$group" : {"_id" : "$user_id", "score" : {"$sum" : "$score"}, "submit_time" : {"$s...
# -*- coding:utf-8 -*_ import sys from pymongo import MongoClient def get_rank(user_id): client = MongoClient('127.0.0.1',27017) db = client.shiyanlou contests = db.contests res = {} list = contests.aggregate( [{"$group" : {"_id" : "$user_id", "score" : {"$sum" : "$score"}, "submit_time" : {"$su...
apache-2.0
Python
c5b14e845b6549e5d8deaf1196eaf82a378b1445
remove python3 incompatible fix
honzajavorek/python.cz,honzajavorek/python.cz,honzajavorek/python.cz,honzajavorek/python.cz
pythoncz/models/jobs.py
pythoncz/models/jobs.py
# -*- coding: utf-8 -*- import os import json import yaml import czech_sort from .. import app __all__ = ('data',) def _group_business_data(data): groups = {} for point in data: if point.get('company'): name = 'companies' else: name = 'individuals' group...
# -*- coding: utf-8 -*- import os import json import yaml import czech_sort from .. import app __all__ = ('data',) def _group_business_data(data): groups = {} for point in data: if point.get('company'): name = 'companies' else: name = 'individuals' group...
mit
Python
9625b63577ebae6f44ac23ada44e8b4abce2de9d
update intent handling; should fix issues with multiple intent sets at a time
pannal/Subliminal.bundle,pannal/Subliminal.bundle,pannal/Subliminal.bundle
Contents/Libraries/Shared/subzero/intent.py
Contents/Libraries/Shared/subzero/intent.py
# coding=utf-8 import datetime class TempIntent(dict): timeout = 1000 # milliseconds store = None def __init__(self, timeout=1000): self.timeout = timeout self.store = {} def __getattr__(self, name): if name in self: return self[name] def __setattr__(self, name, va...
# coding=utf-8 import datetime class TempIntent(dict): timeout = 1000 # milliseconds store = None def __init__(self, timeout=1000): self.timeout = timeout self.store = {} def __getattr__(self, name): if name in self: return self[name] def __setattr__(self, name, va...
mit
Python
663e9c0c4858f1175a0c7494cadea28df575044b
Mark verbose name for translation, too.
pigletto/django-postal,mthornhill/django-postal,mthornhill/django-postal,pigletto/django-postal
src/postal/models.py
src/postal/models.py
""" Model of Postal Address, could possibly use some ideas from http://www.djangosnippets.org/snippets/912/ in the future """ # django imports from django.db import models from django.utils.translation import ugettext_lazy as _ # other imports from django_countries import CountryField class PostalAddress(models.Model...
""" Model of Postal Address, could possibly use some ideas from http://www.djangosnippets.org/snippets/912/ in the future """ # django imports from django.db import models from django.utils.translation import ugettext_lazy as _ # other imports from django_countries import CountryField class PostalAddress(models.Model...
mit
Python
8fb1664364a7723d53e9e612c314a22cf67e3320
Prepare 0.3.9
silentsokolov/django-admin-rangefilter,silentsokolov/django-admin-rangefilter,silentsokolov/django-admin-rangefilter
rangefilter/__init__.py
rangefilter/__init__.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals __author__ = 'Dmitriy Sokolov' __version__ = '0.3.9' default_app_config = 'rangefilter.apps.RangeFilterConfig' VERSION = __version__
# -*- coding: utf-8 -*- from __future__ import unicode_literals __author__ = 'Dmitriy Sokolov' __version__ = '0.3.8' default_app_config = 'rangefilter.apps.RangeFilterConfig' VERSION = __version__
mit
Python
34a4819f73419e966406fc229aeead749165ed5a
improve docstrings
ptosco/rdkit,rvianello/rdkit,greglandrum/rdkit,soerendip42/rdkit,AlexanderSavelyev/rdkit,greglandrum/rdkit,bp-kelley/rdkit,bp-kelley/rdkit,adalke/rdkit,strets123/rdkit,bp-kelley/rdkit,rdkit/rdkit,rvianello/rdkit,AlexanderSavelyev/rdkit,greglandrum/rdkit,rvianello/rdkit,jandom/rdkit,strets123/rdkit,rvianello/rdkit,adalk...
rdkit/Chem/Fragments.py
rdkit/Chem/Fragments.py
# $Id$ # # Copyright (C) 2002-2010 greg Landrum and Rational Discovery LLC # # @@ All Rights Reserved @@ # """ functions to match a bunch of fragment descriptors from a file No user-servicable parts inside. ;-) """ import os from rdkit import RDConfig from rdkit import Chem defaultPatternFileName = os.path.join...
# $Id$ # # Copyright (C) 2002-2006 greg Landrum and Rational Discovery LLC # # @@ All Rights Reserved @@ # """ functions to match a bunch of fragment descriptors from a file No user-servicable parts inside. ;-) """ import os from rdkit import RDConfig from rdkit import Chem defaultPatternFileName = os.path.join...
bsd-3-clause
Python
abc8bf51d38257b17c989665dcab9a9e01d5d03c
Replace uses of jax.partial with functools.partial, in preparation for removing jax.partial.
HopkinsIDD/EpiForecastStatMech,HopkinsIDD/EpiForecastStatMech
epi_forecast_stat_mech/utils.py
epi_forecast_stat_mech/utils.py
# Lint as: python3 """Functions for manipulating nested structures of arrays.""" import functools from typing import Any, Union import jax import jax.numpy as jnp def slice_along_axis( inputs: Any, axis: int, idx: Union[slice, int] ): """Returns slice of `inputs` defined by `idx` along axis `axis`. ...
# Lint as: python3 """Functions for manipulating nested structures of arrays.""" from typing import Any, Union import jax import jax.numpy as jnp def slice_along_axis( inputs: Any, axis: int, idx: Union[slice, int] ): """Returns slice of `inputs` defined by `idx` along axis `axis`. Args: inputs:...
apache-2.0
Python
1a3c251abe2e8ebf3020a21a3449abae6b04c2b1
Fix test_show test to support tuned systems
vstinner/pyperf,haypo/perf
perf/tests/test_system.py
perf/tests/test_system.py
import os.path import sys from perf.tests import get_output from perf.tests import unittest class SystemTests(unittest.TestCase): def test_show(self): args = [sys.executable, '-m', 'perf', 'system', 'show'] proc = get_output(args) regex = ('(Run "%s -m perf system tune" to tune the syste...
import os.path import sys from perf.tests import get_output from perf.tests import unittest class SystemTests(unittest.TestCase): def test_show(self): args = [sys.executable, '-m', 'perf', 'system', 'show'] proc = get_output(args) regex = ('(Run "%s -m perf system tune" to tune the syste...
mit
Python
adb262f31bd0cfd92deea823b21cc562067f2c67
update detecting
jeremywrnr/mewsichip,jeremywrnr/mewsichip,jeremywrnr/mewsichip
detecting.py
detecting.py
from time import sleep import os import signal import subprocess from subprocess import PIPE import CHIP_IO.GPIO as GPIO import datetime from time import sleep GPIO.cleanup() GPIO.setup("XIO-P0", GPIO.IN) GPIO.add_event_detect("XIO-P0", GPIO.RISING) is_playing = False global musicprocess while True: if GPIO.event...
from time import sleep import os import signal import subprocess from subprocess import PIPE import CHIP_IO.GPIO as GPIO import datetime from time import sleep GPIO.cleanup() GPIO.setup("XIO-P0", GPIO.IN) GPIO.add_event_detect("XIO-P0", GPIO.RISING) is_playing = False global musicprocess while True: if GPIO.event...
mit
Python
dc562a5dfc5056ab6009faf1dd67aff742eb0fc3
reduce logging
sahlinet/fastapp,sahlinet/fastapp,sahlinet/fastapp,sahlinet/fastapp
fastapp/routers.py
fastapp/routers.py
from swampdragon import route_handler from swampdragon.route_handler import BaseModelPublisherRouter from serializers import TransactionSerializer, ApySocketSerializer, LogEntrySerializer from models import Transaction, LogEntry from swampdragon.permissions import login_required import logging logger = logging.getLog...
from swampdragon import route_handler from swampdragon.route_handler import BaseModelPublisherRouter from serializers import TransactionSerializer, ApySocketSerializer, LogEntrySerializer from models import Transaction, LogEntry from swampdragon.permissions import login_required import logging logger = logging.getLog...
mit
Python
fd60b1451df390b460fd775fab29714625be63d4
add dropdatabase function; use sqlalchemy utils
fedspendingtransparency/data-act-broker-backend,fedspendingtransparency/data-act-core,chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend,chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend,fedspendingtransparency/data-act-broker-backend,fedspendingtransparency/data-act-core
dataactcore/scripts/databaseSetup.py
dataactcore/scripts/databaseSetup.py
import sqlalchemy_utils from dataactcore.config import CONFIG_DB def createDatabase(dbName): """Create specified database if it doesn't exist.""" config = CONFIG_DB connectString = "postgresql://{}:{}@{}:{}/{}".format(config["username"], config["password"], config["host"], config["port"], d...
import sqlalchemy from sqlalchemy.exc import OperationalError from sqlalchemy.schema import CreateSchema from sqlalchemy.exc import ProgrammingError from dataactcore.config import CONFIG_DB def createDatabase(dbName): """Create specified database if it doesn't exist.""" connectString = "postgresql://{}:{}@{}:...
cc0-1.0
Python
01aa9e2c6c1cf2c0ebf8c954639006e3e3d88a36
Add inverse ohlc ratio by instrument
bernoullio/toolbox
forex_toolbox/utils/instrument.py
forex_toolbox/utils/instrument.py
import os import json inverse_ohlc_ratio = None sym_sid_map = None sid_sym_map = None sid_name_map = None ohlc_ratio = None inverse_ohlc_ratio = None inverse_ohlc_ratio_instrument = None def sid(symbol): """ Returns the arbitrary id assigned to the instrument symbol. See broker/oanda_instruments...
import os import json inverse_ohlc_ratio = None sym_sid_map = None sid_sym_map = None sid_name_map = None ohlc_ratio = None inverse_ohlc_ratio = None def sid(symbol): """ Returns the arbitrary id assigned to the instrument symbol. See broker/oanda_instruments.json Return ------ ...
mit
Python
610ddc6a6830e8a985bb8e89e9d1daa20dec15ed
FIX ordered list of vans (closes issue #2)
telefonicaid/fiware-livedemoapp,telefonicaid/fiware-livedemoapp,telefonicaid/fiware-livedemoapp,telefonicaid/fiware-livedemoapp
scripts/get-van.py
scripts/get-van.py
#!/usr/bin/python # -*- coding: latin-1 -*- # Copyright 2013 Telefonica Investigacin y Desarrollo, S.A.U # # This file is part of FI-WARE LiveDemo App # # FI-WARE LiveDemo App 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 S...
#!/usr/bin/python # -*- coding: latin-1 -*- # Copyright 2013 Telefonica Investigacin y Desarrollo, S.A.U # # This file is part of FI-WARE LiveDemo App # # FI-WARE LiveDemo App 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 S...
agpl-3.0
Python
5e71294a45c99bb0273e05819b217e8cf5d4b652
Move json into requests call... again
StoDevX/BonApp-Widget,drewvolz/BonApp-Widget,drewvolz/BonApp-Widget,StoDevX/BonApp-Widget
scripts/getData.py
scripts/getData.py
#!/usr/bin/env python3 import string, os, time, json, re, unicodedata, html.parser, requests # Bon appetit cafe hours api url url = "http://legacy.cafebonappetit.com/api/2/cafes" # How many cafeterias you want to parse (in order) totalCafes = 10 # What our file should be named fileName = "data.json" # Our constructe...
#!/usr/bin/env python3 import string, os, time, json, re, unicodedata, html.parser, requests # Bon appetit cafe hours api url url = "http://legacy.cafebonappetit.com/api/2/cafes" # How many cafeterias you want to parse (in order) totalCafes = 10 # What our file should be named fileName = "data.json" # Our constructe...
mit
Python
0ac578a204db519999e0a2f4f88b8ac74e5f6e22
test string const, equality
IntelLabs/hpat,IntelLabs/hpat,IntelLabs/hpat,IntelLabs/hpat
hpat/tests/test_strings.py
hpat/tests/test_strings.py
import unittest import hpat class TestString(unittest.TestCase): def test_pass_return(self): def test_impl(_str): return _str hpat_func = hpat.jit(test_impl) # pass single string and return arg = 'test_str' self.assertEqual(hpat_func(arg), test_impl(arg)) ...
import unittest import hpat class TestString(unittest.TestCase): def test_pass_return(self): def test_impl(_str): return _str hpat_func = hpat.jit(test_impl) # pass single string and return arg = 'test_str' self.assertEqual(hpat_func(arg), test_impl(arg)) ...
bsd-2-clause
Python
ebb760b5778e48f4688bd4bd27ede9653787e52c
Update pidriver.py
shyampurk/PubNub-RaspberryPi-RemoteControl,shyampurk/PubNub-RaspberryPi-RemoteControl
driver/pidriver.py
driver/pidriver.py
from pubnub import Pubnub import json,time try: import RPi.GPIO as GPIO except RuntimeError: print "Error importing RPi.GPIO! This is probably because you need superuser privileges. You can achieve this by using 'sudo' to run your script" #Setup GPIO GPIO.setmode(GPIO.BOARD) #Setup PubNub pubnub = Pubnub...
from Pubnub import Pubnub import json,time try: import RPi.GPIO as GPIO except RuntimeError: print "Error importing RPi.GPIO! This is probably because you need superuser privileges. You can achieve this by using 'sudo' to run your script" #Setup GPIO GPIO.setmode(GPIO.BOARD) #Setup PubNub pubnub = Pubnub...
mpl-2.0
Python
141eb2a647490142adf017d3a755d03ab89ed687
Update `Tag` exporter code documentation.
maebert/jrnl,notbalanced/jrnl,philipsd6/jrnl,MinchinWeb/jrnl
jrnl/plugins/tag_exporter.py
jrnl/plugins/tag_exporter.py
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, unicode_literals from .text_exporter import TextExporter from .util import get_tags_count class TagExporter(TextExporter): """This Exporter can lists the tags for entries and journals, exported as a plain text file.""" names = ["...
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, unicode_literals from .text_exporter import TextExporter from .util import get_tags_count class TagExporter(TextExporter): """This Exporter can convert entries and journals into json.""" names = ["tags"] extension = "tags" ...
mit
Python
09a8bf044c30f450bc232ee15994e507d5a05c5a
set main to construct specification
Nekroze/drydock,Nekroze/drydock
drydock/drydock.py
drydock/drydock.py
""" DryDock can automatically provision a cluster of docker containers based on a simple configuration file. """ from __future__ import print_function import yaml import os import sys from .construction import construct from .duster import MetaContainer def main(): try: with open('drydock.yaml') as drydoc...
""" DryDock can automatically provision a cluster of docker containers based on a simple configuration file. """ from __future__ import print_function import yaml import os import sys from .construction import construct from .duster import MetaContainer def main(): try: with open('drydock.yaml') as drydoc...
mit
Python
646be83f769187182654ddc6c90aa3640022cfde
correct documentation typo
fedora-conary/conary-policy
policy/nonpackagefiles.py
policy/nonpackagefiles.py
# # Copyright (c) 2004-2006 rPath, Inc. # # This program is distributed under the terms of the Common Public License, # version 1.0. A copy of this license should have been distributed with this # source file in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.org/...
# # Copyright (c) 2004-2006 rPath, Inc. # # This program is distributed under the terms of the Common Public License, # version 1.0. A copy of this license should have been distributed with this # source file in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.org/...
apache-2.0
Python
66c48ce23a37ad0634578f353078437c91562a20
Define transaction model
n2o/FineAnts,n2o/FineAnts
fineants/models.py
fineants/models.py
# -*- coding: utf-8 -*- from datetime import datetime from django.contrib.auth.models import User from django.db import models class Transaction(models.Model): title = models.CharField("Title", max_length=255, blank=False) creditor = models.ForeignKey(User, verbose_name="Creditor", related_name="Creditor") ...
from django.db import models # Create your models here.
mit
Python
1f5da3ffef8b2d6dde329e9826106db01bad706b
fix CLI docs
efiop/dvc,dmpetrov/dataversioncontrol,dmpetrov/dataversioncontrol,efiop/dvc
dvc/command/get.py
dvc/command/get.py
from __future__ import unicode_literals import argparse import logging from .base import append_doc_link from .base import CmdBaseNoRepo from dvc.exceptions import DvcException logger = logging.getLogger(__name__) class CmdGet(CmdBaseNoRepo): def run(self): from dvc.repo import Repo try: ...
from __future__ import unicode_literals import argparse import logging from .base import append_doc_link from .base import CmdBaseNoRepo from dvc.exceptions import DvcException logger = logging.getLogger(__name__) class CmdGet(CmdBaseNoRepo): def run(self): from dvc.repo import Repo try: ...
apache-2.0
Python
d4a1ae11aeb09ba38d9653e80fba2ad80163e694
Clean up
codefisher/djangopress,codefisher/djangopress,codefisher/djangopress,codefisher/djangopress
djangopress/forum/management/commands/check_spam.py
djangopress/forum/management/commands/check_spam.py
from django.core.management.base import BaseCommand from djangopress.forum.models import Thread, Post, Forum import time import akismet from django.conf import settings class Command(BaseCommand): help = 'Check if any posts are spam and marks them as such' def handle(self, *args, **options): try: ...
from django.core.management.base import BaseCommand from djangopress.forum.models import Thread, Post, Forum import time import akismet from django.conf import settings from django.utils.encoding import force_str class Command(BaseCommand): help = 'Check if any posts are spam and marks them as such' def hand...
mit
Python
e0502e4ba6b706a24bbbae42b2c897a2c72ad484
Handle namespaces
scrapinghub/extruct
extruct/opengraph.py
extruct/opengraph.py
import re import lxml.html _PREFIX_PATTERN = re.compile(r'\s*(\w+): ([^\s]+)') _OG_NAMESPACES = { ('og', 'http://ogp.me/ns#'), ('music', 'http://ogp.me/ns/music#'), ('video', 'http://ogp.me/ns/video#'), ('article', 'http://ogp.me/ns/article#'), ('book', 'http://ogp.me/ns/book#'), ('profile', '...
import re import lxml.html _PREFIX_PATTERN = re.compile(r'\s*(\w+): ([^\s]+)') _OG_NAMESPACES = { ('og', 'http://ogp.me/ns#'), ('music', 'http://ogp.me/ns/music#'), ('video', 'http://ogp.me/ns/video#'), ('article', 'http://ogp.me/ns/article#'), ('book', 'http://ogp.me/ns/book#'), ('profile', '...
bsd-3-clause
Python
9dbe6eb31da419a5ec60b7fd0bf8a80a7fb0ad78
test code coverage progress
ClearCorp/knowledge,ClearCorp/knowledge,ClearCorp/knowledge,ClearCorp/knowledge
document_page/tests/test_document_page_show_diff.py
document_page/tests/test_document_page_show_diff.py
# -*- coding: utf-8 -*- from openerp.tests import common from openerp import _ class TestDocumentPageShowDiff(common.TransactionCase): """document_page_show_diff test class.""" def test_show_demo_page1_diff(self): """Show test page history difference.""" page = self.env.ref('document_page.de...
# -*- coding: utf-8 -*- from openerp.tests import common from openerp import _ class TestDocumentPageShowDiff(common.TransactionCase): """document_page_show_diff test class.""" def test_show_demo_page1_diff(self): """Show test page history difference.""" page = self.env.ref('document_page.de...
agpl-3.0
Python
8e125a3435930fe6860cb513f4dc08ab8d43dd58
Update GameOfWar.py
hectorpefo/hectorpefo.github.io,hectorpefo/hectorpefo.github.io,hectorpefo/hectorpefo.github.io,hectorpefo/hectorpefo.github.io
_includes/GameOfWar.py
_includes/GameOfWar.py
from random import shuffle Reps = 1000000 Accum = 0 CardsDown = 1 def NextRound(): global Me,You,Result,CardsDown Pot = [] Done = False while not Done: MyCard = Me.pop() YourCard = You.pop() Pot.extend([MyCard,YourCard]) shuffle(Pot) if MyCard < YourCard: Me = Pot + Me Done = True if len(You) =...
from random import shuffle Reps = 10000000 Accum = 0 def NextRound(): global Me,You,Result Pot = [] Done = False while not Done: MyCard = Me.pop() YourCard = You.pop() Pot.extend([MyCard,YourCard]) shuffle(Pot) if MyCard < YourCard: Me = Pot + Me Done = True if len(You) == 0: Result = 1 ...
mit
Python
093c9065de9e0e08f248bbb84696bf30309bd536
Fix parallel example for Python 3
dbrattli/RxPY,ReactiveX/RxPY,ReactiveX/RxPY
examples/parallel/timer.py
examples/parallel/timer.py
from __future__ import print_function import rx import concurrent.futures import time seconds = [5, 1, 2, 4, 3] def sleep(t): time.sleep(t) return t def output(result): print('%d seconds' % result) with concurrent.futures.ProcessPoolExecutor(5) as executor: rx.Observable.from_(seconds).flat_map( ...
import rx import concurrent.futures import time seconds = [5, 1, 2, 4, 3] def sleep(t): time.sleep(t) return t def output(result): print '%d seconds' % result with concurrent.futures.ProcessPoolExecutor(5) as executor: rx.Observable.from_(seconds).flat_map( lambda s: executor.submit(sleep,...
mit
Python
79db604954d2bffc5eeb0956592179de2901dd0f
Fix #410 (#412)
jazzband/django-constance,jezdez/django-constance,jazzband/django-constance,jezdez/django-constance,jazzband/django-constance
constance/checks.py
constance/checks.py
from django.core import checks from django.utils.translation import ugettext_lazy as _ @checks.register("constance") def check_fieldsets(*args, **kwargs): """ A Django system check to make sure that, if defined, CONFIG_FIELDSETS accounts for every entry in settings.CONFIG. """ from . import setti...
from django.core import checks from django.utils.translation import ugettext_lazy as _ from . import settings @checks.register("constance") def check_fieldsets(*args, **kwargs): """ A Django system check to make sure that, if defined, CONFIG_FIELDSETS accounts for every entry in settings.CONFIG. """ ...
bsd-3-clause
Python
1d4ce68d2fe7b45a58fa5f534ba1265e90015784
Update paver bok_choy (test) commands to reflect new default vars.
SivilTaram/edx-platform,motion2015/edx-platform,zadgroup/edx-platform,Edraak/circleci-edx-platform,marcore/edx-platform,gsehub/edx-platform,louyihua/edx-platform,longmen21/edx-platform,xuxiao19910803/edx,Kalyzee/edx-platform,cpennington/edx-platform,rue89-tech/edx-platform,Softmotions/edx-platform,wwj718/edx-platform,a...
pavelib/paver_tests/test_paver_bok_choy_cmds.py
pavelib/paver_tests/test_paver_bok_choy_cmds.py
import os import unittest from pavelib.utils.test.suites.bokchoy_suite import BokChoyTestSuite REPO_DIR = os.getcwd() class TestPaverBokChoy(unittest.TestCase): def setUp(self): self.request = BokChoyTestSuite('') def _expected_command(self, expected_text_append): if expected_text_append: ...
import os import unittest from pavelib.utils.test.suites.bokchoy_suite import BokChoyTestSuite REPO_DIR = os.getcwd() class TestPaverBokChoy(unittest.TestCase): def setUp(self): self.request = BokChoyTestSuite('') def _expected_command(self, expected_text_append): if expected_text_append: ...
agpl-3.0
Python
825d9567fbc9ce36a40b89b1efe329aa5a622ee1
Remove unnecessary method
jaap3/django-formative,jaap3/django-formative,jaap3/django-formative
formative/views.py
formative/views.py
from __future__ import unicode_literals from django.contrib.admin.helpers import InlineAdminForm from django.views.generic import TemplateView from formative.utils import add_field_to_fieldsets class InlineFormView(TemplateView): template_name = 'formative/admin/render_fieldsets.html' model = None def ge...
from __future__ import unicode_literals from django.contrib.admin.helpers import InlineAdminForm from django.utils.functional import cached_property from django.views.generic import TemplateView from formative.utils import add_field_to_fieldsets class InlineFormView(TemplateView): template_name = 'formative/admin...
mit
Python
8c00e75e9ec8875e909f7c539b3c72c54929eaac
add unpacking and egg installation
jwiggins/keyenst,jwiggins/keyenst
egginst/patcher.py
egginst/patcher.py
import sys import tarfile import tempfile from os.path import abspath, exists, join from main import EggInst import scripts import object_code if sys.platform == 'darwin': scripts.executable = '../MacOS/python' prefix = abspath(sys.prefix) tmp_dir = tempfile.mkdtemp() # Monkey patch egginst.object_code.alt_re...
import sys from os.path import abspath, basename, exists, join from main import EggInst import scripts import object_code if sys.platform == 'darwin': scripts.executable = '../MacOS/python' prefix = abspath(sys.prefix) # Monkey patch egginst.object_code.alt_replace_func, which is an # optional function, which ...
bsd-3-clause
Python
9c66570a4ffebcb3cbe781b044274032e32a92fe
update test_eval
Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python
misc/test_eval.py
misc/test_eval.py
# -*- coding: utf-8 -*- # eval def main(): dictString = "{'Define1':[[63.3,0.00,0.5,0.3,0.0],[269.3,0.034,1.0,1.0,0.5]," \ "[332.2,0.933,0.2,0.99920654296875,1],[935.0,0.990,0.2,0.1,1.0]]," \ "'Define2':[[63.3,0.00,0.5,0.2,1.0],[269.3,0.034,1.0,0.3,0.5]," \ "[332....
# eval def main(): dictString = "{'Define1':[[63.3,0.00,0.5,0.3,0.0],[269.3,0.034,1.0,1.0,0.5]," \ "[332.2,0.933,0.2,0.99920654296875,1],[935.0,0.990,0.2,0.1,1.0]]," \ "'Define2':[[63.3,0.00,0.5,0.2,1.0],[269.3,0.034,1.0,0.3,0.5]," \ "[332.2,0.933,0.2, 0.4,0.6],[9...
mit
Python
55a939a4acca0c19108047971483d62f9033a88d
Make autoformat tool work with relative paths outside of checkout.
kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka
nuitka/tools/autoformat/__main__.py
nuitka/tools/autoformat/__main__.py
#!/usr/bin/env python # Copyright 2017, Kay Hayen, mailto:kay.hayen@gmail.com # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this fi...
#!/usr/bin/env python # Copyright 2017, Kay Hayen, mailto:kay.hayen@gmail.com # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this fi...
apache-2.0
Python
6ab05cdd0f46d65e51f00a4528872ff4cc5ea987
remove unnecessary bytearray conversion from download_dashboard_pdf.py
looker-open-source/sdk-examples,looker-open-source/sdk-examples,looker/sdk-examples,looker/sdk-examples,looker-open-source/sdk-examples,looker-open-source/sdk-examples,looker/sdk-examples,looker-open-source/sdk-examples,looker-open-source/sdk-examples,looker/sdk-examples,looker/sdk-examples,looker/sdk-examples
python/download_dashboard_pdf.py
python/download_dashboard_pdf.py
import sys import time from looker_sdk import client, models sdk = client.setup("../looker.ini") def main(): dashboard_title = sys.argv[1] if len(sys.argv) > 1 else "" pdf_style = sys.argv[2] if len(sys.argv) > 2 else "tiled" pdf_width = int(sys.argv[3]) if len(sys.argv) > 3 else 545 pdf_height = in...
import sys import time from looker_sdk import client, models sdk = client.setup("../looker.ini") def main(): dashboard_title = sys.argv[1] if len(sys.argv) > 1 else "" pdf_style = sys.argv[2] if len(sys.argv) > 2 else "tiled" pdf_width = int(sys.argv[3]) if len(sys.argv) > 3 else 545 pdf_height = in...
mit
Python
62af32fa4031056d30a49cdec9d383efa4e08017
Build detection works now, and has better error messages.
datawire/mdk,datawire/mdk,datawire/mdk,datawire/mdk
scripts/release.py
scripts/release.py
""" Release the MDK. The process: 0. Ensure current checkout is not dirty (i.e. everything is committed). 1. Ensure current commit has passing tests by talking to Travis API. 2. Bump versions on all relevant files. (TODO: once we only have `master` branch and no more `develop` will add more steps: 3. Git commit. 4....
""" Release the MDK. The process: 0. Ensure current checkout is not dirty (i.e. everything is committed). 1. Ensure current commit has passing tests by talking to Travis API. 2. Bump versions on all relevant files. (TODO: once we only have `master` branch and no more `develop` will add more steps: 3. Git commit. 4....
apache-2.0
Python
36f8c7c1d3cc0caeb95b0e4b098fa3cc43f88903
fix typo in alex.py, return statement
chrissorchard/malucrawl,graingert/reportificate,chrissorchard/malucrawl,graingert/reportificate
malware_crawl/scan/alexa.py
malware_crawl/scan/alexa.py
from __future__ import division import requests import zipfile import cStringIO as StringIO import csv import redis from urlparse import urlparse from publicsuffix import PublicSuffixList from django.conf import settings redis_urls = dict( { "slave": "redis://localhost:6379/0", "master": "redis://...
from __future__ import division import requests import zipfile import cStringIO as StringIO import csv import redis from urlparse import urlparse from publicsuffix import PublicSuffixList from django.conf import settings redis_urls = dict( { "slave": "redis://localhost:6379/0", "master": "redis://...
mit
Python
1d5c882b211498e491cccda5af20e7241b0f90da
Implement CardXML.cost
beheh/fireplace,jleclanche/fireplace,oftc-ftw/fireplace,butozerca/fireplace,butozerca/fireplace,liujimj/fireplace,Ragowit/fireplace,smallnamespace/fireplace,Meerkov/fireplace,liujimj/fireplace,oftc-ftw/fireplace,Ragowit/fireplace,NightKev/fireplace,Meerkov/fireplace,amw2104/fireplace,smallnamespace/fireplace,amw2104/fi...
fireplace/cardxml.py
fireplace/cardxml.py
import os from xml.etree import ElementTree from fireplace.enums import GameTag, PlayReq, Rarity class CardXML(object): def __init__(self, xml): self.xml = xml @property def id(self): return self.xml.attrib["CardID"] @property def chooseCards(self): cards = self.xml.findall("ChooseCard") return [tag.at...
import os from xml.etree import ElementTree from fireplace.enums import GameTag, PlayReq, Rarity class CardXML(object): def __init__(self, xml): self.xml = xml @property def id(self): return self.xml.attrib["CardID"] @property def chooseCards(self): cards = self.xml.findall("ChooseCard") return [tag.at...
agpl-3.0
Python
40ab3660c4f569d9261006a956a5459f59aef0cb
Make gometalinter to be not instant
maralla/validator.vim,maralla/vim-linter,maralla/vim-linter,maralla/vim-fixup,maralla/vim-fixup
pythonx/lints/go/gometalinter.py
pythonx/lints/go/gometalinter.py
# -*- coding: utf-8 -*- import os from validator import Validator class Gometalinter(Validator): __filetype__ = 'go' instant = False checker = 'gometalinter' args = '--fast' # <file>:<line>:[<column>]: <message> (<linter>) regex = r""" .+?: (?P<lnum>\d+): (?P<col>\d+)...
# -*- coding: utf-8 -*- from validator import Validator class Gometalinter(Validator): __filetype__ = 'go' checker = 'gometalinter' # <file>:<line>:[<column>]: <message> (<linter>) regex = r""" .+?: (?P<lnum>\d+): (?P<col>\d+)?: ( (?P<error>error) ...
mit
Python
efeb8bbf351f8c2c25be15b5ca32d5f76ebdd4ef
Fix slot name in HardwareDevice
Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,OSSystems/lava-server
launch_control/models/hw_device.py
launch_control/models/hw_device.py
""" Module with the HardwareDevice model. """ from launch_control.utils.json import PlainOldData class HardwareDevice(PlainOldData): """ Model representing any HardwareDevice A device is just a "device_type" attribute with a bag of properties and a human readable description. Individual device types...
""" Module with the HardwareDevice model. """ from launch_control.utils.json import PlainOldData class HardwareDevice(PlainOldData): """ Model representing any HardwareDevice A device is just a "device_type" attribute with a bag of properties and a human readable description. Individual device types...
agpl-3.0
Python
7bb7a33353f81ef23fde0b1bd4b683d7959fe622
fix setup.py fitting
SasView/sasview,lewisodriscoll/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,SasView/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview
fittingview/setup.py
fittingview/setup.py
""" Installation script for DANSE P(r) inversion perspective for SansView """ import os from distutils.core import setup setup( version = "0.9.1", name="fittingview", description = "Fitting module for SansView", package_dir = {"sans":os.path.join("src", "sans"), "sans....
""" Installation script for DANSE P(r) inversion perspective for SansView """ from distutils.core import setup setup( version = "0.9.1", name="fittingview", description = "Fitting module for SansView", package_dir = {"sans.perspectives":"src/sans/perspectives", "sans....
bsd-3-clause
Python
49a821c835ce10f7e9564c8c218765c76255db3e
Fix comment
spblightadv/rethinkdb,gdi2290/rethinkdb,JackieXie168/rethinkdb,spblightadv/rethinkdb,Wilbeibi/rethinkdb,lenstr/rethinkdb,matthaywardwebdesign/rethinkdb,grandquista/rethinkdb,wujf/rethinkdb,bpradipt/rethinkdb,gavioto/rethinkdb,mquandalle/rethinkdb,Qinusty/rethinkdb,gdi2290/rethinkdb,wojons/rethinkdb,ayumilong/rethinkdb,...
test/performance/compare.py
test/performance/compare.py
#!/usr/bin/python # Copyright 2010-2012 RethinkDB, all rights reserved. import sys from sys import stdout, exit, path import json import os import math path.insert(0, "../../drivers/python") from util import compare def load_files(file1, file2): """ Loads the results from two tests, and generate an HTML pag...
#!/usr/bin/python # Copyright 2010-2012 RethinkDB, all rights reserved. import sys from sys import stdout, exit, path import json import os import math path.insert(0, "../../drivers/python") from util import compare def load_files(file1, file2): """ Save the current results, and if previous results are avai...
apache-2.0
Python
ab94750cdf24c5bfbf96e80384fa688ba4043bed
Add document type to agency_document
gadventures/gapipy
gapipy/models/agency_document.py
gapipy/models/agency_document.py
from .base import BaseModel class AgencyDocument(BaseModel): " Represents a document for an agency. " _as_is_fields = ['file', 'type']
from .base import BaseModel class AgencyDocument(BaseModel): " Represents a document for an agency. " _as_is_fields = ['file']
mit
Python
3cd2e6dc82835f54a0bcf5656697b9926ee405ff
Fix internal CFFI/C type in GetOverlappedResult
opalmer/pywincffi,opalmer/pywincffi,opalmer/pywincffi,opalmer/pywincffi
pywincffi/kernel32/overlapped.py
pywincffi/kernel32/overlapped.py
""" Overlapped ---------- A module containing Windows functions for working with OVERLAPPED objects. """ from pywincffi.core import dist from pywincffi.core.checks import NON_ZERO, input_check, error_check from pywincffi.exceptions import WindowsAPIError from pywincffi.wintypes import HANDLE, OVERLAPPED, wintype_to_c...
""" Overlapped ---------- A module containing Windows functions for working with OVERLAPPED objects. """ from pywincffi.core import dist from pywincffi.core.checks import NON_ZERO, input_check, error_check from pywincffi.exceptions import WindowsAPIError from pywincffi.wintypes import HANDLE, OVERLAPPED, wintype_to_c...
mit
Python
088891169eb2395aed24709d60de94f423a7baf9
Add 403 instead of 500 for put/post/delete
jmcomets/twitto-feels,jmcomets/twitto-feels
models/routing.py
models/routing.py
import json from flask import request from flask.ext.restful import abort, Resource, Api as _Api import mongoengine as mongo class Api(_Api): def register_model(self, model): register_api_model(self, model) def get_request_json(code=400): if not request.headers['Content-Type'].startswith('application/...
import json from flask import request from flask.ext.restful import abort, Resource, Api as _Api class Api(_Api): def register_model(self, model): register_api_model(self, model) def get_request_json(code=400): if not request.headers['Content-Type'].startswith('application/json'): abort(code) ...
apache-2.0
Python
567b2ecb7eea94d0ea07c90423201521768303b2
install it by default
ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo
addons/l10n_it_edi/__manifest__.py
addons/l10n_it_edi/__manifest__.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Italy - E-invoicing', 'version': '0.3', 'depends': [ 'l10n_it', 'fetchmail', ], 'author': 'Odoo', 'description': """ E-invoice implementation """, 'category': 'A...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Italy - E-invoicing', 'version': '0.3', 'depends': [ 'l10n_it', 'fetchmail', ], 'author': 'Odoo', 'description': """ E-invoice implementation """, 'category': 'A...
agpl-3.0
Python
c16aaa8e4159161dcfd98e2314578b2d790067f7
Fix case where no outputs are present
gholms/euca2ools,gholms/euca2ools,jhajek/euca2ools,vasiliykochergin/euca2ools,vasiliykochergin/euca2ools,nagyistoce/euca2ools,jhajek/euca2ools,nagyistoce/euca2ools
euca2ools/commands/cloudformation/describestacks.py
euca2ools/commands/cloudformation/describestacks.py
# Copyright 2014 Eucalyptus Systems, Inc. # # Redistribution and use of this software in source and binary forms, # with or without modification, are permitted provided that the following # conditions are met: # # Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
# Copyright 2014 Eucalyptus Systems, Inc. # # Redistribution and use of this software in source and binary forms, # with or without modification, are permitted provided that the following # conditions are met: # # Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
bsd-2-clause
Python
0d1fcd0e169ec6d478cfd3f98a0d71eb232638dc
remove invalid assertion for new dask
quantopian/odo,ContinuumIO/odo,blaze/odo,ContinuumIO/odo,quantopian/odo,blaze/odo
odo/backends/tests/test_dask_bag.py
odo/backends/tests/test_dask_bag.py
import pytest pytest.importorskip('dask.bag') from operator import methodcaller from odo import chunks, TextFile, odo from dask.bag import Bag from odo.utils import filetexts def inc(x): return x + 1 dsk = {('x', 0): (range, 5), ('x', 1): (range, 5), ('x', 2): (range, 5)} L = list(range(5)) * ...
import pytest pytest.importorskip('dask.bag') from operator import methodcaller from odo import chunks, TextFile, odo from dask.bag import Bag from odo.utils import filetexts def inc(x): return x + 1 dsk = {('x', 0): (range, 5), ('x', 1): (range, 5), ('x', 2): (range, 5)} L = list(range(5)) * ...
bsd-3-clause
Python
351dd3d0540b6169a58897f9cb2ec6b1c20d57a5
Remove unused field from game form
joshsamara/game-website,joshsamara/game-website,joshsamara/game-website
core/forms/games.py
core/forms/games.py
from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, HTML, Submit, Button, Fieldset from django.forms import ModelForm, Textarea from core.models import Game class GameForm(ModelForm): class Meta: model = Game exclude = [...
from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, HTML, Submit, Button, Fieldset from django.forms import ModelForm, Textarea from core.models import Game class GameForm(ModelForm): class Meta: model = Game exclude = [...
mit
Python
c31cdccc390d26100d810a9d4b597b47ac2cbaf1
add docstring
gdsfactory/gdsfactory,gdsfactory/gdsfactory
gdsfactory/samples/demo/pcell.py
gdsfactory/samples/demo/pcell.py
import gdsfactory as gf @gf.cell def mzi_with_bend(radius: float = 10): """Returns MZI interferometer with bend.""" c = gf.Component() mzi = c.add_ref(gf.components.mzi()) bend = c.add_ref(gf.components.bend_euler(radius=radius)) bend.connect("o1", mzi.ports["o2"]) c.add_port("o1", port=mzi.po...
import gdsfactory as gf @gf.cell def mzi_with_bend(radius: float = 10): c = gf.Component() mzi = c.add_ref(gf.components.mzi()) bend = c.add_ref(gf.components.bend_euler(radius=radius)) bend.connect("o1", mzi.ports["o2"]) c.add_port("o1", port=mzi.ports["o1"]) c.add_port("o2", port=bend.ports[...
mit
Python
26b66a830fd9322dcc826fee2f1924670ea6c976
Decrease timeout to make test less flaky
pypa/pip,pradyunsg/pip,sbidoul/pip,sbidoul/pip,pfmoore/pip,pradyunsg/pip,pypa/pip,pfmoore/pip
tests/functional/test_requests.py
tests/functional/test_requests.py
import pytest from tests.lib import PipTestEnvironment @pytest.mark.network def test_timeout(script: PipTestEnvironment) -> None: result = script.pip( "--timeout", "0.00001", "install", "-vvv", "INITools", expect_error=True, ) assert ( "Could not fe...
import pytest from tests.lib import PipTestEnvironment @pytest.mark.network def test_timeout(script: PipTestEnvironment) -> None: result = script.pip( "--timeout", "0.0001", "install", "-vvv", "INITools", expect_error=True, ) assert ( "Could not fet...
mit
Python
51f6272870e4e72d2364b2c2f660457b5c9286ef
Add sum up part using pd.crosstab
tosh1ki/pyogi,tosh1ki/pyogi
doc/sample_code/search_forking_pro.py
doc/sample_code/search_forking_pro.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import pandas as pd sys.path.append('./../../') from pyogi.ki2converter import * from pyogi.kifu import * if __name__ == '__main__': res_table = [] for n in range(0, 50000): n1 = (n // 10000) n2 = int(n < 10000) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys sys.path.append('./../../') from pyogi.ki2converter import * from pyogi.kifu import * if __name__ == '__main__': for n in range(0, 50000): n1 = (n // 10000) n2 = int(n < 10000) relpath = '~/data/shogi/2chkifu/{...
mit
Python
e7d78a167eac9fb12d55b8687b3b7e4935c7226f
Build -O2 to workaround reported segfaults on gcc 4.9
websockets/bufferutil,websockets/bufferutil,websockets/bufferutil
binding.gyp
binding.gyp
{ 'targets': [ { 'target_name': 'bufferutil', 'include_dirs': ["<!(node -e \"require('nan')\")"], 'cflags!': [ '-O3' ], 'cflags': [ '-O2' ], 'sources': [ 'src/bufferutil.cc' ] } ] }
{ 'targets': [ { 'target_name': 'bufferutil', 'include_dirs': ["<!(node -e \"require('nan')\")"], 'cflags': [ '-O3' ], 'sources': [ 'src/bufferutil.cc' ] } ] }
mit
Python
e4f5ab9281ff0c14c74b4793dc06ebfee5023940
Fix typo in ExportEvents
mociepka/saleor,mociepka/saleor,mociepka/saleor
saleor/csv/__init__.py
saleor/csv/__init__.py
class ExportEvents: """The different csv events types.""" EXPORT_PENDING = "export_pending" EXPORT_SUCCESS = "export_success" EXPORT_FAILED = "export_failed" EXPORT_DELETED = "export_deleted" EXPORTED_FILE_SENT = "exported_file_sent" EXPORT_FAILED_INFO_SENT = "Export_failed_info_sent" ...
class ExportEvents: """The different csv events types.""" EXPORT_PENDING = "export_pending" EXPORT_SUCCESS = "export_success" EXPORT_FAILED = "export_failed" EXPORT_DELETED = "export_deleted" EXPORTED_FILE_SENT = "exported_file_sent" EXPORT_FAILED_INFO_SENT = "Export_failed_info_sent" ...
bsd-3-clause
Python
4db93f27d6d4f9b05b33af96bff15108272df6ce
Add multi team output in markers
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,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system
src/webapp/public.py
src/webapp/public.py
import json from flask import Blueprint, render_template import database as db from database.model import Team bp = Blueprint('public', __name__) @bp.route("/map") def map_page(): return render_template("public/map.html") @bp.route("/map_teams") def map_teams(): qry = db.session.query(Team).filter_by(conf...
import json from flask import Blueprint, render_template import database as db from database.model import Team bp = Blueprint('public', __name__) @bp.route("/map") def map_page(): return render_template("public/map.html") @bp.route("/map_teams") def map_teams(): qry = db.session.query(Team).filter_by(conf...
bsd-3-clause
Python
abc70e596bc7fff018aff031fd6ded786eba0eac
Remove redudant code and enable crawling courses
sonicyang/NCKU_Course,sonicyang/NCKU_Course,sonicyang/NCKU_Course,sonicyang/NCKU_Course
crawler/management/commands/crawl_course.py
crawler/management/commands/crawl_course.py
from django.core.management.base import BaseCommand from crawler.crawler import crawl_course, crawl_dept try: from crawler.decaptcha import Entrance, DecaptchaFailure except ImportError: Entrance = None from data_center.models import Course, Department def get_auth_pair(url): if Entrance is not None: ...
from django.core.management.base import BaseCommand from crawler.crawler import crawl_course, crawl_dept try: from crawler.decaptcha import Entrance, DecaptchaFailure except ImportError: Entrance = None from data_center.models import Course, Department def get_auth_pair(url): if Entrance is not None: ...
mit
Python
1fd96f9d12d1cbedb3c10f1d720d96bda4dee922
Fix if bottom_id is not in the dag for some reason
HazyResearch/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics
onto/canonicalize_gene_phenotype.py
onto/canonicalize_gene_phenotype.py
#! /usr/bin/env python import sys sys.path.append('../code') import data_util as dutil import os APP_HOME = os.environ['GDD_HOME'] ### ATTENTION!!!! PLEASE PIPE THE OUTPUT OF THIS SCRIPT THROUGH sort | uniq !!! ### ### Doing it within python is a waste of resources. Linux does it much faster. ### def get_parents(b...
#! /usr/bin/env python import sys sys.path.append('../code') import data_util as dutil import os APP_HOME = os.environ['GDD_HOME'] ### ATTENTION!!!! PLEASE PIPE THE OUTPUT OF THIS SCRIPT THROUGH sort | uniq !!! ### ### Doing it within python is a waste of resources. Linux does it much faster. ### def get_parents(b...
apache-2.0
Python
2b6232924d347f6e8659f4c31ce379c1d2c3da85
Fix typo.
malaonline/Android,malaonline/iOS,malaonline/Android,malaonline/Server,malaonline/iOS,malaonline/iOS,malaonline/Server,malaonline/Android,malaonline/Server,malaonline/Server
server/app/urls.py
server/app/urls.py
from django.conf.urls import include, url from django.views.generic import TemplateView from rest_framework import routers from rest_framework.authtoken import views as authviews from . import views # Routers provide an easy way of automatically determining the URL conf. router = routers.DefaultRouter() router.regis...
from django.conf.urls import include, url from django.views.generic import TemplateView from rest_framework import routers from rest_framework.authtoken import views as authviews from . import views # Routers provide an easy way of automatically determining the URL conf. router = routers.DefaultRouter() router.regis...
mit
Python
3885e8fd36f419976d0b002c391dc246588929c7
Add view metrics permission to metrics view
sloria/osf.io,monikagrabowska/osf.io,brianjgeiger/osf.io,sloria/osf.io,erinspace/osf.io,TomBaxter/osf.io,mfraezz/osf.io,chrisseto/osf.io,crcresearch/osf.io,adlius/osf.io,laurenrevere/osf.io,monikagrabowska/osf.io,acshi/osf.io,crcresearch/osf.io,cwisecarver/osf.io,icereval/osf.io,cwisecarver/osf.io,aaxelb/osf.io,adlius/...
admin/metrics/views.py
admin/metrics/views.py
from django.views.generic import TemplateView from django.contrib.auth.mixins import PermissionRequiredMixin from admin.base.settings import KEEN_CREDENTIALS from admin.base.utils import OSFAdmin class MetricsView(OSFAdmin, TemplateView, PermissionRequiredMixin): template_name = 'metrics/osf_metrics.html' ...
from django.views.generic import TemplateView from admin.base.settings import KEEN_CREDENTIALS from admin.base.utils import OSFAdmin class MetricsView(OSFAdmin, TemplateView): template_name = 'metrics/osf_metrics.html' def get_context_data(self, **kwargs): kwargs.update(KEEN_CREDENTIALS.copy()) ...
apache-2.0
Python
c87936a43c7d0c094b698312f1e7818a533a0f8e
fix return in parent.
constanthatz/data-structures
binheap.py
binheap.py
#!/usr/bin/env python from __future__ import print_function from __future__ import unicode_literals from __future__ import division class Binheap(object): ''' Create an empty heap. ''' def __init__(self, binlist=[]): self.binlist = binlist def push(self, value): self.binlist.append(value)...
#!/usr/bin/env python from __future__ import print_function from __future__ import unicode_literals from __future__ import division class Binheap(object): ''' Create an empty heap. ''' def __init__(self, binlist=[]): self.binlist = binlist def push(self, value): self.binlist.append(value)...
mit
Python
574ab0f4204671b200fee09e4fa87dc1c491ae1e
change the position of function
elixirhub/events-portal-scraping-scripts
AddDataTest.py
AddDataTest.py
__author__ = 'chuqiao' import EventsPortal from datetime import datetime import logging def logger(): """ Function that initialises logging system """ global logger # create logger with 'syncsolr' logger = logging.getLogger('adddata') logger.setLevel(logging.DEBUG) # specifies the ...
__author__ = 'chuqiao' import EventsPortal from datetime import datetime import logging def logger(): """ Function that initialises logging system """ global logger # create logger with 'syncsolr' logger = logging.getLogger('adddata') logger.setLevel(logging.DEBUG) # specifies the ...
mit
Python
b3261b23227482ce5f683ac2853288a110c893a2
bump version
collab-project/django-encode,collab-project/django-encode
encode/__init__.py
encode/__init__.py
# Copyright Collab 2012-2015 """ `django-encode` application. """ from __future__ import unicode_literals AUDIO = "audio" VIDEO = "video" SNAPSHOT = "snapshot" #: Accepted file types. FILE_TYPES = ( (AUDIO, "Audio"), (VIDEO, "Video"), (SNAPSHOT, "Snapshot"), ) #: Application version. __version__ = (1, ...
# Copyright Collab 2012-2015 """ `django-encode` application. """ from __future__ import unicode_literals AUDIO = "audio" VIDEO = "video" SNAPSHOT = "snapshot" #: Accepted file types. FILE_TYPES = ( (AUDIO, "Audio"), (VIDEO, "Video"), (SNAPSHOT, "Snapshot"), ) #: Application version. __version__ = (1, ...
mit
Python
d10720d1dd7997b5e1543cb27f2cd3e1088f30f5
Add advanced search by select type or status
klokantech/epsg.io,dudaerich/epsg.io,dudaerich/epsg.io,klokantech/epsg.io,klokantech/epsg.io,dudaerich/epsg.io,dudaerich/epsg.io,klokantech/epsg.io
server/fulltext.py
server/fulltext.py
#!/usr/bin/env python # encoding: utf-8 """ """ from bottle import route, run, template, request import urllib2 import urllib import sys import os from whoosh.index import create_in, open_dir from whoosh.fields import * from whoosh.qparser import QueryParser, MultifieldParser from whoosh.query import * @route('/') ...
#!/usr/bin/env python # encoding: utf-8 """ """ from bottle import route, run, template, request import urllib2 import urllib import sys import os from whoosh.index import create_in, open_dir from whoosh.fields import * from whoosh.qparser import QueryParser, MultifieldParser from whoosh.query import * @route('/') ...
bsd-2-clause
Python
f336a5abf0b0fcc7fed664a80d85f9a753ee66bc
Add home_location, home_lon, and home_lat
softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat
fellowms/management/commands/loadoldapplications.py
fellowms/management/commands/loadoldapplications.py
import pandas as pd from django.core.management.base import BaseCommand, CommandError from django.core.exceptions import ObjectDoesNotExist from fellowms.models import Fellow CSV_TO_IMPORT = 'old_applications.csv' class Command(BaseCommand): help = "Import CSV (old_applications.csv) with applications to fellows...
import pandas as pd from django.core.management.base import BaseCommand, CommandError from django.core.exceptions import ObjectDoesNotExist from fellowms.models import Fellow CSV_TO_IMPORT = 'old_applications.csv' class Command(BaseCommand): help = "Import CSV (old_applications.csv) with applications to fellows...
bsd-3-clause
Python
6688f544c58575a4d243a72b5f0b998226cd67b0
install script runs makemigrations and migrate to let project installation in a good state
imvu/bluesteel,imvu/bluesteel,imvu/bluesteel
s/install-stronghold.py
s/install-stronghold.py
#!/usr/bin/env python import subprocess import os import sys def main(): if not os.getuid() == 0: print '- This script needs to be executed with root privileges (sudo).' sys.exit(1) list_commands = [] list_commands.append(['python', 's/internal/install-hooks.py']) list_commands.appen...
#!/usr/bin/env python import subprocess import os import sys def main(): if not os.getuid() == 0: print '- This script needs to be executed with root privileges (sudo).' sys.exit(1) list_scripts = [] list_scripts.append('s/internal/install-hooks.py') list_scripts.append('s/internal/i...
mit
Python
67e12c71df5c750d22b59b8734228cdf720be313
Remove pdb
billyvg/piebot
modules/search.py
modules/search.py
"""Google search @package ppbot Returns the first google search result @syntax g <search terms> """ import requests import json from modules import * class Search(Module): def __init__(self, *args, **kwargs): """Constructor""" Module.__init__(self, kwargs=kwargs) self.url = "http://...
"""Google search @package ppbot Returns the first google search result @syntax g <search terms> """ import requests import json from modules import * class Search(Module): def __init__(self, *args, **kwargs): """Constructor""" Module.__init__(self, kwargs=kwargs) self.url = "http://...
mit
Python
150b6324bea046e422b8d94ceb51cbae32b7ae67
Update urls.py
ebridge2/FNGS_website,02agarwalt/FNGS_website,02agarwalt/FNGS_website,ebridge2/FNGS_website,02agarwalt/FNGS_website,ebridge2/FNGS_website,ebridge2/FNGS_website
fngs/explore/urls.py
fngs/explore/urls.py
from django.conf.urls import url from . import views app_name = 'explore' urlpatterns = [ url(r'^$', views.submit_job, name='index'), url(r'job/submit/$', views.submit_job, name='job-submit'), ]
from django.conf.urls import url from . import views from django.conf.urls.static import static from django.conf import settings app_name = 'explore' urlpatterns = [ # /explore/ url(r'^$', views.index, name='index'), # /explore/<dataset_id>/ url(r'^(?P<dataset_id>[\w\-]+)/$', views.dataset, name='datase...
apache-2.0
Python