commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
c0da9801f726ab3ac5c360f77598f1d14c615c2e | make sure windrose_utils._make_plot gets exercised! | pyiem/tests/test_windrose_utils.py | pyiem/tests/test_windrose_utils.py | import unittest
import datetime
import psycopg2
from pyiem.windrose_utils import windrose, _get_timeinfo
class Test(unittest.TestCase):
def test_timeinfo(self):
"""Exercise the _get_timeinfo method"""
res = _get_timeinfo(range(1, 10), 'hour', 24)
self.assertEquals(res['labeltext'], '(1, 2... | import unittest
import datetime
import psycopg2
from pyiem.windrose_utils import windrose, _get_timeinfo
class Test(unittest.TestCase):
def test_timeinfo(self):
"""Exercise the _get_timeinfo method"""
res = _get_timeinfo(range(1, 10), 'hour', 24)
self.assertEquals(res['labeltext'], '(1, 2... | Python | 0 |
d32d57fc07b595c4dc0a24a04ac4589ad5d16918 | Make modules uninstallable | hotel/__openerp__.py | hotel/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | Python | 0 |
eca18d440d37e3caebe049617910420e6d37d507 | remove execute bit from compare_ir python script | src/compiler/glsl/tests/compare_ir.py | src/compiler/glsl/tests/compare_ir.py | #!/usr/bin/env python
# coding=utf-8
#
# Copyright © 2011 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to... | #!/usr/bin/env python
# coding=utf-8
#
# Copyright © 2011 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to... | Python | 0 |
39d89982a2a2bba810e51614158bf474cba500dc | Add more ComputerPlayer names | computer_player.py | computer_player.py | import random
import sys
import time
from player import Player
from solving_algorithm import generate_solutions
class ComputerPlayer(Player):
def __init__(self):
super(ComputerPlayer, self).__init__()
self.PAUSE = 0.1
self.names = ['Chell', 'GLaDOS', 'Curiosity Core', 'Turret', 'Companion... | import random
import sys
import time
from player import Player
from solving_algorithm import generate_solutions
class ComputerPlayer(Player):
def __init__(self):
super(ComputerPlayer, self).__init__()
self.PAUSE = 0.1
self.names = ['Chell', 'GLaDOS', 'Companion Cube', 'Curiosity Core', 'W... | Python | 0 |
068e12ebb0fc36fc3bfa397a58c54aa92e361f9a | Clean up unit test in test_notifier | st2actions/tests/unit/test_notifier.py | st2actions/tests/unit/test_notifier.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Python | 0 |
cf35695481b703e49fbc00e286ef6380a8aec394 | Remove invalid test | corehq/apps/notifications/tests/test_views.py | corehq/apps/notifications/tests/test_views.py | from unittest.mock import patch
from corehq.apps.accounting.models import Subscription
from corehq.apps.groups.models import Group
from ..views import NotificationsServiceRMIView
def test_should_hide_feature_notifs_for_pro_with_groups():
with case_sharing_groups_patch(['agroupid']):
hide = Notifications... | from unittest.mock import patch
from corehq.apps.accounting.models import Subscription
from corehq.apps.groups.models import Group
from ..views import NotificationsServiceRMIView
def test_should_hide_feature_notifs_for_pro_with_groups():
with case_sharing_groups_patch(['agroupid']):
hide = Notifications... | Python | 0 |
9df00bbfa829006396c2a6718e4540410b27c4c6 | Clear the job queue upon kolibri initialization. | kolibri/tasks/apps.py | kolibri/tasks/apps.py | from __future__ import absolute_import, print_function, unicode_literals
from django.apps import AppConfig
class KolibriTasksConfig(AppConfig):
name = 'kolibri.tasks'
label = 'kolibritasks'
verbose_name = 'Kolibri Tasks'
def ready(self):
from kolibri.tasks.api import client
client.cl... | from __future__ import absolute_import, print_function, unicode_literals
from django.apps import AppConfig
class KolibriTasksConfig(AppConfig):
name = 'kolibri.tasks'
label = 'kolibritasks'
verbose_name = 'Kolibri Tasks'
def ready(self):
pass
| Python | 0 |
6a6cb75ad2c29435d74768aa88c5d925570a6ad0 | Add some meta | flask_environments.py | flask_environments.py | # -*- coding: utf-8 -*-
"""
flask_environments
~~~~~~~~~~~~~~~~~~
Environment tools and configuration for Flask applications
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
import os
import yaml
from flask import current_app
class Environments(object):
... |
import os
import yaml
from flask import current_app
class Environments(object):
def __init__(self, app=None, var_name=None, default_env=None):
self.app = app
self.var_name = var_name or 'FLASK_ENV'
self.default_env = default_env or 'DEVELOPMENT'
self.env = os.environ.get(self.va... | Python | 0.000134 |
cff83c316663975af2e838cbd8c365a68079c369 | In plugin child_plugin_instances may be None | shop/cascade/extensions.py | shop/cascade/extensions.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from cms.plugin_pool import plugin_pool
from cmsplugin_cascade.plugin_base import TransparentContainer
from .plugin_base import ShopPluginBase
class ShopExtendableMixin(object):
"""
Add th... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from cms.plugin_pool import plugin_pool
from cmsplugin_cascade.plugin_base import TransparentContainer
from .plugin_base import ShopPluginBase
class ShopExtendableMixin(object):
"""
Add th... | Python | 0.999998 |
77e5dcc8592686202045a79cea293af602ed5d49 | delete is trickle-down, so I think this is more precise | corehq/apps/reminders/tests/test_recipient.py | corehq/apps/reminders/tests/test_recipient.py | from django.test import TestCase
from corehq.apps.domain.models import Domain
from corehq.apps.locations.models import SQLLocation, LocationType
from corehq.apps.reminders.models import CaseReminder, CaseReminderHandler
from corehq.apps.users.models import CommCareUser
from corehq.form_processor.tests.utils import run_... | from django.test import TestCase
from corehq.apps.domain.models import Domain
from corehq.apps.locations.models import SQLLocation, LocationType
from corehq.apps.reminders.models import CaseReminder, CaseReminderHandler
from corehq.apps.users.models import CommCareUser
from corehq.form_processor.tests.utils import run_... | Python | 0.000012 |
bb5cbae79ef8efb8d0b7dd3ee95e76955317d3d7 | Fix for broken container security test | tests/integration/api/test_sc_test_jobs.py | tests/integration/api/test_sc_test_jobs.py | from tests.base import BaseTest
from tenable_io.api.models import ScTestJob
class TestScTestJobsApi(BaseTest):
def test_status(self, client, image):
jobs = client.sc_test_jobs_api.list()
assert len(jobs) > 0, u'At least one job exists.'
test_job = client.sc_test_jobs_api.status(jobs[0].j... | from tests.base import BaseTest
from tenable_io.api.models import ScTestJob
class TestScTestJobsApi(BaseTest):
def test_status(self, client, image):
jobs = client.sc_test_jobs_api.list()
assert len(jobs) > 0, u'At least one job exists.'
test_job = client.sc_test_jobs_api.status(jobs[0].j... | Python | 0 |
db6e23671a82a76afc13b4a69422a6b0d3c381df | Rearrange tests | h5py/tests/high/test_hlobject.py | h5py/tests/high/test_hlobject.py | from tempfile import mktemp
from h5py import tests
import h5py
class Base(tests.HTest):
def setUp(self):
self.name = mktemp()
self.f = h5py.File(self.name, 'w')
def tearDown(self):
import os
try:
if self.f:
self.f.close()
finally:
... | from tempfile import mktemp
from h5py import tests
import h5py
class Base(tests.HTest):
def setUp(self):
self.name = mktemp()
self.f = h5py.File(self.name, 'w')
def tearDown(self):
import os
try:
if self.f:
self.f.close()
finally:
... | Python | 0.000015 |
6594bb843998ee22b0a12036a0e16c1fd625fd03 | Revert "Catch Validation error" | shop/context_processors.py | shop/context_processors.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from shop.models.customer import CustomerModel
def customer(request):
"""
Add the customer to the RequestContext
"""
msg = "The request object does not contain a customer. Edit your MIDDLEWARE_CLASSES sett... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.forms.utils import ValidationError
from shop.models.customer import CustomerModel
def customer(request):
"""
Add the customer to the RequestContext
"""
msg = "The request object does not conta... | Python | 0 |
0cb7f9c41c7ae0a7f487188721f56adf2ff9999d | add type hints. | lib/acli/services/route53.py | lib/acli/services/route53.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, print_function, unicode_literals)
from boto3.session import Session
from acli.output.route53 import (output_route53_list, output_route53_info)
import botocore.exceptions
def get_boto3_session(aws_config):
"""
@type aws_config: Config
"""
... | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, print_function, unicode_literals)
from boto3.session import Session
from acli.output.route53 import (output_route53_list, output_route53_info)
import botocore.exceptions
def get_boto3_session(aws_config):
return Session(region_name=aws_config.region... | Python | 0 |
b747391c748c94cd8433dfacd935d131b484a29c | Improve error handling and refactor base path | java/ql/src/utils/model-generator/RegenerateModels.py | java/ql/src/utils/model-generator/RegenerateModels.py | #!/usr/bin/python3
# Tool to regenerate existing framework CSV models.
from pathlib import Path
import json
import os
import requests
import shutil
import subprocess
import tempfile
import sys
defaultModelPath = "java/ql/lib/semmle/code/java/frameworks"
lgtmSlugToModelFile = {
# "apache/commons-beanutils": "apa... | #!/usr/bin/python3
# Tool to regenerate existing framework CSV models.
from pathlib import Path
import json
import os
import requests
import shutil
import subprocess
import tempfile
import sys
lgtmSlugToModelFile = {
# "apache/commons-beanutils": "java/ql/lib/semmle/code/java/frameworks/apache/BeanUtilsGenerate... | Python | 0 |
f3fd4d098ef5465776cd3e71a8e6c889a2b74ff6 | Update proxy.py | lazada_scsdk/proxy.py | lazada_scsdk/proxy.py | # -*- coding: utf-8 -*-
# @Author: Phu Hoang
# @Date: 2017-05-23 09:40:32
# @Last Modified by: Phu Hoang
# @Last Modified time: 2017-06-16 10:53:12
import logging
from requests.exceptions import ReadTimeout
from http_request_randomizer.requests.proxy.requestProxy import RequestProxy
from http_request_randomizer.re... | # -*- coding: utf-8 -*-
# @Author: Phu Hoang
# @Date: 2017-05-23 09:40:32
# @Last Modified by: Phu Hoang
# @Last Modified time: 2017-06-16 10:53:12
import logging
from requests.exceptions import ReadTimeout
from http_request_randomizer.requests.proxy.requestProxy import RequestProxy
from http_request_randomizer.re... | Python | 0.000001 |
394d5f9cd7c911fa790a63332101b784f67f8b55 | Add dual variables to constraints | cvxpy/constraints/leq_constraint.py | cvxpy/constraints/leq_constraint.py | """
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CVXPY is distributed i... | """
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CVXPY is distributed i... | Python | 0 |
1e1e2793bad3db9201e51c5038edde5373424ad6 | Put infrastructure in place for javascript targetting | client/compile.py | client/compile.py | #!/usr/bin/env python
import os.path
from HTMLParser import HTMLParser
import re
"""
Certain runtimes (like AIR) don't support dynamic function creation. Parse the
JavaScript and create the template beforehand.
"""
class Compiler(HTMLParser):
script = ''
scripts = {}
javascripts = {}
inScript = False... | #!/usr/bin/env python
import os.path
from HTMLParser import HTMLParser
import re
"""
Certain runtimes (like AIR) don't support dynamic function creation. Parse the
JavaScript and create the template beforehand.
"""
class Compiler(HTMLParser):
script = ''
scripts = {}
inScript = False
scriptName = ''
... | Python | 0.000001 |
7dffc7115b5e91ba13de8cb3e306832be7f8e185 | print result in show components | client/jiraffe.py | client/jiraffe.py | import urllib
import os
SERVICE_URL = "http://jiraffe.cloudhub.io/api"
CREATE_SERVICE = SERVICE_URL + "/issues"
DEFAULT_SERVICE = SERVICE_URL + "/defaults"
COMPONENT_SERVICE = SERVICE_URL + "/components"
def get_valid_reporter(reporter):
if reporter == "":
return os.environ['JIRA_ID']
return reporter
def cre... | import urllib
import os
SERVICE_URL = "http://jiraffe.cloudhub.io/api"
CREATE_SERVICE = SERVICE_URL + "/issues"
DEFAULT_SERVICE = SERVICE_URL + "/defaults"
COMPONENT_SERVICE = SERVICE_URL + "/components"
def get_valid_reporter(reporter):
if reporter == "":
return os.environ['JIRA_ID']
return reporter
def cre... | Python | 0 |
a7e45cc5cd9ec9d706b4160f988616d87e185cb8 | FIX survey validate_questions | survey_conditional_questions/survey.py | survey_conditional_questions/survey.py | # -*- coding: utf-8 -*-
from openerp import fields, models
import logging
_logger = logging.getLogger(__name__)
class survey_question(models.Model):
_inherit = 'survey.question'
conditional = fields.Boolean(
'Conditional Question',
copy=False,
# we add copy = false to avoid wrong lin... | # -*- coding: utf-8 -*-
from openerp import fields, models
class survey_question(models.Model):
_inherit = 'survey.question'
conditional = fields.Boolean(
'Conditional Question',
copy=False,
# we add copy = false to avoid wrong link on survey copy,
# should be improoved
)
... | Python | 0 |
f6be438e01a499dc2bde6abfa5a00fb281db7b83 | Add account_id as the element of this class | kamboo/core.py | kamboo/core.py |
import botocore
from kotocore.session import Session
class KambooConnection(object):
"""
Kamboo connection with botocore session initialized
"""
session = botocore.session.get_session()
def __init__(self, service_name="ec2", region_name="us-east-1",
account_id=None,
... |
import botocore
from kotocore.session import Session
class KambooConnection(object):
"""
Kamboo connection with botocore session initialized
"""
session = botocore.session.get_session()
def __init__(self, service_name="ec2", region_name="us-east-1",
credentials=None):
se... | Python | 0.000001 |
a76b866862874ce52c762b4e0381b233917a977a | Increment version | karld/_meta.py | karld/_meta.py | version_info = (0, 2, 7)
version = '.'.join(map(str, version_info))
| version_info = (0, 2, 6)
version = '.'.join(map(str, version_info))
| Python | 0.000002 |
31d7df470dbaf996f4f3c7639107ec04afda1ec4 | Update runcount.py | bin/runcount.py | bin/runcount.py | #!/usr/bin/python
import os
from count import countfile
import common
def runAll(args):
print('\n\n\nYou have requested to count unique sam files')
print('\tWARNING:')
print('\t\tIF USING ANY REFERENCES OTHER THAN THOSE I PROVIDE I CANNOT GUARANTEE RESULT ACCURACY')
print('\n')
#set up environm... | #!/usr/bin/python
import os
from count import countfile
import common
def runAll(args):
print('\n\n\nYou have requested to count unique sam files')
print('\tWARNING:')
print('\t\tIF USING ANY REFERENCES OTHER THAN THOSE I PROVIDE I CANNOT GUARANTEE RESULT ACCURACY')
print('\n')
#set up environm... | Python | 0.000001 |
e6520bb2c2f016f39ae76bfb15dd62cfdb2fdf63 | update rcomp CLI index printing, given new serv format | frontend/rcomp/cli.py | frontend/rcomp/cli.py | """command-line interface (CLI)
For local development, use the `--rcomp-server` switch to direct this
client at the localhost. E.g.,
rcomp --rcomp-server http://127.0.0.1:8000
"""
import argparse
import sys
import json
import requests
from . import __version__
def main(argv=None):
parser = argparse.Argume... | """command-line interface (CLI)
For local development, use the `--rcomp-server` switch to direct this
client at the localhost. E.g.,
rcomp --rcomp-server http://127.0.0.1:8000
"""
import argparse
import sys
import json
import requests
from . import __version__
def main(argv=None):
parser = argparse.Argume... | Python | 0 |
c4a0a83fe4a028b1d571058aed755be5b4714531 | fix logging | includes/SteamGroupMembers.py | includes/SteamGroupMembers.py | import logging
import urllib2
import xml.etree.ElementTree as ElementTree
logger = logging.getLogger()
class SteamGroupMembers(object):
"""
Retrives all members of the specified group.
"""
_members = None
def __init__(self, group_id):
self._group_id = group_id
def __len__(self):
... | import logging
import urllib2
import xml.etree.ElementTree as ElementTree
logger = logging.getLogger()
class SteamGroupMembers(object):
"""
Retrives all members of the specified group.
"""
_members = None
def __init__(self, group_id):
self._group_id = group_id
def __len__(self):
... | Python | 0.000002 |
5ffa9f7054f9fcced99e366cfb8ea6de4dd1a01c | Recognize "Sinhala" as an Indic script | hindkit/constants/linguistics.py | hindkit/constants/linguistics.py | INDIC_SCRIPTS = {
'devanagari': {
'abbreviation': 'dv',
'indic1 tag': 'deva',
'indic2 tag': 'dev2',
},
'bangla': {
'abbreviation': 'bn',
'indic1 tag': 'beng',
'indic2 tag': 'bng2',
'alternative name': 'Bengali',
},
'gurmukhi': {
'abb... | INDIC_SCRIPTS = {
'devanagari': {
'abbreviation': 'dv',
'indic1 tag': 'deva',
'indic2 tag': 'dev2',
},
'bangla': {
'abbreviation': 'bn',
'indic1 tag': 'beng',
'indic2 tag': 'bng2',
'alternative name': 'Bengali',
},
'gurmukhi': {
'abb... | Python | 0.998315 |
0b7a5929208bddb9e850f10ff40f1521363283fd | decrease map_stats precision | ichnaea/map_stats.py | ichnaea/map_stats.py | import csv
from cStringIO import StringIO
from ichnaea.db import Measure
def map_stats_request(request):
session = request.database.session()
query = session.query(Measure.lat, Measure.lon)
unique = set()
for lat, lon in query:
unique.add(((lat // 100000) / 1000.0, (lon // 100000) / 1000.0))
... | import csv
from cStringIO import StringIO
from ichnaea.db import Measure
def map_stats_request(request):
session = request.database.session()
query = session.query(Measure.lat, Measure.lon)
unique = set()
for lat, lon in query:
unique.add(((lat // 10000) / 1000.0, (lon // 10000) / 1000.0))
... | Python | 0.000007 |
3def5ee6b6ffbb60260130deedee65cfc0e186f0 | add missing super() constructor in IosAccelerometer | plyer/platforms/ios/accelerometer.py | plyer/platforms/ios/accelerometer.py | '''
iOS accelerometer
-----------------
Taken from: https://pyobjus.readthedocs.org/en/latest/pyobjus_ios.html#accessing-accelerometer
'''
from plyer.facades import Accelerometer
from pyobjus import autoclass
class IosAccelerometer(Accelerometer):
def __init__(self):
super(IosAccelerometer, self).__ini... | '''
iOS accelerometer
-----------------
Taken from: https://pyobjus.readthedocs.org/en/latest/pyobjus_ios.html#accessing-accelerometer
'''
from plyer.facades import Accelerometer
from pyobjus import autoclass
class IosAccelerometer(Accelerometer):
def __init__(self):
self.bridge = autoclass('bridge').a... | Python | 0.000001 |
a536da0d925201fc652b08ad27985f37c5bd4b6c | Fix relative_urls helper for call from initialization code | src/adhocracy/lib/helpers/site_helper.py | src/adhocracy/lib/helpers/site_helper.py | from pylons import config, app_globals as g
from pylons.i18n import _
from paste.deploy.converters import asbool
from adhocracy.model import instance_filter as ifilter
CURRENT_INSTANCE = object()
def get_domain_part(domain_with_port):
return domain_with_port.split(':')[0]
def domain():
return get_domain_p... | from pylons import config, app_globals as g
from pylons.i18n import _
from paste.deploy.converters import asbool
from adhocracy.model import instance_filter as ifilter
CURRENT_INSTANCE = object()
def get_domain_part(domain_with_port):
return domain_with_port.split(':')[0]
def domain():
return get_domain_p... | Python | 0.000006 |
3f8a29efa3128f8167306b46e47e7ac18cf592ab | set broker pool limit | celeryconfig.py | celeryconfig.py | import os
import sys
import urlparse
from kombu import Exchange, Queue
sys.path.append('.')
redis_url = os.environ.get('REDIS_URL', "redis://127.0.0.1:6379/")
if not redis_url.endswith("/"):
redis_url += "/"
BROKER_URL = redis_url + "1" # REDIS_CELERY_TASKS_DATABASE_NUMBER = 1
CELERY_RESULT_BACKEND = redis_url... | import os
import sys
import urlparse
from kombu import Exchange, Queue
sys.path.append('.')
redis_url = os.environ.get('REDIS_URL', "redis://127.0.0.1:6379/")
if not redis_url.endswith("/"):
redis_url += "/"
BROKER_URL = redis_url + "1" # REDIS_CELERY_TASKS_DATABASE_NUMBER = 1
CELERY_RESULT_BACKEND = redis_url... | Python | 0 |
3abbba864df16e06a768b761baefd3d705008114 | Update vigenereCipher: fixed typo | books/CrackingCodesWithPython/Chapter18/vigenereCipher.py | books/CrackingCodesWithPython/Chapter18/vigenereCipher.py | # Vigenere Cipher (Polyalphabetic Substitution Cipher)
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
from books.CrackingCodesWithPython.pyperclip import copy
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def main():
# This text can be downloaded from https://www.nostarch.com/crackingcodes/:
myMessage = "... | # Vigenere Cipher (Polyalphabetic Substitution Cipher)
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
from books.CrackingCodesWithPython.pyperclip import copy
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def main():
# This text can be downloaded from https://www.nostarch.com/crackingcodes/:
myMessage = "... | Python | 0.000001 |
41126795dec28c8c81f225f65589ba7aa264b4a6 | allow any test sample size for cold start scenario | polara/recommender/coldstart/data.py | polara/recommender/coldstart/data.py | from collections import namedtuple
import numpy as np
import pandas as pd
from polara.recommender.data import RecommenderData
class ItemColdStartData(RecommenderData):
def __init__(self, *args, **kwargs):
random_state = kwargs.pop('random_state', None)
super(ItemColdStartData, self).__init__(*args... | from collections import namedtuple
import numpy as np
import pandas as pd
from polara.recommender.data import RecommenderData
class ItemColdStartData(RecommenderData):
def __init__(self, *args, **kwargs):
random_state = kwargs.pop('random_state', None)
super(ItemColdStartData, self).__init__(*args... | Python | 0 |
ae92abffcbe792d41ee7aafb08e59ba874f3a4c4 | Fix migration dependencies | longclaw/basket/migrations/0003_auto_20170207_2053.py | longclaw/basket/migrations/0003_auto_20170207_2053.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-07 20:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('basket', '0001_initial'),
]
operations = [
migrations.RenameField(
mode... | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-07 20:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('basket', '0002_basketitem_product'),
]
operations = [
migrations.RenameField(
... | Python | 0.000013 |
4177655955f38eae919627bd75e0ee7a0c37c0c5 | Simplify loading logger | calaccess_raw/management/commands/loadcalaccessrawfile.py | calaccess_raw/management/commands/loadcalaccessrawfile.py | import csv
from django.db import connection
from django.db.models.loading import get_model
from django.core.management.base import LabelCommand
from calaccess_raw.management.commands import CalAccessCommand
class Command(CalAccessCommand, LabelCommand):
help = 'Load a cleaned CalAccess file for a model into the d... | import csv
from django.db import connection
from django.db.models.loading import get_model
from django.core.management.base import LabelCommand
from calaccess_raw.management.commands import CalAccessCommand
class Command(CalAccessCommand, LabelCommand):
help = 'Load a cleaned CalAccess file for a model into the d... | Python | 0.000025 |
20003796eb8f3949d931a4b8752fb07f2be39136 | Update utils.py | church/utils.py | church/utils.py | from functools import lru_cache
from os.path import (
join,
dirname,
abspath
)
PATH = abspath(join(dirname(__file__), 'data'))
@lru_cache(maxsize=None)
def pull(filename, lang='en_us'):
"""
Function for getting data from text files in data/
1. de_de - Folder for Germany.
2. en_us - Folde... | from functools import lru_cache
from os.path import (
join,
dirname,
abspath
)
PATH = abspath(join(dirname(__file__), 'data'))
__all__ = ['priest']
@lru_cache(maxsize=None)
def pull(filename, lang='en_us'):
"""
Function for getting data from text files in data/
1. de_de - Folder for Germany.... | Python | 0.000001 |
3c978eab962ed8a6158df2266852a1b1a47c4ec7 | add more terminal nodes | gdcdatamodel/query.py | gdcdatamodel/query.py | from psqlgraph import Node, Edge
traversals = {}
terminal_nodes = ['annotations', 'centers', 'archives', 'tissue_source_sites',
'files', 'related_files', 'describing_files',
'clinical_metadata_files', 'experiment_metadata_files', 'run_metadata_files',
'analysis_met... | from psqlgraph import Node, Edge
traversals = {}
terminal_nodes = ['annotations', 'centers', 'archives', 'tissue_source_sites',
'files', 'related_files', 'describing_files']
def construct_traversals(root, node, visited, path):
recurse = lambda neighbor: (
neighbor
# no backtrack... | Python | 0 |
7c6c8e9ed2b89c7fa15992b5b68c793a53b327d8 | fix test case to run on_commit hook before assertion | django_datawatch/tests/test_trigger_update.py | django_datawatch/tests/test_trigger_update.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals, print_function
try:
from unittest import mock
except ImportError:
import mock
from django.db import transaction
from django.test.testcases import TestCase, override_settings
from django_datawatch.backends.base import BaseBackend
from django_dat... | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals, print_function
from django_datawatch.backends.base import BaseBackend
try:
from unittest import mock
except ImportError:
import mock
from django.test.testcases import TestCase, override_settings
from django_datawatch.datawatch import datawatch... | Python | 0.000001 |
26549566bc502dece76ad596126b219dc5c8991c | Fix for IPv6 Python sockets binding localhost problem | lib/py/src/transport/TSocket.py | lib/py/src/transport/TSocket.py | #!/usr/bin/env python
#
# Copyright (c) 2006- Facebook
# Distributed under the Thrift Software License
#
# See accompanying file LICENSE or visit the Thrift site at:
# http://developers.facebook.com/thrift/
from TTransport import *
import socket
class TSocket(TTransportBase):
"""Socket implementation of TTransport... | #!/usr/bin/env python
#
# Copyright (c) 2006- Facebook
# Distributed under the Thrift Software License
#
# See accompanying file LICENSE or visit the Thrift site at:
# http://developers.facebook.com/thrift/
from TTransport import *
import socket
class TSocket(TTransportBase):
"""Socket implementation of TTransport... | Python | 0.000001 |
2323699ae6b266823b30784293b2d1d900d94700 | Bump aioTV version. | rest_framework_swagger/__init__.py | rest_framework_swagger/__init__.py | VERSION = '0.3.5-aio-v3'
DEFAULT_SWAGGER_SETTINGS = {
'exclude_namespaces': [],
'api_version': '',
'api_key': '',
'token_type': 'Token',
'enabled_methods': ['get', 'post', 'put', 'patch', 'delete'],
'is_authenticated': False,
'is_superuser': False,
'permission_denied_handler': None,
... | VERSION = '0.3.5-aio-v2'
DEFAULT_SWAGGER_SETTINGS = {
'exclude_namespaces': [],
'api_version': '',
'api_key': '',
'token_type': 'Token',
'enabled_methods': ['get', 'post', 'put', 'patch', 'delete'],
'is_authenticated': False,
'is_superuser': False,
'permission_denied_handler': None,
... | Python | 0 |
00bf40ba386d7d1ffebcc1a41766250e0fc975ac | Add related name fields | src/core/models/base.py | src/core/models/base.py | from django.db import models
from django.contrib.auth.models import User
class Location(models.Model):
class Meta:
app_label = "core"
x = models.DecimalField(max_digits=10, decimal_places=5)
y = models.DecimalField(max_digits=10, decimal_places=5)
def __str__(self):
return "x:" + str(self.x) + ", y:" + str... | from django.db import models
from django.contrib.auth.models import User
class Location(models.Model):
class Meta:
app_label = "core"
x = models.DecimalField(max_digits=10, decimal_places=5)
y = models.DecimalField(max_digits=10, decimal_places=5)
def __str__(self):
return "x:" + str(self.x) + ", y:" + str... | Python | 0.000001 |
2edb2145f6f7447a7c659d7eeb51c7b75aa0c6d4 | Add generate username signal | rhinocloud/contrib/auth/signals.py | rhinocloud/contrib/auth/signals.py | from django.contrib.auth.models import User
from rhinocloud.utils import random_generator
def generate_username_from_email(sender, instance, **kwargs):
if sender == User:
username = instance.email
if len(username) > 30:
username = random_generator(username[:25])
instance.userna... | from django.contrib.auth.models import User
from rhinocloud.utils import random_generator
def username_shorten(sender, instance, **kwargs):
if sender == User:
if len(instance.username) > 30:
instance.username = random_generator(instance.username[:25])
def first_name_shorten(sender, instance, ... | Python | 0.000297 |
916638e11ef20e2976c81f0e8230079cf96a3c3a | Set DJANGO_SETTINGS_MODULE env variable. | ibms_project/wsgi.py | ibms_project/wsgi.py | """
WSGI config for IBMS project.
It exposes the WSGI callable as a module-level variable named ``application``.
"""
import dotenv
from django.core.wsgi import get_wsgi_application
import os
from pathlib import Path
# These lines are required for interoperability between local and container environments.
d = Path(__fi... | """
WSGI config for IBMS project.
It exposes the WSGI callable as a module-level variable named ``application``.
"""
import dotenv
from django.core.wsgi import get_wsgi_application
import os
from pathlib import Path
# These lines are required for interoperability between local and container environments.
d = Path(__fi... | Python | 0 |
2636d76fa4d9dd820fd673bc6044f4c3ccdfd0b1 | Fix permissions fixture problem. | src/encoded/tests/test_permissions.py | src/encoded/tests/test_permissions.py | import pytest
@pytest.fixture
def users(testapp):
from .sample_data import URL_COLLECTION
url = '/labs/'
for item in URL_COLLECTION[url]:
res = testapp.post_json(url, item, status=201)
url = '/awards/'
for item in URL_COLLECTION[url]:
res = testapp.post_json(url, item, status=201)
... | import pytest
@pytest.datafixture
def users(app):
from webtest import TestApp
environ = {
'HTTP_ACCEPT': 'application/json',
'REMOTE_USER': 'TEST',
}
testapp = TestApp(app, environ)
from .sample_data import URL_COLLECTION
url = '/labs/'
for item in URL_COLLECTION[url]:
... | Python | 0 |
1a6c6228927b343071d0fc5e1959920bf30e6252 | clean up | darkoob/social/models.py | darkoob/social/models.py | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from neomodel import StructuredNode, IntegerProperty, RelationshipTo, RelationshipFrom
from darkoob.book.models import Quote, Book
import datetime
from django.utils.timezone import utc
SEX_CHOICES = ... | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from neomodel import StructuredNode, IntegerProperty, RelationshipTo, RelationshipFrom
from darkoob.book.models import Quote, Book
import datetime
from django.utils.timezone import utc
SEX_CHOICES = ... | Python | 0.000001 |
d51a13ed70c157d90c2d77461ad1747f7ce12e7c | Improve comment syntax | openfisca_country_template/variables/taxes.py | openfisca_country_template/variables/taxes.py | # -*- coding: utf-8 -*-
# This file defines the variables of our legislation.
# A variable is property of a person, or an entity (e.g. a household).
# See http://openfisca.org/doc/variables.html
# Import from openfisca-core the common python objects used to code the legislation in OpenFisca
from openfisca_core.model_... | # -*- coding: utf-8 -*-
# This file defines the variables of our legislation.
# A variable is property of a person, or an entity (e.g. a household).
# See http://openfisca.org/doc/variables.html
# Import from openfisca-core the common python objects used to code the legislation in OpenFisca
from openfisca_core.model_... | Python | 0.000015 |
da1df870f5d5b7703c4c4c3a6b8cb7d140778469 | Set default task target to 100. | source/vistas/core/task.py | source/vistas/core/task.py | from threading import RLock
class Task:
STOPPED = 'stopped'
RUNNING = 'running'
INDETERMINATE = 'indeterminate'
COMPLETE = 'complete'
SHOULD_STOP = 'should_stop'
tasks = []
def __init__(self, name, description=None, target=100, progress=0):
self.name = name
self.descripti... | from threading import RLock
class Task:
STOPPED = 'stopped'
RUNNING = 'running'
INDETERMINATE = 'indeterminate'
COMPLETE = 'complete'
SHOULD_STOP = 'should_stop'
tasks = []
def __init__(self, name, description=None, target=0, progress=0):
self.name = name
self.description... | Python | 0.00002 |
285d5f43b112354f1d5c05f9dd6b050e30f517e4 | Remove country=DE parameter | geocoder/gisgraphy.py | geocoder/gisgraphy.py | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
from geocoder.location import BBox
from geocoder.base import OneResult, MultipleResultsQuery
class GisgraphyResult(OneResult):
@property
def lat(self):
return self.raw.get('lat')
@property
def lng(se... | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
from geocoder.location import BBox
from geocoder.base import OneResult, MultipleResultsQuery
class GisgraphyResult(OneResult):
@property
def lat(self):
return self.raw.get('lat')
@property
def lng(se... | Python | 0.00039 |
9f725eae63a7851498a82d3bc06414dc788c0ed7 | Update comment style in admin.py | impersonate/admin.py | impersonate/admin.py | # -*- coding: utf-8 -*-
'''Admin models for impersonate app.'''
import logging
from django.conf import settings
from django.contrib import admin
from .models import ImpersonationLog
logger = logging.getLogger(__name__)
MAX_FILTER_SIZE = getattr(settings, 'IMPERSONATE_MAX_FILTER_SIZE', 100)
def friendly_name(user... | # -*- coding: utf-8 -*-
'''Admin models for impersonate app.'''
import logging
from django.conf import settings
from django.contrib import admin
from .models import ImpersonationLog
logger = logging.getLogger(__name__)
MAX_FILTER_SIZE = getattr(settings, 'IMPERSONATE_MAX_FILTER_SIZE', 100)
def friendly_name(user... | Python | 0 |
6d9efe005e346aaef359f369c89d007da1b83189 | add more untested changes for slack integration | lampeflaske.py | lampeflaske.py | #!/usr/bin/env python3
import pprint
import os
import lamper
from flask import Flask, request, jsonify
from flask_api import status
app = Flask(__name__)
@app.route("/", methods=['POST', 'GET'])
def hello():
pprint.pprint(request.form)
if request.form.get('command') != '/lamper':
return "wrong com... | #!/usr/bin/env python3
import pprint
import os
import lamper
from flask import Flask, request
from flask_api import status
app = Flask(__name__)
@app.route("/", methods=['POST', 'GET'])
def hello():
pprint.pprint(request.form)
if request.form.get('command') != '/lamper':
return "wrong command" , s... | Python | 0 |
70aab65ba167cfd4e24452ca7dd03fe1cabaf6a1 | create block on node2 | test/functional/feature_asset_reorg.py | test/functional/feature_asset_reorg.py | #!/usr/bin/env python3
# Copyright (c) 2019-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import SyscoinTestFramework
from test_framework.util import assert_equ... | #!/usr/bin/env python3
# Copyright (c) 2019-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import SyscoinTestFramework
from test_framework.util import assert_equ... | Python | 0.000002 |
1f9dea20b433e5b2a69f348d1a842d71a99bc56e | Modify tests | tests/chainerx_tests/unit_tests/routines_tests/test_evaluation.py | tests/chainerx_tests/unit_tests/routines_tests/test_evaluation.py | import chainer
from chainer import functions as F
import numpy
import chainerx
from chainerx_tests import dtype_utils
from chainerx_tests import op_utils
_in_out_eval_dtypes = [
(('float16', 'int16'), 'float32'),
(('float32', 'int32'), 'float32'),
(('float64', 'int64'), 'float64'),
(('float32', 'int... | import chainer
from chainer import functions as F
import numpy
import chainerx
from chainerx_tests import dtype_utils
from chainerx_tests import op_utils
_in_out_eval_dtypes = dtype_utils._permutate_dtype_mapping([
(('float16', 'float16'), 'float16'),
(('float32', 'float32'), 'float32'),
(('float64', 'f... | Python | 0.000001 |
67adba196ed29a2a17911e154dc814dae89953ec | Correct log level choices | coalib/parsing/DefaultArgParser.py | coalib/parsing/DefaultArgParser.py | import argparse
from coalib.misc.i18n import _
default_arg_parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=_("coala is a simple COde AnaLysis Application. Its goal is "
"to make static code analysis easy and convenient for all "
... | import argparse
from coalib.misc.i18n import _
default_arg_parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=_("coala is a simple COde AnaLysis Application. Its goal is "
"to make static code analysis easy and convenient for all "
... | Python | 0 |
8cf3e7a822517ba12abe72def6d4a2cd0180fb19 | Fix autonomous mode merge | robot/robot/src/autonomous/main.py | robot/robot/src/autonomous/main.py |
try:
import wpilib
except ImportError:
from pyfrc import wpilib
class main(object):
'''autonomous program'''
DEFAULT = True
MODE_NAME = "Tim's Mode"
def __init__ (self, components):
''' initialize'''
super().__init__()
self.drive = components['d... |
try:
import wpilib
except ImportError:
from pyfrc import wpilib
class main(object):
'''autonomous program'''
DEFAULT = True
MODE_NAME = "Tim's Mode"
def __init__ (self, components):
''' initialize'''
super().__init__()
self.drive = components['d... | Python | 0.000083 |
c435f6039b344829380db4bf92f80ff4d5de8972 | fixes scrolling_benchmark. | tools/telemetry/telemetry/core/chrome/android_platform_backend.py | tools/telemetry/telemetry/core/chrome/android_platform_backend.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import sys
from telemetry.core.chrome import platform
from telemetry.core.chrome import platform_backend
# Get build/android s... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import sys
from telemetry.core.chrome import platform
from telemetry.core.chrome import platform_backend
# Get build/android s... | Python | 0.999861 |
9963642c1cc05fb6d9dfe397b9ed811d4f7e3d26 | add 4.6.1 and 3.10.1 (#24701) | var/spack/repos/builtin/packages/py-importlib-metadata/package.py | var/spack/repos/builtin/packages/py-importlib-metadata/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyImportlibMetadata(PythonPackage):
"""Read metadata from Python packages."""
homepag... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyImportlibMetadata(PythonPackage):
"""Read metadata from Python packages."""
homepag... | Python | 0 |
a2749190545a6765a479777b1ea97d2f9090593f | clean up project config a bit | jailscraper/project_config.py | jailscraper/project_config.py | """ProPublica specific configuration and utilities"""
import boto3
import botocore
import os
### Helpers
def get_secrets():
"""Get all environment variables associated with this project.
Reads environment variables that start with PROJECT_SLUG, strips out the slug
and adds them to a dictionary.
"""
... | """ProPublica specific configuration and utilities"""
import os
PROJECT_SLUG = 'cookcountyjail2'
INMATE_URL_TEMPLATE = 'http://www2.cookcountysheriff.org/search2/details.asp?jailnumber={0}'
"""Sets the maximum jail number to scan for by default.
If the subsequent jail number returns a 2xx status code, it will be inc... | Python | 0 |
9f531eec31e141b458c4c7896bebb16611cc7b00 | Refactor calories plugin (#503) | jarviscli/plugins/calories.py | jarviscli/plugins/calories.py | from plugin import plugin
from colorama import Back, Fore, Style
@plugin("calories")
class calories:
"""
Tells the recommended daily calorie intake, also recommends
calories for weight add and loss.(Source 1)
It is based on gender, age, height and weight.
Uses the Miffin-St Jeor Equation as it is ... | from plugin import plugin
@plugin("calories")
def calories(jarvis, s):
"""
Tells the recommended daily calorie intake, also recommends
calories for weight add and loss.(Source 1)
It is based on gender, age, height and weight.
Uses the Miffin-St Jeor Equation as it is considered the
most accura... | Python | 0 |
dde62362955ca4b10f3c1fec4e3b7777b03141f5 | remove ContextDict since std has ChainMap | jasily/collection/__init__.py | jasily/collection/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017~2999 - cologler <skyoflw@gmail.com>
# ----------
#
# ----------
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017~2999 - cologler <skyoflw@gmail.com>
# ----------
#
# ----------
from collections import KeysView, ValuesView, ItemsView, MutableMapping
_NO_VALUE = object()
class ContextDict(MutableMapping):
'''context dict can override base_dict.'''
def ... | Python | 0.000013 |
bca2ea9c72669c4877d6c9be74a2c58f8341ce61 | Update Portuguese lexical attributes | spacy/lang/pt/lex_attrs.py | spacy/lang/pt/lex_attrs.py | # coding: utf8
from __future__ import unicode_literals
from ...attrs import LIKE_NUM
_num_words = ['zero', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete',
'oito', 'nove', 'dez', 'onze', 'doze', 'treze', 'catorze',
'quinze', 'dezasseis', 'dezassete', 'dezoito', 'dezanove', 'vinte'... | # coding: utf8
from __future__ import unicode_literals
# Number words
NUM_WORDS = set("""
zero um dois três quatro cinco seis sete oito nove dez onze doze treze catorze
quinze dezasseis dezassete dezoito dezanove vinte trinta quarenta cinquenta
sessenta setenta oitenta noventa cem mil milhão bilião trilião quadriliã... | Python | 0.000001 |
e635d6a1c4ca8c138a5bd288250f94bcd82bb8a8 | Remove unnecessary imports. | vistrails/tests/resources/upgrades/init.py | vistrails/tests/resources/upgrades/init.py | from vistrails.core.modules.vistrails_module import Module
from vistrails.core.modules.config import IPort, OPort
from vistrails.core.upgradeworkflow import UpgradeModuleRemap
class TestUpgradeA(Module):
_input_ports = [IPort("aaa", "basic:String")]
_output_ports = [OPort("zzz", "basic:Integer")]
class TestU... | from vistrails.core.modules.vistrails_module import Module
from vistrails.core.modules.config import IPort, OPort
from vistrails.core.upgradeworkflow import UpgradeWorkflowHandler, \
UpgradePackageRemap, UpgradeModuleRemap
class TestUpgradeA(Module):
_input_ports = [IPort("aaa", "basic:String")]
_output_po... | Python | 0.000001 |
a2b19e7fd6b0004e4fa18b6d1b20f7347ca1964c | Fix wrong indentation | command/export.py | command/export.py | #!/usr/bin/env python2
# coding=utf-8
import json
import urllib2
import logging
import base64
from config import global_config
from bddown_core import Pan, GetFilenameError
def export(links):
for link in links:
pan = Pan(link)
count = 1
while count != 0:
link, filename, count... | #!/usr/bin/env python2
# coding=utf-8
import json
import urllib2
import logging
import base64
from config import global_config
from bddown_core import Pan, GetFilenameError
def export(links):
for link in links:
pan = Pan(link)
count = 1
while count != 0:
link, filename, count... | Python | 0.810919 |
24b86c78a6420006eabf6c27535f946edc612385 | Handle no tags in repository better | git_gutter_compare.py | git_gutter_compare.py | import sublime
import sublime_plugin
ST3 = int(sublime.version()) >= 3000
if ST3:
from GitGutter.view_collection import ViewCollection
else:
from view_collection import ViewCollection
class GitGutterCompareCommit(sublime_plugin.WindowCommand):
def run(self):
self.view = self.window.active_view()
... | import sublime
import sublime_plugin
ST3 = int(sublime.version()) >= 3000
if ST3:
from GitGutter.view_collection import ViewCollection
else:
from view_collection import ViewCollection
class GitGutterCompareCommit(sublime_plugin.WindowCommand):
def run(self):
self.view = self.window.active_view()
... | Python | 0 |
920872db456987e5bd5002b3bf3fc2168dcbdff4 | fix name | django_extra_tools/conf/defaults.py | django_extra_tools/conf/defaults.py | """Default configuration"""
# auth.backends.ThroughSuperuserModelBackend username separator
AUTH_BACKEND_USERNAME_SEPARATOR = ':'
XHR_MIDDLEWARE_ALLOWED_ORIGINS = '*'
XHR_MIDDLEWARE_ALLOWED_METHODS = ['POST', 'GET', 'OPTIONS', 'PUT', 'DELETE']
XHR_MIDDLEWARE_ALLOWED_HEADERS = ['Content-Type', 'Authorization', 'Locati... | """Default configuration"""
# auth.backends.SuperUserAuthenticateMixin username separator
AUTH_BACKEND_USERNAME_SEPARATOR = ':'
XHR_MIDDLEWARE_ALLOWED_ORIGINS = '*'
XHR_MIDDLEWARE_ALLOWED_METHODS = ['POST', 'GET', 'OPTIONS', 'PUT', 'DELETE']
XHR_MIDDLEWARE_ALLOWED_HEADERS = ['Content-Type', 'Authorization', 'Location... | Python | 0.019891 |
ceac948c3c1e4fc59faf5d745af06516ec6c502e | Improve code quality | conda-envs.15m.py | conda-envs.15m.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <bitbar.title>Anaconda Environments</bitbar.title>
# <bitbar.version>v1.1</bitbar.version>
# <bitbar.author>Darius Morawiec</bitbar.author>
# <bitbar.author.github>nok</bitbar.author.github>
# <bitbar.desc>Useful BitBar plugin to list all created conda environments and t... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <bitbar.title>Anaconda Environments</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Darius Morawiec</bitbar.author>
# <bitbar.author.github>nok</bitbar.author.github>
# <bitbar.desc>Useful BitBar plugin to list all created conda environments and t... | Python | 0.000063 |
a4a01c466c916f5c4ff44d40bc5e052e98951f1d | Bump version | sqlitebiter/__version__.py | sqlitebiter/__version__.py | __author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016, {}".format(__author__)
__license__ = "MIT License"
__version__ = "0.29.1"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| __author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016, {}".format(__author__)
__license__ = "MIT License"
__version__ = "0.29.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| Python | 0 |
05458457f12618cc69970cd2bda87e25e29384a4 | simplify the code (Thx Stefan) | doc/examples/plot_peak_local_max.py | doc/examples/plot_peak_local_max.py | """
====================
Finding local maxima
====================
The ``peak_local_max`` function returns the coordinates of local peaks (maxima)
in an image. A maximum filter is used for finding local maxima. This operation
dilates the original image and merges neighboring local maxima closer than the
size of the di... | """
====================
Finding local maxima
====================
The ``peak_local_max`` function returns the coordinates of local peaks (maxima)
in an image. A maximum filter is used for finding local maxima. This operation
dilates the original image and merges neighboring local maxima closer than the
size of the di... | Python | 0.000001 |
e00a82a31de820f28474cb5de47c5715dafd8d18 | use the largest remainder method for distributing change in ratio_split() | hordak/utilities/money.py | hordak/utilities/money.py | from decimal import Decimal
from hordak.defaults import DECIMAL_PLACES
def ratio_split(amount, ratios):
""" Split in_value according to the ratios specified in `ratios`
This is special in that it ensures the returned values always sum to
in_value (i.e. we avoid losses or gains due to rounding errors). As... | from decimal import Decimal
def ratio_split(amount, ratios):
""" Split in_value according to the ratios specified in `ratios`
This is special in that it ensures the returned values always sum to
in_value (i.e. we avoid losses or gains due to rounding errors). As a
result, this method returns a list o... | Python | 0 |
29d151366d186ed75da947f2861741ed87af902b | Add missing import to settings | website/addons/badges/settings/__init__.py | website/addons/badges/settings/__init__.py | # -*- coding: utf-8 -*-
import logging
from .defaults import * # noqa
logger = logging.getLogger(__name__)
try:
from .local import * # noqa
except ImportError as error:
logger.warn('No local.py settings file found')
| from .defaults import * # noqa
logger = logging.getLogger(__name__)
try:
from .local import * # noqa
except ImportError as error:
logger.warn('No local.py settings file found')
| Python | 0.000001 |
6c64674447bd988eef80a4a927acde2eabe04236 | Modify error messag | googkit/lib/plugin.py | googkit/lib/plugin.py | import os
import googkit.lib.path
from googkit.lib.error import GoogkitError
INIT_FILE = '__init__.py'
COMMAND_FILE = 'command.py'
def load(tree):
base_dir = googkit.lib.path.plugin()
for filename in os.listdir(base_dir):
plugin_dir = os.path.join(base_dir, filename)
if not os.path.isdir(p... | import os
import googkit.lib.path
from googkit.lib.error import GoogkitError
INIT_FILE = '__init__.py'
COMMAND_FILE = 'command.py'
def load(tree):
base_dir = googkit.lib.path.plugin()
for filename in os.listdir(base_dir):
plugin_dir = os.path.join(base_dir, filename)
if not os.path.isdir(p... | Python | 0.000001 |
1b84cc660848fdee7ed68c17772542956f47e89d | Add `lower` parameter to grab.tools.russian::slugify method | grab/tools/russian.py | grab/tools/russian.py | # coding: utf-8
from __future__ import absolute_import
from ..tools.encoding import smart_unicode
from pytils.translit import translify
import re
MONTH_NAMES = u'января февраля марта апреля мая июня июля августа '\
u'сентября октября ноября декабря'.split()
RE_NOT_ENCHAR = re.compile(u'[^-a-zA-Z0-9]', ... | # coding: utf-8
from __future__ import absolute_import
from ..tools.encoding import smart_unicode
from pytils.translit import translify
import re
MONTH_NAMES = u'января февраля марта апреля мая июня июля августа '\
u'сентября октября ноября декабря'.split()
RE_NOT_ENCHAR = re.compile(u'[^-a-zA-Z0-9]', ... | Python | 0.000001 |
88f0faa73beeafc30248210c4c6b99b7a9ccbdba | Add AUTOMATIC_REVERSE_PTR option to cfg | config_template.py | config_template.py | import os
basedir = os.path.abspath(os.path.dirname(__file__))
# BASIC APP CONFIG
WTF_CSRF_ENABLED = True
SECRET_KEY = 'We are the world'
BIND_ADDRESS = '127.0.0.1'
PORT = 9393
LOGIN_TITLE = "PDNS"
# TIMEOUT - for large zones
TIMEOUT = 10
# LOG CONFIG
LOG_LEVEL = 'DEBUG'
LOG_FILE = 'logfile.log'
# For Docker, leave ... | import os
basedir = os.path.abspath(os.path.dirname(__file__))
# BASIC APP CONFIG
WTF_CSRF_ENABLED = True
SECRET_KEY = 'We are the world'
BIND_ADDRESS = '127.0.0.1'
PORT = 9393
LOGIN_TITLE = "PDNS"
# TIMEOUT - for large zones
TIMEOUT = 10
# LOG CONFIG
LOG_LEVEL = 'DEBUG'
LOG_FILE = 'logfile.log'
# For Docker, leave ... | Python | 0 |
0cc0d4a5ddf938f176c2384503ef88bb31c91898 | Transform new schema to old schema, to keep share_v1 up to date | scrapi/processing/elasticsearch.py | scrapi/processing/elasticsearch.py | from __future__ import absolute_import
import logging
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import NotFoundError
from elasticsearch.exceptions import ConnectionError
from scrapi import settings
from scrapi.processing.base import BaseProcessor
from scrapi.base.transformer import JSONTra... | from __future__ import absolute_import
import logging
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import NotFoundError
from elasticsearch.exceptions import ConnectionError
from scrapi import settings
from scrapi.processing.base import BaseProcessor
logger = logging.getLogger(__name__)
logg... | Python | 0 |
959897478bbda18f02aa6e38f2ebdd837581f1f0 | Fix test for changed SctVerificationResult | tests/test_sct_verify_signature.py | tests/test_sct_verify_signature.py | from os.path import join, dirname
from utlz import flo
from ctutlz.sct.verification import verify_signature
def test_verify_signature():
basedir = join(dirname(__file__), 'data', 'test_sct_verify_signature')
signature_input = \
open(flo('{basedir}/signature_input_valid.bin'), 'rb').read()
signa... | from os.path import join, dirname
from utlz import flo
from ctutlz.sct.verification import verify_signature
def test_verify_signature():
basedir = join(dirname(__file__), 'data', 'test_sct_verify_signature')
signature_input = \
open(flo('{basedir}/signature_input_valid.bin'), 'rb').read()
signa... | Python | 0.000001 |
f72277113ce8155a1725bb69929c83cb95183bd8 | order events by room | pyconca2017/pycon_schedule/models.py | pyconca2017/pycon_schedule/models.py | from datetime import datetime
from django.db import models
""" Presentation """
class Speaker(models.Model):
""" Who """
email = models.EmailField(unique=True)
full_name = models.CharField(max_length=255)
bio = models.TextField(default='')
twitter_username = models.CharField(max_length=255, nul... | from datetime import datetime
from django.db import models
""" Presentation """
class Speaker(models.Model):
""" Who """
email = models.EmailField(unique=True)
full_name = models.CharField(max_length=255)
bio = models.TextField(default='')
twitter_username = models.CharField(max_length=255, nul... | Python | 0.998462 |
9cb554c13ae3cec85fd2a3bf0afd9ae2b6cca96a | Refactor target.py | construi/target.py | construi/target.py |
import construi.console as console
from compose.project import Project
from compose.cli.docker_client import docker_client
import dockerpty
import sys
class Target(object):
def __init__(self, config):
self.config = config
self.project = Project.from_dicts(
'construi', config.service... |
import construi.console as console
from compose.project import Project
from compose.cli.docker_client import docker_client
import dockerpty
import sys
class Target(object):
def __init__(self, config):
self.config = config
self.project = Project.from_dicts(
'construi', config.service... | Python | 0.000002 |
b6a5dcef6a612098dc6abddec831980792c23ddf | Allow API key to be set in config for rottentomatoes_list | flexget/plugins/input/rottentomatoes_list.py | flexget/plugins/input/rottentomatoes_list.py | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.cached_input import cached
try:
from flexget.plugins.api_rottentomatoes import lists
except ImportError:
raise... | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.cached_input import cached
try:
from flexget.plugins.api_rottentomatoes import lists
except ImportError:
raise... | Python | 0 |
e73d69d258ab595ee8353efd85a6f37829b47b2b | update docstring | pysat/instruments/methods/general.py | pysat/instruments/methods/general.py | # -*- coding: utf-8 -*-
"""Provides generalized routines for integrating instruments into pysat.
"""
from __future__ import absolute_import, division, print_function
import pandas as pds
import pysat
import logging
logger = logging.getLogger(__name__)
def list_files(tag=None, sat_id=None, data_path=None, format_s... | # -*- coding: utf-8 -*-
"""Provides generalized routines for integrating instruments into pysat.
"""
from __future__ import absolute_import, division, print_function
import pandas as pds
import pysat
import logging
logger = logging.getLogger(__name__)
def list_files(tag=None, sat_id=None, data_path=None, format_s... | Python | 0 |
6b6d3779cd23c188c808387b9f4095ea75da3284 | Add a way to get the resources depended on by an output | heat/engine/output.py | heat/engine/output.py | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | Python | 0.99996 |
0f43efc9c611f4b8bd93a42f85db3e14106915ba | fix burst not work bug | pyspider/database/local/projectdb.py | pyspider/database/local/projectdb.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<roy@binux.me>
# http://binux.me
# Created on 2015-01-17 12:32:17
import os
import re
import six
import logging
from pyspider.database.base.projectdb import ProjectDB as BaseProjectDB
class Projec... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<roy@binux.me>
# http://binux.me
# Created on 2015-01-17 12:32:17
import os
import re
import six
import logging
from pyspider.database.base.projectdb import ProjectDB as BaseProjectDB
class Projec... | Python | 0.000001 |
74e4d69a6ab501e11ff266d1ad77992d0203729f | Include os stuff | thumbor_rackspace/loaders/cloudfiles_loader.py | thumbor_rackspace/loaders/cloudfiles_loader.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2013 theiconic.com.au development@theiconic.com.au
from os.path import join, expanduser
import pyrax
def l... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2013 theiconic.com.au development@theiconic.com.au
import pyrax
def load(context, path, callback):
if(... | Python | 0 |
d55210495fde133b8b76ee1f55e593dd43389e0e | Update to use new HTTP APIs. | src/livestreamer/plugins/ongamenet.py | src/livestreamer/plugins/ongamenet.py | from livestreamer.exceptions import NoStreamsError
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http
from livestreamer.stream import RTMPStream
import re
class Ongamenet(Plugin):
StreamURL = "http://dostream.lab.so/stream.php"
SWFURL = "http://www.ongamenet.com/front/ongame/live... | from livestreamer.compat import str, bytes
from livestreamer.exceptions import PluginError, NoStreamsError
from livestreamer.plugin import Plugin
from livestreamer.stream import RTMPStream
from livestreamer.utils import urlget
import re
class Ongamenet(Plugin):
StreamURL = "http://dostream.lab.so/stream.php"
... | Python | 0 |
e78d613f66df5f10b59e47b6cfce619182d1297f | Update run.py | src/main/app-resources/py-ndvi/run.py | src/main/app-resources/py-ndvi/run.py | #!/usr/bin/env python
import site
import os
import sys
site.addsitedir('/application/share/python/lib/python2.6/site-packages')
#print sys.path
#os.environ['PYTHONUSERBASE'] = '/application/share/python'
#print 'Base:', site.USER_BASE
#print 'Site:', site.USER_SITE
import ndvi
sys.path.append('/usr/lib/ciop/python/... | #!/usr/bin/env python
import site
import os
import sys
site.addsitedir('/application/share/python/lib/python2.6/site-packages')
#print sys.path
#os.environ['PYTHONUSERBASE'] = '/application/share/python'
#print 'Base:', site.USER_BASE
#print 'Site:', site.USER_SITE
import ndvi
sys.path.append('/usr/lib/ciop/python/... | Python | 0.000001 |
0048794fd6e71f58bf88d84ddefb1e9a0194efca | Fix the mock-image used in test-steps unittests. | tests/test_steps/test_source_extraction.py | tests/test_steps/test_source_extraction.py | import unittest
import numpy as np
from tkp.testutil import db_subs, data
from ConfigParser import SafeConfigParser
from tkp.config import parse_to_dict
from tkp.testutil.data import default_job_config
from tkp.testutil import Mock
import tkp.steps.source_extraction
import tkp.accessors
class MockImage(Mock):
def... | import unittest
from tkp.testutil import db_subs, data
from ConfigParser import SafeConfigParser
from tkp.config import parse_to_dict
from tkp.testutil.data import default_job_config
from tkp.testutil import Mock
import tkp.steps.source_extraction
import tkp.accessors
class MockImage(Mock):
def extract(self, *args... | Python | 0 |
edf1e96e56272a10ad767f13e6e8cc886f98055c | Test consecutive Coordinator.heartbeat calls #17 | tests/unit/test_stream/test_coordinator.py | tests/unit/test_stream/test_coordinator.py | import functools
from bloop.stream.shard import Shard
from . import build_get_records_responses
def test_coordinator_repr(coordinator):
coordinator.stream_arn = "repr-stream-arn"
assert repr(coordinator) == "<Coordinator[repr-stream-arn]>"
def test_heartbeat(coordinator, session):
find_records_id = "id-... | import functools
from bloop.stream.shard import Shard
from . import build_get_records_responses
def test_coordinator_repr(coordinator):
coordinator.stream_arn = "repr-stream-arn"
assert repr(coordinator) == "<Coordinator[repr-stream-arn]>"
def test_heartbeat_latest(coordinator, session):
find_records_id... | Python | 0 |
213d6a42d505fb7ca320873cafdc187cf65d10ed | add unit tests for escaping curlies | tests/unit/pypyr/format/string_test.py | tests/unit/pypyr/format/string_test.py | """"string.py unit tests."""
import pypyr.format.string
import pytest
def test_string_interpolate_works():
context = {'key1': 'down', 'key2': 'valleys', 'key3': 'value3'}
input_string = 'Piping {key1} the {key2} wild'
output = pypyr.format.string.get_interpolated_string(input_string, context)
assert ... | """"string.py unit tests."""
import pypyr.format.string
import pytest
def test_string_interpolate_works():
context = {'key1': 'down', 'key2': 'valleys', 'key3': 'value3'}
input_string = 'Piping {key1} the {key2} wild'
output = pypyr.format.string.get_interpolated_string(input_string, context)
assert ... | Python | 0 |
e84b2e11088878d44433bfc767b8abba79eca0a7 | use environment variable for config folder | litleSdkPython/Configuration.py | litleSdkPython/Configuration.py | #Copyright (c) 2011-2012 Litle & Co.
#
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "Software"), to deal in the Software without
#restriction, including without limitation the rights to use,
#copy, modify, merge, publish, distri... | #Copyright (c) 2011-2012 Litle & Co.
#
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "Software"), to deal in the Software without
#restriction, including without limitation the rights to use,
#copy, modify, merge, publish, distri... | Python | 0.000001 |
24e42d5d4a21c1f3ffd36a163b89ee7f39375945 | Update P05_trafficLight add assertion to check for red light | books/AutomateTheBoringStuffWithPython/Chapter10/P05_trafficLight.py | books/AutomateTheBoringStuffWithPython/Chapter10/P05_trafficLight.py | # This program emulates traffic lights at intersections with assertions
market_2nd = {"ns": "green", "ew": "red"}
mission_16th = {"ns": "red", "ew": "green"}
def switchLights(stoplight):
for key in stoplight.keys():
if stoplight[key] == "green":
stoplight[key] = "yellow"
elif stopligh... | # This program emulates traffic lights at intersections with assertions
market_2nd = {"ns": "green", "ew": "red"}
mission_16th = {"ns": "red", "ew": "green"}
def switchLights(stoplight):
for key in stoplight.keys():
if stoplight[key] == "green":
stoplight[key] = "yellow"
elif stopligh... | Python | 0 |
36db4fe3efad221618684547f9e12ca31a9614fd | Update (un)mapping columns set | src/ggrc/utils/rules.py | src/ggrc/utils/rules.py | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Mapping rules for Relationship validation and map:model import columns."""
import copy
def get_mapping_rules():
""" Get mappings rules as defined in business_object.js
Special cases:
Aduit has... | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Mapping rules for Relationship validation and map:model import columns."""
def get_mapping_rules():
""" Get mappings rules as defined in business_object.js
Special cases:
Aduit has direct mappin... | Python | 0.000001 |
304a220e99694ec6b41a31db8150c7f4604f6ef5 | Remove old logging import | flexget/components/notify/notifiers/gotify.py | flexget/components/notify/notifiers/gotify.py | from http import HTTPStatus
from requests.exceptions import RequestException
from urllib.parse import urljoin
from flexget import plugin
from flexget.event import event
from flexget.plugin import PluginWarning
from flexget.utils.requests import Session as RequestSession, TimedLimiter
plugin_name = 'gotify'
requests ... | import logging
from http import HTTPStatus
from requests.exceptions import RequestException
from urllib.parse import urljoin
from flexget import plugin
from flexget.event import event
from flexget.plugin import PluginWarning
from flexget.utils.requests import Session as RequestSession, TimedLimiter
plugin_name = 'g... | Python | 0.000001 |
77ac4b3cc97731c0fcb387a10fadd1509e057a6d | update with main function and header | controller/test.py | controller/test.py | #!/usr/bin/python2.7
"""
created_by: Micah Halter
created_date: 2/28/2015
last_modified_by: Micah Halter
last_modified_date: 3/2/2015
"""
#imports
import constants
import sys
sys.path.insert(0, "./view/")
import viewAssessment
import viewQuestion
import viewTopic
import viewSection
import viewCourse
i... | #!/usr/bin/python2.7
import constants
import sys
sys.path.insert(0, "./view/")
import viewAssessment
import viewQuestion
import viewTopic
import viewSection
import viewCourse
import viewUser
sys.path.insert(0, "./edit/")
import editAssessment
import editQuestion
import editTopic
import editSection
import editCourse
... | Python | 0 |
b8cec88e733237b94fafb2aa978dcb6b758c954f | Add string representation of Log | irclogview/models.py | irclogview/models.py | from django.db import models
from django.core.urlresolvers import reverse
from picklefield.fields import PickledObjectField
from . import utils
class Channel(models.Model):
name = models.SlugField(max_length=50, unique=True)
updated = models.DateTimeField(auto_now=True)
class Meta:
ordering = ['... | from django.db import models
from django.core.urlresolvers import reverse
from picklefield.fields import PickledObjectField
from . import utils
class Channel(models.Model):
name = models.SlugField(max_length=50, unique=True)
updated = models.DateTimeField(auto_now=True)
class Meta:
ordering = ['... | Python | 0.999989 |
28fd64565ea2e7b1e40e88e6121936d03a77b444 | Fix task set generator. | generic-8-link/generated/generate_task_set.py | generic-8-link/generated/generate_task_set.py | #!/usr/bin/python
template = '''
environment {{
robot_filename: "../robot/setup.robot"
environment_filename: "../environment/obstacles_{1_difficulty}.stl"
max_underestimate: 20.0
}}
generator {{
type: {2_generator_type}
seed: {6_seed}
keys: 2
keys: 3
keys: 5
keys: 7
keys: 11
keys: 13
keys: 17
... | #!/usr/bin/python
template = '''
environment {{
robot_filename: "../robot/setup.robot"
environment_filename: "../environment/obstacles_{1_difficulty}.stl"
max_underestimate: 20.0
}}
generator {{
type: {2_generator_type}
seed: {6_seed}
keys: 2
keys: 3
keys: 5
keys: 7
keys: 11
keys: 13
}}
index {{
... | Python | 0.000006 |
c62a658eb469e449372207f146f60375d7497f63 | update dataset api | ismrmrdpy/dataset.py | ismrmrdpy/dataset.py | # Copyright (c) 2014-2015 Ghislain Antony Vaillant.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of... | # Copyright (c) 2014-2015 Ghislain Antony Vaillant.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of... | Python | 0.000001 |
3effb540220f4ce1918d0210e882d926e268473f | Bump P4Runtime to v1.2.0 | tools/build/bazel/p4lang_workspace.bzl | tools/build/bazel/p4lang_workspace.bzl | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
P4RUNTIME_VER = "1.2.0"
P4RUNTIME_SHA = "0fce7e06c63e60a8cddfe56f3db3d341953560c054d4c09ffda0e84476124f5a"
def generate_p4lang():
http_archive(
name = "com_github_p4lang_p4runtime",
urls = ["https://github.com/p4lang/p4runtime/ar... | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
P4RUNTIME_VER = "1.0.0"
P4RUNTIME_SHA = "667464bd369b40b58dc9552be2c84e190a160b6e77137b735bd86e5b81c6adc0"
def generate_p4lang():
http_archive(
name = "com_github_p4lang_p4runtime",
urls = ["https://github.com/p4lang/p4runtime/ar... | Python | 0.000001 |
64e902fae3117c246272cbde943d013da1345b7b | Fix RenameField alteration | gravity/migrations/0003_tiltbridge_mdns_id.py | gravity/migrations/0003_tiltbridge_mdns_id.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2019-03-18 23:46
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('gravity', '0002_tilt_refactor'),
]
operations = [
... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2019-03-18 23:46
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('gravity', '0002_tilt_refactor'),
]
operations = [
... | Python | 0 |
fc4aada050fd995ecf5375871fa1e6ed1884293f | fix hail-apiserver.py module path (#4850) | hail/python/hail-apiserver/hail-apiserver.py | hail/python/hail-apiserver/hail-apiserver.py | import hail as hl
from hail.utils.java import Env, info
import logging
import flask
hl.init()
app = flask.Flask('hail-apiserver')
@app.route('/execute', methods=['POST'])
def execute():
code = flask.request.json
info(f'execute: {code}')
jir = Env.hail().expr.ir.IRParser.parse_value_ir(code, {... | import hail as hl
from hail.utils.java import Env, info
import logging
import flask
hl.init()
app = flask.Flask('hail-apiserver')
@app.route('/execute', methods=['POST'])
def execute():
code = flask.request.json
info(f'execute: {code}')
jir = Env.hail().expr.Parser.parse_value_ir(code, {}, {}... | Python | 0 |
1d10582d622ce6867a85d9e4e8c279ab7e4ab5ab | Revert "Don't complain about \r when core.autocrlf is on in Git" | src/etc/tidy.py | src/etc/tidy.py | #!/usr/bin/python
import sys, fileinput
err=0
cols=78
def report_err(s):
global err
print("%s:%d: %s" % (fileinput.filename(), fileinput.filelineno(), s))
err=1
for line in fileinput.input(openhook=fileinput.hook_encoded("utf-8")):
if line.find('\t') != -1 and fileinput.filename().find("Makefile") =... | #!/usr/bin/python
import sys, fileinput, subprocess
err=0
cols=78
config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],
stdout=subprocess.PIPE)
result=config_proc.communicate()[0]
autocrlf=result.strip() == b"true" if result is not None else False
def report_err(s):
global err
print("%s:%d:... | Python | 0 |
9dcf5e0b30141641a0e182257b34720bcf07d730 | Fix typo in S3_Bucket_With_Versioning_And_Lifecycle_Rules.py (#693) | examples/S3_Bucket_With_Versioning_And_Lifecycle_Rules.py | examples/S3_Bucket_With_Versioning_And_Lifecycle_Rules.py | # Converted from S3_Bucket.template located at:
# http://aws.amazon.com/cloudformation/aws-cloudformation-templates/
from troposphere import Output, Ref, Template
from troposphere.s3 import Bucket, PublicRead, VersioningConfiguration, \
LifecycleConfiguration, LifecycleRule, NoncurrentVersionTransition, \
Life... | # Converted from S3_Bucket.template located at:
# http://aws.amazon.com/cloudformation/aws-cloudformation-templates/
from troposphere import Output, Ref, Template
from troposphere.s3 import Bucket, PublicRead, VersioningConfiguration, \
LifecycleConfiguration, LifecycleRule, NoncurrentVersionTransition, \
Life... | Python | 0.998464 |
a378649f85f0bc55060ad0238e426f587bc2ff1a | Send location only when printing exception (Avoid leaking ID/UUID) | core/exceptions.py | core/exceptions.py | """
exceptions - Core exceptions
"""
class InvalidMembership(Exception):
"""
The membership provided is not valid
"""
pass
class SourceNotFound(Exception):
"""
InstanceSource doesn't have an associated source.
"""
pass
class RequestLimitExceeded(Exception):
"""
A limit was ... | """
exceptions - Core exceptions
"""
class InvalidMembership(Exception):
"""
The membership provided is not valid
"""
pass
class SourceNotFound(Exception):
"""
InstanceSource doesn't have an associated source.
"""
pass
class RequestLimitExceeded(Exception):
"""
A limit was ... | Python | 0 |
93323426c22a08965544b19c818e53c8f2b29e8c | clean select_channel widget | ldk/gui/select_channel_widget.py | ldk/gui/select_channel_widget.py | # -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
class SelectChannelWidget(QtGui.QWidget):
def __init__(self, plot_widget):
super(SelectChannelWidget, self).__init__()
self.plot_widget = plot_widget
self.layout = QtGui.QGridLayout()
self.adc... | # -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
class SelectChannelWidget(QtGui.QWidget):
def __init__(self, plot_widget):
super(SelectChannelWidget, self).__init__()
self.plot_widget = plot_widget
self.layout = QtGui.QGridLayout()
self.adc... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.