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
107ffa054406cefa71f245045fe0ad140d44cc55
Update drinkertest
drinkertest.py
drinkertest.py
from hieretikz import * import subprocess from hierarchy import * formulae = lem, wlem, dp, he, dnsu, dnse, glpo, glpoa, gmp = \ 'lem', 'wlem', 'dp', 'he', 'dnsu', 'dnse', 'glpo', 'glpoa', 'gmp' _______ = None formula_layout = [ ' glpoa ', ' ...
from hieretikz import * import subprocess from hierarchy import * formulae = lem, wlem, dp, he, dnsu, dnse, glpo, glpoa, gmp = \ 'lem', 'wlem', 'dp', 'he', 'dnsu', 'dnse', 'glpo', 'glpoa', 'gmp' _______ = None formula_layout = [ ' glpoa ', ' ...
Python
0.000001
23f87565a9074b7d6bd5e45b1ce8686ba49d3ce8
Update nsoltSynthesis2dNetwork.py
appendix/pytorch/nsoltSynthesis2dNetwork.py
appendix/pytorch/nsoltSynthesis2dNetwork.py
import torch import torch.nn as nn from nsoltBlockIdct2dLayer import NsoltBlockIdct2dLayer from nsoltFinalRotation2dLayer import NsoltFinalRotation2dLayer from nsoltLayerExceptions import InvalidNumberOfChannels, InvalidPolyPhaseOrder, InvalidNumberOfVanishingMoments class NsoltSynthesis2dNetwork(nn.Module): ...
import torch import torch.nn as nn from nsoltBlockIdct2dLayer import NsoltBlockIdct2dLayer from nsoltFinalRotation2dLayer import NsoltFinalRotation2dLayer class NsoltSynthesis2dNetwork(nn.Module): def __init__(self, number_of_channels=[], decimation_factor=[]): super(NsoltSynt...
Python
0.000001
0d056fefa1896a1e4d17b56f0e84dae106c17c57
fix bug
meta/api/views.py
meta/api/views.py
from django.conf.urls import patterns, url from django.shortcuts import render from django.http import Http404 from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt from django.contrib.sites.shortcuts import get_current_site import requests from .forms import UploadImageForm from ....
from django.conf.urls import patterns, url from django.shortcuts import render from django.http import Http404 from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt from django.contrib.sites.shortcuts import get_current_site import requests from .forms import UploadImageForm from ....
Python
0.000001
afebd530cb19196d2101b91cee59011c770b9709
fix bug
meta/api/views.py
meta/api/views.py
from django.conf.urls import patterns, url from django.shortcuts import render from django.http import Http404 from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt from django.contrib.sites.shortcuts import get_current_site import requests from .forms import UploadImageForm from ....
from django.conf.urls import patterns, url from django.shortcuts import render from django.http import Http404 from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt from django.contrib.sites.shortcuts import get_current_site import requests from .forms import UploadImageForm from ....
Python
0.000001
bfe039111e2b8e83a450b0d5e5f56827338cd017
Fix slashes in blog urlpatterns.
mezzanine/urls.py
mezzanine/urls.py
""" This is the main ``urlconf`` for Mezzanine - it sets up patterns for all the various Mezzanine apps, third-party apps like Grappelli and filebrowser. """ from __future__ import unicode_literals from future.builtins import str from django.conf.urls import include, url from django.contrib.sitemaps.views import site...
""" This is the main ``urlconf`` for Mezzanine - it sets up patterns for all the various Mezzanine apps, third-party apps like Grappelli and filebrowser. """ from __future__ import unicode_literals from future.builtins import str from django.conf.urls import include, url from django.contrib.sitemaps.views import site...
Python
0.000001
338282a17766345f054f570d5063a7b0b803727b
Enable migration with special chars in pw
migrations/env.py
migrations/env.py
from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool from sqlalchemy.engine.url import make_url from logging.config import fileConfig from six.moves.urllib.parse import quote # this is the Alembic Config object, which provides # access to the values within t...
from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool from sqlalchemy.engine.url import make_url from logging.config import fileConfig # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.co...
Python
0
3380d0fed1a8d24eba8627bd65dccc1fb2f772dd
Update version to next release
minio/__init__.py
minio/__init__.py
# -*- coding: utf-8 -*- # MinIO Python Library for Amazon S3 Compatible Cloud Storage, # (C) 2015, 2016, 2017 MinIO, 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.ap...
# -*- coding: utf-8 -*- # MinIO Python Library for Amazon S3 Compatible Cloud Storage, # (C) 2015, 2016, 2017 MinIO, 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.ap...
Python
0
5f7cde32f64965fe8f75dd229d67598a53362701
Fix checker
model/simple-python/components/checker.py
model/simple-python/components/checker.py
from . import * import z3 class PropertyChecker (object): """Actually check for properties in the network graph etc.""" def __init__ (self, context, network): self.ctx = context self.net = network self.solver = z3.Solver() self.constraints = list () self.primed = False ...
from . import * import z3 class PropertyChecker (object): """Actually check for properties in the network graph etc.""" def __init__ (self, context, network): self.ctx = context self.net = network self.solver = z3.Solver() self.constraints = list () self.primed = False ...
Python
0.000003
97b594b84811da7bd90a615752c47c8982c1303c
fix addon order - dumper must be last
mitmproxy/dump.py
mitmproxy/dump.py
from __future__ import absolute_import, print_function, division from typing import Optional # noqa import typing # noqa from mitmproxy import controller from mitmproxy import exceptions from mitmproxy import flow from mitmproxy import builtins from mitmproxy import options from mitmproxy.builtins import dumper, te...
from __future__ import absolute_import, print_function, division from typing import Optional # noqa import typing # noqa from mitmproxy import controller from mitmproxy import exceptions from mitmproxy import flow from mitmproxy import builtins from mitmproxy import options from mitmproxy.builtins import dumper, te...
Python
0
87f08dc5a847a12ecbb8f9dfc21303f324e12e99
Fix execution of `commit_msg`
resources/git/hooks/commit_msg.py
resources/git/hooks/commit_msg.py
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import inspect import sys import textwrap #=============================================================================== FIRST_LINE_MAX_CHAR_LENGTH = 70 MESSAGE_BODY_MAX_CHAR_LINE_LENG...
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import inspect import sys import textwrap #=============================================================================== FIRST_LINE_MAX_CHAR_LENGTH = 70 MESSAGE_BODY_MAX_CHAR_LINE_LENG...
Python
0
ef1336fcb30f951d057b5c943a948e8e5d95f07b
Add import json in roomfinder_dispo
roomfinder_dispo/roomfinder_dispo/dispo.py
roomfinder_dispo/roomfinder_dispo/dispo.py
#!/usr/bin/env python2.7 import sys reload(sys) sys.setdefaultencoding("utf-8") from flask import Flask, render_template, request, jsonify import argparse import datetime import os, sys import requests from socket import error as SocketError import errno import json app = Flask(__name__) @app.route("/book", methods=...
#!/usr/bin/env python2.7 import sys reload(sys) sys.setdefaultencoding("utf-8") from flask import Flask, render_template, request, jsonify import argparse import datetime import os, sys import requests from socket import error as SocketError import errno app = Flask(__name__) @app.route("/book", methods=["GET"]) def...
Python
0.000001
4815315b2200cb8061640f6333f2cb96b0707965
update admin to enable list edit
django_sso/admin.py
django_sso/admin.py
from django.contrib import admin from django_sso import settings from django_sso.models import Assignment class AssignmentAdmin(admin.ModelAdmin): list_display = ('__unicode__', 'username', 'username_mode', 'domain', 'user', 'weight') list_editable = ('username', 'username_mode', 'domain', 'user', 'weight') ...
from django.contrib import admin from django_sso import settings from django_sso.models import Assignment class AssignmentAdmin(admin.ModelAdmin): pass admin.site.register(Assignment, AssignmentAdmin) if settings.DJANGO_SSO_ADD_LOGIN_BUTTON: admin.site.login_template = 'django_sso/login.html'
Python
0
5022cefce20ecf20d7689fa6d2c280f8774ee677
add forgot password link to admin login
djangogirls/urls.py
djangogirls/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin from django.views.generic.base import RedirectView urlpatterns = patterns('', # Redirect old links: url(r'^pages/in-your-city/$', RedirectView.as_view(url='/organize/', permanent=True)), url(r'^admin$', RedirectView.as_vi...
from django.conf.urls import patterns, include, url from django.contrib import admin from django.views.generic.base import RedirectView urlpatterns = patterns('', # Redirect old links: url(r'^pages/in-your-city/$', RedirectView.as_view(url='/organize/', permanent=True)), url(r'^admin$', RedirectView.as_vi...
Python
0
caa63e934fb252c17feac25a01f4298ee4d9b3e1
Remove STATIC_URL from Django settings.
hello_world/settings.py
hello_world/settings.py
""" Django settings for hello_world project. Generated by 'django-admin startproject' using Django 1.9.1. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import o...
""" Django settings for hello_world project. Generated by 'django-admin startproject' using Django 1.9.1. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import o...
Python
0
c7291b333c00d11e54339b2b2ae14b399cfdc12c
fix sys import (thank you, Orlando)
retirement_api/utils/check_api.py
retirement_api/utils/check_api.py
# script to check the retirement api to make sure # the SSA Quick Calculator is operational # and to log the result to a csv (currently via cron) import sys import requests import datetime import json import time import signal from urlparse import urlparse timestamp = datetime.datetime.now() # rolling dob to guarante...
# script to check the retirement api to make sure # the SSA Quick Calculator is operational # and to log the result to a csv (currently via cron) import requests import datetime import json import time import signal timestamp = datetime.datetime.now() # rolling dob to guarantee subject is 44 and full retirement age i...
Python
0
123f3e706e1931120e035acd2f11fcb1fa3320c7
Remove unnecessary files
rules/QEMU.py
rules/QEMU.py
import xyz import shutil class Qemu(xyz.BuildProtocol): pkg_name = 'QEMU' deps = ['pkg-config', 'gettext', 'glib'] def configure(self): env = {} ldflags = '{standard_ldflags} -F/Library/Frameworks -F/System/Library/Frameworks' args = ('{source_dir_from_build}/configure', ...
import xyz class Qemu(xyz.BuildProtocol): pkg_name = 'QEMU' deps = ['pkg-config', 'gettext', 'glib'] def configure(self, builder, config): env = {} ldflags = '{standard_ldflags} -F/Library/Frameworks -F/System/Library/Frameworks' args = ('{source_dir_from_build}/configure', ...
Python
0.000004
232d4c2c8876b05cec4a427fcdf141a036c97045
Rename "Events" into "EventRegistry" and "trigger" into "notify"
pyofwave_server/pyofwave/core/operation.py
pyofwave_server/pyofwave/core/operation.py
""" Standard interface for connecting client protocols to the operation extensions. """ from delta import DeltaObserverPool as dop import opdev, delta # Perform operation def _getChildren(tag): rep = [tag.text, ] for child in tag: rep.append(child) rep.append(child.tail) return rep def pe...
""" Standard interface for connecting client protocols to the operation extensions. """ from delta import DeltaObserverPool as dop import opdev, delta # Perform operation def _getChildren(tag): rep = [tag.text, ] for child in tag: rep.append(child) rep.append(child.tail) return rep def pe...
Python
0.000001
7c120c02097bfaa1f494627ac93d6cddf5fb9049
FIX adding newline for chunks
cutools/diff/__init__.py
cutools/diff/__init__.py
from hashlib import md5 from clint.textui import puts, colored def clean_diff(diff): """Removes diff header from a diff. """ res = [] skip = True for line in diff.split('\n'): if line.startswith('diff --git'): skip = True if line.startswith('@@ '): skip = Fa...
from hashlib import md5 from clint.textui import puts, colored def clean_diff(diff): """Removes diff header from a diff. """ res = [] skip = True for line in diff.split('\n'): if line.startswith('diff --git'): skip = True if line.startswith('@@ '): skip = Fa...
Python
0
c8fa72a130d84d921b23f5973dafb8fa91367381
Make ip_type a RadioSelect in the PTR form
cyder/cydns/ptr/forms.py
cyder/cydns/ptr/forms.py
from django import forms from cyder.cydns.forms import DNSForm from cyder.cydns.ptr.models import PTR class PTRForm(DNSForm): def delete_instance(self, instance): instance.delete() class Meta: model = PTR exclude = ('ip', 'reverse_domain', 'ip_upper', 'ip_lower') ...
from django import forms from cyder.cydns.forms import DNSForm from cyder.cydns.ptr.models import PTR class PTRForm(DNSForm): def delete_instance(self, instance): instance.delete() class Meta: model = PTR exclude = ('ip', 'reverse_domain', 'ip_upper', 'ip_lower') ...
Python
0.000001
e68c85ae4526557efd0d3c1bd45857583d542659
handle errors in better bibtex
python/citation_vim/zotero/betterbibtex.py
python/citation_vim/zotero/betterbibtex.py
# -*- coding: utf-8 -*- import os import shutil import json import sqlite3 class betterBibtex(object): def __init__(self, zotero_path, cache_path): self.bb_file = os.path.join(zotero_path, 'better-bibtex/db.json') self.bb_database = os.path.join(zotero_path, 'betterbibtex-lokijs.sqlite') ...
# -*- coding: utf-8 -*- import os import shutil import json import sqlite3 class betterBibtex(object): def __init__(self, zotero_path, cache_path): self.bb_file = os.path.join(zotero_path, 'better-bibtex/db.json') self.bb_database = os.path.join(zotero_path, 'betterbibtex-lokijs.sqlite') ...
Python
0.000002
cbdbe14365d5caad28fe77d9c2ca1c66cbf783bd
test travis turning off db switch
python/marvin/tests/misc/test_db_switch.py
python/marvin/tests/misc/test_db_switch.py
#!/usr/bin/env python2 # encoding: utf-8 # # test_db_switch.py # # Created by José Sánchez-Gallego on Sep 7, 2016. from __future__ import division from __future__ import print_function from __future__ import absolute_import def create_connection(db_name): """Creates the connection and import the model classes."...
#!/usr/bin/env python2 # encoding: utf-8 # # test_db_switch.py # # Created by José Sánchez-Gallego on Sep 7, 2016. from __future__ import division from __future__ import print_function from __future__ import absolute_import def create_connection(db_name): """Creates the connection and import the model classes."...
Python
0
c8df75a2112cd8e6a4f929ceac21714b716e46ce
Use the IRC nickname for !twitter if one is not provided.
dasbit/plugin/twitter.py
dasbit/plugin/twitter.py
from twisted.web.client import getPage from urllib import urlencode import json class Twitter: def __init__(self, manager): self.client = manager.client manager.registerCommand('twitter', 'lookup', 'twitter', '(?P<query>.*?)', self.lookup) def lookup(self, source, query): if query.isd...
from twisted.web.client import getPage from urllib import urlencode import json class Twitter: def __init__(self, manager): self.client = manager.client manager.registerCommand('twitter', 'lookup', 'twitter', '(?P<query>.*?)', self.lookup) def lookup(self, source, query): if query.isd...
Python
0
1cd445e7e2f41665200a43728cbd5196098b7cad
fix crash
school/api.py
school/api.py
# -*- coding: utf-8 -*- from django.core.paginator import Paginator, InvalidPage from django.http import Http404 from django.urls import re_path from django.db.models import Q from haystack.query import SearchQuerySet from tastypie import fields from tastypie.resources import ModelResource from tastypie.resources impo...
# -*- coding: utf-8 -*- from django.core.paginator import Paginator, InvalidPage from django.http import Http404 from django.urls import re_path from django.db.models import Q from haystack.query import SearchQuerySet from tastypie import fields from tastypie.resources import ModelResource from tastypie.resources impo...
Python
0.000003
774da53edef30cb2f3c45cc47c63d46f142a4e07
Use four space indentation, repo_path to arguments
score_repo.py
score_repo.py
#!/usr/bin/env python3 import argparse import importlib import json import os import sys def load_attribute_plugins(attributes): for attribute in attributes: if attribute['enabled']: try: attribute['implementation'] = importlib.import_module("attributes.{0}.main".format(attribu...
#!/usr/bin/env python3 import argparse import importlib import json import sys def loadAttributePlugins(attributes): for attribute in attributes: if attribute['enabled']: try: attribute['implementation'] = importlib.import_module("attributes.{0}.main".format(attribute['name'])) except Import...
Python
0.000001
47c7cccc674beee06c2d4d6f6f197cb860d33354
Update bno055.py
home/Calamity/bno055.py
home/Calamity/bno055.py
arduino = Runtime.createAndStart("arduino","Arduino") arduino.connect("COM11") bno = Runtime.createAndStart("bno","Bno055") bno.setController(arduino) if bno.begin(): while (True): event = bno.getEvent() print event.orientation.x print event.orientation.y print event.orientation.z sleep(1)
arduino = Runtime.createAndStart("arduino","Arduino") arduino.connect("COM11") bno = Runtime.createAndStart("bno","Bno055") bno.setController(arduino) if bno.begin(): event = bno.getEvent() print event.orientation.x print event.orientation.y print event.orientation.z
Python
0
59f96d2ca0f3752052d870ef9c7bc5bc21f21e40
add header
host/pydaq/HL/tdc_s3.py
host/pydaq/HL/tdc_s3.py
# # ------------------------------------------------------------ # Copyright (c) SILAB , Physics Institute of Bonn University # ------------------------------------------------------------ # # SVN revision information: # $Rev:: $: # $Author:: $: # $Date:: ...
# # ------------------------------------------------------------ # Copyright (c) SILAB , Physics Institute of Bonn University # ------------------------------------------------------------ # # SVN revision information: # $Rev:: 1 $: # $Author:: TheresaObermann $: # $Date:: 2013-10-09 10...
Python
0.000001
70f460d3d0ba4c605704bb7179e3618583311621
add docstrings for SPIRE funcs
hsadownload/getspire.py
hsadownload/getspire.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from hsadownload.access import getHsaFits, getObsUrn, parseContextHdu, fixHerschelHeader import os import astropy.io.fits as fits def downloadSpireMap(ldict, obsid, le...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from hsadownload.access import getHsaFits, getObsUrn, parseContextHdu, fixHerschelHeader import os import astropy.io.fits as fits def downloadSpireMap(ldict, obsid, le...
Python
0
f52921e78cc6a8af38df50f0b0ba4d04b15fd768
fix the import error in db.py
service/db.py
service/db.py
#coding=utf-8 import torndb import datetime from constants.errorcode import Errorcode from util.gip_exception import GipException class DB(object): def __init__(self, application): self.mysql_read = application.mysql_conn_read self.mysql_write = application.mysql_conn_write #self.mong...
#coding=utf-8 import torndb import datetime from constants.errorcode import Errorcode from util.lt_exception import LTException class DB(object): def __init__(self, application): self.mysql_read = application.mysql_conn_read self.mysql_write = application.mysql_conn_write ...
Python
0.000035
624adf50b90f97454857185d71259f6fb7a7fed6
fix imports
hublib/rappture/tool.py
hublib/rappture/tool.py
from __future__ import print_function from .node import Node import numpy as np from lxml import etree as ET import os import subprocess import sys from .rappture import RapXML class Tool(RapXML): def __init__(self, tool): """ tool can be any of the following: - Path to a tool.xml file. ...
from __future__ import print_function from .node import Node import numpy as np from lxml import etree as ET import os from subprocess import call, Popen, PIPE import sys from .rappture import RapXML from hublib.use import _use class Tool(RapXML): def __init__(self, tool): """ tool can be any of t...
Python
0.000002
0b4b57f90ee3d0fe0af3ba9921adccda784d6301
Allow to order payment profile by name, type and status.
src/waldur_mastermind/invoices/filters.py
src/waldur_mastermind/invoices/filters.py
import django_filters from rest_framework import filters from waldur_core.core import filters as core_filters from . import models class InvoiceFilter(django_filters.FilterSet): customer = core_filters.URLFilter( view_name='customer-detail', field_name='customer__uuid' ) customer_uuid = django_f...
import django_filters from rest_framework import filters from waldur_core.core import filters as core_filters from . import models class InvoiceFilter(django_filters.FilterSet): customer = core_filters.URLFilter( view_name='customer-detail', field_name='customer__uuid' ) customer_uuid = django_f...
Python
0
af0fbfe74ecaac67fb37f03e01a9aefcd06ce83f
Change default scriptPubKey in coinbase
qa/rpc-tests/test_framework/blocktools.py
qa/rpc-tests/test_framework/blocktools.py
# blocktools.py - utilities for manipulating blocks and transactions # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # from mininode import * from script import CScript, CScriptOp, OP_TRUE, OP_CHECKSIG # Create a block (wit...
# blocktools.py - utilities for manipulating blocks and transactions # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # from mininode import * from script import CScript, CScriptOp # Create a block (with regtest difficulty) ...
Python
0
4d413d45def838d730806097484d7ccf9d49744f
Fix to test code
mycluster/test.py
mycluster/test.py
import mycluster mycluster.init() mycluster.create_submit('hybrid:hybrid.q',script_name='test.job',num_tasks=2, tasks_per_node=2, my_script='test.bsh', ...
import mycluster mycluster.create_submit('hybrid:hybrid.q',script_name='test.job',num_tasks=2, tasks_per_node=2, my_script='test.bsh', ...
Python
0.000018
4c29471af61989e852a813999cf37aa9a8acf76d
test anon to /users endpoint
onadata/apps/api/tests/viewsets/test_user_viewset.py
onadata/apps/api/tests/viewsets/test_user_viewset.py
import json from onadata.apps.api.tests.viewsets.test_abstract_viewset import\ TestAbstractViewSet from onadata.apps.api.viewsets.user_viewset import UserViewSet class TestUserViewSet(TestAbstractViewSet): def setUp(self): super(self.__class__, self).setUp() def test_user_list(self): vie...
import json from onadata.apps.api.tests.viewsets.test_abstract_viewset import\ TestAbstractViewSet from onadata.apps.api.viewsets.user_viewset import UserViewSet class TestUserViewSet(TestAbstractViewSet): def setUp(self): super(self.__class__, self).setUp() def test_user_list(self): vie...
Python
0.000001
84eff383a42784400261c39c87b9455133771bea
correct role & add image
data/upload/backend/parser.py
data/upload/backend/parser.py
import re import csv from data.upload.backend.xlrd import xlrd_dict_reader from data.upload.backend.csv import csv_dict_reader from data.upload.models import (SpreadsheetUpload, SpreadsheetPerson, SpreadsheetSource, SpreadsheetLink, SpreadsheetContactDetai...
import re import csv from data.upload.backend.xlrd import xlrd_dict_reader from data.upload.backend.csv import csv_dict_reader from data.upload.models import (SpreadsheetUpload, SpreadsheetPerson, SpreadsheetSource, SpreadsheetLink, SpreadsheetContactDetai...
Python
0
9e30bc38cfa3cb000ab2d84730552d50ea604ac1
configure wsgi file to use whitenoise
heroku-libsass-python/wsgi.py
heroku-libsass-python/wsgi.py
""" WSGI config for project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` setting...
""" WSGI config for project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` setting...
Python
0
e5b1221598e27c0b871f6afa34bd9dfa06a72845
clean up artifacts at the end of doc build
docs/build.py
docs/build.py
#!/usr/bin/env python """Build scriptharness documentation. At some point it would be good to automate all CI/Release tasks for scriptharness; this is a good start. """ from __future__ import print_function, division, absolute_import, \ unicode_literals from jinja2 import Template import os impo...
#!/usr/bin/env python """Build scriptharness documentation. At some point it would be good to automate all CI/Release tasks for scriptharness; this is a good start. """ from __future__ import print_function, division, absolute_import, \ unicode_literals from jinja2 import Template import os impo...
Python
0
0306b2631260c115f99b8a1f73322277e1c50989
Remove fetal anomaly scans from ARPKD
scripts/fixtures/radar_fixtures/cohorts.py
scripts/fixtures/radar_fixtures/cohorts.py
from radar.models.groups import Group, GROUP_TYPE from radar.pages import PAGE from radar_fixtures.utils import add COHORTS = [ { 'code': 'BONEITIS', 'name': 'Bone-itis', 'short_name': 'Bone-itis', 'pages': [ PAGE.PRIMARY_DIAGNOSIS, PAGE.DIAGNOSES, ...
from radar.models.groups import Group, GROUP_TYPE from radar.pages import PAGE from radar_fixtures.utils import add COHORTS = [ { 'code': 'BONEITIS', 'name': 'Bone-itis', 'short_name': 'Bone-itis', 'pages': [ PAGE.PRIMARY_DIAGNOSIS, PAGE.DIAGNOSES, ...
Python
0
d6371341c13ffe623755cf89ff03733c111bb994
change to rga2
profile_collection/startup/12-rga.py
profile_collection/startup/12-rga.py
### This is RGA:2 configured for ExQ new RGA connected at 10.28.2.142 ##### from ophyd import Device, Component as Cpt class RGA(Device): startRGA = Cpt(EpicsSignal, 'Cmd:MID_Start-Cmd') stopRGA = Cpt(EpicsSignal, 'Cmd:ScanAbort-Cmd') mass1 = Cpt(EpicsSignalRO, 'P:MID1-I') mass2 = Cpt(EpicsSignalRO, '...
from ophyd import Device, Component as Cpt class RGA(Device): startRGA = Cpt(EpicsSignal, 'Cmd:MID_Start-Cmd') stopRGA = Cpt(EpicsSignal, 'Cmd:ScanAbort-Cmd') mass1 = Cpt(EpicsSignalRO, 'P:MID1-I') mass2 = Cpt(EpicsSignalRO, 'P:MID2-I') mass3 = Cpt(EpicsSignalRO, 'P:MID3-I') mass4 = Cpt(EpicsS...
Python
0.998462
99c02cfc36660838e5250e62d1c6f390994dda9b
Attach metadata class instance to class attribute.
pyramid_jsonapi/metadata/__init__.py
pyramid_jsonapi/metadata/__init__.py
"""This package contains metadata 'plugin' modules that provide extra information related to the API being generated, such as documentation, schemas etc. Such plugins can optionally be offered as pyramid routes and views under the 'metadata' endpoint.""" import collections import importlib import os.path import pkgut...
"""This package contains metadata 'plugin' modules that provide extra information related to the API being generated, such as documentation, schemas etc. Such plugins can optionally be offered as pyramid routes and views under the 'metadata' endpoint.""" import collections import importlib import os.path import pkgut...
Python
0
ec46226b0ae5e9d2c29aa07f2ec6749f96a36804
add str isValidPalindrome
str/string_function.py
str/string_function.py
#!/usr/bin/env python # -*- coding:utf-8 -*- from __future__ import division from __future__ import unicode_literals from __future__ import print_function def reverseStr(input_str, begin, end): # Pythonic way should be input_str[::-1] str_list = list(input_str) while begin < end: str_list[begin], ...
#!/usr/bin/env python # -*- coding:utf-8 -*- from __future__ import division from __future__ import unicode_literals from __future__ import print_function def reverseStr(input_str, begin, end): # Pythonic way should be input_str[::-1] str_list = list(input_str) while begin < end: str_list[begin], ...
Python
0.999996
95a8a85aab19cad08703ec1adbb42ca1437119b0
Fix gprof2dot not found error
pytest-profiling/pytest_profiling.py
pytest-profiling/pytest_profiling.py
from __future__ import absolute_import import sys import os import cProfile import pstats import pipes import errno from hashlib import md5 import six import pytest LARGE_FILENAME_HASH_LEN = 8 def clean_filename(s): forbidden_chars = set('/?<>\:*|"') return six.text_type("".join(c if c not in forbidden_cha...
from __future__ import absolute_import import sys import os import cProfile import pstats import pipes import errno from hashlib import md5 import six import pytest LARGE_FILENAME_HASH_LEN = 8 def clean_filename(s): forbidden_chars = set('/?<>\:*|"') return six.text_type("".join(c if c not in forbidden_cha...
Python
0.000002
72171897071bf4b88013b74a13e45231fbc8d7ff
Remove feedback from response serializer.
studies/serializers.py
studies/serializers.py
from accounts.models import Child, DemographicData, Organization, User from api.serializers import (ModelSerializer, UUIDResourceRelatedField, UUIDSerializerMixin) from rest_framework_json_api import serializers from studies.models import Response, Study, Feedback class StudySerializer(UU...
from accounts.models import Child, DemographicData, Organization, User from api.serializers import (ModelSerializer, UUIDResourceRelatedField, UUIDSerializerMixin) from rest_framework_json_api import serializers from studies.models import Response, Study, Feedback class StudySerializer(UU...
Python
0
c128355193d3f0339e24ee70f685d31dbf5b6bb9
Add stub for search()
sudoku/puzzlesolver.py
sudoku/puzzlesolver.py
""" puzzlesolver.py :created on: 20160624 __author__ = 'Frederic Dupont' :License: GPL3 """ __author__ = 'Fred Dupont' import sys from sudoku import puzzleconstants as p_const from sudoku.puzzle import Puzzle, make_grid_from_string class PuzzleSolver(object): """ class that solves a sudoku puzzle tak...
""" puzzlesolver.py :created on: 20160624 __author__ = 'Frederic Dupont' :License: GPL3 """ __author__ = 'Fred Dupont' import sys from sudoku import puzzleconstants as p_const from sudoku.puzzle import Puzzle, make_grid_from_string class PuzzleSolver(object): """ class that solves a sudoku puzzle tak...
Python
0
39bf1b019897b71a3269e46816f11eefa32de507
Fix argument order
elm_package.py
elm_package.py
#! /usr/bin/env python """ Load and save elm-package.json safely. """ # from typing import Dict, Tuple, IO import copy from collections import OrderedDict import json def load(fileobj): # type: (IO[str]) -> Dict return json.load(fileobj, object_pairs_hook=OrderedDict) def dump(package, fileobj): # type...
#! /usr/bin/env python """ Load and save elm-package.json safely. """ # from typing import Dict, Tuple, IO import copy from collections import OrderedDict import json def load(fileobj): # type: (IO[str]) -> Dict return json.load(fileobj, object_pairs_hook=OrderedDict) def dump(package, fileobj): # type...
Python
0.002367
c4670a1b6eb1bbd546369be185cd1fb69dfa3ec0
fix race condition that would drop certain messages on the floor.
emailparser.py
emailparser.py
#!/usr/bin/python import imaplib, time, email.utils, email.parser, calendar import re class EmailParser: def __init__(self, server, username, password, port=None, use_ssl=False, last_check=time.time()): self.server = server if not port: if use_ssl: self.port = 993 else: sel...
#!/usr/bin/python import imaplib, time, email.utils, email.parser, calendar import re class EmailParser: def __init__(self, server, username, password, port=None, use_ssl=False, last_check=time.time()): self.server = server if not port: if use_ssl: self.port = 993 else: sel...
Python
0
e33f4bf8aab41a3bcb564e582c64e2d5e1986187
Fix name/username match
modules/sfp_myspace.py
modules/sfp_myspace.py
#------------------------------------------------------------------------------- # Name: sfp_myspace # Purpose: Query MySpace for username and location information. # # Author: Brendan Coles <bcoles@gmail.com> # # Created: 2018-10-07 # Copyright: (c) Brendan Coles 2018 # Licence: GPL #------...
#------------------------------------------------------------------------------- # Name: sfp_myspace # Purpose: Query MySpace for username and location information. # # Author: Brendan Coles <bcoles@gmail.com> # # Created: 2018-10-07 # Copyright: (c) Brendan Coles 2018 # Licence: GPL #------...
Python
0.033851
552a9e958443ffdff4b28e6e432c09e7d011df6a
Update tesselate_shapes_frame docstring
svg_model/tesselate.py
svg_model/tesselate.py
# coding: utf-8 import types import pandas as pd from .seidel import Triangulator def tesselate_shapes_frame(df_shapes, shape_i_columns): ''' Tesselate each shape path into one or more triangles. Parameters ---------- df_shapes : pandas.DataFrame Table containing vertices of shapes, one ...
# coding: utf-8 import types import pandas as pd from .seidel import Triangulator def tesselate_shapes_frame(df_shapes, shape_i_columns): ''' Tesselate each shape path into one or more triangles. Return `pandas.DataFrame` with columns storing the following fields for each row (where each row corresp...
Python
0
9a744080454cd2577af0935ca9e8b5efccabeb8c
Fix typo hexify -> hexlify
stratatools/helper/rpi_daemon.py
stratatools/helper/rpi_daemon.py
#!/usr/bin/env python2 import argparse import binascii import pyudev import sys import time import traceback from stratatools import * from stratatools import machine,cartridge,manager,crypto,checksum,cartridge_pb2 from google.protobuf.text_format import MessageToString, Merge cartridge_manager = None machine_number...
#!/usr/bin/env python2 import argparse import binascii import pyudev import sys import time import traceback from stratatools import * from stratatools import machine,cartridge,manager,crypto,checksum,cartridge_pb2 from google.protobuf.text_format import MessageToString, Merge cartridge_manager = None machine_number...
Python
0.000336
dfee7e1c89df879f187921752485153fd6214445
Fix typo
IPython/extensions/cythonmagic.py
IPython/extensions/cythonmagic.py
# -*- coding: utf-8 -*- """ The cython magic has been integrated into Cython itself, which is now released in version 0.21. cf github `Cython` organisation, `Cython` repo, under the file `Cython/Build/IpythonMagic.py` """ #----------------------------------------------------------------------------- # Copyright (C) ...
# -*- coding: utf-8 -*- """ The cython magic has been integrated into Cython itself, which is now released in version 0.21. cf github `Cython` organisation, `Cython` repo, under the file `Cython/Build/IpythonMagic.py` """ #----------------------------------------------------------------------------- # Copyright (C) ...
Python
0.000073
9f56f877705bdc0171c3afddadc6d58fb867cefc
Fix PEP 8 issue.
test/units/modules/system/test_systemd.py
test/units/modules/system/test_systemd.py
import os import tempfile from ansible.compat.tests import unittest from ansible.modules.system.systemd import parse_systemctl_show class ParseSystemctlShowTestCase(unittest.TestCase): def test_simple(self): lines = [ 'Type=simple', 'Restart=no', 'Requires=system.slic...
import os import tempfile from ansible.compat.tests import unittest from ansible.modules.system.systemd import parse_systemctl_show class ParseSystemctlShowTestCase(unittest.TestCase): def test_simple(self): lines = [ 'Type=simple', 'Restart=no', 'Requires=system.slic...
Python
0
9bdb3a5e6e2f241a39269d992f1ca5c9f37440ae
add wlm source
importer/SeFornminSv.py
importer/SeFornminSv.py
from Monument import Monument import importer_utils as utils from os import path MAPPING_DIR = "mappings" class SeFornminSv(Monument): def update_labels(self): if len(self.namn) == 0: self.add_label("sv", self.raa_nr) else: self.add_label("sv", self.namn) def set_de...
from Monument import Monument import importer_utils as utils from os import path MAPPING_DIR = "mappings" class SeFornminSv(Monument): def update_labels(self): if len(self.namn) == 0: self.add_label("sv", self.raa_nr) else: self.add_label("sv", self.namn) def set_de...
Python
0
ce1e52336fa298d52aac264d8ccd3887fc8e18e4
Bump binaryen to version 81.
src/funfuzz/js/with_binaryen.py
src/funfuzz/js/with_binaryen.py
# coding=utf-8 # # 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 https://mozilla.org/MPL/2.0/. """Run seeds with binaryen to get a wasm file, then run the shell with the translated wasm binary usin...
# coding=utf-8 # # 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 https://mozilla.org/MPL/2.0/. """Run seeds with binaryen to get a wasm file, then run the shell with the translated wasm binary usin...
Python
0
52c6efa0a84334522cdd76e1e85ffe6bf601ea02
Annotate commands/export_single_user.py.
zerver/management/commands/export_single_user.py
zerver/management/commands/export_single_user.py
from __future__ import absolute_import from __future__ import print_function from typing import Any from argparse import ArgumentParser from django.core.management.base import BaseCommand, CommandError from django.core.exceptions import ValidationError import os import shutil import subprocess import tempfile import...
from __future__ import absolute_import from __future__ import print_function from django.core.management.base import BaseCommand, CommandError from django.core.exceptions import ValidationError import os import shutil import subprocess import tempfile import ujson from zerver.lib.export import do_export_user from ze...
Python
0
2a2309bb4f3a8ae231106123855959d44a0e7551
Fix linter
cartoframes/viz/helpers/size_continuous_layer.py
cartoframes/viz/helpers/size_continuous_layer.py
from __future__ import absolute_import from ..layer import Layer def size_continuous_layer(source, value, title='', size=None, color=None): return Layer( source, style={ 'point': { 'width': 'ramp(linear(sqrt(${0}), sqrt(globalMin(${0})), sqrt(globalMax(${0}))), {1})'.f...
from __future__ import absolute_import from ..layer import Layer def size_continuous_layer(source, value, title='', size=None, color=None): return Layer( source, style={ 'point': { 'width': 'ramp(linear(sqrt(${0}), sqrt(globalMin(${0})), sqrt(globalMax(${0}))), {1})'.f...
Python
0.000002
c426ae514227adaf9dd86f6ada6ce05bc76298c2
Make portal_config fetch config from a URL
catkin/src/portal_config/scripts/serve_config.py
catkin/src/portal_config/scripts/serve_config.py
#!/usr/bin/env python import rospy import urllib2 from portal_config.srv import * # XXX TODO: return an error if the config file isn't valid JSON class ConfigRequestHandler(): def __init__(self, url): self.url = url def get_config(self): response = urllib2.urlopen(self.url) return re...
#!/usr/bin/env python import rospy from portal_config.srv import * class ConfigRequestHandler(): def __init__(self, url): self.url = url def get_config(self): return '{"foo": "bar"}' def handle_request(self, request): config = self.get_config() return PortalConfigRespons...
Python
0.000002
3023600701d64da42534fdc0050c473450e9e5f7
Bump the dart version used on the infra bots to 1.14.1
infra/download_dart_sdk.py
infra/download_dart_sdk.py
#!/usr/bin/python # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Pulls down the current dart sdk to third_party/dart-sdk/. You can manually force this to run again by removing third_party/dart-sdk/STA...
#!/usr/bin/python # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Pulls down the current dart sdk to third_party/dart-sdk/. You can manually force this to run again by removing third_party/dart-sdk/STA...
Python
0
cb96065fcf1f31dfbecfbb064c9414ffbc69217f
Remove all relative imports. We have always been at war with relative imports.
forms.py
forms.py
""" GB-specific Form helpers """ from __future__ import absolute_import import re from django.contrib.localflavor.gb.gb_regions import GB_NATIONS_CHOICES, GB_REGION_CHOICES from django.forms.fields import CharField, Select from django.forms import ValidationError from django.utils.translation import ugettext_lazy as...
""" GB-specific Form helpers """ import re from django.forms.fields import CharField, Select from django.forms import ValidationError from django.utils.translation import ugettext_lazy as _ class GBPostcodeField(CharField): """ A form field that validates its input is a UK postcode. The regular expressi...
Python
0.002027
c78c6f7e9cc305b96eb35a5a0c8f7353db5a3ed2
Update _share.py
tago/account/_share.py
tago/account/_share.py
import requests # Used to make HTTP requests import os import json API_TAGO = os.environ.get('TAGO_SERVER') or 'https://api.tago.io' def invite(type, ref_id, data, default_options): data = data if data else {} if ref_id is None or ref_id == '': raise ValueError('ref_id must be set') elif data['ema...
import requests # Used to make HTTP requests import os import json API_TAGO = os.environ.get('TAGO_SERVER') or 'https://api.tago.io' def invite(type, ref_id, data, default_options): data = data if data else {} if ref_id is None or ref_id == '': raise ValueError('ref_id must be set') elif data['ema...
Python
0
f2a2f6268e11086ece3c311dd3e93e11672de03b
Comment addition.
Lib/distutils/command/build_py.py
Lib/distutils/command/build_py.py
"""distutils.command.build_py Implements the Distutils 'build_py' command.""" # created 1999/03/08, Greg Ward __rcsid__ = "$Id$" import string, os from distutils.core import Command from distutils.errors import * from distutils.util import mkpath, newer, make_file, copy_file class BuildPy (Command): options ...
"""distutils.command.build_py Implements the Distutils 'build_py' command.""" # created 1999/03/08, Greg Ward __rcsid__ = "$Id$" import string, os from distutils.core import Command from distutils.errors import * from distutils.util import mkpath, newer, make_file, copy_file class BuildPy (Command): options ...
Python
0
e0bebba359bca6498c212e1c1fae3d95d2a046b4
Fix python scripts src/chrome_frame/tools/test/page_cycler/cf_cycler.py
chrome_frame/tools/test/page_cycler/cf_cycler.py
chrome_frame/tools/test/page_cycler/cf_cycler.py
#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Automates IE to visit a list of web sites while running CF in full tab mode. The page cycler automates IE and navigates it to a...
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Automates IE to visit a list of web sites while running CF in full tab mode. The page cycler automates IE and navigates it to a series of URLs....
Python
0.999995
3575415592fbd215de02e139d95ad5780bccadd2
Add greeting method that returns given parameter
hello.py
hello.py
def greeting(msg): print(msg) if __name__ == "__main__": greeting('hello')
print("Hello")
Python
0.000146
f2e8f2ef957a6053345f72889c1048a871988bc0
Add octario library path to the plugin helper
ir-plugin/osp_version_name.py
ir-plugin/osp_version_name.py
#!/usr/bin/env python # Copyright 2017 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
#!/usr/bin/env python # Copyright 2017 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
Python
0.000002
6565c4852c2a26f385cf9a422a914ee110b25b4b
Remove cruft from activity_WorkflowConflictCheck.py
activity/activity_WorkflowConflictCheck.py
activity/activity_WorkflowConflictCheck.py
import boto.swf import json import random import datetime import calendar import time import activity import boto.ses import provider.swfmeta as swfmetalib """ WorkflowConflictCheck activity """ class activity_WorkflowConflictCheck(activity.activity): def __init__(self, settings, logger, conn = None, token = ...
import boto.swf import json import random import datetime import calendar import time import activity import boto.ses import provider.swfmeta as swfmetalib """ WorkflowConflictCheck activity """ class activity_WorkflowConflictCheck(activity.activity): def __init__(self, settings, logger, conn = None, token = ...
Python
0
5a5418a9e5f817c3c3f426f57aeefe800c45cc96
Implement tuples.
jaspyx/visitor/types.py
jaspyx/visitor/types.py
import json from jaspyx.visitor import BaseVisitor class Types(BaseVisitor): def visit_Num(self, node): self.output(json.dumps(node.n)) def visit_Str(self, node): self.output(json.dumps(node.s)) def visit_List(self, node): self.group(node.elts, prefix='[', infix=', ', suffix=']')...
import json from jaspyx.visitor import BaseVisitor class Types(BaseVisitor): def visit_Num(self, node): self.output(json.dumps(node.n)) def visit_Str(self, node): self.output(json.dumps(node.s)) def visit_List(self, node): self.group(node.elts, prefix='[', infix=', ', suffix=']')...
Python
0.000004
5cda63163acec59a43c3975f1320b7268dcf337b
Add parameter for log level
devito/parameters.py
devito/parameters.py
"""The parameters dictionary contains global parameter settings.""" __all__ = ['Parameters', 'parameters'] # Be EXTREMELY careful when writing to a Parameters dictionary # Read here for reference: http://wiki.c2.com/?GlobalVariablesAreBad # https://softwareengineering.stackexchange.com/questions/148108/why-is-global-...
"""The parameters dictionary contains global parameter settings.""" __all__ = ['Parameters', 'parameters'] # Be EXTREMELY careful when writing to a Parameters dictionary # Read here for reference: http://wiki.c2.com/?GlobalVariablesAreBad # If any issues related to global state arise, the following class should # be ...
Python
0.000001
8555fc56b72dc86f266055da4b903cda7986654b
Update utils.py to prevent downcasting
emdp/utils.py
emdp/utils.py
import numpy as np # 1D utilities. def convert_int_rep_to_onehot(state, vector_size): s = np.zeros(vector_size) s[state] = 1 return s def convert_onehot_to_int(state): if type(state) is not np.ndarray: state = np.array(state) return state.argmax().item() # # def xy_to_flatten_state(state, ...
import numpy as np # 1D utilities. def convert_int_rep_to_onehot(state, vector_size): s = np.zeros(vector_size) s[state] = 1 return s def convert_onehot_to_int(state): if type(state) is not np.ndarray: state = np.array(state) return state.argmax().astype(np.int8) # # def xy_to_flatten_stat...
Python
0
76aa0d680f85298ca66de7bbcd0dbdc2342c9955
Update Vikidia versions
pywikibot/families/vikidia_family.py
pywikibot/families/vikidia_family.py
# -*- coding: utf-8 -*- """Family module for Vikidia.""" from __future__ import absolute_import, unicode_literals __version__ = '$Id$' from pywikibot import family class Family(family.SubdomainFamily): """Family class for Vikidia.""" name = 'vikidia' domain = 'vikidia.org' codes = ['ca', 'de', '...
# -*- coding: utf-8 -*- """Family module for Vikidia.""" from __future__ import absolute_import, unicode_literals __version__ = '$Id$' from pywikibot import family class Family(family.SubdomainFamily): """Family class for Vikidia.""" name = 'vikidia' domain = 'vikidia.org' codes = ['ca', 'en', '...
Python
0
f1c4b6c9a4bc5a34c6b63b0b96e170f7d2b7fa17
Move comment for min_conflicts algorithm
ai_graph_color/algorithms/min_conflicts.py
ai_graph_color/algorithms/min_conflicts.py
import random params = {} def run(graph, setup, params): """ Color a graph using min-conflicts: First generate a random coloring for the graph. Until there are no conflicts in the graph, choose a random node in the graph, and change it to have the color which reduces the number of co...
""" Color a graph using min-conflicts: First generate a random coloring for the graph. Until there are no conflicts in the graph, choose a random node in the graph, and change it to have the color which reduces the number of conflicts in the graph the most. :param colors: the number of colors to color the gra...
Python
0
7f14a3a1babf102a090a7541038e88337ef14c46
Remove unused import from test
tests/functional/test_customer_account.py
tests/functional/test_customer_account.py
from django.core.urlresolvers import reverse from oscar.test.testcases import WebTestCase from oscar_support.models import Ticket from oscar_support.defaults import SUPPORT_INITIAL_STATUS from tests import factories class TestACustomer(WebTestCase): is_anonymous = False def setUp(self): super(Test...
from django.core.urlresolvers import reverse from oscar.test.testcases import WebTestCase from oscar.test.factories import create_order from oscar_support.models import Ticket from oscar_support.defaults import SUPPORT_INITIAL_STATUS from tests import factories class TestACustomer(WebTestCase): is_anonymous = ...
Python
0
5138db4353edf7414c79ca8e1e42c73b35313b15
Remove various now unused interfaces.
morepath/interfaces.py
morepath/interfaces.py
# -*- coding: utf-8 -*- from abc import ABCMeta, abstractmethod class Interface(object): __meta__ = ABCMeta # class IConsumer(Interface): # """A consumer consumes steps in a stack to find an object. # """ # @abstractmethod # def __call__(self, obj, stack, lookup): # """Returns a boolean ...
# -*- coding: utf-8 -*- from abc import ABCMeta, abstractmethod class Interface(object): __meta__ = ABCMeta class IConsumer(Interface): """A consumer consumes steps in a stack to find an object. """ @abstractmethod def __call__(self, obj, stack, lookup): """Returns a boolean meaning that...
Python
0
d7f17d7d8592f016d8c46ac530338e11b366896d
make randomizer standalone
mpf/core/randomizer.py
mpf/core/randomizer.py
from uuid import uuid4 import random class Randomizer(object): def __init__(self, items): self.force_different = True self.force_all = False self.disable_random = False # self.loop - property which sets force_all=True if loop==False self.items = list() self._loop...
from uuid import uuid4 import random class Randomizer(object): def __init__(self, machine, items, memory='player'): self.force_different = True self.force_all = False self.disable_random = False # self.loop - property which sets force_all=True if loop==False self.items = ...
Python
0.000029
e58686442750afeae70dd3f669070c1342af0bbe
Fix error in qrepeatall()
ControlFlow.py
ControlFlow.py
from BlockLabel import label, endlabel from functools import wraps ## QGL control-flow statements ## def qif(mask, ifSeq, elseSeq=None): if elseSeq: endlabel(elseSeq) # make sure to populate label of elseSeq before using it return [CmpEq(mask), Goto(label(ifSeq))] + elseSeq + [Goto(endlabel(ifSeq))] + ifSeq el...
from BlockLabel import label, endlabel from functools import wraps ## QGL control-flow statements ## def qif(mask, ifSeq, elseSeq=None): if elseSeq: endlabel(elseSeq) # make sure to populate label of elseSeq before using it return [CmpEq(mask), Goto(label(ifSeq))] + elseSeq + [Goto(endlabel(ifSeq))] + ifSeq el...
Python
0.000009
70ecc48e9fb4d936d9c72d89ccbeec51f42b5252
fix get master ip
docker/k8s_tools.py
docker/k8s_tools.py
#!/bin/env python import os import sys import time import socket from kubernetes import client, config PADDLE_JOB_NAME = os.getenv("PADDLE_JOB_NAME") NAMESPACE = os.getenv("NAMESPACE") PORT = os.getenv("PSERVER_PORT") if os.getenv("KUBERNETES_SERVICE_HOST", None): config.load_incluster_config() else: config.loa...
#!/bin/env python import os import sys import time import socket from kubernetes import client, config PADDLE_JOB_NAME = os.getenv("PADDLE_JOB_NAME") NAMESPACE = os.getenv("NAMESPACE") PORT = os.getenv("PSERVER_PORT") if os.getenv("KUBERNETES_SERVICE_HOST", None): config.load_incluster_config() else: config.loa...
Python
0
a0791372d7943a785ae55ed31044d0316b53a2ac
Patch release
elephantblog/__init__.py
elephantblog/__init__.py
from __future__ import absolute_import, unicode_literals VERSION = (1, 0, 1) __version__ = '.'.join(map(str, VERSION))
from __future__ import absolute_import, unicode_literals VERSION = (1, 0, 0) __version__ = '.'.join(map(str, VERSION))
Python
0.000001
34a6ccce1d93843d53efb5985ff5bbb7ea063e31
add force_text a la Django
babel/_compat.py
babel/_compat.py
import sys import array PY2 = sys.version_info[0] == 2 _identity = lambda x: x if not PY2: text_type = str binary_type = bytes string_types = (str,) integer_types = (int, ) text_to_native = lambda s, enc: s unichr = chr iterkeys = lambda d: iter(d.keys()) itervalues = lambda d: ite...
import sys import array PY2 = sys.version_info[0] == 2 _identity = lambda x: x if not PY2: text_type = str string_types = (str,) integer_types = (int, ) unichr = chr text_to_native = lambda s, enc: s iterkeys = lambda d: iter(d.keys()) itervalues = lambda d: iter(d.values()) iterit...
Python
0.00049
b65b359402b2f38dad043b1b6d1840f0ef6d8e72
Fix constants
openprocurement/auctions/dgf/constants.py
openprocurement/auctions/dgf/constants.py
from datetime import datetime, timedelta from openprocurement.api.models import TZ, ORA_CODES def read_json(name): import os.path from json import loads curr_dir = os.path.dirname(os.path.realpath(__file__)) file_path = os.path.join(curr_dir, name) with open(file_path) as lang_file: data =...
from datetime import datetime, timedelta from openprocurement.api.models import TZ, ORA_CODES def read_json(name): import os.path from json import loads curr_dir = os.path.dirname(os.path.realpath(__file__)) file_path = os.path.join(curr_dir, name) with open(file_path) as lang_file: data =...
Python
0.000021
eed9ad741a4bd72d0b476f7580b7d22f84a7f8bb
update test base classes
openprocurement/tender/esco/tests/base.py
openprocurement/tender/esco/tests/base.py
# -*- coding: utf-8 -*- import os from copy import deepcopy from openprocurement.api.tests.base import ( BaseTenderWebTest, BaseWebTest ) from openprocurement.api.tests.base import test_organization as base_test_organization from openprocurement.tender.openua.tests.base import test_bids as base_test_bids from open...
# -*- coding: utf-8 -*- import os from copy import deepcopy from openprocurement.api.tests.base import ( BaseTenderWebTest, BaseWebTest ) from openprocurement.tender.openua.tests.base import test_tender_data as base_ua_test_data from openprocurement.tender.openeu.tests.base import test_tender_data as base_eu_test_...
Python
0
2fb1c14f9ad0b72f1f059d7e5e233b8001c2b60b
Update auth tests
app/tests/integration/test_twitter_api.py
app/tests/integration/test_twitter_api.py
# -*- coding: utf-8 -*- """ Twitter API test module. Do requests to the Twitter API using configured credentials. NB. These require valid tokens for a Twitter dev account, plus a network connection. """ from unittest import TestCase from lib.config import AppConf from lib.twitter_api import authentication conf = App...
# -*- coding: utf-8 -*- """ Twitter API test module. """ from unittest import TestCase from lib.twitter_api import authentication class TestAuth(TestCase): def test_generateAppToken(self): auth = authentication._generateAppAccessToken() def test_getTweepyConnection(self): auth = authenticat...
Python
0.000003
6ba94b87e11b994b02457e57d71eab9b80d28167
fix import for django 1.8
tests/notification/test_sites.py
tests/notification/test_sites.py
from mock import patch from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.core.urlresolvers import reverse from django.test import TestCase, override_settings from callisto.delivery.models import Report from callisto.notification.mo...
from mock import patch from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.test import TestCase, override_settings from django.urls import reverse from callisto.delivery.models import Report from callisto.notification.models import E...
Python
0.000001
0b7b9f95ab2efd16b75dd7d5689ba2329c879b28
fix default
drillsrs/cmd/study.py
drillsrs/cmd/study.py
import argparse import random from datetime import datetime from drillsrs.cmd.command_base import CommandBase from drillsrs import db, scheduler, util from drillsrs.cli_args import Mode def _learn_single_card( index: int, num_cards_to_study: int, card: db.Card, mode: Mode) -> None: ...
import argparse import random from datetime import datetime from typing import List from drillsrs.cmd.command_base import CommandBase from drillsrs import db, scheduler, util from drillsrs.cli_args import Mode def _learn_single_card( index: int, num_cards_to_study: int, card: db.Card, ...
Python
0.000004
22a983f264885f355bd6c735604a4ede370365fe
Switch to unittest format
tests/unit/py2/nupic/data/helpers_test.py
tests/unit/py2/nupic/data/helpers_test.py
#! /usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions...
#! /usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions...
Python
0
f91fc2a8858c243b62d1a9a369d45216fb15f443
Change auth selenium test to use wait_element_become_present
tests/webui/steps/authentication_steps.py
tests/webui/steps/authentication_steps.py
# -*- coding: utf-8 -*- import time from behave import when, then, given from toxicbuild.ui import settings from tests.webui.steps.base_steps import ( # noqa f811 given_logged_in_webui, user_sees_main_main_page_login) # Scenario: Someone try to access a page without being logged. @when('someone tries to access...
# -*- coding: utf-8 -*- import time from behave import when, then, given from toxicbuild.ui import settings from tests.webui.steps.base_steps import ( # noqa f811 given_logged_in_webui, user_sees_main_main_page_login) # Scenario: Someone try to access a page without being logged. @when('someone tries to access...
Python
0.000001
9c8bfb78a1e45ab9cb78fc18318b2a39153103db
use the level arg to populate the operations list instead of appending. This allows the operation list to be changed on every iteration and keep a better record
numbers_solver.py
numbers_solver.py
#!/usr/bin/env python numbers = [25, 7, 9, 3, 1, 8] target = 642 # target = 225 def mult(x, y): return x * y def divide(x, y): if(x > y): return x / y else: return y / x def add(x, y): return x + y def sub(x, y): if(x > y): return x - y else: return y - x OP...
#!/usr/bin/env python numbers = [25, 7, 9, 3, 1, 8] target = 642 # target = 225 def mult(x, y): return x * y def divide(x, y): if(x > y): return x / y else: return y / x def add(x, y): return x + y def sub(x, y): if(x > y): return x - y else: return y - x OP...
Python
0
1ab8224372a5f839c8f0f74f3cafe7926905a7ec
Update __init__.py
nupic/__init__.py
nupic/__init__.py
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
Python
0.000072
39986540e1ad1c4712405e46b988459f2abbf6e9
Update for new python
Communication/testUDP.py
Communication/testUDP.py
# ------------------------------------------------------- import socket, traceback import time host = '' #host = '192.168.201.251' port = 1234 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) s.bind((ho...
# ------------------------------------------------------- import socket, traceback import time host = '' port = 12345 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) s.bind((host, port)) filein = open...
Python
0
862c42a8abf0836604f56a9008018f34c405ca13
update version number
f5/__init__.py
f5/__init__.py
# Copyright 2016 F5 Networks Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
# Copyright 2016 F5 Networks Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
Python
0.000002
5ec3da094bd9d6d1517425b27223ad5da6bfe804
Use run_su in the restart command as well
fabfile/app.py
fabfile/app.py
#:coding=utf8: import pipes from fabric.api import ( env, task, roles, prefix, local as localexec, run, execute, put, runs_once, settings, ) env.venv_path = '/var/www/venvs/homepage' env.deploy_user = 'supervisord' def run_su(cmd, user=None): # The Google Compute Engine images prompt for a passwor...
#:coding=utf8: import pipes from fabric.api import ( env, task, roles, prefix, local as localexec, sudo, run, execute, put, runs_once, settings, ) env.venv_path = '/var/www/venvs/homepage' env.deploy_user = 'supervisord' def run_su(cmd, user=None): # The Google Compute Engine images prompt for a p...
Python
0
db36e08a81d16463d8c76b896593aaeb91c057a0
Refactor into get_check_digit_from_checkable_int method
falcom/luhn.py
falcom/luhn.py
# Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. def get_check_digit_from_checkable_int (number): return (9 * ((number // 10) + rotate_digit(number % 10))) % 10 def rotate_digit (digit)...
# Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. def convert_into_luhn_checkable_int (number): if number: return int(number) else: return None def rotate_digit (dig...
Python
0.002407
29be4cad4ab90fe5d1fc087f0de2e8a575ced40b
Bump version
nanoservice/version.py
nanoservice/version.py
VERSION = '0.3.1'
VERSION = '0.3.0'
Python
0
f66e3e965c00c455608dba994575098e1cd246ae
Update request_tracking_codes.py
samples/request_tracking_codes.py
samples/request_tracking_codes.py
# Copyright 2017 Adler Medrado # # 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...
from ..correios.client import Correios from ..correios.models.user import User, Service def get_tracking_codes(service, quantity): olist_user = User('Your Company\'s Name', 'Your Company\'s CNPJ') client = Correios('Your Correio\'s username', 'Your correio\'s password') tracking_codes = client.request_tra...
Python
0.000003
f3791ea0ed11d46edf9998b80fd1ddd54d7e9b20
Bump to pre-release version 1.0.rc2.
farcy/const.py
farcy/const.py
"""Constants used throughout Farcy.""" import os import re __version__ = '1.0.rc2' VERSION_STR = 'farcy v{0}'.format(__version__) CONFIG_DIR = os.path.expanduser('~/.config/farcy') MD_VERSION_STR = ('[{0}](https://github.com/appfolio/farcy)' .format(VERSION_STR)) FARCY_COMMENT_START = '_{0}_'.for...
"""Constants used throughout Farcy.""" import os import re __version__ = '1.0.rc1' VERSION_STR = 'farcy v{0}'.format(__version__) CONFIG_DIR = os.path.expanduser('~/.config/farcy') MD_VERSION_STR = ('[{0}](https://github.com/appfolio/farcy)' .format(VERSION_STR)) FARCY_COMMENT_START = '_{0}_'.for...
Python
0
035d5feee8ea0691e5777a7b96c362877bcf01ca
Add logging
consumerSQS/consumer.py
consumerSQS/consumer.py
import boto3 import logging from config import config import answer import json import time import librarian def work(message): message = json.loads(message) print(type(message)) print(message) return sendToManager(message) def sendToManager(message): if("entry" in message): um = librarian...
import boto3 import logging from config import config import answer import json import time import librarian def work(message): message = json.loads(message) print(type(message)) print(message) return sendToManager(message) def sendToManager(message): if("entry" in message): um = librarian...
Python
0.000002
e14b8c6b06c75414f42f730e4c1e1a9208e335b0
correct shebang
fetch/fetch.py
fetch/fetch.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Greedy climate data fetch """ filename = 'wwis.json' indexurl = 'http://worldweather.wmo.int/en/json/full_city_list.txt' baseurl = 'http://worldweather.wmo.int/en/json/{0}_en.xml' guideurl = 'http://worldweather.wmo.int/en/dataguide.html' notice = 'Please note the gui...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Greedy climate data fetch """ filename = 'wwis.json' indexurl = 'http://worldweather.wmo.int/en/json/full_city_list.txt' baseurl = 'http://worldweather.wmo.int/en/json/{0}_en.xml' guideurl = 'http://worldweather.wmo.int/en/dataguide.html' notice = 'Please note the guidelin...
Python
0.997942
47555ef5589ccc07a44d9589c93be4fa193625c7
change qe setting
tests/test_ase_setup/qe_setup.py
tests/test_ase_setup/qe_setup.py
import os from ase.calculators.espresso import Espresso # set up executable label = 'AgI' input_file_name = label+'.pwi' output_file_name = label+'.pwo' no_cpus = 1 npool = 1 pw_loc = os.environ.get('PWSCF_COMMAND') #pw_loc = '/n/home08/xiey/q-e/bin/pw.x' #os.environ['ASE_ESPRESSO_COMMAND'] = 'srun -n {0} --mpi=pmi2 {...
import os from ase.calculators.espresso import Espresso # set up executable label = 'AgI' input_file_name = label+'.pwi' output_file_name = label+'.pwo' no_cpus = 1 npool = 1 pw_loc = os.environ.get('PWSCF_COMMAND') #pw_loc = '/n/home08/xiey/q-e/bin/pw.x' #os.environ['ASE_ESPRESSO_COMMAND'] = 'srun -n {0} --mpi=pmi2 {...
Python
0.000001
aeca55a5ca5a8b15314cc7bd31a3c89361436318
Add return type check test
tests/test_pandas_integration.py
tests/test_pandas_integration.py
from unittest import TestCase, main import numpy as np import pandas as pd import numpy.testing as npt from nimble import Events class TestAsPandasCondition(TestCase): def setUp(self): conditional_series = pd.Series([0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1]) condition = (conditional_series > 0) ...
from unittest import TestCase, main import numpy as np import pandas as pd import numpy.testing as npt from nimble import Events class TestAsPandasCondition(TestCase): def setUp(self): conditional_series = pd.Series([0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1]) condition = (conditional_series > 0) ...
Python
0.000001
d6a2e89736932988650c9244139aae1c1b543a88
Stop skipping tests of secondary reads in Sharded mode.
tests/test_slave_okay_sharded.py
tests/test_slave_okay_sharded.py
# Copyright 2015 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
# Copyright 2015 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
Python
0
bb330514b5a18389c451cf3ba58a72d7711c2ceb
Add unit tests
tests/unit/modules/test_event.py
tests/unit/modules/test_event.py
# -*- coding: utf-8 -*- """ :codeauthor: Rupesh Tare <rupesht@saltstack.com> """ # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt Libs import salt.modules.event as event import salt.utils.event from tests.support.mixins import LoaderModuleMockMixin from te...
# -*- coding: utf-8 -*- """ :codeauthor: Rupesh Tare <rupesht@saltstack.com> """ # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt Libs import salt.modules.event as event import salt.utils.event from tests.support.mixins import LoaderModuleMockMixin from te...
Python
0.000001
4680812bcefe32a113547485fae692ee5f6d7a52
Fix typing bugs in loss utils.
enn_acme/losses/utils.py
enn_acme/losses/utils.py
# Copyright 2022 DeepMind Technologies Limited. 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 a...
# Copyright 2022 DeepMind Technologies Limited. 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 a...
Python
0.002287
d871328e94f804a2a296f4fba44751fa98e498d1
Update custom dashboard response
rhizome/api/resources/custom_dashboard.py
rhizome/api/resources/custom_dashboard.py
from tastypie.resources import ALL from rhizome.api.resources.base_model import BaseModelResource from rhizome.api.exceptions import DatapointsException from rhizome.models import CustomDashboard, CustomChart, ChartToDashboard import json class CustomDashboardResource(BaseModelResource): class Meta(BaseModelReso...
from tastypie.resources import ALL from rhizome.api.resources.base_model import BaseModelResource from rhizome.api.exceptions import DatapointsException from rhizome.models import CustomDashboard, CustomChart, ChartToDashboard import json class CustomDashboardResource(BaseModelResource): class Meta(BaseModelReso...
Python
0
7e13edfea2ee0c055f890fba08fa645141cd2f7d
add colourbar
helix.py
helix.py
# Create the data. from numpy import pi, sin, cos, mgrid [u,v] = mgrid[-5:5:0.01,0:2*pi+0.1:0.1] a=2 x = u*cos(v) y = u*sin(v) z = a*v K=-a**2/(u**2 +a**2)**2 from mayavi import mlab s = mlab.mesh(x, y, z,scalars=K) mlab.colorbar(orientation='horizontal',title='Gaussian Curvature') mlab.show()
# Create the data. from numpy import pi, sin, cos, mgrid [u,v] = mgrid[-5:5:0.01,0:2*pi+0.1:0.1] a=2 x = u*cos(v) y = u*sin(v) z = a*v K=-a**2/(u**2 +a**2)**2 from mayavi import mlab s = mlab.mesh(x, y, z,scalars=K) mlab.show()
Python
0.000001