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
4aa248330d8fee41601b606db09bfe6f33547a63
Create a function to check which keys are being pressed and notify the server
game.py
game.py
import pygame from PodSixNet.Connection import ConnectionListener, connection from time import sleep from pygame.locals import * #Create a new class to hold our game object #This extends the connection listener so that we can pump the server for messages class OnlineGame(ConnectionListener): #Constructor d...
import pygame from PodSixNet.Connection import ConnectionListener, connection from time import sleep from pygame.locals import * #Create a new class to hold our game object #This extends the connection listener so that we can pump the server for messages class OnlineGame(ConnectionListener): #Constructor d...
Python
0.000001
95eeefa9b8cf7decd51265eaf624ff4551ac6a15
add feature to create a new app from command line, remove commands that are not implemented
glim.py
glim.py
from termcolor import colored from glim.app import start as appify # glim with use of click import click import shutil, errno import os @click.group() def glim(): pass @click.command() @click.option('--host', default = '127.0.0.1', help = 'enter ip') @click.option('--port', default = '8080', help = 'enter port') ...
from termcolor import colored from glim.app import start as appify # glim with use of click import click @click.group() def glim(): pass @click.command() @click.option('--host', default = '127.0.0.1', help = 'enter ip') @click.option('--port', default = '8080', help = 'enter port') @click.option('--env', default ...
Python
0
fc7d83eda95aa20f0782644cd4076a51e60cc46d
Remove unused properties from models.isolate.Isolate.
dashboard/dashboard/pinpoint/models/isolate.py
dashboard/dashboard/pinpoint/models/isolate.py
# Copyright 2016 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. """Model for storing information to look up isolates. An isolate is a way to describe the dependencies of a specific build. More about isolates: https://gi...
# Copyright 2016 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. """Model for storing information to look up isolates. An isolate is a way to describe the dependencies of a specific build. More about isolates: https://gi...
Python
0
fa3ac19213664f7281bc7b84ddf8734f6c58c57c
Changing output to be scraper specific
dat/RecipesScraper/RecipesScraper/pipelines.py
dat/RecipesScraper/RecipesScraper/pipelines.py
# -*- coding: utf-8 -*- from scrapy.exporters import JsonLinesItemExporter class JsonPipeline(object): """Save Pipeline output to JSON.""" def __init__(self, spider_name): self.file = open("output/{}_recipes.json".format(spider_name), 'wb') self.exporter = JsonLinesItemExporter(self.file, enco...
# -*- coding: utf-8 -*- from scrapy.exporters import JsonItemExporter class JsonPipeline(object): """Save Pipeline output to JSON.""" def __init__(self): self.file = open("recipes.json", 'wb') self.exporter = JsonItemExporter(self.file, encoding='utf-8', ensure_ascii=False) self.export...
Python
0.999615
85671daee9fb1ed1b9f096aa364d05da8fe55b8e
Add clipboard support
iotp.py
iotp.py
#!/usr/bin/env python # Import system libraries import base64 import json import os # Import PyPi libraries from appdirs import AppDirs import click import pyotp import pyperclip # Set app information appname = 'iotp' appauthor = 'Dan Mills' appversion = '0.0.1' # Setup appdirs dirs = AppDirs(appname, appauthor) ke...
#!/usr/bin/env python # Import system libraries import base64 import json import os # Import PyPi libraries from appdirs import AppDirs import click import pyotp # Set app information appname = 'iotp' appauthor = 'Dan Mills' appversion = '0.0.1' # Setup appdirs dirs = AppDirs(appname, appauthor) keyFile = os.path.j...
Python
0.000001
4a25286506cc8e50b5e1225b12015f4d0da3ccfc
Put api token auth endpoint under v1.
smbackend/urls.py
smbackend/urls.py
from django.conf.urls import patterns, include, url from services.api import all_views as services_views from services.api import AccessibilityRuleView from observations.api import views as observations_views from rest_framework import routers from observations.views import obtain_auth_token from munigeo.api import all...
from django.conf.urls import patterns, include, url from services.api import all_views as services_views from services.api import AccessibilityRuleView from observations.api import views as observations_views from rest_framework import routers from observations.views import obtain_auth_token from munigeo.api import all...
Python
0
94764b8daed7ef6df8ac47462013b08d30de7e8f
refactor for less ugliness, resolves #7
source/display.py
source/display.py
class Display(): def __init__(self): self.start = "Welcome" self.draw = "Draw" self.computer = "Computer Wins" self.human = "You Win" self.next_move = "What is your next move?" self.bad_move = "That is not a legal move." def show(self, text): print t...
class Display(): def __init__(self): self.start = "Welcome" self.draw = "Draw" self.computer = "Computer Wins" self.human = "You Win" self.next_move = "What is your next move?" self.bad_move = "That is not a legal move." def show(self, text): print t...
Python
0.000001
b6b99dff989fb6662f795a95895e070424f59822
Add test for login button instead of edit buttons if not logged
candidates/tests/test_person_view.py
candidates/tests/test_person_view.py
from __future__ import unicode_literals import re from django.test.utils import override_settings from django_webtest import WebTest from .dates import processors_before, processors_after from .factories import ( CandidacyExtraFactory, PersonExtraFactory ) from .uk_examples import UK2015ExamplesMixin class Tes...
# Smoke tests for viewing a candidate's page from __future__ import unicode_literals import re from django.test.utils import override_settings from django_webtest import WebTest from .dates import processors_before, processors_after from .factories import ( CandidacyExtraFactory, PersonExtraFactory ) from .uk_e...
Python
0
45c17681bfdfc374e94b086f9cdda4f314be5045
Add entries and preamble arguments to BibliographyData.__init__().
pybtex/database/__init__.py
pybtex/database/__init__.py
# Copyright (C) 2006, 2007, 2008, 2009 Andrey Golovizin # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This pr...
# Copyright (C) 2006, 2007, 2008, 2009 Andrey Golovizin # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This pr...
Python
0
296d3eff909377dcd1d4d334a843c03b00cb1bbe
add logdir to saver
examples/denoise_class/stages.py
examples/denoise_class/stages.py
import tensorflow as tf import numpy as np import os from datetime import datetime import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from flowfairy.core.stage import register, Stage from flowfairy.conf import settings log_dir = os.path.join(settings.LOG_DIR, settings.LOGNAME) @register(500) cl...
import tensorflow as tf import numpy as np import os from datetime import datetime import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from flowfairy.core.stage import register, Stage from flowfairy.conf import settings @register(500) class SummaryStage(Stage): def fig2rgb_array(self, expand=...
Python
0
581b49ad98616b7450c12be1d86960e8f38df9ac
Update lca_calculations.py
cea/optimization/lca_calculations.py
cea/optimization/lca_calculations.py
# -*- coding: utf-8 -*- """ This file imports the price details from the cost database as a class. This helps in preventing multiple importing of the corresponding values in individual files. """ from __future__ import division import warnings import pandas as pd warnings.filterwarnings("ignore") __author__ = "Sree...
# -*- coding: utf-8 -*- """ This file imports the price details from the cost database as a class. This helps in preventing multiple importing of the corresponding values in individual files. """ from __future__ import division import warnings import pandas as pd warnings.filterwarnings("ignore") __author__ = "Sree...
Python
0.000001
7d69bcc6474d954b311251bf077750e0418170cb
Fix typo and execute JS script found in local folder.
button.py
button.py
import RPi.GPIO as GPIO import time import os from optparse import OptionParser # Parse input arguments parser = OptionParser() parser.add_option("-t", "--testGPIO", action="store_true", help="Test GPIO connection, does not call the JS script.") # The option --pin sets the Input Pin for your Button # It default to G...
import RPi.GPIO as GPIO import time import os from optparse import OptionParser # Parse input arguments parser = OptionParser() parser.add_option("-t", "--testGPIO", action="store_true", help="Test GPIO connection, does not call the JS script.") # The option --pin sets the Input Pin for your Button # It default to G...
Python
0
b4ea95dc2dc1591e96d22b5058cef440416477e0
Bump version to 0.10.0b (#740)
stellargraph/version.py
stellargraph/version.py
# -*- coding: utf-8 -*- # # Copyright 2018-2020 Data61, CSIRO # # 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 applicabl...
# -*- coding: utf-8 -*- # # Copyright 2018-2020 Data61, CSIRO # # 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 applicabl...
Python
0
e4be1ad0b1bf575743280d9ae07e74efcf2530bb
Change to class
pygraphc/misc/LogCluster.py
pygraphc/misc/LogCluster.py
import datetime import hashlib import textwrap class LogCluster(object): def __init__(self, wsize, csize): self.wsize = wsize self.csize = csize self.wsketch = [] # This function logs the message given with parameter2,++,parameterN to # syslog, using the level parameter1+ The mess...
import datetime import hashlib import textwrap # This function logs the message given with parameter2,++,parameterN to # syslog, using the level parameter1+ The message is also written to stderr+ def log_msg(*parameters): level = parameters[0] msg = ' '.join(parameters[1:]) now = datetime.datetime.now() ...
Python
0.001275
221e45828b9cc33d9ae02d08d94dfaa89977d3e7
update import_reading for Courtney
vehicles/management/commands/import_reading.py
vehicles/management/commands/import_reading.py
from ciso8601 import parse_datetime from django.utils.timezone import make_aware from django.contrib.gis.geos import Point from busstops.models import Service from ...models import VehicleLocation, VehicleJourney from ..import_live_vehicles import ImportLiveVehiclesCommand class Command(ImportLiveVehiclesCommand): ...
from ciso8601 import parse_datetime from django.utils.timezone import make_aware from django.contrib.gis.geos import Point from busstops.models import Service from ...models import VehicleLocation, VehicleJourney from ..import_live_vehicles import ImportLiveVehiclesCommand class Command(ImportLiveVehiclesCommand): ...
Python
0
08b3c7fb0577ed38dea3f427ffcc8ebc1faf2ca0
Update config.py
src/dogecoinrpc/config.py
src/dogecoinrpc/config.py
# Copyright (c) 2010 Witchspace <witchspace81@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
# Copyright (c) 2010 Witchspace <witchspace81@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
Python
0
63c8f8702e042d9cb3358ba96bf453e6971ad0b2
update basemap for changes in error map from seqspace
epistasis/models/base.py
epistasis/models/base.py
__doc__ = """ Base class for epistasis models. This is meant to be called in a subclass. """ import numpy as np import itertools as it from collections import OrderedDict # imports from seqspace dependency from seqspace.utils import farthest_genotype, binary_mutations_map # Local imports from epistasis.utils import e...
__doc__ = """ Base class for epistasis models. This is meant to be called in a subclass. """ import numpy as np import itertools as it from collections import OrderedDict # imports from seqspace dependency from seqspace.utils import farthest_genotype, binary_mutations_map # Local imports from epistasis.utils import e...
Python
0
13489726a9b3f9ce9dcd2ff9c3086279db7704fe
increment build id
esp32/modules/version.py
esp32/modules/version.py
build = 8 name = "Maffe Maniak"
build = 7 name = "Maffe Maniak"
Python
0.000001
66056c97972011831fb36ce0ae37cc9bd490ddba
Swap In New Function
web/impact/impact/v1/helpers/program_helper.py
web/impact/impact/v1/helpers/program_helper.py
from impact.models import Program from impact.v1.helpers.model_helper import ( FLOAT_FIELD, INTEGER_FIELD, ModelHelper, PK_FIELD, STRING_FIELD, ) PROGRAM_FIELDS = { "id": PK_FIELD, "name": STRING_FIELD, "program_family_id": INTEGER_FIELD, "program_family_name": STRING_FIELD, "cy...
from impact.models import Program from impact.v1.helpers.model_helper import ( FLOAT_FIELD, INTEGER_FIELD, ModelHelper, PK_FIELD, STRING_FIELD, ) PROGRAM_FIELDS = { "id": PK_FIELD, "name": STRING_FIELD, "program_family_id": INTEGER_FIELD, "program_family_name": STRING_FIELD, "cy...
Python
0
0ab8381aeefc4492cce6101260d080e603357ae0
Use secretmanager v1 API instead of v1beta1
event_handler/sources.py
event_handler/sources.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0.000001
74c3095e553759b05ccc57b7c4ffd291ee9568a2
Update get_main_movies_base_data function
webs/douban/tasks/get_main_movies_base_data.py
webs/douban/tasks/get_main_movies_base_data.py
# -*- coding: utf-8 -*- import requests import gevent import models from gevent.pool import Pool from helpers import random_str, get_video_douban_ids from webs.douban import parsers from config import sqla types = ['movie', 'tv'] sorts = ['recommend', 'time', 'rank'] tags_dict = { 'tv': ['热门', '美剧', '英剧', '韩剧', ...
# -*- coding: utf-8 -*- import requests import gevent import models from gevent.pool import Pool from helpers import random_str, get_video_douban_ids from webs.douban import parsers from config import sqla types = ['movie', 'tv'] sorts = ['recommend', 'time', 'rank'] tags_dict = { 'tv': ['热门', '美剧', '英剧', '韩剧', ...
Python
0.000001
fe6d37efa59cbf222dd703a52456de2aa628fecf
Update random-pick-with-weight.py
Python/random-pick-with-weight.py
Python/random-pick-with-weight.py
# Time: O(logn) # Space: O(n) # Given an array w of positive integers, # where w[i] describes the weight of index i, # write a function pickIndex which randomly picks an index in proportion to its weight. # # Note: # # 1 <= w.length <= 10000 # 1 <= w[i] <= 10^5 # pickIndex will be called at most 10000 times. # Exampl...
# Time: O(logn) # Space: O(n) # Given an array w of positive integers, # where w[i] describes the weight of index i, # write a function pickIndex which randomly picks an index in proportion to its weight. # # Note: # # 1 <= w.length <= 10000 # 1 <= w[i] <= 10^5 # pickIndex will be called at most 10000 times. # Exampl...
Python
0
ea660e370b05cfe34dc819211b2f28992a924194
Update random-pick-with-weight.py
Python/random-pick-with-weight.py
Python/random-pick-with-weight.py
# Time: ctor: O(n) # pickIndex: O(logn) # Space: O(n) # Given an array w of positive integers, # where w[i] describes the weight of index i, # write a function pickIndex which randomly picks an index in proportion to its weight. # # Note: # # 1 <= w.length <= 10000 # 1 <= w[i] <= 10^5 # pickIndex will be calle...
# Time: O(logn) # Space: O(n) # Given an array w of positive integers, # where w[i] describes the weight of index i, # write a function pickIndex which randomly picks an index in proportion to its weight. # # Note: # # 1 <= w.length <= 10000 # 1 <= w[i] <= 10^5 # pickIndex will be called at most 10000 times. # Exampl...
Python
0
056a1b769db7f05402b41ffdcb565585db06bf97
Update top-k-frequent-elements.py
Python/top-k-frequent-elements.py
Python/top-k-frequent-elements.py
# Time: O(n) # Space: O(n) # Given a non-empty array of integers, # return the k most frequent elements. # # For example, # Given [1,1,1,2,2,3] and k = 2, return [1,2]. # # Note: # You may assume k is always valid, # 1 <= k <= number of unique elements. # Your algorithm's time complexity must be better # than O(n lo...
# Time: O(n) # Space: O(n) # Given a non-empty array of integers, # return the k most frequent elements. # # For example, # Given [1,1,1,2,2,3] and k = 2, return [1,2]. # # Note: # You may assume k is always valid, # 1 <= k <= number of unique elements. # Your algorithm's time complexity must be better # than O(n lo...
Python
0
3a156a11cd7b8a9bfc40b515a2f1d1351969ce3a
Simplify loading config for instagram middleware
me_api/middleware/instagram.py
me_api/middleware/instagram.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import os import requests from flask import Blueprint, jsonify, request, redirect from me_api.cache import cache from me_api.middleware.utils import MiddlewareConfig config = MiddlewareConfig('instagram') instagram_api = Blueprint...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import os import requests from flask import Blueprint, jsonify, request, redirect from me_api.configs import Config from me_api.cache import cache config = Config.modules['modules']['instagram'] path = config['path'] client_secret...
Python
0.000001
aeeb62f47a7211d945aafd294edb3d39d5d5cf6e
Modify error message
pytablereader/_validator.py
pytablereader/_validator.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import abc import os.path import dataproperty import pathvalidate as pv import six from six.moves.urllib.parse import urlparse from ._constant import SourceType from .error import EmptyDataError ...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import abc import os.path import dataproperty import pathvalidate as pv import six from six.moves.urllib.parse import urlparse from ._constant import SourceType from .error import EmptyDataError ...
Python
0.000001
6c095c0e14c084666b9417b4bd269f396804bfab
Update interface with the latest changes in functionality.
src/ensign/_interfaces.py
src/ensign/_interfaces.py
# pylint: skip-file from zope.interface import Attribute, Interface class IFlag(Interface): """ Flag Interface. Any kind of flag must implement this interface. """ TYPE = Attribute("""Flag type""") store = Attribute("""Flag storage backend""") name = Attribute("""Flag name""") value...
# pylint: skip-file from zope.interface import Attribute, Interface class IFlag(Interface): """ Flag Interface. Any kind of flag must implement this interface. """ TYPE = Attribute("""Flag type""") store = Attribute("""Flag storage backend""") name = Attribute("""Flag name""") value...
Python
0
4484bee2c018a4db3951193c6615a34b76880fe3
add tree migrate anonymous check
python/federatedml/protobuf/model_migrate/converter/tree_model_converter.py
python/federatedml/protobuf/model_migrate/converter/tree_model_converter.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
Python
0
a9253d6382c8eeb4261d0fc533d943046b51d109
Remove unused variable
account_tax_analysis/account_tax_analysis.py
account_tax_analysis/account_tax_analysis.py
# -*- coding: utf-8 -*- ############################################################################## # # Author Vincent Renaville. Copyright 2013-2014 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # p...
# -*- coding: utf-8 -*- ############################################################################## # # Author Vincent Renaville. Copyright 2013-2014 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # p...
Python
0.000015
c433c649a9a4b32095a170f75c7e4aae9382089b
use absolute imports
em_examples/__init__.py
em_examples/__init__.py
import .Attenuation import .BiotSavart import .CondUtils import .DC_cylinder import .DCLayers import .DCsphere import .DCWidget import .DCWidgetPlate2_5D import .DCWidgetPlate_2D import .DCWidgetResLayer2_5D import .DCWidgetResLayer2D import .DipoleWidget1D import .DipoleWidgetFD import .DipoleWidgetTD import .EMcircui...
import Attenuation import BiotSavart import CondUtils import DC_cylinder import DCLayers import DCsphere import DCWidget import DCWidgetPlate2_5D import DCWidgetPlate_2D import DCWidgetResLayer2_5D import DCWidgetResLayer2D import DipoleWidget1D import DipoleWidgetFD import DipoleWidgetTD import EMcircuit import FDEMDi...
Python
0.000146
13af44ee804508afc85711d2f0a0f4c9a09b131e
add logging to rpc connection
src/payout.py
src/payout.py
import json import socket import time from httplib import CannotSendRequest from threading import Timer from bitcoinrpc.authproxy import JSONRPCException from src import database from src.utils import get_rpc __author__ = 'sammoth' def pay(app, log): """ Pay all users who have a balance greater than the min...
import json import socket import time from httplib import CannotSendRequest from threading import Timer from bitcoinrpc.authproxy import JSONRPCException from src import database from src.utils import get_rpc __author__ = 'sammoth' def pay(app, log): """ Pay all users who have a balance greater than the min...
Python
0
881c745646f3f638527d07bd1cfab9a443950f23
add get_one method
tempoiq/protocol/row.py
tempoiq/protocol/row.py
from tempoiq.temporal.validate import convert_iso_stamp from query.selection import AndClause, Compound, OrClause, ScalarSelector class Row(object): """Data from one or more sensors at a single timestamp. Returned when reading sensor data. Example values dict of a row with a single sensor, *temperature*\...
from tempoiq.temporal.validate import convert_iso_stamp from query.selection import AndClause, Compound, OrClause, ScalarSelector class Row(object): """Data from one or more sensors at a single timestamp. Returned when reading sensor data. Example values dict of a row with a single sensor, *temperature*\...
Python
0.000002
c55e9136ee9c86dcd4088ba416043dbff7e65eac
Fix Fast.com autoupdate (#57552)
homeassistant/components/fastdotcom/__init__.py
homeassistant/components/fastdotcom/__init__.py
"""Support for testing internet speed via Fast.com.""" from __future__ import annotations from datetime import datetime, timedelta import logging from typing import Any from fastdotcom import fast_com import voluptuous as vol from homeassistant.const import CONF_SCAN_INTERVAL from homeassistant.core import HomeAssis...
"""Support for testing internet speed via Fast.com.""" from __future__ import annotations from datetime import timedelta import logging from typing import Any from fastdotcom import fast_com import voluptuous as vol from homeassistant.const import CONF_SCAN_INTERVAL from homeassistant.core import HomeAssistant, Serv...
Python
0
717db7509b586e59c06d06ad60be3ca5671e1c35
add support for circleci
src/pyquickhelper/pycode/ci_helper.py
src/pyquickhelper/pycode/ci_helper.py
""" @file @brief Helpers for CI .. versionadded:: 1.3 """ def is_travis_or_appveyor(): """ tells if is a travis environment or appveyor @return ``'travis'``, ``'appveyor'`` or ``None`` The function should rely more on environement variables ``CI``, ``TRAVIS``, ``APPVEYOR``. .. versi...
""" @file @brief Helpers for CI .. versionadded:: 1.3 """ def is_travis_or_appveyor(): """ tells if is a travis environment or appveyor @return ``'travis'``, ``'appveyor'`` or ``None`` The function should rely more on environement variables ``CI``, ``TRAVIS``, ``APPVEYOR``. .. versi...
Python
0
e6e68143e39dcc14833065b388f65879f2aa81f2
Update import export TestCase
src/tests/ggrc/converters/__init__.py
src/tests/ggrc/converters/__init__.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com from flask import json from os.path import abspath from os.path import dirname f...
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com from flask import json from os.path import abspath from os.path import dirname f...
Python
0
671e877bc14eb2034bc4ff735c56c2d3aeb2e43d
Update a test
examples/raw_parameter_script.py
examples/raw_parameter_script.py
""" The main purpose of this file is to demonstrate running SeleniumBase scripts without the use of Pytest by calling the script directly with Python or from a Python interactive interpreter. Based on whether relative imports work or don't, the script can autodetect how this file was run. With pure Pyth...
""" The main purpose of this file is to demonstrate running SeleniumBase scripts without the use of Pytest by calling the script directly with Python or from a Python interactive interpreter. Based on whether relative imports work or don't, the script can autodetect how this file was run. With pure Pyth...
Python
0.000001
870c69f6d8c0f0b9dbe60a053e839ae25283f8ba
map each step
pytest_bdd/cucumber_json.py
pytest_bdd/cucumber_json.py
"""Cucumber json output formatter.""" import os import time import json import py def pytest_addoption(parser): group = parser.getgroup('pytest-bdd') group.addoption( '--cucumberjson', '--cucumber-json', action='store', dest='cucumber_json_path', metavar='path', default=None, help='c...
"""Cucumber json output formatter.""" import os import time import json import py def pytest_addoption(parser): group = parser.getgroup('pytest-bdd') group.addoption( '--cucumberjson', '--cucumber-json', action='store', dest='cucumber_json_path', metavar='path', default=None, help='c...
Python
0.999938
7e98bf41b605c08c0cd04c9edf4479b9ac3961f8
fix import wordnet
pythainlp/corpus/wordnet.py
pythainlp/corpus/wordnet.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals,print_function,absolute_import import nltk try: nltk.data.find("corpora/omw") nltk.data.find("corpora/wordnet") except: nltk.download('wordnet') nltk.download('omw') from nltk.corpus import wordnet ''' API ตัวเก่า ''' import sqlite3 import pythainlp im...
# -*- coding: utf-8 -*- from __future__ import unicode_literals,print_function,absolute_import import nltk try: nltk.data.find("corpora/omw") except: nltk.download('wordnet') nltk.download('omw') try: from nltk.corpus import wordnet except: nltk.download('wordnet') ''' API ตัวเก่า ''' import sqlite3 import pythai...
Python
0.000005
02a3fb6e1d7bde7b9f9d20089e8dd11040388e80
remove testing code
python/app/extract_stats.py
python/app/extract_stats.py
# Copyright (C) 2014 Matthieu Caneill <matthieu.caneill@gmail.com> # # This file is part of Debsources. # # Debsources 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, o...
# Copyright (C) 2014 Matthieu Caneill <matthieu.caneill@gmail.com> # # This file is part of Debsources. # # Debsources 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, o...
Python
0.000021
e2fb56d315a08de736d6fcf5d3cf9cb19b5cba75
check Available; add --no-clean option
cclint.py
cclint.py
#!/usr/bin/env python """ Detects problems in data exported from CoreCommerce. """ import ConfigParser import cctools import optparse import sys def check_string(type_name, item_name, item, key, min_len): """Print message if item[key] is empty or shorter than min_len.""" value_len = len(item[key]) if val...
#!/usr/bin/env python """ Detects problems in data exported from CoreCommerce. """ import ConfigParser import cctools import optparse import sys def check_string(type_name, item_name, item, key, min_len): """Print message if item[key] is empty or shorter than min_len.""" value_len = len(item[key]) if val...
Python
0
510a15371cdbb635bc4691eae6fad8070b582814
Support for Pandoc-style code blocks (http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html) and code span elements (http://daringfireball.net/projects/markdown/syntax#code), which should not be rendered to LaTeX
MarkdownPP/Modules/LaTeXRender.py
MarkdownPP/Modules/LaTeXRender.py
# Copyright (C) 2012 Alex Nisnevich # Licensed under the MIT license import re import httplib, urllib from MarkdownPP.Module import Module from MarkdownPP.Transform import Transform singlelinere = re.compile("\$(\$?)..*\$(\$?)") # $...$ (or $$...$$) startorendre = re.compile("^\$(\$?)|^\S.*\$(\$?)$") # $... or ...$ ...
# Copyright (C) 2012 Alex Nisnevich # Licensed under the MIT license import re import httplib, urllib from MarkdownPP.Module import Module from MarkdownPP.Transform import Transform singlelinere = re.compile("\$(\$?)..*\$(\$?)") # $...$ (or $$...$$) startorendre = re.compile("^\$(\$?)|^\S.*\$(\$?)$") # $... or ...$ ...
Python
0
adfb7518b47c36396c14a513f547fd5055a29883
add bootstrap3
MobileFoodOrderServer/settings.py
MobileFoodOrderServer/settings.py
""" Django settings for MobileFoodOrderServer project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BAS...
""" Django settings for MobileFoodOrderServer project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BAS...
Python
0.000001
47316dcb10d8eaa8be2ee7d9a0b5fcb2d4b562a6
Fix Nonetype due to un-materialized runtime (#2389)
python/taichi/aot/module.py
python/taichi/aot/module.py
from taichi.lang import impl, kernel_arguments, kernel_impl class Module: """An AOT module to save and load Taichi kernels. This module serializes the Taichi kernels for a specific arch. The serialized module can later be loaded to run on that backend, without the Python environment. Example:: ...
from taichi.lang import impl, kernel_arguments, kernel_impl class Module: """An AOT module to save and load Taichi kernels. This module serializes the Taichi kernels for a specific arch. The serialized module can later be loaded to run on that backend, without the Python environment. Example:: ...
Python
0
d06fa1c8bfa5c782a5c28403caf44736620a3706
add get_instruction method modified: qaamus/test_angka_parser.py
qaamus/test_angka_parser.py
qaamus/test_angka_parser.py
import unittest from bs4 import BeautifulSoup from ind_ara_parser import BaseParser class AngkaParser(BaseParser): """Handle terjemah angka page.""" def get_instruction(self): """Return the instruction text. text is returning 'Terjemah angka adalah menterjemahkan angka kedalam bahasa ...
import unittest from bs4 import BeautifulSoup from ind_ara_parser import BaseParser class AngkaParser(BaseParser): pass class AngkaParserTestCase(unittest.TestCase): with open("../html/angka123", "rb") as f: f = f.read() soup = BeautifulSoup(f) def setUp(self): self.angka_parser = A...
Python
0.000012
8bd3ada2fca7ab507dce90c410662b7d173eb743
add RconConnection class
srcds/rcon.py
srcds/rcon.py
# Copyright (C) 2013 Peter Rowlands """Source server RCON communications module""" from __future__ import division, absolute_import import struct import socket import itertools # Packet types SERVERDATA_AUTH = 3 SERVERDATA_AUTH_RESPONSE = 2 SERVERDATA_EXECCOMMAND = 2 SERVERDATA_RESPONSE_VALUE = 0 class RconPacket...
# Copyright (C) 2013 Peter Rowlands # # Constants and packet formats taken from # https://developer.valvesoftware.com/wiki/Source_RCON_Protocol # as of Jan 4 2013 """Source server RCON communications module""" from __future__ import division, absolute_import import struct # Packet types SERVERDATA_AUTH = 3 SERVERDA...
Python
0
6509a1c1e9ee92841378d0b6f546ebf64991bbea
add xyz to exportable formats
stltovoxel.py
stltovoxel.py
import argparse from PIL import Image import numpy as np import os.path import slice import stl_reader import perimeter from util import arrayToPixel def doExport(inputFilePath, outputFilePath, resolution): mesh = list(stl_reader.read_stl_verticies(inputFilePath)) (scale, shift, bounding_box) = slice.calcula...
import argparse from PIL import Image import numpy as np import os.path import slice import stl_reader import perimeter from util import arrayToPixel def doExport(inputFilePath, outputFilePath, resolution): mesh = list(stl_reader.read_stl_verticies(inputFilePath)) (scale, shift, bounding_box) = slice.calcula...
Python
0.000001
21f53bee1bfba8ef82b82898693c2cc09a7873c7
add get_weight() to Keras interface
syft/interfaces/keras/models/sequential.py
syft/interfaces/keras/models/sequential.py
import syft import syft.nn as nn import sys from syft.interfaces.keras.layers import Log class Sequential(object): def __init__(self): self.syft = nn.Sequential() self.layers = list() self.compiled = False def add(self, layer): if(len(self.layers) > 0): # look to the previous layer to get the input sh...
import syft import syft.nn as nn import sys from syft.interfaces.keras.layers import Log class Sequential(object): def __init__(self): self.syft = nn.Sequential() self.layers = list() self.compiled = False def add(self, layer): if(len(self.layers) > 0): # look to the previous layer to get the input sh...
Python
0
8299b323eee11dbfebb7c97bfcd16281b874be1d
add release endpoints for /thirdparty
synapse/rest/client/v2_alpha/thirdparty.py
synapse/rest/client/v2_alpha/thirdparty.py
# -*- coding: utf-8 -*- # Copyright 2015, 2016 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# -*- coding: utf-8 -*- # Copyright 2015, 2016 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Python
0
29c59225c04760e4670f63eee5ed15a910a8f7ec
test update added new parameter to experiment()
tests/texture_features_experiments_test.py
tests/texture_features_experiments_test.py
#! /usr/bin/python # -*- coding: utf-8 -*- # import funkcí z jiného adresáře import sys import os.path import logging path_to_script = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(path_to_script, "../experiments/")) sys.path.append(os.path.join(path_to_script, "../extern/py3DSeedEditor/")) ...
#! /usr/bin/python # -*- coding: utf-8 -*- # import funkcí z jiného adresáře import sys import os.path import logging path_to_script = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(path_to_script, "../experiments/")) sys.path.append(os.path.join(path_to_script, "../extern/py3DSeedEditor/")) ...
Python
0
cb0ba85a56c163436d6a4180413f0228407458d8
Correct path specification error
tests/workflows/test_component_wrappers.py
tests/workflows/test_component_wrappers.py
""" Unit tests for json helpers """ import os import unittest from data_models.parameters import arl_path from workflows.wrappers.component_wrapper import component_wrapper class TestComponentWrappers(unittest.TestCase): def test_run_components(self): files = ["test_results/test_pipeline.log", ...
""" Unit tests for json helpers """ import os import unittest from data_models.parameters import arl_path from workflows.wrappers.component_wrapper import component_wrapper class TestComponentWrappers(unittest.TestCase): def test_run_components(self): files = ["test_results/test_pipeline.log", ...
Python
0.000001
f535228e38f33263289f28d46e910ccb0a98a381
Use list comprehension to evaluate PYTZ_TIME_ZONE_CHOICES
tournamentcontrol/competition/constants.py
tournamentcontrol/competition/constants.py
import pytz from dateutil.rrule import DAILY, WEEKLY from django.utils.translation import ugettext_lazy as _ GENDER_CHOICES = ( ('M', _('Male')), ('F', _('Female')), ('X', _('Unspecified')), ) SEASON_MODE_CHOICES = ( (WEEKLY, _("Season")), (DAILY, _("Tournament")), ) WIN_LOSE = { 'W': _("Winn...
import pytz from dateutil.rrule import DAILY, WEEKLY from django.utils.translation import ugettext_lazy as _ GENDER_CHOICES = ( ('M', _('Male')), ('F', _('Female')), ('X', _('Unspecified')), ) SEASON_MODE_CHOICES = ( (WEEKLY, _("Season")), (DAILY, _("Tournament")), ) WIN_LOSE = { 'W': _("Winn...
Python
0
d0e8d8d9e6e029f0af5dd50e507565fb67bf90b1
update example script
ucscsession/scripts/ucscsession_example.py
ucscsession/scripts/ucscsession_example.py
import webbrowser from ucscsession import UCSCSession import pybedtools # ----------------------------------------------------------------------------- # Note: most methods return a requests.Response object # ----------------------------------------------------------------------------- # ---------------------------...
import webbrowser from ucscsession import UCSCSession import pybedtools # Begin a session. u = UCSCSession() # Demonstration of uploading custom tracks; this uses example data from # pybedtools. for fn in ['a.bed', 'b.bed']: x = pybedtools.example_bedtool(fn)\ .saveas(trackline='track name=%s' % fn) r...
Python
0
998feb0e9684c05240d1370085e7b83e4f9dd776
Fix encoding problem when parsing cairo repository
utils/mkconstants.py
utils/mkconstants.py
# coding: utf-8 import os import sys import re import pycparser.c_generator def parse_constant(node): if isinstance(node, pycparser.c_ast.Constant): return node.value elif isinstance(node, pycparser.c_ast.UnaryOp) and node.op == '-': return '-' + parse_constant(node.expr) else: rai...
# coding: utf-8 import os import sys import re import pycparser.c_generator def parse_constant(node): if isinstance(node, pycparser.c_ast.Constant): return node.value elif isinstance(node, pycparser.c_ast.UnaryOp) and node.op == '-': return '-' + parse_constant(node.expr) else: rai...
Python
0.000189
c8ecbda2b8c4d1a03285527dd11a27db74f746e7
change IdP configuration order, enabled first
openedx/core/djangoapps/appsembler/tpa_admin/api.py
openedx/core/djangoapps/appsembler/tpa_admin/api.py
from rest_framework import generics, viewsets from rest_framework.permissions import IsAuthenticated from openedx.core.djangoapps.appsembler.sites.permissions import AMCAdminPermission from openedx.core.lib.api.authentication import ( OAuth2AuthenticationAllowInactiveUser, ) from third_party_auth.models import SAM...
from rest_framework import generics, viewsets from rest_framework.permissions import IsAuthenticated from openedx.core.djangoapps.appsembler.sites.permissions import AMCAdminPermission from openedx.core.lib.api.authentication import ( OAuth2AuthenticationAllowInactiveUser, ) from third_party_auth.models import SAM...
Python
0
67a0bab4da1d31aba150ce5cb7831daaea1523de
Increase BQ_DEFAULT_TABLE_EXPIRATION_MS in e2etest settings
openprescribing/openprescribing/settings/e2etest.py
openprescribing/openprescribing/settings/e2etest.py
from __future__ import absolute_import from .test import * DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': utils.get_env_setting('E2E_DB_NAME'), 'USER': utils.get_env_setting('DB_USER'), 'PASSWORD': utils.get_env_setting('DB_PASS'), 'HO...
from __future__ import absolute_import from .test import * DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': utils.get_env_setting('E2E_DB_NAME'), 'USER': utils.get_env_setting('DB_USER'), 'PASSWORD': utils.get_env_setting('DB_PASS'), 'HO...
Python
0.000001
2660096db01f88cd0e71860935862fe969204666
Fix a script missed in refactor
paasta_tools/contrib/check_registered_slaves_aws.py
paasta_tools/contrib/check_registered_slaves_aws.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import unicode_literals import argparse import sys from paasta_tools.autoscaling.autoscaling_cluster_lib import get_scaler from paasta_tools.mesos_tools import get_mesos_master from paasta_tools.utils import load_system_paasta_config def c...
#!/usr/bin/env python from __future__ import absolute_import from __future__ import unicode_literals import argparse import sys from paasta_tools.autoscaling.autoscaling_cluster_lib import get_sfr from paasta_tools.autoscaling.autoscaling_cluster_lib import get_sfr_slaves from paasta_tools.autoscaling.autoscaling_clu...
Python
0.00003
e1cf1e0f2cdfd98d47d47a222511127cfee63610
fix config test
corehq/sql_db/tests/test_partition_config.py
corehq/sql_db/tests/test_partition_config.py
from django.test import SimpleTestCase from django.test.utils import override_settings from corehq.sql_db.management.commands.configure_pl_proxy_cluster import get_pl_proxy_server_config_sql, \ get_shard_config_strings from ..config import PartitionConfig from ..exceptions import PartitionValidationError TEST_PAR...
from django.test import SimpleTestCase from django.test.utils import override_settings from corehq.sql_db.management.commands.configure_pl_proxy_cluster import get_pl_proxy_server_config_sql, \ get_shard_config_strings from ..config import PartitionConfig from ..exceptions import PartitionValidationError TEST_PAR...
Python
0.000002
cad9bf433d0fadd8fff27194be9d7a5428b58ae4
missing path
src/plone.server/setup.py
src/plone.server/setup.py
# -*- coding: utf-8 -*- from setuptools import find_packages from setuptools import setup from distutils.core import Extension import os import sys import platform py_impl = getattr(platform, 'python_implementation', lambda: None) pure_python = os.environ.get('PURE_PYTHON', False) is_pypy = py_impl() == 'PyPy' is_jyt...
# -*- coding: utf-8 -*- from setuptools import find_packages from setuptools import setup from distutils.core import Extension import os import sys import platform py_impl = getattr(platform, 'python_implementation', lambda: None) pure_python = os.environ.get('PURE_PYTHON', False) is_pypy = py_impl() == 'PyPy' is_jyt...
Python
0.999092
d406cf8f4812fce7314f10d3a4b1303d54230099
Remove unused import.
src/pyhmsa/util/signal.py
src/pyhmsa/util/signal.py
#!/usr/bin/env python """ ================================================================================ :mod:`signal` -- Signal pattern ================================================================================ .. module:: signal :synopsis: signal pattern .. inheritance-diagram:: pyhmsa.util.signal """ ...
#!/usr/bin/env python """ ================================================================================ :mod:`signal` -- Signal pattern ================================================================================ .. module:: signal :synopsis: signal pattern .. inheritance-diagram:: pyhmsa.util.signal """ ...
Python
0
ac2fc5dbd75d7a897473c4da06875d1b10783bcc
return after getting DatabaseError
src/sentry/utils/raven.py
src/sentry/utils/raven.py
from __future__ import absolute_import, print_function import inspect import logging import raven import sentry from django.conf import settings from django.db.utils import DatabaseError from raven.contrib.django.client import DjangoClient from . import metrics UNSAFE_FILES = ( 'sentry/event_manager.py', 's...
from __future__ import absolute_import, print_function import inspect import logging import raven import sentry from django.conf import settings from django.db.utils import DatabaseError from raven.contrib.django.client import DjangoClient from . import metrics UNSAFE_FILES = ( 'sentry/event_manager.py', 's...
Python
0.000005
779cfb477aca1882c6cb1f34fbb2e66a320be037
Implement subscribe, and parse methods in SNS
sns.py
sns.py
from tornado.httpclient import AsyncHTTPClient, HTTPClient from tornado.httputil import url_concat from lxml import objectify from core import AWSRequest class SNS(object): def __init__(self, access_key, secret_key, region, async=True): self.region = region self.__access_key = access_key s...
#!/usr/bin/env python from tornado.httpclient import AsyncHTTPClient from tornado.httputil import url_concat from core import AWSRequest class SNS(object): def __init__(self, access_key, secret_key, region): self.region = region self.__access_key = access_key self.__secret_key = secret_ke...
Python
0
50d65e246f451b1ecaaa683f5b65d34fbaf6905e
(chore) remove blanks
photo_editor/settings/development.py
photo_editor/settings/development.py
# -*- coding: utf-8 -*- from django_envie.workroom import convertfiletovars convertfiletovars() from .base import * DEBUG = True INSTALLED_APPS += ('django_nose',) TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' NOSE_ARGS = [ '--with-coverage', ]
# -*- coding: utf-8 -*- from django_envie.workroom import convertfiletovars convertfiletovars() from .base import * DEBUG = True INSTALLED_APPS += ('django_nose',) TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' NOSE_ARGS = [ '--with-coverage', ]
Python
0.999999
2180d9ef6d9af45c80fdc89cd64b90df2924c8a7
Fix comment in stepwise (follow up to #5555) [skip ci] (#5560)
src/_pytest/stepwise.py
src/_pytest/stepwise.py
import pytest def pytest_addoption(parser): group = parser.getgroup("general") group.addoption( "--sw", "--stepwise", action="store_true", dest="stepwise", help="exit on test failure and continue from last failing test next time", ) group.addoption( "--s...
import pytest def pytest_addoption(parser): group = parser.getgroup("general") group.addoption( "--sw", "--stepwise", action="store_true", dest="stepwise", help="exit on test failure and continue from last failing test next time", ) group.addoption( "--s...
Python
0
9a5135f9cd27cf24d27b2393fd071073b4485ac7
add test gat_plot_slice
mne/viz/tests/test_decoding.py
mne/viz/tests/test_decoding.py
# Authors: Denis Engemann <denis.engemann@gmail.com> # # License: Simplified BSD import os.path as op import warnings from nose.tools import assert_raises from mne.decoding import GeneralizationAcrossTime from mne import io, Epochs, read_events, pick_types from mne.utils import requires_sklearn, run_tests_if_main im...
# Authors: Denis Engemann <denis.engemann@gmail.com> # # License: Simplified BSD import os.path as op import warnings from nose.tools import assert_raises from mne.decoding import GeneralizationAcrossTime from mne import io, Epochs, read_events, pick_types from mne.utils import requires_sklearn, run_tests_if_main im...
Python
0.000012
476d7da17c7d22415cbd16b625ba8e443a750f0f
update change_upstream_proxy example
examples/change_upstream_proxy.py
examples/change_upstream_proxy.py
# This scripts demonstrates how mitmproxy can switch to a second/different upstream proxy # in upstream proxy mode. # # Usage: mitmdump -U http://default-upstream-proxy.local:8080/ -s "change_upstream_proxy.py host" from libmproxy.protocol.http import send_connect_request alternative_upstream_proxy = ("localhost", 808...
# This scripts demonstrates how mitmproxy can switch to a different upstream proxy # in upstream proxy mode. # # Usage: mitmdump -s "change_upstream_proxy.py host" from libmproxy.protocol.http import send_connect_request alternative_upstream_proxy = ("localhost", 8082) def should_redirect(flow): return flow.reques...
Python
0.000001
0bc9ba5d9f15b443e5af53cb1e1a593446874bbe
put monkapi exits in Site's shutdown
monk/roles/executor_service.py
monk/roles/executor_service.py
# -*- coding: utf-8 -*- """ Created on Sat Apr 19 16:20:55 2014 @author: pacif_000 """ import os import simplejson import logging from bson.objectid import ObjectId from twisted.web import server from twisted.internet import reactor from deffered_resource import DefferedResource import monk.core.api as monkapi import...
# -*- coding: utf-8 -*- """ Created on Sat Apr 19 16:20:55 2014 @author: pacif_000 """ import os import simplejson import logging from bson.objectid import ObjectId from twisted.web import server from twisted.internet import reactor from deffered_resource import DefferedResource import monk.core.api as monkapi import...
Python
0
acef3b83c265078b69061de0054317a31c7a91d0
Fix permission check on exportdb widget (#3906)
bluebottle/bluebottle_dashboard/dashboard.py
bluebottle/bluebottle_dashboard/dashboard.py
import importlib from django.urls.base import reverse, reverse_lazy from django.utils.timezone import now from django.utils.translation import ugettext_lazy as _ from jet.dashboard import modules from jet.dashboard.dashboard import Dashboard, DefaultAppIndexDashboard from jet.dashboard.modules import DashboardModule, ...
import importlib from django.urls.base import reverse, reverse_lazy from django.utils.timezone import now from django.utils.translation import ugettext_lazy as _ from jet.dashboard import modules from jet.dashboard.dashboard import Dashboard, DefaultAppIndexDashboard from jet.dashboard.modules import DashboardModule, ...
Python
0
28915d22eec7f47b3f393429fb63df55a4c43e43
Update form
readthedocs/builds/forms.py
readthedocs/builds/forms.py
"""Django forms for the builds app.""" import re from django import forms from django.utils.translation import ugettext_lazy as _ from readthedocs.builds.constants import ( ALL_VERSIONS, BRANCH, BRANCH_TEXT, TAG, TAG_TEXT, ) from readthedocs.builds.models import RegexAutomationRule, Version from ...
"""Django forms for the builds app.""" import re from django import forms from django.utils.translation import ugettext_lazy as _ from readthedocs.builds.constants import BRANCH, BRANCH_TEXT, TAG, TAG_TEXT from readthedocs.builds.models import RegexAutomationRule, Version from readthedocs.core.mixins import HideProt...
Python
0
5af79b94c6f1b0117e229db23811d3e1c58ff3fa
Add password encrpytion and try to fix mailgun again
config.py
config.py
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): DEBUG = False TESTING = False SECRET_KEY = 'this_is_so_secret' #used for development, reset in prod SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_MIGRATE_REPO = os.path.join(b...
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): DEBUG = False TESTING = False SECRET_KEY = 'this_is_so_secret' #used for development, reset in prod SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_MIGRATE_REPO = os.path.join(b...
Python
0
a10967f6c4d52cac1cf263d2415b1154ecd40745
Remove console level logging in test
test/test_summariser.py
test/test_summariser.py
"""This file contains the BinSummariserTest class.""" import os import shutil import tempfile import unittest from bin import summariser class BinSummariserTest(unittest.TestCase): """A class to test the bin/summariser.py file.""" def setUp(self): """Create tempory config files and populate the db ...
"""This file contains the BinSummariserTest class.""" import os import shutil import tempfile import unittest from bin import summariser class BinSummariserTest(unittest.TestCase): """A class to test the bin/summariser.py file.""" def setUp(self): """Create tempory config files and populate the db ...
Python
0.000002
cdbf0f2c82360c866d8c26f2d8a9539fa943df6b
Bump version 1.0.0.
rpm_py_installer/version.py
rpm_py_installer/version.py
"""Version string.""" # main = X.Y.Z # sub = .devN for pre-alpha releases VERSION = '1.0.0'
"""Version string.""" # main = X.Y.Z # sub = .devN for pre-alpha releases VERSION = '0.9.2'
Python
0
9b5c1892dd4731df564d627ae9dafe95bd82b6a9
Bump version 0.7.1.
rpm_py_installer/version.py
rpm_py_installer/version.py
"""Version string.""" # main = X.Y.Z # sub = .devN for pre-alpha releases VERSION = '0.7.1'
"""Version string.""" # main = X.Y.Z # sub = .devN for pre-alpha releases VERSION = '0.7.0'
Python
0
2d2513ce860503a7ab69e56f47998ca075efaa3b
Add new production hosts
rtei/settings/production.py
rtei/settings/production.py
import sys from .base import * DEBUG = False # Update database configuration with $DATABASE_URL. import dj_database_url db_from_env = dj_database_url.config() DATABASES['default'].update(db_from_env) SECRET_KEY = os.environ.get('SECRET_KEY') # AWS S3 settings DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3Boto...
import sys from .base import * DEBUG = False # Update database configuration with $DATABASE_URL. import dj_database_url db_from_env = dj_database_url.config() DATABASES['default'].update(db_from_env) SECRET_KEY = os.environ.get('SECRET_KEY') # AWS S3 settings DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3Boto...
Python
0
6d8f5e3cd6d2c2997b53121b55bd5da3114ab517
Use the same function for multiple purposes
salt/modules/nagios_json.py
salt/modules/nagios_json.py
# -*- coding: utf-8 -*- ''' Check Host & Service status from Nagios via JSON RPC. .. versionadded:: Beryllium ''' # Import python libs from __future__ import absolute_import import logging import httplib # Import 3rd-party libs # pylint: disable=import-error,no-name-in-module,redefined-builtin from salt.ext.six.mov...
# -*- coding: utf-8 -*- ''' Check Host & Service status from Nagios via JSON RPC. .. versionadded:: Beryllium ''' # Import python libs from __future__ import absolute_import import logging import httplib # Import 3rd-party libs # pylint: disable=import-error,no-name-in-module,redefined-builtin from salt.ext.six.mov...
Python
0.000029
1df00cb6adf8b9cac677f5f6a272331ab5388c90
Update main.py
vkfeed/pages/main.py
vkfeed/pages/main.py
# -*- coding: utf-8 -*- '''Generates the main page.''' from __future__ import unicode_literals import re import urllib import webapp2 import vkfeed.utils class MainPage(webapp2.RequestHandler): '''Generates the main page.''' def get(self): '''Processes a GET request.''' self.response.h...
# -*- coding: utf-8 -*- '''Generates the main page.''' from __future__ import unicode_literals import re import urllib import webapp2 import RSSvk.utils class MainPage(webapp2.RequestHandler): '''Generates the main page.''' def get(self): '''Processes a GET request.''' self.response.he...
Python
0.000001
4b5e8dc1808d1a6107545d486b4097482d07635c
Add dataum_to_img method for pascal dataset
fcn/pascal.py
fcn/pascal.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import cPickle as pickle import os.path as osp import numpy as np from scipy.misc import imread from sklearn.datasets.base import Bunch import plyvel import fcn class SegmentationClassDataset(Bunch): ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import cPickle as pickle import os.path as osp import numpy as np from scipy.misc import imread from sklearn.datasets.base import Bunch import plyvel import fcn class SegmentationClassDataset(Bunch): ...
Python
0
15129d5cc4c3a4981a41bebbfc6ace855004cd20
Add organizational structure.
students/psbriant/session08/circle.py
students/psbriant/session08/circle.py
""" Name: Paul Briant Date: 11/29/16 Class: Introduction to Python Session: 08 Assignment: Circle Lab Description: Classes for Circle Lab """ class Circle: def __init__(self, radius): """ """ self.radius = radius self.diameter = radius * 2 @classmethod def from_...
class Circle: def __init__(self, radius): """ """ self.radius = radius self.diameter = radius * 2 @classmethod def from_diameter(cls, diameter): self = cls(diameter / 2) return self def __str__(self): return "A circle ob...
Python
0.000085
c79723b179b0bfeda9b324139d8478bf4f24c1e5
add unicode char to test print
Lib/glyphNameFormatter/test.py
Lib/glyphNameFormatter/test.py
def printRange(rangeName): from glyphNameFormatter import GlyphName from glyphNameFormatter.unicodeRangeNames import getRangeByName from glyphNameFormatter.data import unicode2name_AGD for u in range(*getRangeByName(rangeName)): g = GlyphName(uniNumber=u) name = g.getName() if...
def printRange(rangeName): from glyphNameFormatter import GlyphName from glyphNameFormatter.unicodeRangeNames import getRangeByName from glyphNameFormatter.data import unicode2name_AGD for u in range(*getRangeByName(rangeName)): g = GlyphName(uniNumber=u) name = g.getName() if...
Python
0.000002
7be409211181bed5d38bde3be0b6c3d892c9cb29
Fix patch key error and remove print statements
frappe/patches/v11_0/remove_skip_for_doctype.py
frappe/patches/v11_0/remove_skip_for_doctype.py
import frappe from frappe.desk.form.linked_with import get_linked_doctypes from frappe.patches.v11_0.replicate_old_user_permissions import get_doctypes_to_skip # `skip_for_doctype` was a un-normalized way of storing for which # doctypes the user permission was applicable. # in this patch, we normalize this into `appli...
import frappe from frappe.desk.form.linked_with import get_linked_doctypes from frappe.patches.v11_0.replicate_old_user_permissions import get_doctypes_to_skip # `skip_for_doctype` was a un-normalized way of storing for which # doctypes the user permission was applicable. # in this patch, we normalize this into `appli...
Python
0.000001
c09274936df73668afd14ccac6d7f7c322d5e8b8
Add naive logging in Main.py
Main.py
Main.py
"""Main Module of PDF Splitter""" import argparse import logging import os from PyPDF2 import PdfFileWriter from Util import all_pdf_files_in_directory, split_on, concat_pdf_pages, is_landscape, write_pdf_file parser = \ argparse.ArgumentParser( description='Split all the pages of multiple PDF files in a...
"""Main Module of PDF Splitter""" import argparse import os from PyPDF2 import PdfFileWriter from Util import all_pdf_files_in_directory, split_on, concat_pdf_pages, is_landscape, write_pdf_file parser = \ argparse.ArgumentParser( description='Split all the pages of multiple PDF files in a directory by d...
Python
0.000001
35c3fa719b57186a63bdf1110e76fc78b620c818
order presentations
pyconca2017/pycon_schedule/models.py
pyconca2017/pycon_schedule/models.py
from datetime import datetime from django.db import models """ Presentation """ class Speaker(models.Model): """ Who """ email = models.EmailField(unique=True) full_name = models.CharField(max_length=255) bio = models.TextField(default='') twitter_username = models.CharField(max_length=255, nul...
from datetime import datetime from django.db import models """ Presentation """ class Speaker(models.Model): """ Who """ email = models.EmailField(unique=True) full_name = models.CharField(max_length=255) bio = models.TextField(default='') twitter_username = models.CharField(max_length=255, nul...
Python
0.000001
6d4038653bf237a285f99e68288454ce9ebdfc92
Add allowed hosts
cinderella/cinderella/settings/production.py
cinderella/cinderella/settings/production.py
from .base import * DEBUG = False ALLOWED_HOSTS = ['188.226.249.33', 'cinderella.li'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': os.environ['DB_NAME'], 'USER': os.environ['DB_USER'], 'PASSWORD': os.environ['DB_PASSWORD'], 'HOST':...
from .base import * DEBUG = False ALLOWED_HOSTS = ['cinderella.io'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': os.environ['DB_NAME'], 'USER': os.environ['DB_USER'], 'PASSWORD': os.environ['DB_PASSWORD'], 'HOST': '127.0.0.1', ...
Python
0
c0787c468e1b71d7e9db93b5f5990ae9bb506d82
FIX other two sample data load for Windows
pystruct/datasets/dataset_loaders.py
pystruct/datasets/dataset_loaders.py
import cPickle from os.path import dirname from os.path import join import numpy as np def load_letters(): """Load the OCR letters dataset. This is a chain classification task. Each example consists of a word, segmented into letters. The first letter of each word is ommited from the data, as it ...
import cPickle from os.path import dirname from os.path import join import numpy as np def load_letters(): """Load the OCR letters dataset. This is a chain classification task. Each example consists of a word, segmented into letters. The first letter of each word is ommited from the data, as it ...
Python
0
19a9465424400ca1a194e5516c44ca77a0f5591a
add Alpha Vantage API key to config file
moneywatch/moneywatchconfig.py
moneywatch/moneywatchconfig.py
#!/usr/bin/python #=============================================================================== # Copyright (c) 2016, James Ottinger. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # MoneyWatch - https://github.com/jamesottinger/moneywatch...
#!/usr/bin/python #=============================================================================== # Copyright (c) 2016, James Ottinger. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # MoneyWatch - https://github.com/jamesottinger/moneywatch...
Python
0
87a14ba6b2a2fff0ab80ff204119795a8e4173f8
Update mongodb_atlas.py
mongodb_atlas/mongodb_atlas.py
mongodb_atlas/mongodb_atlas.py
#!/usr/bin/python import json import urllib import urllib.request as urlconnection from urllib.error import URLError, HTTPError from urllib.request import ProxyHandler plugin_version = 1 heartbeat_required = "true" resultjson={} metrics_units={ "disksize":"GB" } public_key = "" private_key = "" group_id= ""...
#!/usr/bin/python import json import urllib import urllib.request as urlconnection from urllib.error import URLError, HTTPError from urllib.request import ProxyHandler plugin_version = 1 heartbeat_required = "true" resultjson={} metrics_units={ "disksize":"GB" } public_key = "" private_key = "" group_id= ""...
Python
0.000001
04c67e99af363cd8eea4414f59a9294a84faaa6d
Fix test layout
tests/api/test_views.py
tests/api/test_views.py
# -*- coding: utf-8 -*- import httpretty import json from django.test import TestCase from django.utils.encoding import smart_str from bakery.auth.models import BakeryUser from bakery.cookies.models import Cookie from bakery.utils.test import read class TestApi(TestCase): def test_cookies_list_empty(self): ...
# -*- coding: utf-8 -*- import json from django.test import TestCase from django.utils.encoding import smart_str from bakery.auth.models import BakeryUser from bakery.cookies.models import Cookie from bakery.utils.test import read import httpretty class TestApi(TestCase): def test_cookies_list_empty(self): ...
Python
0.000001
6940035d7827a6a2aa719e537f122c07a91bd7c1
support werkzeug==1.0.0
tests/apps/multi/app.py
tests/apps/multi/app.py
import os from flask import Flask, render_template try: from werkzeug.wsgi import SharedDataMiddleware except ImportError: from werkzeug.middleware.shared_data import SharedDataMiddleware app = Flask(__name__) @app.route('/') def hello_world(): return render_template('index.html') app.wsgi_app = SharedDa...
import os from flask import Flask, render_template from werkzeug.wsgi import SharedDataMiddleware app = Flask(__name__) @app.route('/') def hello_world(): return render_template('index.html') app.wsgi_app = SharedDataMiddleware(app.wsgi_app, { '/': os.path.join(os.path.dirname(__file__), 'static') }) app.wsgi_ap...
Python
0.000028
d45bbe102efec23656d1329b5c3e6a785c69acee
switch base test cases of pickle backend from tests.backend.ini to tests.backend.common
tests/backend/pickle.py
tests/backend/pickle.py
# # Copyright (C) 2017 Satoru SATOH <ssato @ redhat.com> # Copyright (C) 2017 Red Hat, Inc. # License: MIT # # pylint: disable=missing-docstring,invalid-name,too-few-public-methods from __future__ import absolute_import import anyconfig.backend.pickle as TT import tests.backend.common as TBC class HasParserTrait(TBC...
# # Copyright (C) 2017 Satoru SATOH <ssato @ redhat.com> # License: MIT # # pylint: disable=missing-docstring from __future__ import absolute_import try: import anyconfig.backend.pickle as TT except ImportError: TT = None import tests.backend.ini from tests.common import dicts_equal CNF_0 = dict(a=0, b="bbb...
Python
0.000001
779e74593b40f0e5e5c50c684dd250f771918b77
Fix tests
pendulum/locales/locale.py
pendulum/locales/locale.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import re from typing import Union, Optional, Any from importlib import import_module from pendulum.utils._compat import basestring from pendulum.utils._compat import decode class Locale: """ Represent a specific locale. """ ...
# -*- coding: utf-8 -*- import os import re from typing import Union, Optional, Any from importlib import import_module from pendulum.utils._compat import basestring from pendulum.utils._compat import decode class Locale: """ Represent a specific locale. """ _cache = {} def __init__(self, loc...
Python
0.000003
f0ef4f5e269d7f2d7fd347e8f458c1c9ce1ffb34
Fix bug in redis hook
mqueue/hooks/redis/__init__.py
mqueue/hooks/redis/__init__.py
import redis import time from mqueue.conf import DOMAIN from mqueue.hooks.redis import serializer from mqueue.conf import HOOKS conf = HOOKS["redis"] R = redis.StrictRedis(host=conf["host"], port=conf["port"], db=conf["db"]) event_num = int(time.time()) def save(event, conf): global event_num global R na...
import redis import time from mqueue.conf import DOMAIN from mqueue.hooks.redis import serializer from mqueue.conf import HOOKS conf = HOOKS["redis"] R = redis.StrictRedis(host=conf["host"], port=conf["port"], db=conf["db"]) event_num = int(time.time()) def save(event, conf): name = DOMAIN+"_event"+str(event_num...
Python
0
54035774d3b9aece86e68f047e9ff4a270d344cb
add mountain climbing emoji #2001
c2corg_ui/format/emoji_databases/c2c_activities.py
c2corg_ui/format/emoji_databases/c2c_activities.py
SVG_CDN = "/static/img/documents/activities/" emoji = { ":rock_climbing:": { "category": "activitiy", "name": "rock climbing", "svg_name": "rock_climbing", "unicode": "1f9d7", }, ":skitouring:": { "category": "activitiy", "name": "ski touring", "svg_n...
SVG_CDN = "/static/img/documents/activities/" emoji = { ":rock_climbing:": { "category": "activitiy", "name": "rock climbing", "svg_name": "rock_climbing", "unicode": "1f9d7", }, ":skitouring:": { "category": "activitiy", "name": "ski touring", "svg_n...
Python
0.999999
f58d82173b7defbed651a1eaec2c318e7bc17911
add giant queue test
qiita_db/test/test_sql_connection.py
qiita_db/test/test_sql_connection.py
from unittest import TestCase, main from qiita_db.sql_connection import SQLConnectionHandler from qiita_db.exceptions import QiitaDBExecutionError from qiita_core.util import qiita_test_checker @qiita_test_checker() class TestConnHandler(TestCase): def test_create_queue(self): self.conn_handler.create_qu...
from unittest import TestCase, main from qiita_db.sql_connection import SQLConnectionHandler from qiita_db.exceptions import QiitaDBExecutionError from qiita_core.util import qiita_test_checker @qiita_test_checker() class TestConnHandler(TestCase): def test_create_queue(self): self.conn_handler.create_qu...
Python
0
d5167d8ba1b3107e5ce121eca76b5496bf8d6448
Truncate a long log message.
qipipe/registration/ants/template.py
qipipe/registration/ants/template.py
import os import logging import envoy from .ants_error import ANTSError def create_template(metric, files): """ Builds a template from the given image files. :param metric: the similarity metric :param files: the image files :return: the template file name """ CMD = "buildtemplateparal...
import os import logging import envoy from .ants_error import ANTSError def create_template(metric, files): """ Builds a template from the given image files. :param metric: the similarity metric :param files: the image files :return: the template file name """ CMD = "buildtemplateparal...
Python
0.000003
0062a78845d9effa68ec9aee4003437d477093b6
Use caps for constants and don't use a constant for localhost
netanalysis/ip/ip_info_test.py
netanalysis/ip/ip_info_test.py
import unittest from ipaddress import ip_address as ip from . import ip_info as ii # Google DNS addresses will be stably assigned to Google's AS" GOOGLE_DNS_IP4_8888 = ip("8.8.8.8") GOOGLE_DNS_IP4_8844 = ip("8.8.4.4") GOOGLE_DNS_IP6_8888 = ip("2001:4860:4860::8888") GOOGLE_DNS_IP6_8844 = ip("2001:4860:4860::8844") G...
import unittest from ipaddress import ip_address as ip from . import ip_info as ii localhost_ip4 = ip("127.0.0.1") localhost_ip6 = ip("::1") # Google DNS addresses will be stably assigned to Google's AS" google_dns_ip4_8888 = ip("8.8.8.8") google_dns_ip4_8844 = ip("8.8.4.4") google_dns_ip6_8888 = ip("2001:4860:4860...
Python
0.000001
52b98755a8b26fb50d90b7988ee8ee16053e5c11
Update lint.py to automatically find .py files
lint.py
lint.py
# coding: utf-8 from __future__ import unicode_literals import os from pylint.lint import Run cur_dir = os.path.dirname(__file__) rc_path = os.path.join(cur_dir, './.pylintrc') print('Running pylint...') files = [] for root, dirnames, filenames in os.walk('oscrypto/'): for filename in filenames: if no...
# coding: utf-8 from __future__ import unicode_literals import os from pylint.lint import Run cur_dir = os.path.dirname(__file__) rc_path = os.path.join(cur_dir, './.pylintrc') print('Running pylint...') files = [ '__init__.py', '_osx_ctypes.py', '_osx_public_key.py', '_osx_symmetric.py', '_os...
Python
0
566c97f99668691b19dad7f0cb737157338ec57b
Add language attribute to dataset holder.
load.py
load.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # pylint: disable=C0103 """ Load CoNLL16st/CoNLL15st dataset. """ __author__ = "GW [http://gw.tnode.com/] <gw.2016@tnode.com>" __license__ = "GPLv3+" from files import load_parses, load_raws, load_relations_gold from words import get_words, get_pos_tags, get_word_metas fro...
#!/usr/bin/env python # -*- coding: utf-8 -*- # pylint: disable=C0103 """ Load CoNLL16st/CoNLL15st dataset. """ __author__ = "GW [http://gw.tnode.com/] <gw.2016@tnode.com>" __license__ = "GPLv3+" from files import load_parses, load_raws, load_relations_gold from words import get_words, get_pos_tags, get_word_metas fro...
Python
0
851d53a68b4c9d8a7ea926d031c9e136b069a820
add abstraction to message handler
examples/accounts/app.py
examples/accounts/app.py
import json import asyncio from nats.aio.client import Client as NATS from nats.aio.errors import ErrConnectionClosed, ErrTimeout, ErrNoServers # TODO ADD possible actions list! # TODO ADD abstractions to Message Handler! # MessageHandler must be able to call methods of Service and control requests class MessageHandl...
import json import asyncio from nats.aio.client import Client as NATS from nats.aio.errors import ErrConnectionClosed, ErrTimeout, ErrNoServers # TODO ADD possible actions list! # TODO ADD abstractions to Message Handler! class ServiceBroker: def __init__(self, io_loop, **settings): self.io_loop = io_loo...
Python
0.000001
10a685d69d6866f86c3db7997e3fcf8b837470e4
add posible actions list
examples/accounts/app.py
examples/accounts/app.py
import json import asyncio from nats.aio.client import Client as NATS from nats.aio.errors import ErrConnectionClosed, ErrTimeout, ErrNoServers # TODO ADD possible actions list! class ServiceBroker: def __init__(self, io_loop, **settings): self.io_loop = io_loop self.nc = NATS() self.logg...
import json import asyncio from nats.aio.client import Client as NATS from nats.aio.errors import ErrConnectionClosed, ErrTimeout, ErrNoServers class ServiceBroker: def __init__(self, io_loop, **settings): self.io_loop = io_loop self.nc = NATS() self.logger = settings.get('logger') __...
Python
0.000019
671ff419731084681edaf3fdc826c1139383c325
add Raises to orthogonal_procrustes docstring
scipy/linalg/_procrustes.py
scipy/linalg/_procrustes.py
""" Solve the orthogonal Procrustes problem. """ from __future__ import division, print_function, absolute_import import numpy as np from .decomp_svd import svd __all__ = ['orthogonal_procrustes'] def orthogonal_procrustes(A, B, compute_scale=False, check_finite=True): """ Compute the matrix solution of t...
""" Solve the orthogonal Procrustes problem. """ from __future__ import division, print_function, absolute_import import numpy as np from .decomp_svd import svd __all__ = ['orthogonal_procrustes'] def orthogonal_procrustes(A, B, compute_scale=False, check_finite=True): """ Compute the matrix solution of t...
Python
0
d8b4dbfed17be90846ea4bc47b5f7b39ad944c24
Remove raw SQL from oscar_calculate_scores
oscar/apps/analytics/scores.py
oscar/apps/analytics/scores.py
from django.db.models import F from oscar.core.loading import get_model ProductRecord = get_model('analytics', 'ProductRecord') Product = get_model('catalogue', 'Product') class Calculator(object): # Map of field name to weight weights = { 'num_views': 1, 'num_basket_additions': 3, '...
from django.db import connection, transaction from oscar.core.loading import get_model ProductRecord = get_model('analytics', 'ProductRecord') Product = get_model('catalogue', 'Product') class Calculator(object): # Map of field name to weight weights = {'num_views': 1, 'num_basket_additions':...
Python
0