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 |
|---|---|---|---|---|---|---|---|---|
e84b2e11088878d44433bfc767b8abba79eca0a7 | use environment variable for config folder | Rediker-Software/litle-sdk-for-python,LitleCo/litle-sdk-for-python | litleSdkPython/Configuration.py | litleSdkPython/Configuration.py | #Copyright (c) 2011-2012 Litle & Co.
#
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "Software"), to deal in the Software without
#restriction, including without limitation the rights to use,
#copy, modify, merge, publish, distri... | #Copyright (c) 2011-2012 Litle & Co.
#
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "Software"), to deal in the Software without
#restriction, including without limitation the rights to use,
#copy, modify, merge, publish, distri... | mit | Python |
24e42d5d4a21c1f3ffd36a163b89ee7f39375945 | Update P05_trafficLight add assertion to check for red light | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter10/P05_trafficLight.py | books/AutomateTheBoringStuffWithPython/Chapter10/P05_trafficLight.py | # This program emulates traffic lights at intersections with assertions
market_2nd = {"ns": "green", "ew": "red"}
mission_16th = {"ns": "red", "ew": "green"}
def switchLights(stoplight):
for key in stoplight.keys():
if stoplight[key] == "green":
stoplight[key] = "yellow"
elif stopligh... | # This program emulates traffic lights at intersections with assertions
market_2nd = {"ns": "green", "ew": "red"}
mission_16th = {"ns": "red", "ew": "green"}
def switchLights(stoplight):
for key in stoplight.keys():
if stoplight[key] == "green":
stoplight[key] = "yellow"
elif stopligh... | mit | Python |
304a220e99694ec6b41a31db8150c7f4604f6ef5 | Remove old logging import | ianstalk/Flexget,crawln45/Flexget,malkavi/Flexget,crawln45/Flexget,Flexget/Flexget,ianstalk/Flexget,malkavi/Flexget,Flexget/Flexget,Flexget/Flexget,malkavi/Flexget,Flexget/Flexget,crawln45/Flexget,crawln45/Flexget,malkavi/Flexget,ianstalk/Flexget | flexget/components/notify/notifiers/gotify.py | flexget/components/notify/notifiers/gotify.py | from http import HTTPStatus
from requests.exceptions import RequestException
from urllib.parse import urljoin
from flexget import plugin
from flexget.event import event
from flexget.plugin import PluginWarning
from flexget.utils.requests import Session as RequestSession, TimedLimiter
plugin_name = 'gotify'
requests ... | import logging
from http import HTTPStatus
from requests.exceptions import RequestException
from urllib.parse import urljoin
from flexget import plugin
from flexget.event import event
from flexget.plugin import PluginWarning
from flexget.utils.requests import Session as RequestSession, TimedLimiter
plugin_name = 'g... | mit | Python |
77ac4b3cc97731c0fcb387a10fadd1509e057a6d | update with main function and header | NCSSM-CS/CSAssess,NCSSM-CS/CSAssess,NCSSM-CS/CSAssess,NCSSM-CS/CSAssess | controller/test.py | controller/test.py | #!/usr/bin/python2.7
"""
created_by: Micah Halter
created_date: 2/28/2015
last_modified_by: Micah Halter
last_modified_date: 3/2/2015
"""
#imports
import constants
import sys
sys.path.insert(0, "./view/")
import viewAssessment
import viewQuestion
import viewTopic
import viewSection
import viewCourse
i... | #!/usr/bin/python2.7
import constants
import sys
sys.path.insert(0, "./view/")
import viewAssessment
import viewQuestion
import viewTopic
import viewSection
import viewCourse
import viewUser
sys.path.insert(0, "./edit/")
import editAssessment
import editQuestion
import editTopic
import editSection
import editCourse
... | mit | Python |
b8cec88e733237b94fafb2aa978dcb6b758c954f | Add string representation of Log | BlankOn/irclogview,fajran/irclogview,BlankOn/irclogview,fajran/irclogview | irclogview/models.py | irclogview/models.py | from django.db import models
from django.core.urlresolvers import reverse
from picklefield.fields import PickledObjectField
from . import utils
class Channel(models.Model):
name = models.SlugField(max_length=50, unique=True)
updated = models.DateTimeField(auto_now=True)
class Meta:
ordering = ['... | from django.db import models
from django.core.urlresolvers import reverse
from picklefield.fields import PickledObjectField
from . import utils
class Channel(models.Model):
name = models.SlugField(max_length=50, unique=True)
updated = models.DateTimeField(auto_now=True)
class Meta:
ordering = ['... | agpl-3.0 | Python |
c62a658eb469e449372207f146f60375d7497f63 | update dataset api | ghisvail/ismrmrdpy | ismrmrdpy/dataset.py | ismrmrdpy/dataset.py | # Copyright (c) 2014-2015 Ghislain Antony Vaillant.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of... | # Copyright (c) 2014-2015 Ghislain Antony Vaillant.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of... | bsd-2-clause | Python |
3effb540220f4ce1918d0210e882d926e268473f | Bump P4Runtime to v1.2.0 | gkatsikas/onos,opennetworkinglab/onos,gkatsikas/onos,opennetworkinglab/onos,opennetworkinglab/onos,gkatsikas/onos,opennetworkinglab/onos,opennetworkinglab/onos,gkatsikas/onos,opennetworkinglab/onos,gkatsikas/onos,gkatsikas/onos | tools/build/bazel/p4lang_workspace.bzl | tools/build/bazel/p4lang_workspace.bzl | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
P4RUNTIME_VER = "1.2.0"
P4RUNTIME_SHA = "0fce7e06c63e60a8cddfe56f3db3d341953560c054d4c09ffda0e84476124f5a"
def generate_p4lang():
http_archive(
name = "com_github_p4lang_p4runtime",
urls = ["https://github.com/p4lang/p4runtime/ar... | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
P4RUNTIME_VER = "1.0.0"
P4RUNTIME_SHA = "667464bd369b40b58dc9552be2c84e190a160b6e77137b735bd86e5b81c6adc0"
def generate_p4lang():
http_archive(
name = "com_github_p4lang_p4runtime",
urls = ["https://github.com/p4lang/p4runtime/ar... | apache-2.0 | Python |
64e902fae3117c246272cbde943d013da1345b7b | Fix RenameField alteration | thorrak/fermentrack,thorrak/fermentrack,thorrak/fermentrack,thorrak/fermentrack,thorrak/fermentrack | gravity/migrations/0003_tiltbridge_mdns_id.py | gravity/migrations/0003_tiltbridge_mdns_id.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2019-03-18 23:46
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('gravity', '0002_tilt_refactor'),
]
operations = [
... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2019-03-18 23:46
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('gravity', '0002_tilt_refactor'),
]
operations = [
... | mit | Python |
fc4aada050fd995ecf5375871fa1e6ed1884293f | fix hail-apiserver.py module path (#4850) | cseed/hail,danking/hail,hail-is/hail,cseed/hail,hail-is/hail,cseed/hail,hail-is/hail,cseed/hail,danking/hail,danking/hail,danking/hail,cseed/hail,danking/hail,cseed/hail,hail-is/hail,danking/hail,cseed/hail,danking/hail,hail-is/hail,hail-is/hail,danking/hail,hail-is/hail,cseed/hail,hail-is/hail | hail/python/hail-apiserver/hail-apiserver.py | hail/python/hail-apiserver/hail-apiserver.py | import hail as hl
from hail.utils.java import Env, info
import logging
import flask
hl.init()
app = flask.Flask('hail-apiserver')
@app.route('/execute', methods=['POST'])
def execute():
code = flask.request.json
info(f'execute: {code}')
jir = Env.hail().expr.ir.IRParser.parse_value_ir(code, {... | import hail as hl
from hail.utils.java import Env, info
import logging
import flask
hl.init()
app = flask.Flask('hail-apiserver')
@app.route('/execute', methods=['POST'])
def execute():
code = flask.request.json
info(f'execute: {code}')
jir = Env.hail().expr.Parser.parse_value_ir(code, {}, {}... | mit | Python |
1d10582d622ce6867a85d9e4e8c279ab7e4ab5ab | Revert "Don't complain about \r when core.autocrlf is on in Git" | ejjeong/rust,omasanori/rust,quornian/rust,mvdnes/rust,barosl/rust,aturon/rust,carols10cents/rust,mdinger/rust,AerialX/rust,krzysz00/rust,krzysz00/rust,sarojaba/rust-doc-korean,SiegeLord/rust,l0kod/rust,philyoon/rust,KokaKiwi/rust,nwin/rust,ktossell/rust,victorvde/rust,dwillmer/rust,0x73/rust,waynenilsen/rand,fabricedes... | src/etc/tidy.py | src/etc/tidy.py | #!/usr/bin/python
import sys, fileinput
err=0
cols=78
def report_err(s):
global err
print("%s:%d: %s" % (fileinput.filename(), fileinput.filelineno(), s))
err=1
for line in fileinput.input(openhook=fileinput.hook_encoded("utf-8")):
if line.find('\t') != -1 and fileinput.filename().find("Makefile") =... | #!/usr/bin/python
import sys, fileinput, subprocess
err=0
cols=78
config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],
stdout=subprocess.PIPE)
result=config_proc.communicate()[0]
autocrlf=result.strip() == b"true" if result is not None else False
def report_err(s):
global err
print("%s:%d:... | apache-2.0 | Python |
9dcf5e0b30141641a0e182257b34720bcf07d730 | Fix typo in S3_Bucket_With_Versioning_And_Lifecycle_Rules.py (#693) | ikben/troposphere,7digital/troposphere,cloudtools/troposphere,cloudtools/troposphere,johnctitus/troposphere,pas256/troposphere,7digital/troposphere,horacio3/troposphere,horacio3/troposphere,pas256/troposphere,johnctitus/troposphere,ikben/troposphere | examples/S3_Bucket_With_Versioning_And_Lifecycle_Rules.py | examples/S3_Bucket_With_Versioning_And_Lifecycle_Rules.py | # Converted from S3_Bucket.template located at:
# http://aws.amazon.com/cloudformation/aws-cloudformation-templates/
from troposphere import Output, Ref, Template
from troposphere.s3 import Bucket, PublicRead, VersioningConfiguration, \
LifecycleConfiguration, LifecycleRule, NoncurrentVersionTransition, \
Life... | # Converted from S3_Bucket.template located at:
# http://aws.amazon.com/cloudformation/aws-cloudformation-templates/
from troposphere import Output, Ref, Template
from troposphere.s3 import Bucket, PublicRead, VersioningConfiguration, \
LifecycleConfiguration, LifecycleRule, NoncurrentVersionTransition, \
Life... | bsd-2-clause | Python |
a378649f85f0bc55060ad0238e426f587bc2ff1a | Send location only when printing exception (Avoid leaking ID/UUID) | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | core/exceptions.py | core/exceptions.py | """
exceptions - Core exceptions
"""
class InvalidMembership(Exception):
"""
The membership provided is not valid
"""
pass
class SourceNotFound(Exception):
"""
InstanceSource doesn't have an associated source.
"""
pass
class RequestLimitExceeded(Exception):
"""
A limit was ... | """
exceptions - Core exceptions
"""
class InvalidMembership(Exception):
"""
The membership provided is not valid
"""
pass
class SourceNotFound(Exception):
"""
InstanceSource doesn't have an associated source.
"""
pass
class RequestLimitExceeded(Exception):
"""
A limit was ... | apache-2.0 | Python |
93323426c22a08965544b19c818e53c8f2b29e8c | clean select_channel widget | Koheron/lase | ldk/gui/select_channel_widget.py | ldk/gui/select_channel_widget.py | # -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
class SelectChannelWidget(QtGui.QWidget):
def __init__(self, plot_widget):
super(SelectChannelWidget, self).__init__()
self.plot_widget = plot_widget
self.layout = QtGui.QGridLayout()
self.adc... | # -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
class SelectChannelWidget(QtGui.QWidget):
def __init__(self, plot_widget):
super(SelectChannelWidget, self).__init__()
self.plot_widget = plot_widget
self.layout = QtGui.QGridLayout()
self.adc... | mit | Python |
0f4e977f18dc1e3b9bbe2f25c3c326ac769fecbd | order size to have thumbnail in first | novapost/insight | insight/api/async.py | insight/api/async.py | # -*- coding: utf-8 -*-
"""Async API view"""
from flask import abort, request
from redis import StrictRedis
import json
from insight.api.config import INSIGHT_ENGINES
try:
import settings
except ImportError:
settings = None
REDIS_QUEUE_KEY = getattr(settings, 'REDIS_QUEUE_KEY', 'insight')
REDIS_HOST = getatt... | # -*- coding: utf-8 -*-
"""Async API view"""
from flask import abort, request
from redis import StrictRedis
import json
from insight.api.config import INSIGHT_ENGINES
try:
import settings
except ImportError:
settings = None
REDIS_QUEUE_KEY = getattr(settings, 'REDIS_QUEUE_KEY', 'insight')
REDIS_HOST = getatt... | mit | Python |
0116f38160c03939306470127f0489c98aeee954 | Update nanomsg build file | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | shipyard/shipyard/nanomsg/build.py | shipyard/shipyard/nanomsg/build.py | """Build nanomsg from source."""
from foreman import define_parameter, define_rule, decorate_rule
from shipyard import (
ensure_directory,
git_clone,
run_commands,
install_packages,
copy_libraries,
)
(define_parameter('deps')
.with_doc("""Build-time Debian packages.""")
.with_type(list)
.wi... | """Build nanomsg from source."""
from foreman import define_parameter, define_rule, decorate_rule
from shipyard import (
ensure_directory,
git_clone,
run_commands,
install_packages,
copy_libraries,
)
(define_parameter('deps')
.with_doc("""Build-time Debian packages.""")
.with_type(list)
.wi... | mit | Python |
22f3b74fec790847c3e353aad84b51252637a90f | Revert "oe.path.relative: switch to a different appraoch" | xifengchuo/openembedded,sledz/oe,Martix/Eonos,bticino/openembedded,openpli-arm/openembedded,xifengchuo/openembedded,John-NY/overo-oe,openembedded/openembedded,SIFTeam/openembedded,SIFTeam/openembedded,sutajiokousagi/openembedded,libo/openembedded,xifengchuo/openembedded,nx111/openembeded_openpli2.1_nx111,JamesAng/oe,Ma... | lib/oe/path.py | lib/oe/path.py | def join(*paths):
"""Like os.path.join but doesn't treat absolute RHS specially"""
import os.path
return os.path.normpath("/".join(paths))
def relative(src, dest):
""" Return a relative path from src to dest.
>>> relative("/usr/bin", "/tmp/foo/bar")
../../tmp/foo/bar
>>> relative("/usr/bi... | def join(*paths):
"""Like os.path.join but doesn't treat absolute RHS specially"""
from os import sep
from os.path import normpath
return normpath(sep.join(paths))
def relative(src, dest=None):
""" Return a relative path from src to dest(default=cwd).
>>> relative("/usr/bin", "/tmp/foo/bar")
... | mit | Python |
0f004830bd220ad8da1d4b151897630431d2f195 | tweak scoring functions, always | axtl/cryptools | cryptools/crack.py | cryptools/crack.py | # -*- coding: utf-8 -*-
import math
import string
from stringutils import convert, freq
def brute_xor(cyphertext, st_freqs):
"""Bruteforce a given single-character XOR-encrypted cyphertext.
Statistical information is used to choose which character is the most
likely key.
:param cyphertext: the cyph... | # -*- coding: utf-8 -*-
import string
from stringutils import convert, freq
def brute_xor(cyphertext, st_freqs):
"""Bruteforce a given single-character XOR-encrypted cyphertext.
Statistical information is used to choose which character is the most
likely key.
:param cyphertext: the cyphertext to cr... | mit | Python |
c6a9fcfe817128d3e7b0f52625bcd2e6c1c92f76 | fix #4491: auth1 test needs sapi for login (#4492) | radiasoft/sirepo,radiasoft/sirepo,radiasoft/sirepo,radiasoft/sirepo,radiasoft/sirepo | tests/auth1_test.py | tests/auth1_test.py | # -*- coding: utf-8 -*-
u"""Test sirepo.auth
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
from pykern import pkcollections
from sirepo import srunit
@sru... | # -*- coding: utf-8 -*-
u"""Test sirepo.auth
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
from pykern import pkcollections
from sirepo import srunit
@sru... | apache-2.0 | Python |
646db72eca34f6006d189f0a143d0c00388d1955 | Update viehicle.py | kantel/processingpy,kantel/processingpy,kantel/processingpy | sketches/ev_steering_1/viehicle.py | sketches/ev_steering_1/viehicle.py | class Viehicle():
def __init__(self, x, y):
self.acceleration = PVector(0, 0)
self.velocity = PVector(0, 0)
self.location = PVector(x, y)
self.r = 8.0
self.maxspeed = 5
self.maxforce = 0.1
self.d = 25
def update(self):
self.velocity.add(s... | class Viehicle():
def __init__(self, x, y):
self.acceleration = PVector(0, 0)
self.velocity = PVector(0, 0)
self.location = PVector(x, y)
self.r = 8.0
self.maxspeed = 5
self.maxforce = 0.1
self.d = 25
def update(self):
self.velocity.add(s... | mit | Python |
b58c8b4f9d049207b7e7e0e4de7058959df90b70 | Use sendgrid's Subject type when sending email. (#1033) | google/clusterfuzz,google/clusterfuzz,google/clusterfuzz,google/clusterfuzz,google/clusterfuzz,google/clusterfuzz,google/clusterfuzz,google/clusterfuzz | src/appengine/libs/mail.py | src/appengine/libs/mail.py | # Copyright 2019 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 2019 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 |
b393b432c4f24906e1919999402ed56bde49086e | Fix test case - found another trunk tunnel on layer 0. | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | integration-test/546-road-sort-keys-tunnel.py | integration-test/546-road-sort-keys-tunnel.py | # tunnels at level = 0
#https://www.openstreetmap.org/way/167952621
assert_has_feature(
16, 10475, 25324, "roads",
{"kind": "highway", "kind_detail": "motorway", "id": 167952621,
"name": "Presidio Pkwy.", "is_tunnel": True, "sort_rank": 333})
# http://www.openstreetmap.org/way/259492789
assert_has_feature... | # tunnels at level = 0
#https://www.openstreetmap.org/way/167952621
assert_has_feature(
16, 10475, 25324, "roads",
{"kind": "highway", "kind_detail": "motorway", "id": 167952621,
"name": "Presidio Pkwy.", "is_tunnel": True, "sort_rank": 333})
# http://www.openstreetmap.org/way/259492762
assert_has_feature... | mit | Python |
90c42beafe4dc5168224fd96cf7891695c7cf346 | fix save default values | haoNoQ/wztools2100,haoNoQ/wztools2100,haoNoQ/wztools2100 | ini_tools/ini_file.py | ini_tools/ini_file.py | import os
from config_parser import WZConfigParser
from profile_loader import Profile, get_profiles_name_list
from generate_ini_header import get_header
class WZException(Exception):
pass
class IniFile(dict):
profiles = get_profiles_name_list()
def get_profile_for_ini(self):
name = os.path.base... | import os
from config_parser import WZConfigParser
from profile_loader import Profile, get_profiles_name_list
from generate_ini_header import get_header
class WZException(Exception):
pass
class IniFile(dict):
profiles = get_profiles_name_list()
def get_profile_for_ini(self):
name = os.path.base... | cc0-1.0 | Python |
3640cb895bb93d144a615d4b745af135016d67af | order imports | plone/plone.server,plone/plone.server | src/plone.server/plone/server/__init__.py | src/plone.server/plone/server/__init__.py | # -*- encoding: utf-8 -*-
# load the patch before anything else.
from plone.server import patch # noqa
from plone.server import interfaces
from plone.server import languages
# load defined migrations
from plone.server.migrate import migrations # noqa
from zope.i18nmessageid import MessageFactory
import collection... | # -*- encoding: utf-8 -*-
# create logging
import logging
logger = logging.getLogger('plone.server')
from zope.i18nmessageid import MessageFactory # noqa
_ = MessageFactory('plone')
# load the patch before anything else.
from plone.server import patch # noqa
# load defined migrations
from plone.server.migrate impor... | bsd-2-clause | Python |
63cdfe0de155ed32af0332310340b4d57dcef145 | bump version for release | astraw/stdeb,astraw/stdeb,astraw/stdeb,benthomasson/stdeb,pombredanne/stdeb,LeMeteore/stdeb,sathieu/stdeb,sathieu/stdeb,pombredanne/stdeb,sathieu/stdeb,benthomasson/stdeb,LeMeteore/stdeb,pombredanne/stdeb,benthomasson/stdeb,LeMeteore/stdeb | stdeb/__init__.py | stdeb/__init__.py | # setuptools is required for distutils.commands plugin we use
import logging
import setuptools
__version__ = '0.4.3'
log = logging.getLogger('stdeb')
log.setLevel(logging.INFO)
handler = logging.StreamHandler()
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(message)s')
handler.setFormatter(formatter)
... | # setuptools is required for distutils.commands plugin we use
import logging
import setuptools
__version__ = '0.4.2.git'
log = logging.getLogger('stdeb')
log.setLevel(logging.INFO)
handler = logging.StreamHandler()
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(message)s')
handler.setFormatter(formatt... | mit | Python |
cbe58b74f6d5fe5c96b197ced9c2269cf8886d24 | make boolean functions in utils return real booleans | craigds/django-livesettings | livesettings/utils.py | livesettings/utils.py | import sys
import types
import os
def can_loop_over(maybe):
"""Test value to see if it is list like"""
try:
iter(maybe)
except TypeError:
return False
return True
def is_list_or_tuple(maybe):
return isinstance(maybe, (types.TupleType, types.ListType))
def is_scalar(maybe):
""... | import sys
import types
import os
def can_loop_over(maybe):
"""Test value to see if it is list like"""
try:
iter(maybe)
except:
return 0
else:
return 1
def is_list_or_tuple(maybe):
return isinstance(maybe, (types.TupleType, types.ListType))
def is_scalar(maybe):
"""Te... | bsd-3-clause | Python |
a91ac10af21cf644bfc45ef729e465726491db7b | Enable android_test and friends as waf commands. | playedonline/flambe,aduros/flambe,markknol/flambe,Disar/flambe,mikedotalmond/flambe,markknol/flambe,weilitao/flambe,aduros/flambe,playedonline/flambe,Disar/flambe,mikedotalmond/flambe,weilitao/flambe,mikedotalmond/flambe,aduros/flambe,playedonline/flambe,markknol/flambe,Disar/flambe,aduros/flambe,weilitao/flambe,mikedo... | tools/flambe.py | tools/flambe.py | #!/usr/bin/env python
from waflib import *
from waflib.TaskGen import *
import os
# Waf hates absolute paths for some reason
FLAMBE_ROOT = os.path.dirname(__file__) + "/.."
def options(ctx):
ctx.add_option("--debug", action="store_true", default=False, help="Build a development version")
def configure(ctx):
... | #!/usr/bin/env python
from waflib import *
from waflib.TaskGen import *
import os
# Waf hates absolute paths for some reason
FLAMBE_ROOT = os.path.dirname(__file__) + "/.."
def options(ctx):
ctx.add_option("--debug", action="store_true", default=False, help="Build a development version")
def configure(ctx):
... | mit | Python |
d42b47f971675af4b12f59089326276b3b8ff9f4 | Bump version to 0.14.0 | dmulholland/syntex,dmulholland/syntex | syntex/pkgmeta.py | syntex/pkgmeta.py | # -------------------------------------------------------------------------
# Package meta data.
# -------------------------------------------------------------------------
# Package version number.
__version__ = "0.14.0"
| # -------------------------------------------------------------------------
# Package meta data.
# -------------------------------------------------------------------------
# Package version number.
__version__ = "0.13.4"
| unlicense | Python |
dadd800384358356542ccc49bbdad1ae54006cfc | Fix test_Bucket.BucketDataTests to test `needed` attribute. | pagea/bridgedb,pagea/bridgedb | lib/bridgedb/test/test_Bucket.py | lib/bridgedb/test/test_Bucket.py | # -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :copyright: (c) 2007-2014, The Tor Project, Inc.
# (c) 2007-2014, all entities within the AUTHORS file
# :license: 3-Clause BSD, see LICENSE for licensing information
"""Unittests for the :mod:`bridgedb.Bucket`... | # -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :copyright: (c) 2007-2014, The Tor Project, Inc.
# (c) 2007-2014, all entities within the AUTHORS file
# :license: 3-Clause BSD, see LICENSE for licensing information
"""Unittests for the :mod:`bridgedb.Bucket`... | bsd-3-clause | Python |
c86c80854ac5ea60f43619610a21bfba9b1094f2 | add ratio | John-Lin/pydcard | example/simple_male_female_ratio.py | example/simple_male_female_ratio.py | import pydcard
def main():
male = 0
female = 0
for page_num in range(1, 41):
print ('Sending request to page %d' % page_num)
page = pydcard.get_all_page(page_num)
for post_thread in range(0, len(page)):
if page[post_thread].get('member').get('gender') == 'M':
... | import pydcard
def main():
male = 0
female = 0
for page_num in range(1, 41):
print ('Sending request to page %d' % page_num)
page = pydcard.getAllPage(page_num)
for post_thread in range(0, len(page)):
if page[post_thread].get('member').get('gender') == 'M':
... | mit | Python |
1bb4059a783fdbc8f397b596d5d5d5ed6d97a7b4 | use radiasoft/beamsim-jupyter image | biviosoftware/salt-conf,radiasoft/salt-conf,radiasoft/salt-conf,biviosoftware/salt-conf | srv/salt/jupyterhub/jupyterhub_config.py | srv/salt/jupyterhub/jupyterhub_config.py | c.Authenticator.admin_users = {'{{ pillar.jupyterhub.admin_user }}',}
c.JupyterHub.confirm_no_ssl = True
c.JupyterHub.ip = '0.0.0.0'
import base64
c.JupyterHub.cookie_secret = base64.b64decode('{{ pillar.jupyterhub.cookie_secret }}')
c.JupyterHub.proxy_auth_token = '{{ pillar.jupyterhub.proxy_auth_token }}'
# Allow bot... | c.Authenticator.admin_users = {'{{ pillar.jupyterhub.admin_user }}',}
c.JupyterHub.confirm_no_ssl = True
c.JupyterHub.ip = '0.0.0.0'
import base64
c.JupyterHub.cookie_secret = base64.b64decode('{{ pillar.jupyterhub.cookie_secret }}')
c.JupyterHub.proxy_auth_token = '{{ pillar.jupyterhub.proxy_auth_token }}'
# Allow bot... | apache-2.0 | Python |
16fc80f36fa0bade1f4e5e7bef5595b3617a42bc | fix bartlett to pass participant not participant uuid | jcpeterson/Dallinger,Dallinger/Dallinger,berkeley-cocosci/Wallace,Dallinger/Dallinger,jcpeterson/Dallinger,suchow/Wallace,Dallinger/Dallinger,suchow/Wallace,berkeley-cocosci/Wallace,jcpeterson/Dallinger,Dallinger/Dallinger,berkeley-cocosci/Wallace,Dallinger/Dallinger,jcpeterson/Dallinger,suchow/Wallace,jcpeterson/Dalli... | examples/bartlett1932/experiment.py | examples/bartlett1932/experiment.py | """Bartlett's trasmission chain experiment from Remembering (1932)."""
from wallace.networks import Chain
from wallace.nodes import Source, ReplicatorAgent
from wallace import processes
from wallace.experiments import Experiment
import random
class Bartlett1932(Experiment):
"""Defines the experiment."""
de... | """Bartlett's trasmission chain experiment from Remembering (1932)."""
from wallace.networks import Chain
from wallace.nodes import Source, ReplicatorAgent
from wallace import processes
from wallace.experiments import Experiment
import random
class Bartlett1932(Experiment):
"""Defines the experiment."""
de... | mit | Python |
6073610cb08e03e142b80dc7b1196ce359a1f55a | fix pylint import error | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | selfdrive/debug/toyota_eps_factor.py | selfdrive/debug/toyota_eps_factor.py | #!/usr/bin/env python3
import sys
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model # pylint: disable=import-error
from tools.lib.route import Route
from tools.lib.logreader import MultiLogIterator
MIN_SAMPLES = 30*100
def to_signed(n, bits):
if n >= (1 << max((bits - 1), 0)):
... | #!/usr/bin/env python3
import sys
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
from tools.lib.route import Route
from tools.lib.logreader import MultiLogIterator
MIN_SAMPLES = 30*100
def to_signed(n, bits):
if n >= (1 << max((bits - 1), 0)):
n = n - (1 << max(bits, 0))
... | mit | Python |
60ebebb4cc167a010904763c5a4ffed6347c029e | Fix license tab. | Livit/Livit.Learn.EdX,Livit/Livit.Learn.EdX,Livit/Livit.Learn.EdX,Livit/Livit.Learn.EdX | lms/djangoapps/labster_course_license/tabs.py | lms/djangoapps/labster_course_license/tabs.py | """
Registers the Labster Course License for the edX platform.
"""
from django.conf import settings
from django.utils.translation import ugettext_noop
from xmodule.tabs import CourseTab
from student.roles import CourseCcxCoachRole
from courseware.access import has_access
class LicenseCourseTab(CourseTab):
"""
... | """
Registers the Labster Course License for the edX platform.
"""
from django.conf import settings
from django.utils.translation import ugettext_noop
from xmodule.tabs import CourseTab
from student.roles import CourseCcxCoachRole
class LicenseCourseTab(CourseTab):
"""
The representation of the LTI Passport... | agpl-3.0 | Python |
d8e872c3d2aa141c29d993c08c207c1b7994b055 | Add missing filter decorators | thoas/django-sequere | sequere/templatetags/sequere_tags.py | sequere/templatetags/sequere_tags.py | from django import template
from sequere.registry import registry
from sequere.models import (get_followers_count, get_followings_count)
register = template.Library()
@register.filter
def identifier(instance, arg=None):
return registry.get_identifier(instance)
@register.filter
def followers_count(instance, id... | from django import template
from sequere.registry import registry
from sequere.models import (get_followers_count, get_followings_count)
register = template.Library()
def identifier(instance, arg=None):
return registry.get_identifier(instance)
def followers_count(instance, identifier=None):
return get_fol... | mit | Python |
99c3eba0d6384cd42c90ef347823e6d66659d6e3 | Fix typo in division operator | pdarragh/Viper | viper/interpreter/prelude/operators.py | viper/interpreter/prelude/operators.py | from ..value import ForeignCloVal
def plus(a: int, b: int) -> int:
return a + b
def minus(a: int, b: int) -> int:
return a - b
def times(a: int, b: int) -> int:
return a * b
def divide(a: int, b: int) -> float:
return a / b
env = {
'+': ForeignCloVal(plus, {}),
'-': ForeignCloVal(minus... | from ..value import ForeignCloVal
def plus(a: int, b: int) -> int:
return a + b
def minus(a: int, b: int) -> int:
return a - b
def times(a: int, b: int) -> int:
return a * b
def divide(a: int, b: int) -> float:
return a / b
env = {
'+': ForeignCloVal(plus, {}),
'-': ForeignCloVal(minus... | apache-2.0 | Python |
340e872114363ddc041b2c5cdcc5769c9b793efe | Add test_select_with_seed_too_small_raise_Exception | Commonists/bingo | tests/test_bingo.py | tests/test_bingo.py | """Unit tests for cat2cohort."""
import unittest
from bingo import bingo
class TestBingoGenerator(unittest.TestCase):
"""Test methods from bingo."""
def test_bingo_generator_has_default_size(self):
bingo_generator = bingo.BingoGenerator()
expected = pow(bingo.DEFAULT_SIZE, 2)
self.a... | """Unit tests for cat2cohort."""
import unittest
from bingo import bingo
class TestBingoGenerator(unittest.TestCase):
"""Test methods from bingo."""
def test_bingo_generator_has_default_size(self):
bingo_generator = bingo.BingoGenerator()
expected = pow(bingo.DEFAULT_SIZE, 2)
self.a... | mit | Python |
36f2376a2f23b295bba8cc2af16577efd3fe03ff | Add a couple of snippets. | sam33r/dotfiles,sam33r/dotfiles,sam33r/dotfiles,sam33r/dotfiles | utils/snippets.py | utils/snippets.py | #!/usr/bin/env python
# A hacky script to do dynamic snippets.
import sys
import os
import datetime
snippet_map = {
'date': datetime.datetime.now().strftime('%b %d %G %I:%M%p '),
'time': datetime.datetime.now().strftime('%I:%M%p '),
'best': 'Best,\nSameer',
'cheers': 'Cheers,\nSameer',
'thanks': '... | #!/usr/bin/env python
# A hacky script to do dynamic snippets.
import sys
import os
import datetime
snippet_map = {
'date' : datetime.datetime.now().strftime('%b %d %G %I:%M%p '),
'time' : datetime.datetime.now().strftime('%I:%M%p '),
'sign' : 'Best,\nSameer',
}
keys = '\n'.join(snippet_map.keys())
resul... | mit | Python |
8887ac66a221b443215e7ab57a2f21b1521b167b | move docs to readme | obestwalter/obestwalter.github.io,obestwalter/obestwalter.github.io | utils/workflow.py | utils/workflow.py | from __future__ import print_function
import os
import subprocess
import sys
from datetime import datetime
from string import Template
from lektor.utils import slugify
HERE = os.path.dirname(__file__)
PROJECT_PATH = os.path.join(HERE, '..')
DRAFTS_PATH = os.path.join(PROJECT_PATH, 'drafts')
CONTENT_PATH = os.path.jo... | """
Helpers for my evolving workflow.
draft [art] "My super article"
creates a prepared md file with all the necessary settings to work on.
publish drafts/my-super-article.md
will make the necessary adjustments and publish it in the contents.
deploy [clean]
will create a [clean] build and push it onli... | mit | Python |
377f2120b3474d131b02dab90b6e51c35deb0c74 | Add comments | lnls-fac/mathphys | mathphys/constants.py | mathphys/constants.py | """Constants module."""
import math as _math
from . import base_units as _u
# temporary auxiliary derived units
_volt = (_u.kilogram * _u.meter**2) / (_u.ampere * _u.second**2)
_coulomb = _u.second * _u.ampere
_joule = _u.kilogram * _u.meter**2 / _u.second**2
_pascal = _u.kilogram / (_u.meter * _u.second**2)
# phy... | """Constants module."""
import math as _math
from . import base_units as _u
# temporary auxiliary derived units
_volt = (_u.kilogram * _u.meter**2) / (_u.ampere * _u.second**2)
_coulomb = _u.second * _u.ampere
_joule = _u.kilogram * _u.meter**2 / _u.second**2
_pascal = _u.kilogram / (_u.meter * _u.second**2)
# phy... | mit | Python |
a26f04bddcdb92af050c2d8237ccb6c2ef1406e5 | Fix identation | rzhilkibaev/jst,rzhilkibaev/jst | jst/common/context.py | jst/common/context.py | '''
Created on Jan 18, 2015
@author: rz
'''
import configparser
import os
from os.path import expanduser
def load():
global_cfg_file = expanduser("~") + '/.jst/jst.properties'
if (not os.path.isfile(global_cfg_file)):
raise FileNotFoundError(global_cfg_file)
cwd = os.getcwd()
ctx_file = cwd ... | '''
Created on Jan 18, 2015
@author: rz
'''
import configparser
import os
from os.path import expanduser
def load():
global_cfg_file = expanduser("~") + '/.jst/jst.properties'
if (not os.path.isfile(global_cfg_file)):
raise FileNotFoundError(global_cfg_file)
cwd = os.getcwd()
ctx_file = cwd +... | mit | Python |
99bc38b7d33eef76fd99d7ce362b00080edf5067 | Change dependencies | xpansa/stock-logistics-transport,open-synergy/stock-logistics-transport,Antiun/stock-logistics-transport,Endika/stock-logistics-transport | stock_shipment_management/__openerp__.py | stock_shipment_management/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joël Grand-Guillaume
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as pu... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joël Grand-Guillaume
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as pu... | agpl-3.0 | Python |
aad19b0373f2b331ffbada431385173d2bf3e43e | Update cronjob.py | fiaas/k8s | k8s/models/cronjob.py | k8s/models/cronjob.py | #!/usr/bin/env python
# -*- coding: utf-8
# Copyright 2017-2019 The FIAAS 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
#
# U... | #!/usr/bin/env python
# -*- coding: utf-8
# Copyright 2017-2019 The FIAAS 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
#
# U... | apache-2.0 | Python |
e7dca1dae8300dd702ecfc36110518b16c9c5231 | change directory back to previous location (prevents following tests from pointing into the forest) | ohumbel/rtc2git,jacobilsoe/rtc2git,cwill747/rtc2git,rtcTo/rtc2git,WtfJoke/rtc2git,akchinSTC/rtc2git | tests/testhelper.py | tests/testhelper.py | from contextlib import contextmanager
import tempfile
import os
import shutil
from configuration import Builder
from gitFunctions import Initializer
import configuration
@contextmanager
def mkchdir(subfolder, folderprefix="rtc2test_case"):
tempfolder = tempfile.mkdtemp(prefix=folderprefix + subfolder)
previo... | from contextlib import contextmanager
import tempfile
import os
import shutil
from configuration import Builder
from gitFunctions import Initializer
import configuration
@contextmanager
def mkchdir(subfolder, folderprefix="rtc2test_case"):
tempfolder = tempfile.mkdtemp(prefix=folderprefix + subfolder)
os.chd... | mit | Python |
5a8199744bf658d491721b16fea7639303e47d3f | Edit view pre-populates with data from user object | ChimeraCoder/GOctober,ChimeraCoder/GOctober,julython/julython.org,ChimeraCoder/GOctober,julython/julython.org,julython/julython.org,julython/julython.org | july/people/views.py | july/people/views.py | from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.template.context import RequestContext
#from google.appengine.ext import db
from july.people.models import Commit
from gae_django.auth.models import User
from django.http import Http404, HttpResponseRed... | from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.template.context import RequestContext
#from google.appengine.ext import db
from july.people.models import Commit
from gae_django.auth.models import User
from django.http import Http404, HttpResponseRed... | mit | Python |
8e9edf002368df0cd4bfa33975271b75af191ef0 | fix cache expiring | googleinterns/userjourneytool,googleinterns/userjourneytool | ujt/dash_app.py | ujt/dash_app.py | """ Configuration for Dash app.
Exposes app and cache to enable other files (namely callbacks) to register callbacks and update cache.
App is actually started by ujt.py
"""
import dash
import dash_bootstrap_components as dbc
import dash_cytoscape as cyto
from flask_caching import Cache
# Initialize Dash app and Flas... | """ Configuration for Dash app.
Exposes app and cache to enable other files (namely callbacks) to register callbacks and update cache.
App is actually started by ujt.py
"""
import dash
import dash_bootstrap_components as dbc
import dash_cytoscape as cyto
from flask_caching import Cache
# Initialize Dash app and Flas... | apache-2.0 | Python |
144cd7bb846c5bcbadf1676d5455a065de52419a | Leverage fixtures for sample project and user_overrides. | pypa/setuptools,pypa/setuptools,pypa/setuptools | setuptools/tests/test_upload_docs.py | setuptools/tests/test_upload_docs.py | import os
import shutil
import tempfile
import zipfile
import pytest
from setuptools.command.upload_docs import upload_docs
from setuptools.dist import Distribution
from .textwrap import DALS
SETUP_PY = DALS(
"""
from setuptools import setup
setup(name='foo')
""")
@pytest.fixture
def sample_proj... | import sys
import os
import shutil
import tempfile
import site
import zipfile
from setuptools.command.upload_docs import upload_docs
from setuptools.dist import Distribution
from .textwrap import DALS
SETUP_PY = DALS(
"""
from setuptools import setup
setup(name='foo')
""")
class TestUploadDocsTes... | mit | Python |
a8e43dcdbdd00de9d4336385b3f3def1ae5c2515 | Update UserX, with back compatibility | vanessa-bell/hd-kiosk-v2,carylF/lab5,gmist/fix-5studio,lipis/the-smallest-creature,NeftaliYagua/gae-init,gmist/my-gae-init-auth,jakedotio/gae-init,carylF/lab5,lipis/gae-init,lipis/gae-init,lovesoft/gae-init,gae-init/gae-init-docs,mdxs/gae-init,tonyin/optionstg,gmist/my-gae-init,gae-init/gae-init-babel,terradigital/gae-... | main/modelx.py | main/modelx.py | # -*- coding: utf-8 -*-
import hashlib
class BaseX(object):
@classmethod
def retrieve_one_by(cls, name, value):
cls_db_list = cls.query(getattr(cls, name) == value).fetch(1)
if cls_db_list:
return cls_db_list[0]
return None
class ConfigX(object):
@classmethod
def get_master_db(cls):
r... | # -*- coding: utf-8 -*-
import hashlib
class BaseX(object):
@classmethod
def retrieve_one_by(cls, name, value):
cls_db_list = cls.query(getattr(cls, name) == value).fetch(1)
if cls_db_list:
return cls_db_list[0]
return None
class ConfigX(object):
@classmethod
def get_master_db(cls):
r... | mit | Python |
6ba3fc5c9fade3609695aa7f5b0498b77a8c18fa | revert to 0.2.7 tag | keras-team/keras-cv,keras-team/keras-cv,keras-team/keras-cv | keras_cv/__init__.py | keras_cv/__init__.py | # Copyright 2022 The KerasCV 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | # Copyright 2022 The KerasCV 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
55a3b3a845014d0e4c4c4d057bbe088d7791d43d | Prepare for v1.10.0 | antidot/Pyckson | src/pyckson/__init__.py | src/pyckson/__init__.py | from pyckson.decorators import *
from pyckson.json import *
from pyckson.parser import parse
from pyckson.parsers.base import Parser
from pyckson.serializer import serialize
from pyckson.serializers.base import Serializer
from pyckson.dates.helpers import configure_date_formatter, configure_explicit_nulls
from pyckson.... | from pyckson.decorators import *
from pyckson.json import *
from pyckson.parser import parse
from pyckson.parsers.base import Parser
from pyckson.serializer import serialize
from pyckson.serializers.base import Serializer
from pyckson.dates.helpers import configure_date_formatter, configure_explicit_nulls
from pyckson.... | lgpl-2.1 | Python |
6d63ab2ef50512a794948c86cf1ce834b59acd90 | Add str method for map area | sevazhidkov/greenland,sevazhidkov/greenland | maps/models.py | maps/models.py | import json
from django.conf import settings
# from django.contrib.postgres.fields import JSONField
from django.db import models
JSONTextField = models.TextField
# See
# https://developers.google.com/maps/documentation/javascript/reference?hl=en#LatLngBoundsLiteral
class LatLngBounds(models.Model):
east = mode... | import json
from django.conf import settings
# from django.contrib.postgres.fields import JSONField
from django.db import models
JSONTextField = models.TextField
# See
# https://developers.google.com/maps/documentation/javascript/reference?hl=en#LatLngBoundsLiteral
class LatLngBounds(models.Model):
east = mode... | mit | Python |
f8fde8fd984242f75e36644d2e54c1d306c1b785 | Remove --population=default | dmtucker/keysmith | keysmith/__main__.py | keysmith/__main__.py | """Keysmith Default Interface"""
import argparse
import math
import string
import pkg_resources
import keysmith
def cli(parser=None):
"""Parse CLI arguments and options."""
if parser is None:
parser = argparse.ArgumentParser(prog=keysmith.CONSOLE_SCRIPT)
parser.add_argument(
'-d', '--de... | """Keysmith Default Interface"""
import argparse
import math
import string
import pkg_resources
import keysmith
def cli(parser=None):
"""Parse CLI arguments and options."""
if parser is None:
parser = argparse.ArgumentParser(prog=keysmith.CONSOLE_SCRIPT)
parser.add_argument(
'-d', '--de... | bsd-3-clause | Python |
646548dff38ea476a35462cf51ba028e3275748a | Fix some undefined reference and attribute errors in the deallocate simprocedure | chubbymaggie/simuvex,iamahuman/angr,chubbymaggie/angr,angr/angr,iamahuman/angr,chubbymaggie/simuvex,axt/angr,f-prettyland/angr,tyb0807/angr,axt/angr,angr/simuvex,chubbymaggie/simuvex,schieb/angr,tyb0807/angr,angr/angr,chubbymaggie/angr,angr/angr,tyb0807/angr,f-prettyland/angr,iamahuman/angr,f-prettyland/angr,schieb/ang... | simuvex/procedures/cgc/deallocate.py | simuvex/procedures/cgc/deallocate.py | import simuvex
import logging
l = logging.getLogger("simuvex.procedures.cgc.deallocate")
class deallocate(simuvex.SimProcedure):
#pylint:disable=arguments-differ
def run(self, addr, length): #pylint:disable=unused-argument
# return code (see deallocate() docs)
r = self.state.se.ite_cases((
... | import simuvex
class deallocate(simuvex.SimProcedure):
#pylint:disable=arguments-differ
def run(self, addr, length): #pylint:disable=unused-argument
# return code (see deallocate() docs)
r = self.state.se.ite_cases((
(addr % 0x1000 != 0, self.state.cgc.EINVAL),
... | bsd-2-clause | Python |
70c520d3ff882b499febfe021d02108f79171773 | Fix ST2(python26) compatibility. | Lyleo/OmniMarkupPreviewer,Lyleo/OmniMarkupPreviewer,timonwong/OmniMarkupPreviewer,timonwong/OmniMarkupPreviewer,Lyleo/OmniMarkupPreviewer,timonwong/OmniMarkupPreviewer,timonwong/OmniMarkupPreviewer,Lyleo/OmniMarkupPreviewer | OmniMarkupLib/Renderers/MarkdownRenderer.py | OmniMarkupLib/Renderers/MarkdownRenderer.py | from .base_renderer import *
import re
import markdown
@renderer
class MarkdownRenderer(MarkupRenderer):
FILENAME_PATTERN_RE = re.compile(r'\.(md|mkdn?|mdwn|mdown|markdown|litcoffee)$')
YAML_FRONTMATTER_RE = re.compile(r'\A---\s*\n.*?\n?^---\s*$\n?', re.DOTALL | re.MULTILINE)
def load_settings(self, rend... | from .base_renderer import *
import re
import markdown
@renderer
class MarkdownRenderer(MarkupRenderer):
FILENAME_PATTERN_RE = re.compile(r'\.(md|mkdn?|mdwn|mdown|markdown|litcoffee)$')
YAML_FRONTMATTER_RE = re.compile(r'\A---\s*\n.*?\n?^---\s*$\n?', re.DOTALL | re.MULTILINE)
def load_settings(self, rend... | mit | Python |
b7523a8bbac9fdce7d97afda32b9a7982f00a6d0 | Update Exp 7_2 | MrYsLab/pymata-aio | examples/sparkfun_redbot/sparkfun_experiments/Exp7_2_DriveDistance.py | examples/sparkfun_redbot/sparkfun_experiments/Exp7_2_DriveDistance.py | """
Exp7_2_DriveDistance -- RedBot Experiment 7.2
In an earlier experiment, we used a combination of speed and time to
drive a certain distance. Using the encoders, we can me much more accurate.
In this example, we will show you how to setup your robot to drive a certain
distance regardless of the motorPower... | """
Exp7_2_DriveDistance -- RedBot Experiment 7.2
In an earlier experiment, we used a combination of speed and time to
drive a certain distance. Using the encoders, we can me much more accurate.
In this example, we will show you how to setup your robot to drive a certain
distance regardless of the motorPower... | agpl-3.0 | Python |
168c80e3bf024f74fbb49184ceffbc2a09abe6c1 | Allow empty labels | vikoivun/kerrokantasi,stephawe/kerrokantasi,stephawe/kerrokantasi,City-of-Helsinki/kerrokantasi,stephawe/kerrokantasi,City-of-Helsinki/kerrokantasi,vikoivun/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,vikoivun/kerrokantasi | kk/models/hearing.py | kk/models/hearing.py |
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from .base import ModifiableModel
class Label(ModifiableModel):
label = models.CharField(verbose_name=_('Label'), default='', max_length=200)
def __str__(se... |
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from .base import ModifiableModel
class Label(ModifiableModel):
label = models.CharField(verbose_name=_('Label'), default='', max_length=200)
def __str__(se... | mit | Python |
d58b82997d9e5d616da2f517c19c5191c43cd823 | make membship optional, on which we revert to matching_dissim; speed improvement | nicodv/kmodes | kmodes/util/dissim.py | kmodes/util/dissim.py | """
Dissimilarity measures for clustering
"""
import numpy as np
def matching_dissim(a, b, **_):
"""Simple matching dissimilarity function"""
return np.sum(a != b, axis=1)
def euclidean_dissim(a, b, **_):
"""Euclidean distance dissimilarity function"""
if np.isnan(a).any() or np.isnan(b).any():
... | """
Dissimilarity measures for clustering
"""
import numpy as np
def matching_dissim(a, b, **_):
"""Simple matching dissimilarity function"""
return np.sum(a != b, axis=1)
def euclidean_dissim(a, b, **_):
"""Euclidean distance dissimilarity function"""
if np.isnan(a).any() or np.isnan(b).any():
... | mit | Python |
1b972c4ab088fd6566dd144992167f4a4ae62356 | rebuild LevelRenderData after saving changed_geometries | c3nav/c3nav,c3nav/c3nav,c3nav/c3nav,c3nav/c3nav | src/c3nav/mapdata/models/update.py | src/c3nav/mapdata/models/update.py | from contextlib import contextmanager
from django.conf import settings
from django.core.cache import cache
from django.db import models, transaction
from django.utils.http import int_to_base36
from django.utils.timezone import make_naive
from django.utils.translation import ugettext_lazy as _
from c3nav.mapdata.tasks... | from contextlib import contextmanager
from django.conf import settings
from django.core.cache import cache
from django.db import models, transaction
from django.utils.http import int_to_base36
from django.utils.timezone import make_naive
from django.utils.translation import ugettext_lazy as _
from c3nav.mapdata.tasks... | apache-2.0 | Python |
73b67a30495e7a6d638421ba8b9544a5e2dc4185 | Fix task full resource | cgwire/zou | zou/app/resources/project/task_full.py | zou/app/resources/project/task_full.py | from flask import abort
from flask_login import login_required
from zou.app.models.task import Task
from zou.app.models.project import Project
from zou.app.models.person import Person
from zou.app.models.entity import Entity
from zou.app.models.entity_type import EntityType
from zou.app.models.task_status import TaskS... | from flask import abort
from flask_login import login_required
from zou.app.models.task import Task
from zou.app.models.project import Project
from zou.app.models.person import Person
from zou.app.models.entity import Entity
from zou.app.models.entity_type import EntityType
from zou.app.models.task_status import TaskS... | agpl-3.0 | Python |
d4563fe6991ee644350528a469884f697f02308d | Add production of very high S/N model images | MegaMorph/galfitm-illustrations,MegaMorph/galfitm-illustrations | models/make_images.py | models/make_images.py | #!/usr/bin/env python
from glob import glob
import pyfits
import sys, os
import numpy
shape = (100,100)
bands = ['u', 'g', 'r', 'i', 'z', 'Y', 'J', 'H', 'K']
zp = numpy.array([16.75,15.957,15.0,14.563,14.259,14.162,13.955,13.636,13.525])
def make_images(model='A', noiselevel=5,
bandsel=['u', 'g', 'r... | #!/usr/bin/env python
from glob import glob
import pyfits
import sys, os
import numpy
shape = (100,100)
bands = ['u', 'g', 'r', 'i', 'z', 'Y', 'J', 'H', 'K']
zp = numpy.array([16.75,15.957,15.0,14.563,14.259,14.162,13.955,13.636,13.525])
def make_images(model='A', noiselevel=5,
bandsel=['u', 'g', 'r... | mit | Python |
2417f7e3c445c7f369c9eb8cb48c83ebb4c2e43d | Change blueprints to be more container-like. | SunDwarf/Kyoukai | kyokai/blueprints.py | kyokai/blueprints.py | """
Kyōkai blueprints are simply groups of routes.
They're a simpler way of grouping your routes together instead of having to import your app object manually all of
the time.
"""
from kyokai.route import Route
class Blueprint(object):
"""
A Blueprint is a container for routes.
"""
def __init__(self,... | """
Kyōkai are simply groups of routes.
They're a simpler way of grouping your routes together instead of having to import your app object manually all of
the time.
"""
from kyokai.route import Route
class Blueprint(object):
"""
A Blueprint contains one public method: `bp.route`. It acts exactly the same as ... | mit | Python |
a43ada7785db136f3a5d7d96c6b64b0a686d052e | fix total_force missing | adengz/nano266,adengz/nano266 | labs/lab2/analyze.py | labs/lab2/analyze.py | #!/usr/bin/env python
import re
import sys
import csv
import argparse
# This defines the patterns for extracting relevant data from the output
# files.
patterns = {
"energy": re.compile("total energy\s+=\s+([\d\.\-]+)\sRy"),
"ecut": re.compile("kinetic\-energy cutoff\s+=\s+([\d\.\-]+)\s+Ry"),
"alat": re.... | #!/usr/bin/env python
import re
import sys
import csv
import argparse
# This defines the patterns for extracting relevant data from the output
# files.
patterns = {
"energy": re.compile("total energy\s+=\s+([\d\.\-]+)\sRy"),
"ecut": re.compile("kinetic\-energy cutoff\s+=\s+([\d\.\-]+)\s+Ry"),
"alat": re.... | bsd-3-clause | Python |
0ce8050b797b3e2c2a9b0e74cbc67fd8e31736b3 | Remove working distros to focus on non-working ones | FOGProject/fog-community-scripts,FOGProject/fog-community-scripts,FOGProject/fog-community-scripts | fog-aws-testing/scripts/settings.py | fog-aws-testing/scripts/settings.py | # The list of OSs.
#OSs = ["debian9","centos7","rhel7","fedora29","arch","ubuntu18_04"]
OSs = ["rhel7","fedora29","arch","ubuntu18_04"]
#dnsAddresses = ["debian9.fogtesting.cloud","centos7.fogtesting.cloud","rhel7.fogtesting.cloud","fedora29.fogtesting.cloud","arch.fogtesting.cloud","ubuntu18_04.fogtesting.cloud"]
dnsA... | # The list of OSs.
OSs = ["debian9","centos7","rhel7","fedora29","arch","ubuntu18_04"]
dnsAddresses = ["debian9.fogtesting.cloud","centos7.fogtesting.cloud","rhel7.fogtesting.cloud","fedora29.fogtesting.cloud","arch.fogtesting.cloud","ubuntu18_04.fogtesting.cloud"]
# The list of branches to process.
branches = ["maste... | mit | Python |
b72ab35056ca6ec1e48db963d61c31d89ec80161 | fix on winsock2 | tuttleofx/sconsProject | autoconf/winsock2.py | autoconf/winsock2.py | from _external import *
winsock2 = LibWithHeaderChecker( 'ws2_32',
['winsock2.h'],
'c',
name='winsock2' )
| from _external import *
winsock2 = LibWithHeaderChecker( 'winsock2',
['winsock2.h'],
'c',
name='ws2_32' )
| mit | Python |
0b499f01d517775fb03294c1c785318ca6224874 | Bump to v0.0.5 | cogniteev/backache | backache/__init__.py | backache/__init__.py | from . core import *
from . antioxidant import celerize # flake8: noqa
from . errors import *
__version__ = (0, 0, 5)
| from . core import *
from . antioxidant import celerize # flake8: noqa
from . errors import *
__version__ = (0, 0, 4)
| apache-2.0 | Python |
ce2cf07d9fa9dc3bdd229b1cbb56745784e3049d | Fix stray char. | riga/law,riga/law | law/sandbox/docker.py | law/sandbox/docker.py | # -*- coding: utf-8 -*-
"""
Docker sandbox implementation.
"""
__all__ = ["DockerSandbox"]
from law.sandbox.base import Sandbox
class DockerSandbox(Sandbox):
sandbox_type = "docker"
@property
def image(self):
return self.name
def cmd(self, task, task_cmd):
# get args for the do... | # -*- coding: utf-8 -*-
"""
Docker sandbox implementation.
"""
__all__ = ["DockerSandbox"]
from law.sandbox.base import Sandbox
class DockerSandbox(Sandbox):
sandbox_type = "docker"
@property
def image(self):
return self.name
def cmd(self, task, task_cmd):
# get args for the do... | bsd-3-clause | Python |
699085edd1db5aa7a827a16ffffcbcc9a69cbf52 | Add forgotten imports for bucketlist endpoints | brayoh/bucket-list-api | app/endpoints.py | app/endpoints.py | from flask import request, Blueprint
from flask_restful import Api
from controllers.accounts_manager import LoginResource, RegisterResource
from controllers.bucketlist import BucketListsResource, BucketListResource
from controllers.bucketlist_items import BucketListItems
bucketlist_blueprint = Blueprint('bucket_list... | from flask import request, Blueprint
from flask_restful import Api
from controllers.accounts_manager import LoginResource, RegisterResource
from controllers.bucketlist import GetAllBucketLists, GetBucketList
from controllers.bucketlist_items import BucketListItems
bucketlist_blueprint = Blueprint('bucket_list', __na... | mit | Python |
6908060af5b872e54d42f63e580591931b7ff230 | Check empty string | DrDos0016/z2,DrDos0016/z2,DrDos0016/z2 | museum_site/scroll.py | museum_site/scroll.py | from django.db import models
class Scroll(models.Model):
# Constants
SCROLL_TOP = """```
╞╤═════════════════════════════════════════════╤╡
│ Scroll ### │
╞═════════════════════════════════════════════╡
│ • • • • • • • • •│"""
SCROLL_BOTTOM = ... | from django.db import models
class Scroll(models.Model):
# Constants
SCROLL_TOP = """```
╞╤═════════════════════════════════════════════╤╡
│ Scroll ### │
╞═════════════════════════════════════════════╡
│ • • • • • • • • •│"""
SCROLL_BOTTOM = ... | mit | Python |
e00b7c612f34c938a3d42dada006874ffea021c8 | complete localizer | minggli/fisheries-convnet,minggli/fisheries-convnet | app/localizer.py | app/localizer.py | # -*- coding: utf-8 -*-
"""
localizer
localize bounding boxes and pad rest of image with zeros (255, 255, 255)
"""
import os
import cv2
import numpy as np
import multiprocessing as mp
from app.pipeline import generate_data_skeleton
from app.cv.serializer import deserialize_json
from app.settings import BOUNDINGBOX, I... | # -*- coding: utf-8 -*-
"""
localizer
localize bounding boxes and pad rest of image with zeros (255, 255, 255)
"""
import os
import cv2
import numpy as np
from app.cv.serializer import deserialize_json
from app.settings import CV_SAMPLE_PATH, BOUNDINGBOX
test_image = CV_SAMPLE_PATH + 'pos/img_00003.jpg'
class Loca... | mit | Python |
73b9246164994049d291d5b482d4dbf2ca41a124 | Rename master branch to main | alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin | tests/app/test_accessibility_statement.py | tests/app/test_accessibility_statement.py | import re
import subprocess
from datetime import datetime
def test_last_review_date():
statement_file_path = "app/templates/views/accessibility_statement.html"
# test local changes against main for a full diff of what will be merged
statement_diff = subprocess.run(
[f"git diff --exit-code origin/... | import re
import subprocess
from datetime import datetime
def test_last_review_date():
statement_file_path = "app/templates/views/accessibility_statement.html"
# test local changes against master for a full diff of what will be merged
statement_diff = subprocess.run(
[f"git diff --exit-code origi... | mit | Python |
5f5bdcf5c6b6fb70dc94945d463c5200a46699d6 | revert unfinished task test | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | tests/integration/unfinished_task_test.py | tests/integration/unfinished_task_test.py | # stdlib
import time
# third party
import pytest
# syft absolute
import syft as sy
from syft.core.node.common.action.save_object_action import SaveObjectAction
from syft.core.store.storeable_object import StorableObject
@pytest.mark.general
def test_unfinished_task(get_clients) -> None:
print("running test_unfi... | # third party
import pytest
# syft absolute
import syft as sy
from syft.core.node.common.action.save_object_action import SaveObjectAction
from syft.core.store.storeable_object import StorableObject
@pytest.mark.general
def test_unfinished_task(get_clients) -> None:
print("running test_unfinished_task")
clie... | apache-2.0 | Python |
da3a4e8036a5933a9ce00f42795c8ca398925c38 | Update geogig_init_repo.py | state-hiu/cybergis-scripts,state-hiu/cybergis-scripts | lib/rogue/geogig_init_repo.py | lib/rogue/geogig_init_repo.py | from base64 import b64encode
from optparse import make_option
import json
import urllib
import urllib2
import argparse
import time
import os
import subprocess
#==#
import _geogig_init_repo
#==#
parser = argparse.ArgumentParser(description='Initialize GeoGig repository and optionally add to GeoServer instance. If you w... | from base64 import b64encode
from optparse import make_option
import json
import urllib
import urllib2
import argparse
import time
import os
import subprocess
#==#
import _geogig_init_repo
#==#
parser = argparse.ArgumentParser(description='Initialize GeoGig repository and optionally add to GeoServer instance. If you w... | mit | Python |
a19a52a42486eaa8e849d2f0a175f9a76497029d | bump version number | Kagiso-Future-Media/django-intercom,kencochrane/django-intercom,kencochrane/django-intercom,mikesdnielsen/django-intercom,mikesdnielsen/django-intercom,Kagiso-Future-Media/django-intercom | intercom/__init__.py | intercom/__init__.py | __version__ = "0.0.7"
| __version__ = "0.0.6" | bsd-3-clause | Python |
d23a53f5c97a3939952ecb8f39d24603fe0d4bab | bump `datadog-checks-base` version (#9718) | DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core | mysql/setup.py | mysql/setup.py | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from codecs import open
from os import path
from setuptools import setup
HERE = path.abspath(path.dirname(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, "datadog_checks", "mysql", "_... | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from codecs import open
from os import path
from setuptools import setup
HERE = path.abspath(path.dirname(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, "datadog_checks", "mysql", "_... | bsd-3-clause | Python |
1ecf42f474b17e01de12d235a29b08e7f18d0726 | bump version to v1.10.3 | simomarsili/ndd | ndd/package.py | ndd/package.py | # -*- coding: utf-8 -*-
"""Template package file"""
__title__ = 'ndd'
__version__ = '1.10.3'
__author__ = 'Simone Marsili'
__summary__ = ''
__url__ = 'https://github.com/simomarsili/ndd'
__email__ = 'simo.marsili@gmail.com'
__license__ = 'BSD 3-Clause'
__copyright__ = 'Copyright (c) 2020, Simone Marsili'
__classifiers_... | # -*- coding: utf-8 -*-
"""Template package file"""
__title__ = 'ndd'
__version__ = '1.10.2'
__author__ = 'Simone Marsili'
__summary__ = ''
__url__ = 'https://github.com/simomarsili/ndd'
__email__ = 'simo.marsili@gmail.com'
__license__ = 'BSD 3-Clause'
__copyright__ = 'Copyright (c) 2020, Simone Marsili'
__classifiers_... | bsd-3-clause | Python |
527ccd5790aa08d33387b43fd25beb2ed20335c7 | remove defaults, use self.asserts | karllessard/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,tensorflow/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflo... | tensorflow/python/ops/script_ops_test.py | tensorflow/python/ops/script_ops_test.py | # Copyright 2020 The TensorFlow 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 applica... | # Copyright 2020 The TensorFlow 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 applica... | apache-2.0 | Python |
10f0807b9ab85bfa6f6bbb4ed533e1a8af642571 | fix bug in raw service | spaam/svtplay-dl,spaam/svtplay-dl,olof/svtplay-dl,olof/svtplay-dl | lib/svtplay_dl/service/raw.py | lib/svtplay_dl/service/raw.py | from __future__ import absolute_import
import os
import re
from svtplay_dl.service import Service
from svtplay_dl.fetcher.hds import hdsparse
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.fetcher.dash import dashparse
class Raw(Service):
def get(self):
if self.exclude():
return
... | from __future__ import absolute_import
import os
import re
from svtplay_dl.service import Service
from svtplay_dl.fetcher.hds import hdsparse
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.fetcher.dash import dashparse
class Raw(Service):
def get(self):
if self.exclude():
return
... | mit | Python |
6a2aa6051c7922d1b2b37824d92634a4880e9ff2 | Correct semantic version format. | tensorflow/probability,tensorflow/probability | tensorflow_probability/python/version.py | tensorflow_probability/python/version.py | # Copyright 2018 The TensorFlow Probability 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 o... | # Copyright 2018 The TensorFlow Probability 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 o... | apache-2.0 | Python |
82665b999fb07e3ebc41de8132ba9d22dc04140c | Change version number back to 0.8.0.dev | samuelgarcia/python-neo,apdavison/python-neo,NeuralEnsemble/python-neo,rgerkin/python-neo,JuliaSprenger/python-neo,INM-6/python-neo | neo/version.py | neo/version.py | # -*- coding: utf-8 -*-
version = '0.8.0.dev'
| # -*- coding: utf-8 -*-
version = '0.7.1'
| bsd-3-clause | Python |
b3761729b156367229b5cd8895d225cb13d3267a | Fix example `Set-Based Column Map Expectation` template import (#6134) | great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations | examples/expectations/set_based_column_map_expectation_template.py | examples/expectations/set_based_column_map_expectation_template.py | """
This is a template for creating custom SetBasedColumnMapExpectations.
For detailed instructions on how to use it, please see:
https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_set_based_column_map_expectations
"""
from great_expectations.expectations.s... | """
This is a template for creating custom SetBasedColumnMapExpectations.
For detailed instructions on how to use it, please see:
https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_set_based_column_map_expectations
"""
from great_expectations.expectations.r... | apache-2.0 | Python |
99e9ef79178d6e2dffd8ec7ed12b3edbd8b7d0f1 | Add basket total to context | JamesRamm/longclaw,JamesRamm/longclaw,JamesRamm/longclaw,JamesRamm/longclaw | longclaw/longclawbasket/views.py | longclaw/longclawbasket/views.py | from django.shortcuts import render
from django.views.generic import ListView
from longclaw.longclawbasket.models import BasketItem
from longclaw.longclawbasket import utils
class BasketView(ListView):
model = BasketItem
template_name = "longclawbasket/basket.html"
def get_context_data(self, **kwargs):
... | from django.shortcuts import render
from django.views.generic import ListView
from longclaw.longclawbasket.models import BasketItem
from longclaw.longclawbasket import utils
class BasketView(ListView):
model = BasketItem
template_name = "longclawbasket/basket.html"
def get_context_data(self, **kwargs):
... | mit | Python |
1d07732e0fae0dca9eae1d89de913a1e124e32fc | Disable some prod optimisations | Turupawn/website,lutris/website,lutris/website,Turupawn/website,lutris/website,lutris/website,Turupawn/website,Turupawn/website | lutrisweb/settings/production.py | lutrisweb/settings/production.py | import os
from base import * # noqa
DEBUG = False
MEDIA_URL = '//lutris.net/media/'
FILES_ROOT = '/srv/files'
ALLOWED_HOSTS = ['.lutris.net', '.lutris.net.', ]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'lutris',
'USER': 'lutris',
'PASS... | import os
from base import * # noqa
DEBUG = False
MEDIA_URL = '//lutris.net/media/'
FILES_ROOT = '/srv/files'
ALLOWED_HOSTS = ['.lutris.net', '.lutris.net.', ]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'lutris',
'USER': 'lutris',
'PASS... | agpl-3.0 | Python |
362312ad1a26dbecf0c4942c9a6e7042cbaab3bd | Test the rest of Roman masters | khaledhosny/psautohint,khaledhosny/psautohint | test-mm.py | test-mm.py | from psautohint import autohint
from psautohint import psautohint
def getFonts(masters, baseDir):
options = autohint.ACOptions()
options.quiet = True
fonts = []
infos = []
for master in masters:
path = "%s/%s/font.ufo" % (baseDir, master)
font = autohint.openUFOFile(path, None, Fal... | from psautohint import autohint
from psautohint import psautohint
def getFonts(masters, baseDir):
options = autohint.ACOptions()
options.quiet = True
fonts = []
infos = []
for master in masters:
path = "%s/%s/font.ufo" % (baseDir, master)
font = autohint.openUFOFile(path, None, Fal... | apache-2.0 | Python |
6aa5e2c95c0f529aa2803395779ca7274d5795b1 | Bump version to 1.0.1-machtfit-67 | machtfit/django-oscar,machtfit/django-oscar,machtfit/django-oscar | src/oscar/__init__.py | src/oscar/__init__.py | import os
# Use 'dev', 'beta', or 'final' as the 4th element to indicate release type.
VERSION = (1, 0, 1, 'machtfit', 67)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
return '{}.{}.{}-{}-{}'.format(*VERSION)
# Cheeky setting that allows each template to be acces... | import os
# Use 'dev', 'beta', or 'final' as the 4th element to indicate release type.
VERSION = (1, 0, 1, 'machtfit', 66)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
return '{}.{}.{}-{}-{}'.format(*VERSION)
# Cheeky setting that allows each template to be acces... | bsd-3-clause | Python |
d9c2bb2de79db80bc94509cb6a23de7f85e6e899 | update tests | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | tests/test_pecanstreet_dataset_adapter.py | tests/test_pecanstreet_dataset_adapter.py | import sys
sys.path.append('../')
from disaggregator import PecanStreetDatasetAdapter
import unittest
class PecanStreetDatasetAdapterTestCase(unittest.TestCase):
def setUp(self):
db_url = "postgresql://USERNAME:PASSWORD@db.wiki-energy.org:5432/postgres"
self.psda = PecanStreetDatasetAdapter(db_u... | import sys
sys.path.append('../')
from disaggregator import PecanStreetDatasetAdapter
import unittest
class PecanStreetDatasetAdapterTestCase(unittest.TestCase):
def setUp(self):
db_url = "postgresql://USERNAME:PASSWORD@db.wiki-energy.org:5432/postgres"
self.psda = PecanStreetDatasetAdapter(db_u... | mit | Python |
52ebe157585019c9be01b22638fff924ba328892 | Increase delay (to fix tests that are failing randomly on travis but are always passing on my locale machine) | pyQode/pyqode.python,zwadar/pyqode.python,mmolero/pyqode.python,pyQode/pyqode.python | test/test_modes/test_goto_assignments.py | test/test_modes/test_goto_assignments.py | """
Test the autocomplete mode
"""
from pyqode.core.api import TextHelper
from pyqode.qt import QtCore, QtWidgets
from pyqode.qt.QtTest import QTest
from pyqode.python import modes as pymodes
from test.helpers import editor_open
def get_mode(editor):
return editor.modes.get(pymodes.GoToAssignmentsMode)
@editor_... | """
Test the autocomplete mode
"""
from pyqode.core.api import TextHelper
from pyqode.qt import QtCore, QtWidgets
from pyqode.qt.QtTest import QTest
from pyqode.python import modes as pymodes
from test.helpers import editor_open
def get_mode(editor):
return editor.modes.get(pymodes.GoToAssignmentsMode)
@editor_... | mit | Python |
48e280177123902001e4ff6fb3e178190b435054 | fix test for Exscript.workqueue.MainLoop. | maximumG/exscript,knipknap/exscript,knipknap/exscript,maximumG/exscript | tests/Exscript/workqueue/MainLoopTest.py | tests/Exscript/workqueue/MainLoopTest.py | import sys, unittest, re, os.path, threading
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..', 'src'))
from Exscript.workqueue import MainLoop
from Exscript.workqueue.Job import ProcessJob
class MainLoopTest(unittest.TestCase):
CORRELATE = MainLoop
def setUp(self):
pass
... | import sys, unittest, re, os.path, threading
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..', 'src'))
from Exscript.workqueue import MainLoop
class MainLoopTest(unittest.TestCase):
CORRELATE = MainLoop
def setUp(self):
pass
def testMainLoop(self):
lock = threa... | mit | Python |
523216bbf6f21757651e41ac307bc296041b7963 | load nonlinux_config if the platform is not linux | simphony/simphony-remote,simphony/simphony-remote,simphony/simphony-remote,simphony/simphony-remote | tests/docker/test_async_docker_client.py | tests/docker/test_async_docker_client.py | import os
import sys
import warnings
from tornado.testing import AsyncTestCase, gen_test
from remoteappmanager.docker.async_docker_client import AsyncDockerClient
from tests.docker.config import nonlinux_config
from tests import utils
class TestAsyncDockerClient(AsyncTestCase):
def setUp(self):
super().s... | import os
import warnings
from tornado.testing import AsyncTestCase, gen_test
from remoteappmanager.docker.async_docker_client import AsyncDockerClient
from tests.docker.config import nonlinux_config
from tests import utils
class TestAsyncDockerClient(AsyncTestCase):
def setUp(self):
super().setUp()
... | bsd-3-clause | Python |
6bec22cd51288c94dff40cf0c973b975538040d5 | Increase timeout for test_long_running_job test | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/minion/test_timeout.py | tests/integration/minion/test_timeout.py | # -*- coding: utf-8 -*-
'''
Tests for various minion timeouts
'''
# Import Python libs
from __future__ import absolute_import
import os
import sys
import salt.utils.platform
# Import Salt Testing libs
from tests.support.case import ShellCase
class MinionTimeoutTestCase(ShellCase):
'''
Test minion timing fu... | # -*- coding: utf-8 -*-
'''
Tests for various minion timeouts
'''
# Import Python libs
from __future__ import absolute_import
import os
import sys
import salt.utils.platform
# Import Salt Testing libs
from tests.support.case import ShellCase
class MinionTimeoutTestCase(ShellCase):
'''
Test minion timing fu... | apache-2.0 | Python |
0bb2ebc52e720a3d693ca14f3621fd710ea36d4b | use make_result_iq | community-ssu/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,community-ssu/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/... | tests/twisted/vcard/test-avatar-async.py | tests/twisted/vcard/test-avatar-async.py |
"""
Test support for retrieving avatars asynchronously using RequestAvatars.
"""
import base64
import hashlib
from servicetest import EventPattern
from gabbletest import exec_test, acknowledge_iq, make_result_iq
def test(q, bus, conn, stream):
conn.Connect()
_, iq_event = q.expect_many(
EventPattern... |
"""
Test support for retrieving avatars asynchronously using RequestAvatars.
"""
import base64
import hashlib
from servicetest import EventPattern
from gabbletest import exec_test, acknowledge_iq
def test(q, bus, conn, stream):
conn.Connect()
_, iq_event = q.expect_many(
EventPattern('dbus-signal', ... | lgpl-2.1 | Python |
cf4d8318557d971cee1869fe8cbac82cc6316020 | Change expected exception | plotly/python-api,plotly/plotly.py,plotly/plotly.py,plotly/python-api,plotly/plotly.py,plotly/python-api | plotly/tests/test_core/test_file/test_file.py | plotly/tests/test_core/test_file/test_file.py | """
test_meta:
==========
A module intended for use with Nose.
"""
import random
import string
import requests
from unittest import TestCase
from nose.plugins.attrib import attr
import plotly.plotly as py
from plotly.exceptions import PlotlyRequestError
@attr('slow')
class FolderAPITestCase(TestCase):
def se... | """
test_meta:
==========
A module intended for use with Nose.
"""
import random
import string
import requests
from unittest import TestCase
from nose.plugins.attrib import attr
import plotly.plotly as py
from plotly.exceptions import PlotlyRequestError
@attr('slow')
class FolderAPITestCase(TestCase):
def se... | mit | Python |
6cfc94d8a03439c55808090aa5e3a4f35c288887 | Use assert_allclose so we can see the appveyor failure | yuxiang-zhou/menpodetect,jabooth/menpodetect,yuxiang-zhou/menpodetect,jabooth/menpodetect | menpodetect/tests/opencv_test.py | menpodetect/tests/opencv_test.py | from numpy.testing import assert_allclose
from menpodetect.opencv import (load_opencv_frontal_face_detector,
load_opencv_eye_detector)
import menpo.io as mio
takeo = mio.import_builtin_asset.takeo_ppm()
def test_frontal_face_detector():
takeo_copy = takeo.copy()
opencv_detecto... | from menpodetect.opencv import (load_opencv_frontal_face_detector,
load_opencv_eye_detector)
import menpo.io as mio
takeo = mio.import_builtin_asset.takeo_ppm()
def test_frontal_face_detector():
takeo_copy = takeo.copy()
opencv_detector = load_opencv_frontal_face_detector()
... | bsd-3-clause | Python |
b8d0a7cbac6ab2415a1d059a1f68428e9312f3cb | Make our error page handlers work on Django 2.0 (#969) | DMOJ/site,DMOJ/site,DMOJ/site,DMOJ/site | judge/views/error.py | judge/views/error.py | import traceback
from django.shortcuts import render
from django.utils.translation import gettext as _
def error(request, context, status):
return render(request, 'error.html', context=context, status=status)
def error404(request, exception=None):
# TODO: "panic: go back"
return render(request, 'generi... | import traceback
from django.shortcuts import render
from django.utils.translation import gettext as _
def error(request, context, status):
return render(request, 'error.html', context=context, status=status)
def error404(request):
# TODO: "panic: go back"
return render(request, 'generic-message.html',... | agpl-3.0 | Python |
4e92dabe65416a3a751a0b38e75512b6daa1ba38 | Remove useless imports | gdetrez/fscons-ticketshop,gdetrez/fscons-ticketshop,gdetrez/fscons-ticketshop | ticketshop/ticketapp/tests/test_views.py | ticketshop/ticketapp/tests/test_views.py | from django.test import Client
from django.contrib.auth.models import User
from django.test import TestCase
from ..models import TicketType, TicketPurchase
class TicketPurchaseViewTest(TestCase):
def test_getForm(self):
"""
Test that we can get the purchase form
"""
self.assertCon... | from django.test import Client
from django.contrib.auth.models import User
from django.contrib.messages.storage.base import Message
from django.contrib.messages.constants import ERROR
from django.test import TestCase
from ..models import TicketType, Ticket, TicketPurchase, Coupon
class TicketPurchaseViewTest(TestCase... | mit | Python |
1f98e497136ce3d9da7e63a6dc7c3f67fedf50b5 | Save the observation if the form was valid. | zsiciarz/variablestars.net,zsiciarz/variablestars.net,zsiciarz/variablestars.net | observations/views.py | observations/views.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import messages
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import FormView
from braces.views import LoginRequiredMixin
from .forms import O... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import messages
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import FormView
from braces.views import LoginRequiredMixin
from .forms import O... | mit | Python |
6353dd8caa3656b8c37280bcccd56cfaa78ff67a | Add API for making authenticated API requests | valohai/valohai-cli | valohai_cli/api.py | valohai_cli/api.py | import platform
from urllib.parse import urljoin, urlparse
import requests
from click.globals import get_current_context
from requests.auth import AuthBase
from valohai_cli import __version__ as VERSION
from valohai_cli.exceptions import APIError, ConfigurationError
from valohai_cli.settings import settings
from valo... | import platform
from urllib.parse import urljoin, urlparse
import requests
from requests.auth import AuthBase
from valohai_cli import __version__ as VERSION
from valohai_cli.exceptions import APIError, ConfigurationError
from valohai_cli.settings import settings
class TokenAuth(AuthBase):
def __init__(self, net... | mit | Python |
1b2a1bb5f4c99f80c3664a40796939732e9fe91c | bump dev version | bndl/bndl,bndl/bndl | bndl/__init__.py | bndl/__init__.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 th... | # 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 th... | apache-2.0 | Python |
b159d28dc965e60843f2617b4ae40d6c04cd2604 | Optimize sensitive areas API | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/api/v2/views/sensitivity.py | geotrek/api/v2/views/sensitivity.py | from __future__ import unicode_literals
from django.conf import settings
from django.db.models import F, Case, When
from django_filters.rest_framework.backends import DjangoFilterBackend
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from geotrek.api.v2 import serializers as api_serializers, \
v... | from __future__ import unicode_literals
from django.conf import settings
from django.db.models import F, Case, When
from django_filters.rest_framework.backends import DjangoFilterBackend
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from geotrek.api.v2 import serializers as api_serializers, \
v... | bsd-2-clause | Python |
9433fa8970341cb2d024bceb0e23e93fbfb71393 | Update python test | enjin/contracts | solidity/python/FormulaTestSale.py | solidity/python/FormulaTestSale.py | from sys import argv
from decimal import Decimal
from random import randrange
from Formula import calculateSaleReturn
def formulaTest(supply,reserve,ratio,amount):
fixed = Decimal(calculateSaleReturn(supply,reserve,ratio,amount))
real = Decimal(reserve)*(1-(1-Decimal(amount)/Decimal(supply))**(100/Decim... | from sys import argv
from decimal import Decimal
from random import randrange
from Formula import calculateSaleReturn
def formulaTest(supply,reserve,ratio,amount):
fixed = Decimal(calculateSaleReturn(supply,reserve,ratio,amount))
real = Decimal(reserve)*(1-(1-Decimal(amount)/Decimal(supply))**(100/Decim... | apache-2.0 | Python |
e364bdf7723ca45ac1000eda13a76cf1b19f0ad8 | Remove a debug print | ipa-led/airbus_coop,ipa-led/airbus_coop,ipa-led/airbus_coop,ipa-led/airbus_coop | plugins/plugin_node_manager/src/plugin_node_manager/launch_item.py | plugins/plugin_node_manager/src/plugin_node_manager/launch_item.py | #!/usr/bin/env python
################################################################################
#
# Copyright Airbus Group SAS 2015
# All rigths reserved.
#
# File Name : setup.py
# Authors : Martin Matignon
#
# If you find any bug or if you have any question please contact
# Adolfo Suarez Roos <adolfo.suarez@ai... | #!/usr/bin/env python
################################################################################
#
# Copyright Airbus Group SAS 2015
# All rigths reserved.
#
# File Name : setup.py
# Authors : Martin Matignon
#
# If you find any bug or if you have any question please contact
# Adolfo Suarez Roos <adolfo.suarez@ai... | apache-2.0 | Python |
31caceefaa2f6b6dc7d2601d8537e613ce600743 | Use account's static groups instead of a conversation's groups for dialogue group state | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/apps/dialogue/view_definition.py | go/apps/dialogue/view_definition.py | import json
from django.http import HttpResponse
from django.forms import Form
from go.api.go_api import client
from go.api.go_api.client import GoApiError
from go.conversation.view_definition import (
ConversationViewDefinitionBase, ConversationTemplateView)
class DialogueEditView(ConversationTemplateView):
... | import json
from django.http import HttpResponse
from django.forms import Form
from go.api.go_api import client
from go.api.go_api.client import GoApiError
from go.conversation.view_definition import (
ConversationViewDefinitionBase, ConversationTemplateView)
class DialogueEditView(ConversationTemplateView):
... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.