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 |
|---|---|---|---|---|---|---|---|---|
7095948771778624d8f1fb40a311660f84f331f1 | add 'remove' | ireapps/census,ireapps/census,ireapps/census,ireapps/census | dataprocessing/update_state_list.py | dataprocessing/update_state_list.py | #!/usr/bin/env python
import json
import sys
from boto.exception import S3ResponseError
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import config
import utils
def update_state_list(environment, state, clear=False, remove=False):
c = S3Connection()
bucket = c.get_bucket(config.S3_... | #!/usr/bin/env python
import json
import sys
from boto.exception import S3ResponseError
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import config
import utils
def update_state_list(environment, state, clear=False):
c = S3Connection()
bucket = c.get_bucket(config.S3_BUCKETS[enviro... | mit | Python |
2ce9e927602c7b61c17fe4a80ff2d470caac7d55 | update host.py | open-falcon/portal,Cepave/portal,Cepave/portal,open-falcon/portal,open-falcon/portal,Cepave/portal,Cepave/portal,open-falcon/portal | web/model/host.py | web/model/host.py | # -*- coding:utf-8 -*-
__author__ = 'Ulric Qin'
from .bean import Bean
from frame.store import db
class Host(Bean):
_tbl = 'host'
_cols = 'id, hostname, maintain_begin, maintain_end'
def __init__(self, _id, hostname, maintain_begin, maintain_end):
self.id = _id
self.hostname = hostname
... | # -*- coding:utf-8 -*-
__author__ = 'Ulric Qin'
from .bean import Bean
from frame.store import db
class Host(Bean):
_tbl = 'host'
_cols = 'id, hostname, maintain_begin, maintain_end'
def __init__(self, _id, hostname, maintain_begin, maintain_end):
self.id = _id
self.hostname = hostname
... | apache-2.0 | Python |
1138610c1602b6e2ed07892b98be86842a931024 | Revert "Move _contact_details => contact_details" | mileswwatkins/pupa,datamade/pupa,opencivicdata/pupa,opencivicdata/pupa,mileswwatkins/pupa,rshorey/pupa,rshorey/pupa,influence-usa/pupa,influence-usa/pupa,datamade/pupa | pupa/scrape/helpers.py | pupa/scrape/helpers.py | """ these are helper classes for object creation during the scrape """
from .popolo import Person, Organization, Membership
class Legislator(Person):
def __init__(self, name, district, party=None, chamber=None, role='member', **kwargs):
super(Legislator, self).__init__(name, **kwargs)
self._distri... | """ these are helper classes for object creation during the scrape """
from .popolo import Person, Organization, Membership
class Legislator(Person):
def __init__(self, name, district, party=None, chamber=None, role='member', **kwargs):
super(Legislator, self).__init__(name, **kwargs)
self._distri... | bsd-3-clause | Python |
4598e19727dd795548896157bdc455da3cc13254 | modify export_jars.py script to accept command line arg | PunchThrough/Bean-Android-SDK,PunchThrough/Bean-Android-SDK,PunchThrough/bean-sdk-android,PunchThrough/bean-sdk-android | export_jars.py | export_jars.py | #!/usr/bin/python
import sys
import shutil
from glob import glob
from subprocess import call, check_output
if len(sys.argv) < 2:
print('Please provide an absolute path to a projects libs/ folder')
sys.exit(1)
target_project_libs_folder = sys.argv[1]
def call_unsafe(*args, **kwargs):
kwargs['shell'] =... | #!/usr/bin/python
import os
import shutil
from glob import glob
from subprocess import call, check_output
OUTPUT_DIR_NAME = 'jars'
def call_unsafe(*args, **kwargs):
kwargs['shell'] = True
call(*args, **kwargs)
call_unsafe('./gradlew clean javadocRelease jarRelease')
try:
os.mkdir(OUTPUT_DIR_NAME)
exc... | mit | Python |
a3a2ad5099663bb92a04db41e531c776b9e02d41 | Use from dials_regression.image_examples.get_all_working_images import get_all_working_images method to get list of images | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | dxtbx/tst_dxtbx.py | dxtbx/tst_dxtbx.py | def tst_dxtbx():
import libtbx.load_env
import os
dials_regression = libtbx.env.dist_path('dials_regression')
from boost.python import streambuf
from dxtbx import read_uint16
from dxtbx.format.Registry import Registry
from dials_regression.image_examples.get_all_working_images import \
... | def tst_dxtbx():
import libtbx.load_env
import os
dials_regression = libtbx.env.dist_path('dials_regression')
from boost.python import streambuf
from dxtbx import read_uint16
from dxtbx.format.Registry import Registry
for directory, image in [('SLS_X06SA', 'mar225_2_001.img')]:
file... | bsd-3-clause | Python |
3651c7f28ab0a12a5e419576919e69b332509600 | remove 2 unused pass statements | Yinr/LCBot,LCTT/LCBot,robot527/LCBot | export_puid.py | export_puid.py | #!/usr/bin/env python3
# coding: utf-8
from wxpy import *
'''
使用 cache 来缓存登陆信息,同时使用控制台登陆
'''
bot = Bot('bot.pkl', console_qr=False)
'''
开启 PUID 用于后续的控制
'''
bot.enable_puid('wxpy_puid.pkl')
friends = bot.friends()
groups = bot.groups()
with open('data', 'w',encoding='UTF-8') as output:
output.write("-----Frie... | #!/usr/bin/env python3
# coding: utf-8
from wxpy import *
'''
使用 cache 来缓存登陆信息,同时使用控制台登陆
'''
bot = Bot('bot.pkl', console_qr=False)
'''
开启 PUID 用于后续的控制
'''
bot.enable_puid('wxpy_puid.pkl')
friends = bot.friends()
groups = bot.groups()
with open('data', 'w',encoding='UTF-8') as output:
output.write("-----Frie... | mit | Python |
fe6f13739f927820ceb0514d392a27e8400509e9 | add basic phot uncert | jradavenport/MW-Flare | LSSToy.py | LSSToy.py | import numpy as np
import matplotlib.pyplot as plt
def generate_visits(Nvisits=900, tspan=10, stat=False,
seasonscale=365./5):
'''
Use some very crude approximations for how visits will be spaced out:
- Survey starts at midnight, time = 0.0
- Can only observe at night, time > 0.75... | import numpy as np
def generate_visits(Nvisits=900, tspan=10, stat=False,
seasonscale=365./5):
'''
Use some very crude approximations for how visits will be spaced out:
- Survey starts at midnight, time = 0.0
- Can only observe at night, time > 0.75 | time < 0.25
- Exposures a... | mit | Python |
c77b71bb120c1c1413e6b3db94cf14cbf8e1eb31 | Update config list to avoid autograph conversion of Keras code. | tensorflow/tensorflow-pywrap_tf_optimizer,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_tf_optimizer,paolodedios/tensorflow,yongtang/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,sarvex/tensorflow,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,Intel... | tensorflow/python/autograph/core/config.py | tensorflow/python/autograph/core/config.py | # Copyright 2016 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 2016 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 |
1729e3c61f120f2c7163e3bb0b585c7ba4302006 | update custom json tags | apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl | apps/api/templatetags/extra_tags.py | apps/api/templatetags/extra_tags.py | from django import template
from django.core import serializers
from django.utils.safestring import mark_safe
from django.utils.html import escapejs
register = template.Library()
@register.filter(name='json', needs_autoescape=True)
def to_json(data, autoescape=True):
data = data.select_related('author__username... | from django import template
from django.core import serializers
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter(name='json', needs_autoescape=True)
def to_json(data, autoescape=True):
dump = serializers.serialize(
'json', data, fields=['title', 'slug', 'autho... | mit | Python |
96d266612d7220209864db3f323e2a351398a6d1 | Change deprecation update message and nest import | rakshit-agrawal/sonnet,rakshit-agrawal/sonnet,deepmind/sonnet,deepmind/sonnet | sonnet/python/ops/nest.py | sonnet/python/ops/nest.py | # Copyright 2017 The Sonnet 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 applicable l... | # Copyright 2017 The Sonnet 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 applicable l... | apache-2.0 | Python |
f593565470979acc794a5b65735003818246bf26 | Add getattr and statfs to support ls | matthiasvegh/fusepp,matthiasvegh/fusepp,matthiasvegh/fusepp | fusepp.py | fusepp.py | #!/usr/bin/env python
from __future__ import with_statement
import subprocess
import inspect
import os
import sys
import errno
import string
import shutil
import filecmp
import fuse
#from fuse import Fuse, FuseOSError
class Filesystem(fuse.Operations):
def __init__(self, root):
self.root = root
d... | #!/usr/bin/env python
from __future__ import with_statement
import subprocess
import inspect
import os
import sys
import errno
import string
import shutil
import filecmp
import fuse
#from fuse import Fuse, FuseOSError
class Filesystem(fuse.Operations):
def __init__(self, root):
self.root = root
d... | mit | Python |
66e67e53360a9f49ae73c8c8f2de49991525363b | Fix the order of parameters to hasAccess, which broke all topic changing when +t was set | Heufneutje/txircd,DesertBus/txircd,ElementalAlchemist/txircd | txircd/modules/cmode_t.py | txircd/modules/cmode_t.py | from twisted.words.protocols import irc
from txircd.modbase import Mode
class TopiclockMode(Mode):
def checkPermission(self, user, cmd, data):
if cmd != "TOPIC":
return data
if "topic" not in data:
return data
targetChannel = data["targetchan"]
if "t" in targetChannel.mode and not user.hasAccess(targetC... | from twisted.words.protocols import irc
from txircd.modbase import Mode
class TopiclockMode(Mode):
def checkPermission(self, user, cmd, data):
if cmd != "TOPIC":
return data
if "topic" not in data:
return data
targetChannel = data["targetchan"]
if "t" in targetChannel.mode and not user.hasAccess(self.ir... | bsd-3-clause | Python |
a01ccea5f88e8716a846d72941a5169d27f0fd0a | Update version to 5.5.2 | abusesa/abusehelper | abusehelper/__init__.py | abusehelper/__init__.py | __version__ = "5.5.2"
| __version__ = "5.5.1"
| mit | Python |
b9109c1baf230feb5c4e0486686ddc00cff2b78d | fix bug in call to corpus constructor | kmp3325/linguine-python,rigatoni/linguine-python,jmp3833/linguine-python,Pastafarians/linguine-python | linguine/transaction.py | linguine/transaction.py | import json
import linguine.operation_builder
from linguine.corpus import Corpus
from pymongo import MongoClient
from bson.objectid import ObjectId
from bson.errors import InvalidId
from linguine.database_adapter import DatabaseAdapter
from linguine.transaction_exception import TransactionException
class Transaction:
... | import json
import linguine.operation_builder
from linguine.corpus import Corpus
from pymongo import MongoClient
from bson.objectid import ObjectId
from bson.errors import InvalidId
from linguine.database_adapter import DatabaseAdapter
from linguine.transaction_exception import TransactionException
class Transaction:
... | mit | Python |
c97eaae1f705d3fc2bbb962ea980db98f6578bf3 | Update ipc_lista1.15.py | any1m1c/ipc20161 | lista1/ipc_lista1.15.py | lista1/ipc_lista1.15.py | #ipc_lista1.15
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
qHora = input("Quanto você ganha por hora: ")
hT = input("Quantas horas você trabalhou: ")
SalBruto = qHora
ir = (11/100.0 * salBruto)
inss = (8/100.0m* SalBruto)
sindicato =
| #ipc_lista1.15
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
qHora = input("Quanto você ganha por hora: ")
hT = input("Quantas horas você trabalhou: ")
SalBruto = qHora
ir = (11/100.0 * salBruto)
inss =
sindicato =
| apache-2.0 | Python |
0d110b3caca9901b09da401a93087220ad3a6923 | Fix docstring | liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,fhartwig/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,liqd... | src/adhocracy_core/adhocracy_core/sheets/document.py | src/adhocracy_core/adhocracy_core/sheets/document.py | """Sheets to store a document."""
import colander
from adhocracy_core.interfaces import ISheet
from adhocracy_core.interfaces import ISheetReferenceAutoUpdateMarker
from adhocracy_core.interfaces import SheetToSheet
from adhocracy_core.sheets import sheet_meta
from adhocracy_core.sheets import add_sheet_to_registry
fr... | """Sheets to store a document."""
import colander
from adhocracy_core.interfaces import ISheet
from adhocracy_core.interfaces import ISheetReferenceAutoUpdateMarker
from adhocracy_core.interfaces import SheetToSheet
from adhocracy_core.sheets import sheet_meta
from adhocracy_core.sheets import add_sheet_to_registry
fr... | agpl-3.0 | Python |
7d685ce769a57ad31e658ca259d39e441bd28c93 | add more details to config.h | depp/sglib,depp/sglib | script/d3build/generatedsource/configheader.py | script/d3build/generatedsource/configheader.py | # Copyright 2013-2014 Dietrich Epp.
# This file is part of SGLib. SGLib is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
from . import GeneratedSource, NOTICE
def macro(x):
return x.replace('-', '_').upper()
class ConfigHeader(GeneratedSource):
__slots__ = ['... | # Copyright 2013-2014 Dietrich Epp.
# This file is part of SGLib. SGLib is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
from . import GeneratedSource, NOTICE
def macro(x):
return x.replace('-', '_').upper()
class ConfigHeader(GeneratedSource):
__slots__ = ['... | bsd-2-clause | Python |
16223272f188ae6b17b6da28d074dd2f8408f7f8 | bump version | Andertaker/django-vkontakte-users | vkontakte_users/__init__.py | vkontakte_users/__init__.py | VERSION = (0, 3, 4)
__version__ = '.'.join(map(str, VERSION))
| VERSION = (0, 3, 3)
__version__ = '.'.join(map(str, VERSION))
| bsd-3-clause | Python |
7872c4a103f6a002da1c5156f7df3c38f88baabd | remove wsgi service | vmthunder/virtman | vmthunder/cmd/vmthunderd.py | vmthunder/cmd/vmthunderd.py | #!/usr/bin/env python
import sys
import threading
import time
from oslo.config import cfg
from vmthunder import compute
from vmthunder.openstack.common import log as logging
#TODO: Auto determine host ip if not filled in conf file
host_opts = [
cfg.StrOpt('host_ip',
default='10.107.... | #!/usr/bin/env python
import sys
import threading
import time
from oslo.config import cfg
from vmthunder import compute
from vmthunder.openstack.common import log as logging
#TODO: Auto determine host ip if not filled in conf file
host_opts = [
cfg.StrOpt('host_ip',
default='10.107.... | apache-2.0 | Python |
ed0aee230ee9d8be986eead289aac97bc6577de1 | add subscriber email to Blast form | texastribune/salesforce-stripe,texastribune/salesforce-stripe,MinnPost/salesforce-stripe,texastribune/salesforce-stripe,MinnPost/salesforce-stripe,MinnPost/salesforce-stripe | forms.py | forms.py | from flask_wtf import Form
from wtforms.fields import StringField, HiddenField, BooleanField, DecimalField
from wtforms.fields import RadioField, SelectField
from wtforms import validators
from wtforms.fields.html5 import EmailField
class BaseForm(Form):
first_name = StringField(u'First',
[validators.req... | from flask_wtf import Form
from wtforms.fields import StringField, HiddenField, BooleanField, DecimalField
from wtforms.fields import RadioField, SelectField
from wtforms import validators
class BaseForm(Form):
first_name = StringField(u'First',
[validators.required(message="Your first name is required."... | mit | Python |
1c564863438e722196b49df361be43622a6bb0b8 | Fix robots.txt content-type. | fi-ksi/web-backend,fi-ksi/web-backend | endpoint/robots.py | endpoint/robots.py | import falcon
class Robots(object):
def on_get(self, req, resp):
resp.content_type = 'text/plain'
resp.body = "User-agent: *\nDisallow: /"
| import falcon
class Robots(object):
def on_get(self, req, resp):
resp.body = "User-agent: *\nDisallow: /"
| mit | Python |
61e8b679c64c7c2155c1c3f5077cf058dd6610d3 | Remove all relative imports. We have always been at war with relative imports. | luyikei/django-localflavor-jp | forms.py | forms.py | """
JP-specific Form helpers
"""
from __future__ import absolute_import
from django.contrib.localflavor.jp.jp_prefectures import JP_PREFECTURES
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
class JPPostalCodeField(RegexField):
"""
A form field tha... | """
JP-specific Form helpers
"""
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import RegexField, Select
class JPPostalCodeField(RegexField):
"""
A form field that validates its input is a Japanese postcode.
Accepts 7 digits, with or without a hyphen.
"""
defaul... | bsd-3-clause | Python |
50828810da3fdafbc067ba5f344a18934165a767 | Correct parameter documentation in validate function | Ghostkeeper/Luna | plugins/data/datatype/__init__.py | plugins/data/datatype/__init__.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | cc0-1.0 | Python |
8164d048b47299377b4db7d9fc0198e24b07bdb3 | Fix move to return only int, draw functions cannot handle floats as coordinates | PGHM/spacebattle | engine/geometry.py | engine/geometry.py | from math import cos, sin, pi, hypot
def rotate(polygon, angle):
rotated_points = []
cos_result = cos(angle)
sin_result = sin(angle)
for point in polygon:
x = point[0] * cos_result - point[1] * sin_result
y = point[0] * sin_result + point[1] * cos_result
rotated_points.append((x... | from math import cos, sin, pi, hypot
def rotate(polygon, angle):
rotated_points = []
cos_result = cos(angle)
sin_result = sin(angle)
for point in polygon:
x = point[0] * cos_result - point[1] * sin_result
y = point[0] * sin_result + point[1] * cos_result
rotated_points.append((x... | apache-2.0 | Python |
e292705df44ba511a0650e5b4d70ab5f2404e412 | Document PR command line syntax | jwodder/ghutil | ghutil/cli/pr/__init__.py | ghutil/cli/pr/__init__.py | import click
from ghutil.util import default_command, package_group
@package_group(__package__, __file__, invoke_without_command=True)
@click.pass_context
def cli(ctx):
"""
Manage pull requests
GitHub pull requests may be specified on the command line using any of the
following formats:
\b
... | import click
from ghutil.util import default_command, package_group
@package_group(__package__, __file__, invoke_without_command=True)
@click.pass_context
def cli(ctx):
""" Manage pull requests """
default_command(ctx, 'list')
| mit | Python |
1badeb47db86a9325f84935dfbd75e30fb44d460 | Change incorrect variable name | git-harry/rpc-openstack,darrenchan/rpc-openstack,darrenchan/rpc-openstack,briancurtin/rpc-maas,hughsaunders/rpc-openstack,jacobwagner/rpc-openstack,shannonmitchell/rpc-openstack,shannonmitchell/rpc-openstack,xeregin/rpc-openstack,nrb/rpc-openstack,cloudnull/rpc-openstack,mattt416/rpc-openstack,jpmontez/rpc-openstack,xe... | glance_api_local_check.py | glance_api_local_check.py | #!/usr/bin/env python
from maas_common import (status_ok, status_err, metric, get_keystone_client,
get_auth_ref)
from requests import Session
from requests import exceptions as exc
def check(auth_ref):
keystone = get_keystone_client(auth_ref)
tenant_id = keystone.tenant_id
auth_t... | #!/usr/bin/env python
from maas_common import (status_ok, status_err, metric, get_keystone_client,
get_auth_ref)
from requests import Session
from requests import exceptions as exc
def check(auth_ref):
keystone = get_keystone_client(auth_ref)
tenant_id = keystone.tenant_id
auth_t... | apache-2.0 | Python |
8c593d2a24fc52e2404f2de69cdb9965ca9835b8 | Add redactor block in test settings file | blancltd/django-glitter,blancltd/django-glitter,developersociety/django-glitter,developersociety/django-glitter,blancltd/django-glitter,developersociety/django-glitter | glitter/tests/settings.py | glitter/tests/settings.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.utils.crypto import get_random_string
BASE_DIR = os.path.dirname(__file__)
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test',
}
}
CACHES = {
'default': ... | # -*- coding: utf-8 -*-
import os
from django.utils.crypto import get_random_string
BASE_DIR = os.path.dirname(__file__)
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test',
}
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.... | bsd-3-clause | Python |
19defb8a7293591adf9ac4f83e21a6eb4e2b6fda | add example for JSON-RPC 1.0 request | lorehov/json-rpc,clach04/json-rpc | examples/client.py | examples/client.py | import requests
import json
def main():
url = "http://localhost:4000/jsonrpc"
headers = {'content-type': 'application/json'}
# Example echo method
payload = {
"method": "echo",
"params": ["echome!"],
"jsonrpc": "2.0",
"id": 0,
}
response = requests.post(
... | import requests
import json
def main():
url = "http://localhost:4000/jsonrpc"
headers = {'content-type': 'application/json'}
# Example echo method
payload = {
"method": "echo",
"params": ["echome!"],
"jsonrpc": "2.0",
"id": 0,
}
response = requests.post(
... | mit | Python |
4007ea9c763645253eff86a788a7b058245b9d02 | change to snap git out of madness | marcysweber/lifetime-repro-success | group.py | group.py | from agent import FemaleState
class SavannahGroup:
def __init__(self, index):
self.index = index
self.dominance_hierarchy = []
self.agents = []
self.excess_females = 0
self.sorted_by_rhp = []
def do_nothing(self):
pass
def get_excess_females(self, pop):
... | from agent import FemaleState
class SavannahGroup:
def __init__(self, index):
self.index = index
self.dominance_hierarchy = []
self.agents = []
self.excess_females = 0
self.sorted_by_rhp = []
def get_excess_females(self, pop):
males = 0
cyc_females = 0
... | mit | Python |
b7cb587ab2cac46db3ffcda54e25d3c6e63edcfe | Update marty.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/moz4r/Marty/marty.py | home/moz4r/Marty/marty.py | #MARTY I2C PI
#SCRIPT BASED ON MATS WORK
from time import sleep
raspi = Runtime.createAndStart("RasPi","RasPi")
adaFruit16c = Runtime.createAndStart("AdaFruit16C","Adafruit16CServoDriver")
adaFruit16c.setController("RasPi","1","0x40")
#
# This part is common for both devices and creates two servo instances
# on port 3 ... | #MARTY I2C PI SERVO TEST
#SCRIPT BASED ON MATS WORK
from time import sleep
raspi = Runtime.createAndStart("RasPi","RasPi")
adaFruit16c = Runtime.createAndStart("AdaFruit16C","Adafruit16CServoDriver")
adaFruit16c.setController("RasPi","1","0x40")
#
# This part is common for both devices and creates two servo instances
#... | apache-2.0 | Python |
bf002c85ae444954c3237fa4b056fbf9111448a1 | Fix change in Python 3.8 | rsalmaso/huey,pombredanne/huey,coleifer/huey | huey/bin/huey_consumer.py | huey/bin/huey_consumer.py | #!/usr/bin/env python
import logging
import os
import sys
from huey.consumer import Consumer
from huey.consumer_options import ConsumerConfig
from huey.consumer_options import OptionParserHandler
from huey.utils import load_class
def err(s):
sys.stderr.write('\033[91m%s\033[0m\n' % s)
def load_huey(path):
... | #!/usr/bin/env python
import logging
import os
import sys
from huey.consumer import Consumer
from huey.consumer_options import ConsumerConfig
from huey.consumer_options import OptionParserHandler
from huey.utils import load_class
def err(s):
sys.stderr.write('\033[91m%s\033[0m\n' % s)
def load_huey(path):
... | mit | Python |
acd96e59de2c8cc97823e9446e27d5ddd3c65224 | correct output of unicode characters in index | dani-l/recipe-markdown,andreasWallner/recipe-markdown,andreasWallner/recipe-markdown,dani-l/recipe-markdown | index.py | index.py | import os
import utils
from lxml import etree
def append_recipes(body, path, f):
""" insert recipe information into a page
can not handle files that are not in the webroot by itself
this has to be done on the index page (via pointing the
browser at another basedir)
Arguments:
body -- etree.El... | import os
import utils
from lxml import etree
def append_recipes(body, path, f):
""" insert recipe information into a page
can not handle files that are not in the webroot by itself
this has to be done on the index page (via pointing the
browser at another basedir)
Arguments:
body -- etree.El... | mit | Python |
8316e1f02e67cd2c94f002c631cfcd70d490cd13 | Remove send email functionality | pkakelas/eagle | index.py | index.py | from __future__ import division
import urllib.request as request, json, os.path
import json, time
if os.path.exists('config/config.json'):
config_file = open('config/config.json')
config = json.load(config_file)
else:
print('Please copy the config.json file to config-local.json and fill in the file.')
... | from __future__ import division
import urllib.request as request, json, os.path
import json, time
if os.path.exists('config/config.json'):
config_file = open('config/config.json')
config = json.load(config_file)
else:
print('Please copy the config.json file to config-local.json and fill in the file.')
... | mit | Python |
f7a18ceb64fa2548017ad8fcfcfb3080733563a8 | rewrite comments | kaijianZ/Alvitr | login.py | login.py | import requests
import re
def login():
session = requests.session()
url = 'https://accounts.pixiv.net/login'
# get a post_key for login
# check ref [2] for details
login_page = session.get(url)
pattern = re.compile('name="post_key" value="(.*?)">')
result = pattern.findall(login_page.text... | import requests
import re
def login():
session = requests.session()
url = 'https://accounts.pixiv.net/login'
# to get a post_key for login
# check ref [2] for details
login_page = session.get(url)
pattern = re.compile('name="post_key" value="(.*?)">')
result = pattern.findall(login_page.t... | mit | Python |
a381e1a8aab9df37c3136ce14a3ccb0fe99e3ea3 | update dev version after 0.27.0 tag [skip ci] | desihub/desisim,desihub/desisim | py/desisim/_version.py | py/desisim/_version.py | __version__ = '0.27.0.dev1392'
| __version__ = '0.27.0'
| bsd-3-clause | Python |
ee82cbf396ab5388e2a4ad8aedb221eb4e604d7b | Remove useless subclassing/super() calls | dpursehouse/pygerrit2 | pygerrit2/rest/auth.py | pygerrit2/rest/auth.py | # The MIT License
#
# Copyright 2013 Sony Mobile Communications. All rights reserved.
#
# 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 r... | # The MIT License
#
# Copyright 2013 Sony Mobile Communications. All rights reserved.
#
# 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 r... | mit | Python |
9a287b956c2b35dd42130e7f9ee6c3884964314e | make init_h5 a private func | ulmo-dev/ulmo-common | pyhis/ncdc/pytables.py | pyhis/ncdc/pytables.py | import os
import tempfile
import tables
# default hdf5 file path
HDF5_FILE_PATH = os.path.join(tempfile.gettempdir(), "pyhis.h5")
class NCDCValue(tables.IsDescription):
date = tables.StringCol(8)
flag = tables.StringCol(1)
value = tables.StringCol(20)
last_modified = tables.StringCol(26)
def get_... | import os
import tempfile
import tables
# default hdf5 file path
HDF5_FILE_PATH = os.path.join(tempfile.gettempdir(), "pyhis.h5")
class NCDCValue(tables.IsDescription):
date = tables.StringCol(8)
flag = tables.StringCol(1)
value = tables.StringCol(20)
last_modified = tables.StringCol(26)
def init... | bsd-3-clause | Python |
a45042c504fcb1b11741fb9ce786c5afb94219a7 | Add a new test for roundtripping in the opposite direction. | jwg4/qual,jwg4/calexicon | qual/tests/test_iso.py | qual/tests/test_iso.py | import unittest
from hypothesis import given
from hypothesis.strategies import integers
from hypothesis.extra.datetime import datetimes
import qual
from datetime import date, MINYEAR, MAXYEAR
class TestIsoUtils(unittest.TestCase):
@given(datetimes(timezones=[]))
def test_round_trip_date(self, dt):
d ... | import unittest
from hypothesis import given
from hypothesis.extra.datetime import datetimes
import qual
from datetime import date
class TestIsoUtils(unittest.TestCase):
@given(datetimes(timezones=[]))
def test_round_trip_date(self, dt):
d = dt.date()
self.assertEqual(qual.iso_to_gregorian(*d... | apache-2.0 | Python |
03b352cbcd857dc748f05e2ea3ce592ee22b180c | Declare the DMARC RUA/RUF configuration items | kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io | admin/mailu/__init__.py | admin/mailu/__init__.py | import flask
import flask_sqlalchemy
import flask_bootstrap
import flask_login
import flask_script
import flask_migrate
import flask_babel
import os
import docker
from apscheduler.schedulers import background
# Create application
app = flask.Flask(__name__, static_url_path='/admin/app_static')
default_config = {
... | import flask
import flask_sqlalchemy
import flask_bootstrap
import flask_login
import flask_script
import flask_migrate
import flask_babel
import os
import docker
from apscheduler.schedulers import background
# Create application
app = flask.Flask(__name__, static_url_path='/admin/app_static')
default_config = {
... | mit | Python |
8514b8e5912c474d4f7cb14b666e7e2e8c64b1fd | Set DJANGO_SETTINGS_MODULE. | devilry/devilry-django,vegarang/devilry-django,devilry/devilry-django,devilry/devilry-django,vegarang/devilry-django,devilry/devilry-django | devenv/bin/devilryadminwrapper.py | devenv/bin/devilryadminwrapper.py | #!/usr/bin/env python
import os
import django_dev
import sys
from devilry.devilryadmin.devilryadmin import cli
# Add the PYTHONPATH set in devmanage to PYTHONPATH so that devilryadmin sub processes have correct path.
os.environ['PYTHONPATH'] = ':'.join(sys.path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'devilry.projec... | #!/usr/bin/env python
import os
import django_dev
import sys
from devilry.devilryadmin.devilryadmin import cli
# Add the PYTHONPATH set in devmanage to PYTHONPATH so that devilryadmin sub processes have correct path.
os.environ['PYTHONPATH'] = ':'.join(sys.path)
# Run devilryadmin
cli()
| bsd-3-clause | Python |
3fda3c05df8e92044e8249ab2cf04eb7563034fa | include votes | tomviner/lunchbox,tomviner/lunchbox | lunchbox/core/models.py | lunchbox/core/models.py | from django.db import models
class Restaurant(models.Model):
pass
class Vote (models.Model):
date = models.DateField(auto_now_add=True)
people = models.ManyToManyField(Person)
| from django.db import models
| agpl-3.0 | Python |
84d0944dda056933873586e2c5e253bd1a853000 | use JsonRpcClient config methods instead of directly touching Requests | grawity/rwho,grawity/rwho,grawity/rwho,grawity/rwho,grawity/rwho | agent/lib/api_client.py | agent/lib/api_client.py | import json
import requests
import socket
import sys
from .exceptions import *
from .json_rpc import JsonRpcClient, RemoteFault
from .log_util import *
class RwhoClient():
def __init__(self, url, host_name=None):
self.rpc = JsonRpcClient(url)
self.host_name = host_name
def set_auth_basic(self... | import json
import requests
import socket
import sys
from .exceptions import *
from .json_rpc import JsonRpcClient, RemoteFault
from .log_util import *
class RwhoClient():
def __init__(self, url, host_name=None):
self.rpc = JsonRpcClient(url)
self.host_name = host_name
def set_auth_basic(self... | mit | Python |
9749cdaaebacd7316b581c5d368a5082fb6d3789 | Add empty time tests (for ui testing) | martinsmid/pytest-ui | test_projects/test_module_b/test_feat_4.py | test_projects/test_module_b/test_feat_4.py | import time
import unittest
class TestG(unittest.TestCase):
def test_feat_1_case_1(self):
pass
def test_feat_1_case_2(self):
pass
def test_feat_1_case_3(self):
pass
def test_feat_1_case_4(self):
pass
class TestH(unittest.TestCase):
def test_feat_1_case_1(self):... | import unittest
class TestG(unittest.TestCase):
def test_feat_1_case_1(self):
pass
def test_feat_1_case_2(self):
pass
def test_feat_1_case_3(self):
pass
def test_feat_1_case_4(self):
pass
class TestH(unittest.TestCase):
def test_feat_1_case_1(self):
pas... | mit | Python |
7b65bcac8a966933a4ae19a4a148b33f036ac872 | add checks.d to packaging | guruxu/dd-agent,c960657/dd-agent,manolama/dd-agent,pfmooney/dd-agent,amalakar/dd-agent,mderomph-coolblue/dd-agent,AntoCard/powerdns-recursor_check,guruxu/dd-agent,c960657/dd-agent,GabrielNicolasAvellaneda/dd-agent,benmccann/dd-agent,a20012251/dd-agent,joelvanvelden/dd-agent,brettlangdon/dd-agent,Wattpad/dd-agent,a20012... | packaging/datadog-agent-lib/setup.py | packaging/datadog-agent-lib/setup.py | #!/usr/bin/env python
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
import os, sys
from distutils.command.install import INSTALL_SCHEMES
def getVersion():
try:
from con... | #!/usr/bin/env python
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
import os, sys
from distutils.command.install import INSTALL_SCHEMES
def getVersion():
try:
from con... | bsd-3-clause | Python |
dca90659ea78fb337189d91b8b46fa323c3c186e | Improve Fish version check; don't exit on failure | adambrenecki/virtualfish,adambrenecki/virtualfish | virtualfish/loader/cli.py | virtualfish/loader/cli.py | from sys import argv
import logging
import psutil
from virtualfish.loader import installer
logger = logging.getLogger(__name__)
minimum_fish_version = "3.3.0"
class vcolors:
NORMAL = "\033[0m"
RED = "\033[31m"
def install():
if "--help" in argv or "-h" in argv:
print("Usage: vf install [<plug... | from sys import argv
import psutil
from virtualfish.loader import installer
minimum_fish_version = "3.1"
def install():
if "--help" in argv or "-h" in argv:
print("Usage: vf install [<plugin> ...]")
exit()
installer.install(argv[2:])
def check_fish_version():
"""Exit and notify if min... | mit | Python |
99d89dfb3385db96f1f68088a1ac65e7b3a3eac2 | add excluded fields for aldryn-translator | aldryn/aldryn-button,aldryn/aldryn-button | aldryn_button/models.py | aldryn_button/models.py | # -*- coding: utf-8 -*-
import re
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models.fields import PageField
from cms.models.pluginmodel import CMSPlugin
class ButtonPlugin(CMSPlugin):
translatable_content_excluded_fields = ['url', 'page_link', 'target', 'mailto... | # -*- coding: utf-8 -*-
import re
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models.fields import PageField
from cms.models.pluginmodel import CMSPlugin
class ButtonPlugin(CMSPlugin):
name = models.CharField(_('Name'), max_length=256)
url = models.URLField(... | bsd-3-clause | Python |
bef32551bfa35681248fc812c10d359ca55c11f7 | Use real scheme and host when asking github to redirect | markpasc/makerbase,markpasc/makerbase | makerbase/views/auth.py | makerbase/views/auth.py | import json
from urllib import urlencode
from urlparse import parse_qs, urlsplit, urlunsplit
from flask import redirect, request, url_for
from flaskext.login import LoginManager, login_user
import requests
from makerbase import app
from makerbase.models import User
login_manager = LoginManager()
login_manager.setup... | import json
from urllib import urlencode
from urlparse import parse_qs, urlunsplit
from flask import redirect, request, url_for
from flaskext.login import LoginManager, login_user
import requests
from makerbase import app
from makerbase.models import User
login_manager = LoginManager()
login_manager.setup_app(app, ... | mit | Python |
6603657df4626a9e2c82a3658c63314c7a9537f4 | Add write dump to file | paulkramme/btsoot | src/experimental/os_walk_with_filechecker.py | src/experimental/os_walk_with_filechecker.py | #!/usr/bin/python3
# THIS FILE IS AN EXPERIMENTAL PROGRAM TO LEARN ABOUT OS_WALK
import os, sys, datetime
#dt = datetime.datetime(1970,1,1).total_seconds()
# print(dt)
walk_dir = sys.argv[1]
with open("fsscan.scan", "w") as f:
print("SCANFROM" + walk_dir)
for root, subdirs, files in os.walk(walk_dir):
f.write... | #!/usr/bin/python3
# THIS FILE IS AN EXPERIMENTAL PROGRAM TO LEARN ABOUT OS_WALK
import os, sys
walk_dir = sys.argv[1]
print("walk directory: " + walk_dir)
print("Walk directory (absolute) = " + os.path.abspath(walk_dir))
print("\n\n\n\n\n\n\n\n\n")
for root, subdirs, files in os.walk(walk_dir):
print(root)
#lis... | bsd-3-clause | Python |
0e85529d37e9c2ad6e6389a8ab3c70eee3d3003c | Use partial for readability | eugene-eeo/exthread | exthread/mq.py | exthread/mq.py | from functools import partial
from contextlib import contextmanager
from collections import deque
from .core import ExThread
class MQThread(ExThread):
def __init__(self, target, *args, **kwargs):
ExThread.__init__(self,
partial(target, self),
*args,
... | from contextlib import contextmanager
from collections import deque
from .core import ExThread
class MQThread(ExThread):
def __init__(self, target, *args, **kwargs):
ExThread.__init__(self,
lambda *a, **k: target(self, *a, **k),
*args,
... | mit | Python |
8232f33f631cd5b75fc12e0d3e0f3e93668cd024 | Fix broken imports in monitoringlist ingredient. | bartscheers/tkp,transientskp/tkp,mkuiack/tkp,mkuiack/tkp,transientskp/tkp,bartscheers/tkp | trap/ingredients/monitoringlist.py | trap/ingredients/monitoringlist.py | import os
import logging
from contextlib import closing
from lofarpipe.support.lofarexceptions import PipelineException
from lofar.parameterset import parameterset
from tkp.database import DataBase, DataSet
import tkp.utility.accessors as accessors
from tkp.database.orm import Image
logger = logging.getLogger(__name_... | import os
import logging
from contextlib import closing
from lofarpipe.support.lofarexceptions import PipelineException
from lofar.parameterset import parameterset
from tkp.database import DataBase, DataSet
import tkp.utility.accessors
from tkp.database.orm import Image
logger = logging.getLogger(__name__)
BOX_IN_BE... | bsd-2-clause | Python |
c78c1090abc9e2e36b50ee8141244616df0f97b3 | Fix help description. Add vehicle.close to the example | dronekit/dronekit-python,hamishwillee/dronekit-python,diydrones/dronekit-python,hamishwillee/dronekit-python,dronekit/dronekit-python,diydrones/dronekit-python | examples/channel_overrides/channel_overrides.py | examples/channel_overrides/channel_overrides.py | """
channel_overrides.py:
Demonstrates how set and clear channel-override information.
# NOTE:
Channel overrides (a.k.a "RC overrides") are highly discommended (they are primarily implemented
for simulating user input and when implementing certain types of joystick control).
They are provided for development purp... | """
channel_overrides.py:
Demonstrates how set and clear channel-override information.
# NOTE:
Channel overrides (a.k.a "RC overrides") are highly discommended (they are primarily implemented
for simulating user input and when implementing certain types of joystick control).
They are provided for development purp... | apache-2.0 | Python |
d8ed0de9c746f27338e3df7a30d623e0a1cc84fc | Add prototype assignment function. | LeeBergstrand/pygenprop | modules/genome_properties_results.py | modules/genome_properties_results.py | #!/usr/bin/env python
"""
Created by: Lee Bergstrand (2018)
Description: The genome property tree class.
"""
import json
import pandas as pd
from modules.genome_properties_tree import GenomePropertiesTree
class GenomePropertiesResults(object):
"""
This class contains a representation of a table of result... | #!/usr/bin/env python
"""
Created by: Lee Bergstrand (2018)
Description: The genome property tree class.
"""
from modules.genome_properties_tree import GenomePropertiesTree
import pandas as pd
import json
class GenomePropertiesResults(object):
"""
This class contains a representation of a table of results ... | apache-2.0 | Python |
a76ec622c06b449abd9af624801472b0de101e56 | Use '/' when forming resource path for Python tests. | nickerso/libcellml,hsorby/libcellml,cellml/libcellml,cellml/libcellml,nickerso/libcellml,hsorby/libcellml,nickerso/libcellml,cellml/libcellml,hsorby/libcellml,nickerso/libcellml,cellml/libcellml,hsorby/libcellml | tests/bindings/python/test_resources.in.py | tests/bindings/python/test_resources.in.py |
import os
TESTS_RESOURCE_LOCATION = "${TESTS_RESOURCE_LOCATION}"
def resource_path(relative_path=''):
return TESTS_RESOURCE_LOCATION + '/' + relative_path
def file_contents(file_name):
with open(os.path.join(TESTS_RESOURCE_LOCATION, file_name)) as f:
content = f.read()
return content
|
import os
TESTS_RESOURCE_LOCATION = "${TESTS_RESOURCE_LOCATION}"
def resource_path(relative_path=''):
return os.path.join(TESTS_RESOURCE_LOCATION, relative_path)
def file_contents(file_name):
with open(os.path.join(TESTS_RESOURCE_LOCATION, file_name)) as f:
content = f.read()
return content... | apache-2.0 | Python |
fbb5addbb6b61a127066fd443d70f1cfe94f7c03 | Put ValidationError on top-level namespace | 0xDCA/marshmallow,dwieeb/marshmallow,bartaelterman/marshmallow,maximkulkin/marshmallow,Tim-Erwin/marshmallow,mwstobo/marshmallow,VladimirPal/marshmallow,daniloakamine/marshmallow,xLegoz/marshmallow,marshmallow-code/marshmallow,0xDCA/marshmallow,etataurov/marshmallow,quxiaolong1504/marshmallow,Bachmann1234/marshmallow | marshmallow/__init__.py | marshmallow/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
__version__ = '1.0.0-dev'
__author__ = 'Steven Loria'
__license__ = 'MIT'
from marshmallow.schema import (
Schema,
SchemaOpts,
MarshalResult,
UnmarshalResult,
Serializer,
)
from marshmallow.utils import pprint
from marshmallow.exceptio... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
__version__ = '1.0.0-dev'
__author__ = 'Steven Loria'
__license__ = 'MIT'
from marshmallow.schema import (
Schema,
SchemaOpts,
MarshalResult,
UnmarshalResult,
Serializer,
)
from marshmallow.utils import pprint
from marshmallow.exceptio... | mit | Python |
a3691aea77a07b39ef8303249aa7c5a8fd61d4a4 | increment minor version. | tsuyukimakoto/biisan,tsuyukimakoto/biisan | biisan/__init__.py | biisan/__init__.py | import os
version_info = (0, 2, 0)
__version__ = ".".join([str(v) for v in version_info])
os.environ['GLUE_PLATE_BASE_MODULE'] = 'biisan.biisan_settings'
| import os
version_info = (0, 1, 0)
__version__ = ".".join([str(v) for v in version_info])
os.environ['GLUE_PLATE_BASE_MODULE'] = 'biisan.biisan_settings'
| mit | Python |
30a8d845e62de121d98e20ba54dd2349a891b82b | Add quoted_value test | davesque/html.py,davesque/html.py | parse_html/tests/test_parsers.py | parse_html/tests/test_parsers.py | from __future__ import unicode_literals
import unittest
from parsing.exceptions import ParseError
from ..parsers import (
simple_value,
double_quoted_value,
single_quoted_value,
quoted_value,
)
class BaseTestCases(object):
class TestParser(unittest.TestCase):
PARSER = None
VALUES... | from __future__ import unicode_literals
import unittest
from parsing.exceptions import ParseError
from ..parsers import (
simple_value,
double_quoted_value,
single_quoted_value,
)
class BaseTestCases(object):
class TestParser(unittest.TestCase):
PARSER = None
VALUES = {}
def... | mit | Python |
c55dbf067d85c3a060a6ffeff2aad24991e95eae | Remove duplicate Series sort_index check | pratapvardhan/pandas,rs2/pandas,winklerand/pandas,jorisvandenbossche/pandas,zfrenchee/pandas,winklerand/pandas,TomAugspurger/pandas,pandas-dev/pandas,harisbal/pandas,jmmease/pandas,pratapvardhan/pandas,TomAugspurger/pandas,DGrady/pandas,jorisvandenbossche/pandas,cython-testbed/pandas,zfrenchee/pandas,nmartensen/pandas,... | pandas/tests/series/test_validate.py | pandas/tests/series/test_validate.py | import pytest
from pandas.core.series import Series
class TestSeriesValidate(object):
"""Tests for error handling related to data types of method arguments."""
s = Series([1, 2, 3, 4, 5])
def test_validate_bool_args(self):
# Tests for error handling related to boolean arguments.
invalid_v... | import pytest
from pandas.core.series import Series
class TestSeriesValidate(object):
"""Tests for error handling related to data types of method arguments."""
s = Series([1, 2, 3, 4, 5])
def test_validate_bool_args(self):
# Tests for error handling related to boolean arguments.
invalid_v... | bsd-3-clause | Python |
1595f01c8f1136d7e2e05457a420fec3271e5b4e | Make arguments explicit | ShrimpingIt/medea,ShrimpingIt/medea | examples/scripts/twitterTimelineTokenizeLive.py | examples/scripts/twitterTimelineTokenizeLive.py | from medea.util import visit
from medea.https import createContentByteGeneratorFactory
from medea.twitter import twitterHeaders, createTwitterTimelineUrl
def visitor(tok, val):
print(tok, val)
def run():
twitterUrl = createTwitterTimelineUrl('realDonaldTrump', count=1)
byteGeneratorFactory = createConte... | from medea.util import visit
from medea.https import createContentByteGeneratorFactory
from medea.twitter import twitterHeaders, createTwitterTimelineUrl
def visitor(*a):
print(a)
def run():
twitterUrl = createTwitterTimelineUrl('realDonaldTrump', count=1)
byteGeneratorFactory = createContentByteGenerat... | agpl-3.0 | Python |
8cf62d0cf104c7150e0c384b31f8954b18f8715d | Revert "Handle leading quote mark in import_dmd_snomed" | ebmdatalab/openprescribing,ebmdatalab/openprescribing,ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc | openprescribing/dmd/management/commands/import_dmd_snomed.py | openprescribing/dmd/management/commands/import_dmd_snomed.py | import logging
import os
from openpyxl import load_workbook
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import connection, transaction
from dmd.models import DMDProduct
from gcutils.bigquery import Client
class Command(BaseCommand):
help = ('Parse BNF->dm+... | import logging
import os
from openpyxl import load_workbook
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import connection, transaction
from dmd.models import DMDProduct
from gcutils.bigquery import Client
class Command(BaseCommand):
help = ('Parse BNF->dm+... | mit | Python |
36c7f795b49af1bb7198dabcccce41c3e197c5fb | fix configuration: Message.<init>(Handler) | plum-umd/pasket,plum-umd/pasket,plum-umd/pasket,plum-umd/pasket,plum-umd/pasket | pasket/rewrite/android/__init__.py | pasket/rewrite/android/__init__.py | import lib.const as C
# special cases for the accessor pattern
acc_default = [
"getHandler",
C.ADR.ACTT, # Handler, Activity
C.ADR.LOOP # MessageQueue
]
# configuration for the accessor pattern
acc_conf_uni = {
"Message": (1, 1, 1), # (get|set)Target
"Handler": (1, 1, 0), # getLooper
"Intent": (1, 1, 0)... | import lib.const as C
# special cases for the accessor pattern
acc_default = [
"getHandler",
C.ADR.ACTT, # Handler, Activity
C.ADR.LOOP # MessageQueue
]
# configuration for the accessor pattern
acc_conf_uni = {
"Message": (0, 1, 1), # (get|set)Target
"Handler": (1, 1, 0), # getLooper
"Intent": (1, 1, 0)... | mit | Python |
3acd7d885e6c660c3acb0b584b7ed07c8a1a4df3 | Support SNI in the example client | python-hyper/h11,njsmith/h11 | docs/source/_examples/myclient.py | docs/source/_examples/myclient.py | import socket, ssl
import h11
class MyHttpClient:
def __init__(self, host, port):
self.sock = socket.create_connection((host, port))
if port == 443:
ctx = ssl.create_default_context()
self.sock = ctx.wrap_socket(self.sock, server_hostname=host)
self.conn = h11.Connec... | import socket, ssl
import h11
class MyHttpClient:
def __init__(self, host, port):
self.sock = socket.create_connection((host, port))
if port == 443:
self.sock = ssl.wrap_socket(self.sock)
self.conn = h11.Connection(our_role=h11.CLIENT)
def send(self, *events):
for e... | mit | Python |
fcb3f124756b92c3901f2e0fe0444d6fc8ff7b1a | Tweak text-analysis admin | rhymeswithcycle/openparliament,litui/openparliament,litui/openparliament,rhymeswithcycle/openparliament,rhymeswithcycle/openparliament,litui/openparliament | parliament/text_analysis/admin.py | parliament/text_analysis/admin.py | from django.contrib import admin
from parliament.text_analysis.models import TextAnalysis
class TextAnalysisOptions(admin.ModelAdmin):
search_fields = ('key',)
list_display = ['key', 'lang', 'updated']
admin.site.register(TextAnalysis, TextAnalysisOptions) | from django.contrib import admin
from parliament.text_analysis.models import TextAnalysis
admin.site.register(TextAnalysis) | agpl-3.0 | Python |
255a14dfbf4b7bd5534a2319a336dbdbf221d18f | Fix typo | fedora-infra/python-fedora | fedora/__init__.py | fedora/__init__.py | # Copyright 2008 Red Hat, Inc.
# This file is part of python-fedora
#
# python-fedora is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later ... | # Copyright 2008 Red Hat, Inc.
# This file is part of python-fedora
#
# python-fedora is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later ... | lgpl-2.1 | Python |
af53d0100c229108f32aaac4fe68a51f7dc6f977 | Update scale.py | zsdonghao/tensorlayer,zsdonghao/tensorlayer | tensorlayer/layers/scale.py | tensorlayer/layers/scale.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
import tensorflow as tf
from tensorlayer import logging
from tensorlayer.initializers import constant
from tensorlayer.layers.core import Layer
__all__ = [
'Scale',
]
class Scale(Layer):
"""The :class:`Scale` class is to multiple a trainable scale value to the laye... | #! /usr/bin/python
# -*- coding: utf-8 -*-
import tensorflow as tf
from tensorlayer import logging
from tensorlayer.initializers import constant
from tensorlayer.layers.core import Layer
__all__ = [
'Scale',
]
class Scale(Layer):
"""The :class:`Scale` class is to multiple a trainable scale value to the laye... | apache-2.0 | Python |
ddd5203195376a5cfdd675f0281b5766cc4e827d | Fix the two Twisted trial errors under win32. | ipython/ipython,ipython/ipython | IPython/kernel/core/tests/test_redirectors.py | IPython/kernel/core/tests/test_redirectors.py | # encoding: utf-8
"""
Test the output capture at the OS level, using file descriptors.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2009 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is
# in the file COPY... | # encoding: utf-8
"""
Test the output capture at the OS level, using file descriptors.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2009 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is
# in the file COPY... | bsd-3-clause | Python |
a8f923a851a93d83644e103e7ede21ed9836d1a3 | add a condition wich allow the user to quit the loop | D15123494/cloud | Lab3/palindrome.py | Lab3/palindrome.py | #!/usr/bin/python3
'''This method determine if the word is a palindrome or not
param : string is the word to test
return : true if the word is a palindrome, otherwise false
'''
def isPalindrome (word):
return word==word[::-1]
cont = True
while(cont):
word = input("Please enter a word : ")
print (isPalindrome... | #!/usr/bin/python3
'''This method determine if the word is a palindrome or not
param : string is the word to test
return : true if the word is a palindrome, otherwise false
'''
def isPalindrome (word):
return word==word[::-1]
cont = True
while(cont):
word = input("Please enter a word : ")
print (isPalindrome... | mit | Python |
1247e6ff17b3f06dc6fdd28027ba17a2fa51af8a | fix typo | knmkr/perGENIE,perGENIE/pergenie-web,perGENIE/pergenie,perGENIE/pergenie,perGENIE/pergenie-web,perGENIE/pergenie-web,perGENIE/pergenie-web,knmkr/perGENIE,knmkr/perGENIE,perGENIE/pergenie-web,perGENIE/pergenie,perGENIE/pergenie-web,knmkr/perGENIE,perGENIE/pergenie,knmkr/perGENIE,perGENIE/pergenie,knmkr/perGENIE | pergenie/apps/population/views.py | pergenie/apps/population/views.py | # -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.views.generic.simple import direct_to_template
from django.utils.translation import ugettext as _
from django.conf import settings
from apps.riskreport.forms import RiskReportForm
import sys, os
from models import *
from ut... | # -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.views.generic.simple import direct_to_template
from django.utils.translation import ugettext as _
from django.conf import settings
from apps.riskreport.forms import RiskReportForm
import sys, os
from models import *
from ut... | agpl-3.0 | Python |
2cbf642f0a8677e655dc3a013e59a1a2275fd96b | Test fetch transfer | andela-sjames/paystack-python | paystackapi/tests/test_transfer.py | paystackapi/tests/test_transfer.py | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.transfer import Transfer
class TestTransfer(BaseTestCase):
@httpretty.activate
def test_initiate(self):
"""Method defined to test transfer initiation."""
httpretty.register_uri(
httpretty.... | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.transfer import Transfer
class TestTransfer(BaseTestCase):
@httpretty.activate
def test_initiate(self):
"""Method defined to test transfer initiation."""
httpretty.register_uri(
httpretty.... | mit | Python |
6875ab3427e0055bd45dcbcc981acd34f3998248 | resolve sets in possible return values | plepe/pgmapcss,plepe/pgmapcss | pgmapcss/eval/possible_values.py | pgmapcss/eval/possible_values.py | import pgmapcss.eval
def possible_values(value, stat):
global eval_param
eval_functions = pgmapcss.eval.functions().list()
if type(value) == str:
if value[0:2] == 'v:':
return value[2:]
elif value[0:2] == 'f:':
func = value[2:]
if not func in eval_funct... | import pgmapcss.eval
def possible_values(value, stat):
global eval_param
eval_functions = pgmapcss.eval.functions().list()
if type(value) == str:
if value[0:2] == 'v:':
return value[2:]
elif value[0:2] == 'f:':
func = value[2:]
if not func in eval_funct... | agpl-3.0 | Python |
23d92f1a24e919bd1b232cb529dbe022f6cdd463 | Use dict for dump data format | kurgm/gwv | gwv/gwv.py | gwv/gwv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from gwv import version
from validator import validate
def open_dump(filename):
dump = {}
with open(filename) as f:
if filename[-4:] == ".csv":
for l in f:
row = l.rstrip("\n").split(",")
i... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from gwv import version
from validator import validate
def main(args=None):
if args is None:
args = sys.argv[1:]
import argparse
parser = argparse.ArgumentParser(description="GlyphWiki data validator")
parser.add_argument("d... | mit | Python |
baeb84570fff5c53b5804b7564e8626753ef135b | Update __init__.py | inkenbrandt/WellApplication | wellapplication/__init__.py | wellapplication/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.2.17'
__author__ = 'Paul Inkenbrandt'
__name__ = 'wellapplication'
from transport import transport
from usgsGis import usgs
from chem import WQP
from graphs import piper, fdc, gantt
import MannKendall
import avgMeths
| # -*- coding: utf-8 -*-
__version__ = '0.2.16'
__author__ = 'Paul Inkenbrandt'
__name__ = 'wellapplication'
from transport import transport
from usgsGis import usgs
from chem import WQP
from graphs import piper, fdc, gantt
import MannKendall
import avgMeths
| mit | Python |
9cc8ce0644d5f965f8ba05ea07a1ac5490c23bd2 | Add missing return statement from throttle | KevinHanson/redi,nrejack/redi,KevinHanson/redi,KevinHanson/redi,nrejack/redi,nrejack/redi,KevinHanson/redi,KevinHanson/redi,nrejack/redi,KevinHanson/redi,nrejack/redi,KevinHanson/redi,nrejack/redi,nrejack/redi | redi/utils/throttle.py | redi/utils/throttle.py | """
Utility module for throttling calls to a function
"""
import collections
import datetime
import logging
import time
__author__ = "University of Florida CTS-IT Team"
__copyright__ = "Copyright 2014, University of Florida"
__license__ = "BSD 3-Clause"
logger = logging.getLogger(__name__)
logger.addHandler(logging... | """
Utility module for throttling calls to a function
"""
import collections
import datetime
import logging
import time
__author__ = "University of Florida CTS-IT Team"
__copyright__ = "Copyright 2014, University of Florida"
__license__ = "BSD 3-Clause"
logger = logging.getLogger(__name__)
logger.addHandler(logging... | bsd-3-clause | Python |
d4375b99d637d0350cbdcf775c5e49d66d6f2883 | Bump version number | LIVVkit/LIVVkit,LIVVkit/LIVVkit,LIVVkit/LIVVkit | livvkit/__init__.py | livvkit/__init__.py | # coding=utf-8
# Copyright (c) 2015-2018, UT-BATTELLE, LLC
# 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... | # coding=utf-8
# Copyright (c) 2015-2018, UT-BATTELLE, LLC
# 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... | bsd-3-clause | Python |
aa9531b4fc1c5b370b5658a451758c5011cd3abc | add main function | ccqpein/Arithmetic-Exercises,ccqpein/Arithmetic-Exercises,ccqpein/Arithmetic-Exercises,ccqpein/Arithmetic-Exercises,ccqpein/Arithmetic-Exercises,ccqpein/Arithmetic-Exercises,ccqpein/Arithmetic-Exercises | Longest-Increasing-Path-in-a-Matrix/LIPiaM.py | Longest-Increasing-Path-in-a-Matrix/LIPiaM.py | def changeDataToList(matrix):
returnList, returnList2 = [], []
for i in matrix:
for ii in i:
returnList.append(ii)
returnList = sorted(returnList)
for i in returnList:
if i not in returnList2:
returnList2.append(i)
returnList = returnList2
return returnLis... | def changeDataToList(matrix):
returnList, returnList2 = [], []
for i in matrix:
for ii in i:
returnList.append(ii)
returnList = sorted(returnList)
for i in returnList:
if i not in returnList2:
returnList2.append(i)
returnList = returnList2
return returnLis... | apache-2.0 | Python |
01f811bf801455084de5b16b763780be0e90540e | Remove preprints from papers plot. | capitalaslash/libmesh,90jrong/libmesh,vikramvgarg/libmesh,pbauman/libmesh,libMesh/libmesh,BalticPinguin/libmesh,pbauman/libmesh,BalticPinguin/libmesh,svallaghe/libmesh,capitalaslash/libmesh,jwpeterson/libmesh,vikramvgarg/libmesh,dschwen/libmesh,svallaghe/libmesh,capitalaslash/libmesh,capitalaslash/libmesh,capitalaslash... | doc/statistics/libmesh_citations.py | doc/statistics/libmesh_citations.py | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
# Number of "papers using libmesh" by year.
#
# Note 1: this does not count citations "only," the authors must have actually
# used libmesh in part of their work. Therefore, these counts do not include
# things like Wolfgang citing us in his pap... | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
# Number of "papers using libmesh" by year.
#
# Note 1: this does not count citations "only," the authors must have actually
# used libmesh in part of their work. Therefore, these counts do not include
# things like Wolfgang citing us in his pap... | lgpl-2.1 | Python |
b3917feae39a83f56d390da42b2e2728aa966f13 | merge document | lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django | agir/gestion/actions.py | agir/gestion/actions.py | import reversion
from agir.gestion.models import Document, Reglement, VersionDocument
def merge_document(d1: Document, d2: Document):
assert d1.id != d2.id
with reversion.create_revision():
reversion.set_comment("Fusion de deux documents")
# champs du document
d1.precision = d1.precis... | import reversion
from agir.gestion.models import Document, Reglement, VersionDocument
def merge_document(d1: Document, d2: Document):
assert d1.id != d2.id
with reversion.create_revision():
reversion.set_comment("Fusion de deux documents")
# champs du document
d1.precision = d1.precis... | agpl-3.0 | Python |
72ad87569ad21ea7d0ad3d851605184e3f967413 | Fix test_config with sponsor images | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | tests/scoring_engine/engine/test_config.py | tests/scoring_engine/engine/test_config.py | import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../'))
from scoring_engine.engine.config import Config
class TestConfig(object):
def setup(self):
self.config = Config(location="../../tests/scoring_engine/engine/example.conf")
def test_checks_loca... | import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../'))
from scoring_engine.engine.config import Config
class TestConfig(object):
def setup(self):
self.config = Config(location="../../tests/scoring_engine/engine/example.conf")
def test_checks_loca... | mit | Python |
043bd7db02624bb40cfb2d0ab574b7ffe6387585 | Fix typo | OpenVolunteeringPlatform/django-ovp-core,OpenVolunteeringPlatform/django-ovp-core | ovp_core/mixins/country_filter.py | ovp_core/mixins/country_filter.py | class CountryFilterMixin():
def filter_by_country(self, request, query_set, address_param):
if request.user.is_superuser:
return query_set
user_groups = request.user.groups.all()
if len(user_groups) == 0:
return query_set.filter(owner=user)
user_countries = []
for group in user_group... | class CountryFilterMixin():
def filter_by_country(self, request, query_set, address_param):
if request.user.is_superuser:
return query_set
user_groups = request.user.groups.all()
if len(user_groups) == 0:
return query_set.filter(owner=user)
user_contries = []
for group in user_groups... | agpl-3.0 | Python |
ad4705cfe67e34b482eea20fe7729574e2ea6cc5 | Fix stderr output | Bogh/django-pipeline-typescript | pipeline_typescript/compilers.py | pipeline_typescript/compilers.py | from __future__ import unicode_literals
from django.conf import settings as _settings
from pipeline.compilers import SubProcessCompiler
DEFAULTS = {
'PIPELINE_TYPESCRIPT_BINARY': '/usr/bin/env tsc',
'PIPELINE_TYPESCRIPT_ARGUMENTS': ''
}
def get_setting(name):
if hasattr(_settings, name):
return ... | from __future__ import unicode_literals
from django.conf import settings as _settings
from pipeline.compilers import CompilerBase
DEFAULTS = {
'PIPELINE_TYPESCRIPT_BINARY': '/usr/bin/env tsc',
'PIPELINE_TYPESCRIPT_ARGUMENTS': ''
}
def get_setting(name):
if hasattr(_settings, name):
return getatt... | mit | Python |
beb6904c040a28ce5bc0ca3f88dfd4db43985875 | Fix path | praekelt/jmbo-skeleton,praekelt/jmbo-skeleton,praekelt/jmbo-skeleton | handler.py | handler.py | from devproxy.handlers.wurfl_handler.scientia_mobile_cloud_resolution \
import ScientiaMobileCloudResolutionTouchHandler
# The default handler distinguishes between basic, smart and web. See
# device-proxy for other handlers or create your own.
class MyHandler(ScientiaMobileCloudResolutionTouchHandler):
pass
| from devproxy.handlers.wurfl_handler.scientia_mobile_cloud \
import ScientiaMobileCloudResolutionTouchHandler
# The default handler distinguishes between basic, smart and web. See
# device-proxy for other handlers or create your own.
class MyHandler(ScientiaMobileCloudResolutionTouchHandler):
pass
| bsd-3-clause | Python |
9ba8b31ed5001ea6522657b86ce3dfd2a75d594c | Fix RTD docs build (#12373) | sekikn/incubator-airflow,apache/airflow,sekikn/incubator-airflow,bolkedebruin/airflow,bolkedebruin/airflow,Acehaidrey/incubator-airflow,bolkedebruin/airflow,nathanielvarona/airflow,DinoCow/airflow,apache/incubator-airflow,Acehaidrey/incubator-airflow,dhuang/incubator-airflow,mrkm4ntr/incubator-airflow,airbnb/airflow,da... | docs/exts/providers_packages_ref.py | docs/exts/providers_packages_ref.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 | Python |
c5033d51a808ba766f6e28f71a19fc8dace7cbc5 | fix flake8 | Caleydo/caleydo_data_redis | phovea_data_redis/load_mappings.py | phovea_data_redis/load_mappings.py | from __future__ import print_function
import redis
import os
db = redis.Redis(host='localhost', port=6379, db=4)
def load_file(file_name):
name, _ = os.path.splitext(os.path.basename(file_name))
print('loading ' + file_name + ' ' + name)
with open(file_name, 'r') as f:
for line in f:
parts = [s.strip... | import redis
import os
db = redis.Redis(host='localhost', port=6379, db=4)
def load_file(file_name):
name, _ = os.path.splitext(os.path.basename(file_name))
print 'loading ' + file_name + ' ' + name
with open(file_name, 'r') as f:
for line in f:
parts = [s.strip() for s in line.split('\t')]
fro... | bsd-3-clause | Python |
07c7fb75e91e4bd72f3291aac2914de99e556528 | switch to new format for MIGRATION_MODULES | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/settings/testing.py | polling_stations/settings/testing.py | from .base import *
EVERY_ELECTION['CHECK'] = True
DISABLE_GA = True # don't log to Google Analytics when we are running tests
INSTALLED_APPS = list(INSTALLED_APPS)
INSTALLED_APPS.append('aloe_django',)
NOSE_ARGS = [
'--verbosity=2',
'--nologcapture',
'--nocapture',
]
MIGRATION_MODULES = {
app: None... | from .base import *
EVERY_ELECTION['CHECK'] = True
DISABLE_GA = True # don't log to Google Analytics when we are running tests
INSTALLED_APPS = list(INSTALLED_APPS)
INSTALLED_APPS.append('aloe_django',)
NOSE_ARGS = [
'--verbosity=2',
'--nologcapture',
'--nocapture',
]
MIGRATION_MODULES = {
app: '{}.... | bsd-3-clause | Python |
2d7c2773a92a5b6780086b381ea793268476f682 | simplify admin and remove prepopulated slug | rizumu/django-paste-organizer | writeboards/admin.py | writeboards/admin.py | from django.contrib import admin
from models import Writeboard
admin.site.register(Writeboard,) | from django.contrib import admin
from models import Writeboard
class WriteboardAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('writeboard_name',)}
admin.site.register(Writeboard, WriteboardAdmin) | mit | Python |
fc994239ad1643770c5a9bf212e5ad81f355e881 | Increase mock pose rate to 200 Hz. | masasin/spirit,masasin/spirit | src/mock_pose.py | src/mock_pose.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) 2015 Jean Nassar
# Released under BSD version 4
"""
Publish random similar poses to /ardrone/pose.
"""
from __future__ import division
import numpy as np
import rospy
import tf2_ros
from geometry_msgs.msg import PoseStamped, TransformStamped
class PoseGenerator(... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) 2015 Jean Nassar
# Released under BSD version 4
"""
Publish random similar poses to /ardrone/pose.
"""
from __future__ import division
import numpy as np
import rospy
import tf2_ros
from geometry_msgs.msg import PoseStamped, TransformStamped
class PoseGenerator(... | mit | Python |
dbee8136d4383c283863d1113b64b49006a2fc33 | Add json and yaml filters. (#47) | Wiredcraft/pipelines,Wiredcraft/pipelines,Wiredcraft/pipelines,Wiredcraft/pipelines | pipelines/pipeline/var_processing.py | pipelines/pipeline/var_processing.py | import logging
from dotmap import DotMap
import jinja2
import yaml
import json
log = logging.getLogger('pipelines')
def substitute_variables(pipeline_context, obj):
if isinstance(pipeline_context, DotMap):
pipeline_context = pipeline_context.toDict()
pipeline_context.update(pipeline_context.get('var... | import logging
from dotmap import DotMap
from jinja2 import Template
log = logging.getLogger('pipelines')
def substitute_variables(pipeline_context, obj):
if isinstance(pipeline_context, DotMap):
pipeline_context = pipeline_context.toDict()
pipeline_context.update(pipeline_context.get('vars')) # Pu... | mit | Python |
246c6a251ebc2bd946bee4773561346369fc6718 | change log html name | daijia/fetch-flight | fetch.py | fetch.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from website import fetch_airchina, fetch_ceair, fetch_ch, fetch_csair, \
fetch_ctrip
from settings import *
import util
import random
import template.page
reload(sys)
sys.setdefaultencoding('utf8')
from tomorrow import threads
func_map = {
Website.CTRI... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from website import fetch_airchina, fetch_ceair, fetch_ch, fetch_csair, \
fetch_ctrip
from settings import *
import util
import random
import template.page
reload(sys)
sys.setdefaultencoding('utf8')
from tomorrow import threads
func_map = {
Website.CTRI... | mit | Python |
d3f8c8639462feffe15c457d0009b36816fd3264 | Refactor setup.root to never again need to be changed if the file moves | kbd/setup,kbd/setup,kbd/setup,kbd/setup,kbd/setup | HOME/bin/lib/setup/__init__.py | HOME/bin/lib/setup/__init__.py | from pathlib import Path
SETTINGS_PATH = 'conf/settings.py'
PARTIALS_PATH = 'conf/partials.txt'
HOME_DIR = 'HOME'
def load_config(path=SETTINGS_PATH):
settings = eval(open(path).read())
return settings
def root():
# this file is under HOME_DIR, which is directly under the repo root
path = Path(__fi... | from pathlib import Path
SETTINGS_PATH = 'conf/settings.py'
PARTIALS_PATH = 'conf/partials.txt'
def load_config(path=SETTINGS_PATH):
settings = eval(open(path).read())
return settings
def root():
# this program lives in $repo/HOME/bin/lib, so $repo/HOME/bin/../../.. will
# get the root of the repos... | mit | Python |
7b1edb570264ebbdd66e21ef063a701c5617a7b6 | Update block graph test data and generation script. | supriyantomaftuh/syzygy,Eloston/syzygy,pombreda/syzygy,ericmckean/syzygy,wangming28/syzygy,wangming28/syzygy,google/syzygy,sebmarchand/syzygy,sebmarchand/syzygy,pombreda/syzygy,google/syzygy,ericmckean/syzygy,wangming28/syzygy,sebmarchand/syzygy,google/syzygy,Eloston/syzygy,supriyantomaftuh/syzygy,pombreda/syzygy,supri... | syzygy/block_graph/test_data/generate_test_dll_bg.py | syzygy/block_graph/test_data/generate_test_dll_bg.py | #!/usr/bin/python2.6
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | #!/usr/bin/python2.6
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python |
f99d83a1a200646c83fd78e3b851e7bcf1e996a4 | Bump to version 0.19.1 | reubano/tabutils,reubano/meza,reubano/tabutils,reubano/meza,reubano/tabutils,reubano/meza | tabutils/__init__.py | tabutils/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
tabutils
~~~~~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
tabutils
~~~~~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.... | mit | Python |
571cb7f14d3ea2fe1ae77e419a3d71d6f9987b25 | Fix __doc__ not being replaced | mjdorma/pyvbox | virtualbox/library_ext/progress.py | virtualbox/library_ext/progress.py | from virtualbox import library
"""
Add helper code to the default IProgress class.
"""
# Helper function for IProgress to print out a current progress state
# in __str__
_progress_template = """\
(%(o)s/%(oc)s) %(od)s %(p)-3s%% (%(tr)s s remaining)"""
class IProgress(library.IProgress):
__doc__ = library.IProgr... | from virtualbox import library
"""
Add helper code to the default IProgress class.
"""
# Helper function for IProgress to print out a current progress state
# in __str__
_progress_template = """\
(%(o)s/%(oc)s) %(od)s %(p)-3s%% (%(tr)s s remaining)"""
class IProgress(library.IProgress):
__doct__ = library.IProg... | apache-2.0 | Python |
993a2508b57bf57f80509e9e9fde95e546b8d11e | Fix bug | igorbpf/TheGist,igorbpf/TheGist,igorbpf/TheGist | blue/api/routes.py | blue/api/routes.py | from flask import Blueprint, jsonify, request, make_response
from utils import summarize
from requests.exceptions import Timeout
mod = Blueprint('api',__name__)
@mod.route('/summary', methods=['POST'])
def apiSummarize():
url = request.form['url']
try:
title, summary = summarize(url)
except Timeo... | from flask import Blueprint, jsonify, request, make_response
from utils import summarize
from requests.exceptions import Timeout
mod = Blueprint('api',__name__)
@mod.route('/summary', methods=['POST'])
def apiSummarize():
url = request.form['url']
try:
title, summary = summarize(url)
except Timeo... | mit | Python |
be1834d19a1b2160a93803234eaaf2c58659e933 | remove our window.clear function, use rabbyt's instead | tartley/zerkcom | tanks/view/window.py | tanks/view/window.py | import pyglet
import rabbyt
from ..image import load_all
from . import sprite
CLEAR_COLOR_DEFAULT = (0.1, 0.3, 0.2)
def init(world, options):
window = pyglet.window.Window(
fullscreen=options.fullscreen,
vsync=options.vsync,
resizable=not options.fullscreen,
caption='Tanks',
... | import pyglet
import rabbyt
from ..image import load_all
from . import sprite
CLEAR_COLOR_DEFAULT = (0.1, 0.3, 0.2)
def clear(color=CLEAR_COLOR_DEFAULT):
rabbyt.clear(rgba=CLEAR_COLOR_DEFAULT)
def init(world, options):
window = pyglet.window.Window(
fullscreen=options.fullscreen,
vsync=o... | bsd-3-clause | Python |
1e52f96f944beee3b9e46e45713fd29eb34115f2 | update module description | elego/tkobr-addons,thinkopensolutions/tkobr-addons,elego/tkobr-addons,thinkopensolutions/tkobr-addons,elego/tkobr-addons,elego/tkobr-addons,thinkopensolutions/tkobr-addons,thinkopensolutions/tkobr-addons | tko_web_sessions_management/__openerp__.py | tko_web_sessions_management/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# ThinkOpen Solutions Brasil
# Copyright (C) Thinkopen Solutions <http://www.tkobr.com>.
#
# This... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# ThinkOpen Solutions Brasil
# Copyright (C) Thinkopen Solutions <http://www.tkobr.com>.
#
# This... | agpl-3.0 | Python |
2552b439cf01ed430691345b4b0c43e8f58f9057 | clean up the formatting of the messages generated when this script runs. | EsriOceans/btm | Install/toolbox/scripts/bpi.py | Install/toolbox/scripts/bpi.py | # bpi.py
# Description: The Benthic Terrain Modeler (BTM) functions as a toolbox
# within ArcMap, and relies on a methodology to analyze benthic
# terrain from input multibeam bathymetry in ESRI's GRID (raster)
# format. The BTM toolbox contains a set of tools that allow
# ... | # bpi.py
# Description: The Benthic Terrain Modeler (BTM) functions as a toolbox
# within ArcMap, and relies on a methodology to analyze benthic
# terrain from input multibeam bathymetry in ESRI's GRID (raster)
# format. The BTM toolbox contains a set of tools that allow
# ... | mpl-2.0 | Python |
7e8c0f95c12bc22f9f3e0fc3f887dd0136fd0d98 | Check for empty list in wheres | rchui/pyql | Parser/parselib.py | Parser/parselib.py | """ parselib.py
This file defines functions that parse the SQL queries.
"""
import re
import imp
try:
imp.find_module('sqlparse')
except ImportError:
from subprocess import call
print('\nsqlparse not found. Attempting sqlparse installation.')
call(['pip3', 'install', 'sqlparse'])
import sqlparse
def... | """ parselib.py
This file defines functions that parse the SQL queries.
"""
import re
import imp
try:
imp.find_module('sqlparse')
except ImportError:
from subprocess import call
print('\nsqlparse not found. Attempting sqlparse installation.')
call(['pip3', 'install', 'sqlparse'])
import sqlparse
def... | mit | Python |
75b3b8f021d3a1e3ba72c4e72f6393296bcf0153 | Handle UDP in seperate thread. | serathius/elasticsearch-raven,pozytywnie/elasticsearch-raven,socialwifi/elasticsearch-raven | elasticsearch_raven/udp_server.py | elasticsearch_raven/udp_server.py | import argparse
import datetime
import os
import queue
import socket
import sys
import threading
from elasticsearch_raven.transport import ElasticsearchTransport
from elasticsearch_raven.transport import SentryMessage
def run_server():
args = _parse_args()
sock = get_socket(args.ip, args.port)
if sock:
... | import argparse
import datetime
import os
import queue
import socket
import sys
import threading
from elasticsearch_raven.transport import ElasticsearchTransport
from elasticsearch_raven.transport import SentryMessage
def run_server():
args = _parse_args()
sock = get_socket(args.ip, args.port)
if sock:
... | mit | Python |
58620934b0a49cdde573ed7090053e3316fcf215 | Add user registration via api | xp2017-hackergarden/server,xp2017-hackergarden/server,xp2017-hackergarden/server,xp2017-hackergarden/server | xpserver_api/serializers.py | xpserver_api/serializers.py | from django.contrib.auth.models import User
from rest_framework import serializers, viewsets
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'email')
def create(self, validated_data):
user = User.objects.create(**validated_data)
... | from django.contrib.auth.models import User
from rest_framework import serializers, viewsets
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'email')
class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all()
serializer... | mit | Python |
05d5156d9147cbe942786e61d1e6f2eda9a31279 | Refactor utility functions for getting credentials. | simplegeo/clusto-sgext | sgext/util/aws.py | sgext/util/aws.py | # -*- coding: utf-8 -*-
#
# © 2011 SimpleGeo, Inc. All rights reserved.
# Author: Paul Lathrop <paul@simplegeo.com>
#
"""Utility functions for AWS-related tasks."""
from getpass import getpass
import os
import boto.pyami.config as boto_config
def has_aws_environment():
"""
Return True if the AWS_ACCESS_KEY... | # -*- coding: utf-8 -*-
#
# © 2011 SimpleGeo, Inc. All rights reserved.
# Author: Paul Lathrop <paul@simplegeo.com>
#
"""Utility functions for AWS-related tasks."""
from getpass import getpass
import boto.pyami.config as boto_config
def get_credentials(batch=False):
"""Return a dictionary of AWS credentials. C... | bsd-2-clause | Python |
4a0569d129d770fead45f3b0d9069ff54e8ddc56 | Add stop method, fix dangerous args. | pkulev/xoinvader,pankshok/xoinvader | xoinvader/game.py | xoinvader/game.py | #! /usr/bin/env python3
"""Main XOInvader module, that is entry point to game.
Prepare environment for starting game and start it."""
import curses
from xoinvader.menu import MainMenuState
from xoinvader.ingame import InGameState
from xoinvader.render import Renderer
from xoinvader.common import Settings
from xoin... | #! /usr/bin/env python3
"""Main XOInvader module, that is entry point to game.
Prepare environment for starting game and start it."""
import curses
from xoinvader.menu import MainMenuState
from xoinvader.ingame import InGameState
from xoinvader.render import Renderer
from xoinvader.common import Settings
from xoin... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.