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
db2f6f4c2a70875aade3741fb57d0bc1b109ce3c
Add regexp to create_user form logic
app/views/create_user.py
app/views/create_user.py
from flask import request, flash, render_template import bcrypt from app import app, helpers @app.route('/create_user', methods=['GET', 'POST']) def create_user(): if request.method == 'POST': username = request.form.get('username', None).strip() # Aa09_.- allowed password = request.form.get('pa...
from flask import request, flash, render_template import bcrypt from app import app, helpers @app.route('/create_user', methods=['GET', 'POST']) def create_user(): if request.method == 'POST': username = request.form.get('username', None).strip() password = request.form.get('password', None) ...
Python
0
e4097fc77139abde6311886c2a7792d675e5f805
Update merge_intervals.py
array/merge_intervals.py
array/merge_intervals.py
""" Given a collection of intervals, merge all overlapping intervals. """ class Interval: """ In mathematics, a (real) interval is a set of real numbers with the property that any number that lies between two numbers in the set is also included in the set. """ def __init__(self, start=0, end=...
""" Given a collection of intervals, merge all overlapping intervals. """ class Interval: """ In mathematics, a (real) interval is a set of real numbers with the property that any number that lies between two numbers in the set is also included in the set. """ def __init__(self, start=0, end=...
Python
0.000002
5e11d6766bea9098b89a8c5246518b4a09a163d5
Add some paramters to the generic REST API class: - api_root - timeout - api_version
atlassian/rest_client.py
atlassian/rest_client.py
import json import logging from urllib.parse import urlencode, urljoin import requests log = logging.getLogger("atlassian") class AtlassianRestAPI: default_headers={'Content-Type': 'application/json', 'Accept': 'application/json'} def __init__(self, url, username, password, timeout=60, api_root='rest/api'...
import json import logging from urllib.parse import urlencode, urljoin import requests log = logging.getLogger("atlassian") class AtlassianRestAPI: def __init__(self, url, username, password): self.url = url self.username = username self.password = password self._session = reque...
Python
0.999987
8bcc09e4d3d0a14abd132e023bb4b4896aaac4f2
make imports Python 3 friendly
barak/absorb/__init__.py
barak/absorb/__init__.py
from .absorb import * from .equiv_width import * from .aod import *
from absorb import * from equiv_width import * from aod import *
Python
0.000012
4b6bffdb048aa44b42cb80a54fca9a204ede833f
Update version to 0.0.3
boto3facade/metadata.py
boto3facade/metadata.py
# -*- coding: utf-8 -*- """Project metadata Information describing the project. """ # The package name, which is also the "UNIX name" for the project. package = 'boto3facade' project = "boto3facade" project_no_spaces = project.replace(' ', '') version = '0.0.3' description = 'A simple facade for boto3' authors = ['Ge...
# -*- coding: utf-8 -*- """Project metadata Information describing the project. """ # The package name, which is also the "UNIX name" for the project. package = 'boto3facade' project = "boto3facade" project_no_spaces = project.replace(' ', '') version = '0.0.2' description = 'A simple facade for boto3' authors = ['Ge...
Python
0.000001
81df185279a8d46ca2e8ed9fbed4c3204522965e
Extend potential life of social media queue entries
bvspca/social/models.py
bvspca/social/models.py
import logging from datetime import datetime, timedelta from django.db import models from wagtail.core.models import Page logger = logging.getLogger('bvspca.social') class SocialMediaPostable(): def social_media_ready_to_post(self): raise NotImplemented() def social_media_post_text(self): r...
import logging from datetime import datetime, timedelta from django.db import models from wagtail.core.models import Page logger = logging.getLogger('bvspca.social') class SocialMediaPostable(): def social_media_ready_to_post(self): raise NotImplemented() def social_media_post_text(self): r...
Python
0.000003
77f4b5b1bc3c30fb454212d3c4d2aa62d8c06ca8
Update exportyaml.py
canmatrix/exportyaml.py
canmatrix/exportyaml.py
#!/usr/bin/env python from __future__ import absolute_import from .canmatrix import * import codecs import yaml from yaml.representer import SafeRepresenter from builtins import * import copy #Copyright (c) 2013, Eduard Broecker #All rights reserved. # #Redistribution and use in source and binary forms, with or witho...
#!/usr/bin/env python from __future__ import absolute_import from .canmatrix import * import codecs import yaml from yaml.representer import SafeRepresenter from builtins import * import copy #Copyright (c) 2013, Eduard Broecker #All rights reserved. # #Redistribution and use in source and binary forms, with or witho...
Python
0.000001
df679af352f156ad4846fbc53a8efc43814b897c
Update ce.transformer.utils
ce/transformer/utils.py
ce/transformer/utils.py
import itertools from ce.expr import Expr from ce.transformer.core import TreeTransformer from ce.transformer.biop import associativity, distribute_for_distributivity, \ BiOpTreeTransformer from ce.analysis import expr_frontier def closure(tree, depth=None): return BiOpTreeTransformer(tree, depth=depth).clos...
import itertools from ce.expr import Expr from ce.transformer.core import TreeTransformer from ce.transformer.biop import associativity, distribute_for_distributivity, \ BiOpTreeTransformer from ce.analysis import expr_frontier def closure(tree, depth=None): return BiOpTreeTransformer(tree, depth=depth).clos...
Python
0.000001
1a50aaf6be0f866046d88944607802a4e8661c61
Revert "Test jenkins failure"
ceam_tests/test_util.py
ceam_tests/test_util.py
# ~/ceam/tests/test_util.py from unittest import TestCase from datetime import timedelta from unittest.mock import Mock import numpy as np import pandas as pd from ceam.engine import SimulationModule from ceam.util import from_yearly, to_yearly, rate_to_probability, probability_to_rate class TestRateConversions(Te...
# ~/ceam/tests/test_util.py from unittest import TestCase from datetime import timedelta from unittest.mock import Mock import numpy as np import pandas as pd from ceam.engine import SimulationModule from ceam.util import from_yearly, to_yearly, rate_to_probability, probability_to_rate class TestRateConversions(Te...
Python
0
c00c7e6099269c66b64a15c15318093eadbf3851
Fix excluded_extensions when ignore_hidden is False
checksumdir/__init__.py
checksumdir/__init__.py
""" Function for deterministically creating a single hash for a directory of files, taking into account only file contents and not filenames. Usage: from checksumdir import dirhash dirhash('/path/to/directory', 'md5') """ import os import hashlib import re import pkg_resources __version__ = pkg_resources.require...
""" Function for deterministically creating a single hash for a directory of files, taking into account only file contents and not filenames. Usage: from checksumdir import dirhash dirhash('/path/to/directory', 'md5') """ import os import hashlib import re import pkg_resources __version__ = pkg_resources.require...
Python
0
f1dd824978ad8581113a088afe1d1bdf99a00802
Move to dev.
command_line/griddex.py
command_line/griddex.py
# LIBTBX_SET_DISPATCHER_NAME dev.dials.griddex from __future__ import absolute_import, division, print_function import libtbx.phil import libtbx.load_env help_message = ''' Cross reference indexing solutions. Examples:: %s expts0.json refl0.json ''' % libtbx.env.dispatcher_name phil_scope = libtbx.phil.parse("...
from __future__ import absolute_import, division, print_function import libtbx.phil import libtbx.load_env help_message = ''' Cross reference indexing solutions. Examples:: %s expts0.json refl0.json ''' % libtbx.env.dispatcher_name phil_scope = libtbx.phil.parse(""" d_min = None .type = float(value_min=0...
Python
0
9ebc7c3aee73f4a950d4975034f3c41417d59444
clean up unused imports
common/util/__init__.py
common/util/__init__.py
import sublime from plistlib import readPlistFromBytes syntax_file_map = {} def move_cursor(view, line_no, char_no): # Line numbers are one-based, rows are zero-based. line_no -= 1 # Negative line index counts backwards from the last line. if line_no < 0: last_line, _ = view.rowcol(view.size...
import itertools import sublime from plistlib import readPlistFromBytes from .parse_diff import parse_diff syntax_file_map = {} def move_cursor(view, line_no, char_no): # Line numbers are one-based, rows are zero-based. line_no -= 1 # Negative line index counts backwards from the last line. if lin...
Python
0.000001
8c3b20f8aa655a7f8fe1ae485e493aa4a5f24abd
Remove __getattr__ method from CompositeField
composite_field/l10n.py
composite_field/l10n.py
from copy import deepcopy from django.conf import settings from django.db.models.fields import Field, CharField, TextField, FloatField from django.utils.functional import lazy from django.utils import six from . import CompositeField LANGUAGES = map(lambda lang: lang[0], getattr(settings, 'LANGUAGES', ())) class...
from copy import deepcopy from django.conf import settings from django.db.models.fields import Field, CharField, TextField, FloatField from django.utils.functional import lazy from django.utils import six from . import CompositeField LANGUAGES = map(lambda lang: lang[0], getattr(settings, 'LANGUAGES', ())) class...
Python
0
5caf134eedc4ace933da8c2f21aacc5f5b1224ef
bump version
confetti/__version__.py
confetti/__version__.py
__version__ = "2.2.1"
__version__ = "2.2.0"
Python
0
b48a29e1f940f6b9c0305dbcc15e98ea37057232
Update moscow.py
russian_metro/parser/providers/moscow.py
russian_metro/parser/providers/moscow.py
# -*- coding: utf-8 -*- import requests from bs4 import BeautifulSoup from russian_metro.parser.base import BaseDataProvider class DataProvider(BaseDataProvider): metro_lines_src = u"http://ru.wikipedia.org/wiki/Модуль:MoscowMetro#ColorByNum" metro_stations_src = u"http://ru.wikipedia.org/w/index.php?title=\...
# -*- coding: utf-8 -*- import requests from bs4 import BeautifulSoup from russian_metro.parser.base import BaseDataProvider class DataProvider(BaseDataProvider): metro_lines_src = u"http://ru.wikipedia.org/wiki/Модуль:MoscowMetro#ColorByNum" metro_stations_src = u"http://ru.wikipedia.org/w/index.php?title=\...
Python
0
3dae8f25cda4827397ab3812ea552ed27d37e757
Remove contraints on dotted names
base_vat_optional_vies/models/res_partner.py
base_vat_optional_vies/models/res_partner.py
# Copyright 2015 Tecnativa - Antonio Espinosa # Copyright 2017 Tecnativa - David Vidal # Copyright 2019 FactorLibre - Rodrigo Bonilla # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models class ResPartner(models.Model): _inherit = 'res.partner' vies_passed ...
# Copyright 2015 Tecnativa - Antonio Espinosa # Copyright 2017 Tecnativa - David Vidal # Copyright 2019 FactorLibre - Rodrigo Bonilla # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models class ResPartner(models.Model): _inherit = 'res.partner' vies_passed ...
Python
0.000001
6ed3f5d97fe8f8967df5624f62e69ce2a58a9413
Add color to pytest tests on CI (#20723)
scripts/ci/images/ci_run_docker_tests.py
scripts/ci/images/ci_run_docker_tests.py
#!/usr/bin/env python3 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "L...
#!/usr/bin/env python3 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "L...
Python
0
b5b31136ff716b423d78d307e107df4b8d8cfedc
Add images field on article model abstract, is many to many
opps/core/models/article.py
opps/core/models/article.py
# -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from django.core.exceptions import ValidationError, ObjectDoesNotExist from opps.core.models.published import Published from opps.core.models.date import Date from opps.core.models.channel import Channel from o...
# -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from django.core.exceptions import ValidationError, ObjectDoesNotExist from opps.core.models.published import Published from opps.core.models.date import Date from opps.core.models.channel import Channel from ...
Python
0.000059
5cf84d646796bf5d2f96c67b12a21dc557532c4f
move recv_threads checking loop to run()
orchard/cli/socketclient.py
orchard/cli/socketclient.py
# Adapted from https://github.com/benthor/remotty/blob/master/socketclient.py from select import select import sys import tty import fcntl import os import termios import threading import time import errno import logging log = logging.getLogger(__name__) class SocketClient: def __init__(self, socket_in=...
# Adapted from https://github.com/benthor/remotty/blob/master/socketclient.py from select import select import sys import tty import fcntl import os import termios import threading import time import errno import logging log = logging.getLogger(__name__) class SocketClient: def __init__(self, socket_in=...
Python
0
6aa92f13673ec49a67b5f9e2970c7751a852c19b
Fix typos in test_handler.py (#1953)
opentelemetry-sdk/tests/logs/test_handler.py
opentelemetry-sdk/tests/logs/test_handler.py
# Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
# Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
Python
0.0006
a25141dca6ce6f8ead88c43fa7f5726afb2a9dba
Fix currency dialog to match model changes
cbpos/mod/currency/views/dialogs/currency.py
cbpos/mod/currency/views/dialogs/currency.py
from PySide import QtGui import cbpos logger = cbpos.get_logger(__name__) from cbpos.mod.currency.models import Currency from cbpos.mod.currency.views import CurrenciesPage class CurrencyDialog(QtGui.QWidget): def __init__(self): super(CurrencyDialog, self).__init__() messa...
from PySide import QtGui from cbpos.mod.currency.models.currency import Currency import cbpos class CurrencyDialog(QtGui.QWidget): def __init__(self): super(CurrencyDialog, self).__init__() self.name = QtGui.QLineEdit() self.symbol = QtGui.QLineEdit() self.value =...
Python
0.000001
0dacb5382e3099d0b9faa65e207c3be407747eeb
Use .array
chainerrl/optimizers/nonbias_weight_decay.py
chainerrl/optimizers/nonbias_weight_decay.py
# This caused an error in py2 because cupy expect non-unicode str # from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import * # NOQA from future import standard_library standard_library.install_aliases() ...
# This caused an error in py2 because cupy expect non-unicode str # from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import * # NOQA from future import standard_library standard_library.install_aliases() ...
Python
0
1006ac44b8ef9654976c1b57ccf20387877db1cb
Update results/title/forms100.py
results/title/forms100.py
results/title/forms100.py
from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont import os.path from laboratory.settings import FONTS_FOLDER from directions.models import Issledovaniya from reportlab.platypus import Paragraph, Table, TableStyle, Spacer from reportlab.lib.styles import getSampleStyleSheet from rep...
from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont import os.path from laboratory.settings import FONTS_FOLDER from directions.models import Issledovaniya from reportlab.platypus import Paragraph, Table, TableStyle, Spacer from reportlab.lib.styles import getSampleStyleSheet from rep...
Python
0
4ea9a0bc8b7ef47dd98c155b3f35440fe88b564a
Fix output order, add uri attribute
resync/capability_list.py
resync/capability_list.py
"""ResourceSync Capability List object An Capability List is a set of capabilitys with some metadata for each capability. The Capability List object may also contain metadata and links like other lists. """ import collections from resource import Resource from resource_set import ResourceSet from list_base import ...
"""ResourceSync Capability List object An Capability List is a set of capabilitys with some metadata for each capability. The Capability List object may also contain metadata and links like other lists. """ import collections from resource import Resource from resource_set import ResourceSet from list_base import ...
Python
0.000022
f51369999441cb85ed730488e943580d707e8856
use relative imports in parser/__init__.py
rflint/parser/__init__.py
rflint/parser/__init__.py
from .parser import (SuiteFolder, ResourceFile, SuiteFile, RobotFactory, Testcase, Keyword, Row, Statement, TestcaseTable, KeywordTable) from .tables import DefaultTable, SettingTable, UnknownTable, VariableTable, MetadataTable, RobotTable
from parser import ResourceFile, SuiteFile, RobotFileFactory, Testcase, Keyword, Row, Statement from tables import DefaultTable, SettingTable, UnknownTable, VariableTable, MetadataTable, RobotTable
Python
0.000015
650dae4ce3bd154dba442cf0476651e0e949b092
add default
controller/management/commands/2xmp.py
controller/management/commands/2xmp.py
from django.core.management.base import BaseCommand, CommandError from optparse import make_option from progressbar import ProgressBar, SimpleProgress import os, sys, subprocess from django.conf import settings from emma.core.metadata import Metadata class Command(BaseCommand): """ Migrates keywords from the I...
from django.core.management.base import BaseCommand, CommandError from optparse import make_option from progressbar import ProgressBar, SimpleProgress import os, sys, subprocess from django.conf import settings from emma.core.metadata import Metadata class Command(BaseCommand): """ Migrates keywords from the I...
Python
0.000002
780f28cd91f92fea0dddee2b62bc659d244a8270
Change create sample code to select indexes by eval set
create_sample.py
create_sample.py
# importing modules/ libraries import pandas as pd import random import numpy as np # create a sample of prior orders orders_df = pd.read_csv("Data/orders.csv") s = round(3214874 * 0.1) i = sorted(random.sample(list(orders_df[orders_df["eval_set"]=="prior"].index), s)) orders_df.loc[i,:].to_csv("Data/orders_prior_samp...
# importing modules/ libraries import pandas as pd import random import numpy as np # create a sample of prior orders orders_df = pd.read_csv("Data/orders.csv") s = round(3214874 * 0.1) i = sorted(random.sample(range(1,3214874), s)) orders_df.loc[i,:].to_csv("Data/orders_prior_sample.csv", index = False) # create a s...
Python
0
fee30c4017da4d41a9487d961ba543d2d1e20e85
Add explicit Note join relationship on NoteContent model. (also remove extraneous comments on old date format)
tuhi_flask/models.py
tuhi_flask/models.py
# Copyright 2015 icasdri # # This file is part of tuhi-flask. # # tuhi-flask is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # #...
# Copyright 2015 icasdri # # This file is part of tuhi-flask. # # tuhi-flask is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # #...
Python
0
ee76ae4f41be17a0f6a482273e99783df8212004
Reconfigure key repeat (should change to be configurable)
riker/worker/utils.py
riker/worker/utils.py
from logging import getLogger import tempfile from threading import Thread import lirc from django.conf import settings from systemstate.models import RemoteButton from systemstate.utils import push_button LOGGER = getLogger(__name__) LIRCRC_TEMPLATE = ''' begin prog = {lirc_name} button = {key_...
from logging import getLogger import tempfile from threading import Thread import lirc from django.conf import settings from systemstate.models import RemoteButton from systemstate.utils import push_button LOGGER = getLogger(__name__) LIRCRC_TEMPLATE = ''' begin prog = {lirc_name} button = {key_...
Python
0
0827911184bf43a6dd50712444d3f9385a64eb31
support combining bigrams
constraintWriterTool.py
constraintWriterTool.py
#!/usr/bin/env python from autosuggest import * import os, sys from sys import argv, exit def printUsage(): print("Usage: constraintWriterTool action [options]\nActions:\n\tsuggest\t\tbigramfile word\n\tsuggestPfx\tbigramfile word prefix\n\tinWhitelist\tbigramfile word\n\tinBlacklist\tbigramfile word\n\tcompile\t\tc...
#!/usr/bin/env python from autosuggest import * import os, sys from sys import argv, exit def printUsage(): print("Usage: constraintWriterTool action [options]\nActions:\n\tsuggest\t\tbigramfile word\n\tsuggestPfx\t\tbigramfile word prefix\n\tinWhitelist\tbigramfile word\n\tinBlacklist\tbigramfile word\n\tcompile\t\...
Python
0
23939ace63c12391dc07a3419a55ca573ee5dd73
Update debug output and remove unnecessary assignment
righteous/api/server_template.py
righteous/api/server_template.py
import re from urllib import urlencode from logging import getLogger import omnijson as json from .. import config from .base import _request, debug log = getLogger(__name__) def list_server_templates(): """ Lists ServerTemplates :return: list of dicts of server information with the following keys: ...
import re from urllib import urlencode from logging import getLogger import omnijson as json from .. import config from .base import _request, debug log = getLogger(__name__) def list_server_templates(): """ Lists ServerTemplates :return: list of dicts of server information with the following keys: ...
Python
0
1f19fa52e40db1f28d620aa8bf75745e814c0f81
Remove unused import
cogs/fun.py
cogs/fun.py
import discord from discord.ext import commands from utils.messages import ColoredEmbed class Fun: def __init__(self, bot): self.bot = bot @commands.command() async def xkcd(self, ctx): """See the latest XKCD comic.""" async with self.bot.session.get('https://xkcd.com/info.0.json'...
import random import discord from discord.ext import commands from utils.messages import ColoredEmbed class Fun: def __init__(self, bot): self.bot = bot @commands.command() async def xkcd(self, ctx): """See the latest XKCD comic.""" async with self.bot.session.get('https://xkcd.co...
Python
0.000001
14eaff694912320296412f2e4ca51072c5dddf49
add unit_testing_only decorator
corehq/apps/userreports/dbaccessors.py
corehq/apps/userreports/dbaccessors.py
from corehq.apps.domain.dbaccessors import get_docs_in_domain_by_class from corehq.apps.domain.models import Domain from corehq.util.test_utils import unit_testing_only def get_number_of_report_configs_by_data_source(domain, data_source_id): """ Return the number of report configurations that use the given da...
from django.conf import settings from dimagi.utils.couch.database import iter_docs from corehq.apps.domain.dbaccessors import get_docs_in_domain_by_class from corehq.apps.domain.models import Domain def get_number_of_report_configs_by_data_source(domain, data_source_id): """ Return the number of report conf...
Python
0
e595d823e303a6db0a9c7e24f6a9d1644615009c
Bump version of CaptchaService.py
module/plugins/internal/CaptchaService.py
module/plugins/internal/CaptchaService.py
# -*- coding: utf-8 -*- from module.plugins.internal.Captcha import Captcha class CaptchaService(Captcha): __name__ = "CaptchaService" __type__ = "captcha" __version__ = "0.35" __status__ = "stable" __description__ = """Base anti-captcha service plugin""" __license__ = "GPLv3" ...
# -*- coding: utf-8 -*- from module.plugins.internal.Captcha import Captcha class CaptchaService(Captcha): __name__ = "CaptchaService" __type__ = "captcha" __version__ = "0.34" __status__ = "stable" __description__ = """Base anti-captcha service plugin""" __license__ = "GPLv3" ...
Python
0.003249
5efc40cd9be0c212f142d7469a9bf6f44da0827a
add story support in client with -s boolean operator
instapy_cli/__main__.py
instapy_cli/__main__.py
import sys from platform import python_version from instapy_cli.cli import InstapyCli as client from optparse import OptionParser import pkg_resources # part of setuptools version = pkg_resources.require('instapy_cli')[0].version def main(args=None): print('instapy-cli ' + version + ' | python ' + python_versi...
import sys from platform import python_version from instapy_cli.cli import InstapyCli as client from optparse import OptionParser import pkg_resources # part of setuptools version = pkg_resources.require('instapy_cli')[0].version ''' TODO: - use instapy_cli.media to download image link and use it for upload and conf...
Python
0
6341f351aab0ff510fcf1d9ce135be680763a971
Fix comments in backtracking/coloring.py (#4857)
backtracking/coloring.py
backtracking/coloring.py
""" Graph Coloring also called "m coloring problem" consists of coloring a given graph with at most m colors such that no adjacent vertices are assigned the same color Wikipedia: https://en.wikipedia.org/wiki/Graph_coloring """ def valid_coloring( neighbours: list[int], colored_vertices: list[int...
""" Graph Coloring also called "m coloring problem" consists of coloring given graph with at most m colors such that no adjacent vertices are assigned same color Wikipedia: https://en.wikipedia.org/wiki/Graph_coloring """ def valid_coloring( neighbours: list[int], colored_vertices: list[int], col...
Python
0
86c9a2191e412d7701940e5aa64279ca000235b3
Add ListsRanking, which is identical to ProbabilisticRanking, and PairwisePreferenceRanking as well #57
interleaving/ranking.py
interleaving/ranking.py
from collections import defaultdict class BalancedRanking(list): ''' A list of document IDs generated by an interleaving method including two rankers A and B ''' __slots__ = ['a', 'b'] def __hash__(self): return hash((tuple(self), tuple(self.a), tuple(self.b))) def dumpd(self): ...
from collections import defaultdict class BalancedRanking(list): ''' A list of document IDs generated by an interleaving method including two rankers A and B ''' __slots__ = ['a', 'b'] def __hash__(self): return hash((tuple(self), tuple(self.a), tuple(self.b))) def dumpd(self): ...
Python
0
ca295aff7a051c5a8b5272a47f4af32378db3185
Update PID_wrap.py
control/PID/PID_wrap.py
control/PID/PID_wrap.py
import sensors.SensorClass as SensorClass import PID_controller import numpy as np import Accel_to_Pos as posfinder class PID(object): def __init__(self): self.pos = posfinder(self) self.data = SensorClass.Data_file.State() self.controller_x = PID_controller.PID_Controller(self) se...
import sensors.SensorClass as SensorClass import PID_controller import numpy as np class PID(object): def __init__(self): self.data = SensorClass.Data_file.State() self.controller_x = PID_controller.PID_Controller(self) self.controller_y = PID_controller.PID_Controller(self) self.c...
Python
0
f26c2059ff6e2a595097ef7a03efe149f9e253eb
Add default images for podcasts if necessary
iterator.py
iterator.py
import os, re, requests rootdir = '_posts' for subdir, dirs, files in os.walk(rootdir): for file in files: filename = os.path.join(subdir, file) f = open(filename, "r") contents = f.readlines() f.close() # Find first image if re.search('podcast', filename): if re.s...
import os, re, requests rootdir = '_posts' for subdir, dirs, files in os.walk(rootdir): for file in files: filename = os.path.join(subdir, file) f = open(filename, "r") contents = f.readlines() f.close() # Find first image for key, line in enumerate(contents): src = re.sear...
Python
0.000001
6d52a6a1447ae854e22bc6317b694cb3bb317c12
Fix import paths
curiosity/bot.py
curiosity/bot.py
import traceback import logbook from ruamel import yaml from curious.commands.bot import CommandsBot from curious.commands.context import Context from curious.commands.exc import CheckFailureError, MissingArgumentError, ConversionFailedError from curious.dataclasses.status import Game, Status from curious.dataclasses...
import traceback import logbook from ruamel import yaml from curious.commands.bot import CommandsBot from curious.commands.context import Context from curious.commands.exc import CheckFailureError, MissingArgumentError, ConversionFailedError from curious.dataclasses import Game, Status, Message from curious.event imp...
Python
0.00008
a72e0a6068614b740ade7586ec316db7b9611b46
Make JBrowse work in DEBUG mode without nginx.
genome_designer/urls.py
genome_designer/urls.py
from django.conf.urls import include from django.conf.urls import patterns from django.conf.urls import url from django.views.generic import RedirectView import settings urlpatterns = patterns('', url(r'^$', 'genome_designer.main.views.home_view'), # Project-specific views url(r'^projects$', ...
from django.conf.urls import include from django.conf.urls import patterns from django.conf.urls import url from django.views.generic import RedirectView urlpatterns = patterns('', url(r'^$', 'genome_designer.main.views.home_view'), # Project-specific views url(r'^projects$', 'genome_designer....
Python
0.000001
e0f3e68435b406e3bad9b7f7e459b724ea832e9e
Disable summernote editor test from Travis
shuup_tests/browser/admin/test_editor.py
shuup_tests/browser/admin/test_editor.py
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2018, Shuup Inc. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. import os import pytest from django.core.urlresolvers import reverse from ...
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2018, Shuup Inc. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. import os import pytest from django.core.urlresolvers import reverse from ...
Python
0
6f7c11c13793cbba7904cfd2a27ab3eb59ab9302
Update ispyb/sp/xtalimaging.py: proper multi-line docstring
ispyb/sp/xtalimaging.py
ispyb/sp/xtalimaging.py
from __future__ import absolute_import, division, print_function from ispyb.interface.dataarea import DataArea class XtalImaging(DataArea): """provides methods for accessing crystal imaging tables.""" def upsert_sample_image( self, id=None, sample_id=None, inspection_id=None,...
from __future__ import absolute_import, division, print_function from ispyb.interface.dataarea import DataArea class XtalImaging(DataArea): """provides methods for accessing crystal imaging tables.""" def upsert_sample_image( self, id=None, sample_id=None, inspection_id=None,...
Python
0
b1d1df9a5368a50f82a8bab6a4be023a51ef603f
Update PickList.py
Cogs/PickList.py
Cogs/PickList.py
import asyncio import discord from discord.ext import commands def setup(bot): # This module isn't actually a cog return class Picker: def __init__(self, **kwargs): self.list = kwargs.get("list", []) self.title = kwargs.get("title", None) self.timeout = kwargs.get("timeout", 60) ...
import asyncio import discord from discord.ext import commands def setup(bot): # This module isn't actually a cog return class Picker: def __init__(self, **kwargs): self.list = kwargs.get("list", []) self.title = kwargs.get("title", None) self.timeout = kwargs.get("timeout", 60) ...
Python
0
eda2f6905a3275623525c4179358e55e472b4fd7
Fix bug in urls.py following the sample_list template being renamed.
genome_designer/urls.py
genome_designer/urls.py
from django.conf.urls.defaults import include from django.conf.urls.defaults import patterns from django.conf.urls.defaults import url urlpatterns = patterns('', url(r'^$', 'genome_designer.main.views.home_view'), # Project-specific views url(r'^projects$', 'genome_designer.main.views.project_...
from django.conf.urls.defaults import include from django.conf.urls.defaults import patterns from django.conf.urls.defaults import url urlpatterns = patterns('', url(r'^$', 'genome_designer.main.views.home_view'), # Project-specific views url(r'^projects$', 'genome_designer.main.views.project_...
Python
0
63702a236d6c882b747cb19b566122a4a8ddfa3b
Change Indicator.add_menu arguments to allow passing CheckMenuItem status
jackselect/indicator.py
jackselect/indicator.py
"""A convenience class for a GTK 3 system tray indicator.""" from pkg_resources import resource_filename import gi gi.require_version('Gtk', '3.0') # noqa from gi.repository import Gtk from gi.repository.GdkPixbuf import Pixbuf class Indicator: """This class defines a standard GTK3 system tray indicator. ...
"""A convenience class for a GTK 3 system tray indicator.""" from pkg_resources import resource_filename import gi gi.require_version('Gtk', '3.0') # noqa from gi.repository import Gtk from gi.repository.GdkPixbuf import Pixbuf class Indicator: """This class defines a standard GTK3 system tray indicator. ...
Python
0
50bd1ce1118ddb52a54f679fc9faee4bc3110458
Allow the --force command line argument to accept one or more stage names'
rubra/cmdline_args.py
rubra/cmdline_args.py
# Process the unix command line of the pipeline. import argparse from version import rubra_version def get_cmdline_args(): return parser.parse_args() parser = argparse.ArgumentParser( description='A bioinformatics pipeline system.') parser.add_argument( '--pipeline', metavar='PIPELINE_FILE', typ...
# Process the unix command line of the pipeline. import argparse from version import rubra_version def get_cmdline_args(): return parser.parse_args() parser = argparse.ArgumentParser( description='A bioinformatics pipeline system.') parser.add_argument( '--pipeline', metavar='PIPELINE_FILE', typ...
Python
0
4009e01004ecd9b8f3d759842181b65a3893f73a
fix `TypeError: the JSON object must be str, bytes or bytearray, not NoneType`
simple_settings/dynamic_settings/base.py
simple_settings/dynamic_settings/base.py
# -*- coding: utf-8 -*- import re from copy import deepcopy import jsonpickle class BaseReader(object): """ Base class for dynamic readers """ _default_conf = {} def __init__(self, conf): self.conf = deepcopy(self._default_conf) self.conf.update(conf) self.key_pattern = s...
# -*- coding: utf-8 -*- import re from copy import deepcopy import jsonpickle class BaseReader(object): """ Base class for dynamic readers """ _default_conf = {} def __init__(self, conf): self.conf = deepcopy(self._default_conf) self.conf.update(conf) self.key_pattern = s...
Python
0.000001
a6cb3bfeb5f7201a0e702024257df1f874a3bb70
Bump version 15.
terroroftinytown/client/__init__.py
terroroftinytown/client/__init__.py
VERSION = 15 # Please update this whenever .client or .services changes # Please update MIN_VERSION_OVERRIDE and MIN_CLIENT_VERSION_OVERRIDE as needed
VERSION = 14 # Please update this whenever .client or .services changes # Please update MIN_VERSION_OVERRIDE and MIN_CLIENT_VERSION_OVERRIDE as needed
Python
0
3f70ead379b7f586313d01d5ab617fd5368f8ce3
Print traceback if startup fails
cthulhubot/management/commands/restart_masters.py
cthulhubot/management/commands/restart_masters.py
from traceback import print_exc from django.core.management.base import BaseCommand from cthulhubot.models import Buildmaster class Command(BaseCommand): help = 'Restart all Buildmaster processes' args = "" def handle(self, *fixture_labels, **options): verbosity = int(options.get('verbosity', 1))...
from django.core.management.base import BaseCommand from cthulhubot.models import Buildmaster class Command(BaseCommand): help = 'Restart all Buildmaster processes' args = "" def handle(self, *fixture_labels, **options): verbosity = int(options.get('verbosity', 1)) commit = int(options.ge...
Python
0.000008
8095347cc2b4b1d10ae9e37223d98c2dd44b7164
fix reversing after commit
nm_payment/drivers/bbs/payment_session.py
nm_payment/drivers/bbs/payment_session.py
import concurrent.futures from threading import Lock import logging log = logging.getLogger('nm_payment') from nm_payment.base import PaymentSession from nm_payment.exceptions import ( SessionCompletedError, SessionCancelledError, CancelFailedError, ) from .session import BBSSession RUNNING = 'RUNNING' CANCELL...
import concurrent.futures from threading import Lock import logging log = logging.getLogger('nm_payment') from nm_payment.base import PaymentSession from nm_payment.exceptions import ( SessionCompletedError, SessionCancelledError, CancelFailedError, ) from .session import BBSSession RUNNING = 'RUNNING' CANCELL...
Python
0.000002
4541b5edc808d77f53305eafca418d3be6715e8d
Cut 0.17.3
invocations/_version.py
invocations/_version.py
__version_info__ = (0, 17, 3) __version__ = '.'.join(map(str, __version_info__))
__version_info__ = (0, 17, 2) __version__ = '.'.join(map(str, __version_info__))
Python
0.000001
8d70bad3968cb11c929beafcef44b023822b886f
make interval adjustable in poll_request, and also remove check_response call duplication
stacktester/common/http.py
stacktester/common/http.py
from stacktester import exceptions import httplib2 import os import time class Client(object): USER_AGENT = 'python-nova_test_client' def __init__(self, host='localhost', port=80, base_url=''): #TODO: join these more robustly self.base_url = "http://%s:%s/%s" % (host, port, base_url) d...
from stacktester import exceptions import httplib2 import os import time class Client(object): USER_AGENT = 'python-nova_test_client' def __init__(self, host='localhost', port=80, base_url=''): #TODO: join these more robustly self.base_url = "http://%s:%s/%s" % (host, port, base_url) d...
Python
0
a8fe56cd60296607f879dea86432532a5b40824a
Add a main method
dame/__init__.py
dame/__init__.py
from .dame import * def main(): dame.main()
Python
0.998985
c005ce217f77aa185ad8916475463f2040a3dc67
clean up yaml generator.
iridium/core/trapper.py
iridium/core/trapper.py
from functools import wraps from .logger import glob_logger from iridium.config import config from .exceptions import FunctionException import yaml from inspect import signature def tracer(func): """ tracer will decorate a given function which allow users to step through a function call on error. :par...
from functools import wraps from .logger import glob_logger from iridium.config import config from .exceptions import FunctionException import yaml from inspect import signature def tracer(func): """ tracer will decorate a given function which allow users to step through a function call on error. :par...
Python
0
e6d0e3c2b01a28a3235d1de292f99328c77e6584
print usage
dnsquery.py
dnsquery.py
import sys import csv import time import logging from common import threadpool import dns.resolver import dns.message import dns.rdataclass import dns.rdatatype import dns.query import dns.exception class DNSQueryTask(threadpool.Task): def do(self): qname, qtype, qcount, bdnsip = "", "", 0, "" ...
import sys import csv import time import logging from common import threadpool import dns.resolver import dns.message import dns.rdataclass import dns.rdatatype import dns.query import dns.exception class DNSQueryTask(threadpool.Task): def do(self): qname, qtype, qcount, bdnsip = "", "", 0, "" ...
Python
0.000003
083499cc0bb2ad443bbebb45d0e75bd0bc2df8b7
allow ssh key of any size
fig_leaf.py
fig_leaf.py
""" Fig Leaf: Encrypt and decrypt data with ssh keys! 2017 maryx Usage: 1. Run `pip install pycrypto` 2. To encrypt, run `python fig_leaf.py <path to file location> <path to output location> <path to public key>` 3. To decrypt, run `python fig_leaf.py <path to encrypted file location> <path to output location> <path t...
""" Fig Leaf: Encrypt and decrypt data with ssh keys! 2017 maryx Usage: 1. Run `pip install pycrypto` 2. To encrypt, run `python fig_leaf.py <path to file location> <path to output location> <path to public key>` 3. To decrypt, run `python fig_leaf.py <path to encrypted file location> <path to output location> <path t...
Python
0.000001
1cbe7b335405e6294fcbca792914932f7226ac9b
Fix entities API
openfisca_web_api/controllers/entities.py
openfisca_web_api/controllers/entities.py
# -*- coding: utf-8 -*- # OpenFisca -- A versatile microsimulation software # By: OpenFisca Team <contact@openfisca.fr> # # Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team # https://github.com/openfisca # # This file is part of OpenFisca. # # OpenFisca is free software; you can redistribute it and/or modify...
# -*- coding: utf-8 -*- # OpenFisca -- A versatile microsimulation software # By: OpenFisca Team <contact@openfisca.fr> # # Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team # https://github.com/openfisca # # This file is part of OpenFisca. # # OpenFisca is free software; you can redistribute it and/or modify...
Python
0.000035
f5e65b648d632f2e75dffe7943ed3e7105b21d7f
Remove GCS patch fixed upstream in te upstream library
core/polyaxon/fs/gcs.py
core/polyaxon/fs/gcs.py
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 ...
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 ...
Python
0
479b414fd3d93bcf6dfabe61494c8e958ea60f08
Rewrite of basic methods for food sort class.
ucrfood/food_sort.py
ucrfood/food_sort.py
from urllib.parse import urlparse, parse_qs, quote from typing import TypeVar, Generic from datetime import datetime from requests import get from hashlib import md5 class FoodSort: url_types = TypeVar('url_types', str, list) def __init__(self, urls: Generic[url_types], check_data: bool): self.__menu...
# Imports: from datetime import datetime from urllib.parse import urlparse, parse_qs, quote from bs4 import BeautifulSoup import requests import uuid import re class FoodSort(object): """ Description: grabs dining hall menu web page and restructures it to an object format. Methods: - _daily_menu_tree ...
Python
0.000001
cb92a3cf67557fbd4a629601490a74bdb2119935
add print_list method to dijkstra
dijkstra.py
dijkstra.py
# -*- coding: utf-8 -*- class Dijkstra: def __init__(self, adj, start): self.adj = adj self.s = start self.dists = [0 for x in range(len(adj))] # Liefert minimales Element > 0 def minweight(self, verts): return min([x for x in verts if x>0]) # Baut liste der Entfernung...
# -*- coding: utf-8 -*- class Dijkstra: def __init__(self, adj, start): self.adj = adj self.s = start self.dists = [0 for x in range(len(adj))] # Liefert minimales Element > 0 def minweight(self, verts): return min([x for x in verts if x>0]) # Baut liste der Entfernung...
Python
0.000001
ed42fa81e1029633f6b6f426c437df0c55262922
Fix LabHubApp.
jupyterlab/labhubapp.py
jupyterlab/labhubapp.py
import os import warnings from traitlets import default from .labapp import LabApp try: from jupyterhub.singleuser import SingleUserNotebookApp except ImportError: SingleUserLabApp = None raise ImportError('You must have jupyterhub installed for this to work.') else: class SingleUserLabApp(SingleUser...
import os from traitlets import default from .labapp import LabApp try: from jupyterhub.singleuser import SingleUserNotebookApp except ImportError: SingleUserLabApp = None raise ImportError('You must have jupyterhub installed for this to work.') else: class SingleUserLabApp(SingleUserNotebookApp, Lab...
Python
0
f4c1093616d08bd4abcb5ddc030b59d863dcec05
Change netapi to use processmanager
salt/client/netapi.py
salt/client/netapi.py
# encoding: utf-8 ''' The main entry point for salt-api ''' # Import python libs import logging import multiprocessing import signal import os # Import salt-api libs import salt.loader import salt.utils.process logger = logging.getLogger(__name__) class NetapiClient(object): ''' Start each netapi module tha...
# encoding: utf-8 ''' The main entry point for salt-api ''' # Import python libs import logging import multiprocessing import signal import os # Import salt-api libs import salt.loader logger = logging.getLogger(__name__) class NetapiClient(object): ''' Start each netapi module that is configured to run ...
Python
0
72b3d998a14388be98c73556df1cd20859a71573
remove invalid data
signal_receive.py
signal_receive.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2013 KuoE0 <kuoe0.tw@gmail.com> # # Distributed under terms of the MIT license. """ """ import tornado.httpserver import tornado.ioloop import tornado.web import serial import signal import sys import json tornado_port = 8888 # create s...
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2013 KuoE0 <kuoe0.tw@gmail.com> # # Distributed under terms of the MIT license. """ """ import tornado.httpserver import tornado.ioloop import tornado.web import serial import signal import sys import json tornado_port = 8888 # create s...
Python
0.001233
32e1ff21562c451ab790c0af077b3760855f1e6b
use slider component for bmi gui
ExPy/ExPy/module19.py
ExPy/ExPy/module19.py
""" BMI Calculator """ from tkinter import HORIZONTAL import rx import tkcomponents def calculate_bmi(weight, height): """ Given weight (pounds), height (inches) Return BMI """ return (weight / (height * height)) * 703. def bmi_recommendation(bmi): """Given a BMI, return a recommendation""" i...
""" BMI Calculator """ import rx import tkcomponents def calculate_bmi(weight, height): """ Given weight (pounds), height (inches) Return BMI """ return (weight / (height * height)) * 703. def bmi_recommendation(bmi): """Given a BMI, return a recommendation""" if bmi < 18.5: return 'Y...
Python
0
89f8d0ebe01e188b5a043dfbf891cf3a3bca0504
Clarify that event is sent up to the master
salt/modules/event.py
salt/modules/event.py
''' Fire events on the minion, events can be fired up to the master ''' # Import salt libs import salt.crypt import salt.utils.event import salt.payload def fire_master(data, tag): ''' Fire an event off up to the master server CLI Example:: salt '*' event.fire_master 'stuff to be in the event' ...
''' Fire events on the minion, events can be fired up to the master ''' # Import salt libs import salt.crypt import salt.utils.event import salt.payload def fire_master(data, tag): ''' Fire an event off on the master server CLI Example:: salt '*' event.fire_master 'stuff to be in the event' 'ta...
Python
0.001957
e6d327a5249e14765999357a391d97c4fd2cd8b8
Test for sitemap.xml
skeleton/tests.py
skeleton/tests.py
from django.core import management from django.test import TestCase as BaseTestCase from django.test.client import Client as BaseClient, FakePayload, \ RequestFactory from django.core.urlresolvers import reverse from post.models import Post from foundry.models import Member class TestCase(BaseTestCase): @cl...
from django.core import management from django.test import TestCase as BaseTestCase from django.test.client import Client as BaseClient, FakePayload, \ RequestFactory from django.core.urlresolvers import reverse from post.models import Post from foundry.models import Member class TestCase(BaseTestCase): @cl...
Python
0.000001
5f962415d401b3c37825d6e3a0560de47ce9ec3d
remove unused code
controller/lib/jubamgr/controller/main.py
controller/lib/jubamgr/controller/main.py
# -*- coding: utf-8 -*- import threading import msgpackrpc from jubavisor.client import Jubavisor from jubavisor.types import ServerArgv from .config import JubaManagerConfig from .zk import get_zk, cancel_if_down class JubaManagerController(): @classmethod def main(cls, args): myself = args.pop(0) # ...
# -*- coding: utf-8 -*- import threading import msgpackrpc from jubavisor.client import Jubavisor from jubavisor.types import ServerArgv from .config import JubaManagerConfig from .zk import get_zk, cancel_if_down class JubaManagerController(): @classmethod def main(cls, args): myself = args.pop(0) # ...
Python
0.000017
eb624f48a259e948f4bc4c33370fe971b19ea19b
Update alert() fn tests according to new signature
tests/alerts/geomodel/test_alert.py
tests/alerts/geomodel/test_alert.py
from datetime import datetime, timedelta from mozdef_util.utilities.toUTC import toUTC from alerts.geomodel.alert import alert import alerts.geomodel.locality as locality class TestAlert: '''Unit tests for alert generation. ''' def test_do_not_alert_when_travel_possible(self): state = locality....
from datetime import datetime, timedelta from mozdef_util.utilities.toUTC import toUTC from alerts.geomodel.alert import alert import alerts.geomodel.locality as locality class TestAlert: '''Unit tests for alert generation. ''' def test_do_not_alert_when_travel_possible(self): state = locality....
Python
0
6312f162eb37ac3e57a18ea80fe201ab08a6ded1
Add Docstring entry for the filter feature of dir_items()
convenience/file_convenience/dir_items.py
convenience/file_convenience/dir_items.py
import os # ============================================================================== # DIR ITEMS # ============================================================================== def dir_items(d, opt="all", rel=True, root="", filter=""): """...
import os # ============================================================================== # DIR ITEMS # ============================================================================== def dir_items(d, opt="all", rel=True, root="", filter=""): """...
Python
0
2eb3a682706a5ff0255474230ec32fd0ac96c727
update mac build script
sansview/setup_mac.py
sansview/setup_mac.py
""" This is a setup.py script partly generated by py2applet Usage: python setup.py py2app """ from setuptools import setup import periodictable.xsf import DataLoader.readers from distutils.sysconfig import get_python_lib import os DATA_FILES = [] RESOURCES_FILES = [] #Periodictable data file DATA_FILES = period...
""" This is a setup.py script partly generated by py2applet Usage: python setup.py py2app """ from setuptools import setup import periodictable.xsf import DataLoader.readers from distutils.sysconfig import get_python_lib import os DATA_FILES = [] RESOURCES_FILES = [] #Periodictable data file DATA_FILES = period...
Python
0
b6c8e38b96293bacd7739411200cd85f47f1efca
handle division by zero
prophet/analyze.py
prophet/analyze.py
from prophet.utils.formatters import dict_to_table import math import numpy as np class Analyzer(object): def __repr__(self): return self.name class Volatility(Analyzer): name = 'volatility' def run(self, backtest, **kwargs): return backtest.get_daily_returns().std() class Sharpe(Ana...
from prophet.utils.formatters import dict_to_table import math import numpy as np class Analyzer(object): def __repr__(self): return self.name class Volatility(Analyzer): name = 'volatility' def run(self, backtest, **kwargs): return backtest.get_daily_returns().std() class Sharpe(Ana...
Python
0.002079
6ddc32c10124d10db53f9017044be65a00a35a33
Add newline to end of __init__.py.
propka/__init__.py
propka/__init__.py
"""PROPKA 3.1 See https://github.com/jensengroup/propka-3.1 for more information. Please cite these PROPKA references in publications: * Sondergaard, Chresten R., Mats HM Olsson, Michal Rostkowski, and Jan H. Jensen. "Improved Treatment of Ligands and Coupling Effects in Empirical Calculation and Rationalization of ...
"""PROPKA 3.1 See https://github.com/jensengroup/propka-3.1 for more information. Please cite these PROPKA references in publications: * Sondergaard, Chresten R., Mats HM Olsson, Michal Rostkowski, and Jan H. Jensen. "Improved Treatment of Ligands and Coupling Effects in Empirical Calculation and Rationalization of ...
Python
0.000005
0560f65eb6740281c77c9b016bd9a44f486be6ae
Use dense matrices instead of sparse where that makes sense
openprescribing/matrixstore/matrix_ops.py
openprescribing/matrixstore/matrix_ops.py
from __future__ import division import numpy import scipy.sparse # Above a certain level of density it becomes more efficient to use a normal # dense matrix instead of a sparse one. This threshold was determined through a # not particularly scientific process of trial and error. Due to the # compression we apply th...
import numpy import scipy.sparse def sparse_matrix(shape, integer=False): """ Create a new sparse matrix (either integer or floating point) in a form suitable for populating with data """ dtype = numpy.int_ if integer else numpy.float_ return scipy.sparse.lil_matrix(shape, dtype=dtype) def f...
Python
0.000011
34f6eef42401590bc1809af68e15992f63736027
Add sensor class for gyroscope uncalibrated
plyer/platforms/android/gyroscope.py
plyer/platforms/android/gyroscope.py
''' Android Gyroscope --------------------- ''' from plyer.facades import Gyroscope from jnius import PythonJavaClass, java_method, autoclass, cast from plyer.platforms.android import activity Context = autoclass('android.content.Context') Sensor = autoclass('android.hardware.Sensor') SensorManager = autoclass('andro...
''' Android Gyroscope --------------------- ''' from plyer.facades import Gyroscope from jnius import PythonJavaClass, java_method, autoclass, cast from plyer.platforms.android import activity Context = autoclass('android.content.Context') Sensor = autoclass('android.hardware.Sensor') SensorManager = autoclass('andro...
Python
0.000001
1185595ea55f4b4be2f227a37b33d8142bcf92c1
bump version to 6.0.0.dev0
stellar_sdk/__version__.py
stellar_sdk/__version__.py
""" _____ _______ ______ _ _ _____ _____ _____ _ __ / ____|__ __| ____| | | | /\ | __ \ / ____| __ \| |/ / | (___ | | | |__ | | | | / \ | |__) |____| (___ | | | | ' / \___ \ | | | __| | | | | / /\ \ | _ /______\___ \| | | | < _...
""" _____ _______ ______ _ _ _____ _____ _____ _ __ / ____|__ __| ____| | | | /\ | __ \ / ____| __ \| |/ / | (___ | | | |__ | | | | / \ | |__) |____| (___ | | | | ' / \___ \ | | | __| | | | | / /\ \ | _ /______\___ \| | | | < _...
Python
0.000004
e589f4347a730abc64f43b3b427ac556643c361f
Use proper mesh
graphs/hydrogen_pfem.py
graphs/hydrogen_pfem.py
R_x = { 0: [5, 7, 10, 16, 18, 22, 28, 34], } R_y = { (1, 0): [0.17076672795968373, 0.043356138894337204, 0.041045532914633254, 0.0058943597765469535, 0.00018759868059159412, 1.7891829137695048e-06, 7.0804719309869313e-09, 6.5346731359383625e-09], (2, 0): [0.044544127593562716, 0.010965171727...
R_x = { 0: [5, 7, 13, 15, 21, 25, 29], } R_y = { (1, 0): [0.1843068472879863, 0.06235603500209852, 0.011111956105256449, 0.00050366115986938409, 7.1562463805907583e-06, 4.0298526238213839e-08, 3.9956294661802616e-08], (2, 0): [0.046105675637867799, 0.013246017078074462, 0.005542485710768652,...
Python
0.000032
9b3fee4f413c02c0b69465fe935b9ea48206191d
Add context to excerpts
conjure/controllers/jujumodel.py
conjure/controllers/jujumodel.py
from conjure.ui.views.jujumodel import (NewModelView, ExistingModelView) from conjure.controllers.deploy import DeployController from conjure.controllers.jujumodels.maas import MaasJujuModelController from conjure.controllers.jujumodels.openstack import OpenStackJujuModelController # noqa from conjure.controllers.juju...
from conjure.ui.views.jujumodel import (NewModelView, ExistingModelView) from conjure.controllers.deploy import DeployController from conjure.controllers.jujumodels.maas import MaasJujuModelController from conjure.controllers.jujumodels.openstack import OpenStackJujuModelController # noqa from conjure.controllers.juju...
Python
0.999997
5ad7dfbea0b85fca283025e09a0dc33b2fbe97a6
switch to the cdn domain
crate_project/settings/production/base.py
crate_project/settings/production/base.py
from ..base import * LOGGING = { "version": 1, "disable_existing_loggers": True, "filters": { "require_debug_false": { "()": "django.utils.log.RequireDebugFalse", }, }, "formatters": { "simple": { "format": "%(levelname)s %(message)s" }, }...
from ..base import * LOGGING = { "version": 1, "disable_existing_loggers": True, "filters": { "require_debug_false": { "()": "django.utils.log.RequireDebugFalse", }, }, "formatters": { "simple": { "format": "%(levelname)s %(message)s" }, }...
Python
0.000001
59833d6a9ef216ae78c4116e6fae8441f1ba5d9c
remove redundants
tests/chainer_tests/functions_tests/activation_tests/test_sigmoid.py
tests/chainer_tests/functions_tests/activation_tests/test_sigmoid.py
import unittest import numpy import chainer from chainer.backends import cuda from chainer import functions from chainer import testing from chainer.testing import attr def _sigmoid(x): half = x.dtype.type(0.5) return numpy.tanh(x * half) * half + half @testing.parameterize(*testing.product({ 'shape':...
import unittest import numpy import chainer from chainer.backends import cuda from chainer import functions from chainer import testing from chainer.testing import attr def _sigmoid(x): half = x.dtype.type(0.5) return numpy.tanh(x * half) * half + half @testing.parameterize(*testing.product({ 'shape':...
Python
0.999999
bbb9d7e65fdff189562d1e2a5cdf4a302e562f3e
Use parameterized test
tests/chainer_tests/functions_tests/math_tests/test_trigonometric.py
tests/chainer_tests/functions_tests/math_tests/test_trigonometric.py
import unittest import numpy import chainer from chainer import cuda import chainer.functions as F from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.testing import condition @testing.parameterize(*testing.product({ 'shape': [(3, 2), ()], })) class Unary...
import unittest import numpy import chainer from chainer import cuda import chainer.functions as F from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.testing import condition class UnaryFunctionsTestBase(object): def make_data(self): raise NotIm...
Python
0.000001
a985f0ac4ef31e534e96319da9980745f5169252
Disable some Pylint errors
tests/integration/modules/pillar.py
tests/integration/modules/pillar.py
# -*- coding: utf-8 -*- # Import Python Libs from distutils.version import LooseVersion # pylint: disable=import-error,no-name-in-module # Import Salt Testing libs from salttesting import skipIf from salttesting.helpers import ( ensure_in_syspath, requires_network ) ensure_in_syspath('../../') # Import salt...
# -*- coding: utf-8 -*- # Import Python Libs from distutils.version import LooseVersion # Import Salt Testing libs from salttesting import skipIf from salttesting.helpers import ( ensure_in_syspath, requires_network ) ensure_in_syspath('../../') # Import salt libs import integration GIT_PYTHON = '0.3.2' HAS...
Python
0.000001
abb72e478fd0bdf5929111d3bc782b94e98819ab
Revert b00b3c4 (but keep addition to allow_failure list in test_valid_docs())
tests/integration/modules/sysmod.py
tests/integration/modules/sysmod.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import import re # Import Salt Testing libs from salttesting.helpers import ensure_in_syspath ensure_in_syspath('../../') # Import salt libs import integration # Import 3rd-party libs import salt.ext.six as six class SysModuleTest(integr...
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import import re # Import Salt Testing libs from salttesting.helpers import ensure_in_syspath ensure_in_syspath('../../') # Import salt libs import integration # Import 3rd-party libs import salt.ext.six as six class SysModuleTest(integr...
Python
0
c98ef2e8b64b7daa94c0e883f71813a3e3226a78
set current day to none if there is none
riskgame/context_processors.py
riskgame/context_processors.py
# -*- coding: utf-8 from riskgame.models import Player, TeamPlayer, EpisodeDay, Game def player(request): returnDict = {} if request.user.is_authenticated(): try: currentPlayer = Player.objects.get(user=request.user) except Player.DoesNotExist: currentPlayer = Playe...
# -*- coding: utf-8 from riskgame.models import Player, TeamPlayer, EpisodeDay, Game def player(request): returnDict = {} if request.user.is_authenticated(): try: currentPlayer = Player.objects.get(user=request.user) except Player.DoesNotExist: currentPlayer = Playe...
Python
0.020175
734c7c9ad2d1290a202e48ebb5535a0bc371bd75
fix iarc constant test
mkt/constants/tests/test_ratingsbodies.py
mkt/constants/tests/test_ratingsbodies.py
from contextlib import contextmanager from nose.tools import eq_ from tower import activate import amo.tests import mkt.constants.ratingsbodies as ratingsbodies class TestRatingsBodies(amo.tests.TestCase): def test_all_ratings_waffle_off(self): ratings = ratingsbodies.ALL_RATINGS() # Assert o...
from contextlib import contextmanager from nose.tools import eq_ from tower import activate import amo.tests import mkt.constants.ratingsbodies as ratingsbodies class TestRatingsBodies(amo.tests.TestCase): def test_all_ratings_waffle_off(self): ratings = ratingsbodies.ALL_RATINGS() # Assert o...
Python
0.000002
7bb6ac8e1d6e742c2c02c3cc489ea350175dc8cd
Refactor source grab's try/catch
vizydrop/rest/base.py
vizydrop/rest/base.py
from http.client import INTERNAL_SERVER_ERROR import json from vizydrop.rest import VizydropAppRequestHandler from vizydrop.sdk.source import StreamingDataSource from tornado.gen import coroutine from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPError from . import TpaHandlerMixin class BaseHandler(Vi...
from http.client import INTERNAL_SERVER_ERROR import json from vizydrop.rest import VizydropAppRequestHandler from vizydrop.sdk.source import StreamingDataSource from tornado.gen import coroutine from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPError from . import TpaHandlerMixin class BaseHandler(Vi...
Python
0
546d4ac0bbf14da2bc5610aa09b5a75627b297a6
Add 131
100_to_199/euler_131.py
100_to_199/euler_131.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Problem 131 There are some prime values, p, for which there exists a positive integer, n, such that the expression n3 + n2p is a perfect cube. For example, when p = 19, 83 + 82×19 = 123. What is perhaps most surprising is that for each prime with this property the val...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Problem 131 There are some prime values, p, for which there exists a positive integer, n, such that the expression n3 + n2p is a perfect cube. For example, when p = 19, 83 + 82×19 = 123. What is perhaps most surprising is that for each prime with this property the val...
Python
0.999937
6e04d3ab8a6d967c14afaf45869152c93d94d1ec
Refactor remote URI formatting functions
gutenberg/textsource.py
gutenberg/textsource.py
"""Module providing implementations of the api.TextSource interface.""" from __future__ import absolute_import from . import beautify from . import api from .common import wget import itertools import logging import os import rdflib import tarfile def _is_legacy_uid(uid): return 0 < uid < 10 def _format_uri(u...
"""Module providing implementations of the api.TextSource interface.""" from __future__ import absolute_import from . import beautify from . import api from .common import wget import itertools import logging import os import rdflib import tarfile class GutenbergEbooks(api.TextSource): """Implementation of api....
Python
0
10318a11dded5e69c3d9c98325613700c9b3db63
Fix for dependent package detection.
lib/spack/spack/cmd/dependents.py
lib/spack/spack/cmd/dependents.py
############################################################################## # Copyright (c) 2013, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 ...
Python
0
4f3c3755d9fcbfd9ce0551c19bb893e7ba73db91
Add missing setup.py
numpy/numarray/setup.py
numpy/numarray/setup.py
from os.path import join def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('numarray',parent_package,top_path) config.add_data_files('include/numarray/*.h') # Configure fftpack_lite config.add_extension('_capi', ...
Python
0.000003
735ce7f11b70bf8e916bad5610093b5886c57db6
Add quickseg.py
cyvlfeat/quickshift/quickseg.py
cyvlfeat/quickshift/quickseg.py
import numpy as np from cyvlfeat.quickshift import quickshift from cyvlfeat.quickshift import flatmap from cyvlfeat.quickshift import imseg def quickseg(image, ratio, kernel_size, max_dist): """ Produce a quickshift segmentation of a greyscale image. Parameters ---------- image : [H, W] or [H, W,...
Python
0
766569894a5c849c449971aca5c7d999e7019aef
check required packages
check_packages.py
check_packages.py
""" Checking and reinstalling the external packages """ import os import sys if sys.platform =='win32': IS_WIN = True else: IS_WIN = False try: import setuptools print "==> setuptools-%s installed."% setuptools.__version__ #if setuptools.__version__ != '0.6c11': # print "!!! Recommend to inst...
Python
0
8080128d2ca5718ac971160bf964c3ca73b235b7
add downloader
operators/downloader.py
operators/downloader.py
import os from drivers import driver from file_utils import file_util class Downloader(object): def __init__(self, server_driver): """Init a Uploader object Args: server_driver: a driver already connected to cloud service """ if not issubclass(driver.Driver, driver.Dr...
Python
0.000001
49071cbeda14133019b0969e7499ea8f26cdb1cf
Create OogOrderedSet.py
OogOrderedSet.py
OogOrderedSet.py
# -*- coding: utf8-*- # coding: utf-8 __author__ = "Dominique Dutoit" __date__ = "$5 march 2014$" from collections import MutableSet class OrderedSet(MutableSet): def __init__(self, iterable=None): self.end = end = [] end += [None, end, end] # sentinel node for doubly linked list self.map = {} # key -->...
Python
0
5be32f4022135a10585cf094b6fb8118dd87a2f6
Add files via upload (#396)
ciphers/Atbash.py
ciphers/Atbash.py
def Atbash(): inp=raw_input("Enter the sentence to be encrypted ") output="" for i in inp: extract=ord(i) if extract>=65 and extract<=90: output+=(unichr(155-extract)) elif extract>=97 and extract<=122: output+=(unichr(219-extract)) else: ...
Python
0
8d1016437e87794fb39b447b51427bae98a51bc2
Add one public IP provider
classes/jsonip.py
classes/jsonip.py
from json import load from urllib2 import urlopen class JsonIp: def __init__(self): url = 'https://jsonip.com/' uri = urlopen(url) response = load(uri) self.ip = response["ip"] # self.ip = '1.1.1.1'
Python
0
b1be1bbf785406f4d286c7eb85ea459309ea03a2
Fix file hierarchy.
batch_image_resizer2/batch_image_resizer.py
batch_image_resizer2/batch_image_resizer.py
"""Resize images in a folder using imagemagick command line tools. http://hakanu.net """ import glob import os def main(): print 'Started' images = glob.glob("/home/h/Desktop/all_karikatur_resized/*.jpg") counter = 0 for image in images: print 'Processing: ', image index = image[image.rfind('/') + 1:...
Python
0
6cbc9230e241511ccc922eb179f62e08db78bf14
1689. Partitioning Into Minimum Number Of Deci-Binary Numbers
LeetCode/PartitioningIntoMinimumNumberOfDeciBinaryNumbers.py
LeetCode/PartitioningIntoMinimumNumberOfDeciBinaryNumbers.py
""" a convoluted way of describing finding the biggest decimal digit :D """ class Solution: def minPartitions(self, n: str) -> int: return max(int(d) for d in str(n))
Python
0.999999
3b9d85b9b41636a43821b0551e7162894131cbf5
add new file for clusterisation
clusterisation.py
clusterisation.py
import sys import os import random import math import statistics from collections import namedtuple from fasta import * from fastq import * from log_progress import * Read = namedtuple('Read', 'index seq qual') def replace_low_quality(data, q_threshold): res = '' for nuc, q in zip(data.seq, data.qual): ...
Python
0
19ca3a0a16b321f0b5caadb09a3db78d857c4d0c
Create jrcsv2gncsv.py
jrcsv2gncsv.py
jrcsv2gncsv.py
''' Created on Feb 3, 2014 This code converts from the klm like hierarchical csv format used by junar open data platform to a flat csv format. The script reads in a junar csv and emits a standard csv, paths given by fnamein and fnameout Code tested with Sacramento Cites locations-of-city-trees.csv and PARKI-SPACE.csv...
Python
0.000001