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
e312e2c61d6ddba147be73e636b26b14aaf49f60
use django.conf.settings instead of plain settings
lingcod/kmlapp/tests.py
lingcod/kmlapp/tests.py
""" Unit tests for the KML App """ from django.conf import settings from django.test import TestCase from django.contrib.gis.geos import GEOSGeometry from django.contrib.auth.models import * from lingcod.common import utils from lingcod.mpa.models import MpaDesignation Mpa = utils.get_mpa_class() MpaArray = utils.get...
""" Unit tests for the KML App """ import settings from django.test import TestCase from django.contrib.gis.geos import GEOSGeometry from django.contrib.auth.models import * from lingcod.common import utils from lingcod.mpa.models import MpaDesignation Mpa = utils.get_mpa_class() MpaArray = utils.get_array_class() u...
Python
0
368d46ba4bec2da22abfba306badf39a3a552e88
Remove now-unused imports
tests/test_snippets.py
tests/test_snippets.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. from xml.dom.minidom import parseString from xml.parsers.expat import ExpatError import pytest import requests from bs4...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import json import re from xml.dom.minidom import parseString from xml.parsers.expat import ExpatError import pytest im...
Python
0
142ef9b907868f53c696bd4426a7f08b7ef57528
Change metatdata test
tests/test_tifffile.py
tests/test_tifffile.py
""" Test tifffile plugin functionality. """ import os import numpy as np from pytest import raises from imageio.testing import run_tests_if_main, get_test_dir, need_internet from imageio.core import get_remote_file import imageio test_dir = get_test_dir() def test_tifffile_format(): # Test selection for ...
""" Test tifffile plugin functionality. """ import os import numpy as np from pytest import raises from imageio.testing import run_tests_if_main, get_test_dir, need_internet from imageio.core import get_remote_file import imageio test_dir = get_test_dir() def test_tifffile_format(): # Test selection for ...
Python
0
8d09e745f24e663cb81ff5be6bc7b643c6c5bd76
call it pennyblack 0.3.0
pennyblack/__init__.py
pennyblack/__init__.py
VERSION = (0, 3, 0,) __version__ = '.'.join(map(str, VERSION)) # Do not use Django settings at module level as recommended try: from django.utils.functional import LazyObject except ImportError: pass else: class LazySettings(LazyObject): def _setup(self): from pennyblack import default_...
VERSION = (0, 3, 0, 'pre') __version__ = '.'.join(map(str, VERSION)) # Do not use Django settings at module level as recommended try: from django.utils.functional import LazyObject except ImportError: pass else: class LazySettings(LazyObject): def _setup(self): from pennyblack import de...
Python
0.999594
57d5622d205854eafd8babf8dfa1ad45bf05ebcb
Update ipc_lista1.15.py
lista1/ipc_lista1.15.py
lista1/ipc_lista1.15.py
#ipc_lista1.15 #Professor: Jucimar Junior #Any Mendes Carvalho - 1615310044 # # # # ##Faça um Programa que pergunte quanto você ganha por hora e o número de horas trabalhadas no mês. Calcule e mostre o total do seu salário no referido mês, sabendo-se que são descontados 11% para o Imposto de Renda, 8% para o INSS e 5% ...
#ipc_lista1.15 #Professor: Jucimar Junior #Any Mendes Carvalho - 1615310044 # # # # ##Faça um Programa que pergunte quanto você ganha por hora e o número de horas trabalhadas no mês. Calcule e mostre o total do seu salário no referido mês, sabendo-se que são descontados 11% para o Imposto de Renda, 8% para o INSS e 5% ...
Python
0
b37432e914b6c6e45803a928f35fbaa8964780aa
test by uuid
tests/unit/test_log.py
tests/unit/test_log.py
import pytest from raft import log def mle(index, term, committed=False, msgid='', msg={}): return dict(index=index, term=term, committed=committed, msgid=msgid, msg=msg) def test_le(): # a's term is greater than b's a = {1: mle(1, 2), 2: mle(2, 2), 3: mle(3, 4)} b =...
import pytest from raft import log def mle(index, term, committed=False, msgid='', msg={}): return dict(index=index, term=term, committed=committed, msgid=msgid, msg=msg) def test_le(): # a's term is greater than b's a = {1: mle(1, 2), 2: mle(2, 2), 3: mle(3, 4)} b =...
Python
0.000001
62d5a4446c4c0a919557dd5f2e95d21c5a8259a8
Test the optimized set
tests/unit/test_set.py
tests/unit/test_set.py
import pytest from pypred import OptimizedPredicateSet, PredicateSet, Predicate class TestPredicateSet(object): def test_two(self): p1 = Predicate("name is 'Jack'") p2 = Predicate("name is 'Jill'") s = PredicateSet([p1, p2]) match = s.evaluate({'name': 'Jill'}) assert match ...
from pypred import PredicateSet, Predicate class TestPredicateSet(object): def test_two(self): p1 = Predicate("name is 'Jack'") p2 = Predicate("name is 'Jill'") s = PredicateSet([p1, p2]) match = s.evaluate({'name': 'Jill'}) assert match == [p2] def test_dup(self): ...
Python
0.000043
cae0764f2cbb8d00de1832079e55b8e4d45f55f2
Fix for short OTU name when there is a species but no genus or higher
phylotoast/otu_calc.py
phylotoast/otu_calc.py
from __future__ import division import ast from collections import defaultdict from phylotoast import biom_calc as bc def otu_name(tax): """ Determine a simple Genus-species identifier for an OTU, if possible. If OTU is not identified to the species level, name it as Unclassified (familly/genus/etc......
from __future__ import division import ast from collections import defaultdict from phylotoast import biom_calc as bc def otu_name(tax): """ Determine a simple Genus-species identifier for an OTU, if possible. If OTU is not identified to the species level, name it as Unclassified (familly/genus/etc......
Python
0.00004
7c4d3fffe62190b8c27317ed83bd5e7110b103ec
Update parser.py
MusicXMLParser/parser.py
MusicXMLParser/parser.py
''' Takes a musicXML file, and creates a file that can be played by my MusicPlayer arduino library. Written by Eivind Lie Andreassen, 2016 Licensed under the MIT license. ''' import xml.dom.minidom import valueHelper xmlPath = input("Enter path to MusicXML file: ") savePath = input("Enter save path of con...
''' Takes a musicXML file, and creates a file that can be played by my MusicPlayer arduino library. Written by Eivind Lie Andreassen, 2016 Licensed under Creative Commons Attribution-ShareAlike 4.0 International. http://creativecommons.org/licenses/by-sa/4.0/ ''' import xml.dom.minidom import valueHelper xml...
Python
0.000001
83b83cb3491bd4ccf39e2c6ade72f8f526ea27fe
Increase toolbox reporting
ArcToolbox/Scripts/ExportFolder2PDF.py
ArcToolbox/Scripts/ExportFolder2PDF.py
#Export a folder of maps to PDFs at their Map Document set sizes #Written using ArcGIS 10 and Python 2.6.5 #by: Guest # https://gis.stackexchange.com/questions/7147/how-to-batch-export-mxd-to-pdf-files import arcpy, os #Read input parameter from user. path = arcpy.GetParameterAsText(0) #Write MXD names in folder to ...
#Export a folder of maps to PDFs at their Map Document set sizes #Written using ArcGIS 10 and Python 2.6.5 #by: Guest # https://gis.stackexchange.com/questions/7147/how-to-batch-export-mxd-to-pdf-files import arcpy, os #Read input parameter from user. path = arcpy.GetParameterAsText(0) #Write MXD names in folder to ...
Python
0
f5a3d65d56a1746fac3bd42d38537cca359a968c
improve range-only command detection
ex_command_parser.py
ex_command_parser.py
"""a simple 'parser' for :ex commands """ from collections import namedtuple import re # holds info about an ex command EX_CMD = namedtuple('ex_command', 'name command forced range args') EX_RANGE_REGEXP = re.compile(r'^(:?([.$%]|(:?/.*?/|\?.*?\?){1,2}|\d+)([-+]\d+)?)(([,;])(:?([.$]|(:?/.*?/|\?.*?\?){1,2}|\d+)([-+]...
"""a simple 'parser' for :ex commands """ from collections import namedtuple import re # holds info about an ex command EX_CMD = namedtuple('ex_command', 'name command forced range args') EX_RANGE_REGEXP = re.compile(r'^(:?([.$%]|(:?/.*?/|\?.*?\?){1,2}|\d+)([-+]\d+)?)(([,;])(:?([.$]|(:?/.*?/|\?.*?\?){1,2}|\d+)([-+]...
Python
0.000001
b614436766e8ee3316936c5718262b35cfae3869
Add slug field on save
memex_explorer/base/models.py
memex_explorer/base/models.py
from django.db import models from django.utils.text import slugify class Project(models.Model): name = models.CharField(max_length=64) slug = models.SlugField(max_length=64, unique=True) description = models.TextField() icon = models.CharField(max_length=64) def __str__(self): return sel...
from django.db import models class Project(models.Model): name = models.CharField(max_length=64) slug = models.SlugField(max_length=64, unique=True) description = models.TextField() icon = models.CharField(max_length=64) def __str__(self): return self.name class DataModel(models.Model):...
Python
0.000001
047db1c64cd5b7ef070f73e1d580e36236ac9613
Print warning when using deprecated 'python3' module
mesonbuild/modules/python3.py
mesonbuild/modules/python3.py
# Copyright 2016-2017 The Meson development team # 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 agree...
# Copyright 2016-2017 The Meson development team # 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 agree...
Python
0.000007
1018d6bde32a8d18a2315dafd084826443209ba1
Update clock.py
examples/clock.py
examples/clock.py
#!/usr/bin/python import time import datetime from Adafruit_LED_Backpack import SevenSegment # =========================================================================== # Clock Example # =========================================================================== segment = SevenSegment.SevenSegment(address=0x70) #...
#!/usr/bin/python import time import datetime from Adafruit_LED_Backpack import SevenSegment # =========================================================================== # Clock Example # =========================================================================== segment = SevenSegment.SevenSegment(address=0x70) #...
Python
0.000002
37da8a56f127a871c4133f0ba58921779e9b487c
Update __init__.py
deepdish/io/__init__.py
deepdish/io/__init__.py
from __future__ import division, print_function, absolute_import from .mnist import load_mnist from .norb import load_small_norb from .casia import load_casia from .cifar import load_cifar_10 try: import tables _pytables_ok = True del tables except ImportError: _pytables_ok = False if _pytables_ok: ...
from __future__ import division, print_function, absolute_import from .mnist import load_mnist from .norb import load_small_norb from .casia import load_casia from .cifar import load_cifar_10 try: import tables _pytables_ok = True except ImportError: _pytables_ok = False del tables if _pytables_ok: fr...
Python
0
0d914a4843e5959c108077e8c5275a1ddd05f617
Upgrade version number
djaloha/__init__.py
djaloha/__init__.py
# -*- coding: utf-8 -*- VERSION = (0, 2) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) # if VERSION[2]: # version = '%s.%s' % (version, VERSION[2]) # if VERSION[3] != "final": # version = '%s%s%s' % (version, VERSION[3], VERSION[4]) return version __version__ = get_versi...
# -*- coding: utf-8 -*- VERSION = (0, 1) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) # if VERSION[2]: # version = '%s.%s' % (version, VERSION[2]) # if VERSION[3] != "final": # version = '%s%s%s' % (version, VERSION[3], VERSION[4]) return version __version__ = get_versi...
Python
0.000001
0f5433458be9add6a879e8e490017663714d7664
fix cron job FailedRunsNotificationCronJob to import get_class routine from new place
django_cron/cron.py
django_cron/cron.py
from django.conf import settings from django_cron import CronJobBase, Schedule, get_class from django_cron.models import CronJobLog from django_common.helper import send_mail class FailedRunsNotificationCronJob(CronJobBase): """ Send email if cron failed to run X times in a row """ RUN_EVERY_MINS...
from django.conf import settings from django_cron import CronJobBase, Schedule from django_cron.models import CronJobLog from django_cron.management.commands.runcrons import get_class from django_common.helper import send_mail class FailedRunsNotificationCronJob(CronJobBase): """ Send email if cron faile...
Python
0
57184440872c8c29906c84a919624e7878f7d75c
fix compat
skitai/backbone/https_server.py
skitai/backbone/https_server.py
#!/usr/bin/env python from . import http_server from ..counter import counter import socket, time from rs4 import asyncore import ssl from skitai import lifetime import os, sys, errno import skitai from errno import EWOULDBLOCK from aquests.protocols.http2 import H2_PROTOCOLS from ..handlers import vhost_handler clas...
#!/usr/bin/env python from . import http_server from ..counter import counter import socket, time from rs4 import asyncore import ssl from skitai import lifetime import os, sys, errno import skitai from errno import EWOULDBLOCK from aquests.protocols.http2 import H2_PROTOCOLS from ..handlers import vhost_handler clas...
Python
0.000001
7f3b2b0ab21e4dadffb55da912684eb84ce6da3d
Check if remot git is already on commit
gitric/api.py
gitric/api.py
from __future__ import with_statement from fabric.state import env from fabric.api import local, run, abort, task, cd, puts from fabric.context_managers import settings @task def allow_dirty(): '''allow pushing even when the working copy is dirty''' env.gitric_allow_dirty = True @task def force_push(): ...
from __future__ import with_statement from fabric.state import env from fabric.api import local, run, abort, task from fabric.context_managers import settings @task def allow_dirty(): '''allow pushing even when the working copy is dirty''' env.gitric_allow_dirty = True @task def force_push(): '''allow p...
Python
0
47e7fcc3b837b459a2800e09ee87c2a6f87cdfba
Update SController.py
skype_controller/SController.py
skype_controller/SController.py
"""Import somes important packages""" import Skype4Py import config as gbconfig import json from common import get_project_path # Get Skype class instance SKYPE_OBJ = Skype4Py.Skype() # Establish the connection from the Skype object to the Skype ddclient. SKYPE_OBJ.Attach() # Get all contact from object. This funct...
"""Import somes important packages""" import Skype4Py import config as gbconfig import json from common import get_project_path # Get Skype class instance SKYPE_OBJ = Skype4Py.Skype() # Establish the connection from the Skype object to the Skype ddclient. SKYPE_OBJ.Attach() # Get all contact from object. This funct...
Python
0.000001
f21e732eada64a18e08524052ec66ce8705d9e9b
make imagemagick env var default to 'convert' instead of None
glc/config.py
glc/config.py
""" glc.config ========== At the moment this only houses the environmental variable for the ImageMagick binary. If you don't want to set that, or can't for some reason, you can replace ``"convert"`` with the path where the ``convert`` application that comes with it lives in, if it doesn't ...
""" glc.config ========== At the moment this only houses the environmental variable for the ImageMagick binary. If you don't want to set that, or can't for some reason, you can replace ``None`` with the path where the ``convert`` application that comes with it lives in. (c) 2016 LeoV ...
Python
0.000113
d338dc15c57e3aea12de78354da908b1457c5055
Clean up command more (#30)
earwigbot/commands/lag.py
earwigbot/commands/lag.py
# -*- coding: utf-8 -*- # # Copyright (C) 2009-2012 Ben Kurtovic <ben.kurtovic@verizon.net> # # 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 limitatio...
# -*- coding: utf-8 -*- # # Copyright (C) 2009-2012 Ben Kurtovic <ben.kurtovic@verizon.net> # # 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 limitatio...
Python
0.000001
09a313a2cd74c391c12761306cb8ae641e9f0d28
fix logs app prompt
ebcli/controllers/logs.py
ebcli/controllers/logs.py
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
Python
0.000001
d3cd1778f4ccb1651feb2186ecfdd0c81f86088c
Improve Instruction parsing
instruction.py
instruction.py
class Instruction(object): def __init__(self, line): instr = line.split(' ') self.name = instr[0] self.ops = [] if len(instr) > 4: raise Exception('too many operands: {}'.format(line)) # iterate through operands, perform some loose checks, and append # t...
class Instruction(object): def __init__(self, line): instr = line.split(' ') self.name = instr[0] self.ops = [] if len(instr) > 4: raise Exception('too many operands: {}'.format(line)) # iterate through operands, perform some loose checks, and append # t...
Python
0.000072
23c95dcba178b3876bf07bec4b0c4f5c06895181
add padding to file names
copyfiles.py
copyfiles.py
import hashlib import os import random import shutil import string BLOCKSIZE = 65536 class FileCopier(object): def __init__(self, dest_dir, copy): self._dest_dir = dest_dir self._copy = copy def copy_file(self, in_path, date, subject): out_dir = self._get_directory_name(date, subject)...
import hashlib import os import random import shutil import string BLOCKSIZE = 65536 class FileCopier(object): def __init__(self, dest_dir, copy): self._dest_dir = dest_dir self._copy = copy def copy_file(self, in_path, date, subject): out_dir = self._get_directory_name(date, subject)...
Python
0.000001
daa29e745256b164b3375e502444ec247aa0d892
implement get_default_args for the future repr development
logwrap/func_helpers.py
logwrap/func_helpers.py
# Copyright 2016 Mirantis, Inc. # Copyright 2016 Alexey Stepanov aka penguinolog # 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/LICENS...
# Copyright 2016 Mirantis, Inc. # Copyright 2016 Alexey Stepanov aka penguinolog # 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/LICENS...
Python
0
d223ee2988be1eb439ebde1146c28ffc83576a29
Return empty list on exception
fetch_mentions.py
fetch_mentions.py
import time import requests import json import tweepy from tweepy.error import TweepError from raven import Client from settings import consumer_key, consumer_secret, key, secret, count, pubKey, payload_type, SENTRY_DSN,\ overlap_count, waiting_period, speed_layer_endpoint_url, password, timeout, ssl_verification...
import time import requests import json import tweepy from tweepy.error import TweepError from raven import Client from settings import consumer_key, consumer_secret, key, secret, count, pubKey, payload_type, SENTRY_DSN,\ overlap_count, waiting_period, speed_layer_endpoint_url, password, timeout, ssl_verification...
Python
0.999717
8d0a41391fae5c66c296d5dfacc0ac6f82a6b355
fix gridsearch path
gridsearch.py
gridsearch.py
import time import itertools as it from gensim.models import word2vec from goethe.corpora import Corpus model_config = { 'size': [200, 300, 400, 500, 600], 'window': [5, 10, 20], 'sg': [0, 1] # Skip-gram or CBOW } sample_size = 10000000 epochs = 10 def train_model(config): size, window, sg = config ...
import time import itertools as it from gensim.models import word2vec from goethe.corpora import Corpus model_config = { 'size': [200, 300, 400, 500, 600], 'window': [5, 10, 20], 'sg': [0, 1] # Skip-gram or CBOW } sample_size = 10000000 epochs = 10 def train_model(config): size, window, sg = config ...
Python
0.000001
f682300d4a8ab7e13ad0e26d2b37fdf24cdbdce9
Bump development version
filer/__init__.py
filer/__init__.py
# -*- coding: utf-8 -*- # version string following pep-0396 and pep-0386 __version__ = '1.2.6.rc2' # pragma: nocover default_app_config = 'filer.apps.FilerConfig'
# -*- coding: utf-8 -*- # version string following pep-0396 and pep-0386 __version__ = '1.2.6.rc1' # pragma: nocover default_app_config = 'filer.apps.FilerConfig'
Python
0
05c8dffcbfc08bbfd98d0f6a506af245719b3ac8
FIX dependency
stock_picking_ean128_report/__openerp__.py
stock_picking_ean128_report/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Pu...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Pu...
Python
0.000001
9608fff230665f5120e6ea98d4ae0efc91a345ef
Revert "Add teuthology git version query/logging"
teuthology/__init__.py
teuthology/__init__.py
from gevent import monkey monkey.patch_all( dns=False, # Don't patch subprocess to avoid http://tracker.ceph.com/issues/14990 subprocess=False, ) import sys # Don't write pyc files sys.dont_write_bytecode = True from .orchestra import monkey monkey.patch_all() import logging import os __version__ = '0....
from gevent import monkey monkey.patch_all( dns=False, # Don't patch subprocess to avoid http://tracker.ceph.com/issues/14990 subprocess=False, ) import sys # Don't write pyc files sys.dont_write_bytecode = True from .orchestra import monkey monkey.patch_all() import logging import os import subprocess ...
Python
0
26123b15e28975c331b4c29e86bf69f2bee3a2c2
Add option to get_or_create_inspection to filter inspections with content.
thezombies/tasks/urls.py
thezombies/tasks/urls.py
from __future__ import absolute_import from django.db import transaction from django.conf import settings from celery import shared_task import requests from requests.exceptions import (MissingSchema) from cachecontrol import CacheControl from .utils import ResultDict, logger from thezombies.models import URLInspecti...
from __future__ import absolute_import from django.db import transaction from django.conf import settings from celery import shared_task import requests from requests.exceptions import (MissingSchema) from cachecontrol import CacheControl from .utils import ResultDict, logger from thezombies.models import URLInspecti...
Python
0
0e4c8fb4965eadf8cf45ff0f6d3406df17015f46
remove print
timeside/server/tasks.py
timeside/server/tasks.py
from __future__ import absolute_import import time import gc from celery import shared_task from celery.result import AsyncResult from celery.result import GroupResult from .models import Item, Selection, Preset, Experience, Task from .models import _DONE from celery.task import chord from celery.utils.log import g...
from __future__ import absolute_import import time import gc from celery import shared_task from celery.result import AsyncResult from celery.result import GroupResult from .models import Item, Selection, Preset, Experience, Task from .models import _DONE from celery.task import chord from celery.utils.log import g...
Python
0.000793
bcf6470f2e01b81a3373779cb83820ff125754c2
Fix add item http post
items/views.py
items/views.py
import os from django.shortcuts import render from django.http import JsonResponse, HttpResponse from django.views.generic import View from items.models import Item, UploadForm from django.contrib.auth.models import User from django.core import serializers from django.views.decorators.csrf import csrf_exempt from d...
import os from django.shortcuts import render from django.http import JsonResponse, HttpResponse from django.views.generic import View from items.models import Item, UploadForm from django.contrib.auth.models import User from django.core import serializers from django import forms from django.views.decorators.csrf i...
Python
0
0138eacf0d518b86e819a70000b7b527434a6b35
Change les arguments passés à celery pour gérer la sérialisation JSON.
libretto/signals.py
libretto/signals.py
# coding: utf-8 from __future__ import unicode_literals from celery_haystack.signals import CelerySignalProcessor from django.contrib.admin.models import LogEntry from django.contrib.sessions.models import Session from reversion.models import Version, Revision from .tasks import auto_invalidate class CeleryAutoInval...
# coding: utf-8 from __future__ import unicode_literals from celery_haystack.signals import CelerySignalProcessor from django.contrib.admin.models import LogEntry from reversion.models import Version, Revision from .tasks import auto_invalidate class CeleryAutoInvalidator(CelerySignalProcessor): def enqueue(self...
Python
0
eb102bb8550d59b34373f1806633a6079f7064a8
Make sure that all requests for static files are correctly hidden from output
devserver/utils/http.py
devserver/utils/http.py
from django.conf import settings from django.core.servers.basehttp import WSGIRequestHandler from django.db import connection from devserver.utils.time import ms_from_timedelta from datetime import datetime class SlimWSGIRequestHandler(WSGIRequestHandler): """ Hides all requests that originate from either ``...
from django.conf import settings from django.core.servers.basehttp import WSGIRequestHandler from django.db import connection from devserver.utils.time import ms_from_timedelta from datetime import datetime class SlimWSGIRequestHandler(WSGIRequestHandler): """ Hides all requests that originate from ```MEDIA_...
Python
0.000001
866e5fee6d39da9eb1a4893f12b1fe7aafbdbefd
update a comment about None gradient
examples/train_mlp.py
examples/train_mlp.py
############## # # This example demonstrates the basics of using `equinox.jitf` and `equinox.gradf`. # # Here we'll use them to facilitate training a simple MLP: to automatically take gradients and jit with respect to # all the jnp.arrays constituting the parameters. (But not with respect to anything else, like the cho...
############## # # This example demonstrates the basics of using `equinox.jitf` and `equinox.gradf`. # # Here we'll use them to facilitate training a simple MLP: to automatically take gradients and jit with respect to # all the jnp.arrays constituting the parameters. (But not with respect to anything else, like the cho...
Python
0
c053d6d46e6c1102b712649c8d91841d57b32ca7
add todo
buncuts/utils.py
buncuts/utils.py
# coding: utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import sys import codecs import re default_delimeter = "。!?▲" default_quote_dict = {"「": "」", "『": "』"} def split_into_sentences(text=sys.stdi...
# coding: utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import sys import codecs import re default_delimeter = "。!?▲" default_quote_dict = {"「": "」", "『": "』"} def split_into_sentences(text=sys.stdi...
Python
0
649d4b7fb22c92fa116fb574c1e4a07578ca6faa
Create methods for getting revisions.
forum/models.py
forum/models.py
from django.db import models import django.contrib.auth.models as auth class User(auth.User): """Model for representing users. It has few fields that aren't in the standard authentication user table, and are needed for the forum to work, like footers. """ display_name = models.CharField(max_length...
from django.db import models import django.contrib.auth.models as auth class User(auth.User): """Model for representing users. It has few fields that aren't in the standard authentication user table, and are needed for the forum to work, like footers. """ display_name = models.CharField(max_length...
Python
0
65eb9bcd58d78fd80fabd03a26be73335f1a1122
Update ci nose config to run with four processes
goldstone/settings/ci.py
goldstone/settings/ci.py
"""Settings for accessing a distributed docker instance.""" # Copyright 2015 Solinea, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
"""Settings for accessing a distributed docker instance.""" # Copyright 2015 Solinea, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
Python
0
39c16a3552ef882441b26a4c6defc57d9ea42010
return JSON rather than request.response objects
mondo.py
mondo.py
import requests class MondoClient(): url = 'https://production-api.gmon.io/' def __init__(self, url = None): if url != None: self.url = url def token(self, client_id, client_secret, username, password): """ Acquiring an access token """ payload = {'gran...
import requests class MondoClient(): url = 'https://production-api.gmon.io/' def __init__(self, url = None): if url != None: self.url = url def token(self, client_id, client_secret, username, password): """ Acquiring an access token """ payload = {'gran...
Python
0.000019
0fe56f804a7ed4958f33a534e30e3b6c79526ea6
Update SimplyPremiumCom.py
module/plugins/accounts/SimplyPremiumCom.py
module/plugins/accounts/SimplyPremiumCom.py
# -*- coding: utf-8 -*- from module.common.json_layer import json_loads from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" __version__ = "0.04" __description__ = """Simply-Premium.com account plugin""" __license__ ...
# -*- coding: utf-8 -*- from module.common.json_layer import json_loads from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" __version__ = "0.03" __description__ = """Simply-Premium.com account plugin""" __license__ ...
Python
0
a58de69cd0b93f1967a9b56812b1972a3ab9e5d1
Update main.py
WikiQA_CNN+Feat/main.py
WikiQA_CNN+Feat/main.py
""" ** deeplean-ai.com ** ** dl-lab ** created by :: GauravBh1010tt """ import numpy as np from dl_text import * import model import wiki_utils as wk from dl_text.metrics import eval_metric glove_fname = 'D:/workspace/Trec_QA-master/data/Glove/glove.6B.50d.txt' ################### DEFINING MODEL ###################...
import numpy as np from dl_text import * import model import wiki_utils as wk from dl_text.metrics import eval_metric glove_fname = 'D:/workspace/Trec_QA-master/data/Glove/glove.6B.50d.txt' ################### DEFINING MODEL ################### lrmodel = model.cnn model_name = lrmodel.func_name ###################...
Python
0.000001
187e8237f9ba56dc517b2ad6e58be3e8031fa9df
Update __init__.py
examples/__init__.py
examples/__init__.py
# coding: utf-8 import sys sys.path.append("./examples")
# coding: utf-8 # In[1]: import sys sys.path.append("./examples")#add the examples as a module
Python
0.000072
9ee0ad7dfad15e3d933b4d1c3fab508d99480748
Fix example.
examples/faithful.py
examples/faithful.py
import numpy as np import matplotlib.pyplot as plt from gmm.algorithm import GMM # Read in dataset from file with open('faithful.txt', 'rt') as f: data = [] for row in f: cols = row.strip('\r\n').split(' ') data.append(np.fromiter(map(lambda x: float(x), cols), np.float)) data = np.array(...
import numpy as np import matplotlib.pyplot as plt from gmm.algorithm import GMM # Read in dataset from file with open('faithful.txt', 'rt') as f: data = [] for row in f: cols = row.strip('\r\n').split(' ') data.append(np.fromiter(map(lambda x: float(x), cols), np.float)) data = np.array(...
Python
0.000004
dc03a20265c2fc611c7b2027e76d01a495ef2e7e
fix typo
examples/ssd/eval.py
examples/ssd/eval.py
from __future__ import division import argparse import sys import time import chainer from chainer import iterators from chainercv.datasets import VOCDetectionDataset from chainercv.datasets import voc_detection_label_names from chainercv.evaluations import eval_detection_voc from chainercv.links import SSD300 from ...
from __future__ import division import argparse import sys import time import chainer from chainer import iterators from chainercv.datasets import VOCDetectionDataset from chainercv.datasets import voc_detection_label_names from chainercv.evaluations import eval_detection_voc from chainercv.links import SSD300 from ...
Python
0.999991
a27f561ff24b41f215bdb3e33cdcdfcc4c43bf93
fix imports, crashes with TypeError, now
examples/testknn2.py
examples/testknn2.py
# -*- coding: utf-8 -*- """ SVM for Wind Power Prediction (SAES, global timeout) ================================ """ # Future from __future__ import absolute_import, division, print_function, \ unicode_literals, with_statement # Third Party #from sklearn.neighbors import KNeighborsRegressor from windml.datasets.n...
# -*- coding: utf-8 -*- """ SVM for Wind Power Prediction (SAES, global timeout) ================================ """ # Future from __future__ import absolute_import, division, print_function, \ unicode_literals, with_statement # Third Party #from sklearn.neighbors import KNeighborsRegressor from windml.datasets.n...
Python
0
528b10713d98e2603fad62c3fb252464c08896f0
make '/mc_trks' absolute path to avoid confusion
examples/tonphdf5.py
examples/tonphdf5.py
#!/usr/bin/env python """ Converts hits in a Jpp-ROOT file to HDF5. """ from km3pipe.pumps.aanet import AanetPump from km3pipe import Pipeline, Module import sys import pandas as pd import h5py if len(sys.argv) < 3: sys.exit('Usage: {0} FILENAME.root OUTPUTFILENAME.h5'.format(sys.argv[0])) FILEPATH = sys.argv[1...
#!/usr/bin/env python """ Converts hits in a Jpp-ROOT file to HDF5. """ from km3pipe.pumps.aanet import AanetPump from km3pipe import Pipeline, Module import sys import pandas as pd import h5py if len(sys.argv) < 3: sys.exit('Usage: {0} FILENAME.root OUTPUTFILENAME.h5'.format(sys.argv[0])) FILEPATH = sys.argv[1...
Python
0.000004
2c09c700b524a7272436feff19c4128ca3211725
Update word2vec.py
examples/word2vec.py
examples/word2vec.py
import copy import gensim import logging import pyndri import sys logging.basicConfig(level=logging.INFO) if len(sys.argv) <= 1: logging.error('Usage: python %s <path-to-indri-index>'.format(sys.argv[0])) sys.exit(0) logging.info('Initializing word2vec.') word2vec_init = gensim.models.Word2Vec( size=30...
import copy import gensim import logging import pyndri import sys logging.basicConfig(level=logging.INFO) if len(sys.argv) <= 1: logging.error('Usage: python %s <path-to-indri-index>'.format(sys.argv[0])) sys.exit(0) logging.info('Initializing word2vec.') word2vec_init = gensim.models.Word2Vec( size=30...
Python
0.000014
2ece6032b2344e3cf6304a757714d0ecf5015324
split drive controller to allow other pwm interface eg raspy juice
fishpi/vehicle/test_drive.py
fishpi/vehicle/test_drive.py
#!/usr/bin/python # # FishPi - An autonomous drop in the ocean # # Simple test of PWM motor and servo drive # import raspberrypi from time import sleep from drive_controller import AdafruitDriveController if __name__ == "__main__": print "testing drive controller..." drive = AdafruitDriveController(debug=Tr...
#!/usr/bin/python # # FishPi - An autonomous drop in the ocean # # Simple test of PWM motor and servo drive # import raspberrypi from time import sleep from drive_controller import DriveController if __name__ == "__main__": print "testing drive controller..." drive = DriveController(debug=True, i2c_bus=rasp...
Python
0
3566c7689f59715f2d58886f52d3dd0c00a0ce4e
change manage.py
maili-develop/manage.py
maili-develop/manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": if 'test' in sys.argv: os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings") else: os.environ.setdefault("DJANGO_SETTINGS_MODULE", "maili.settings") from django.core.management import execute_from_command_line...
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "maili.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Python
0.000002
cf79339061669bace0c97ca3e3452b27b77ad8da
Fix region not being passed to JAAS
conjureup/controllers/bootstrap/common.py
conjureup/controllers/bootstrap/common.py
from pathlib import Path from conjureup import events, juju from conjureup.app_config import app from conjureup.models.step import StepModel from conjureup.telemetry import track_event class BaseBootstrapController: msg_cb = NotImplementedError() def is_existing_controller(self): controllers = juju....
from pathlib import Path from conjureup import events, juju from conjureup.app_config import app from conjureup.models.step import StepModel from conjureup.telemetry import track_event class BaseBootstrapController: msg_cb = NotImplementedError() def is_existing_controller(self): controllers = juju....
Python
0
ed267933edf8b6e2e2b63d11ece7457943fe9646
Add documentation for powerline.lib.shell.run_cmd
powerline/lib/shell.py
powerline/lib/shell.py
# vim:fileencoding=utf-8:noet from __future__ import absolute_import, unicode_literals, division, print_function from subprocess import Popen, PIPE from locale import getlocale, getdefaultlocale, LC_MESSAGES def _get_shell_encoding(): return getlocale(LC_MESSAGES)[1] or getdefaultlocale()[1] or 'utf-8' def run_c...
# vim:fileencoding=utf-8:noet from __future__ import absolute_import, unicode_literals, division, print_function from subprocess import Popen, PIPE from locale import getlocale, getdefaultlocale, LC_MESSAGES def _get_shell_encoding(): return getlocale(LC_MESSAGES)[1] or getdefaultlocale()[1] or 'utf-8' def run_c...
Python
0.000001
be8fd3f10dbfd8e2099a046340a8e51758e60bd5
Add signout view so we can signout (by entering url manually)
makerbase/views/auth.py
makerbase/views/auth.py
import json from urllib import urlencode from urlparse import parse_qs, urlsplit, urlunsplit from flask import redirect, request, url_for from flaskext.login import LoginManager, login_user, logout_user import requests from makerbase import app from makerbase.models import User login_manager = LoginManager() login_...
import json from urllib import urlencode from urlparse import parse_qs, urlsplit, urlunsplit from flask import redirect, request, url_for from flaskext.login import LoginManager, login_user import requests from makerbase import app from makerbase.models import User login_manager = LoginManager() login_manager.setup...
Python
0
df27f7ad62eebf29b42bfa9b2bce7d73739c4a8e
Fix minor template modernization bug
enhydris/conf/settings.py
enhydris/conf/settings.py
# Enhydris settings for {{ project_name }} project. # # Generated by 'enhydris-admin newinstance' using Enhydris {{ enhydris_version }} # and Django {{ django_version }}. # # For more information on this file, see # http://enhydris.readthedocs.org/en/{{ enhydris_docs_version }}/general/install.html#settings-reference ...
# Enhydris settings for {{ project_name }} project. # # Generated by 'enhydris-admin newinstance' using Enhydris {{ enhydris_version }} # and Django {{ django_version }}. # # For more information on this file, see # http://enhydris.readthedocs.org/en/{{ enhydris_docs_version }}/general/install.html#settings-reference ...
Python
0
4464919c5114193179490c151844fd771bfd880b
fix setup without flask installed
flask_ecstatic.py
flask_ecstatic.py
"""Serves static files with optional directory index. Files in static folder are automatically served on static URL by Flask. See http://flask.pocoo.org/docs/0.10/api/#application-object. It's recommended to specify static folder and URL path directly on Flask application object, unless you need additional static fol...
"""Serves static files with optional directory index. Files in static folder are automatically served on static URL by Flask. See http://flask.pocoo.org/docs/0.10/api/#application-object. It's recommended to specify static folder and URL path directly on Flask application object, unless you need additional static fol...
Python
0.000001
b83e371f37477b5eaf552ac78383e3f0ac94bc21
Change in presseurop RSS feed
modules/presseurop/backend.py
modules/presseurop/backend.py
# -*- coding: utf-8 -*- # Copyright(C) 2012 Florent Fourcot # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your op...
# -*- coding: utf-8 -*- # Copyright(C) 2012 Florent Fourcot # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your op...
Python
0
a3ae8a7ece6bc75437b9848cf43335690250c128
exit http server gracefully
presstatic/__main__.py
presstatic/__main__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import argparse import SimpleHTTPServer import SocketServer from clint.textui import colored, puts, indent from presstatic import help from presstatic.builders import SiteBuilder from presstatic.storage import s3 def http_server(host, port, dir): Handler ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import argparse import SimpleHTTPServer import SocketServer from clint.textui import colored, puts, indent from presstatic import help from presstatic.builders import SiteBuilder from presstatic.storage import s3 def http_server_on_dir(host, port, dir): H...
Python
0.000001
c272b597a7ec2a1a5596daecce144001ae8a7d99
fix simulate device
fluxghost/websocket/touch.py
fluxghost/websocket/touch.py
from uuid import UUID import logging import json from fluxclient.upnp.task import UpnpTask from .base import WebSocketBase logger = logging.getLogger("WS.DISCOVER") class WebsocketTouch(WebSocketBase): def __init__(self, *args): WebSocketBase.__init__(self, *args) def on_text_message(self, message...
from uuid import UUID import logging import json from fluxclient.upnp.task import UpnpTask from .base import WebSocketBase logger = logging.getLogger("WS.DISCOVER") class WebsocketTouch(WebSocketBase): def __init__(self, *args): WebSocketBase.__init__(self, *args) def on_text_message(self, message...
Python
0.000002
4bc9217f15ee394332ab54efdb96ded056825c2b
Add todo to handle shuffling of tracks.
mopidy_pandora/doubleclick.py
mopidy_pandora/doubleclick.py
import logging import time from mopidy.internal import encoding from pandora.errors import PandoraException from mopidy_pandora.library import PandoraUri logger = logging.getLogger(__name__) class DoubleClickHandler(object): def __init__(self, config, client): self.on_pause_resume_click = config["on_...
import logging import time from mopidy.internal import encoding from pandora.errors import PandoraException from mopidy_pandora.library import PandoraUri logger = logging.getLogger(__name__) class DoubleClickHandler(object): def __init__(self, config, client): self.on_pause_resume_click = config["on_...
Python
0
d4f083d0cc1096152d7d5cd13c63e82f1a58a298
handle testrunner exits as PR failures
spawner.py
spawner.py
#!/usr/bin/env python3 # Parse the YAML file, start the testrunners in parallel, # and wait for them. import os import sys import traceback import subprocess import utils.parser as parser import utils.ghupdate as ghupdate def main(): "Main entry point." try: n = parse_suites() except SyntaxErr...
#!/usr/bin/env python3 # Parse the YAML file, start the testrunners in parallel, # and wait for them. import os import sys import traceback import subprocess import utils.parser as parser import utils.ghupdate as ghupdate def main(): "Main entry point." try: n = parse_suites() except SyntaxErr...
Python
0
9381657d8ad2e96c2537c89fad7a4b3d8d8ddff5
Add gpu parameter to htcondor_at_vispa example.
examples/htcondor_at_vispa/analysis/framework.py
examples/htcondor_at_vispa/analysis/framework.py
# -*- coding: utf-8 -*- """ Law example tasks to demonstrate HTCondor workflows at VISPA. In this file, some really basic tasks are defined that can be inherited by other tasks to receive the same features. This is usually called "framework" and only needs to be defined once per user / group / etc. """ import os i...
# -*- coding: utf-8 -*- """ Law example tasks to demonstrate HTCondor workflows at VISPA. In this file, some really basic tasks are defined that can be inherited by other tasks to receive the same features. This is usually called "framework" and only needs to be defined once per user / group / etc. """ import os i...
Python
0
a5de78328cc2e63c901c409fb6c7b376abf921e2
reorganize code the object oriented way
src/scopus.py
src/scopus.py
from itertools import chain import requests _HEADERS = {'Accept': 'application/json'} class ScopusResponse(object): def __init__(self, data): self._data = data def __getitem__(self, key): return self._data['search-results'][key] def __iter__(self): resp = self while resp...
import requests class ScopusClient(object): _AUTHOR_API = 'http://api.elsevier.com/content/search/author' _SCOPUS_API = 'http://api.elsevier.com/content/search/scopus' _HEADERS = {'Accept': 'application/json'} def __init__(self, apiKey): self.apiKey = apiKey def _api(self, endpoint, quer...
Python
0.000153
28601b95720474a4f8701d6cb784ac6ec3618d49
add support for wheel DL proxy (#14010)
tools/download-wheels.py
tools/download-wheels.py
#!/usr/bin/env python """ Download SciPy wheels from Anaconda staging area. """ import sys import os import re import shutil import argparse import urllib import urllib3 from bs4 import BeautifulSoup __version__ = '0.1' # Edit these for other projects. STAGING_URL = 'https://anaconda.org/multibuild-wheels-staging/s...
#!/usr/bin/env python """ Download SciPy wheels from Anaconda staging area. """ import sys import os import re import shutil import argparse import urllib3 from bs4 import BeautifulSoup __version__ = '0.1' # Edit these for other projects. STAGING_URL = 'https://anaconda.org/multibuild-wheels-staging/scipy' PREFIX =...
Python
0
c43bd7f829ce79577421374ba6c00b74adca05aa
add test for using glob matching in a directory tree in file iterator
src/test/file_iterator_tests.py
src/test/file_iterator_tests.py
import nose from nose.tools import * from unittest import TestCase import os from shutil import rmtree from tempfile import mkdtemp from file_iterator import FileIterator class FileIteratorTests(TestCase): def setUp(self): self.directory = mkdtemp('-gb-file-iterator-tests') self.file_iterator = F...
import nose from nose.tools import * from unittest import TestCase import os from shutil import rmtree from tempfile import mkdtemp from file_iterator import FileIterator class FileIteratorTests(TestCase): def setUp(self): self.directory = mkdtemp('-gb-file-iterator-tests') self.file_iterator = F...
Python
0
9e03e2c83328b5dc1b291dcd43c6fca1a7df2d74
Implement thread safe object for devkitstatuses
src/server.py
src/server.py
import logging import asyncio import flask import threading import time import aiocoap.resource as resource import aiocoap app = flask.Flask(__name__,static_folder="../static",static_url_path="/static",template_folder="../templates") @app.route("/") class Nordicnode(): def __init__(self, led="0,0,0,0", active=Fa...
import logging import asyncio import flask import threading import aiocoap.resource as resource import aiocoap app = flask.Flask(__name__,static_folder="../static",static_url_path="/static",template_folder="../templates") @app.route("/") def hello(): return flask.render_template("index.html", name="index") class...
Python
0
0bf9c011ca36df2d72dfd3b8fc59f6320e837e43
Update __init__.py
dmoj/cptbox/__init__.py
dmoj/cptbox/__init__.py
from collections import defaultdict from dmoj.cptbox.sandbox import SecurePopen, PIPE from dmoj.cptbox.handlers import DISALLOW, ALLOW from dmoj.cptbox.chroot import CHROOTSecurity from dmoj.cptbox.syscalls import SYSCALL_COUNT if sys.version_info.major == 2: range = xrange class NullSecurity(defaultdict): d...
from collections import defaultdict from dmoj.cptbox.sandbox import SecurePopen, PIPE from dmoj.cptbox.handlers import DISALLOW, ALLOW from dmoj.cptbox.chroot import CHROOTSecurity from dmoj.cptbox.syscalls import SYSCALL_COUNT class NullSecurity(defaultdict): def __init__(self): for i in xrange(SYSCALL_...
Python
0.000072
ca050969d1267d13986a0494a86f7fd50616937e
Remove old code.
process/scripts/run.py
process/scripts/run.py
""" Document processing script. Does NER for persons, dates, etc. Usage: process.py <dbname> process.py -h | --help | --version Options: -h --help Show this screen --version Version number """ import logging from docopt import docopt from iepy.db import connect, DocumentManager fr...
""" Document processing script. Does NER for persons, dates, etc. Usage: process.py <dbname> process.py -h | --help | --version Options: -h --help Show this screen --version Version number """ import logging from docopt import docopt from iepy.db import connect, DocumentManager fr...
Python
0.000045
9bc1c77250d338ca93ff33d2832c2b3117b3550e
Use the raw domain for Netflix, because there's only one now
services/netflix.py
services/netflix.py
import urlparse import foauth.providers from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY class Netflix(foauth.providers.OAuth1): # General info about the provider provider_url = 'https://www.netflix.com/' favicon_url = 'https://netflix.hs.llnwd.net/e1/en_US/icons/nficon.ico' docs_url = 'http:...
import urlparse import foauth.providers from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY class Netflix(foauth.providers.OAuth1): # General info about the provider provider_url = 'https://www.netflix.com/' favicon_url = 'https://netflix.hs.llnwd.net/e1/en_US/icons/nficon.ico' docs_url = 'http:...
Python
0.000001
87cc7ccb8626d9e236954cce0667167f5f9742be
fix prometheus test
restclients_core/tests/test_prometheus.py
restclients_core/tests/test_prometheus.py
from restclients_core.tests.dao_implementation.test_live import TDAO from unittest import TestCase, skipUnless from prometheus_client import generate_latest, REGISTRY import os @skipUnless("RUN_LIVE_TESTS" in os.environ, "RUN_LIVE_TESTS=1 to run tests") class TestPrometheusObservations(TestCase): def test_prometh...
from restclients_core.tests.dao_implementation.test_backend import TDAO from unittest import TestCase from prometheus_client import generate_latest, REGISTRY class TestPrometheusObservations(TestCase): def test_prometheus_observation(self): metrics = generate_latest(REGISTRY).decode('utf-8') self...
Python
0.000018
2b1cb336168e8ac72a768b03852ebe5a0c02a8a9
Remove unused import
corehq/apps/users/tests/fixture_status.py
corehq/apps/users/tests/fixture_status.py
from datetime import datetime from django.test import TestCase from django.contrib.auth.models import User from corehq.apps.users.models import CouchUser, CommCareUser from corehq.apps.domain.models import Domain from corehq.apps.fixtures.models import UserFixtureStatus, UserFixtureType class TestFixtureStatus(TestC...
from datetime import datetime from django.test import TestCase from mock import MagicMock, patch from django.contrib.auth.models import User from corehq.apps.users.models import CouchUser, CommCareUser from corehq.apps.domain.models import Domain from corehq.apps.fixtures.models import UserFixtureStatus, UserFixtureTy...
Python
0.000001
dcd7b8e990ff0f3d29807be78d7d3967c6ad46c4
Add trailing newline
gen_tmpfiles.py
gen_tmpfiles.py
#!/usr/bin/python '''Scan an existing directory tree and record installed directories. During build a number of directories under /var are created in the stateful partition. We want to make sure that those are always there so create a record of them using systemd's tempfiles config format so they are recreated during ...
#!/usr/bin/python '''Scan an existing directory tree and record installed directories. During build a number of directories under /var are created in the stateful partition. We want to make sure that those are always there so create a record of them using systemd's tempfiles config format so they are recreated during ...
Python
0.000001
738cc42fc0ee8e06a53842c27dd4a392403bea49
remove asgi warning
fiduswriter/manage.py
fiduswriter/manage.py
#!/usr/bin/env python3 import os import sys from importlib import import_module os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true" if "COVERAGE_PROCESS_START" in os.environ: import coverage coverage.process_startup() SRC_PATH = os.path.dirname(os.path.realpath(__file__)) os.environ.setdefault("SRC_PATH", SRC...
#!/usr/bin/env python3 import os import sys from importlib import import_module if "COVERAGE_PROCESS_START" in os.environ: import coverage coverage.process_startup() SRC_PATH = os.path.dirname(os.path.realpath(__file__)) os.environ.setdefault("SRC_PATH", SRC_PATH) def inner(default_project_path): sys....
Python
0.000006
a363edd761e2c99bae6d4492d0ca44a404e5d904
Avoid py36 error when printing unicode chars in a stream
neutronclient/tests/unit/test_exceptions.py
neutronclient/tests/unit/test_exceptions.py
# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
Python
0.999789
62404979e69ccd129f8382e8a2fce5329c577a78
fix version
experimentator/__version__.py
experimentator/__version__.py
__version__ = '0.2.0dev5'
__version__ = '0.2.0.dev5'
Python
0.000001
b0e3b4fcd3d85989ebe72fa805cfab4576867835
Fix how node-caffe detects if GPU is supported on a machine
node-caffe/binding.gyp
node-caffe/binding.gyp
{ 'targets': [ { 'target_name': 'caffe', 'sources': [ 'src/caffe.cpp' ], 'variables': { 'has_gpu': '<!(if which nvidia-smi; then echo true; else echo false; fi)', }, 'include_dirs': [ '<!(node -e "require(\'nan\')")', '<!(echo $CAFFE_ROOT/include...
{ 'targets': [ { 'target_name': 'caffe', 'sources': [ 'src/caffe.cpp' ], 'include_dirs': [ '<!(node -e "require(\'nan\')")', '<!(echo $CAFFE_ROOT/include)', '/usr/local/cuda/include/', '<!(pwd)/caffe/src/', '<!(pwd)/caffe/include/', '...
Python
0.000082
3471381b5894536142a9460410e0efe5e8b1b294
make doc regex more lenient
flask_website/docs.py
flask_website/docs.py
# -*- coding: utf-8 -*- import os import re from flask import url_for, Markup from flask_website import app from flask_website.search import Indexable _doc_body_re = re.compile(r'''(?smx) <title>(.*?)</title>.*? <div.*?class=".*?body.*?>(.*) <div.*?class=".*?sphinxsidebar ''') class DocumentationPage(Ind...
# -*- coding: utf-8 -*- import os import re from flask import url_for, Markup from flask_website import app from flask_website.search import Indexable _doc_body_re = re.compile(r'''(?smx) <title>(.*?)</title>.*? <div\s+class="body">(.*?)<div\s+class="sphinxsidebar"> ''') class DocumentationPage(Indexable): ...
Python
0.000692
43403cfca2ca217c03f4aaffdddd7a4d03a74520
Change string formatting
getMolecules.py
getMolecules.py
#!/usr/bin/env python # Copyright (c) 2016 Ryan Collins <rcollins@chgr.mgh.harvard.edu> # Distributed under terms of the MIT license. """ Estimate original molecule sizes and coordinates from 10X linked-read WGS barcodes """ import argparse from collections import defaultdict, Counter, namedtuple import pysam def g...
#!/usr/bin/env python # Copyright (c) 2016 Ryan Collins <rcollins@chgr.mgh.harvard.edu> # Distributed under terms of the MIT license. """ Estimate original molecule sizes and coordinates from 10X linked-read WGS barcodes """ import argparse from collections import defaultdict, Counter, namedtuple import pysam def g...
Python
0.000007
98e899d5e76f8bee5c288bffe78ccf943665693c
Fix white space to be 4 spaces
get_cve_data.py
get_cve_data.py
# Script to import CVE data from NIST https://nvd.nist.gov/vuln/data-feeds#JSON_FEED # https://static.nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-modified.json.gz import gzip import json import pycurl from io import BytesIO NVD_CVE_ENDPOINT = 'https://static.nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-modified.json.gz'...
# Script to import CVE data from NIST https://nvd.nist.gov/vuln/data-feeds#JSON_FEED # https://static.nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-modified.json.gz import gzip import json import pycurl from io import BytesIO NVD_CVE_ENDPOINT = 'https://static.nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-modified.json.gz'...
Python
0.999999
5e3a4c84d31fe63a67fdb2e64c5edc1ffe8d24ab
Tweak return message
flexget/api/cached.py
flexget/api/cached.py
from __future__ import unicode_literals, division, absolute_import from builtins import * # pylint: disable=unused-import, redefined-builtin from flask.helpers import send_file from flask_restplus import inputs from flexget.api import api, APIResource, APIError, BadRequest from flexget.utils.tools import cached_resou...
from __future__ import unicode_literals, division, absolute_import from builtins import * # pylint: disable=unused-import, redefined-builtin from flask.helpers import send_file from flask_restplus import inputs from flexget.api import api, APIResource, APIError, BadRequest from flexget.utils.tools import cached_resou...
Python
0
16e38be365c939f7e74fb321280e88370606a6c3
Fix daemonizing on python 3.4+
flexget/task_queue.py
flexget/task_queue.py
from __future__ import unicode_literals, division, absolute_import from builtins import * import logging import queue import sys import threading import time from sqlalchemy.exc import ProgrammingError, OperationalError from flexget.task import TaskAbort log = logging.getLogger('task_queue') class TaskQueue(objec...
from __future__ import unicode_literals, division, absolute_import from builtins import * import logging import queue import threading import time from sqlalchemy.exc import ProgrammingError, OperationalError from flexget.task import TaskAbort log = logging.getLogger('task_queue') class TaskQueue(object): """...
Python
0
9df0c21bcefdeda4ca65ee4126ed965a6d099416
Fix line length on import statement
website/website/wagtail_hooks.py
website/website/wagtail_hooks.py
from wagtail.contrib.modeladmin.options import ModelAdmin,\ modeladmin_register, ThumbnailMixin from website.models import Logo class LogoAdmin(ThumbnailMixin, ModelAdmin): model = Logo menu_icon = 'picture' menu_order = 1000 list_display = ('admin_thumb', 'category', 'link') add_to_settings_...
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register, \ ThumbnailMixin from website.models import Logo class LogoAdmin(ThumbnailMixin, ModelAdmin): model = Logo menu_icon = 'picture' menu_order = 1000 list_display = ('admin_thumb', 'category', 'link') add_to_settings...
Python
0.00979
d4d69ed62cbd726c92de9382136175e0fbdbb8af
Remove super-stale file paths
opencog/nlp/anaphora/agents/testingAgent.py
opencog/nlp/anaphora/agents/testingAgent.py
from __future__ import print_function from pprint import pprint # from pln.examples.deduction import deduction_agent from opencog.atomspace import types, AtomSpace, TruthValue from agents.hobbs import HobbsAgent from agents.dumpAgent import dumpAgent from opencog.scheme_wrapper import load_scm,scheme_eval_h, scheme_ev...
from __future__ import print_function from pprint import pprint # from pln.examples.deduction import deduction_agent from opencog.atomspace import types, AtomSpace, TruthValue from agents.hobbs import HobbsAgent from agents.dumpAgent import dumpAgent from opencog.scheme_wrapper import load_scm,scheme_eval_h, scheme_ev...
Python
0.000002
f585a7cdf4ecbecfe240873a3b4b8e7d4376e69c
Move fallback URL pattern to the end of the list so it gets matched last.
campus02/urls.py
campus02/urls.py
#!/usr/bin/python # -*- coding: utf-8 -*- from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.views.static import serve urlpatterns = [ url(r'^', include('django.contrib.auth.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^web/...
#!/usr/bin/python # -*- coding: utf-8 -*- from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.views.static import serve urlpatterns = [ url(r'^', include('django.contrib.auth.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^web/...
Python
0
c05a93d8993e14fc8521dd01a13a930e85fcb882
fix code style in `test_db_util` (#9594)
datadog_checks_base/tests/test_db_util.py
datadog_checks_base/tests/test_db_util.py
# -*- coding: utf-8 -*- # (C) Datadog, Inc. 2020-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import time from datadog_checks.base.utils.db.utils import ConstantRateLimiter, RateLimitingTTLCache def test_constant_rate_limiter(): rate_limit = 8 test_duration_s = 0....
# -*- coding: utf-8 -*- # (C) Datadog, Inc. 2020-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import math import time from datadog_checks.base.utils.db.utils import RateLimitingTTLCache, ConstantRateLimiter def test_constant_rate_limiter(): rate_limit = 8 test_dur...
Python
0
a9a9b60d9994bc4780e74ddd01df833a85247b95
Change state serialiser to pass hex color values.
suddendev/game/state_encoder.py
suddendev/game/state_encoder.py
#!/usr/bin/python3 import json def encodeState(game): return json.dumps(game, cls=StateEncoder) def clamp(x): return max(0, min(x, 255)) class StateEncoder(json.JSONEncoder): def default(self, o): return self.serializeState(o) def serializeState(self, state): return { ...
#!/usr/bin/python3 import json def encodeState(game): return json.dumps(game, cls=StateEncoder) class StateEncoder(json.JSONEncoder): def default(self, o): return self.serializeState(o) def serializeState(self, state): return { 'players': self.serializePlayers(state.play...
Python
0
3e5c500eed84ca24ffc31e802e061833a5a43225
use unicode names in test
suvit_system/tests/test_node.py
suvit_system/tests/test_node.py
# -*- coding: utf-8 -*- from openerp.tests.common import TransactionCase class TestNode(TransactionCase): def test_node_crud(self): Node = self.env['suvit.system.node'] root = Node.create({'name': u'Root1'}) ch1 = Node.create({'name': u'Ch1', 'parent_id': root.id}) ch2 = Node.cre...
# -*- coding: utf-8 -*- from openerp.tests.common import TransactionCase class TestNode(TransactionCase): def test_node_crud(self): Node = self.env['suvit.system.node'] root = Node.create({'name': 'Root1'}) ch1 = Node.create({'name': 'Ch1', 'parent_id': root.id}) ch2 = Node.crea...
Python
0.000026
c300e70bb65da3678f27c4ba01b22f9a3d4fc717
Use spi_serial for tools
tools/serial_rf_spy.py
tools/serial_rf_spy.py
#!/usr/bin/env python import os import serial import time class SerialRfSpy: CMD_GET_STATE = 1 CMD_GET_VERSION = 2 CMD_GET_PACKET = 3 CMD_SEND_PACKET = 4 CMD_SEND_AND_LISTEN = 5 CMD_UPDATE_REGISTER = 6 CMD_RESET = 7 def __init__(self, serial_port, rtscts=None): if not rtscts: rtscts = int(...
#!/usr/bin/env python import os import serial import time class SerialRfSpy: CMD_GET_STATE = 1 CMD_GET_VERSION = 2 CMD_GET_PACKET = 3 CMD_SEND_PACKET = 4 CMD_SEND_AND_LISTEN = 5 CMD_UPDATE_REGISTER = 6 CMD_RESET = 7 def __init__(self, serial_port, rtscts=None): if not rtscts: rtscts = int(...
Python
0.000001
da3f842107e5f8062013b7a6412da2cb18592f5f
make the dt statement into an assertion
examples/basic_example.py
examples/basic_example.py
""" Basic Example ============= Here we demonstrate both the coordinate-based slicing notatation, which is unique to pySpecData, as well the way in which the axis coordinates for a Fourier transform are handled automatically. The case considered here is that of an NMR FID that has been acquired with a wider spectral w...
""" Basic Example ============= Here we demonstrate both the coordinate-based slicing notatation, which is unique to pySpecData, as well the way in which the axis coordinates for a Fourier transform are handled automatically. The case considered here is that of an NMR FID that has been acquired with a wider spectral w...
Python
0.999999
73029223f54dc6c793c190e70a135d0bd3faa50b
Update download script
download_corpora.py
download_corpora.py
#!/usr/bin/env python # -*- coding: utf-8 -*- '''Downloads the necessary NLTK models and corpora.''' from text.packages import nltk REQUIRED_CORPORA = [ 'brown', 'punkt', 'conll2000', 'maxent_treebank_pos_tagger', ] def main(): for each in REQUIRED_CORPORA: print(('Downloading "{0}"'.forma...
#!/usr/bin/env python # -*- coding: utf-8 -*- '''Downloads the necessary NLTK models and corpora.''' from nltk import download REQUIRED_CORPORA = [ 'brown', 'punkt', 'conll2000', 'maxent_treebank_pos_tagger', ] def main(): for each in REQUIRED_CORPORA: print(('Downloading "{0}"'.format(eac...
Python
0
c818007491fe10101a73beeb7adfa59f9aadf3c6
use private key instead of public
osf/management/commands/file_view_counts.py
osf/management/commands/file_view_counts.py
from __future__ import unicode_literals import logging import django django.setup() import json import requests import urllib from django.core.management.base import BaseCommand from django.db import transaction from osf.models import BaseFileNode, PageCounter from website import settings from keen import KeenClient...
from __future__ import unicode_literals import logging import django django.setup() import json import requests import urllib from django.core.management.base import BaseCommand from django.db import transaction from osf.models import BaseFileNode, PageCounter from website import settings from keen import KeenClient...
Python
0.000001
02490615e82be65520a8d608cff467dcf1bd7b96
add picture commands help messages
extensions/picture/picture.py
extensions/picture/picture.py
from discord.ext import commands import discord import os class Picture(): def __init__(self, bot): self.bot = bot @commands.command(help="Awoo!") async def awoo(self): fp = os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/awoo.jpg') with open(fp, 'rb') as f: ...
from discord.ext import commands import discord import os class Picture(): def __init__(self, bot): self.bot = bot @commands.command() async def awoo(self): fp = os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/awoo.jpg') with open(fp, 'rb') as f: try: ...
Python
0.000001
6148e7cccc50023955ef7c3d86709c5197ae78e7
Make output more understandable
doc/python/cryptobox.py
doc/python/cryptobox.py
#!/usr/bin/python import sys import botan def main(args = None): if args is None: args = sys.argv if len(args) != 3: raise Exception("Usage: <password> <input>"); password = args[1] input = ''.join(open(args[2]).readlines()) rng = botan.RandomNumberGenerator() ciphertext = ...
#!/usr/bin/python import sys import botan def main(args = None): if args is None: args = sys.argv if len(args) != 3: raise Exception("Bad usage") password = args[1] input = ''.join(open(args[2]).readlines()) rng = botan.RandomNumberGenerator() ciphertext = botan.cryptobox_e...
Python
1
4dc6b726e5f685d01229bc6438b99f060fb63380
Add content type and accpet header checking, probaly too strict.
src/webapp.py
src/webapp.py
#!/usr/bin/env python import os import json import uuid import tornado.ioloop import tornado.web import tornado.options tornado.options.define('cookie_secret', default='sssecccc', help='Change this to a real secret') tornado.options.define('favicon', default='static/favicon.ico', help='Path to favicon.ico') tornado.o...
#!/usr/bin/env python import os import json import uuid import tornado.ioloop import tornado.web import tornado.options tornado.options.define('cookie_secret', default='sssecccc', help='Change this to a real secret') tornado.options.define('favicon', default='static/favicon.ico', help='Path to favicon.ico') tornado.o...
Python
0
6174580057cc1c54539f9f05bc09c6a80df1fe4b
Fix issue following rebase
app/questionnaire/create_questionnaire_manager.py
app/questionnaire/create_questionnaire_manager.py
from app.validation.validator import Validator from app.routing.routing_engine import RoutingEngine from app.navigation.navigator import Navigator from app.questionnaire.questionnaire_manager import QuestionnaireManager from app.main import errors from app.utilities.factory import factory from app.metadata.metadata_sto...
from app.validation.validator import Validator from app.routing.routing_engine import RoutingEngine from app.navigation.navigator import Navigator from app.questionnaire.questionnaire_manager import QuestionnaireManager from app.main import errors from app.utilities.factory import factory from app.metadata.metadata_sto...
Python
0.000001
b7b78a9282e2a4ee776020f83812e3abd437467b
Corrige erro de QuerySet immutable
djangosige/apps/cadastro/views/cliente.py
djangosige/apps/cadastro/views/cliente.py
# -*- coding: utf-8 -*- from django.core.urlresolvers import reverse_lazy from djangosige.apps.cadastro.forms import ClienteForm from djangosige.apps.cadastro.models import Cliente from .base import AdicionarPessoaView, PessoasListView, EditarPessoaView class AdicionarClienteView(AdicionarPessoaView): template...
# -*- coding: utf-8 -*- from django.core.urlresolvers import reverse_lazy from djangosige.apps.cadastro.forms import ClienteForm from djangosige.apps.cadastro.models import Cliente from .base import AdicionarPessoaView, PessoasListView, EditarPessoaView class AdicionarClienteView(AdicionarPessoaView): template...
Python
0.000001
a2a26ed8b216c4a40db7a384571d05c690e25cef
Update test expectation
examples/run-example-8.py
examples/run-example-8.py
#!/usr/bin/python import os, sys, inspect DIR = os.path.dirname(os.path.realpath(__file__)) NORM_EXPECT='Require Coq.omega.Omega.\nRequire Top.A.\nRequire Top.B.\nRequire Top.C.\nRequire Top.D.\n\nImport Top.D.\n\nFail Check A.mA.axA.\n' GET_EXPECT = { 'Coq.omega.Omega': None, 'Top.A': 'Module Export Top_DOT...
#!/usr/bin/python import os, sys, inspect DIR = os.path.dirname(os.path.realpath(__file__)) NORM_EXPECT='Require Coq.omega.Omega.\nRequire Top.A.\nRequire Top.B.\nRequire Top.C.\nRequire Top.D.\n\nImport Top.D.\n' GET_EXPECT = { 'Coq.omega.Omega': None, 'Top.A': 'Module Export Top_DOT_A.\nModule Export Top.\...
Python
0.000001
48a89b4cdb2e084f4b349e9ca12a91daba9e0734
Fix build with Python 3
spyne/test/transport/test_msgpack.py
spyne/test/transport/test_msgpack.py
# # spyne - Copyright (C) Spyne contributors. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This libra...
# # spyne - Copyright (C) Spyne contributors. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This libra...
Python
0.000001
6cdc05abb5777656684d18cfb215aa7dbcb10c43
Create indexes if not created
scripts/install/create_tables_cloudsql.py
scripts/install/create_tables_cloudsql.py
#! /usr/bin/env python import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "engine", "src")) import MySQLdb import time from juliabox.db import JBoxUserV2, JBoxDynConfig, JBoxSessionProps, JBoxInstanceProps, JBPluginDB, JBoxAPISpec, JBoxUserProfile from juliabox.jbox_util import ...
#! /usr/bin/env python import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "engine", "src")) import MySQLdb import time from juliabox.db import JBoxUserV2, JBoxDynConfig, JBoxSessionProps, JBoxInstanceProps, JBPluginDB, JBoxAPISpec, JBoxUserProfile from juliabox.jbox_util import ...
Python
0.000002
0dcad3ac5f3754fedf12c7aca7050ec6ab85840d
fix merge cleaning
transports/__init__.py
transports/__init__.py
from yo_ug_http import YoUgHttpTransport from cm_nl_yo_ug_http import CmYoTransport from cm_nl_http import CmTransport from push_tz_yo_ug_http import PushYoTransport from push_tz_http import PushTransport from push_tz_smpp import PushTzSmppTransport from mobivate_http import MobivateHttpTransport from movilgate_http im...
from yo_ug_http import YoUgHttpTransport from cm_nl_yo_ug_http import CmYoTransport from cm_nl_http import CmTransport from push_tz_yo_ug_http import PushYoTransport from push_tz_http import PushTransport from push_tz_smpp import PushTzSmppTransport from mobivate_http import MobivateHttpTransport from movilgate_http im...
Python
0