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 |
|---|---|---|---|---|---|---|---|
18d66a1325e9c8825c4b33ea5438fe0ec8fcab33 | Don't swallow the underlying decrypt error | decrypt-windows-ec2-passwd.py | decrypt-windows-ec2-passwd.py | #!/usr/bin/env python
import base64, binascii, getpass, optparse, sys
from Crypto.PublicKey import RSA
def pkcs1_unpad(text):
#From http://kfalck.net/2011/03/07/decoding-pkcs1-padding-in-python
if len(text) > 0 and text[0] == '\x02':
# Find end of padding marked by nul
pos = text.fi... | #!/usr/bin/env python
import base64, binascii, getpass, optparse, sys
from Crypto.PublicKey import RSA
def pkcs1_unpad(text):
#From http://kfalck.net/2011/03/07/decoding-pkcs1-padding-in-python
if len(text) > 0 and text[0] == '\x02':
# Find end of padding marked by nul
pos = text.fi... | Python | 0.998796 |
57cb5546d0e832bae8b2171d42fc4428ebc6dc74 | add try for imports | tumb_borg/authorize.py | tumb_borg/authorize.py | #!/usr/bin/python
from tumblpy import Tumblpy as T
try:
from urllib.parse import urlparse, parse_qs
except ImportError:
from urlparse import urlparse, parse_qs
def authorize(KEY, SECRET, CALLBACK):
def get_authorization_properties():
t = T(KEY, SECRET)
return t \
.get_authentica... | #!/usr/bin/python
from tumblpy import Tumblpy as T
from urlparse import urlparse, parse_qs
def authorize(KEY, SECRET, CALLBACK):
def get_authorization_properties():
t = T(KEY, SECRET)
return t \
.get_authentication_tokens(
callback_url=CALLBACK)
auth_p = get... | Python | 0 |
e5fd6111d164cee574cb929849934e0b2c7a70a1 | Add ArticleImportView tests | molo/core/api/tests/test_views.py | molo/core/api/tests/test_views.py | from django.contrib.auth.models import User
from django.test import Client, TestCase
from django.core.urlresolvers import reverse
from mock import patch
from molo.core.api.tests.utils import mocked_requests_get
from molo.core.tests.base import MoloTestCaseMixin
class MainImportViewTestCase(MoloTestCaseMixin, TestCa... | from django.contrib.auth.models import User
from django.test import Client, TestCase
from django.core.urlresolvers import reverse
from mock import patch
from molo.core.api.tests.utils import mocked_requests_get
from molo.core.tests.base import MoloTestCaseMixin
class MainImportViewTestCase(MoloTestCaseMixin, TestCa... | Python | 0 |
3a49982dfe1a94159bb2543540ae3638688c7c31 | make RAOB download backend more time forgiving | cgi-bin/request/raob.py | cgi-bin/request/raob.py | #!/usr/bin/env python
"""
Download interface for data from RAOB network
"""
import sys
import cgi
import datetime
import pytz
from pyiem.util import get_dbconn, ssw
from pyiem.network import Table as NetworkTable
def m(val):
"""Helper"""
if val is None:
return 'M'
return val
def fetcher(station... | #!/usr/bin/env python
"""
Download interface for data from RAOB network
"""
import cgi
import datetime
import pytz
from pyiem.util import get_dbconn, ssw
from pyiem.network import Table as NetworkTable
def m(val):
"""Helper"""
if val is None:
return 'M'
return val
def fetcher(station, sts, ets)... | Python | 0 |
722de274d3ee9866c7580a7f95e32de1777e6a3b | Add note | csscms/properties_scraper.py | csscms/properties_scraper.py | from pyquery import PyQuery as pq
"""
A quick and dirty scraper for w3c's css properties list.
See css_properties.py for the example output. This is meant to be run once, except when new properties
need to be scraped.
"""
def strip_all_prefixes(string):
bad_prefixes = [
'text-text-',
'pos-',
... | from pyquery import PyQuery as pq
"""A quick and dirty scraper for w3c's css properties list."""
def strip_all_prefixes(string):
bad_prefixes = [
'text-text-',
'pos-',
'font-font-',
'nav-',
'class-',
'gen-',
'tab-'
]
for prefix in bad_prefixes:
... | Python | 0 |
d13204abb2cf5d341eff78416dd442c303042697 | Modify add_occupant method to raise exception in case of a duplicate | classes/room.py | classes/room.py | class Room(object):
def __init__(self, room_name, room_type, max_persons):
self.room_name = room_name
self.room_type = room_type
self.max_persons = max_persons
self.persons = []
def add_occupant(self, person):
if person not in self.persons:
if len(self.person... | class Room(object):
def __init__(self, room_name, room_type, max_persons):
self.room_name = room_name
self.room_type = room_type
self.max_persons = max_persons
self.persons = []
def add_occupant(self, person):
if len(self.persons) < self.max_persons:
self.per... | Python | 0 |
90d3f00cd8fea8fab9274069ac06ea461f8e4dfd | Send only pics and gifs to OOO_B_R. | channels/ooo_b_r/app.py | channels/ooo_b_r/app.py | #encoding:utf-8
from utils import get_url, weighted_random_subreddit
# Group chat https://yal.sh/dvdahoy
t_channel = '-1001065558871'
subreddit = weighted_random_subreddit({
'ANormalDayInRussia': 1.0,
'ANormalDayInAmerica': 0.1,
'ANormalDayInJapan': 0.01
})
def send_post(submission, r2t):
what, url... | #encoding:utf-8
from utils import get_url, weighted_random_subreddit
# Group chat https://yal.sh/dvdahoy
t_channel = '-1001065558871'
subreddit = weighted_random_subreddit({
'ANormalDayInRussia': 1.0,
'ANormalDayInAmerica': 0.1,
'ANormalDayInJapan': 0.01
})
def send_post(submission, r2t):
what, url... | Python | 0 |
e309ed0a2f1f991e4015fcede373dccfe3843d97 | Change version tag. | core/info/info.py | core/info/info.py | # -*- coding: utf-8 -*-
"""Informations.
+ Pyslvs version.
+ Module versions.
+ Help descriptions.
+ Check for update function.
"""
__author__ = "Yuan Chang"
__copyright__ = "Copyright (C) 2016-2018"
__license__ = "AGPL"
__email__ = "pyslvs@gmail.com"
from sys import version_info
import platform
import argparse
imp... | # -*- coding: utf-8 -*-
"""Informations.
+ Pyslvs version.
+ Module versions.
+ Help descriptions.
+ Check for update function.
"""
__author__ = "Yuan Chang"
__copyright__ = "Copyright (C) 2016-2018"
__license__ = "AGPL"
__email__ = "pyslvs@gmail.com"
from sys import version_info
import platform
import argparse
imp... | Python | 0 |
35d2a174d671e29e08ad512f9bee08e150d39984 | Save original, then parse amounts. | db/db.py | db/db.py | #!/usr/bin/python
import sys
import copy
import json
import getpass
import aesjsonfile
sys.path.append("../")
import config
def parse_amount(amount):
if type(amount) == int:
return amount
if "." not in amount:
amount += ".00"
return int(amount.replace("$","").replace(",","").replace(".","... | #!/usr/bin/python
import sys
import copy
import json
import getpass
import aesjsonfile
sys.path.append("../")
import config
def parse_amount(amount):
if type(amount) == int:
return amount
if "." not in amount:
amount += ".00"
return int(amount.replace("$","").replace(",","").replace(".","... | Python | 0 |
d966b0973da71f5c883697ddd12c2728b2a04cce | Improve git tag to version conversion | ci/cleanup-binary-tags.py | ci/cleanup-binary-tags.py | #!/usr/bin/env python3
import os
import subprocess
import re
import semver
def tag_to_version(tag):
return tag.split('-')[1].lstrip('v')
subprocess.check_call('git pull --tags', shell=True)
tags = subprocess.check_output(
'git tag --list | grep binary', shell=True).decode('UTF-8').splitlines()
versions = s... | #!/usr/bin/env python3
import os
import subprocess
import re
import semver
def tag_to_version(tag):
version = re.sub(r'binary-', '', tag)
version = re.sub(r'-[x86|i686].*', '', version)
return version
subprocess.check_call('git pull --tags', shell=True)
tags = subprocess.check_output(
'git tag --li... | Python | 0.000001 |
94aed149fd39ba9a6dd6fcf5dcc44c6e4f2a09b9 | fix imports | website_sale_search_clear/controllers.py | website_sale_search_clear/controllers.py | # -*- coding: utf-8 -*-
from odoo import http
from odoo.addons.website_sale.controllers.main import WebsiteSale as controller
class WebsiteSale(controller):
@http.route()
def shop(self, page=0, category=None, search='', **post):
if category and search:
category = None
return super... | # -*- coding: utf-8 -*-
from openerp import http
from openerp.addons.website_sale.controllers.main import website_sale as controller
class WebsiteSale(controller):
@http.route()
def shop(self, page=0, category=None, search='', **post):
if category and search:
category = None
retur... | Python | 0.000004 |
24a1bb4fed640a61caa1613cfe4da29a530a8efc | Fix enconding issue on Harvest Config validation | udata/harvest/forms.py | udata/harvest/forms.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from udata.forms import Form, fields, validators
from udata.i18n import lazy_gettext as _
from .actions import list_backends
from .models import VALIDATION_STATES, VALIDATION_REFUSED
__all__ = 'HarvestSourceForm', 'HarvestSourceValidationForm'
class ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from udata.forms import Form, fields, validators
from udata.i18n import lazy_gettext as _
from .actions import list_backends
from .models import VALIDATION_STATES, VALIDATION_REFUSED
__all__ = 'HarvestSourceForm', 'HarvestSourceValidationForm'
class ... | Python | 0 |
683ccc69c51a64146dda838ad01674ca3b95fccd | Remove useless hearing comments router | democracy/urls_v1.py | democracy/urls_v1.py | from django.conf.urls import include, url
from rest_framework_nested import routers
from democracy.views import (
CommentViewSet, ContactPersonViewSet, HearingViewSet, ImageViewSet, LabelViewSet, ProjectViewSet,
RootSectionViewSet, SectionCommentViewSet, SectionViewSet, UserDataViewSet, FileViewSet, ServeFileV... | from django.conf.urls import include, url
from rest_framework_nested import routers
from democracy.views import (
CommentViewSet, ContactPersonViewSet, HearingViewSet, ImageViewSet, LabelViewSet, ProjectViewSet,
RootSectionViewSet, SectionCommentViewSet, SectionViewSet, UserDataViewSet, FileViewSet, ServeFileV... | Python | 0 |
ad153499a3982182533033acfa17971a35d7a587 | implement __eq__ | capa/features/address.py | capa/features/address.py | import abc
from dncil.clr.token import Token
class Address(abc.ABC):
@abc.abstractmethod
def __eq__(self, other):
...
@abc.abstractmethod
def __lt__(self, other):
# implement < so that addresses can be sorted from low to high
...
@abc.abstractmethod
def __hash__(self... | import abc
from dncil.clr.token import Token
class Address(abc.ABC):
@abc.abstractmethod
def __lt__(self, other):
# implement < so that addresses can be sorted from low to high
...
@abc.abstractmethod
def __hash__(self):
# implement hash so that addresses can be used in sets ... | Python | 0.00008 |
e660953c1df2dc9de6b3038e4ddb1d77768b2b51 | Correct pyhande dependencies (broken for some time) | tools/pyhande/setup.py | tools/pyhande/setup.py | from distutils.core import setup
setup(
name='pyhande',
version='0.1',
author='HANDE developers',
packages=('pyhande',),
license='Modified BSD license',
description='Analysis framework for HANDE calculations',
long_description=open('README.rst').read(),
install_requires=['numpy', 'scipy... | from distutils.core import setup
setup(
name='pyhande',
version='0.1',
author='HANDE developers',
packages=('pyhande',),
license='Modified BSD license',
description='Analysis framework for HANDE calculations',
long_description=open('README.rst').read(),
requires=['numpy', 'pandas (>= 0.... | Python | 0 |
776c8fd802385ef4294112e76365df6bdf93476a | Update Bee.py | Templates/Bee.py | Templates/Bee.py | import pythoncom, pyHook
from os import path
from sys import exit
import threading
import urllib,urllib2
import smtplib
import datetime,time
import win32com.client
import win32event, win32api, winerror
from _winreg import *
import shutil
import sys
mutex = win32event.CreateMutex(None, 1, 'N0tAs519n')
if win32api.GetLa... | import pythoncom
import pyHook
from os import path
from sys import exit
from sys import argv
from shutil import copy
import threading
import urllib,urllib2
import smtplib
import datetime,time
import win32com.client
import win32event, win32api, winerror
from _winreg import *
mutex = win32event.CreateMutex(None, 1, 'N0t... | Python | 0.000009 |
d07d87ea7f9d62e8274ba1b958d08756d071653a | add format detection by magic number | thumbor/engines/__init__.py | thumbor/engines/__init__.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) 2011 globo.com timehome@corp.globo.com
class BaseEngine(object):
def __init__(self, context):
... | #!/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) 2011 globo.com timehome@corp.globo.com
class BaseEngine(object):
def __init__(self, context):
... | Python | 0.000001 |
b277ca357728010c9d763c95cc459540821802c0 | Update dice loss | dataset/models/tf/losses/__init__.py | dataset/models/tf/losses/__init__.py | """ Contains custom losses """
import tensorflow as tf
from ..layers import flatten
def dice(targets, predictions, weights=1.0, label_smoothing=0, scope=None,
loss_collection=tf.GraphKeys.LOSSES, reduction=tf.losses.Reduction.SUM_BY_NONZERO_WEIGHTS):
""" Dice coefficient
Parameters
----------
... | """ Contains custom losses """
import tensorflow as tf
from ..layers import flatten
def dice(targets, predictions):
""" Dice coefficient
Parameters
----------
targets : tf.Tensor
tensor with target values
predictions : tf.Tensor
tensor with predicted values
Returns
----... | Python | 0 |
4c9b47052c2c66671230f33ea84459e02b3b2f06 | Update Unit_Testing2.py | Unit_Testing2.py | Unit_Testing2.py | from unit_testing import *
import unittest
class UnitTests(unittest.TestCase):
def setUp(self):
print('setUp()...')
self.hash1 = Hash('1234')
self.email1 = Email('zmg@verizon.net')
def test(self):
print('testing hash...')
self.assertEqual(self.hash1, self.has... | from unit_testing import *
import unittest
class UnitTests(unittest.TestCase):
def setUp(self):
print('setUp()...')
self.hash1 = Hash('1234')
self.hash2 = Hash('1234')
self.hash3 = Hash('123')
self.email1 = Email('P@V')
def test(self):
print('testing... | Python | 0 |
4089730950d6005e257c20e6926000073fd41b33 | Enable Tensor equality for 2.0 | tensorflow/python/compat/v2_compat.py | tensorflow/python/compat/v2_compat.py | # Copyright 2018 The TensorFlow 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2018 The TensorFlow 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0 |
e39c2e0c3dae39ee380a98a1aa662d14d1a1191e | Add new keyfile | dexter/config/celeryconfig.py | dexter/config/celeryconfig.py | from celery.schedules import crontab
# uses AWS creds from the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env variables
BROKER_URL = 'sqs://'
BROKER_TRANSPORT_OPTIONS = {
'region': 'eu-west-1',
'polling_interval': 15 * 1,
'queue_name_prefix': 'mma-dexter-',
'visibility_timeout': 3600*12,
}
# all ou... | from celery.schedules import crontab
# uses AWS creds from the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env variables
BROKER_URL = 'sqs://'
BROKER_TRANSPORT_OPTIONS = {
'region': 'eu-west-1',
'polling_interval': 15 * 1,
'queue_name_prefix': 'mma-dexter-',
'visibility_timeout': 3600*12,
}
# all ou... | Python | 0.000002 |
9a3d81d38e8b5885f54198f41b27d1d813c83e74 | Add django_extensions | director/director/settings.py | director/director/settings.py | """
Django settings for director project.
Uses ``django-configurations``. For more on this package, see
https://github.com/jazzband/django-configurations
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djan... | """
Django settings for director project.
Uses ``django-configurations``. For more on this package, see
https://github.com/jazzband/django-configurations
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djan... | Python | 0.000005 |
c4f7f2025a6089ec0ddcb190eaf4c020804b384b | make the call to core commands more explicit | toggleselection/__init__.py | toggleselection/__init__.py | # Override commands that toggle item selection to automatically compute and instantly display
# combined filesize for selected files and the number of selected folders/files
from fman import DirectoryPaneCommand, DirectoryPaneListener, load_json, save_json, PLATFORM
from core.commands.util import is_hidden
from fman.u... | # Override commands that toggle item selection to automatically compute and instantly display
# combined filesize for selected files and the number of selected folders/files
from fman import DirectoryPaneListener, load_json
import json
from statusbarextended import StatusBarExtended
class CommandEmpty(): # to avoid d... | Python | 0 |
50eedeaaa401d192c2681d58c83981961a1c4ff1 | fix update profile | lxxl/services/graph/users/profile.py | lxxl/services/graph/users/profile.py | from lxxl.lib import router, output
from lxxl.lib.app import Controller, Error
from lxxl.lib.storage import Db, ASCENDING
from lxxl.lib.flush import FlushRequest
from lxxl.model.users import User, Factory as UserFactory, Duplicate
import datetime
class Profile(router.Root):
def get(self, environ, params):
... | from lxxl.lib import router, output
from lxxl.lib.app import Controller, Error
from lxxl.lib.storage import Db, ASCENDING
from lxxl.lib.flush import FlushRequest
from lxxl.model.users import User, Factory as UserFactory, Duplicate
import datetime
class Profile(router.Root):
def get(self, environ, params):
... | Python | 0.000001 |
9a4e2f88eba716ef607b8c476509cac5e58475f7 | Update mapper_lowercase.py | mapreduce/filter/mapper_lowercase.py | mapreduce/filter/mapper_lowercase.py | #!/usr/bin/env python
import sys
# Open just for read
dbpediadb = set(open('dbpedia_labels.txt').read().splitlines())
dbpediadb_lower = set(x.lower() for x in open('dbpedia_labels.txt').read().splitlines())
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# split the li... | #!/usr/bin/env python
import sys
# Open just for read
dbpediadb = set(open('dbpedia_labels.txt').read().splitlines())
dbpediadb_lower = set(x.lower() for x in open('dbpedia_labels.txt').read().splitlines())
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# split the li... | Python | 0.000067 |
84ce27775b7e04955a15a0eb1e277db3e447b81f | fix SlidingCloth | mayaLib/rigLib/utils/slidingCloth.py | mayaLib/rigLib/utils/slidingCloth.py | __author__ = 'Lorenzo Argentieri'
import pymel.core as pm
from mayaLib.rigLib.utils import skin
from mayaLib.rigLib.utils import deform
class SlidingCloth():
def __init__(self, mainSkinGeo, proxySkinGeo, mainClothGeo, proxyClothGeo, rigModelGrp=None):
"""
Setup Sliding Cloth deformation
:... | __author__ = 'Lorenzo Argentieri'
import pymel.core as pm
from mayaLib.rigLib.utils import skin
from mayaLib.rigLib.utils import deform
class SlidingCloth():
def __init__(self, mainSkinGeo, proxySkinGeo, mainClothGeo, proxyClothGeo):
"""
Setup Sliding Cloth deformation
:param mainSkinGeo:... | Python | 0.000001 |
f7060b65464b24bb16a8cf4704c68fa1348d655c | bump version | crossbar/crossbar/__init__.py | crossbar/crossbar/__init__.py | ###############################################################################
##
## Copyright (C) 2011-2014 Tavendo GmbH
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License, version 3,
## as published by the Free Software Founda... | ###############################################################################
##
## Copyright (C) 2011-2014 Tavendo GmbH
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License, version 3,
## as published by the Free Software Founda... | Python | 0 |
c0e09993facdd76e7b1dfbab97285464f83980bb | Update version | cast_convert/__init__.py | cast_convert/__init__.py | #!/usr/bin/env python3
__version__ = '0.1.7.17'
from .cmd import cmd as command
from .watch import *
from . import *
from .convert import *
from .media_info import *
import click
@click.command(help="Print version")
def version():
print(__version__)
command.add_command(version)
| #!/usr/bin/env python3
__version__ = '0.1.7.11'
from .cmd import cmd as command
from .watch import *
from . import *
from .convert import *
from .media_info import *
import click
@click.command(help="Print version")
def version():
debug_print(__version__)
command.add_command(version)
| Python | 0 |
b5cd4ff2b02151bca966c53b80dbea8911a7a6b2 | Upgrade celery.utils.encoding from kombu | celery/utils/encoding.py | celery/utils/encoding.py | """
celery.utils.encoding
====================
Utilities to encode text, and to safely emit text from running
applications without crashing with the infamous :exc:`UnicodeDecodeError`
exception.
"""
from __future__ import absolute_import
import sys
import traceback
__all__ = ["str_to_bytes", "bytes_to_str", "from_u... | """
celery.utils.encoding
=====================
Utilties to encode text, and to safely emit text from running
applications without crashing with the infamous :exc:`UnicodeDecodeError`
exception.
"""
from __future__ import absolute_import
import sys
import traceback
__all__ = ["str_to_bytes", "bytes_to_str", "from_... | Python | 0 |
a0ff8cc15df5cd9668e11eba3b5e7406b33dcfc5 | fix RemovedInDjango19Warning on django.utils.importlib | celery_haystack/utils.py | celery_haystack/utils.py | from django.core.exceptions import ImproperlyConfigured
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
from django.db import connection
from haystack.utils import get_identifier
from .conf import settings
def get_update_task(task_path=None):
... | from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from django.db import connection
from haystack.utils import get_identifier
from .conf import settings
def get_update_task(task_path=None):
import_path = task_path or settings.CELERY_HAYSTACK_DEFAULT_TASK
... | Python | 0 |
7d89c9c3229ebd7d8b56edf211e7020c3fad29a0 | add support for msgpack | utils/encoders.py | utils/encoders.py | # Copyright (C) 2015 SlimRoms Project
#
# 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... | # Copyright (C) 2015 SlimRoms Project
#
# 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... | Python | 0 |
745d3fae6b6055c731a47c13ef77e1faf1a4b7e5 | upgrade elasticsearch mining backends | mining/db/backends/melasticsearch.py | mining/db/backends/melasticsearch.py | # -*- coding: utf-8 -*-
import json
import requests
from elasticsearch import Elasticsearch as ES
from mining.utils.listc import listc_dict
class Elasticsearch(object):
def conn(self):
"""Open connection on Elasticsearch DataBase"""
conn = ES([
{"host": self.conf.get('host'),
... | # -*- coding: utf-8 -*-
import json
from elasticsearch import Elasticsearch as ES
class Elasticsearch(object):
def conn(self):
"""Open connection on Elasticsearch DataBase"""
conn = ES([
{"host": self.conf.get('host'),
"port": self.conf.get('port'),
"url_prefi... | Python | 0 |
136a47e74f6c7e10c05286bc12048b41b7e2f580 | Add a simple command shell for running backup and restore | corvus/console.py | corvus/console.py | import asyncore
import cmd
import shlex
import sys
import time
from corvus.client import Corvus
class Console(cmd.Cmd):
def __init__(self, completekey='tab', stdin=None, stdout=None,
corvus=None):
if corvus is None:
corvus = Corvus()
self._corvus = corvus
self.p... | import sys
import time
from corvus.client import Corvus
def backup(corvus, filename):
total_sectors = corvus.get_drive_capacity(1)
with open(filename, "wb") as f:
for i in range(total_sectors):
data = corvus.read_sector_512(1, i)
f.write(''.join([ chr(d) for d in data ]))
... | Python | 0 |
bc1e350dd19d91932bbfff73f863129ac94273c9 | bump version to 2.0.1 | torment/information.py | torment/information.py | # Copyright 2015 Alex Brandt
#
# 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, ... | # Copyright 2015 Alex Brandt
#
# 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, ... | Python | 0 |
90ad8e104c339b923d9291916647391572fbced1 | Bump version number | nassl/__init__.py | nassl/__init__.py | # -*- coding: utf-8 -*-
__author__ = 'Alban Diquet'
__version__ = '0.16.0'
| # -*- coding: utf-8 -*-
__author__ = 'Alban Diquet'
__version__ = '0.15.1'
| Python | 0.000002 |
e51786c46ad4eb7310b1eaa0153253116f2c01bc | Update test bids | openprocurement/tender/esco/tests/base.py | openprocurement/tender/esco/tests/base.py | # -*- coding: utf-8 -*-
import os
from copy import deepcopy
from openprocurement.tender.openeu.tests.base import (
BaseTenderWebTest,
test_features_tender_data as base_eu_test_features_data,
test_tender_data as base_eu_test_data,
test_lots as base_eu_lots,
test_bids as base_eu_bids,
)
test_tender... | # -*- coding: utf-8 -*-
import os
from copy import deepcopy
from openprocurement.tender.openeu.tests.base import (
BaseTenderWebTest,
test_features_tender_data as base_eu_test_features_data,
test_tender_data as base_eu_test_data,
test_lots as base_eu_lots,
test_bids as base_eu_bids,
)
test_tender... | Python | 0 |
7a8e5d15d7d9681b8d5ddae4d72e64b5ca6cba13 | remove disabled code | dyndnsc/updater/base.py | dyndnsc/updater/base.py | # -*- coding: utf-8 -*-
import logging
import requests
from ..common.subject import Subject
from ..common.events import IP_UPDATE_SUCCESS, IP_UPDATE_ERROR
log = logging.getLogger(__name__)
class UpdateProtocol(Subject):
"""the base class for all update protocols"""
_updateurl = None
theip = None
... | # -*- coding: utf-8 -*-
import logging
import requests
from ..common.subject import Subject
from ..common.events import IP_UPDATE_SUCCESS, IP_UPDATE_ERROR
log = logging.getLogger(__name__)
class UpdateProtocol(Subject):
"""the base class for all update protocols"""
_updateurl = None
theip = None
... | Python | 0 |
6c15caa37c3635fc1ca65a0d2989a271bc5723fe | Update amalgamation.py | nnvm/amalgamation/amalgamation.py | nnvm/amalgamation/amalgamation.py | import sys
import os.path, re, StringIO
blacklist = [
'Windows.h',
'mach/clock.h', 'mach/mach.h',
'malloc.h',
'glog/logging.h', 'io/azure_filesys.h', 'io/hdfs_filesys.h', 'io/s3_filesys.h',
'sys/stat.h', 'sys/types.h',
'omp.h', 'execinfo.h', 'packet/sse-inl.h'
]
def get_sources(def_file):... | import sys
import os.path, re, StringIO
blacklist = [
'Windows.h',
'mach/clock.h', 'mach/mach.h',
'malloc.h',
'glog/logging.h', 'io/azure_filesys.h', 'io/hdfs_filesys.h', 'io/s3_filesys.h',
'sys/stat.h', 'sys/types.h',
'omp.h'
]
def get_sources(def_file):
sources = []
files = []
... | Python | 0.000001 |
7fabbbb6562f068690b7971c6ea1299172400d73 | fix `make run_importer_jobs` | labonneboite/importer/conf/development.py | labonneboite/importer/conf/development.py | # --- job 1/8 & 2/8 : check_etablissements & extract_etablissements
DISTINCT_DEPARTEMENTS_HAVING_OFFICES = 15
# --- job 5/8 : compute_scores
MINIMUM_OFFICES_REQUIRED_TO_TRAIN_MODEL = 0
RMSE_MAX = 20000
MAXIMUM_COMPUTE_SCORE_JOB_FAILURES = 94 # 96 departements == 2 successes + 94 failures
# --- job 6/8 : validate_sco... | # --- job 1/8 & 2/8 : check_etablissements & extract_etablissements
DISTINCT_DEPARTEMENTS_HAVING_OFFICES = 15
# --- job 5/8 : compute_scores
MINIMUM_OFFICES_REQUIRED_TO_TRAIN_MODEL = 0
RMSE_MAX = 5000
MAXIMUM_COMPUTE_SCORE_JOB_FAILURES = 94 # 96 departements == 2 successes + 94 failures
# --- job 6/8 : validate_scor... | Python | 0 |
51129edea0a10a5799f329443b196e930a591fb9 | Move down timezone module. | laundryapp/templatetags/laundryapptags.py | laundryapp/templatetags/laundryapptags.py | from schedule.conf.settings import CHECK_EVENT_PERM_FUNC, CHECK_CALENDAR_PERM_FUNC
from schedule.templatetags.scheduletags import querystring_for_date
from django.conf import settings
from django import template
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from schedule.... | from schedule.conf.settings import CHECK_EVENT_PERM_FUNC, CHECK_CALENDAR_PERM_FUNC
from schedule.templatetags.scheduletags import querystring_for_date
from django.conf import settings
from django import template
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.utils.safestrin... | Python | 0 |
3cefa75b8e9012d828453a764c0b169ab169fae6 | fix google login names; associate with any user with same name | chip_friends/security.py | chip_friends/security.py | from __future__ import unicode_literals
import random
import string
from flask import render_template
from flask_security import Security, PeeweeUserDatastore
from flask_social import Social
from flask_social.datastore import PeeweeConnectionDatastore
from flask_social.utils import get_connection_values_from_oauth_res... | import random
import string
from flask import render_template
from flask_security import Security, PeeweeUserDatastore
from flask_social import Social
from flask_social.datastore import PeeweeConnectionDatastore
from flask_social.utils import get_connection_values_from_oauth_response
from flask_social.views import con... | Python | 0 |
5836b48bbfa87ba706e6ddcb267dc375678695a8 | use str | test/functional/feature_asset_burn.py | test/functional/feature_asset_burn.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.000001 |
9d2766a7b6aae9e3ad3c94925bdde100a70f6150 | fix debug_view function | src/psd_tools/debug.py | src/psd_tools/debug.py | # -*- coding: utf-8 -*-
"""
Assorted debug utilities
"""
from __future__ import absolute_import, print_function
import sys
from collections import namedtuple
try:
from IPython.lib.pretty import pprint
_PRETTY_ENABLED = True
except ImportError:
from pprint import pprint
_PRETTY_ENABLED = False
def debu... | # -*- coding: utf-8 -*-
"""
Assorted debug utilities
"""
from __future__ import absolute_import
import sys
from collections import namedtuple
try:
from IPython.lib.pretty import pprint
_PRETTY_ENABLED = True
except ImportError:
from pprint import pprint
_PRETTY_ENABLED = False
def debug_view(fp, txt="... | Python | 0.000021 |
2bc1cd6ab4be134758edcc8739b89ce4984131b4 | Fix overly large try/except block. | zerver/management/commands/create_user.py | zerver/management/commands/create_user.py | import argparse
import logging
from typing import Any, Optional
from django.conf import settings
from django.core import validators
from django.core.exceptions import ValidationError
from django.core.management.base import CommandError
from django.db.utils import IntegrityError
from zerver.lib.actions import do_creat... | import argparse
import logging
from typing import Any, Optional
from django.conf import settings
from django.core import validators
from django.core.exceptions import ValidationError
from django.core.management.base import CommandError
from django.db.utils import IntegrityError
from zerver.lib.actions import do_creat... | Python | 0 |
b2b19d5bd608db9286448000e1c998784139a614 | update join | classmate_party/views.py | classmate_party/views.py | # -*- coding: utf-8 -*-
import os
import uuid
from PIL import Image
from django.shortcuts import render_to_response
from models import *
def index(request):
return render_to_response('index.html', locals())
def join(request):
msg = ''
category_choice = Person.CATEGORY_CHOICE
if request.method == ... | # -*- coding: utf-8 -*-
import os
import uuid
from PIL import Image
from django.shortcuts import render_to_response
from models import *
def index(request):
return render_to_response('index.html', locals())
def join(request):
msg = ''
category_choice = Person.CATEGORY_CHOICE
if request.method == ... | Python | 0 |
5e991fd00d980884f9210cfd5f25d5e7d91aabfc | Fix race condition in #144 | test/replication/init_storage.test.py | test/replication/init_storage.test.py | import os
import glob
from lib.tarantool_server import TarantoolServer
# master server
master = server
master.admin('space = box.schema.create_space(\'test\', {id = 42})')
master.admin('space:create_index(\'primary\', \'hash\', {parts = { 0, \'num\' } })')
master.admin('for k = 1, 9 do space:insert(k, k*k) end')
f... | import os
import glob
from lib.tarantool_server import TarantoolServer
# master server
master = server
master.admin('space = box.schema.create_space(\'test\', {id = 42})')
master.admin('space:create_index(\'primary\', \'hash\', {parts = { 0, \'num\' } })')
master.admin('for k = 1, 9 do space:insert(k, k*k) end')
f... | Python | 0 |
0ea32a2b51438b55130082e54f30fc9c97bd9d85 | Fix compatibility with oslo.db 12.1.0 | cloudkitty/db/__init__.py | cloudkitty/db/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... | # -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... | Python | 0.000019 |
cfe7de10ef9c6c1d8d5be71993e5f96ace58953d | Update Ansible release version to 2.6.0dev0. | lib/ansible/release.py | lib/ansible/release.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | Python | 0 |
359f337d7cfd0dac2eec8ecce643af10588e3e6a | Fix i18n __radd__ bug | uliweb/i18n/lazystr.py | uliweb/i18n/lazystr.py | def lazy(func):
def f(message):
return LazyString(func, message)
return f
class LazyString(object):
"""
>>> from uliweb.i18n import gettext_lazy as _
>>> x = _('Hello')
>>> print repr(x)
"""
def __init__(self, func, message):
self._func = func
se... | def lazy(func):
def f(message):
return LazyString(func, message)
return f
class LazyString(object):
"""
>>> from uliweb.i18n import gettext_lazy as _
>>> x = _('Hello')
>>> print repr(x)
"""
def __init__(self, func, message):
self._func = func
se... | Python | 0.263457 |
ac985005f925c0d37ae337ada0bf88b50becaee6 | change scheduler | coalics/schedule.py | coalics/schedule.py | import os.path
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import logging
from coalics import tasks, q, redis, app
from datetime import datetime
from datetime import datetime, timedelta
import time
# stream_handler = logging.StreamHandler()
# stream_handler.setLevel(logging.INFO)
# app... | import os.path
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import logging
from coalics import tasks, q, redis, app
from datetime import datetime
from datetime import datetime, timedelta
import time
# stream_handler = logging.StreamHandler()
# stream_handler.setLevel(logging.INFO)
# app... | Python | 0.000001 |
9b354f4dc00e3aef4cfceae71be60b1dc60a1927 | Add test for ticket #1559. | numpy/ma/tests/test_regression.py | numpy/ma/tests/test_regression.py | from numpy.testing import *
import numpy as np
rlevel = 1
class TestRegression(TestCase):
def test_masked_array_create(self,level=rlevel):
"""Ticket #17"""
x = np.ma.masked_array([0,1,2,3,0,4,5,6],mask=[0,0,0,1,1,1,0,0])
assert_array_equal(np.ma.nonzero(x),[[1,2,6,7]])
def test_masked... | from numpy.testing import *
import numpy as np
rlevel = 1
class TestRegression(TestCase):
def test_masked_array_create(self,level=rlevel):
"""Ticket #17"""
x = np.ma.masked_array([0,1,2,3,0,4,5,6],mask=[0,0,0,1,1,1,0,0])
assert_array_equal(np.ma.nonzero(x),[[1,2,6,7]])
def test_masked... | Python | 0 |
813c478f06c175e36dc8334fd37195e403a42166 | update test_symbol_accuracy | test_symbol_accuracy.py | test_symbol_accuracy.py | from dataset import create_testing_data_for_symbol, get_symbol_list
from keras.models import load_model
import sys
INITIAL_CAPITAL = 10000.0
PERCENT_OF_CAPITAL_PER_TRANSACTION = 10.0
TRANSACTION_FEE = 0
def compare(x, y):
if x[3] < y[3]:
return 1
return -1
def main():
model = load_model(sys.argv[1])
symbols = ... | from dataset import create_testing_data_for_symbol, get_symbol_list
from keras.models import load_model
import sys
INITIAL_CAPITAL = 10000.0
PERCENT_OF_CAPITAL_PER_TRANSACTION = 10.0
TRANSACTION_FEE = 0
def compare(x, y):
if x[1] < y[1]:
return 1
return -1
def main():
model = load_model(sys.argv[1])
symbols = ... | Python | 0.000025 |
cf4fc126b49c425d7f441abc91f4114b5f1303ea | Move publication field above tite//subtitle/description in admin | cms_lab_carousel/admin.py | cms_lab_carousel/admin.py | from django.contrib import admin
from cms_lab_carousel.models import Carousel, Slide
class CarouselAdmin(admin.ModelAdmin):
fieldset_frame = ('Carousel Frame', {
'fields': [
'title',
'header_image',
'footer_image',
],
})
fieldset_visibility = ('Visibilit... | from django.contrib import admin
from cms_lab_carousel.models import Carousel, Slide
class CarouselAdmin(admin.ModelAdmin):
fieldset_frame = ('Carousel Frame', {
'fields': [
'title',
'header_image',
'footer_image',
],
})
fieldset_visibility = ('Visibilit... | Python | 0 |
f61a4766ad3006bb2001df33d06feeb15352aa5a | Change Box user list request from raw API call to Box SDK make_request method | okta-integration/python/server.py | okta-integration/python/server.py | from flask import Flask, redirect, g, url_for
from flask_oidc import OpenIDConnect
from okta import UsersClient
from boxsdk import Client
from boxsdk import JWTAuth
import requests
import config
import json
app = Flask(__name__)
app.config.update({
'SECRET_KEY': config.okta_client_secret,
'OIDC_CLIENT_SECRETS': '.... | from flask import Flask, redirect, g, url_for
from flask_oidc import OpenIDConnect
from okta import UsersClient
from boxsdk import Client
from boxsdk import JWTAuth
import requests
import config
import json
app = Flask(__name__)
app.config.update({
'SECRET_KEY': config.okta_client_secret,
'OIDC_CLIENT_SECRETS': '.... | Python | 0 |
332cbbd8b1be773593037d293c5dabbf6c100199 | Migrate freedns tests from coroutine to async/await (#30390) | tests/components/freedns/test_init.py | tests/components/freedns/test_init.py | """Test the FreeDNS component."""
import pytest
from homeassistant.components import freedns
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow
from tests.common import async_fire_time_changed
ACCESS_TOKEN = "test_token"
UPDATE_INTERVAL = freedns.DEFAULT_INTERVAL
UPDATE_UR... | """Test the FreeDNS component."""
import asyncio
import pytest
from homeassistant.components import freedns
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow
from tests.common import async_fire_time_changed
ACCESS_TOKEN = "test_token"
UPDATE_INTERVAL = freedns.DEFAULT_IN... | Python | 0 |
72941398fd2e78cbf5d994b4bf8683c4bdefaab9 | Comment out semipar notebook in travis runner until pip build us updated. | utils/travis_runner.py | utils/travis_runner.py | #!/usr/bin/env python
"""This script manages all tasks for the TRAVIS build server."""
import os
import subprocess
if __name__ == "__main__":
os.chdir("promotion/grmpy_tutorial_notebook")
cmd = [
"jupyter",
"nbconvert",
"--execute",
"grmpy_tutorial_notebook.ipynb",
"--Ex... | #!/usr/bin/env python
"""This script manages all tasks for the TRAVIS build server."""
import os
import subprocess
if __name__ == "__main__":
os.chdir("promotion/grmpy_tutorial_notebook")
cmd = [
"jupyter",
"nbconvert",
"--execute",
"grmpy_tutorial_notebook.ipynb",
"--Ex... | Python | 0 |
1f2c175d00729902a953513436879b08a0e3baa3 | test must have broken with upgrade (change in random seed?) so this fixes it | tests/mep/genetics/test_chromosome.py | tests/mep/genetics/test_chromosome.py | import unittest
import random
from mep.genetics.gene import VariableGene, OperatorGene, Gene
from mep.genetics.chromosome import Chromosome
import numpy as np
class MockedGene(Gene):
def __init__(self, error_to_return):
"""
Initialize.
:param error_to_return: what to return in the evaluate... | import unittest
import random
from mep.genetics.gene import VariableGene, OperatorGene, Gene
from mep.genetics.chromosome import Chromosome
import numpy as np
class MockedGene(Gene):
def __init__(self, error_to_return):
"""
Initialize.
:param error_to_return: what to return in the evaluate... | Python | 0 |
17dfc3faa45584200c8f67686b86b541a2ce01fe | Test for informal word | revscoring/languages/tests/test_hebrew.py | revscoring/languages/tests/test_hebrew.py | from nose.tools import eq_
from .. import language, hebrew
def test_language():
is_misspelled = hebrew.solve(language.is_misspelled)
assert is_misspelled("חטול")
assert not is_misspelled("חתול")
is_badword = hebrew.solve(language.is_badword)
assert is_badword("שרמוטה")
assert not is_badwo... | from nose.tools import eq_
from .. import language, hebrew
def test_language():
is_misspelled = hebrew.solve(language.is_misspelled)
assert is_misspelled("חטול")
assert not is_misspelled("חתול")
is_badword = hebrew.solve(language.is_badword)
assert is_badword("שרמוטה")
assert not is_badwo... | Python | 0.000037 |
1b75a0e5ee01387c434922b9d0fd23705cbafe9b | Allow empty enums for `OneOf` | marshmallow_jsonschema/validation.py | marshmallow_jsonschema/validation.py | from marshmallow import fields
from .exceptions import UnsupportedValueError
def handle_length(schema, field, validator, parent_schema):
"""Adds validation logic for ``marshmallow.validate.Length``, setting the
values appropriately for ``fields.List``, ``fields.Nested``, and
``fields.String``.
Args:... | from marshmallow import fields
from .exceptions import UnsupportedValueError
def handle_length(schema, field, validator, parent_schema):
"""Adds validation logic for ``marshmallow.validate.Length``, setting the
values appropriately for ``fields.List``, ``fields.Nested``, and
``fields.String``.
Args:... | Python | 0.000011 |
eb71d45097e509273518b83113489911bf985e4a | clean up | mcpipy/test/builders/test_protein.py | mcpipy/test/builders/test_protein.py | import pandas as pd
from cellcraft.builders.protein import define_items_color_texture_protein, store_location_biological_prot_data
def test_define_items_color_texture_protein():
dict_chains = {"a": 1, "b": 2}
d_appearance = define_items_color_texture_protein(dict_chains)
assert len(d_appearance) == 2
... | import pandas as pd
from cellcraft.builders.protein import define_items_color_texture_protein, store_location_biological_prot_data
def test_define_items_color_texture_protein():
dict_chains = {"a": 1, "b": 2}
d_appearance = define_items_color_texture_protein(dict_chains)
assert len(d_appearance) == 2
... | Python | 0.000001 |
237f85009e2d8669e75c1e7e9ae3940efe7a151d | update vetn version and pull recursively | vcontrol/rest/machines/create.py | vcontrol/rest/machines/create.py | from ..helpers import get_allowed
import ast
import json
import os
import subprocess
import web
class CreateMachineR:
"""
This endpoint is for creating a new machine of Vent on a provider.
"""
allow_origin, rest_url = get_allowed.get_allowed()
def OPTIONS(self):
return self.POST()
def... | from ..helpers import get_allowed
import ast
import json
import os
import subprocess
import web
class CreateMachineR:
"""
This endpoint is for creating a new machine of Vent on a provider.
"""
allow_origin, rest_url = get_allowed.get_allowed()
def OPTIONS(self):
return self.POST()
def... | Python | 0 |
be929d518ff320ed8e16f57da55f0855800f7408 | Use mutli_reduce instead of reduce in enum file loading | src/engine/file_loader.py | src/engine/file_loader.py | import os
import json
from lib import contract, functional
data_dir = os.path.join(os.environ['PORTER'], 'data')
@contract.accepts(str)
@contract.returns(list)
def read_and_parse_json(data_type):
sub_dir = os.path.join(data_dir, data_type)
def full_path(file_name):
return os.path.join(sub_dir, file... | import os
import json
from lib import contract
data_dir = os.path.join(os.environ['PORTER'], 'data')
@contract.accepts(str)
@contract.returns(list)
def read_and_parse_json(data_type):
sub_dir = os.path.join(data_dir, data_type)
def full_path(file_name):
return os.path.join(sub_dir, file_name)
... | Python | 0 |
ecc21e3fccc41413686389735da93e0488779cc4 | Add a test command | pypush.py | pypush.py | # Simple Push Python Module
import znc
import re
import http.client, urllib
import traceback
class pypush(znc.Module):
module_types = [znc.CModInfo.UserModule]
description = "Push python3 module for ZNC"
def OnLoad(self, sArgs, sMessage):
self.nick = ''
self.debug = False
return z... | # Simple Push Python Module
import znc
import re
import http.client, urllib
import traceback
class pypush(znc.Module):
module_types = [znc.CModInfo.UserModule]
description = "Push python3 module for ZNC"
def OnLoad(self, sArgs, sMessage):
self.nick = ''
self.debug = False
return z... | Python | 0.000797 |
9d74f2ebfc0a635026544a977380593e90b4150d | upgrade (goflow.workflow indepency) | leavedemo/urls.py | leavedemo/urls.py | from django.conf.urls.defaults import *
from django.conf import settings
from leave.forms import StartRequestForm, RequesterForm, CheckRequestForm
from os.path import join, dirname
_dir = join(dirname(__file__))
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# FOR D... | from django.conf.urls.defaults import *
from django.conf import settings
from leave.forms import StartRequestForm, RequesterForm, CheckRequestForm
from os.path import join, dirname
_dir = join(dirname(__file__))
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# FOR D... | Python | 0 |
1df66cc442e93d85fd8a8bbab2815574387a8952 | Remove print | doc/examples/brain_extraction_dwi.py | doc/examples/brain_extraction_dwi.py | """
=================================================
Brain segmentation with dipy.segment.mask.
=================================================
We show how to extract brain information and mask from a b0 image using dipy's
segment.mask module.
First import the necessary modules:
"""
import os.path
import numpy as... | """
=================================================
Brain segmentation with dipy.segment.mask.
=================================================
We show how to extract brain information and mask from a b0 image using dipy's
segment.mask module.
First import the necessary modules:
"""
import os.path
import numpy as... | Python | 0.000016 |
51b716cc00efd0d0c93ffc11f4cd7242446bad88 | Remove unused pyrax import | nodes/management/commands/create_images.py | nodes/management/commands/create_images.py | from gevent import monkey
monkey.patch_all()
import gevent
import os
from django.core.management import BaseCommand
from django.conf import settings
from ...utils import connect_to_node, logger
class Command(BaseCommand):
help = 'create nodes images'
def handle(self, *args, **kwargs):
self._root = o... | from gevent import monkey
monkey.patch_all()
import gevent
import os
from django.core.management import BaseCommand
from django.conf import settings
from ...utils import connect_to_node, logger, pyrax
class Command(BaseCommand):
help = 'create nodes images'
def handle(self, *args, **kwargs):
self._r... | Python | 0 |
9ca88c5cd7f52c6f064a1d5edb003471f6223a74 | Change lable on click | Winston.py | Winston.py | import sys
from PyQt4.QtGui import *
#from PyQt4.QtWidgets import *
from PyQt4.QtCore import *
from core.Messenger import *
from core.Events import *
from alexa import AlexaService
class QTApp(QWidget):
def __init__(self):
super(QWidget, self).__init__()
self.title = 'Winston'
self.setWind... | import sys
from PyQt4.QtGui import *
#from PyQt4.QtWidgets import *
from PyQt4.QtCore import *
from core.Messenger import *
from core.Events import *
from alexa import AlexaService
class QTApp(QWidget):
def __init__(self):
super(QWidget, self).__init__()
self.title = 'Winston'
self.setWin... | Python | 0 |
2f31a1f0745214c2b06dadc1258926f7440d429f | Set datetime output format to ISO8601 | abe/app.py | abe/app.py | #!/usr/bin/env python3
"""Main flask app"""
from flask import Flask, render_template, jsonify
from flask_restful import Api
from flask_cors import CORS
from flask_sslify import SSLify # redirect to https
from flask.json import JSONEncoder
from datetime import datetime
import os
import logging
FORMAT = "%(levelname)... | #!/usr/bin/env python3
"""Main flask app"""
from flask import Flask, render_template, jsonify
from flask_restful import Api
from flask_cors import CORS
from flask_sslify import SSLify # redirect to https
import os
import logging
FORMAT = "%(levelname)s:ABE: _||_ %(message)s"
logging.basicConfig(level=logging.DEBUG, ... | Python | 0.999999 |
ba1494afb962fb8fba84e306cfb4c26a83602b6d | update license | drink.py | drink.py | # -*- coding: utf-8 -*-
import os
from server import app, db
import server.model
if __name__ == "__main__":
db.create_all()
app.run(debug=True) # host='10.10.56.190')
| # -*- coding: utf-8 -*-
"""
Copyright (C) 2014 Chuck Housley
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See the COPYING file for more details.
"""
import os
from server import app, db
import ser... | Python | 0 |
6b56ab963f46ac45caf0a2f3391fdedf9dfabb39 | Fix python2 compatibility | create_dataset.py | create_dataset.py | from __future__ import print_function
import os
import shutil
import spotipy
import pickle
import pandas as pd
import numpy as np
from collections import Counter
if not os.path.exists("genres.p"):
# Login to Spotify and get your OAuth token:
# https://developer.spotify.com/web-api/search-item/
AUTH = "B... | import os
import shutil
import spotipy
import pickle
import pandas as pd
import numpy as np
from collections import Counter
if not os.path.exists("genres.p"):
# Login to Spotify and get your OAuth token:
# https://developer.spotify.com/web-api/search-item/
AUTH = "BQBHlFpkjjlfDwbyQ7v0F1p_cejpmYARG6KDclVlP... | Python | 0.000303 |
1b726978e1604269c8c4d2728a6f7ce774e5d16d | Fix edit control assessment modal | src/ggrc/models/control_assessment.py | src/ggrc/models/control_assessment.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
from ggrc import db
from .mixins import (
deferred, BusinessObject, Timeboxe... | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
from ggrc import db
from .mixins import (
deferred, BusinessObject, Timeboxe... | Python | 0 |
e7d9a67611b2dc443c1f2bc23506323837d79bda | fix test_mcp | numerics/swig/tests/test_mcp.py | numerics/swig/tests/test_mcp.py | # Copyright (C) 2005, 2012 by INRIA
#!/usr/bin/env python
import numpy as np
import siconos.numerics as N
def mcp_function(z):
M = np.array([[2., 1.],
[1., 2.]])
q = np.array([-5., -6.])
return np.dot(M,z) + q
def mcp_Nablafunction(z):
M = np.array([[2., 1.],
[1.,... | # Copyright (C) 2005, 2012 by INRIA
#!/usr/bin/env python
import numpy as np
import siconos.numerics as N
def mcp_function (z) :
M = np.array([[2., 1.],
[1., 2.]])
q = np.array([-5., -6.])
return dot(M,z) + q
def mcp_Nablafunction (z) :
M = np.array([[2., 1.],
[1., 2.]]... | Python | 0.00002 |
2fbdd9903fc9bf6e1fe797e92c0157abd67850ce | add robust tests for exec_command() | numpy/distutils/tests/test_exec_command.py | numpy/distutils/tests/test_exec_command.py | import os
import sys
import StringIO
from numpy.distutils import exec_command
class redirect_stdout(object):
"""Context manager to redirect stdout for exec_command test."""
def __init__(self, stdout=None):
self._stdout = stdout or sys.stdout
def __enter__(self):
self.old_stdout = sys.std... | import sys
import StringIO
from numpy.distutils import exec_command
class redirect_stdout(object):
"""Context manager to redirect stdout for exec_command test."""
def __init__(self, stdout=None):
self._stdout = stdout or sys.stdout
def __enter__(self):
self.old_stdout = sys.stdout
... | Python | 0.000001 |
7138cd2fb7a5dc8a5044f15b19d3d53a1486dec3 | order by companies by name, helps when viewing adding companies to jobs entry form | companies/models.py | companies/models.py | from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from markupfield.fields import MarkupField
from cms.models import NameSlugModel
DEFAULT_MARKUP_TYPE = getattr(settings, 'DEFAULT_MARKUP_TYPE', 'restructuredtext')
class Company(NameSlugModel):
... | from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from markupfield.fields import MarkupField
from cms.models import NameSlugModel
DEFAULT_MARKUP_TYPE = getattr(settings, 'DEFAULT_MARKUP_TYPE', 'restructuredtext')
class Company(NameSlugModel):
... | Python | 0 |
f283dc1f710c8eca452d39f63f5b3b956e5676c8 | Fix the xs-tape9 option | transmutagen/origen.py | transmutagen/origen.py | import argparse
import os
from subprocess import run
from pyne.utils import toggle_warnings
import warnings
toggle_warnings()
warnings.simplefilter('ignore')
from pyne.origen22 import (nlbs, write_tape5_irradiation, write_tape4,
parse_tape9, merge_tape9, write_tape9, parse_tape6)
from pyne.material import from_at... | import argparse
import os
from subprocess import run
from pyne.utils import toggle_warnings
import warnings
toggle_warnings()
warnings.simplefilter('ignore')
from pyne.origen22 import (nlbs, write_tape5_irradiation, write_tape4,
parse_tape9, merge_tape9, write_tape9, parse_tape6)
from pyne.material import from_at... | Python | 0.999998 |
10e7388eec8d16f5a69e5d4f3b9e6cf56a1c956e | Remove explicit byte string from migration 0003 (#298) | silk/migrations/0003_request_prof_file.py | silk/migrations/0003_request_prof_file.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-08 18:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('silk', '0002_auto_update_uuid4_id_field'),
]
operations = [
migrations.AddFi... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-08 18:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('silk', '0002_auto_update_uuid4_id_field'),
]
operations = [
migrations.AddFi... | Python | 0.000004 |
30452b9fe815a2b68826b739625d1c06886fb17e | Remove redundant isinstance() check | pact/group.py | pact/group.py | import itertools
from .base import PactBase
class PactGroup(PactBase):
def __init__(self, pacts=None, lazy=True):
if pacts is None:
pacts = []
self._pacts = list(pacts)
self._finished_pacts = []
self._is_lazy = lazy
super(PactGroup, self).__init__()
def _... | import itertools
from .base import PactBase
class PactGroup(PactBase):
def __init__(self, pacts=None, lazy=True):
if pacts is None:
pacts = []
self._pacts = list(pacts)
self._finished_pacts = []
self._is_lazy = lazy
super(PactGroup, self).__init__()
def _... | Python | 0.000015 |
1b3657adf92b52d731fd0d9248f517a0cee58019 | Compute the difference with the previous timestamp | src/remora_parse_fs.py | src/remora_parse_fs.py | #!/usr/bin/env python
#
#========================================================================
# HEADER
#========================================================================
#% DESCRIPTION
#% remora_parse_fs
#%
#% DO NOT call this script directory. This is a postprocessing
#% tool called by REMORA
#%
#==========... | #!/usr/bin/env python
#
#========================================================================
# HEADER
#========================================================================
#% DESCRIPTION
#% remora_parse_fs
#%
#% DO NOT call this script directory. This is a postprocessing
#% tool called by REMORA
#%
#==========... | Python | 1 |
7dc9085bf0665efc3083b64c0b34cb7c8c92ae31 | update now drops duplicates | dblib/dbUpdate.py | dblib/dbUpdate.py | import pymongo
import multiprocessing
import multiprocessing.connection
import time
SIZE = 128
NUM_NODES = 3
def recv_data(sock,dataQueue,cQueue):
connect = sock.accept()
cQueue.put("listen")
data = connect.recv()
dataQueue.put(data)
connect.close()
print("received data")
exit(0)
def db_s... | import pymongo
import multiprocessing
import multiprocessing.connection
import time
SIZE = 128
NUM_NODES = 3
def recv_data(sock,dataQueue,cQueue):
connect = sock.accept()
cQueue.put("listen")
data = connect.recv()
dataQueue.put(data)
connect.close()
print("received data")
exit(0)
def db_s... | Python | 0 |
e76d6ad7a4670bfa47ba506343aff2e5f118f976 | fix rsync options for use in shared scenarios | myriadeploy/update_myria_jar_only.py | myriadeploy/update_myria_jar_only.py | #!/usr/bin/env python
import myriadeploy
import subprocess
import sys
def host_port_list(workers):
return [str(worker[0]) + ':' + str(worker[1]) for worker in workers]
def get_host_port_path(node, default_path):
if len(node) == 2:
(hostname, port) = node
if default_path is None:
... | #!/usr/bin/env python
import myriadeploy
import subprocess
import sys
def host_port_list(workers):
return [str(worker[0]) + ':' + str(worker[1]) for worker in workers]
def get_host_port_path(node, default_path):
if len(node) == 2:
(hostname, port) = node
if default_path is None:
... | Python | 0 |
afbef65bd28f0058edf39579125e2ccb35a72aee | Update test_multivariate.py to Python 3.4 | nb_twitter/test/test_multivariate.py | nb_twitter/test/test_multivariate.py | # -*- coding: utf-8 -*-
# test_multivariate.py
# nb_twitter/nb_twitter/bayes
#
# Created by Thomas Nelson <tn90ca@gmail.com>
# Preston Engstrom <pe12nh@brocku.ca>
# Created..........................2015-06-29
# Modified.........................2015-06-30
#
# This script was developed for use as part of the ... | # -*- coding: utf-8 -*-
# test_multivariate.py
# nb_twitter/nb_twitter/bayes
#
# Created by Thomas Nelson <tn90ca@gmail.com>
# Preston Engstrom <pe12nh@brocku.ca>
# Created..........................2015-06-29
# Modified.........................2015-06-29
#
# This script was developed for use as part of the ... | Python | 0.000009 |
45b0af75824c1f7715c464ae2dfc35ac8d7a9767 | Add additional_tags parameter to upload and pass through client args to httplib2. | cloudshark/cloudshark.py | cloudshark/cloudshark.py |
import httplib2
import io
import json
import os
import urllib
class CloudsharkError(Exception):
def __init__(self, msg, error_code=None):
self.msg = msg
self.error_code = error_code
def __str__(self):
return repr('%s: %s' % (self.error_code, self.msg))
class Cloudshark(object):
... |
import httplib2
import io
import json
import os
import urllib
class CloudsharkError(Exception):
def __init__(self, msg, error_code=None):
self.msg = msg
self.error_code = error_code
def __str__(self):
return repr('%s: %s' % (self.error_code, self.msg))
class Cloudshark(object):
... | Python | 0 |
1b668fa59624bc1f73f5fceebecbbadfc0038156 | support arrow DictionaryType | packages/vaex-arrow/vaex_arrow/dataset.py | packages/vaex-arrow/vaex_arrow/dataset.py | __author__ = 'maartenbreddels'
import logging
import pyarrow as pa
import pyarrow.parquet as pq
import vaex.dataset
import vaex.file.other
from .convert import column_from_arrow_array
logger = logging.getLogger("vaex_arrow")
class DatasetArrow(vaex.dataset.DatasetLocal):
"""Implements storage using arrow"""
... | __author__ = 'maartenbreddels'
import logging
import pyarrow as pa
import pyarrow.parquet as pq
import vaex.dataset
import vaex.file.other
from .convert import column_from_arrow_array
logger = logging.getLogger("vaex_arrow")
class DatasetArrow(vaex.dataset.DatasetLocal):
"""Implements storage using arrow"""
... | Python | 0 |
52239a9b6cd017127d52c29ac0e2a0d3818e7d9e | Add new lab_members fieldset_website to fieldsets for cms_lab_members | cms_lab_members/admin.py | cms_lab_members/admin.py | from django.contrib import admin
from cms.admin.placeholderadmin import PlaceholderAdminMixin
from lab_members.models import Scientist
from lab_members.admin import ScientistAdmin
class CMSScientistAdmin(PlaceholderAdminMixin, ScientistAdmin):
fieldsets = [
ScientistAdmin.fieldset_basic,
Scientist... | from django.contrib import admin
from cms.admin.placeholderadmin import PlaceholderAdminMixin
from lab_members.models import Scientist
from lab_members.admin import ScientistAdmin
class CMSScientistAdmin(PlaceholderAdminMixin, ScientistAdmin):
fieldsets = [
ScientistAdmin.fieldset_basic,
Scientist... | Python | 0 |
dda3ebfcb9fff7f7304ee72c087dca9f8556fe6c | Update yadisk.py | cogs/utils/api/yadisk.py | cogs/utils/api/yadisk.py | import json
import requests
DEVICE_ID = '141f72b7-fd02-11e5-981a-00155d860f42'
DEVICE_NAME = 'DroiTaka'
CLIENT_ID = 'b12710fc26ee46ba82e34b97f08f2305'
CLIENT_SECRET = '4ff2284115644e04acc77c54526364d2'
class YaDisk(object):
def __init__(self, token):
self.session = requests.session()
self.session.headers.update... | import json
import requests
DEVICE_ID = '141f72b7-fd02-11e5-981a-00155d860f42'
DEVICE_NAME = 'DroiTaka'
CLIENT_ID = 'b12710fc26ee46ba82e34b97f08f2305'
CLIENT_SECRET = '4ff2284115644e04acc77c54526364d2'
class YaDisk(object):
def __init__(self, token):
self.session = requests.session()
self.session.headers.update... | Python | 0.000001 |
2eb1535c3bb137216548bacaf9f7a22cd9e0e8a2 | Fix incorrect double-quotes. | colour/plotting/graph.py | colour/plotting/graph.py | # -*- coding: utf-8 -*-
"""
Automatic Colour Conversion Graph Plotting
==========================================
Defines the automatic colour conversion graph plotting objects:
- :func:`colour.plotting.plot_automatic_colour_conversion_graph`
"""
from __future__ import division
from colour.graph import CONVERSION... | # -*- coding: utf-8 -*-
"""
Automatic Colour Conversion Graph Plotting
==========================================
Defines the automatic colour conversion graph plotting objects:
- :func:`colour.plotting.plot_automatic_colour_conversion_graph`
"""
from __future__ import division
from colour.graph import CONVERSION... | Python | 0.000178 |
14043a783e2ebd6c4a27a38f08ca75e6e31dd5d8 | Add show admin panel | cinemair/shows/admin.py | cinemair/shows/admin.py | from django.contrib import admin
from . import models
class ShowsInline(admin.TabularInline):
model = models.Show
extra = 0
@admin.register(models.Show)
class Show(admin.ModelAdmin):
fieldsets = (
(None, {"fields": ("cinema", "movie", "datetime")}),
)
list_display = ("id", "cinema", "mo... | from django.contrib import admin
from . import models
class ShowsInline(admin.TabularInline):
model = models.Show
extra = 0
| Python | 0 |
9e1b3893a676f0fff7d601245fd06ec5df7fb61f | bump version | circleparse/__init__.py | circleparse/__init__.py | from circleparse.replay import parse_replay_file, parse_replay
__version__ = "6.1.0"
| from circleparse.replay import parse_replay_file, parse_replay
__version__ = "6.0.0"
| Python | 0 |
0251d41a46165f76b8e76da716bbc280723ce767 | Make the circuits.web.loggers.Logger understand and respect X-Forwarded-For request headers when logging the remote host | circuits/web/loggers.py | circuits/web/loggers.py | # Module: loggers
# Date: 6th November 2008
# Author: James Mills, prologic at shortcircuit dot net dot au
"""Logger Component
This module implements Logger Components.
"""
import os
import sys
import rfc822
import datetime
from circuits.core import handler, BaseComponent
def formattime():
now = dateti... | # Module: loggers
# Date: 6th November 2008
# Author: James Mills, prologic at shortcircuit dot net dot au
"""Logger Component
This module implements Logger Components.
"""
import os
import sys
import rfc822
import datetime
from circuits.core import handler, BaseComponent
def formattime():
now = dateti... | Python | 0 |
3026d78dc6e2a0f6f391819370f2369df94e77eb | Move Data Portal / Other to bottom of contact select | ckanext/nhm/settings.py | ckanext/nhm/settings.py | #!/usr/bin/env python
# encoding: utf-8
#
# This file is part of ckanext-nhm
# Created by the Natural History Museum in London, UK
from collections import OrderedDict
# the order here matters as the default option should always be first in the dict so that it is
# automatically selected in combo boxes that use this li... | #!/usr/bin/env python
# encoding: utf-8
#
# This file is part of ckanext-nhm
# Created by the Natural History Museum in London, UK
from collections import OrderedDict
# the order here matters as the default option should always be first in the dict so that it is
# automatically selected in combo boxes that use this li... | Python | 0 |
2105143c63292ec225258b3ca129156d858cf972 | Use OrderParameterDistribution objects in wetting. | coex/wetting.py | coex/wetting.py | """Find the wetting properties of a direct or expanded ensemble
grand canonical simulation.
"""
import numpy as np
def get_cos_theta(s, d):
"""Calculate the cosine of the contact angle.
Args:
s: A float (or numpy array): the spreading coefficient.
d: A float (or numpy array): the drying coef... | """Find the wetting properties of a direct or expanded ensemble
grand canonical simulation.
"""
import numpy as np
def get_cos_theta(s, d):
"""Calculate the cosine of the contact angle.
Args:
s: A float (or numpy array): the spreading coefficient.
d: A float (or numpy array): the drying coef... | Python | 0 |
a962e631b0fc997a6a5569244463c3f96da8b671 | add extra fwhm2sigma test | lib/neuroimaging/fmri/tests/test_utils.py | lib/neuroimaging/fmri/tests/test_utils.py | import unittest
import numpy as N
import scipy
from neuroimaging.fmri.utils import CutPoly, WaveFunction, sigma2fwhm, fwhm2sigma
class utilTest(unittest.TestCase):
def test_CutPoly(self):
f = CutPoly(2.0)
t = N.arange(0, 10.0, 0.1)
y = f(t)
scipy.testing.assert_almost_equal(y,... | import unittest
import numpy as N
import scipy
from neuroimaging.fmri.utils import CutPoly, WaveFunction, sigma2fwhm, fwhm2sigma
class utilTest(unittest.TestCase):
def test_CutPoly(self):
f = CutPoly(2.0)
t = N.arange(0, 10.0, 0.1)
y = f(t)
scipy.testing.assert_almost_equal(y,... | Python | 0.000001 |
108763ace5f250922387aacffab4a668155cfe67 | deploy script changes | deploy/fabfile.py | deploy/fabfile.py | # -*- coding: utf-8 -*-
# http://docs.fabfile.org/en/1.5/tutorial.html
from __future__ import with_statement
from fabric.api import *
from contextlib import contextmanager as _contextmanager
@_contextmanager
def virtualenv():
with prefix(env.virtualenv_activate):
yield
env.hosts = ['176.58.125.166']
env.... | # -*- coding: utf-8 -*-
# http://docs.fabfile.org/en/1.5/tutorial.html
from __future__ import with_statement
from fabric.api import *
from contextlib import contextmanager as _contextmanager
@_contextmanager
def virtualenv():
with prefix(env.virtualenv_activate):
yield
env.hosts = ['176.58.125.166']
env.... | Python | 0.000001 |
34fa7433ea6f04089a420e0392605147669801d1 | Revert "added more crappy codes" | dummy.py | dummy.py | import os
def foo():
"""
This is crappy function. should be removed using git checkout
"""
return None
def main():
pass
if __name__ == '__main__':
main()
| import os
def foo():
"""
This is crappy function. should be removed using git checkout
"""
if True == True:
return True
else:
return False
def main():
pass
if __name__ == '__main__':
main()
| Python | 0 |
e4850d9ba5cb4733862194298cdbb8a34766b39f | update tests for new api | reddit.py | reddit.py | import json, random, urllib2
def declare():
return {"reddit": "privmsg", "guess": "privmsg"}
def callback(self):
channel = self.channel
command = self.command
user = self.user
msg = self.message
type = self.type
isop = self.isop
if command == 'guess':
u = 'SwordOrSheath'
e... | import json, random, urllib2
def declare():
return {"reddit": "privmsg", "guess": "privmsg"}
def callback(self):
channel = self.channel
command = self.command
user = self.user
msg = self.message
type = self.type
isop = self.isop
if command == 'guess':
u = 'SwordOrSheath'
e... | Python | 0 |
acd0b8803579ece5b52a3158c05140ff1287f0be | Handle string values better in FilterComparison.__str__ | odin/filtering.py | odin/filtering.py | # -*- coding: utf-8 -*-
import six
from .traversal import TraversalPath
class FilterAtom(object):
"""
Base filter statement
"""
def __call__(self, resource):
raise NotImplementedError()
def any(self, collection):
return any(self(r) for r in collection)
def all(self, collectio... | # -*- coding: utf-8 -*-
from .traversal import TraversalPath
class FilterAtom(object):
"""
Base filter statement
"""
def __call__(self, resource):
raise NotImplementedError()
def any(self, collection):
return any(self(r) for r in collection)
def all(self, collection):
... | Python | 0.000019 |
178bde1703bbb044f8af8c70a57517af4490a3c0 | Fix duplicate cookie issue and header parsing | databot/handlers/download.py | databot/handlers/download.py | import time
import requests
import bs4
import cgi
from databot.recursive import call
class DownloadErrror(Exception):
pass
def dump_response(response):
return {
'headers': dict(response.headers),
'cookies': response.cookies.get_dict(),
'status_code': response.status_code,
'e... | import time
import requests
import bs4
from databot.recursive import call
class DownloadErrror(Exception):
pass
def dump_response(response):
return {
'headers': dict(response.headers),
'cookies': dict(response.cookies),
'status_code': response.status_code,
'encoding': respon... | Python | 0.000001 |
5de8209ec751fec9178a86e713393d8eafb7a124 | Abort when strange things happen | emwin.py | emwin.py | from time import strptime, mktime, time
import logging
import sys
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s'))
log = logging.getLogger('emwin')
log.addHandler(handler)
log.setLevel(logging.DEBUG)
class Connection(object):
def __init__... | from time import strptime, mktime
import logging
import sys
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s'))
log = logging.getLogger('emwin')
log.addHandler(handler)
log.setLevel(logging.DEBUG)
class Connection(object):
def __init__(self,... | Python | 0.000008 |
32446090486db452342ec76606d28a05f6736e81 | Update tracking.py | panoptes/state/states/default/tracking.py | panoptes/state/states/default/tracking.py | import time
def on_enter(event_data):
""" The unit is tracking the target. Proceed to observations. """
pan = event_data.model
pan.say("Checking our tracking")
next_state = 'parking'
try:
pan.say("I'm adjusting the tracking rate")
#pan.observatory.update_tracking()
next_st... | import time
def on_enter(event_data):
""" The unit is tracking the target. Proceed to observations. """
pan = event_data.model
pan.say("Checking our tracking")
next_state = 'parking'
try:
pan.say("I'm adjusting the tracking rate")
pan.observatory.update_tracking()
next_sta... | Python | 0.000001 |
cbae828ee9eb91a2373a415f1a1521fb5dee3100 | Add method to generate list of abscissa dicts | datac/main.py | datac/main.py | # -*- coding: utf-8 -*-
import copy
def init_abscissa(params, abscissae, abscissa_name):
"""
List of dicts to initialize object w/ calc method
This method generates a list of dicts; each dict is sufficient to initialize an object featuring a calculator method of interest. This list can be thought of as th... | # -*- coding: utf-8 -*-
import copy
| Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.