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 |
|---|---|---|---|---|---|---|---|---|
b5dd7317eb137dacd4f64c2102fdb03a9930080b | Refactor KafkaSampleWriter | mre/kafka-influxdb,mre/kafka-influxdb | kafka_influxdb/writer/kafka_sample_writer.py | kafka_influxdb/writer/kafka_sample_writer.py | import kafka
import kafka.common
import random
import logging
import time
class KafkaWriterException(Exception):
pass
class KafkaSampleWriter(object):
"""
KafkaSampleWriter can be used to write sample messages into Kafka for
benchmark purposes
"""
def __init__(self, host, port, topic):
... | from kafka import KafkaClient, create_message
from kafka.common import ProduceRequest
import random
import logging
class KafkaSampleWriter(object):
"""
KafkaSampleWriter can be used to write sample messages into Kafka for
benchmark purposes
"""
def __init__(self, config, batches=1000, batch_size=... | apache-2.0 | Python |
1cd7e59ed1afb13629b4153b3a93de184cc06248 | Update sframe_unpack.py | dato-code/how-to,srikris/how-to,nagyistoce/how-to-graphlab-create | sframe_unpack.py | sframe_unpack.py | import graphlab as gl
# An SFrame with a column 'wc' of type (dict)
sf = gl.SFrame({'id': [1,2,3],
'dict_col': [{'a': 1}, {'b': 2}, {'a': 1, 'b': 2}]})
sf_unpack = sf.unpack('dict_col', column_name_prefix="foo")
# Returns
# +----+-------+-------+
# | id | foo.a | foo.b |
# +----+-------+-------+
# ... | # Title: Expand an SFrame column of type list/dict into multiple columns
import graphlab as gl
# An SFrame with a column 'wc' of type (dict)
sf = gl.SFrame({'id': [1,2,3],
'dict_col': [{'a': 1}, {'b': 2}, {'a': 1, 'b': 2}]})
sf_unpack = sf.unpack('dict_col', column_name_prefix="foo")
# Returns
# +--... | cc0-1.0 | Python |
153b226b3cd1e65ca75db549d255ae4f3a67cb90 | Add note to emd.py | clarka34/exploringShipLogbooks,clarka34/exploring-ship-logbooks | scripts/emd.py | scripts/emd.py | import os
import sys
import random
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from emd import emd
"""
To use emd function, we need to install pyemd package on your machine first. (Windows machine may not supported)
https://github.com/garydoranjr/pyemd
"""
def if_data_ready(filename):
... | import os
import sys
import random
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from emd import emd
"""
If data is not ready, we need download the raw data and unzip the files in the same route
If data is ready, return the DataFrame
"""
def if_data_ready(filename):
if os.path.exists(file... | mit | Python |
47ed61c60a7da4596dfed180865befe2883f8c96 | Fix arg reference in the print_metadata.py (#284) | mit-ll/python-keylime,mit-ll/python-keylime,mit-ll/python-keylime,mit-ll/python-keylime | keylime/revocation_actions/print_metadata.py | keylime/revocation_actions/print_metadata.py | #!/usr/bin/env python
'''
DISTRIBUTION STATEMENT A. Approved for public release: distribution unlimited.
This material is based upon work supported by the Assistant Secretary of Defense for
Research and Engineering under Air Force Contract No. FA8721-05-C-0002 and/or
FA8702-15-D-0001. Any opinions, findings, conclusi... | #!/usr/bin/env python
'''
DISTRIBUTION STATEMENT A. Approved for public release: distribution unlimited.
This material is based upon work supported by the Assistant Secretary of Defense for
Research and Engineering under Air Force Contract No. FA8721-05-C-0002 and/or
FA8702-15-D-0001. Any opinions, findings, conclusi... | bsd-2-clause | Python |
0437ba94140565c8f8a2aeee0e23ca5f005f963a | add agent config save | wandb/client,wandb/client,wandb/client | wandb/agent/agent.py | wandb/agent/agent.py | import sys
import click
import time
import os
from wandb.apis import internal
import subprocess
import json
class Agent(object):
def __init__(self, spec):
self._spec = spec
settings = dict(base_url="app.qa.wandb.ai")
self._api = internal.Api(default_settings=settings)
def check_que... | import sys
import click
import time
from wandb.apis import internal
class Agent(object):
def __init__(self, spec):
self._spec = spec
settings = dict(base_url="app.qa.wandb.ai")
self._api = internal.Api(default_settings=settings)
def check_queue(self):
ups = self._api.pop_fr... | mit | Python |
76457b72cb11ae7ac62a5d6f0bc4cbd8f54bee65 | Add path filtering. | chaomodus/pixywerk,chaomodus/pixywerk,chaomodus/pixywerk | pixywerkwsgi.py | pixywerkwsgi.py | import os
import pixywerk
import simpleconfig
from utils import response
import re
default_config = {
'root':os.getcwd(),
'name':'pixywerk',
'template_paths':('templates',),
'pathelement_blacklist':('.git',),
'wsgi_path_filters':(),
}
config = default_config
print "PIXYWERK"
if os.environ.has_key... | import os
import pixywerk
import simpleconfig
from utils import response
default_config = {
'root':os.getcwd(),
'name':'pixywerk',
'template_paths':('templates',),
'pathelement_blacklist':('.git',),
}
config = default_config
print "PIXYWERK"
if os.environ.has_key('PIXYWERK_CONFIG'):
infile = file... | mit | Python |
159538d495b8403afba918245a38245c1f07b1c4 | Set module uninstalable | odoo-brazil/l10n-brazil-wip,odoo-brazil/l10n-brazil-wip,thinkopensolutions/l10n-brazil,thinkopensolutions/l10n-brazil | l10n_br_account_move_template/__openerp__.py | l10n_br_account_move_template/__openerp__.py | # -*- coding: utf-8 -*-
# Copyright 2017 KMEE
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'L10n Br Account Move Template',
'summary': """
Modulo temporario pra facilitar o desenvolvimento dos roteiros
contabeis""",
'version': '10.0.1.0.0',
'license': 'AGPL-... | # -*- coding: utf-8 -*-
# Copyright 2017 KMEE
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'L10n Br Account Move Template',
'summary': """
Modulo temporario pra facilitar o desenvolvimento dos roteiros
contabeis""",
'version': '8.0.1.0.0',
'license': 'AGPL-3... | agpl-3.0 | Python |
ea533cbb5305954cd588aa962b16215e486ddac5 | fix model | ITCase/pyramid_pages,ITCase/pyramid_pages,uralbash/pyramid_pages,uralbash/pyramid_pages,uralbash/pyramid_pages,uralbash/pyramid_pages,ITCase/pyramid_pages | sacrud_pages/models.py | sacrud_pages/models.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 uralbash <root@uralbash.ru>
#
# Distributed under terms of the MIT license.
"""
Model of Pages
"""
from sqlalchemy import Boolean, Column, Integer, String, Text
from sqlalchemy.ext.declarative import declarative_base, declared_attr
f... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 uralbash <root@uralbash.ru>
#
# Distributed under terms of the MIT license.
"""
Model of Pages
"""
from sqlalchemy import Boolean, Column, Integer, String, Text
from sqlalchemy.ext.declarative import declarative_base, declared_attr
f... | mit | Python |
4cb4a89008e4637552deaa43241686044c9a4214 | Update version.py | ljchang/nltools | nltools/version.py | nltools/version.py | """Specifies current version of nltools to be used by setup.py and __init__.py
"""
__version__ = '0.4.2'
| """Specifies current version of nltools to be used by setup.py and __init__.py
"""
__version__ = '0.4.1'
| mit | Python |
1180c6b64175127455c0c617aa2a48aec4199128 | Add tests for LogCatcher. | TouK/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,harrissoerja/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,TouK/vumi | vumi/tests/test_testutils.py | vumi/tests/test_testutils.py | from twisted.trial.unittest import TestCase
from vumi.service import Worker
from vumi.tests.utils import get_stubbed_worker, Mocking, LogCatcher
from vumi.tests.fake_amqp import FakeAMQClient
from vumi import log
class ToyWorker(Worker):
def poke(self):
return "poke"
class MockingHistoryItemTestCase(Te... | from twisted.trial.unittest import TestCase
from vumi.service import Worker
from vumi.tests.utils import get_stubbed_worker, Mocking
from vumi.tests.fake_amqp import FakeAMQClient
class ToyWorker(Worker):
def poke(self):
return "poke"
class MockingHistoryItemTestCase(TestCase):
def test_basic_item(... | bsd-3-clause | Python |
a7c480eaa5ff377a644f3c752eb7e5c5ace4dd0e | Replace requests with urllib3 | sholsapp/py509 | py509/bin/verify.py | py509/bin/verify.py | #!/usr/bin/env python
"""Verify a certificate."""
import argparse
import logging
import sys
import struct
from OpenSSL import crypto
import certifi
import urllib3
from py509.asn1.authority_info_access import AuthorityInfoAccess
from py509.x509 import load_x509_certificates
from pyasn1.codec.der.decoder import decod... | #!/usr/bin/env python
"""Verify a certificate."""
import argparse
import logging
import sys
import struct
from OpenSSL import crypto
import certifi
import requests
from py509.asn1.authority_info_access import AuthorityInfoAccess
from py509.x509 import load_x509_certificates
from pyasn1.codec.der.decoder import deco... | apache-2.0 | Python |
221a94c38ac0ad0c6d08f02b587c259423b96311 | Fix issue where lang was not parsed properly | marteinn/wagtail-alt-generator,marteinn/wagtail-alt-generator,marteinn/wagtail-alt-generator | wagtailaltgenerator/utils.py | wagtailaltgenerator/utils.py | import os
import requests
from django.utils.translation import get_language
from wagtailaltgenerator.translation_providers import get_current_provider
from wagtailaltgenerator.providers import DescriptionResult
def get_image_data(image_url):
'''
Load external image and return byte data
'''
image_dat... | import os
import requests
from django.utils.translation import get_language
from wagtailaltgenerator.translation_providers import get_current_provider
from wagtailaltgenerator.providers import DescriptionResult
def get_image_data(image_url):
'''
Load external image and return byte data
'''
image_dat... | mit | Python |
58f0088e538ef9fec4a063e6759c5e0a7297a2ae | allow admins to manually update boot_nonce | dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi | PLC/Methods/UpdateNode.py | PLC/Methods/UpdateNode.py | from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Nodes import Node, Nodes
from PLC.Auth import Auth
can_update = lambda (field, value): field in \
['hostname', 'boot_state', 'model', 'version',
'key', 'session', 'boot_nonce']
class U... | from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Nodes import Node, Nodes
from PLC.Auth import Auth
can_update = lambda (field, value): field in \
['hostname', 'boot_state', 'model', 'version',
'key', 'session']
class UpdateNode(Meth... | bsd-3-clause | Python |
3a09318632970f21ff377a03375e754cb70f89e6 | bump to version 0.2.0 | jpiper/pyDNase,jpiper/pyDNase | pyDNase/_version.py | pyDNase/_version.py | __version__ = "0.2.0" | __version__ = "0.2.0dev" | mit | Python |
14b77c8b5611ca38af5ab2f3a3561a1905cf12bd | clean up comments | jld23/saspy,jld23/saspy | saspy/__init__.py | saspy/__init__.py | import os
from saspy.pysas34 import *
from saspy.sasstat import *
from saspy.sasets import *
from saspy.SASLogLexer import *
SAS = SAS_session()
sas = SAS
executable = os.environ.get('SAS_EXECUTABLE', 'sas')
if executable=='sas':
executable='/opt/sasinside/SASHome/SASFoundation/9.4/sas'
e2=executable.split(... | import os
print ("after os")
from saspy.pysas34 import *
print ("after pysas34")
from saspy.sasstat import *
from saspy.sasets import *
from saspy.SASLogLexer import *
print ("after all saspy import")
SAS = SAS_session()
sas = SAS
executable = os.environ.get('SAS_EXECUTABLE', 'sas')
if executable=='sas':
ex... | apache-2.0 | Python |
062ebba81c3c52827c90307c11cca26ba8b6f0be | Move StringIO import to use six for salt.renderers.mako.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/renderers/mako.py | salt/renderers/mako.py | # -*- coding: utf-8 -*-
'''
Mako Renderer for Salt
'''
# Import python libs
from __future__ import absolute_import
# Import salt libs
import salt.ext.six as six
import salt.utils.templates
from salt.exceptions import SaltRenderError
def render(template_file, saltenv='base', sls='', context=None, tmplpath=None, **kw... | # -*- coding: utf-8 -*-
'''
Mako Renderer for Salt
'''
from __future__ import absolute_import
# Import python libs
from StringIO import StringIO
# Import salt libs
import salt.utils.templates
from salt.exceptions import SaltRenderError
def render(template_file, saltenv='base', sls='', context=None, tmplpath=None, ... | apache-2.0 | Python |
f5ef94564a3da9b4ad4106c0c359bc7ced2ade60 | fix user_functions | Fendoe/open-hackathon-o,SpAiNiOr/open-hackathon,juniwang/open-hackathon,msopentechcn/open-hackathon,msopentechcn/open-hackathon,xunxunzgq/open-hackathon-bak_01,mshubian/BAK_open-hackathon,Fendoe/open-hackathon-o,rapidhere/open-hackathon,lclchen/open-hackathon,Fendoe/open-hackathon,SpAiNiOr/open-hackathon,YaningX/open-h... | open-hackathon/src/hackathon/user/user_functions.py | open-hackathon/src/hackathon/user/user_functions.py | __author__ = 'root'
import sys
sys.path.append("..")
from database.models import Experiment
from sqlalchemy import and_
def get_user_experiment(uid):
return map(lambda u: u.json(),
Experiment.query.filter(and_(Experiment.user_id == uid, Experiment.status < 5)).all())
def get_user_hackathon(uid):... | __author__ = 'root'
from database.models import Experiment
from sqlalchemy import and_
def get_user_experiment(uid):
return map(lambda u: u.hackathon.json(),
Experiment.query.filter(and_(Experiment.user_id == uid, Experiment.status < 5)).all())
def get_user_hackathon(uid):
hackathon = get_use... | mit | Python |
c8ca5d37189395b9c6e6ae653a490f034d346f71 | Update wsgi.py for Heroku | alykhank/Tunezout,alykhank/Tunezout | tunezout/wsgi.py | tunezout/wsgi.py | """
WSGI config for tunezout project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | """
WSGI config for tunezout project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | mit | Python |
dd00a3fc81952ce3f45de237de86b21682b08422 | Use SERVE_LOCAL. | BeardedSteve/flask-bootstrap,suvorom/flask-bootstrap,Coxious/flask-bootstrap,moha24/flask-bootstrap,victorbjorklund/flask-bootstrap,scorpiovn/flask-bootstrap,eshijia/flask-bootstrap,suvorom/flask-bootstrap,vishnugonela/flask-bootstrap,livepy/flask-bootstrap,Coxious/flask-bootstrap,eshijia/flask-bootstrap,BeardedSteve/f... | sample_app/__init__.py | sample_app/__init__.py | # Welcome to the Flask-Bootstrap sample application. This will give you a
# guided tour around creating an application using Flask-Bootstrap.
#
# To run this application yourself, please install its requirements first:
#
# $ pip install -r sample_app/requirements.txt
#
# This will, among other things, install Flask-A... | # Welcome to the Flask-Bootstrap sample application. This will give you a
# guided tour around creating an application using Flask-Bootstrap.
#
# To run this application yourself, please install its requirements first:
#
# $ pip install -r sample_app/requirements.txt
#
# This will, among other things, install Flask-A... | apache-2.0 | Python |
35001c26362c32dc313b2e118716763ff673e8a1 | change logger to spider's logger. | wings27/sc_spider | sc_spider/pipelines.py | sc_spider/pipelines.py | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import logging
from pymongo import MongoClient
from pymongo.errors import ServerSelectionTimeoutError
class MongoDBPipeline(o... | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import logging
from pymongo import MongoClient
from pymongo.errors import ServerSelectionTimeoutError
class MongoDBPipeline(o... | apache-2.0 | Python |
0378d60e99d2fe1fedeffa772a809a9dc10a6112 | update sample submission script to reflect API changes | vzhuang/osim-rl,stanfordnmbl/osim-rl | scripts/submit.py | scripts/submit.py | import opensim as osim
from osim.http.client import Client
from osim.env import *
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Flatten, Input, merge
import numpy as np
import argparse
# Settings
CROWDAI_TOKEN = "518ec33d7af656bddfcb83ab614ba079"
remote_base = 'http://grader.cr... | import opensim as osim
from osim.http.client import Client
from osim.env import *
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Flatten, Input, merge
import numpy as np
import argparse
# Settings
CROWDAI_TOKEN = "518ec33d7af656bddfcb83ab614ba079"
remote_base = 'http://grader.cr... | mit | Python |
1248ac83eff730765ec5cc6a0ffbabd7d4db5417 | Change break to continue which makes more sense | zarafagroupware/python-zarafa,zarafagroupware/python-zarafa,hoffie/python-zarafa | scripts/mbox2zarafa.py | scripts/mbox2zarafa.py | #!/usr/bin/env python
import zarafa
import email
import mailbox
from email.header import *
version = 'Mbox 2 Zarafa 1.0'
# Connect to Zarafa server
server = zarafa.Server()
user = server.user('zarafaUser')
# Connect to Mailbox file
mbox = mailbox.mbox('mailbox')
debug = False
def import_mail(mailroot, item):
... | #!/usr/bin/env python
import zarafa
import email
import mailbox
from email.header import *
version = 'Mbox 2 Zarafa 1.0'
# Connect to Zarafa server
server = zarafa.Server()
user = server.user('zarafaUser')
# Connect to Mailbox file
mbox = mailbox.mbox('mailbox')
debug = False
def import_mail(mailroot, item):
... | agpl-3.0 | Python |
5a4f66691fadd174aeeb5b6c860afa2facfb3588 | Use HSTS in release | bill-mccloskey/mozsearch,bill-mccloskey/searchfox,bill-mccloskey/searchfox,bill-mccloskey/mozsearch,bill-mccloskey/mozsearch,bill-mccloskey/searchfox,bill-mccloskey/searchfox,bill-mccloskey/mozsearch,bill-mccloskey/mozsearch,bill-mccloskey/mozsearch,bill-mccloskey/searchfox,bill-mccloskey/searchfox | scripts/nginx-setup.py | scripts/nginx-setup.py | #!/usr/bin/env python
import sys
import json
import os.path
config_fname = sys.argv[1]
doc_root = sys.argv[2]
mozsearch_path = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..'))
config = json.load(open(config_fname))
fmt = {
'doc_root': doc_root,
'mozsearch_path': mozsearch_pa... | #!/usr/bin/env python
import sys
import json
import os.path
config_fname = sys.argv[1]
doc_root = sys.argv[2]
mozsearch_path = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..'))
config = json.load(open(config_fname))
fmt = {'doc_root': doc_root, 'mozsearch_path': mozsearch_path}
... | mpl-2.0 | Python |
d9d7d0eb96951f5b9824675fda35c8b3cc093788 | Update Blink | nerginer/GrovePi,stwolny/GrovePi,penoud/GrovePi,NeuroRoboticTech/Jetduino,NeuroRoboticTech/Jetduino,karan259/GrovePi,penoud/GrovePi,NeuroRoboticTech/Jetduino,penoud/GrovePi,nerginer/GrovePi,penoud/GrovePi,stwolny/GrovePi,nerginer/GrovePi,rpedersen/GrovePi,rpedersen/GrovePi,nerginer/GrovePi,karan259/GrovePi,stwolny/Grov... | Software/Python/grovepi_blink.py | Software/Python/grovepi_blink.py | import smbus
import time
import grovepi
# for RPI version 1, use "bus = smbus.SMBus(0)"
# Attach GrovePi LED to port D4.
bus = smbus.SMBus(0)
# This is the address we setup in the Arduino Program
address = 0x04
grovepi.pinMode(4,"OUTPUT")
time.sleep(1)
#similar to loop() of Arduino
while True:
#digital... | import smbus
import time
import grovepi
# for RPI version 1, use "bus = smbus.SMBus(0)"
bus = smbus.SMBus(0)
# This is the address we setup in the Arduino Program
address = 0x04
grovepi.pinMode(4,"OUTPUT")
time.sleep(1)
#similar to loop() of Arduino
while True:
#digitalWrite() on pin 4 with HIGH
grov... | mit | Python |
ad7179591ee4d640ff69254e0bba4ba7db1ce2da | Fix migration hack | kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi | kpi/migrations/0004_default_permissions_1910.py | kpi/migrations/0004_default_permissions_1910.py | # coding: utf-8
from django.db import models, migrations
from django.contrib.auth import get_user_model
from django.contrib.auth.management import create_permissions
from kpi.utils.permissions import grant_all_model_level_perms
def default_permissions_to_existing_users(apps, schema_editor):
# The permissions obje... | # coding: utf-8
from django.db import models, migrations
from django.contrib.auth import get_user_model
from django.contrib.auth.management import create_permissions
from kpi.utils.permissions import grant_all_model_level_perms
def default_permissions_to_existing_users(apps, schema_editor):
# The permissions obje... | agpl-3.0 | Python |
98fac025164b879c4fa7d8b12d1176421c985e2f | Fix filter tests | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/export/tests/test_export_forms.py | corehq/apps/export/tests/test_export_forms.py | import datetime
from collections import namedtuple
import pytz
from django.test import SimpleTestCase
from mock import patch
from corehq.apps.export.filters import FormSubmittedByFilter
from corehq.apps.export.forms import FilterFormESExportDownloadForm
class TestFilterFormESExportDownloadForm(SimpleTestCase):
... | import datetime
from collections import namedtuple
import pytz
from django.test import SimpleTestCase
from mock import patch
from corehq.apps.export.filters import FormSubmittedByFilter
from corehq.apps.export.forms import FilterFormESExportDownloadForm
@patch('corehq.apps.reports.util.get_first_form_submission_rec... | bsd-3-clause | Python |
60be522cab1a4d08ecff4d522890ab144700fd47 | clarify user msg | hdm-dt-fb/rvt_model_services,hdm-dt-fb/rvt_model_services | commands/detect_str_col_changes_no_ws/data_handler.py | commands/detect_str_col_changes_no_ws/data_handler.py | import os
import re
from pathlib import Path
from . import elem_compare
from notify.email import send_mail
from utils import dir_purger
def data_pickup_and_compare(project_code):
model_path = os.environ["RVT_QC_PATH"]
model_title = os.path.basename(model_path).split(".rvt")[0]
re_string = r"\d{8}_\d{4}_... | import os
import re
from pathlib import Path
from . import elem_compare
from notify.email import send_mail
from utils import dir_purger
def data_pickup_and_compare(project_code):
model_path = os.environ["RVT_QC_PATH"]
model_title = os.path.basename(model_path).split(".rvt")[0]
re_string = r"\d{8}_\d{4}_... | mit | Python |
2c141e92ccbc6ab749c8002917c6bfc4fbe08d86 | document test purpose better | dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,gmimano/commcaretest,dimagi/commcare-hq,qedsoftware/commcare-hq,gmimano/commcaretest,gmimano/commcaretest,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/comm... | corehq/apps/hqcase/tests/test_object_cache.py | corehq/apps/hqcase/tests/test_object_cache.py | import StringIO
import hashlib
from django.test import RequestFactory
from django.test.client import Client
import ipdb
from corehq.apps.domain.models import Domain
import time
from corehq.apps.users.models import CommCareUser, WebUser
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.tests imp... | import StringIO
import hashlib
from django.test import RequestFactory
from django.test.client import Client
import ipdb
from corehq.apps.domain.models import Domain
import time
from corehq.apps.users.models import CommCareUser, WebUser
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.tests imp... | bsd-3-clause | Python |
03cbdde654f4abc808dfb6265ab17177c7c945f2 | add prefix tag | linkmax91/bitquant,linkmax91/bitquant,joequant/bitquant,joequant/bitquant,joequant/bitquant,linkmax91/bitquant,linkmax91/bitquant,joequant/bitquant,linkmax91/bitquant,linkmax91/bitquant,joequant/bitquant | web/scripts/bitquantutils.py | web/scripts/bitquantutils.py | import tornado.ioloop
has_ioloop = tornado.ioloop.IOLoop.initialized()
def register_port(prefix, port):
import json
import urllib.request
data = {"prefix" : prefix, "port" : port }
request = urllib.request.Request("http://localhost/app/register")
request.add_header('Content-Type', 'application/json... | import tornado.ioloop
has_ioloop = tornado.ioloop.IOLoop.initialized()
def register_port(prefix, port):
import json
import urllib.request
data = {"prefix" : prefix, "port" : port }
request = urllib.request.Request("http://localhost/app/register")
request.add_header('Content-Type', 'application/json... | bsd-2-clause | Python |
f2473c0e0f51f99be31cad5e478f9f0394dbfe27 | swap node pairs | sinderpl/CodingExamples,sinderpl/CodingExamples,sinderpl/CodingExamples,sinderpl/CodingExamples,sinderpl/CodingExamples | python/Algorithms/Recursion/swapNodeInPairs.py | python/Algorithms/Recursion/swapNodeInPairs.py | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def swapPairs(self, head: Optional[ListNode]) -> Optional[ListNode]:
if not head or not head.next:
return head
t... | sd dsds | mit | Python |
f4f05f0c39c28c7455748a4e3675fd79fc940dd7 | Reduce log output | Autostew/autostew,Autostew/autostew,Autostew/autostew | autostew_back/settings.py | autostew_back/settings.py | import logging
logging.getLogger().setLevel(logging.INFO)
logging.getLogger('django.db.backends').setLevel(logging.INFO)
logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.ERROR)
event_poll_period = 1
full_update_period = 5
api_record_destination = "api_record"
api_compatibility = {
... | import logging
logging.getLogger().setLevel(logging.INFO)
logging.getLogger('django.db.backends').setLevel(logging.INFO)
logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.WARNING)
event_poll_period = 1
full_update_period = 5
api_record_destination = "api_record"
api_compatibility = {
... | agpl-3.0 | Python |
4792abf46c1dae84b599e598dc3f7671f90a356c | Add license | isbm/salt-huelamp | salt/modules/philips_hue.py | salt/modules/philips_hue.py | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE 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 agr... | # -*- coding: utf-8 -*-
'''
Philips HUE lamps module for proxy.
'''
from __future__ import absolute_import
import sys
__virtualname__ = 'hue'
__proxyenabled__ = ['philips_hue']
def _proxy():
'''
Get proxy.
'''
return __opts__['proxymodule']
def __virtual__():
'''
Start the Philips HUE only... | apache-2.0 | Python |
76513ba2bb1570aa8e2565811fc79b6f3bd3729d | Remove default parameter from solution stub (#1641) | jmluy/xpython,smalley/python,behrtam/xpython,exercism/xpython,exercism/xpython,behrtam/xpython,jmluy/xpython,smalley/python,exercism/python,N-Parsons/exercism-python,exercism/python,N-Parsons/exercism-python | exercises/two-fer/two_fer.py | exercises/two-fer/two_fer.py | def two_fer(name):
pass
| def two_fer(name="you"):
pass
| mit | Python |
bfed753e15ed78bd7d6b605540a7432b6ed164b8 | use new caching middleware, validate sections (in a naive, stupid way i guess) | arturtamborski/wypok,arturtamborski/wypok,arturtamborski/wypok,arturtamborski/wypok | sections/views.py | sections/views.py | from allauth.account.decorators import verified_email_required as login_required
from django.conf import settings
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse
from django.http import HttpResponseNotFound, Http404
from wypok.cache import mark_for_caching
from . import ... | from django.views.decorators.cache import cache_page
from django.conf import settings
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse
from . import models
from . import forms
@cache_page(settings.CACHE_TTL)
def home(request, section=None):
if section is None:
... | mit | Python |
1130ffea97eabec05650d0ead7af7d50e6d7e476 | Update programa4.py | eliecer11/Uip-prog3 | Tareas-f/programa4.py | Tareas-f/programa4.py |
chance = 0
minutos = 0
while chance < 10:
tiempo = int(input("Introduzca el tiempo en minutos: "))
chance +=1
if tiempo / 60:
dias = 24 - tiempo % 24
horas = 8 - tiempo % 8
minutos = 60 - tiempo % 60
print(dias)
print(horas)
print(minutos)
... |
chance = 0
minutos = 0
while chance < 10:
tiempo = int(input("Introduzca el tiempo en minutos: "))
chance +=1
if tiempo / 60:
dias = 24 - tiempo % 24
horas = 8 - tiempo % 8
minutos = 60 - tiempo % 60
print(dias)
print(horas)
print(minutos)
... | mit | Python |
67203719bf4d6f000b3ba3d627df55ef5f4c430d | Add some more checks | awau/Amethyst,HexadecimalPython/Xeili | utils/confirm.py | utils/confirm.py | from utils.command_system import check
import __main__
import discord
def instance_owner():
def checker(ctx):
return str(ctx.msg.author.id) in __main__.amethyst.owners
return check(checker, True)
def instance_guild():
def checker(ctx):
return not ctx.is_dm()
return check(checker)
... | from utils.command_system import check
import __main__
def instance_owner():
def checker(ctx):
return str(ctx.msg.author.id) in __main__.amethyst.owners
return check(checker, True)
def instance_guild():
def checker(ctx):
return not ctx.is_dm()
return check(checker)
| mit | Python |
c81b9cb1d89a9cccd43a4529ba93b71b02e87ff8 | Fix Selection::remove | onitake/Uranium,onitake/Uranium | UM/Scene/Selection.py | UM/Scene/Selection.py | from UM.Signal import Signal
class Selection:
@classmethod
def add(cls, object):
if not object in cls.__selection:
cls.__selection.append(object)
cls.selectionChanged.emit()
@classmethod
def remove(cls, object):
if object in cls.__selection:
cls.__se... | from UM.Signal import Signal
class Selection:
@classmethod
def add(cls, object):
if not object in cls.__selection:
cls.__selection.append(object)
cls.selectionChanged.emit()
@classmethod
def remove(cls, object):
if object in cls._selection:
cls.__sel... | agpl-3.0 | Python |
80d1a7e19f8439d146baa93e6bbc712c14d004f8 | set default false allow_cnpj_multi_ie | thinkopensolutions/l10n-brazil,rvalyi/l10n-brazil,odoo-brazil/l10n-brazil-wip,thinkopensolutions/l10n-brazil,odoo-brazil/l10n-brazil-wip,rvalyi/l10n-brazil | l10n_br_base/models/res_config.py | l10n_br_base/models/res_config.py | # -*- coding: utf-8 -*-
from openerp import fields, models
from openerp.tools.safe_eval import safe_eval
class res_config(models.TransientModel):
_inherit = 'base.config.settings'
allow_cnpj_multi_ie = fields.Boolean(
string=u'Permitir o cadastro de Customers com CNPJs iguais',
default=False... | # -*- coding: utf-8 -*-
from openerp import fields, models
from openerp.tools.safe_eval import safe_eval
class res_config(models.TransientModel):
_inherit = 'base.config.settings'
allow_cnpj_multi_ie = fields.Boolean(
string=u'Permitir o cadastro de Customers com CNPJs iguais',
default=True,... | agpl-3.0 | Python |
b2c527e912260253be459c9ad3dd6139be21a75d | Update manager API for update. | REANNZ/faucet,faucetsdn/faucet,mwutzke/faucet,anarkiwi/faucet,shivarammysore/faucet,trungdtbk/faucet,REANNZ/faucet,gizmoguy/faucet,anarkiwi/faucet,mwutzke/faucet,trungdtbk/faucet,shivarammysore/faucet,faucetsdn/faucet,gizmoguy/faucet | faucet/valve_manager_base.py | faucet/valve_manager_base.py | """Valve Manager base class"""
# pylint: disable=R0201
# pylint: disable=W0613
class ValveManagerBase: # pylint: disable=too-few-public-methods
"""Base class for ValveManager objects.
Expected to control the installation of flows into datapath tables.
Ideally each datapath table should be controlled by 1... | """Valve Manager base class"""
# pylint: disable=R0201
# pylint: disable=W0613
class ValveManagerBase: # pylint: disable=too-few-public-methods
"""Base class for ValveManager objects.
Expected to control the installation of flows into datapath tables.
Ideally each datapath table should be controlled by 1... | apache-2.0 | Python |
26f48bc7a5e39f50b035f20a517664dade87b981 | Add support for relativedelta timespecs | CodeYellowBV/django-binder | binder/json.py | binder/json.py | import json
import datetime
from uuid import UUID
from django.http import HttpResponse
from .exceptions import BinderRequestError
try:
from dateutil.relativedelta import relativedelta
from relativedeltafield import format_relativedelta
except ImportError:
class relativedelta:
pass
class BinderJSONEncoder(json.... | import json
import datetime
from uuid import UUID
from django.http import HttpResponse
from .exceptions import BinderRequestError
class BinderJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime.datetime):
# FIXME: was .isoformat(), but that omits the microseconds if they
# a... | mit | Python |
a9dac864e71ab7781fd52997eee3db0c5c1b239d | delete messages | Amechi101/indieapp,Amechi101/indieapp,Amechi101/indieapp | _backend_api/views.py | _backend_api/views.py | from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.contrib import auth, messages
from django.views.generic import ListView
from django.views.generic.detail import SingleObjectMixin
from _backend_api.models import Product, Brand, Location
from subscription.mo... | from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.contrib import auth, messages
from django.views.generic import ListView
from django.views.generic.detail import SingleObjectMixin
from _backend_api.models import Product, Brand, Location
from subscription.mo... | mit | Python |
5b9b8b573b87d2c52e34433b1f84e9e19af88e7e | Add "PEP" into cookbook | leven-cn/admin-linux,leven-cn/admin-linux | _cookbook/__init__.py | _cookbook/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''@package _cookbook
Python Cookbook
- unittest
- doctest
- Number Division
- Loop Techniques
- Unpack Iterable
- Output Format
- Function Arguments
- OOP
- Context Manager
- file I/O
- Find & Sort Algorithms
- Text Pattern
- Network
## Comm... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''@package _cookbook
Python Cookbook
- unittest
- doctest
- Number Division
- Loop Techniques
- Unpack Iterable
- Output Format
- Function Arguments
- OOP
- Context Manager
- file I/O
- Find & Sort Algorithms
- Text Pattern
- Network
Python ... | apache-2.0 | Python |
83569193ee8a0df74a7772d5f30a19784a8c6c32 | Apply renaming | openfisca/country-template,openfisca/country-template | openfisca_country_template/reforms/modify_social_security_taxation.py | openfisca_country_template/reforms/modify_social_security_taxation.py | # -*- coding: utf-8 -*-
# This file defines a reform.
# A reform is a set of modifications to be applied to a reference tax and benefit system to carry out experiments.
# See https://doc.openfisca.fr/reforms.html
# Import from openfisca-core the common python objects used to code the legislation in OpenFisca
from op... | # -*- coding: utf-8 -*-
# This file defines a reform.
# A reform is a set of modifications to be applied to a reference tax and benefit system to carry out experiments.
# See https://doc.openfisca.fr/reforms.html
# Import from openfisca-core the common python objects used to code the legislation in OpenFisca
from op... | agpl-3.0 | Python |
e8e22f18cba317a165e1b36af268b0696837b281 | Use the imp module to get the magic word. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Tools/scripts/checkpyc.py | Tools/scripts/checkpyc.py | #! /usr/bin/env python
# Check that all ".pyc" files exist and are up-to-date
# Uses module 'os'
import sys
import os
from stat import ST_MTIME
import imp
def main():
silent = 0
verbose = 0
if sys.argv[1:]:
if sys.argv[1] == '-v':
verbose = 1
elif sys.argv[1] == '-s':
silent = 1
MAGIC = imp.get_magic()
... | #! /usr/bin/env python
# Check that all ".pyc" files exist and are up-to-date
# Uses module 'os'
import sys
import os
from stat import ST_MTIME
def main():
silent = 0
verbose = 0
if sys.argv[1:]:
if sys.argv[1] == '-v':
verbose = 1
elif sys.argv[1] == '-s':
silent = 1
MAGIC = '\0\0\0\0'
try:
if sys.v... | mit | Python |
2a35b7f03a9ef7355387d6741dc8f8b0a59c9e46 | Remove stray comments | westerncapelabs/django-grs-gatewaycms | services/admin.py | services/admin.py | from django.contrib import admin
from models import (Category, Service)
from django import forms
from django.forms.models import BaseInlineFormSet
class ServiceFormset(BaseInlineFormSet):
def clean(self):
super(ServiceFormset, self).clean()
for form in self.forms:
if not hasattr(form,... | # from django.contrib import admin
# from services.models import Service
# class ServiceAdmin(admin.ModelAdmin):
# list_display = ["name", "content_1", "content_2", "content_3", "sms"]
# admin.site.register(Service, ServiceAdmin)
# -----
from django.contrib import admin
from models import (Category, Service)
... | mit | Python |
2d65eb16990caeaf242de4820fc8e97625677019 | change route | josip-milic/asc_qwerty_test,josip-milic/asc_qwerty_test,josip-milic/asc_qwerty_test | qwerty/app/views.py | qwerty/app/views.py | from django.http import HttpResponse
from models import Event
from django.shortcuts import render
from .serializer import EventSerializer
from django.template import loader
def index(request):
a = 2
template = loader.get_template('app/index.html')
return HttpResponse(template.render({}, request))
def... | from django.http import HttpResponse
from models import Event
from django.shortcuts import render
from .serializer import EventSerializer
from django.template import loader
def index(request):
template = loader.get_template('app/index.html')
return HttpResponse(template.render({}, request))
def get_event... | apache-2.0 | Python |
a1018ae5fb92e15469711746e24be3f43d5ff073 | Use generate long slug on save model admin channel | YACOWS/opps,williamroot/opps,opps/opps,jeanmask/opps,williamroot/opps,williamroot/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,jeanmask/opps,opps/opps,opps/opps | opps/channel/admin.py | opps/channel/admin.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.auth.models import User
from opps.channel.models import Channel
from opps.channel.utils import generate_long_slug
class ChannelAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
exclude = ('user', 'long_slug')
... | # -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.auth.models import User
from opps.channel.models import Channel
class ChannelAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
exclude = ('user', 'long_slug')
def save_model(self, request, obj, form, change):
... | mit | Python |
295501f789326b34bc5d94ebdb40013d1b9d384d | update script to use heroku environ variables | IQSS/miniverse,IQSS/miniverse,IQSS/miniverse | scripts/copy_logos_to_s3.py | scripts/copy_logos_to_s3.py | """
Quick script to upload existing markers to S3 using Bucketeer created creds
"""
import os
from os.path import join
from boto.s3.connection import S3Connection
from boto.s3.key import Key
aws_bucket_url = os.environ['BUCKETEER_AWS_PUBLIC_URL']
aws_access_key = os.environ['BUCKETEER_AWS_ACCESS_KEY_ID']
aws_secret ... | """
Quick script to upload existing markers to S3 using Bucketeer created creds
"""
import os
from os.path import join
from boto.s3.connection import S3Connection
from boto.s3.key import Key
aws_bucket_url = 'the-url'
aws_access_key = 'ok-there'
aws_secret = 'blah'
conn = S3Connection(aws_access_key, aws_secret)
buc... | mit | Python |
7e0daffc0f30b4a5d3ed14c626bb5e327afe83d0 | Fix error on searching logged actions in the admin interface | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | candidates/admin.py | candidates/admin.py | from __future__ import unicode_literals
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.forms import ModelForm
from .models import (
LoggedAction, PartySet, ExtraField, PersonExtraFieldValue,
SimplePopoloField, ComplexPopoloField, PostExtraElection
)
class LoggedAc... | from __future__ import unicode_literals
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.forms import ModelForm
from .models import (
LoggedAction, PartySet, ExtraField, PersonExtraFieldValue,
SimplePopoloField, ComplexPopoloField, PostExtraElection
)
class LoggedAc... | agpl-3.0 | Python |
93eb47d1aadab796ec405c28cf553121bd1951d1 | add a repeat option to the bench function | simphony/simphony-common | simphony/bench/util.py | simphony/bench/util.py | from __future__ import print_function
from timeit import Timer
def bench(stmt='pass', setup='pass', repeat=5):
""" BenchMark the function.
"""
timer = Timer(stmt, setup)
for i in range(100):
number = 10**i
time = timer.timeit(number)
if time > 0.2:
break
times... | from __future__ import print_function
from timeit import Timer
def bench(stmt='pass', setup='pass'):
""" BenchMark the function.
"""
timer = Timer(stmt, setup)
for i in range(100):
number = 10**i
time = timer.timeit(number)
if time > 0.2:
break
times = [timer.... | bsd-2-clause | Python |
82ba42bf269e7897129976c07d28b4bc0f23df69 | Enable keyword arguments when requesting metafields | Shopify/shopify_python_api | shopify/mixins.py | shopify/mixins.py | import shopify.resources
class Countable(object):
@classmethod
def count(cls, _options=None, **kwargs):
if _options is None:
_options = kwargs
return int(cls.get("count", **_options))
class Metafields(object):
def metafields(self, _options=None, **kwargs):
if _option... | import shopify.resources
class Countable(object):
@classmethod
def count(cls, _options=None, **kwargs):
if _options is None:
_options = kwargs
return int(cls.get("count", **_options))
class Metafields(object):
def metafields(self):
return shopify.resources.Metafield.... | mit | Python |
6cd9a11e6b54fdb986d5398e0012005905fdf908 | Fix debug user creation. | bjaress/shortanswer | shortapp/views.py | shortapp/views.py | from django.shortcuts import render
from django.http import HttpResponseRedirect
from .models import QuestionForm, Question
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.http import HttpResponse
from django.contrib.auth import logout as auth_logout, login as auth... | from django.shortcuts import render
from django.http import HttpResponseRedirect
from .models import QuestionForm, Question
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.http import HttpResponse
from django.contrib.auth import logout as auth_logout, login as auth... | agpl-3.0 | Python |
e93b9d9a99026eb98c192134087dd9d1ce4f9ce5 | add a custom converter for BannedMembers | Naught0/qtbot | cogs/mod.py | cogs/mod.py | #!/bin/env python3
import discord
from discord.ext import commands
# This bit allows me to more easily unban members via ID or name#discrim
# Taken mostly from R. Danny
# https://github.com/Rapptz/RoboDanny/blob/rewrite/cogs/mod.py#L83-L94
class BannedMember(commands.Converter):
async def convert(self, ctx, arg)... | #!/bin/env python3
import discord
from discord.ext import commands
class Moderator:
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['k'])
@commands.has_permissions(kick_members=True)
async def kick(self, ctx, member: discord.Member, *, reason=None):
""" Kick a membe... | mit | Python |
6516ec0f6f167c3ffe3110d21e174075fe9a83c0 | Use permission_required decorator | pinax/pinax-boxes,eldarion/django-boxes | boxes/views.py | boxes/views.py | import json
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseForbidden
from django.shortcuts import redirect
from django.template import RequestContext
from django.template.loader import render_to_string
from django.utils import timezone
from django.views.decorators.http i... | import json
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseForbidden
from django.shortcuts import redirect
from django.template import RequestContext
from django.template.loader import render_to_string
from django.utils import timezone
from django.views.decorators.http i... | unknown | Python |
ca07d9dbd84a6962e0bc1528fdee44c59abd1898 | Fix count when the attribute is not in the response | CartoDB/cartodb-python,CartoDB/carto-python | carto/paginators.py | carto/paginators.py | """
Used internally to retrieve results paginated
.. module:: carto.paginators
:platform: Unix, Windows
:synopsis: Used internally to retrieve results paginated
.. moduleauthor:: Daniel Carrion <daniel@carto.com>
.. moduleauthor:: Alberto Romeu <alrocar@carto.com>
"""
from pyrestcli.paginators import Paginat... | """
Used internally to retrieve results paginated
.. module:: carto.paginators
:platform: Unix, Windows
:synopsis: Used internally to retrieve results paginated
.. moduleauthor:: Daniel Carrion <daniel@carto.com>
.. moduleauthor:: Alberto Romeu <alrocar@carto.com>
"""
from pyrestcli.paginators import Paginat... | bsd-3-clause | Python |
6a6a2cf8958a185ec217473786bcf3606cf383de | Fix CartoPaginator | CartoDB/cartodb-python,CartoDB/carto-python | carto/paginators.py | carto/paginators.py | """
Used internally to retrieve results paginated
.. module:: carto.paginators
:platform: Unix, Windows
:synopsis: Used internally to retrieve results paginated
.. moduleauthor:: Daniel Carrion <daniel@carto.com>
.. moduleauthor:: Alberto Romeu <alrocar@carto.com>
"""
from pyrestcli.paginators import Paginat... | """
Used internally to retrieve results paginated
.. module:: carto.paginators
:platform: Unix, Windows
:synopsis: Used internally to retrieve results paginated
.. moduleauthor:: Daniel Carrion <daniel@carto.com>
.. moduleauthor:: Alberto Romeu <alrocar@carto.com>
"""
from pyrestcli.paginators import Paginat... | bsd-3-clause | Python |
be934e5f9ba000f536c6ba83d4c3fd98723a13b0 | Make ResourceTypesTests skippable | openstack/horizon,BiznetGIO/horizon,NeCTAR-RC/horizon,noironetworks/horizon,openstack/horizon,openstack/horizon,openstack/horizon,yeming233/horizon,noironetworks/horizon,ChameleonCloud/horizon,yeming233/horizon,yeming233/horizon,ChameleonCloud/horizon,NeCTAR-RC/horizon,NeCTAR-RC/horizon,BiznetGIO/horizon,BiznetGIO/hori... | openstack_dashboard/dashboards/project/stacks/resource_types/tests.py | openstack_dashboard/dashboards/project/stacks/resource_types/tests.py | # 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, software
# distributed under the... | # 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, software
# distributed under the... | apache-2.0 | Python |
7895849d54d14a4087f163af3dcbf3792042c413 | Make modules uninstallable | OCA/social,OCA/social,OCA/social | mail_restrict_follower_selection/__openerp__.py | mail_restrict_follower_selection/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | agpl-3.0 | Python |
bf8edda9ce22602667a772f61b866b1f72ce0d98 | Convert bytes to string moose/scripts | sapitts/moose,bwspenc/moose,laagesen/moose,SudiptaBiswas/moose,andrsd/moose,harterj/moose,SudiptaBiswas/moose,sapitts/moose,nuclear-wizard/moose,laagesen/moose,milljm/moose,andrsd/moose,dschwen/moose,andrsd/moose,bwspenc/moose,andrsd/moose,laagesen/moose,bwspenc/moose,sapitts/moose,SudiptaBiswas/moose,idaholab/moose,nu... | scripts/are_queued_jobs_finished.py | scripts/are_queued_jobs_finished.py | #!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgp... | #!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgp... | lgpl-2.1 | Python |
14321203ac4b883654f0de29f9601ad172b9da65 | Make SSL nodelay | blynkkk/blynk-library,al1271/blynk-library,csicar/blynk-library,okhiroyuki/blynk-library,radut/blynk-library,CedricFinance/blynk-library,radut/blynk-library,sstocker46/blynk-library,blynkkk/blynk-library,blynkkk/blynk-library,csicar/blynk-library,sstocker46/blynk-library,ivankravets/blynk-library,radut/blynk-library,iv... | scripts/blynk/gateway/socket_ssl.py | scripts/blynk/gateway/socket_ssl.py | from __future__ import print_function
import socket
import ssl
from .socket_tcp import BlynkTcpClient
__author__ = "Volodymyr Shymanskyy"
__copyright__ = "Copyright (c) 2015 Volodymyr Shymanskyy"
__license__ = "MIT"
__status__ = "Prototype"
class BlynkSslClient(BlynkTcpClient):
def __init__(self, host, p... | from __future__ import print_function
import socket
import ssl
from .socket_tcp import BlynkTcpClient
__author__ = "Volodymyr Shymanskyy"
__copyright__ = "Copyright (c) 2015 Volodymyr Shymanskyy"
__license__ = "MIT"
__status__ = "Prototype"
class BlynkSslClient(BlynkTcpClient):
def __init__(self, host, p... | mit | Python |
15ca1675f61443d0bbdf153a338077e015ecc1a3 | remove unused func | qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/ex-submodules/casexml/apps/case/tests/test_out_of_order_processing.py | corehq/ex-submodules/casexml/apps/case/tests/test_out_of_order_processing.py | import os
from django.test.utils import override_settings
from django.test import TestCase
from casexml.apps.case.tests.util import delete_all_cases
from corehq.form_processor.interfaces import FormProcessorInterface
@override_settings(CASEXML_FORCE_DOMAIN_CHECK=False)
class OutOfOrderCaseTest(TestCase):
def set... | import os
from django.test.utils import override_settings
from django.test import TestCase
from casexml.apps.case.tests.util import post_util as real_post_util, delete_all_cases
from corehq.form_processor.interfaces import FormProcessorInterface
def post_util(**kwargs):
form_extras = kwargs.get('form_extras', {})... | bsd-3-clause | Python |
7c43298e3e8461a0e0389fcd3b6dc6d6589a08e6 | Add failing test for MFA secret regeneration | kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi | kobo/apps/mfa/tests/test_api.py | kobo/apps/mfa/tests/test_api.py | # coding: utf-8
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework import status
from trench.settings import api_settings
from trench.utils import get_mfa_model
from kpi.tests.kpi_test_case import BaseTestCase
class MfaApiTestCase(BaseTestCase):
fixtures = ['test_dat... | # coding: utf-8
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework import status
from trench.utils import get_mfa_model
from kpi.tests.kpi_test_case import BaseTestCase
class MfaApiTestCase(BaseTestCase):
fixtures = ['test_data']
"""
The purpose of this clas... | agpl-3.0 | Python |
f3ffc74d6d1de85897d1c4036de28126eec745e0 | Fix bug in BaseResourceGenerator where missed options were added | uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged | csunplugged/utils/BaseResourceGenerator.py | csunplugged/utils/BaseResourceGenerator.py | """Class for generator for a resource."""
from django.http import Http404
from abc import ABC, abstractmethod
from utils.str_to_bool import str_to_bool
class BaseResourceGenerator(ABC):
"""Class for generator for a resource."""
default_valid_options = {
"paper_size": ["a4", "letter"]
}
addit... | """Class for generator for a resource."""
from django.http import Http404
from abc import ABC, abstractmethod
from utils.str_to_bool import str_to_bool
class BaseResourceGenerator(ABC):
"""Class for generator for a resource."""
default_valid_options = {
"paper_size": ["a4", "letter"]
}
addit... | mit | Python |
0d0fc348995f429ab50bda6df2788425127e073a | add app parameter to start event | stanislavfeldman/wsjson-server | wsjson/server.py | wsjson/server.py | # -*- coding: utf-8 -*-
from putils.types import Dict
import inspect
from geventwebsocket import WebSocketServer
from werkzeug.wsgi import SharedDataMiddleware
from putils.patterns import Singleton
from router import Router
import gevent
import signal
from pev import Eventer
import logging
logger = logging.getLogger(__... | # -*- coding: utf-8 -*-
from putils.types import Dict
import inspect
from geventwebsocket import WebSocketServer
from werkzeug.wsgi import SharedDataMiddleware
from putils.patterns import Singleton
from router import Router
import gevent
import signal
from pev import Eventer
import logging
logger = logging.getLogger(__... | bsd-3-clause | Python |
ef54c67d900c8f82c8bc5688935e8700d30dea49 | Fix bug when logging requests | bcb/jsonrpcclient | jsonrpcclient/http_server.py | jsonrpcclient/http_server.py | """
HTTPServer
**********
An HTTP server to communicate with, for example::
HTTPServer('http://example.com/api').request('go')
"""
from requests import Request, Session
from jsonrpcclient.server import Server
class HTTPServer(Server):
"""
:param endpoint: The server address.
:param kwargs: HTTP he... | """
HTTPServer
**********
An HTTP server to communicate with, for example::
HTTPServer('http://example.com/api').request('go')
"""
from requests import Request, Session
from jsonrpcclient.server import Server
class HTTPServer(Server):
"""
:param endpoint: The server address.
:param kwargs: HTTP he... | mit | Python |
89a4f714fafc9d41fbad768b14ac093995cb47f5 | Revert "refactor(nodetool.py): less instance attributes" | scylladb/scylla-longevity-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-longevity-tests,scylladb/scylla-longevity-tests | sdcm/sct_events/nodetool.py | sdcm/sct_events/nodetool.py | # This program 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.
#
# This program is distributed in the hope that it will be usefu... | # This program 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.
#
# This program is distributed in the hope that it will be usefu... | agpl-3.0 | Python |
d5bc30b959b67d004ffcfbd0ad7903e3c937bf04 | Update Katib SDK version (#1931) | kubeflow/katib,kubeflow/katib,kubeflow/katib,kubeflow/katib,kubeflow/katib,kubeflow/katib | sdk/python/v1beta1/setup.py | sdk/python/v1beta1/setup.py | # Copyright 2021 The Kubeflow 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 2021 The Kubeflow 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 ... | apache-2.0 | Python |
440a25076eebb2e4c46c32ab2dde297d4185f2c1 | Fix small issue with the android activity formatting | joshzarrabi/e-mission-server,yw374cornell/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,joshzarrabi/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,joshzarrabi/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,joshzarrabi/e-mi... | emission/net/usercache/formatters/android/activity.py | emission/net/usercache/formatters/android/activity.py | import logging
import emission.net.usercache.formatters.android.motion_activity as fam
def format(entry):
entry["metadata"]["key"] = "background/motion_activity"
return fam.format(entry)
| import logging
import emission.net.usercache.formatters.android.motion_activity as fam
def format(entry):
entry.metadata.key = "background/motion_activity"
return fam.format(entry)
| bsd-3-clause | Python |
c1d973985eb063cb1d85e2d517b787821b40dd20 | Kill octave-cli as well | blink1073/oct2py,blink1073/oct2py | oct2py/__init__.py | oct2py/__init__.py | # -*- coding: utf-8 -*-
"""
Oct2Py is a means to seamlessly call M-files and GNU Octave functions from Python.
It manages the Octave session for you, sharing data behind the scenes using
MAT files. Usage is as simple as:
.. code-block:: python
>>> import oct2py
>>> oc = oct2py.Oct2Py()
>>> x =... | # -*- coding: utf-8 -*-
"""
Oct2Py is a means to seamlessly call M-files and GNU Octave functions from Python.
It manages the Octave session for you, sharing data behind the scenes using
MAT files. Usage is as simple as:
.. code-block:: python
>>> import oct2py
>>> oc = oct2py.Oct2Py()
>>> x =... | mit | Python |
47d27ec7844c5c56f902080c0ba013d28e64c491 | Correct use of noqa | sileht/keystoneauth,citrix-openstack-build/keystoneauth,jamielennox/keystoneauth | keystoneclient/exceptions.py | keystoneclient/exceptions.py | # Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 Nebula, 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 ... | # Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 Nebula, 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 ... | apache-2.0 | Python |
e55f4a745b924fedd03ee88815113c21b399c20f | add more labels | OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic | ogusa/constants.py | ogusa/constants.py | VAR_LABELS = {'Y': 'GDP ($Y_t$)', 'C': 'Consumption ($C_t$)',
'K': 'Capital Stock ($K_t$)', 'L': 'Labor ($L_t$)',
'nssmat': 'Labor Supply', 'n_mat': 'Labor Supply'}
ToGDP_LABELS = {'D': 'Debt-to-GDP ($D_{t}/Y_t$)'}
| VAR_LABELS = {'Y': 'GDP ($Y_t$)', 'C': 'Consumption ($C_t$)',
'K': 'Capital Stock ($K_t$)', 'L': 'Labor ($L_t$)'}
ToGDP_LABELS = {'D': 'Debt-to-GDP ($D_{t}/Y_t$)'}
| mit | Python |
5f844d384ba20d02b2a80e9218019366d45f97de | Replace the variable name object by obj in factory (assignement to reserved built-in symbol) #7 | synw/django-chartflo,synw/django-chartflo,synw/django-chartflo | chartflo/factory.py | chartflo/factory.py | # -*- coding: utf-8 -*-
class ChartController():
def package(self, chart_id, data_label, dataset, legend=False):
return {'chart_id': chart_id, 'data_label': data_label, "dataset": dataset, "legend": legend}
def count(self, query, field=None, func=None):
pack = {}
if field is not None... | # -*- coding: utf-8 -*-
class ChartController():
def package(self, chart_id, data_label, dataset, legend=False):
return {'chart_id': chart_id, 'data_label': data_label, "dataset": dataset, "legend": legend}
def count(self, query, field=None, func=None):
pack = {}
if field is not None... | mit | Python |
d1c6636245465a22aeb55a2a7c80eb64150eb656 | Fix #4 for older ConfigParser versions | mkollaro/launchpadstats | launchpadstats/configuration.py | launchpadstats/configuration.py | # Copyright (c) 2014 Red Hat, 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 ... | # Copyright (c) 2014 Red Hat, 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 ... | apache-2.0 | Python |
9a2bb7e74722a95edd5ccd10c0caa472eabc06df | Add foo() method for testing integration | refinery29/chassis,refinery29/chassis | chassis/__init__.py | chassis/__init__.py | def foo():
return 'bar'
| mit | Python | |
249e57ad1a8ec465fde5f3e2e7aa5b6cfd3afc8b | Update notificationcenter.py | TingPing/plugins,TingPing/plugins | HexChat/notificationcenter.py | HexChat/notificationcenter.py | from __future__ import print_function
import hexchat
__module_name__ = 'notification-center'
__module_author__ = 'TingPing'
__module_version__ = '0'
__module_description__ = 'Integrate with the Notification Center on OSX'
loaded = False
try:
from pync import Notifier
except ImportError:
print('\002\00304Error:\017 ... | from __future__ import print_function
import hexchat
__module_name__ = 'notification-center'
__module_author__ = 'TingPing'
__module_version__ = '0'
__module_description__ = 'Integrate with the Notification Center on OSX'
loaded = False
try:
from pync import Notifier
except ImportError:
print('\002\00304Error:\017 ... | mit | Python |
3395943d4c202709c2f1f110e19a2aa0dc741e63 | Fix directory listing on windows. | onitake/Uranium,onitake/Uranium | UM/Qt/Bindings/DirectoryListModel.py | UM/Qt/Bindings/DirectoryListModel.py | from UM.Qt.ListModel import ListModel
from UM.Application import Application
from PyQt5.QtCore import Qt, pyqtProperty, pyqtSignal, QUrl
import os
import os.path
import platform
class DirectoryListModel(ListModel):
NameRole = Qt.UserRole + 1
UrlRole = Qt.UserRole + 2
def __init__(self):
super().... | from UM.Qt.ListModel import ListModel
from UM.Application import Application
from PyQt5.QtCore import Qt, pyqtProperty, pyqtSignal, QUrl
import os
import os.path
class DirectoryListModel(ListModel):
NameRole = Qt.UserRole + 1
UrlRole = Qt.UserRole + 2
def __init__(self):
super().__init__()
... | agpl-3.0 | Python |
401fd04cecec16f1ed0452eb936502d5d33a23be | bump version (#945) | facebookresearch/detectron2,facebookresearch/detectron2,facebookresearch/detectron2 | detectron2/__init__.py | detectron2/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from .utils.env import setup_environment
setup_environment()
# This line will be programatically read/write by setup.py.
# Leave them at the bottom of this file and don't touch them.
__version__ = "0.1.1"
| # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from .utils.env import setup_environment
setup_environment()
# This line will be programatically read/write by setup.py.
# Leave them at the bottom of this file and don't touch them.
__version__ = "0.1"
| apache-2.0 | Python |
c653bffbed0eeaca00fd9a928dca2bcebebea2f3 | Change to office URLs for bleepy noises | theodi/signin-web,theodi/signin-web,theodi/signin-web,theodi/signin-web | RFIDiot_Bits/odi-multiselect.py | RFIDiot_Bits/odi-multiselect.py | #!/usr/bin/python
# odi-multiselect.py - continuously read cards and post numbers to defined REST endpoint
#
# Adapted from multiselect.py, pacakaged as part of the RFIDiot library. (c) Adam Laurie
#
# This code is copyright (c) David Tarrant, 2013, All rights reserved.
# The following terms apply:
#
# This c... | #!/usr/bin/python
# odi-multiselect.py - continuously read cards and post numbers to defined REST endpoint
#
# Adapted from multiselect.py, pacakaged as part of the RFIDiot library. (c) Adam Laurie
#
# This code is copyright (c) David Tarrant, 2013, All rights reserved.
# The following terms apply:
#
# This c... | mit | Python |
e035705836ce60c7197f534c66f82eaaefa79940 | Remove redundant wrapper | ParrotPrediction/pyalcs | lcs/agents/acs2/Condition.py | lcs/agents/acs2/Condition.py | from __future__ import annotations
import random
from typing import Callable, Union
from lcs import Perception
from .. import PerceptionString
class Condition(PerceptionString):
"""
Specifies the set of situations (perceptions) in which the classifier
can be applied.
"""
@property
def speci... | from __future__ import annotations
import random
from typing import Callable, Union
from lcs import Perception
from .. import PerceptionString
class Condition(PerceptionString):
"""
Specifies the set of situations (perceptions) in which the classifier
can be applied.
"""
@property
def speci... | mit | Python |
5429534fc79237fb175aa8f7888565dd14092d9d | Add name method to ConsoleBridge | Hornwitser/YetiBridge | yetibridge/bridge/console.py | yetibridge/bridge/console.py | import threading
from . import BaseBridge
from .. import BaseEvent
class ConsoleBridge(BaseBridge):
def __init__(self, config):
BaseBridge.__init__(self, config)
self._thread = threading.Thread(target=self.run, daemon=True)
self.users = {}
def on_register(self):
self._thread.s... | import threading
from . import BaseBridge
from .. import BaseEvent
class ConsoleBridge(BaseBridge):
def __init__(self, config):
BaseBridge.__init__(self, config)
self._thread = threading.Thread(target=self.run, daemon=True)
self.users = {}
def on_register(self):
self._thread.s... | mit | Python |
fe657426cd380830989ced76ec81c1876db78401 | Fix the version check | peastman/conda-recipes,peastman/conda-recipes,omnia-md/conda-recipes,omnia-md/conda-recipes,peastman/conda-recipes,omnia-md/conda-recipes | openmm/run_test.py | openmm/run_test.py | #!/usr/bin/env python
from simtk import openmm
# Check major version number
# If Z=0 for version X.Y.Z, out put is "X.Y"
assert openmm.Platform.getOpenMMVersion() == '7.1.1', "openmm.Platform.getOpenMMVersion() = %s" % openmm.Platform.getOpenMMVersion()
# Check git hash
assert openmm.version.git_revision == '4b6fad2... | #!/usr/bin/env python
from simtk import openmm
# Check major version number
assert openmm.Platform.getOpenMMVersion() == '7.1', "openmm.Platform.getOpenMMVersion() = %s" % openmm.Platform.getOpenMMVersion()
# Check git hash
assert openmm.version.git_revision == '4b6fad2c19ea87a117b37969e96c99ffcbcf38e3', "openmm.ver... | mit | Python |
e494917273d8e36bd28f891d23a09705cbf8bfe1 | Update LongestIncreasingSubsequence for Python3 compatibility | jfinkels/PADS | LongestIncreasingSubsequence.py | LongestIncreasingSubsequence.py | """LongestIncreasingSubsequence.py
Find longest increasing subsequence of an input sequence.
D. Eppstein, April 2004
"""
import unittest
from bisect import bisect_left
def LongestIncreasingSubsequence(S):
"""
Find and return longest increasing subsequence of S.
If multiple increasing subsequences exist, ... | """LongestIncreasingSubsequence.py
Find longest increasing subsequence of an input sequence.
D. Eppstein, April 2004
"""
import unittest
from bisect import bisect_left
def LongestIncreasingSubsequence(S):
"""
Find and return longest increasing subsequence of S.
If multiple increasing subsequences exist, ... | mit | Python |
7ed17a62fec512ad721a4fd6429ef97adb622b2d | Fix individual link | uranusjr/snafu,uranusjr/snafu | snafu/installations.py | snafu/installations.py | import contextlib
import itertools
import os
import pathlib
import re
import subprocess
import attr
@attr.s
class Installation:
path = attr.ib(convert=pathlib.Path)
@property
def python(self):
return self.path.joinpath('python.exe')
@property
def scripts_dir(self):
return self.... | import contextlib
import itertools
import os
import pathlib
import re
import subprocess
import attr
@attr.s
class Installation:
path = attr.ib(convert=pathlib.Path)
@property
def python(self):
return self.path.joinpath('python.exe')
@property
def scripts_dir(self):
return self.... | isc | Python |
b7b85004c4e636bb9613469f93cca035db06d4e9 | reformat codes | sungmin-park/sqlalchemy-paginate | sqlalchemy_paginate/__init__.py | sqlalchemy_paginate/__init__.py | def int_ceil(x, y):
"""
equivalent to math.ceil(x / y)
:param x:
:param y:
:return:
"""
q, r = divmod(x, y)
if r:
q += 1
return q
class Pagination(object):
def __init__(self, query, page=1, per_page=10, per_nav=10,
map_=lambda x: x):
self.first ... | def int_ceil(x, y):
"""
equivalent to math.ceil(x / y)
:param x:
:param y:
:return:
"""
q, r = divmod(x, y)
if r:
q += 1
return q
class Pagination(object):
def __init__(self, query, page=1, per_page=10, per_nav=10,
map_=lambda x: x):
self.first ... | mit | Python |
34a311171e3cb8cc6df8dc90017e76e49ac1554f | Add newline at the EOF of constants.py | AtteqCom/zsl,AtteqCom/zsl | zsl/constants.py | zsl/constants.py | from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from enum import Enum
class MimeType(Enum):
APPLICATION_JSON = 'application/json'
# type: str
class HttpHeaders(Enum):
CONTENT_TYPE = 'Content-Type'
# type: str
| from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from enum import Enum
class MimeType(Enum):
APPLICATION_JSON = 'application/json'
# type: str
class HttpHeaders(Enum):
CONTENT_TYPE = 'Content-Type'
# type: str
| mit | Python |
ab8fc00a7dc6618d23e06f06e125da5ee69b2dba | Remove the dependence with the module hr_contract_stage. | avanzosc/event-wip | event_registration_hr_contract/__openerp__.py | event_registration_hr_contract/__openerp__.py | # -*- coding: utf-8 -*-
# (c) 2016 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Event Registration Hr Contract",
'version': '8.0.1.1.0',
'license': "AGPL-3",
'author': "AvanzOSC",
'website': "http://www.avanzosc.es",
'contributors': ... | # -*- coding: utf-8 -*-
# (c) 2016 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Event Registration Hr Contract",
'version': '8.0.1.1.0',
'license': "AGPL-3",
'author': "AvanzOSC",
'website': "http://www.avanzosc.es",
'contributors': ... | agpl-3.0 | Python |
46742b03ce8cac4f3ed97e916d5e6848b0cc0779 | fix settings fetching from conf module name | botify-labs/simpleflow,botify-labs/simpleflow | simpleflow/settings/base.py | simpleflow/settings/base.py | import sys
from future.utils import iteritems
from . import default
class Setting(object):
pass
def is_definition(var):
if var.startswith('_'):
return False
return all(c.isupper() for c in var if c.isalpha())
def get_settings(module):
return {
var: getattr(module, var) for var in... | import sys
from future.utils import iteritems
from . import default
class Setting(object):
pass
def is_definition(var):
if var.startswith('_'):
return False
return all(c.isupper() for c in var if c.isalpha())
def get_settings(module):
return {
var: getattr(module, var) for var in... | mit | Python |
44a7c59d798d9a20d4d54b9cce7e56b8f88595cc | Modify the code in the getKey() function so that it gracefully ignores non-integer input. | aclogreco/InventGamesWP | ch14/caesar.py | ch14/caesar.py | # Caesar Cipher
MAX_KEY_SIZE = 26
def getMode():
while True:
print('Do you wish to encrypt or decrypt a message?')
mode = input().lower()
if mode in 'encrypt e decrypt d'.split():
return mode
else:
print('Enter either "encrypt" or "e" or "decrypt" or "d".')
... | # Caesar Cipher
MAX_KEY_SIZE = 26
def getMode():
while True:
print('Do you wish to encrypt or decrypt a message?')
mode = input().lower()
if mode in 'encrypt e decrypt d'.split():
return mode
else:
print('Enter either "encrypt" or "e" or "decrypt" or "d".')
... | bsd-2-clause | Python |
014b4905784f50fd13111ca8528fade9be4bd767 | Fix import bug due to rebase | blink1073/scikit-image,robintw/scikit-image,emon10005/scikit-image,newville/scikit-image,michaelaye/scikit-image,GaZ3ll3/scikit-image,chintak/scikit-image,chriscrosscutler/scikit-image,warmspringwinds/scikit-image,vighneshbirodkar/scikit-image,robintw/scikit-image,dpshelio/scikit-image,Hiyorimi/scikit-image,youprofit/s... | skimage/feature/__init__.py | skimage/feature/__init__.py | from ._hog import hog
from .texture import greycomatrix, greycoprops, local_binary_pattern
from .peak import peak_local_max
from ._harris import harris
from .template import match_template
| from ._hog import hog
from ._greycomatrix import greycomatrix, greycoprops
from .hog import hog
from .texture import greycomatrix, greycoprops, local_binary_pattern
from .peak import peak_local_max
from ._harris import harris
from .template import match_template
| bsd-3-clause | Python |
ccb43370faa19de1e189372d87bb63108c5da86c | format fix | SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray | fuzzers/005-tilegrid/util.py | fuzzers/005-tilegrid/util.py | #!/usr/bin/env python3
from prjxray import util
'''
Local utils script to hold shared code of the 005-tilegrid fuzzer scripts
'''
def add_tile_bits(
tile_name,
tile_db,
baseaddr,
offset,
frames,
words,
height=None,
verbose=False):
'''
Record dat... | #!/usr/bin/env python3
from prjxray import util
'''
Local utils script to hold shared code of the 005-tilegrid fuzzer scripts
'''
def add_tile_bits(
tile_name,
tile_db,
baseaddr,
offset,
frames,
words,
height=None,
verbose=False):
'''
Record data... | isc | Python |
5d63d4ff363148e1d5b088c68746e1366205d052 | change order | jamescw/django-paintstore,RDXT/django-paintstore,RDXT/django-paintstore,gsiegman/django-paintstore,gsiegman/django-paintstore,jamescw/django-paintstore | paintstore/widgets.py | paintstore/widgets.py | from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
class ColorPickerWidget(forms.TextInput):
class Media:
css = {
"all": ("%s/%s" % (settings.STATIC_URL, "paintstore/css/colorpicker.css"),)
}
js = (
... | from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
class ColorPickerWidget(forms.TextInput):
class Media:
css = {
"all": ("%s/%s" % (settings.STATIC_URL, "paintstore/css/colorpicker.css"),)
}
js = (
... | mit | Python |
ebe10a6e1a0cd04828344147c34709e88275cac8 | Bump to v2.2.1 | Ritiek/Spotify-Downloader | spotdl/version.py | spotdl/version.py | __version__ = "2.2.1"
| __version__ = "2.2.0"
| mit | Python |
0264d4a9df6ea498ed3e1ab697ba311089518761 | Update environment_monitor.py | SpinStabilized/bbb-primer,SpinStabilized/bbb-primer,SpinStabilized/bbb-primer,SpinStabilized/bbb-primer | chapter10/environment_monitor.py | chapter10/environment_monitor.py | #!/usr/bin/env python
import Adafruit_BBIO.ADC as ADC
import time
import phant
# Configue the ADC
ADC.setup()
# Define program constants
TMP36_PIN = 'AIN0'
PHOTO_PIN = 'AIN1'
PHANT_PRIVATE_KEY = 'YOUR_PRIVATE_KEY'
PHANT_PUBLIC_KEY = 'YOUR_PUBLIC_KEY'
SAMPLE_RATE = 0.0033 # Hertz
def read_adc_v(adc_pin, adc_... | #!/usr/bin/env python
import Adafruit_BBIO.ADC as ADC
import time
import phant
# Configue the ADC
ADC.setup()
# Define program constants
TMP36_PIN = 'AIN0'
PHOTO_PIN = 'AIN1'
PHANT_PRIVATE_KEY = 'lzPWybq77pFevXD4gYJV'
PHANT_PUBLIC_KEY = 'RMGJoAgbbqiGnRd64bLM'
SAMPLE_RATE = 0.0033 # Hertz
def read_adc_v(adc_... | mit | Python |
87ab017ec893b6c4182164d722d5ab324fe195eb | allow loading json from zip | Spring-Chobby/ChobbyLauncher,Spring-Chobby/ChobbyLauncher | chobby_launcher/chobby_config.py | chobby_launcher/chobby_config.py | import json
import pkgutil
class ChobbyConfig(object):
def __init__(self):
configFile = pkgutil.get_data("chobby_launcher", "config.json")
configFile = configFile.decode('utf-8')
json_data = json.loads(configFile)
self.auto_download = json_data["auto_download"]
self.auto_st... | import json
class ChobbyConfig(object):
def __init__(self):
json_data = None
with open('config.json') as data_file:
json_data = json.load(data_file)
self.auto_download = json_data["auto_download"]
self.auto_start = json_data["auto_start"]
self.game_title = json_dat... | mit | Python |
96c9774cfb228fcef9d33e17f90bc047081749a7 | add timer start/stop/average time to statsd | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | cla_backend/apps/timer/models.py | cla_backend/apps/timer/models.py | from django.db import models
from django.conf import settings
from django.utils import timezone
from django.db import connection
from django_statsd.clients import statsd
from model_utils.models import TimeStampedModel
from legalaid.models import Case
from .managers import RunningTimerManager
class Timer(TimeStamped... | from django.db import models
from django.conf import settings
from django.utils import timezone
from django.db import connection
from model_utils.models import TimeStampedModel
from legalaid.models import Case
from .managers import RunningTimerManager
class Timer(TimeStampedModel):
created_by = models.ForeignK... | mit | Python |
4aed050e24ff3347c7342f723925976bbe046120 | clean up data_io.api | bthirion/nipy,nipy/nipy-labs,nipy/nireg,bthirion/nipy,alexis-roche/register,alexis-roche/nireg,alexis-roche/nipy,arokem/nipy,arokem/nipy,arokem/nipy,nipy/nireg,alexis-roche/nipy,nipy/nipy-labs,alexis-roche/niseg,alexis-roche/register,arokem/nipy,alexis-roche/register,bthirion/nipy,alexis-roche/nipy,alexis-roche/nipy,bt... | lib/neuroimaging/data_io/api.py | lib/neuroimaging/data_io/api.py | from datasource import DataSource, iswritemode, iszip, unzip, splitzipext, \
Repository, Cache, ensuredirs
from formats.format import getformats, Format
from formats.analyze import Analyze
from formats.nifti1 import Nifti1
from formats.ecat7 import Ecat7
from formats.afni import AFNI
| from datasource import DataSource, iswritemode, iszip, unzip, splitzipext, \
Repository, Cache, ensuredirs
from formats.format import getformats, Format
from formats.analyze import Analyze
import formats.nifti1 as nifti1
| bsd-3-clause | Python |
a56bdad58558c5c92f0965f95b6479909f11d018 | Fix test inconsistency (NC-21) | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/structure/tests/test_structure.py | nodeconductor/structure/tests/test_structure.py | from django.test import TestCase
from django.conf import settings
from nodeconductor.structure.models import *
from django.contrib.auth.models import User
from django.db.utils import IntegrityError
class NetworkTest(TestCase):
def test_segment_creation(self):
mgr = User.objects.create_user(username='foo',... | from django.test import TestCase
from django.conf import settings
from nodeconductor.structure.models import *
from django.contrib.auth.models import User
from django.db.utils import IntegrityError
class NetworkTest(TestCase):
def test_segment_creation(self):
mgr = User.objects.create_user(username='foo',... | mit | Python |
d6ab5261b44e325251476b6854c38094625957fe | add an empty DocumentMetaData to each Document by default | shownotes/snotes20-restapi,shownotes/snotes20-restapi | snotes20/models/document.py | snotes20/models/document.py | from datetime import datetime
from django.db import models
from django.conf import settings
from uuidfield import UUIDField
from .state.DocumentState import DocumentMetaData
EDITOR_ETHERPAD = 'EP'
EDITOR_CHOICES = (
(EDITOR_ETHERPAD, 'Etherpad'),
)
class Document(models.Model):
name = models.CharField(... | from datetime import datetime
from django.db import models
from django.conf import settings
from uuidfield import UUIDField
from .state.DocumentState import DocumentMetaData
EDITOR_ETHERPAD = 'EP'
EDITOR_CHOICES = (
(EDITOR_ETHERPAD, 'Etherpad'),
)
class Document(models.Model):
name = models.CharField(... | agpl-3.0 | Python |
0014f298be3e2a636fd6243908238fb027527e28 | Support python3 in expand_testcase | iovisor/ubpf,rlane/ubpf,iovisor/ubpf,rlane/ubpf,iovisor/ubpf,iovisor/ubpf | test_framework/expand-testcase.py | test_framework/expand-testcase.py | #!/usr/bin/env python
"""
Expand testcase into individual files
"""
import os
import sys
import struct
import testdata
import argparse
ROOT_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
if os.path.exists(os.path.join(ROOT_DIR, "ubpf")):
# Running from source tree
sys.path.insert(0, ROOT... | #!/usr/bin/env python
"""
Expand testcase into individual files
"""
import os
import sys
import struct
import testdata
import argparse
ROOT_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
if os.path.exists(os.path.join(ROOT_DIR, "ubpf")):
# Running from source tree
sys.path.insert(0, ROOT... | apache-2.0 | Python |
89cc6ae30d8617ecfbab12a33e1a562b2f6bc7a9 | Add support for multiple files | andersy005/spark-xarray,andersy005/spark-xarray | spark-xarray/reader.py | spark-xarray/reader.py | from __future__ import print_function
import numpy as np
import pandas as pd
import xarray as xr
import itertools
from glob import glob
from pyspark.sql import SparkSession
def ncread(sc, filename, mode='single', partitions=None, partition_on='time'):
if (mode == 'single') and (partition_on == 'time'):
r... | from __future__ import print_function
import numpy as np
import pandas as pd
import xarray as xr
from pyspark.sql import SparkSession
def ncread(sc, file_list, mode='single', partitions=None, partition_on='time'):
if (mode == 'single') and (partition_on == 'time'):
return read_nc_single_time(sc, file_lis... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.