commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
6fc70b971bc0c049b2e9649d6146911510c0126f | Fix flake8. | GoogleCloudPlatform/PerfKitBenchmarker,syed/PerfKitBenchmarker,ksasi/PerfKitBenchmarker,ksasi/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,mateusz-blaszkowski/PerfKitBenchmarker,lleszczu/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,meteorfox/PerfKitBenchmarker,syed/PerfKitBenchmarker,AdamIsrae... | perfkitbenchmarker/packages/unixbench.py | perfkitbenchmarker/packages/unixbench.py | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | apache-2.0 | Python |
b67349b997eea31cd80e471ecf84a5544353b128 | Indent correction in PyCharm | urda/nistbeacon | nist_randomness_beacon.py | nist_randomness_beacon.py | #! /usr/bin/env python
NIST_BASE_URL = "https://beacon.nist.gov/rest/record"
class NistBeaconValue(object):
def __init__(
self,
version: str,
frequency: int,
timestamp: int,
seed_value: str,
previous_output_value: str,
signature_... | #! /usr/bin/env python
NIST_BASE_URL = "https://beacon.nist.gov/rest/record"
class NistBeaconValue(object):
def __init__(
self,
version: str,
frequency: int,
timestamp: int,
seed_value: str,
previous_output_value: str,
signature_... | apache-2.0 | Python |
d918c5e28bc2505407cc3245ecae378bdb97ba19 | Use raw_id_fields for the relation from RegistrationProfile to User, for sites which have huge numbers of users. | sandipagr/django-registration,myimages/django-registration,euanlau/django-registration,Troyhy/django-registration,kennydude/djregs,spurfly/django-registration,futurecolors/django-registration,hacklabr/django-registration,futurecolors/django-registration,awakeup/django-registration,sandipagr/django-registration,akvo/dja... | registration/admin.py | registration/admin.py | from django.contrib import admin
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
raw_id_fields = ['user']
search_fields = ('user__username', 'user__first_name')
admin.site.register(RegistrationProfil... | from django.contrib import admin
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
search_fields = ('user__username', 'user__first_name')
admin.site.register(RegistrationProfile, RegistrationAdmin)
| bsd-3-clause | Python |
3e0a04ab9138bc948ae8750325c9022a2e501ab1 | Exit main thread if no actors are running | bencevans/mopidy,jodal/mopidy,hkariti/mopidy,mopidy/mopidy,vrs01/mopidy,ZenithDK/mopidy,swak/mopidy,tkem/mopidy,tkem/mopidy,mopidy/mopidy,kingosticks/mopidy,bacontext/mopidy,vrs01/mopidy,ZenithDK/mopidy,hkariti/mopidy,swak/mopidy,diandiankan/mopidy,bencevans/mopidy,jodal/mopidy,SuperStarPL/mopidy,adamcik/mopidy,kingost... | mopidy/core.py | mopidy/core.py | import logging
import optparse
import time
from pykka.registry import ActorRegistry
from mopidy import get_version, settings, OptionalDependencyError
from mopidy.utils import get_class
from mopidy.utils.log import setup_logging
from mopidy.utils.path import get_or_create_folder, get_or_create_file
from mopidy.utils.p... | import logging
import optparse
import time
from pykka.registry import ActorRegistry
from mopidy import get_version, settings, OptionalDependencyError
from mopidy.utils import get_class
from mopidy.utils.log import setup_logging
from mopidy.utils.path import get_or_create_folder, get_or_create_file
from mopidy.utils.p... | apache-2.0 | Python |
2298d4345d41aad60075c26ab0d3ac9146db6c2b | Add docstrings to test_backends | incuna/django-user-management,incuna/django-user-management | user_management/models/tests/test_backends.py | user_management/models/tests/test_backends.py | from django.test import TestCase
from ..backends import CaseInsensitiveEmailBackend
from .factories import UserFactory
class CaseInsensitveEmailBackendTest(TestCase):
def test_authenticate(self):
"""
Check case-insensitive username authentication
"""
email = 'test-Email@example.c... | from django.test import TestCase
from ..backends import CaseInsensitiveEmailBackend
from .factories import UserFactory
class CaseInsensitveEmailBackendTest(TestCase):
def test_authenticate(self):
email = 'test-Email@example.com'
password = 'arandomsuperstrongpassword'
user = UserFactory.... | bsd-2-clause | Python |
b42003c15132f8e5874f1b5e8a7133b813a71aaa | Allow raw queries to annotations bucket | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | backdrop/read/config/development.py | backdrop/read/config/development.py | DATABASE_NAME = "backdrop"
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
LOG_LEVEL = "DEBUG"
RAW_QUERIES_ALLOWED = {
"licensing_journey": True,
"government_annotations": True,
}
| DATABASE_NAME = "backdrop"
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
LOG_LEVEL = "DEBUG"
RAW_QUERIES_ALLOWED = {
"licensing_journey": True
}
| mit | Python |
0b1123c90457d5a657224d7241459c0cc92e5c65 | Add lpa and hmrc to bucket access | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | backdrop/read/config/development.py | backdrop/read/config/development.py | DATABASE_NAME = "backdrop"
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
LOG_LEVEL = "DEBUG"
RAW_QUERIES_ALLOWED = {
"government_annotations": True,
"govuk_realtime": True,
"licence_finder_monitoring": True,
"licensing": False,
"licensing_journey": True,
"licensing_monitoring": True,
"licensing_realtime": T... | DATABASE_NAME = "backdrop"
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
LOG_LEVEL = "DEBUG"
RAW_QUERIES_ALLOWED = {
"government_annotations": True,
"govuk_realtime": True,
"licence_finder_monitoring": True,
"licensing": False,
"licensing_journey": True,
"licensing_monitoring": True,
"licensing_realtime": T... | mit | Python |
9d0ee773873764ab75802e51f6c85d40a800b2af | make python events actually work | andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin | src/python/m5/event.py | src/python/m5/event.py | # Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | # Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | bsd-3-clause | Python |
58945cca491316ca37f4e73a82af3e0882b43a5b | bump version | nluedtke/brochat-bot | common.py | common.py | VERSION_YEAR = 2018
VERSION_MONTH = 6
VERSION_DAY = 7
VERSION_REV = 0
whos_in = None
twitter = None
users = {}
twilio_client = None
ARGS = {}
smmry_api_key = None
pubg_api_key = None
pubg_api = None
# Variable hold trumps last tweet id
last_id = 0
trump_chance_roll_rdy = False
# Runtime stats
duels_conducted = 0
ite... | VERSION_YEAR = 2018
VERSION_MONTH = 6
VERSION_DAY = 5
VERSION_REV = 0
whos_in = None
twitter = None
users = {}
twilio_client = None
ARGS = {}
smmry_api_key = None
pubg_api_key = None
pubg_api = None
# Variable hold trumps last tweet id
last_id = 0
trump_chance_roll_rdy = False
# Runtime stats
duels_conducted = 0
ite... | mit | Python |
5b07448cf12460090af588b332e813af3419d645 | make python events actually work | gedare/gem5,gem5/gem5,samueldotj/TeeRISC-Simulator,gedare/gem5,markoshorro/gem5,joerocklin/gem5,briancoutinho0905/2dsampling,gem5/gem5,powerjg/gem5-ci-test,rallylee/gem5,rjschof/gem5,sobercoder/gem5,samueldotj/TeeRISC-Simulator,SanchayanMaity/gem5,TUD-OS/gem5-dtu,aclifton/cpeg853-gem5,yb-kim/gemV,joerocklin/gem5,zlfben... | src/python/m5/event.py | src/python/m5/event.py | # Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | # Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | bsd-3-clause | Python |
6b5ffe350b2247d499f86f833398dd8de9ed7a71 | Fix logic error in add_drink | nluedtke/brochat-bot | common.py | common.py | VERSION_YEAR = 2017
VERSION_MONTH = 9
VERSION_DAY = 5
VERSION_REV = 1
whos_in = None
twitter = None
users = {}
twilio_client = None
# Variable hold trumps last tweet id
last_id = 0
trump_chance_roll_rdy = False
# Runtime stats
duels_conducted = 0
items_awarded = 0
trump_tweets_seen = 0
# Shot_duel acceptance and ac... | VERSION_YEAR = 2017
VERSION_MONTH = 9
VERSION_DAY = 5
VERSION_REV = 1
whos_in = None
twitter = None
users = {}
twilio_client = None
# Variable hold trumps last tweet id
last_id = 0
trump_chance_roll_rdy = False
# Runtime stats
duels_conducted = 0
items_awarded = 0
trump_tweets_seen = 0
# Shot_duel acceptance and ac... | mit | Python |
660ccd202e627cc8938a47532c7607edc676963f | fix for YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. | royrapoport/destalinator,royrapoport/destalinator,randsleadershipslack/destalinator,randsleadershipslack/destalinator | config.py | config.py | #! /usr/bin/env python
import os
import yaml
from utils.with_logger import WithLogger
class Config(WithLogger):
config_fname = "configuration.yaml"
def __init__(self, config_fname=None):
config_fname = config_fname or self.config_fname
fo = open(config_fname, "r")
blob = fo.read()
... | #! /usr/bin/env python
import os
import yaml
from utils.with_logger import WithLogger
class Config(WithLogger):
config_fname = "configuration.yaml"
def __init__(self, config_fname=None):
config_fname = config_fname or self.config_fname
fo = open(config_fname, "r")
blob = fo.read()
... | apache-2.0 | Python |
716697eb1942ed34243c3fd23f072b14b9e75925 | Add DiffLexer | alexwlchan/pygmentizr,alexwlchan/pygmentizr | config.py | config.py | # -*- encoding, utf-8 -*-
from collections import OrderedDict
WTF_CSRF_ENABLED = True
SECRET_KEY = 'Pygments is a generic syntax highlighter'
# Select the lexers to be exposed in the interface
from pygments.lexers import *
SELECTED_LEXERS = OrderedDict([
('Python', PythonLexer),
('Python console', ... | # -*- encoding, utf-8 -*-
from collections import OrderedDict
WTF_CSRF_ENABLED = True
SECRET_KEY = 'Pygments is a generic syntax highlighter'
# Select the lexers to be exposed in the interface
from pygments.lexers import *
SELECTED_LEXERS = OrderedDict([
('Python', PythonLexer),
('Python console', ... | mit | Python |
1210f2b27a853ced9c9d4f297549b60a471f7d2a | Add config entry for Teli API token | tuxxy/SMIRCH | config.py | config.py | from os import urandom
from base64 import b64encode
class Config():
SECRET_KEY = b64encode(urandom(66)).decode('utf-8')
SESSION_KEY_BITS = 256
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:test123@localhost/smirch'
TELI_TOKEN = ""
| from os import urandom
from base64 import b64encode
class Config():
SECRET_KEY = b64encode(urandom(66)).decode('utf-8')
SESSION_KEY_BITS = 256
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:test123@localhost/smirch'
| agpl-3.0 | Python |
cc903819db1a06d2d7f5a06c3f506a98b6772585 | add configuration for aws s3 | happyraul/tv | config.py | config.py | import os
from settings import environment
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = environment['SECRET_KEY']
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
TV_MAIL_SUBJECT_PREFIX = '[Snow Day]'
TV_MAIL_SENDER = 'Snow Day Admin <admin@snow-day.com>'
TV_ADMIN = environm... | import os
from settings import environment
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = environment['SECRET_KEY']
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
TV_MAIL_SUBJECT_PREFIX = '[Snow Day]'
TV_MAIL_SENDER = 'Snow Day Admin <admin@snow-day.com>'
TV_ADMIN = environm... | apache-2.0 | Python |
c1ba26b97a13273912abe847b4b2bca88858d17f | Allow DB URI to be set via ENV | steven-hadfield/dpxdt,weeksghost/dpxdt,mabushadi/dpxdt,steven-hadfield/dpxdt,steven-hadfield/dpxdt,ygravrand/dpxdt,gBritz/dpxdt,gBritz/dpxdt,mabushadi/dpxdt,bslatkin/dpxdt,weeksghost/dpxdt,ygravrand/dpxdt,Medium/dpxdt,steven-hadfield/dpxdt,Medium/dpxdt,weeksghost/dpxdt,mabushadi/dpxdt,ygravrand/dpxdt,Medium/dpxdt,gBrit... | config.py | config.py | #!/usr/bin/env python
# Copyright 2013 Brett Slatkin
#
# 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 o... | #!/usr/bin/env python
# Copyright 2013 Brett Slatkin
#
# 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 o... | apache-2.0 | Python |
32ce73328d7644601a848cf5ac6d0de1242eb900 | Use constant secret key for easier debugging | citruspi/Alexandria,citruspi/Alexandria | config.py | config.py | class Config(object):
DEBUG = False
SECRET_KEY = 'CHANGEME'
TEMP_DIR = 'tmp'
LIB_DIR = 'books'
MONGO = {
'HOST' : 'localhost',
'PORT' : 27017,
'DATABASE' : 'Alexandria'
}
class Debug(Config):
DEBUG=True
| import os
class Config(object):
DEBUG = False
SECRET_KEY = os.urandom(30).encode('hex')
TEMP_DIR = 'tmp'
LIB_DIR = 'books'
MONGO = {
'HOST' : 'localhost',
'PORT' : 27017,
'DATABASE' : 'Alexandria'
}
class Debug(Config):
DEBUG=True
| mit | Python |
535cf7c5bf4a2faac7b8dee7aafa5499af4aec8b | Make Python 3 compatible. | TC01/cplink,TC01/cplink | cplink.py | cplink.py | #!/usr/bin/env python
"""
cplink
Basically, it does what it says on the tin. Example:
a ==> b
cplink b:
rm b
cp -r a/ b/
So, it unlinks two things but replaces the link with the original source.
"""
import argparse
import os
import shutil
import sys
def cplink(directory, verbose=False):
current = os.getcwd()
... | #!/usr/bin/env python
"""
cplink
Basically, it does what it says on the tin. Example:
a ==> b
cplink b:
rm b
cp -r a/ b/
So, it unlinks two things but replaces the link with the original source.
"""
import argparse
import os
import shutil
import sys
def cplink(directory, verbose=False):
current = os.getcwd()
... | mit | Python |
2e0f9052bd626845ba995b5a637544b8d9dfeb62 | change some var names in json stuff - which hg had amend | markdrago/caboose | src/results_package.py | src/results_package.py | import json
class ResultsPackage(object):
def __init__(self):
self.results = {}
self.statnames = []
def add_result(self, date, name, result):
if date not in self.results:
self.results[date] = {}
if name not in self.statnames:
self.statnames.append(n... | import json
class ResultsPackage(object):
def __init__(self):
self.results = {}
self.statnames = []
def add_result(self, date, name, result):
if date not in self.results:
self.results[date] = {}
if name not in self.statnames:
self.statnames.append(n... | mit | Python |
de627ccbefbb47ed90a3ee0177fe0ac8de9bd963 | fix --dump-timing= on py3, wants a text-mode file | warner/magic-wormhole,warner/magic-wormhole,warner/magic-wormhole,warner/magic-wormhole | src/wormhole/timing.py | src/wormhole/timing.py | from __future__ import print_function, absolute_import
import json, time
class Event:
def __init__(self, name, when, **details):
# data fields that will be dumped to JSON later
self._name = name
self._start = time.time() if when is None else float(when)
self._stop = None
sel... | from __future__ import print_function, absolute_import
import json, time
class Event:
def __init__(self, name, when, **details):
# data fields that will be dumped to JSON later
self._name = name
self._start = time.time() if when is None else float(when)
self._stop = None
sel... | mit | Python |
3052651c7965d1440e044571edc52267fc726b3b | fix test | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | test/pipelines/test_pacbio_qc.py | test/pipelines/test_pacbio_qc.py | from sequana import SequanaConfig, sequana_data
from easydev import shellcmd
import subprocess
import json
import os
import tempfile
from .common import Pipeline
class PacbioQCPipeline(Pipeline):
def __init__(self, wk=None):
super(PacbioQCPipeline, self).__init__(wk=wk)
# Define the data
... | from sequana import SequanaConfig, sequana_data
from easydev import shellcmd
import subprocess
import json
import os
import tempfile
from .common import Pipeline
class PacbioQCPipeline(Pipeline):
def __init__(self, wk=None):
super(PacbioQCPipeline, self).__init__(wk=wk)
# Define the data
... | bsd-3-clause | Python |
d9b901d53bcf48ef5ff7c6072f52f128c2a619ae | Revise a file | shodimaggio/piavatar_ros,shodimaggio/piavatar_ros | test/travis_test_lightsensors.py | test/travis_test_lightsensors.py | #!/usr/bin/env python
#encoding: utf8
import unittest, rostest
import rosnode, rospy
import time
from piavatar_ros.msg import LightSensorValues
class LightSensorTest(unittest.TestCase):
def setUp(self):
self.count = 0
rospy.Subscriber('/lightsensors', LightSensorValues, self.callback)
self.va... | #!/usr/bin/env python
#encoding: utf8
import unittest, rostest
import rosnode, rospy
import time
from piavatar_ros.msg import LightSensorValues
class LightSensorTest(unittest.TestCase):
def setUp(self):
self.count = 0
rospy.Subscriber('/lightsensors', LightSensorValues, self.callback)
self.va... | bsd-3-clause | Python |
0d58d7c7a3eee8748efbf7405aba7a5f3e0f7eb3 | Add some search fields to Zaad | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/funding_telesom/admin.py | bluebottle/funding_telesom/admin.py | from django.contrib import admin
from bluebottle.funding.admin import PaymentChildAdmin, PaymentProviderChildAdmin, BankAccountChildAdmin
from bluebottle.funding.models import PaymentProvider, Payment
from bluebottle.funding_telesom.models import TelesomPayment, TelesomPaymentProvider, TelesomBankAccount
@admin.regi... | from django.contrib import admin
from bluebottle.funding.admin import PaymentChildAdmin, PaymentProviderChildAdmin, BankAccountChildAdmin
from bluebottle.funding.models import PaymentProvider, Payment
from bluebottle.funding_telesom.models import TelesomPayment, TelesomPaymentProvider, TelesomBankAccount
@admin.regi... | bsd-3-clause | Python |
1ab7c478c5a81c30b9e0fcfaf185d557a9f1f7a7 | Read more catagories. Found some averages. | RedRocksCommunityCollege/Clair-Global-Collab | Tests/Data-from-csv-Adam.py | Tests/Data-from-csv-Adam.py | import numpy as np
import pandas as pd
df = pd.read_csv("/home/adam/GitHub/RedRocksCommunityCollege/Clair-Global-Collab/Data/Test_Data/RECS2009/recs2009_public.csv")
TOTALRooms = df.TOTROOMS
BEDRooms = df.BEDROOMS
Game1 = df.PLAYSTA1
Game2 = df.PLAYSTA2
Game3 = df.PLAYSTA3
TVNum = df.TVCOLOR
NumHouseMem = df.NHSLDMEM... | import numpy as np
import pandas as pd
df = pd.read_csv("/home/adam/GitHub/RedRocksCommunityCollege/Clair-Global-Collab/Data/Test_Data/RECS2009/recs2009_public.csv")
Rooms = df.TOTROOMS
Game1 = df.PLAYSTA1
Game2 = df.PLAYSTA2
Game3 = df.PLAYSTA3
Rooms.mean()
Houses = np.array([[0,0,0,0]]) # Make an empty array. We ... | mit | Python |
f41283083dad318ec0560027af4a2ab87841b588 | Fix ForeignKey references to Client model with Application | mjrulesamrat/django-oauth-toolkit,Gr1N/django-oauth-toolkit,JensTimmerman/django-oauth-toolkit,natgeo/django-oauth-toolkit,bleib1dj/django-oauth-toolkit,DeskConnect/django-oauth-toolkit,DeskConnect/django-oauth-toolkit,StepicOrg/django-oauth-toolkit,Gr1N/django-oauth-toolkit,cheif/django-oauth-toolkit,trbs/django-oauth... | oauth2_provider/models.py | oauth2_provider/models.py | from django.db import models
from django.conf import settings
from django.utils.translation import ugettext as _
class Application(models.Model):
"""
"""
CLIENT_CONFIDENTIAL = 'confidential'
CLIENT_PUBLIC = 'public'
CLIENT_TYPES = (
(CLIENT_CONFIDENTIAL, _('Confidential')),
(CLIE... | from django.db import models
from django.conf import settings
from django.utils.translation import ugettext as _
class Application(models.Model):
"""
"""
CLIENT_CONFIDENTIAL = 'confidential'
CLIENT_PUBLIC = 'public'
CLIENT_TYPES = (
(CLIENT_CONFIDENTIAL, _('Confidential')),
(CLIE... | bsd-2-clause | Python |
4fe4bdfeaa6445bf93888c8a6b03d703c8214955 | remove depricated duplicate code | kadrlica/obztak | obztak/utils/constants.py | obztak/utils/constants.py | """
Constants.
"""
import ephem
from collections import OrderedDict as odict
import numpy as np
# Plotting DECam
DECAM=1.1 # DECam radius (deg)
# Marker size depends on figsize and DPI
FIGSIZE=(10.5,8.5)
SCALE=np.sqrt((8.0*6.0)/(FIGSIZE[0]*FIGSIZE[1]))
DPI=80;
# LMC and SMC
RA_LMC = 80.8939
DEC_LMC = -69.7561
RADIUS_... | """
Constants.
"""
import ephem
from collections import OrderedDict as odict
import numpy as np
# Plotting DECam
DECAM=1.1 # DECam radius (deg)
# Marker size depends on figsize and DPI
FIGSIZE=(10.5,8.5)
SCALE=np.sqrt((8.0*6.0)/(FIGSIZE[0]*FIGSIZE[1]))
DPI=80;
# LMC and SMC
RA_LMC = 80.8939
DEC_LMC = -69.7561
RADIUS_... | mit | Python |
e0e8f045fe39976fb6b6e2794d4d4ff40e3d9330 | Change the onchange condition. (#1582) | avanzosc/odoo-addons,avanzosc/odoo-addons | custom_saca_purchase/models/saca_line.py | custom_saca_purchase/models/saca_line.py | # Copyright 2022 Berezi Amubieta - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class SacaLine(models.Model):
_inherit = "saca.line"
purchase_order_id = fields.Many2one(
string="Purchase Order",
comodel_name="purchase.orde... | # Copyright 2022 Berezi Amubieta - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class SacaLine(models.Model):
_inherit = "saca.line"
purchase_order_id = fields.Many2one(
string="Purchase Order",
comodel_name="purchase.orde... | agpl-3.0 | Python |
a2d32a49d2fee269243282ca155363c629d90b96 | split the licensee code and name into two fields, also cleaned a few things up | kevinmarsh/opencorporates | confidential_well_sources/scraper.py | confidential_well_sources/scraper.py | # -*- coding: utf-8 -*-
import json
import datetime
import re
import requests
import turbotlib
turbotlib.log('Starting run...')
source_url = 'http://www.aer.ca/data/conwell/ConWell.txt'
response = requests.get(source_url, timeout=20)
# So this is a plain text file, not delineated at all, luckily they have
# a semi... | # -*- coding: utf-8 -*-
import json
import datetime
import re
import requests
import turbotlib
turbotlib.log("Starting run...")
source_url = "http://www.aer.ca/data/conwell/ConWell.txt"
response = requests.get(source_url, timeout=20)
# So this is a plain text file, not delineated at all, luckily they have
# a semi... | mit | Python |
99eeef5aa21cdbf07d6b4c9d9e7bada4f400a89b | Add Meta classes to Arkisto models | Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org | Instanssi/arkisto/models.py | Instanssi/arkisto/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.contrib import admin
class Tag(models.Model):
name = models.CharField('Tag', max_length=32)
def __unicode__(self):
return self.name
class Meta:
verbose_name=u"tagi"
verbose_name_plural=u"tagit"
class Eve... | # -*- coding: utf-8 -*-
from django.db import models
from django.contrib import admin
class Tag(models.Model):
name = models.CharField('Tag', max_length=32)
def __unicode__(self):
return self.name
class Event(models.Model):
name = models.CharField('Nimi', max_length=32)
date = mod... | mit | Python |
11c7e620f44c9526d3d2213fb0ce2699a9547b9e | update streaming config for pi | vtsatskin/lightbox,vtsatskin/lightbox,vtsatskin/lightbox | Box/reading_stream.py | Box/reading_stream.py | import serial
import logging
import sys
import json
import couchdb
import time
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
SERIAL_HANDLE='/dev/ttyACM0'
RATE=9600
logging.info("Opening connection to %s at rate of %i", SERIAL_HANDLE, RATE)
ser = serial.Serial(SERIAL_HANDLE, RATE)
couch = couchdb.Server... | import serial
import logging
import sys
import json
import couchdb
import time
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
SERIAL_HANDLE='/dev/cu.usbmodem1451'
RATE=9600
logging.info("Opening connection to %s at rate of %i", SERIAL_HANDLE, RATE)
ser = serial.Serial(SERIAL_HANDLE, RATE)
couch = couch... | mit | Python |
ef391aa95c259983f2f3d1672b14cb6297f59fd2 | change default to map | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | apps/mapideas/views.py | apps/mapideas/views.py | import django_filters
from django.contrib import messages
from django.utils.translation import ugettext as _
from adhocracy4.maps import mixins as map_mixins
from adhocracy4.modules import views as module_views
from apps.contrib import filters
from . import forms
from . import models
def get_ordering_choices(reque... | import django_filters
from django.contrib import messages
from django.utils.translation import ugettext as _
from adhocracy4.maps import mixins as map_mixins
from adhocracy4.modules import views as module_views
from apps.contrib import filters
from . import forms
from . import models
def get_ordering_choices(reque... | agpl-3.0 | Python |
c87d633e005a860f5dac67945419c7080cbdffdc | Remove some hardcoded messages from client. | CheeseLord/warts,CheeseLord/warts | src/test_echoclient.py | src/test_echoclient.py | #!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from __future__ import print_function
import os
from twisted.internet import task, stdio, reactor
from twisted.internet.defer import Deferred
from twisted.internet.protocol import ClientFactory
from twisted.protocols.basic ... | #!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from __future__ import print_function
import os
from twisted.internet import task, stdio, reactor
from twisted.internet.defer import Deferred
from twisted.internet.protocol import ClientFactory
from twisted.protocols.basic ... | mit | Python |
1dcda1aa897f9d4a112ae4a690616865187966d2 | add failing test for unicode in destination names | STOP2/stop2.0-backend,STOP2/stop2.0-backend | src/tests/test_stop.py | src/tests/test_stop.py | import unittest
import stop
class TestStopRoutes(unittest.TestCase):
def setUp(self):
stop.app.config['TESTING'] = True
self.app = stop.app.test_client()
def test_stops_get(self):
response = self.app.get('/stops?lat=1.0&lon=2.0')
self.assertEqual(response.status_code, 200)
... | import unittest
import stop
class TestStopRoutes(unittest.TestCase):
def setUp(self):
stop.app.config['TESTING'] = True
self.app = stop.app.test_client()
def test_stops_get(self):
response = self.app.get('/stops?lat=1.0&lon=2.0')
self.assertEqual(response.status_code, 200)
... | mit | Python |
c2edb73438c704fe894197a5313758ce61fb1f05 | Remove unused order components (#405) | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | zeus/api/resources/repository_test_history.py | zeus/api/resources/repository_test_history.py | from flask import request
from zeus.config import db
from zeus.constants import Result
from zeus.db.func import array_agg_row
from zeus.models import Job, Build, Repository, TestCase
from .base_repository import BaseRepositoryResource
from ..schemas import AggregateTestCaseSummarySchema
class RepositoryTestHistoryR... | from flask import request
from sqlalchemy.dialects.postgresql import array_agg
from zeus.config import db
from zeus.constants import Result
from zeus.db.func import array_agg_row
from zeus.models import Job, Build, Repository, TestCase
from .base_repository import BaseRepositoryResource
from ..schemas import Aggregat... | apache-2.0 | Python |
1c5a76a181210f1abfda4b594fffc612e39e9d27 | Update test_mutation_expansion.py | pybel/pybel-tools,pybel/pybel-tools,pybel/pybel-tools | tests/test_mutation_expansion.py | tests/test_mutation_expansion.py | # -*- coding: utf-8 -*-
import unittest
from pybel import BELGraph
from pybel.constants import (
GENE, RNA,
)
from pybel.dsl import protein, complex_abundance, reaction
from pybel_tools.mutation import enrich_complexes, enrich_reactions
HGNC = 'HGNC'
GOBP = 'GOBP'
CHEBI = 'CHEBI'
g1 = GENE, HGNC, '1'
r1 = RNA, ... | # -*- coding: utf-8 -*-
import unittest
from pybel import BELGraph
from pybel.constants import (
GENE, RNA,
)
from pybel.dsl import protein, complex_abundance, reaction
from pybel_tools.mutation import enrich_complexes, enrich_reactions
HGNC = 'HGNC'
GOBP = 'GOBP'
CHEBI = 'CHEBI'
g1 = GENE, HGNC, '1'
r1 = RNA, ... | mit | Python |
79c5335e1a0cc3b9ccda3718a5213351a991d0b1 | add way to generate version string without product | Liongold/crash,mmohrhard/crash,mmohrhard/crash,Liongold/crash,mmohrhard/crash,Liongold/crash | django/crashreport/crashsubmit/models.py | django/crashreport/crashsubmit/models.py | # -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from __future__ import unicode_lit... | # -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from __future__ import unicode_lit... | mpl-2.0 | Python |
9be471c7976d2d049bd5ef7be3052390ec8dae09 | Abort the fixer before issuing a warning if the fix has already been applied. | LTD-Beget/python-atfork,google/python-atfork | atfork/stdlib_fixer.py | atfork/stdlib_fixer.py | # Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | # Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | apache-2.0 | Python |
92949a39d1c02f76d78f935be924b427a454d595 | Add a debug-level log message when an auth request is made | ndevenish/auth_mac | auth_mac/decorators.py | auth_mac/decorators.py | import logging
from functools import wraps
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from auth_mac.models import Nonce, Credentials
from auth_mac.tools import Validator
# Get an instance of a logger
authlog = logging.getLogger("auth_mac.authorization")
def require_cred... | import logging
from functools import wraps
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from auth_mac.models import Nonce, Credentials
from auth_mac.tools import Validator
# Get an instance of a logger
authlog = logging.getLogger("auth_mac.authorization")
def require_cred... | mit | Python |
b5992b2ae6bbba400835564a828847565ceac1c2 | fix owlbot config | googleapis/java-logging-servlet-initializer,googleapis/java-logging-servlet-initializer,googleapis/java-logging-servlet-initializer | owlbot.py | owlbot.py | # Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
cda1d6b1cdb0a36a3e9d9e5a65eabfb22a29e94e | Handle bad signature with flask abort | scolby33/OCSPdash,scolby33/OCSPdash,scolby33/OCSPdash | src/ocspdash/web/blueprints/ui.py | src/ocspdash/web/blueprints/ui.py | import base64
from collections import namedtuple, OrderedDict
from itertools import groupby
import json
from operator import itemgetter
from typing import List
from flask import Blueprint, render_template, request, current_app
import nacl.signing
import nacl.encoding
import nacl.exceptions
from ...models import Locat... | import base64
from collections import namedtuple, OrderedDict
from itertools import groupby
import json
from operator import itemgetter
from typing import List
from flask import Blueprint, render_template, request, current_app
import nacl.signing
import nacl.encoding
import nacl.exceptions
from ...models import Locat... | mit | Python |
fb7c5dcb4b0bba304cfe5f0abd9710a3c56ce262 | 更新版本号:0.1.12 | ddcatgg/dglib | dglib/__init__.py | dglib/__init__.py |
__author__ = 'DDGG'
__version__ = '0.1.12'
__license__ = 'MIT'
|
__author__ = 'DDGG'
__version__ = '0.1.11'
__license__ = 'MIT'
| mit | Python |
435f7d91d27c62550645e99a46a5097f756933a2 | fix a typo | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | openquake/server/utils.py | openquake/server/utils.py | from openquake.engine import __version__ as oqversion
def getusername(request):
"""
Return the real username if authentication support is enabled and user is
authenticated, otherwise it returns "platform" as user for backward
compatibility.
"""
user_name = (request.user.username if hasattr(re... | from openquake.engine import __version__ as oqversion
def getusername(request):
"""
Return the real user is authentication support is enabled and user is
authenticated, otherwise it returns "platform" as user for backward
compatibility.
"""
user_name = (request.user.username if hasattr(reques... | agpl-3.0 | Python |
e3ca364389984a4434986f837d27b33e7b5c754a | fix hornbook_api view | pz325/hornbook-django,pz325/hornbook-django,pz325/hornbook-django | apps/hornbook_api/views.py | apps/hornbook_api/views.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Create your views here.
from models import MostCommonCharacter
from models import MostCommonWord
from django.shortcuts import render_to_response
from django.http import HttpResponse
import json
import random
def index(request):
'''
Test page for horn_api app
'''... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Create your views here.
from models import MostCommonCharacter
from models import MostCommonWord
from django.shortcuts import render_to_response
from django.http import HttpResponse
import json
import random
def index(request):
'''
Test page for horn_api app
'''... | bsd-3-clause | Python |
ef074761702dd56103287678c56e7ef1e11e6fe2 | Update import.py: - create fucking authenticate | solairerove/woodstock,solairerove/woodstock,solairerove/woodstock | additional/import/import.py | additional/import/import.py | #!/usr/bin/python3.4
import time
from py2neo import Graph
from py2neo import Path, authenticate
def main():
host_port = "localhost:7474"
user_name = "neo4j"
user_password = "woodstock"
authenticate(host_port, user_name, user_password)
graph = Graph()
query = '''
MATCH (n) RETURN n... | #!/usr/bin/python3.4
import time
from py2neo import Graph
def main():
host_port = "localhost:7474"
user_name = "neo4j"
password = "woodstock"
graph = Graph("http://" + user_name + ":" + password + "@" + host_port + "/db/data/")
query = '''
MATCH (n) RETURN n LIMIT 200
'''
print... | apache-2.0 | Python |
234df393c438fdf729dc050d20084e1fe1a4c2ee | Change directory where data is written to. | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | backend/mcapi/mcdir.py | backend/mcapi/mcdir.py | import utils
from os import environ
import os.path
MCDIR = environ.get("MCDIR") or '/mcfs/data/materialscommons'
def for_uid(uidstr):
pieces = uidstr.split('-')
path = os.path.join(MCDIR, pieces[1][0:2], pieces[1][2:4])
utils.mkdirp(path)
return path
| import utils
from os import environ
import os.path
MCDIR = environ.get("MCDIR") or '/mcfs/data'
def for_uid(uidstr):
pieces = uidstr.split('-')
path = os.path.join(MCDIR, pieces[1][0:2], pieces[1][2:4])
utils.mkdirp(path)
return path
| mit | Python |
72f84b49ea9781f3252c49a1805c0ce19af5c635 | Revert "support unwrapping of basic types" | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/case_search/dsl_utils.py | corehq/apps/case_search/dsl_utils.py | from django.utils.translation import gettext as _
from eulxml.xpath.ast import FunctionCall, UnaryExpression, serialize
from corehq.apps.case_search.exceptions import (
CaseFilterError,
XPathFunctionException,
)
from corehq.apps.case_search.xpath_functions import XPATH_VALUE_FUNCTIONS
def unwrap_value(value... | from django.utils.translation import gettext as _
from eulxml.xpath.ast import FunctionCall, UnaryExpression, serialize
from corehq.apps.case_search.exceptions import (
CaseFilterError,
XPathFunctionException,
)
from corehq.apps.case_search.xpath_functions import XPATH_VALUE_FUNCTIONS
def unwrap_value(value... | bsd-3-clause | Python |
9e6fd7bc32c2435c2e638a7743e6af9d6e4b94ed | Add some jwt algorithm mixins. | atlassian/asap-authentication-python | atlassian_jwt_auth/tests/utils.py | atlassian_jwt_auth/tests/utils.py | from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives import serialization
from ..signer import JWTAuthSigner
def get_new_rsa_private_key_in_pem_format():
""" ... | from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
from ..signer import JWTAuthSigner
def get_new_rsa_private_key_in_pem_format():
""" returns a new rsa key in pem format. """
private_key ... | mit | Python |
2538003a6e3a5a4d8526cba15e092e5be4d8388b | update documentation url to live docs | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/sso/utils/url_helpers.py | corehq/apps/sso/utils/url_helpers.py | from django.urls import reverse
from dimagi.utils.web import get_url_base
def get_saml_entity_id(identity_provider):
return _get_full_sso_url("sso_saml_metadata", identity_provider)
def get_saml_acs_url(identity_provider):
return _get_full_sso_url("sso_saml_acs", identity_provider)
def get_saml_login_url... | from django.urls import reverse
from dimagi.utils.web import get_url_base
def get_saml_entity_id(identity_provider):
return _get_full_sso_url("sso_saml_metadata", identity_provider)
def get_saml_acs_url(identity_provider):
return _get_full_sso_url("sso_saml_acs", identity_provider)
def get_saml_login_url... | bsd-3-clause | Python |
4ba4f414f93b5e0d780b76fcbebd9f402597cdda | Add Mocks to Enrollment API Doc Config | openfun/edx-platform,longmen21/edx-platform,louyihua/edx-platform,rhndg/openedx,motion2015/a3,edx/edx-platform,zofuthan/edx-platform,nikolas/edx-platform,naresh21/synergetics-edx-platform,jolyonb/edx-platform,atsolakid/edx-platform,caesar2164/edx-platform,Edraak/circleci-edx-platform,vasyarv/edx-platform,EDUlib/edx-pla... | docs/en_us/enrollment_api/source/conf.py | docs/en_us/enrollment_api/source/conf.py | # -*- coding: utf-8 -*-
# pylint: disable=invalid-name
# pylint: disable=redefined-builtin
# pylint: disable=protected-access
# pylint: disable=unused-argument
import os
from path import path
import sys
import mock
MOCK_MODULES = [
'ipware',
'ip',
'ipware.ip',
'get_ip',
'pygeoip',
'ipaddr',
... | # -*- coding: utf-8 -*-
# pylint: disable=invalid-name
# pylint: disable=redefined-builtin
# pylint: disable=protected-access
# pylint: disable=unused-argument
import os
from path import path
import sys
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
sys.path.append('../../../../')
from docs.shared.conf impo... | agpl-3.0 | Python |
fa1cf410f6c0a504d03bb3fc3b0159fcf5fceffc | Fix FileNotFoundError when loading component yaml from file. (#6396) | kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines | components/google-cloud/google_cloud_pipeline_components/experimental/__init__.py | components/google-cloud/google_cloud_pipeline_components/experimental/__init__.py | # Copyright 2021 The Kubeflow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | # Copyright 2021 The Kubeflow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | apache-2.0 | Python |
66dbede5bfe85ea8e79c95c283c98c3d6fb1fc16 | fix indentation | yeosblue/nlp-2013-fall | Lab1.N_Gram_Frequency/ngram_frequency.py | Lab1.N_Gram_Frequency/ngram_frequency.py | def ngram(n, words):
for i in xrange(len(words)-n+1):
yield words[i:i+n]
def getWords(filename):
words = []
with open(filename) as f:
for line in f.readlines():
words += line.split()
return words
def frequencyTop(top_n, words):
from collections import Counter
return Co... | def ngram(n, words):
for i in xrange(len(words)-n+1):
yield words[i:i+n]
def getWords(filename):
words = []
with open(filename) as f:
for line in f.readlines():
words += line.split()
return words
def frequencyTop(top_n, words):
from collections import Counter
return Counter(... | unlicense | Python |
4262aafd33f5b90b2bbc6224a1ee8e7572113ca9 | Update P05_stylingExcel specified chart measurement | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter12/P05_stylingExcel.py | books/AutomateTheBoringStuffWithPython/Chapter12/P05_stylingExcel.py | # This program uses the OpenPyXL module to manipulate Excel documents
import openpyxl
from openpyxl.styles import Font, NamedStyle
wb = openpyxl.Workbook()
sheet = wb["Sheet"]
# Setting the Font Style of Cells
italic24Font = NamedStyle(name="italic24Font")
italic24Font.font = Font(size=24, italic=True)
sheet["A1"].s... | # This program uses the OpenPyXL module to manipulate Excel documents
import openpyxl
from openpyxl.styles import Font, NamedStyle
wb = openpyxl.Workbook()
sheet = wb["Sheet"]
# Setting the Font Style of Cells
italic24Font = NamedStyle(name="italic24Font")
italic24Font.font = Font(size=24, italic=True)
sheet["A1"].s... | mit | Python |
26efdd9b17f8ceb579c05d65abab8d311370ee64 | Change date localize function | shirlei/helios-server,shirlei/helios-server,shirlei/helios-server,shirlei/helios-server,shirlei/helios-server | heliosinstitution/utils.py | heliosinstitution/utils.py | import pytz
from django.conf import settings
def elections_as_json(elections):
elections_as_json = []
for election in elections:
election_dict = {
'pk': election.pk,
'uuid': election.uuid,
'name': election.name,
'url': election.url,
'a... | import json
from dateutil.tz import tzutc
UTC = tzutc()
def elections_as_json(elections):
elections_as_json = []
for election in elections:
election_dict = {
'pk': election.pk,
'uuid': election.uuid,
'name': election.name,
'url': election.url,
... | apache-2.0 | Python |
ce845c01ff12308cf2e94f6a06377ee078085cdc | test timer | proyectosdeley/proyectos_de_ley,proyectosdeley/proyectos_de_ley,proyectosdeley/proyectos_de_ley,proyectosdeley/proyectos_de_ley | proyectos_de_ley/pdl/tests/test_utils.py | proyectos_de_ley/pdl/tests/test_utils.py | import time
import datetime
from django.test import TestCase
from pdl.utils import convert_string_to_time, convert_date_to_string
from pdl.utils import Timer
class TestUtils(TestCase):
def test_convert_string_to_time(self):
string = "2014-10-10"
expected = datetime.datetime(2014, 10, 10)
... | import datetime
from django.test import TestCase
from pdl.utils import convert_string_to_time, convert_date_to_string
class TestUtils(TestCase):
def test_convert_string_to_time(self):
string = "2014-10-10"
expected = datetime.datetime(2014, 10, 10)
result = convert_string_to_time(string)... | mit | Python |
28e5484f3b0f325ac9648eb816eb54c2c048a626 | remove settings management. this is a lib ;) | nuagenetworks/bambou | restnuage/__init__.py | restnuage/__init__.py | # -*- coding: utf-8 -*-
import logging
logging.getLogger('restnuage').addHandler(logging.NullHandler())
from ConfigParser import ConfigParser
config = ConfigParser()
config.read('./settings.cfg')
__all__ = ['NURESTBasicUser', 'NURESTConnection', 'NURESTFetcher', 'NURESTLoginController', 'NURESTObject', 'NURESTPushCe... | # -*- coding: utf-8 -*-
import logging
logging.getLogger('restnuage').addHandler(logging.NullHandler())
from ConfigParser import ConfigParser
config = ConfigParser()
config.read('./settings.cfg')
try:
DEFAULT_USER = config.get('default', 'user')
DEFAULT_PASSWORD = config.get('default', 'password')
DEFAUL... | bsd-3-clause | Python |
f6a974a1dc5337e482fe6fcac402597735892567 | Use the delivery classes as proxy for items groups | Drekscott/Motlaesaleor,taedori81/saleor,rchav/vinerack,maferelo/saleor,rodrigozn/CW-Shop,dashmug/saleor,taedori81/saleor,laosunhust/saleor,laosunhust/saleor,car3oon/saleor,mociepka/saleor,hongquan/saleor,arth-co/saleor,taedori81/saleor,car3oon/saleor,spartonia/saleor,dashmug/saleor,hongquan/saleor,hongquan/saleor,car3o... | saleor/delivery/__init__.py | saleor/delivery/__init__.py | from __future__ import unicode_literals
from re import sub
from django.conf import settings
from prices import Price
from satchless.item import ItemSet
from ..cart import ShippedGroup
class BaseDelivery(ItemSet):
group = None
def __init__(self, delivery_group):
self.group = delivery_group
def... | from __future__ import unicode_literals
from django.conf import settings
from prices import Price
from satchless.item import Item
class BaseDelivery(Item):
def __init__(self, delivery_group):
self.group = delivery_group
def get_price_per_item(self, **kwargs):
return Price(0, currency=settin... | bsd-3-clause | Python |
7d57eb1df106a5ccc1fef940708d522a23a12cc2 | Debug voor aanlog naar objectstore | DatapuntAmsterdam/bgt,DatapuntAmsterdam/bgt | src/objectstore/objectstore.py | src/objectstore/objectstore.py | import logging
from swiftclient.client import Connection
import bgt_setup
log = logging.getLogger(__name__)
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.getLogger("swiftclient").setLevel(logging.WARNING)
OBJECTSTORE = {
'auth_version': '2.... | import logging
from swiftclient.client import Connection
import bgt_setup
log = logging.getLogger(__name__)
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.getLogger("swiftclient").setLevel(logging.WARNING)
OBJECTSTORE = {
'auth_version': '2.... | mpl-2.0 | Python |
05222a02f34f74c48c2ad196766d569bb9927466 | Update moin.py | TheIoTLearningInitiative/CodeLabs,TheIoTLearningInitiative/CodeLabs,TheIoTLearningInitiative/CodeLabs,TheIoTLearningInitiative/CodeLabs,TheIoTLearningInitiative/CodeLabs,TheIoTLearningInitiative/CodeLabs | Dzibilchaltun/moin.py | Dzibilchaltun/moin.py | https://home-assistant.io/components/notify.telegram/
api_key = ""
chat_id = ""
bot = telegram.Bot(token=api_key)
bot.sendMessage(chat_id=chat_id, text="Hi")
| api_key = ""
chat_id = ""
bot = telegram.Bot(token=api_key)
bot.sendMessage(chat_id=chat_id, text="Hi")
| apache-2.0 | Python |
0aa16b36b748bb7cb8b080d72715d484565ffab4 | Make the example in proper yaml format - windows/win_iis_virtualdirectory.py (#18829) | thaim/ansible,thaim/ansible | lib/ansible/modules/windows/win_iis_virtualdirectory.py | lib/ansible/modules/windows/win_iis_virtualdirectory.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Henrik Wallström <henrik@wallstroms.nu>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Henrik Wallström <henrik@wallstroms.nu>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | mit | Python |
89f4eae77018fef3cb350fe82974a448813874b5 | Update fab file to load the website after deploying | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | rnacentral/fabfile.py | rnacentral/fabfile.py | """
Copyright [2009-2014] EMBL-European Bioinformatics Institute
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 a... | """
Copyright [2009-2014] EMBL-European Bioinformatics Institute
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 a... | apache-2.0 | Python |
c57c6ccc30e779284d188d0db66a56264603ed37 | Remove whitespace | jesford/AstroLabels | astrolabels/astrolabels.py | astrolabels/astrolabels.py | class AstroLabels(object):
"""Formatted strings for labeling astronomy plots."""
def __init__(self):
# units
self.mpc = " $[\mathrm{Mpc}]$"
self.msun_pc2 = " $[M_{\odot}\ \mathrm{pc}^{-2}]$"
# quantities
self.sgma = "$\Sigma(R)$"
self.sgma_off = "$\Sigma^\mathrm{... | class AstroLabels(object):
"""Formatted strings for labeling astronomy plots."""
def __init__(self):
# units
self.mpc = " $[\mathrm{Mpc}]$"
self.msun_pc2 = " $[M_{\odot}\ \mathrm{pc}^{-2}]$"
# quantities
self.sgma = "$\Sigma(R)$"
self.sgma_off = "$\Sigma^\mat... | mit | Python |
cc8ec168f5e581910f0f1459bee6038cf9283477 | add country_id to cities api call | VincentVW/OIPA,VincentVW/OIPA,openaid-IATI/OIPA,tokatikato/OIPA,tokatikato/OIPA,bryanph/OIPA,zimmerman-zimmerman/OIPA,catalpainternational/OIPA,zimmerman-zimmerman/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA,bryanph/OIPA,VincentVW/OIPA,openaid-IATI/OIPA,bryanph/OIPA,bryanph/OIPA,catalpainternational/OIPA,openaid-IA... | OIPA/api/v3/resources/model_resources.py | OIPA/api/v3/resources/model_resources.py | from tastypie.serializers import Serializer
from indicator.models import *
from api.v3.resources.helper_resources import *
class RegionResource(ModelResource):
class Meta:
queryset = Region.objects.all()
resource_name = 'regions'
include_resource_uri = False
serializer = Serializ... | from tastypie.serializers import Serializer
from indicator.models import *
from api.v3.resources.helper_resources import *
class RegionResource(ModelResource):
class Meta:
queryset = Region.objects.all()
resource_name = 'regions'
include_resource_uri = False
serializer = Serializ... | agpl-3.0 | Python |
effc8ab3a10524f9e511111b11046ef1891ece3d | Make nosetest skip like autotest does (for CI) | rafaelmartins/rst2pdf,rafaelmartins/rst2pdf | rst2pdf/tests/test.py | rst2pdf/tests/test.py | # -*- coding: utf-8 -*-
from autotest import MD5Info, PathInfo, globjoin
from autotest import run_single
import sys, os
import nose.plugins.skip
class RunTest:
def __init__(self,f):
basename = os.path.basename(f)
self.description = basename
mprefix = os.path.join(PathInfo.md5dir, basenam... | # -*- coding: utf-8 -*-
from autotest import MD5Info, PathInfo, globjoin
from autotest import run_single
import sys, os
import nose.plugins.skip
class RunTest:
def __init__(self,f):
basename = os.path.basename(f)
self.description = basename
mprefix = os.path.join(PathInfo.md5dir, basenam... | mit | Python |
4a4b4259523db80cf3536f9db56ccf653e16dbfe | Fix import order in agents. | reinforceio/tensorforce,lefnire/tensorforce | tensorforce/agents/__init__.py | tensorforce/agents/__init__.py | # Copyright 2017 reinforce.io. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | # Copyright 2017 reinforce.io. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 | Python |
cc7a73835b35d6d08a6ba753f778694efa6a28d2 | change version and remove empty keys in openerp.py | ClearCorp/server-tools,ClearCorp/server-tools | auth_admin_passkey/__openerp__.py | auth_admin_passkey/__openerp__.py | # -*- coding: utf-8 -*-
# © 2016 GRAP
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# -*- encoding: utf-8 -*-
{
'name': 'Authentification - Admin Passkey',
'version': '9.0.1.0.0',
'category': 'base',
'author': "GRAP,Odoo Community Association (OCA)",
'website': 'http://www.gr... | # -*- coding: utf-8 -*-
# © 2016 GRAP
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# -*- encoding: utf-8 -*-
{
'name': 'Authentification - Admin Passkey',
'version': '9.0.0.1',
'category': 'base',
'author': "GRAP,Odoo Community Association (OCA)",
'website': 'http://www.grap... | agpl-3.0 | Python |
5f03cdb71b18d43d30edd39942a1a64e46d00db4 | Update finding_masking_bright_pixels.py | dpshelio/sunpy,dpshelio/sunpy,dpshelio/sunpy | examples/computer_vision_techniques/finding_masking_bright_pixels.py | examples/computer_vision_techniques/finding_masking_bright_pixels.py | # -*- coding: utf-8 -*-
"""
=================================
Finding and masking bright pixels
=================================
How to find and overplot the location of the brightest
pixel and then mask pixels around that region.
"""
# sphinx_gallery_thumbnail_number = 2
import numpy as np
import numpy.ma as ma
imp... | """
=================================
Finding and masking bright pixels
=================================
How to find and overplot the location of the brightest
pixel and then mask any pixels out the area around this region.
"""
import numpy as np
import numpy.ma as ma
import matplotlib.pyplot as plt
import astropy.u... | bsd-2-clause | Python |
510edc5b7d5320deb568b2fab1d654ee4d7a5c83 | Add a hook to load glance_store options | openstack/openstack-doc-tools,savinash47/openstack-doc-tools,savinash47/openstack-doc-tools,openstack/openstack-doc-tools,savinash47/openstack-doc-tools | autogenerate_config_docs/hooks.py | autogenerate_config_docs/hooks.py | #
# A collection of shared functions for managing help flag mapping files.
#
# 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 requi... | #
# A collection of shared functions for managing help flag mapping files.
#
# 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 requi... | apache-2.0 | Python |
212adddead82a7957119ceebe122e09e915c08c5 | Add 'rejected' column | ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata | ckanext/requestdata/logic/schema.py | ckanext/requestdata/logic/schema.py | from ckan.plugins import toolkit
from ckanext.requestdata.logic import validators
not_missing = toolkit.get_validator('not_missing')
not_empty = toolkit.get_validator('not_empty')
package_id_exists = toolkit.get_validator('package_id_exists')
email_validator = validators.email_validator
state_validator = validators.... | from ckan.plugins import toolkit
from ckanext.requestdata.logic import validators
not_missing = toolkit.get_validator('not_missing')
not_empty = toolkit.get_validator('not_empty')
package_id_exists = toolkit.get_validator('package_id_exists')
email_validator = validators.email_validator
state_validator = validators.... | agpl-3.0 | Python |
386159798e847433960ca1ecd210de45a2d5373c | Update Darwin test | bootandy/Axelrod,mojones/Axelrod,bootandy/Axelrod,mojones/Axelrod,uglyfruitcake/Axelrod,uglyfruitcake/Axelrod | axelrod/tests/unit/test_darwin.py | axelrod/tests/unit/test_darwin.py | """
Tests for the Darwin PD strategy.
"""
import axelrod
from .test_player import TestPlayer
class TestDarwin(TestPlayer):
name = "Darwin"
player = axelrod.Darwin
expected_classifier = {
'memory_depth': float('inf'),
'stochastic': False,
'inspects_source': False,
'mani... | """
Tests for the Darwin PD strategy.
"""
import axelrod
from .test_player import TestPlayer
class TestDarwin(TestPlayer):
name = "Darwin"
player = axelrod.Darwin
expected_classifier = {
'memory_depth': float('inf'),
'stochastic': False,
'inspects_source': False,
'mani... | mit | Python |
9d4cd06cb69b80aea1e54fa017be65706a914117 | Make const_char_ptr_test pass with pybind11 code generator. | google/clif,google/clif,google/clif | clif/testing/python/const_char_ptr_test.py | clif/testing/python/const_char_ptr_test.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, ... | apache-2.0 | Python |
3a8ccef50780b149f66158c856b25385f34cbbf1 | Convert constants to uppercase | everyonesdesign/OpenSearchInNewTab | OpenSearchInNewTab.py | OpenSearchInNewTab.py | import sublime_plugin
DEFAULT_NAME = 'Find Results'
ALT_NAME = 'Find Results '
class OpenSearchInNewTab(sublime_plugin.EventListener):
def on_deactivated(self, view):
if view.name() == 'Find Results':
# set a name with space
# so it won't be bothered
# during new search
view.set_name(ALT_NAME)
# the... | import sublime_plugin
default_name = 'Find Results'
alt_name = 'Find Results '
class OpenSearchInNewTab(sublime_plugin.EventListener):
def on_deactivated(self, view):
if view.name() == 'Find Results':
# set a name with space
# so it won't be bothered
# during new search
view.set_name(alt_name)
# the... | mit | Python |
02c39016a37ba5fdd144068d12625705bc12405e | update mongo management command refine | awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat | onadata/apps/fsforms/management/commands/update_mongo_value_type.py | onadata/apps/fsforms/management/commands/update_mongo_value_type.py | from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Update value type of fs_site and fs_uuid in mongo instances to make string type to int type"
def handle(self, *args, **kwargs):
xform_instances = settings.MONGO_DB.instances
... | from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Update value type of fs_site and fs_uuid in mongo instances to make string type to int type"
def handle(self, *args, **kwargs):
xform_instances = settings.MONGO_DB.instances
... | bsd-2-clause | Python |
bca14f3e187b4621db0b1a08132251e10ac6400a | Fix issue | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/monitor_resources/management/commands/monitor_resources.py | polyaxon/monitor_resources/management/commands/monitor_resources.py | import time
from django.conf import settings
from django.db import InterfaceError, OperationalError, ProgrammingError
from db.models.clusters import Cluster
from db.models.nodes import ClusterNode
from libs.base_monitor import BaseMonitorCommand
from libs.utils import to_bool
from monitor_resources import monitor
c... | import time
from django.conf import settings
from django.db import InterfaceError, OperationalError, ProgrammingError
from db.models.clusters import Cluster
from db.models.nodes import ClusterNode
from libs.base_monitor import BaseMonitorCommand
from libs.utils import to_bool
from monitor_resources import monitor
c... | apache-2.0 | Python |
0e2fc9c4b10ca06e3318c01b37b646a7aef80af5 | allow date time formatting placeholders in upload dir. | derek-adair/django-ajax-uploader,skoczen/django-ajax-uploader,brilliant-org/django-ajax-uploader,derek-adair/django-ajax-uploader,brilliant-org/django-ajax-uploader,derek-adair/django-ajax-uploader,brilliant-org/django-ajax-uploader,skoczen/django-ajax-uploader | ajaxuploader/backends/default_storage.py | ajaxuploader/backends/default_storage.py | import datetime
import os
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from ajaxuploader.backends.base import AbstractUploadBackend
class DefaultStorageUploadBackend(AbstractUploadBackend):
"""
Uses Django's default storage backend to store the uploade... | import os
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from ajaxuploader.backends.base import AbstractUploadBackend
class DefaultStorageUploadBackend(AbstractUploadBackend):
"""
Uses Django's default storage backend to store the uploaded files
see ... | bsd-3-clause | Python |
7e211332d715b0791b5a0d448fadfbe6df94a98d | Update fmt version to 6.2.1 | facebook/folly,facebook/folly,facebook/folly,facebook/folly,facebook/folly | build/fbcode_builder/specs/fmt.py | build/fbcode_builder/specs/fmt.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def fbcode_builder_spec(builder):
builder.add_option('fmtlib/fmt:git_hash', '6.2.1')
ret... | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def fbcode_builder_spec(builder):
builder.add_option('fmtlib/fmt:git_hash', '5.3.0')
ret... | apache-2.0 | Python |
df1cbfbd220d622477aed3bbb948b97e3e4b8695 | Make this test check another date. | jwg4/qual,jwg4/calexicon | calexicon/fn/tests/test_julian.py | calexicon/fn/tests/test_julian.py | from hypothesis import given
from hypothesis.extra.datetime import datetimes
import unittest
from datetime import date as vanilla_date
from calexicon.calendars.tests.test_calendar import JulianGregorianConversion
from calexicon.fn import julian_to_gregorian, gregorian_to_julian
from calexicon.fn import julian_to_jul... | from hypothesis import given
from hypothesis.extra.datetime import datetimes
import unittest
from datetime import date as vanilla_date
from calexicon.calendars.tests.test_calendar import JulianGregorianConversion
from calexicon.fn import julian_to_gregorian, gregorian_to_julian
from calexicon.fn import julian_to_jul... | apache-2.0 | Python |
26b042c67791f8bb295ceb02643883c75b081827 | Fix life histories and sample_histories | ihmeuw/vivarium | ceam/components/sample_history.py | ceam/components/sample_history.py | # ~/ceam/ceam/modules/sample_history.py
import pandas as pd
import numpy as np
from ceam import config
from ceam.framework.event import listens_for
from ceam.framework.population import uses_columns
class SampleHistory:
"""
Collect a detailed record of events that happen to a sampled sub-population for use ... | # ~/ceam/ceam/modules/sample_history.py
import pandas as pd
import numpy as np
from ceam import config
from ceam.framework.event import listens_for
from ceam.framework.population import uses_columns
class SampleHistory:
"""
Collect a detailed record of events that happen to a sampled sub-population for use ... | bsd-3-clause | Python |
ebada998faeca95e8295eb2ab122d7119a410ce3 | Create admin view, cube/connection | AndrzejR/mining,mining/mining,jgabriellima/mining,avelino/mining,seagoat/mining,AndrzejR/mining,chrisdamba/mining,avelino/mining,mining/mining,seagoat/mining,chrisdamba/mining,jgabriellima/mining,mlgruby/mining,mlgruby/mining,mlgruby/mining | admin/views.py | admin/views.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import riak
import tornado.ioloop
import tornado.web
import tornado.gen
from utils import slugfy
from admin.forms import ConnectionForm, CubeForm
class CubeHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
def get(self):
form = CubeForm()
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tornado.ioloop
import tornado.web
import tornado.gen
class CubeHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
def get(self):
self.render('index.html')
| mit | Python |
74b4700b71bfd56783f59bd800d88db03992c0e3 | replace print statement with self.stdout.write() | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | cla_backend/apps/cla_butler/management/commands/reverthousekeeping.py | cla_backend/apps/cla_butler/management/commands/reverthousekeeping.py | # -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django.core.management.base import BaseCommand
from cla_eventlog.models import Log
from cla_provider.models import Feedback
from complaints.models import Complaint
from diagnosis.models import Diag... | # -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django.core.management.base import BaseCommand
from cla_eventlog.models import Log
from cla_provider.models import Feedback
from complaints.models import Complaint
from diagnosis.models import Diag... | mit | Python |
02441545bbd205d5536b425e075d1fa3d62a6ef9 | add scenario tags | nikitanovosibirsk/vedro | vedro/core/runner.py | vedro/core/runner.py | import sys
import os
import importlib
import inspect
from .profiler import Profiler
from .scenario import Scenario
from .step import Step
from ..helpers import scenario as scenario_decorator
class Runner:
def __init__(self):
self.__scope = None
self.__step = None
def __discover_scenarios(self, root):
... | import sys
import os
import importlib
import inspect
from .profiler import Profiler
from .scenario import Scenario
from .step import Step
from ..helpers import scenario as scenario_decorator
class Runner:
def __init__(self):
self.__scope = None
self.__step = None
def __discover_scenarios(self, root):
... | apache-2.0 | Python |
7a9502776b722797d06113bd04db087f7758ef68 | bump version | PhilipGarnero/django-rest-framework-social-oauth2,villoid/django-rest-framework-social-oauth2,barseghyanartur/django-rest-framework-social-oauth2,pombredanne/django-rest-framework-social-oauth2 | rest_framework_social_oauth2/__init__.py | rest_framework_social_oauth2/__init__.py | __version__ = "0.0.1"
__description__ = """This module provides a python-social-auth and oauth2 support for django-rest-framework"""
| __version__ = "0.0.0"
__description__ = """This module provides a python-social-auth and oauth2 support for django-rest-framework"""
| mit | Python |
591b62ebee611c890595d6e4a624b91f507620fa | Migrate analyzer_test to pytest | LibreTime/libretime,LibreTime/libretime,LibreTime/libretime,LibreTime/libretime,LibreTime/libretime,LibreTime/libretime | python_apps/airtime_analyzer/tests/analyzer_test.py | python_apps/airtime_analyzer/tests/analyzer_test.py | import pytest
from airtime_analyzer.analyzer import Analyzer
def test_analyze():
with pytest.raises(NotImplementedError):
abstract_analyzer = Analyzer()
abstract_analyzer.analyze(u"foo", dict())
| from airtime_analyzer.analyzer import Analyzer
from nose.tools import *
def setup():
pass
def teardown():
pass
@raises(NotImplementedError)
def test_analyze():
abstract_analyzer = Analyzer()
abstract_analyzer.analyze(u"foo", dict())
| agpl-3.0 | Python |
fdaef6072caa2bbdb6e8df896dea85fab5317c72 | add handling for specific char like '%s' | weijia/django-excel-to-model,weijia/django-excel-to-model | django_excel_to_model/field_tools.py | django_excel_to_model/field_tools.py | import pinyin
from django_excel_to_model.file_readers.file_reader_exceptions import NonUnicodeFieldNameNotSupported
SPECIFIC_CHAR_MAPPING = {
"%" : 'percentage'
}
def get_target_field_name(col):
for ch in [" ", ",", "_", ")", "(", ":", "/", "\\", '"', "'", "-", ",", ".", "<", ">", "%", "&", "\r", "\n"]:
... | import pinyin
from django_excel_to_model.file_readers.file_reader_exceptions import NonUnicodeFieldNameNotSupported
def get_target_field_name(col):
for ch in [" ", ",", "_", ")", "(", ":", "/", "\\", '"', "'", "-", ",", ".", "<", ">", "%", "&", "\r", "\n"]:
col = col.replace(ch, "_").replace("__", "_")
... | bsd-3-clause | Python |
1a5606e34eb51280acc0c7d8fd6744f54f4c1bce | Add django.contrib.sites to installed apps to manage the site. | timlinux/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,timlinux/inasafe-django,timlinux/inasafe-django,timlinux/inasafe-django,AIFDR/inasafe-django | django_project/core/settings/base.py | django_project/core/settings/base.py | # -*- coding: utf-8 -*-
# Django settings for inasafe project.
from .utils import ABS_PATH
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this m... | # -*- coding: utf-8 -*-
# Django settings for inasafe project.
from .utils import ABS_PATH
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this m... | bsd-2-clause | Python |
89dd010586383b2d854c71512da0f793f97f3189 | Fix blank popup | lucernae/feti,cchristelis/feti,cchristelis/feti,lucernae/feti,lucernae/feti,cchristelis/feti,lucernae/feti,cchristelis/feti | django_project/feti/models/campus.py | django_project/feti/models/campus.py | # coding=utf-8
"""Model class for WMS Resource"""
__author__ = 'Christian Christelis <christian@kartoza.com>'
__date__ = '04/2015'
__license__ = "GPL"
__copyright__ = 'kartoza.com'
from django.contrib.gis.db import models
from feti.models.provider import Provider
from feti.models.address import Address
from feti.mod... | # coding=utf-8
"""Model class for WMS Resource"""
__author__ = 'Christian Christelis <christian@kartoza.com>'
__date__ = '04/2015'
__license__ = "GPL"
__copyright__ = 'kartoza.com'
from django.contrib.gis.db import models
from feti.models.provider import Provider
from feti.models.address import Address
from feti.mod... | bsd-2-clause | Python |
5d31f5d443f6ef191b963b50576836487728e6f8 | Sale pricing handlers accepts 'discount' param. | fusionbox/satchless,fusionbox/satchless,taedori81/satchless,fusionbox/satchless | satchless/contrib/examples/gulliver/sale/handler.py | satchless/contrib/examples/gulliver/sale/handler.py | from django.db.models import Sum, Min, Max
from satchless.pricing import Price
from . import models
def _discount_product(product, price):
try:
group = product.discount.get()
except models.DiscountGroup.DoesNotExist:
return price
if isinstance(price, Price):
return group.get_discou... | from django.db.models import Sum, Min, Max
from satchless.pricing import Price
from . import models
def _discount_product(product, price):
try:
group = product.discount.get()
except models.DiscountGroup.DoesNotExist:
return price
if isinstance(price, Price):
return group.get_discou... | bsd-3-clause | Python |
d237658a8575b6d3d3253d2e17aa3279a12f5737 | Update setchannelposition to handle order None | learningequality/kolibri,learningequality/kolibri,indirectlylit/kolibri,learningequality/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,learningequality/kolibri | kolibri/core/content/management/commands/setchannelposition.py | kolibri/core/content/management/commands/setchannelposition.py | import sys
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.db.models import F
from kolibri.core.content.models import ChannelMetadata
class Command(BaseCommand):
"""
Order the way channels appear.
"""
def add_arguments(self, parser):
... | import sys
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.db.models import F
from kolibri.core.content.models import ChannelMetadata
class Command(BaseCommand):
"""
Order the way channels appear.
"""
def add_arguments(self, parser):
... | mit | Python |
474dd68eb08790e5853879885025ecc2afb92041 | Add binary/octal/decimal/hexadecimal | YASME-Tim/crypto-tools,YASME-Tim/crypto-tools,abpolym/crypto-tools,abpolym/crypto-tools | find-coding-scheme/find_coding_scheme.py | find-coding-scheme/find_coding_scheme.py | import sys
import re
# first argument: unknown coding text
if len(sys.argv) != 2: sys.exit(2)
estr=sys.argv[1]
binrex = re.compile('^[01]+$')
if(binrex.match(estr)): print 'binary'
decrex = re.compile('^[0-9]+$')
if(decrex.match(estr)): print 'decimal'
octrex = re.compile('^[0-7]+$')
if(octrex.match(estr)): print '... | import sys
import re
# first argument: unknown coding text
if len(sys.argv) != 2: sys.exit(2)
estr=sys.argv[1]
b64rex = re.compile('^[A-Za-z0-9+/]+[=]{0,2}$')
if(b64rex.match(estr)): print 'base64'
uurex = re.compile('^(begin.*\n)?[\x20-\x60\n]+(end[\n]?)?$')
if(uurex.match(estr)): print 'uuencode'
xxrex = re.compi... | mit | Python |
266a225e0820d25c15af42cdc87efb2a3158a4a0 | fix the quoting? | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/cache/warn_cache.py | scripts/cache/warn_cache.py | # Need something to cache the warnings GIS files, since they are so
# huge.
import os
FINAL = "/mesonet/share/pickup/wwa/"
for year in range(1986,2010):
cmd = 'wget -q -O %s/%s_all.zip "http://localhost/cgi-bin/request/gis/watchwarn.py?year1=%s&month1=1&day1=1&hour1=0&minute1=0&year2=%s&month2=1&day2=1&hour2=0&mi... | # Need something to cache the warnings GIS files, since they are so
# huge.
import os
FINAL = "/mesonet/share/pickup/wwa/"
for year in range(1986,2010):
cmd = "wget -q -O %s/%s_all.zip http://localhost/cgi-bin/request/gis/watchwarn.py?year1=%s&month1=1&day1=1&hour1=0&minute1=0&year2=%s&month2=1&day2=1&hour2=0&min... | mit | Python |
262f8f443658dab3bceb791441f91b067ac53700 | Add refresh | agendaodonto/server,agendaodonto/server | app/schedule/service/sms.py | app/schedule/service/sms.py | from datetime import datetime
from time import sleep
from django.conf import settings
from pyfcm import FCMNotification
class SMS:
def __init__(self):
self.client = FCMNotification(settings.FIREBASE_TOKEN)
def wait_for_status_change(self, schedule) -> bool:
start_time = datetime.now()
... | from datetime import datetime
from time import sleep
from django.conf import settings
from pyfcm import FCMNotification
class SMS:
def __init__(self):
self.client = FCMNotification(settings.FIREBASE_TOKEN)
def wait_for_status_change(self, schedule) -> bool:
start_time = datetime.now()
... | agpl-3.0 | Python |
1bf61d2ed9078dbe7854d45162c3c16220bb2021 | Change >= to > | ZDroid/feedstyl | parser.py | parser.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Python script for displaying pretty RSS feeds
#
import sys
import feedparser
# List of uples (label, property tag, truncation)
# -----------------------------------------------
feed_properties = [
("\n\033[1mFeed title:\033[0m", "title", None),
("\033[1mFeed desc... | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Python script for displaying pretty RSS feeds
#
import sys
import feedparser
# List of uples (label, property tag, truncation)
# -----------------------------------------------
feed_properties = [
("\n\033[1mFeed title:\033[0m", "title", None),
("\033[1mFeed desc... | mit | Python |
222ea492fdfa4a811311e68c89e4f75955bacc10 | Remove leftover TODO in is_list_like | prat0318/bravado-core | bravado_core/schema.py | bravado_core/schema.py | from collections import Mapping
from bravado_core.exception import SwaggerMappingError
# 'object' and 'array' are omitted since this should really be read as
# "Swagger types that map to python primitives"
SWAGGER_PRIMITIVES = (
'integer',
'number',
'string',
'boolean',
'null',
)
def has_defaul... | from collections import Mapping
from bravado_core.exception import SwaggerMappingError
# 'object' and 'array' are omitted since this should really be read as
# "Swagger types that map to python primitives"
SWAGGER_PRIMITIVES = (
'integer',
'number',
'string',
'boolean',
'null',
)
def has_defaul... | bsd-3-clause | Python |
9c279ff823f70d42d184e9dff9ea6a64d2f7e45b | Update the messages | rajeevrn/myscripts,rajeevrn/myscripts | vmware/vcenterapi.py | vmware/vcenterapi.py | #!/usr/bin/python
import json
import requests
import urllib3
# Wanted to disable the warnings. Only for demo, do not disable the warnings.
urllib3.disable_warnings()
#URL of the VCSA Appliance
url = "https://192.168.0.9/rest/appliance/"
#API which you want to explore
restdata = "/health/applmgmt";
#Verify=Fals... | #!/usr/bin/python
import json
import requests
import urllib3
# Wanted to disable the warnings. Only for demo, do not disable the warnings.
urllib3.disable_warnings()
#URL of the appliance
url = "https://192.168.0.9/rest/appliance/"
#API which you want to explore
restdata = "/health/applmgmt";
#Verify=False - T... | mit | Python |
0ed1bc257b2acb0ad036ad6b8a7265728440153d | Make memoization slightly less fragile | MOLSSI-BSE/basis_set_exchange | basis_set_exchange/memo.py | basis_set_exchange/memo.py | '''
Class/decorator for memoizing BSE functionality
'''
import functools
import pickle
import inspect
# If set to True, memoization of some internal functions
# will be used. Generally safe to leave enabled - it
# won't use that much memory
memoize_enabled = True
def _make_key(args_spec, *args, **kwargs):
left_... | '''
Class/decorator for memoizing BSE functionality
'''
import functools
import pickle
# If set to True, memoization of some internal functions
# will be used. Generally safe to leave enabled - it
# won't use that much memory
memoize_enabled = True
class BSEMemoize:
def __init__(self, f):
self.__f = f
... | bsd-3-clause | Python |
812a8635167f1ac2aa7d009d581419fd661df1c6 | synchronize event description to act comment | ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide | scripts/copy_description.py | scripts/copy_description.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
log = open('descriptions.log', 'a+')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "calebasse.settings")
from calebasse.agenda.models import EventWithAct
for event in EventWithAct.objects.all():
if event.act:
if not event.act.comment and event.d... | # -*- coding: utf-8 -*-
#!/usr/bin/env python
import calebasse.settings
import django.core.management
django.core.management.setup_environ(calebasse.settings)
from calebasse.agenda.models import EventWithAct
for event in EventWithAct.objects.all():
if not event.act.comment and event.description:
event.a... | agpl-3.0 | Python |
c58860305a4f46bd3bc16622fc44f85f47f08ae3 | Fix blendergltf import | Kupoman/BlenderRealtimeEngineAddon | brte/converters/btf.py | brte/converters/btf.py | if 'imported' in locals():
import imp
import bpy
imp.reload(blendergltf)
else:
imported = True
import blendergltf
import json
import math
import bpy
def togl(matrix):
return [i for col in matrix.col for i in col]
class BTFConverter:
def convert(self, add_delta, update_delta, remove_de... | if 'imported' in locals():
import imp
import bpy
imp.reload(blendergltf)
else:
imported = True
from . import blendergltf
import json
import math
import bpy
def togl(matrix):
return [i for col in matrix.col for i in col]
class BTFConverter:
def convert(self, add_delta, update_delta, re... | mit | Python |
41f744542a689cfe443132c5718f7b4971ae0152 | Check that invoice number matches filename | pwaring/125-accounts,pwaring/125-accounts | scripts/generate-invoice.py | scripts/generate-invoice.py | #!/usr/bin/env python3
import argparse
import decimal
import sys
import yaml
import jinja2
import weasyprint
decimal.getcontext().prec = 2
parser = argparse.ArgumentParser()
parser.add_argument('--data', help='path to data directory', required=True)
parser.add_argument('--number', help='Invoice number', type=int, r... | #!/usr/bin/env python3
import argparse
import decimal
import sys
import yaml
import jinja2
import weasyprint
decimal.getcontext().prec = 2
parser = argparse.ArgumentParser()
parser.add_argument('--data', help='path to data directory', required=True)
parser.add_argument('--number', help='Invoice number', type=int, r... | mit | Python |
4f23e8323141b465b1013741e6eaa6782aea6c56 | remove unnecessary creation of a temporary list that's then passed to the tuple() function as well as the removal of a tuple() call on a tuple() object. this second change is pure wtf fail. | mchrzanowski/ProjectEuler,mchrzanowski/ProjectEuler | src/python/Problem102.py | src/python/Problem102.py | '''
Created on Mar 13, 2012
@author: mchrzanowski
'''
import os.path
from itertools import izip
from time import time
def loadTriangles(fileName):
def getNumbersInPairs(points):
counter = 0
while counter + 1 < len(points):
yield points[counter], points[counter + 1]
co... | '''
Created on Mar 13, 2012
@author: mchrzanowski
'''
import os.path
from itertools import izip
from time import time
def loadTriangles(fileName):
def getNumbersInPairs(points):
counter = 0
while counter + 1 < len(points):
yield points[counter], points[counter + 1]
co... | mit | Python |
fa63f587aae05a20b19abbb762c5c3fdb0a4f246 | comment mod. | mchrzanowski/ProjectEuler,mchrzanowski/ProjectEuler | src/python/Problem131.py | src/python/Problem131.py | '''
Created on Aug 25, 2012
@author: mchrzanowski
'''
from ProjectEulerPrime import ProjectEulerPrime
def main(ceiling):
primes = ProjectEulerPrime()
special_primes = 0
# n ** 3 + p * n ** 2 = x ** 3 can be re-written as:
# n ** 2 * (n + p) = x ** 3
# since x, p, and n are positive integers, w... | '''
Created on Aug 25, 2012
@author: mchrzanowski
'''
from ProjectEulerPrime import ProjectEulerPrime
def main(ceiling):
primes = ProjectEulerPrime()
special_primes = 0
# n ** 3 + p * n ** 2 = x ** 3 can be re-written as:
# n ** 2 * (n + p) = x ** 3
# since x, p, and n are positive integers, w... | mit | Python |
5d2cabdca90ea8b8d61338a0b9ea9b643f1b1b6f | Update escaped char. | KarlGong/ptest-pycharm-plugin,KarlGong/ptest-pycharm-plugin,KarlGong/ptest-pycharm-plugin | src/python/tcmessages.py | src/python/tcmessages.py | import sys
class TeamcityServiceMessages:
quote = {"'": "|'", "|": "||", "\n": "|n", "\r": "|r", ']': '|]', '[': '|['}
def __init__(self, output=sys.stdout, prepend_linebreak=False):
self.output = output
self.prepend_linebreak = prepend_linebreak
def escapeValue(self, value):
... | import sys
class TeamcityServiceMessages:
quote = {"'": "|'", "|": "||", "\n": "|n", "\r": "|r", ']': '|]'}
def __init__(self, output=sys.stdout, prepend_linebreak=False):
self.output = output
self.prepend_linebreak = prepend_linebreak
def escapeValue(self, value):
if sys.... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.