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
9e306e6aa369ca5d435aa0a69d1ab584994bed7d
Implement memory limiting
mindriot101/fitsiochunked
fitsiochunked.py
fitsiochunked.py
# -*- coding: utf-8 -*- from collections import namedtuple Chunk = namedtuple('Chunk', ['data', 'slice']) class ChunkedAdapter(object): def __init__(self, hdu): self.hdu = hdu @property def nrows(self): return self.hdu.get_info()['dims'][0] @property def num_images(self): ...
# -*- coding: utf-8 -*- from collections import namedtuple Chunk = namedtuple('Chunk', ['data', 'slice']) class ChunkedAdapter(object): def __init__(self, hdu): self.hdu = hdu @property def nrows(self): return self.hdu.get_info()['dims'][0] @property def num_images(self): ...
mit
Python
286c8151c174f11df98d6cb421252c0d61337add
Update regexp to detect magic comment
tk0miya/flake8-coding
flake8_coding.py
flake8_coding.py
# -*- coding: utf-8 -*- import re __version__ = '0.1.0' class CodingChecker(object): name = 'flake8_coding' version = __version__ def __init__(self, tree, filename): self.filename = filename @classmethod def add_options(cls, parser): parser.add_option( '--accept-enc...
# -*- coding: utf-8 -*- import re __version__ = '0.1.0' class CodingChecker(object): name = 'flake8_coding' version = __version__ def __init__(self, tree, filename): self.filename = filename @classmethod def add_options(cls, parser): parser.add_option( '--accept-enc...
apache-2.0
Python
cbd6d8802506d0075d5c093ad510380c8a8e8181
remove redundant import alias
openstack/watcher,openstack/watcher,stackforge/watcher,stackforge/watcher
watcher/cmd/sync.py
watcher/cmd/sync.py
# -*- encoding: utf-8 -*- # # Copyright (c) 2016 Intel # # Authors: Tomasz Kaczynski <tomasz.kaczynski@intel.com> # # 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/lic...
# -*- encoding: utf-8 -*- # # Copyright (c) 2016 Intel # # Authors: Tomasz Kaczynski <tomasz.kaczynski@intel.com> # # 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/lic...
apache-2.0
Python
266fc32bd48d1857294151b82f25cbdc34851dda
Update logout view.
FoodLust/FL,FoodLust/FL,FoodLust/FL
foodlust/urls.py
foodlust/urls.py
"""foodlust URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-b...
"""foodlust URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-b...
mit
Python
449a9c284be95f1a773fb2dee2a9f5b975db1483
bump version
blackskad/sixpack,llonchj/sixpack,seatgeek/sixpack,blackskad/sixpack,spjwebster/sixpack,seatgeek/sixpack,vpuzzella/sixpack,vpuzzella/sixpack,smokymountains/sixpack,llonchj/sixpack,seatgeek/sixpack,vpuzzella/sixpack,spjwebster/sixpack,seatgeek/sixpack,smokymountains/sixpack,llonchj/sixpack,nickveenhof/sixpack,vpuzzella/...
sixpack/__init__.py
sixpack/__init__.py
__version__ = '0.2.3'
__version__ = '0.2.2'
bsd-2-clause
Python
ed5c589e8cd3247bc9b0f443468a739b5f166baa
Load generator client
fabiomorais/load_generator,fabiomorais/load_generator
load_generator_client.py
load_generator_client.py
import threading as t import time import subprocess import sys from flask import Flask, request from collections import deque app = Flask(__name__) QUEUE = deque() def get_ncpus(): return str(subprocess.Popen(['nproc'], stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]) def is_cpu_value_a...
import threading as t import time import subprocess import sys from flask import Flask, request from collections import deque app = Flask(__name__) QUEUE = deque() def get_ncpus(): return str(subprocess.Popen(['nproc'], stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]) def is_cpu_value_a...
apache-2.0
Python
4dc258144707910b91c48cf8d0fec9c1e920c83e
Fix script to correctly figure out the static directory. Review URL: http://chromereview.prom.corp.google.com/1178030
mgireesh05/dev-util,coreos/dev-util,coreos/dev-util,coreos/dev-util,marineam/coreos-dev-util,mgireesh05/dev-util,marineam/coreos-dev-util,mgireesh05/dev-util
devserver.py
devserver.py
# Copyright (c) 2009 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import autoupdate import buildutil import os import web import sys urls = ('/', 'index', '/update', 'update') app = web.application(urls, gl...
# Copyright (c) 2009 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import autoupdate import buildutil import os import web app_id = "87efface-864d-49a5-9bb3-4b050a7c227a" root_dir = "/usr/local/google/home/rtc/chrome...
bsd-3-clause
Python
214b98d6b379625763ff520add5c59a0c9649f25
Add RSS url
rhertzog/librement,rhertzog/librement,rhertzog/librement
src/librement/profile/forms.py
src/librement/profile/forms.py
from django import forms from django.contrib.auth.models import User from .models import Profile class ProfileForm(forms.ModelForm): class Meta: model = Profile fields = ( 'display_name', 'biography', 'rss_url', ) class URLForm(forms.ModelForm): use...
from django import forms from django.contrib.auth.models import User from .models import Profile class ProfileForm(forms.ModelForm): class Meta: model = Profile fields = ( 'display_name', 'biography', ) class URLForm(forms.ModelForm): username = forms.RegexFiel...
agpl-3.0
Python
f8077b4a8f9906d0125e3fa8a99a08a82dcfcc91
switch from using np.random to using the python built in hash function, to avoid issues with conflicting numpy versions.
google/BIG-bench,google/BIG-bench
bigbench/api/task_metrics.py
bigbench/api/task_metrics.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, so...
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, so...
apache-2.0
Python
2a945eb2fe33b4386f8d1fd2dba3afc757ed60a8
Fix Extra handling in pull schema, which had a non-dict root
jsenko/repour,project-ncl/repour,project-ncl/repour,jsenko/repour
repour/validation.py
repour/validation.py
import logging from voluptuous import * from . import adjust as adjustmodule from . import pull as pullmodule from . import repo # # Primitives # nonempty_str = All(str, Length(min=1)) nonempty_noblank_str = All(str, Match(r'^\S+$')) port_num = All(int, Range(min=1, max=65535)) # # Adjust # adjust_raw = { "na...
import logging from voluptuous import * from . import adjust as adjustmodule from . import pull as pullmodule from . import repo # # Primitives # nonempty_str = All(str, Length(min=1)) nonempty_noblank_str = All(str, Match(r'^\S+$')) port_num = All(int, Range(min=1, max=65535)) # # Adjust # adjust_raw = { "na...
apache-2.0
Python
7cb5a225738bfc1236ef5836aad50e216a7e7355
Rework blog license add-on urls
TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker
apps/blog/license_urls.py
apps/blog/license_urls.py
""" URLCONF for the blog app (add-on urls for the license app). """ from django.conf.urls import url from . import views, feeds # URL patterns configuration urlpatterns = ( # License index page url(r'^(?P<slug>[-a-zA-Z0-9_]+)/articles/$', views.license_detail, name='license_articles_detail'), # Relate...
""" URLCONF for the blog app. """ from django.conf.urls import url from . import views, feeds # URL patterns configuration urlpatterns = ( # License index page url(r'^(?P<slug>[-a-zA-Z0-9_]+)/$', views.license_detail, name='license_detail'), # Related articles feed url(r'^(?P<slug>[-a-zA-Z0-9_]+)/...
agpl-3.0
Python
5dfacded4f0dd8e7b5e7fe212fc6bfe017dcb2b5
Use ISO formatted time stamps
siggame/ng-games,siggame/ng-games,siggame/ng-games
games.py
games.py
""" This module is for generating fake game data for use with the API. An example of some game data:: { "id": 1, "logURL": "http://derp.nope/", "winner": 0, "updates": [ { "status": "complete", "time": "today" } ], ...
""" This module is for generating fake game data for use with the API. An example of some game data:: { "id": 1, "logURL": "http://derp.nope/", "winner": 0, "updates": [ { "status": "complete", "time": "today" } ], ...
bsd-3-clause
Python
624036406747beb6799dfcade06f9040a8ff8d9a
Update constants.py
fronzbot/blinkpy,fronzbot/blinkpy
blinkpy/helpers/constants.py
blinkpy/helpers/constants.py
"""Generates constants for use in blinkpy.""" import os MAJOR_VERSION = 0 MINOR_VERSION = 17 PATCH_VERSION = "0.dev2" __version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}.{PATCH_VERSION}" REQUIRED_PYTHON_VER = (3, 6, 0) PROJECT_NAME = "blinkpy" PROJECT_PACKAGE_NAME = "blinkpy" PROJECT_LICENSE = "MIT" PROJECT_AUTHOR = "...
"""Generates constants for use in blinkpy.""" import os MAJOR_VERSION = 0 MINOR_VERSION = 17 PATCH_VERSION = "0.dev2" __version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}.{PATCH_VERSION}" REQUIRED_PYTHON_VER = (3, 6, 0) PROJECT_NAME = "blinkpy" PROJECT_PACKAGE_NAME = "blinkpy" PROJECT_LICENSE = "MIT" PROJECT_AUTHOR = "...
mit
Python
c6c675c1ef623ab6da01bf241b0336599e13221b
Add default values for Bmi and INPUT_FILE.
csdms/bmi-tester
bmi_tester/tests/__init__.py
bmi_tester/tests/__init__.py
# Both of these variables should be overriden to test a particular # BMI class Bmi = None INPUT_FILE = None
mit
Python
e8f60852c5f387913997e24c9c5b9de2c0409988
Add apache2 header
jogo/graphing-openstack
graph.py
graph.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 u...
import pydot graph = pydot.Dot(graph_type='digraph') server_names = ['nova', 'keystone', 'glance'] s = {} # servers for server in server_names: s[server] = pydot.Node(server, style="filled") for server in s: graph.add_node(s[server]) # black: a REQUIRES b THROUGH label REQUIRES = "black" # blue: a CAN-USE...
apache-2.0
Python
38011ca10171988acdc047a68418e5ee313c6ffd
Update script
HERA-Team/hera_mc,HERA-Team/Monitor_and_Control,HERA-Team/hera_mc
scripts/write_antenna_location_file.py
scripts/write_antenna_location_file.py
#! /usr/bin/env python # -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD license. """ Script to write out antenna locations for use in cal files. """ import pandas as pd from hera_mc import mc, geo_handling, cm_handling import datetime parser = mc.get_mc_a...
#! /usr/bin/env python # -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD license. """ Script to write out antenna locations for use in cal files. """ import pandas as pd from hera_mc import mc, geo_handling, cm_handling import datetime parser = mc.get_mc_a...
bsd-2-clause
Python
9c3efae879a558a3d6e7ee50eac31d96058b85cc
Remove leading zero padding from dates
openva/gould
gould.py
gould.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Determines the rate structure for tomorrow that's advertised by Dominion (the Virginia electricial utility) and creates a JSON file containing that data. """ import os import sys import urllib, json import time import datetime as dt import yaml # Load the rates file. ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Determines the rate structure for tomorrow that's advertised by Dominion (the Virginia electricial utility) and creates a JSON file containing that data. """ import os import sys import urllib, json import time import datetime as dt import yaml # Load the rates file. ...
mit
Python
6406b0c0976225a52a516c0cf76d289e4a99bd06
Add Section.readable
isislab/dispatch,isislab/dispatch
dispatch/formats/section.py
dispatch/formats/section.py
class Section(object): ''' Represents a section from an executable. All common executable formats have nearly the exact same idea of a section, so we just put it into a unified class for easy, consistent access ''' name = '' vaddr = 0 offset = 0 size = 0 raw = None readable = F...
class Section(object): ''' Represents a section from an executable. All common executable formats have nearly the exact same idea of a section, so we just put it into a unified class for easy, consistent access ''' name = '' vaddr = 0 offset = 0 size = 0 raw = None writable = F...
mit
Python
f765d72b5175b9a661c91767a0ee6db3fe48fb15
Fix typo
mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-inter...
problems/byte-format/byte-format.py
problems/byte-format/byte-format.py
def byte_format(n, roundto=2): """ Runtime: O(n) """ units = ["B", "KB", "MB", "GB", "TB", "PB"] # ... id = 0 factor = 1024 # or 1000 while n > factor: n = float(n) / factor id += 1 n = "%.{0}f".format(roundto) % n return "{0} {1}".format(n, units[id]) print byte_...
def byte_format(n, roundto=2): """ Runtime: O(1) """ units = ["B", "KB", "MB", "GB", "TB", "PB"] # ... id = 0 factor = 1024 # or 1000 while n > factor: n = float(n) / factor id += 1 n = "%.{0}f".format(roundto) % n return "{0} {1}".format(n, units[id]) print byte_fo...
mit
Python
8ad745d7b808cd3b7a2e74752bc8d8c8eae198f2
fix header name conversion.
soapteam/soapfish,FelixSchwarz/soapfish,FelixSchwarz/soapfish
soapfish/django_.py
soapfish/django_.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from soapfish.core import SOAPRequest from soapfish.soap_dispatch import SOAPDispatcher __all__ = ['django_dispatcher'] class DjangoEnvironWrapper(object): def __init__(self, environ): self.environ = environ def get(self, name, defaul...
# -*- coding: utf-8 -*- from __future__ import absolute_import from soapfish.core import SOAPRequest from soapfish.soap_dispatch import SOAPDispatcher __all__ = ['django_dispatcher'] class DjangoEnvironWrapper(object): def __init__(self, environ): self.environ = environ def get(self, name, defaul...
bsd-3-clause
Python
f226b823a258d742dfbab048ffe29d425ec46db3
Change shortcuts to list to simplify
freedomboxtwh/Plinth,kkampardi/Plinth,vignanl/Plinth,freedomboxtwh/Plinth,freedomboxtwh/Plinth,kkampardi/Plinth,harry-7/Plinth,freedomboxtwh/Plinth,freedomboxtwh/Plinth,vignanl/Plinth,kkampardi/Plinth,vignanl/Plinth,harry-7/Plinth,harry-7/Plinth,vignanl/Plinth,harry-7/Plinth,kkampardi/Plinth,vignanl/Plinth,harry-7/Plin...
plinth/frontpage.py
plinth/frontpage.py
# # This file is part of Plinth. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
# # This file is part of Plinth. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
agpl-3.0
Python
5c718f90588eb6cf845b7dc490232f33c6740c5a
remove reduce2 build warning
pydata/bottleneck,kwgoodman/bottleneck,kwgoodman/bottleneck,pydata/bottleneck,pydata/bottleneck,kwgoodman/bottleneck
bottleneck/template/setup.py
bottleneck/template/setup.py
from distutils.core import setup, Extension import numpy as np c_ext = Extension("nansum", ["reduce2.c"]) setup( ext_modules=[c_ext], include_dirs=np.get_include(), )
from distutils.core import setup, Extension import numpy.distutils.misc_util c_ext = Extension("nansum", ["reduce2.c"]) setup( ext_modules=[c_ext], include_dirs=numpy.distutils.misc_util.get_numpy_include_dirs(), )
bsd-2-clause
Python
e45d6439d3858e70fde8f1dad1d72d8c291e8979
Make the build script P2/3 compatible
theinternetftw/xyppy
build-single-file-version.py
build-single-file-version.py
#! /usr/bin/env python import os import stat import zipfile try: from StringIO import StringIO except ImportError: from io import BytesIO as StringIO package_dir = 'xyppy' python_directive = '#!/usr/bin/env python' packed = StringIO() packed_writer = zipfile.ZipFile(packed, 'w', zipfile.ZIP_DEFLATED) for fn...
#! /usr/bin/env python import os import stat import zipfile import StringIO package_dir = 'xyppy' python_directive = '#!/usr/bin/env python' packed = StringIO.StringIO() packed_writer = zipfile.ZipFile(packed, 'w', zipfile.ZIP_DEFLATED) for fname in os.listdir(package_dir): fpath = os.path.join(package_dir, fnam...
mit
Python
70fef87576ac997fdb4e1c265152cc8f2929141a
Remove mention to MigrateCommand
ArtProcessors/django-tenant-schemas,bernardopires/django-tenant-schemas,ArtProcessors/django-tenant-schemas,goodtune/django-tenant-schemas,goodtune/django-tenant-schemas,bernardopires/django-tenant-schemas
tenant_schemas/management/commands/migrate.py
tenant_schemas/management/commands/migrate.py
from django.conf import settings from django.core.management.base import CommandError, BaseCommand from tenant_schemas.management.commands.migrate_schemas import Command as MigrateSchemasCommand from tenant_schemas.utils import django_is_in_test_mode class Command(BaseCommand): def handle(self, *args, **options...
from django.conf import settings from django.core.management.base import CommandError, BaseCommand from tenant_schemas.management.commands.migrate_schemas import Command as MigrateSchemasCommand from tenant_schemas.utils import django_is_in_test_mode class Command(BaseCommand): def handle(self, *args, **options...
mit
Python
1205b99b030cf24a01549163e7e5a1c717e15156
Add sensible defaults
Banno/getsentry-ldap-auth,kmlebedev/getsentry-ldap-auth
sentry_ldap_auth/backend.py
sentry_ldap_auth/backend.py
from __future__ import absolute_import from django_auth_ldap.backend import LDAPBackend from django.conf import settings from sentry.models import ( Organization, OrganizationMember, OrganizationMemberType, UserOption, ) class SentryLdapBackend(LDAPBackend): def get_or_create_user(self, username,...
from __future__ import absolute_import from django_auth_ldap.backend import LDAPBackend from django.conf import settings from sentry.models import ( Organization, OrganizationMember, OrganizationMemberType, UserOption, ) class SentryLdapBackend(LDAPBackend): def get_or_create_user(self, username,...
apache-2.0
Python
157d2f37be81b1edeb2ddff6d1197b8c377b3f7b
Fix final newline
PaulOlteanu/PVCS
helpers/patch_applier.py
helpers/patch_applier.py
def apply_patch(string_to_patch, patch, reverse=False): """Apply a diff file to a specified string """ # The strings are now represented as arrays with every element being one line patch_lines = patch.split("\n") final_text = string_to_patch.split("\n") current_line_number = 0 for line in ...
def apply_patch(string_to_patch, patch, reverse=False): """Apply a diff file to a specified string """ # The strings are now represented as arrays with every element being one line patch_lines = patch.split("\n") final_text = string_to_patch.split("\n") current_line_number = 0 for line in ...
mit
Python
2954c7d0c2605003fd147ec1bc82471a63fdf504
use old-style class for better py2 compat
zhiyuanshi/pgcli,koljonen/pgcli,MattOates/pgcli,TamasNo1/pgcli,w4ngyi/pgcli,bitemyapp/pgcli,suzukaze/pgcli,joewalnes/pgcli,dbcli/vcli,dbcli/pgcli,yx91490/pgcli,dbcli/pgcli,bitmonk/pgcli,joewalnes/pgcli,lk1ngaa7/pgcli,johshoff/pgcli,d33tah/pgcli,j-bennet/pgcli,thedrow/pgcli,dbcli/vcli,d33tah/pgcli,j-bennet/pgcli,nosun/p...
pgcli/packages/namedqueries.py
pgcli/packages/namedqueries.py
from ..config import load_config class NamedQueries(object): section_name = 'named queries' def __init__(self, filename): self.config = load_config(filename) def list(self): return self.config.get(self.section_name, []) def get(self, name): return self.config.get(self.sectio...
from os.path import expanduser from ..config import load_config class NamedQueries: section_name = 'named queries' def __init__(self, filename): self.config = load_config(filename) def list(self): return self.config.get(self.section_name, []) def get(self, name): return self...
bsd-3-clause
Python
173796940953ee9a3b13baf8f7d0f80aa260de51
Bump version
MissiaL/hikvision-client
hikvisionapi/__init__.py
hikvisionapi/__init__.py
from .hikvisionapi import Client __title__ = 'hikvisionapi' __version__ = '0.2.1' __author__ = 'Petr Alekseev' __license__ = 'MIT' __copyright__ = 'Copyright 2018 Petr Alekseev'
from .hikvisionapi import Client __title__ = 'hikvisionapi' __version__ = '0.2' __author__ = 'Petr Alekseev' __license__ = 'MIT' __copyright__ = 'Copyright 2018 Petr Alekseev'
mit
Python
d16cec0a2506d75901ab22e9d42ab51176279125
Handle missing slash in app url
j0gurt/ggrc-core,prasannav7/ggrc-core,selahssea/ggrc-core,edofic/ggrc-core,prasannav7/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,NejcZupec/ggrc-core,josthkko/ggrc-core,josthkko/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,VinnieJohns/ggrc-core...
test/selenium/src/lib/environment/__init__.py
test/selenium/src/lib/environment/__init__.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: jernej@reciprocitylabs.com # Maintained By: jernej@reciprocitylabs.com import os import logging from ast import literal_eval from lib import consta...
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: jernej@reciprocitylabs.com # Maintained By: jernej@reciprocitylabs.com import os import logging from ast import literal_eval from lib import consta...
apache-2.0
Python
fe25e0d68647af689c4015f1728cd7dd2d48b7ee
Update parser to the changes in the report format
0xPoly/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,0xPoly/...
scripts/example_parser.py
scripts/example_parser.py
# This is an example of how to parse ooniprobe reports import yaml import sys print "Opening %s" % sys.argv[1] f = open(sys.argv[1]) yamloo = yaml.safe_load_all(f) report_header = yamloo.next() print "ASN: %s" % report_header['probe_asn'] print "CC: %s" % report_header['probe_cc'] print "IP: %s" % report_header['prob...
# This is an example of how to parse ooniprobe reports import yaml import sys print "Opening %s" % sys.argv[1] f = open(sys.argv[1]) yamloo = yaml.safe_load_all(f) report_header = yamloo.next() print "ASN: %s" % report_header['probe_asn'] print "CC: %s" % report_header['probe_cc'] print "IP: %s" % report_header['prob...
bsd-2-clause
Python
3079d059dcea50288b11c319b2d4fdb82b86ca17
Include the last energy level in the histogram.
marblar/demon,marblar/demon,marblar/demon,marblar/demon
scripts/plot/histogram.py
scripts/plot/histogram.py
import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.mlab as mlab from sys import stdin lists = [] currentList = [] for line in stdin: if line.startswith("Beta: "): if currentList: lists.append(currentList) currentList = [] ...
import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.mlab as mlab from sys import stdin lists = [] currentList = [] for line in stdin: if line.startswith("Beta: "): if currentList: lists.append(currentList) currentList = [] ...
mit
Python
df2d24757d8e12035437d152d17dc9016f1cd9df
Create model in config file.
CAPU-ENG/CAPUHome-API,huxuan/CAPUHome-API
app/__init__.py
app/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: __init__.py Author: huxuan <i(at)huxuan.org> Description: Initial file for app. """ from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy app = Flask(__name__) # pylint: disable=invalid-name app.config.from_object('config') # commented as for fil...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: __init__.py Author: huxuan <i(at)huxuan.org> Description: Initial file for app. """ from flask import Flask app = Flask(__name__) # pylint: disable=invalid-name app.config.from_object('config') # commented as for file structure, should recover later. # from ap...
mit
Python
1fa6e6402a830612915b10bf66fc68a83e49d02a
remove lock from proc controller
EndPointCorp/appctl,EndPointCorp/appctl
appctl/src/appctl_support/proc_controller.py
appctl/src/appctl_support/proc_controller.py
import rospy import threading from controller import BaseController from proc_runner import ProcRunner class ProcController(BaseController): """ Controls startup and shutdown of a ProcRunner. """ def __init__(self, cmd, shell=False, spawn_hooks=[], respawn=True): """ respawn handles wh...
import rospy import threading from controller import BaseController from proc_runner import ProcRunner class ProcController(BaseController): """ Controls startup and shutdown of a ProcRunner. """ def __init__(self, cmd, shell=False, spawn_hooks=[], respawn=True): """ respawn handles wh...
apache-2.0
Python
0d507db6567840be985d55e95b50d63b7c466331
update the old fbcode_builder spec for fbzmq
facebook/wangle,facebook/wangle,facebook/wangle
build/fbcode_builder/specs/fbzmq.py
build/fbcode_builder/specs/fbzmq.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import specs.fbthrift as fbthrift import specs.folly as folly import specs.gmock as gmock import ...
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import specs.fbthrift as fbthrift import specs.folly as folly import specs.gmock as gmock import ...
apache-2.0
Python
805c0d5c21c1b08ed70746b07f9d9497821a98e8
remove debug logging
jeromecc/doctoctocbot
src/bot/conf/cfg.py
src/bot/conf/cfg.py
import os import inspect import json import logging from django.conf import settings logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) def getConfig(): """ Get config object. To use production configuration file, export en...
import os import inspect import json import logging from django.conf import settings logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) def getConfig(): """ Get config object. To use production configuration file, export en...
mpl-2.0
Python
8c2996b94cdc3210b24ebeaeb957c625629f68a5
Add log to encoding output (still fails due to objects)
MoyTW/RL_Arena_Experiment
hunting/level/encoder.py
hunting/level/encoder.py
import json import hunting.sim.entities as entities class GameObjectEncoder(json.JSONEncoder): def default(self, o): d = o.__dict__ d.pop('owner', None) if isinstance(o, entities.GameObject): d.pop('log', None) d.pop('ai', None) return d elif is...
import json import hunting.sim.entities as entities class GameObjectEncoder(json.JSONEncoder): def default(self, o): d = o.__dict__ d.pop('owner', None) if isinstance(o, entities.GameObject): d.pop('log', None) d.pop('ai', None) return d elif is...
mit
Python
28960dc03e5e14db94d18b968947257029f934d8
Simplify adding spaces and add time/space complexity
bowen0701/algorithms_data_structures
cw_draw_stairs.py
cw_draw_stairs.py
"""Codewars: Draw stairs 8 kyu URL: https://www.codewars.com/kata/draw-stairs/ Given a number n, draw stairs using the letter "I", n tall and n wide, with the tallest in the top left. For example n = 3 result in "I\n I\n I", or printed: I I I Another example, a 7-step stairs should be drawn like this: I I I ...
"""Codewars: Draw stairs 8 kyu URL: https://www.codewars.com/kata/draw-stairs/ Given a number n, draw stairs using the letter "I", n tall and n wide, with the tallest in the top left. For example n = 3 result in "I\n I\n I", or printed: I I I Another example, a 7-step stairs should be drawn like this: I I I ...
bsd-2-clause
Python
6276445382f4f4491aab9a0d30a653c0fd2af0b2
add generated results
felixbade/visa
app/views.py
app/views.py
import random import json from flask import render_template, session, request from app import app import config from app import request_logger from app import questions @app.route('/', methods=['GET', 'POST']) def q(): possible_questions = list(request.form.keys()) if len(possible_questions) == 1: qu...
import random from flask import render_template, session, request from app import app import config from app import request_logger from app import questions @app.route('/', methods=['GET', 'POST']) def q(): possible_questions = list(request.form.keys()) if len(possible_questions) == 1: question = pos...
mit
Python
af383409a45a392e6143594b6ce7b48d10b780f7
remove nday in timedelta
axelbellec/chronos,axelbellec/chronos,axelbellec/chronos
app/views.py
app/views.py
# coding: utf-8 """ Chronos webapp views. """ from collections import OrderedDict import datetime as dt from flask import render_template from app import app from app import cache from chronos.util import read_json, read_yaml CHRONOS_CONFIG = app.config['CHRONOS_CONFIG'] def get_config(): config = read_yaml(C...
# coding: utf-8 """ Chronos webapp views. """ from collections import OrderedDict import datetime as dt from flask import render_template from app import app from app import cache from chronos.util import read_json, read_yaml CHRONOS_CONFIG = app.config['CHRONOS_CONFIG'] def get_config(): config = read_yaml(C...
mit
Python
3fd61581b3b4232681f964f9c3643d0c20f64e9f
Call the right kotlinc
github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql
java/kotlin-extractor/kotlin_plugin_versions.py
java/kotlin-extractor/kotlin_plugin_versions.py
import platform import re import shutil import subprocess import sys def is_windows(): '''Whether we appear to be running on Windows''' if platform.system() == 'Windows': return True if platform.system().startswith('CYGWIN'): return True return False def version_tuple_to_string(version...
import platform import re import shutil import subprocess import sys def is_windows(): '''Whether we appear to be running on Windows''' if platform.system() == 'Windows': return True if platform.system().startswith('CYGWIN'): return True return False def version_tuple_to_string(version...
mit
Python
0b2879bcc4addd27527e9242f4f0876dadd95a1e
fix json encoder issues
salsita/flask-mime-encoders
lib/json.py
lib/json.py
"""Flask MIME JSON encoder and decoder.""" __all__ = 'JsonMimeEncoder'.split() from . import MimeEncoders from flask import json, request, Response from functools import wraps class JsonMimeEncoder(MimeEncoders.base): """Flask MIME JSON encoder and decoder.""" name = 'json' mimetype = 'application/json' ...
"""Flask MIME JSON encoder and decoder.""" __all__ = 'JsonMimeEncoder'.split() from . import MimeEncoders from flask import json, request, Response from functools import wraps class JsonMimeEncoder(MimeEncoders.base): """Flask MIME JSON encoder and decoder.""" name = 'json' mimetype = 'application/json' ...
mit
Python
9a338dfb7ada40bb13c1e3105ffec62b08a2eaf5
Add storage dictionary class (for config files) to mx/util/__init__.py.
leapcode/leap_mx,meskio/leap_mx,isislovecruft/leap_mx,kalikaneko/leap_mx,leapcode/leap_mx,kalikaneko/leap_mx-1,kalikaneko/leap_mx-1,meskio/leap_mx,kalikaneko/leap_mx,micah/leap_mx,isislovecruft/leap_mx,micah/leap_mx
src/leap/util/__init__.py
src/leap/util/__init__.py
# -*- encoding: utf-8 -*- """ mx/util/__init__.py ------------------- Initialization file for leap_mx utilities. Some miscellaneous things are stored here also. """ class Storage(dict): """ A Storage object is like a dictionary except `obj.foo` can be used in addition to `obj['foo']`. >>> o =...
agpl-3.0
Python
3752780ba804a6e167c8cecc830f8a139c3e6d0e
Add a migrate function for renaming 'hash' field to 'key'
igboyes/virtool,virtool/virtool,igboyes/virtool,virtool/virtool
virtool/caches/migrate.py
virtool/caches/migrate.py
""" Operation that should be performed on caches when the application starts. """ import os from virtool.types import App async def migrate_caches(app: App): """ Apply automatic updates to cache documents on application start. :param app: the application object """ await add_missing_field(app...
""" Operation that should be performed on caches when the application starts. """ import os from virtool.types import App async def migrate_caches(app: App): """ Apply automatic updates to cache documents on application start. :param app: the application object """ await add_missing_field(app...
mit
Python
af42cf02301d85a00664e3c476992a71d7e353bd
Drop delete field
sciosci/nsf_data_ingestion,sciosci/nsf_data_ingestion
nsf_data_ingestion/medline/process_medline_xml.py
nsf_data_ingestion/medline/process_medline_xml.py
import sys import os import findspark findspark.init() import pyspark from pyspark.sql import functions from pyspark.sql import SparkSession from pyspark.sql import Row from pyspark.sql import Window from pyspark.sql.functions import rank, max, sum, desc from os import path import zlib def create_spark_session(name):...
import sys import os import findspark findspark.init() import pyspark from pyspark.sql import functions from pyspark.sql import SparkSession from pyspark.sql import Row from pyspark.sql import Window from pyspark.sql.functions import rank, max, sum, desc from os import path import zlib def create_spark_session(name):...
apache-2.0
Python
4fb3008d3028fa6a79bea737d21559e817e6e1d8
Allow environment variable to set local IP used in STs
tomdee/libnetwork-plugin,projectcalico/libcalico,robbrockbank/libcalico,TrimBiggs/libnetwork-plugin,plwhite/libcalico,alexhersh/libcalico,projectcalico/libnetwork-plugin,insequent/libcalico,djosborne/libcalico,TrimBiggs/libcalico,caseydavenport/libcalico,Symmetric/libcalico,L-MA/libcalico,TrimBiggs/libnetwork-plugin,to...
calico_containers/tests/st/utils.py
calico_containers/tests/st/utils.py
import os import sh from sh import docker import socket from time import sleep LOCAL_IP_ENV = "MY_IP" def get_ip(): """Return a string of the IP of the hosts eth0 interface.""" try: ip = os.environ[LOCAL_IP_ENV] except KeyError: # No env variable set; try to auto detect. s = socket...
import sh from sh import docker import socket from time import sleep def get_ip(): """Return a string of the IP of the hosts eth0 interface.""" s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("8.8.8.8", 80)) ip = s.getsockname()[0] s.close() return ip def cleanup_inside(name)...
apache-2.0
Python
16b1c27c005f5f26bc0814259daf83222eee43fe
Change tagging to taggit on dev settings
opps/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,opps/opps,opps/opps,williamroot/opps,opps/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps
dev_settings.py
dev_settings.py
#!/usr/bin/env python # -*- coding: utf-8 -*- DEBUG = True TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': None } } SITE_ID = 1 USE_I18N = True USE_L10N = True USE_TZ = False STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.Fil...
#!/usr/bin/env python # -*- coding: utf-8 -*- DEBUG = True TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': None } } SITE_ID = 1 USE_I18N = True USE_L10N = True USE_TZ = False STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.Fil...
mit
Python
c2d0f5fb0adc89b0b7bbe3940d94ac95c453dca5
remove setLoggerClass (will move it to py23 module)
fonttools/fonttools,googlefonts/fonttools
Lib/fontTools/__init__.py
Lib/fontTools/__init__.py
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * import logging from fontTools.misc.loggingTools import configLogger log = logging.getLogger(__name__) version = "3.0" __all__ = ["version", "log", "configLogger"]
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * import logging from fontTools.misc.loggingTools import Logger, configLogger # set the logging.Logger class to one which supports the "last resort" handler, # to be used when the client doesn't explicitly configure loggin...
mit
Python
cdcd2755c1933a87403fab313ff596d2a2956343
Remove faker
commoncode/rea-patterns-b2c
rea_patterns_b2c/patterns/salesorder/factories.py
rea_patterns_b2c/patterns/salesorder/factories.py
import factory from django.contrib.webdesign import lorem_ipsum class SalesOrderFactory(factory.django.DjangoModelFactory): FACTORY_FOR = 'salesorder.SalesOrder' title = factory.LazyAttribute( lambda o: lorem_ipsum.words(5, common=False).title() )
import factory from django.contrib.webdesign import lorem_ipsum from faker import Factory fake = Factory.create() class SalesOrderFactory(factory.django.DjangoModelFactory): FACTORY_FOR = 'salesorder.SalesOrder' title = factory.LazyAttribute( lambda o: lorem_ipsum.words(5, common=False).title())
mit
Python
10341564138504467acde968dcf3b4d024db4833
Add with_id test
mapproxy/mapproxy-webconf,mapproxy/mapproxy-webconf,mapproxy/mapproxy-webconf
app/mapproxy_webconf/test/test_sqlitestorage.py
app/mapproxy_webconf/test/test_sqlitestorage.py
import os from mapproxy_webconf.storage import SQLiteStore from mapproxy_webconf.test.helper import TempDirTest import sqlite3 import pytest class TestSQLiteStorage(TempDirTest): def setup(self): TempDirTest.setup(self) self.storage = SQLiteStore(os.path.join(self.tmp_dir, 'test.sqlite')) def ...
import os from mapproxy_webconf.storage import SQLiteStore from mapproxy_webconf.test.helper import TempDirTest import sqlite3 import pytest class TestSQLiteStorage(TempDirTest): def setup(self): TempDirTest.setup(self) self.storage = SQLiteStore(os.path.join(self.tmp_dir, 'test.sqlite')) def ...
apache-2.0
Python
71071c98617b738b48e4dff991bd39a2095d95db
Add a couple DEPRECATED notices for pre-Krypton context items
rmrector/script.artwork.beef
context.py
context.py
import sys import xbmc from lib.artworkprocessor import ArtworkProcessor def main(mode): listitem = sys.listitem mediatype = get_mediatype(listitem) dbid = get_dbid(listitem) if dbid and mediatype: processor = ArtworkProcessor() processor.process_item(mediatype, dbid, mode) def get_m...
import sys import xbmc from lib.artworkprocessor import ArtworkProcessor def main(mode): listitem = sys.listitem mediatype = get_mediatype(listitem) dbid = get_dbid(listitem) if dbid and mediatype: processor = ArtworkProcessor() processor.process_item(mediatype, dbid, mode) def get_m...
mit
Python
f7fb8515c03b635e11b5cd98aa710a55ed6491c0
Remove unused method
BeatButton/beattie,BeatButton/beattie-bot
context.py
context.py
from __future__ import annotations # type: ignore import io from typing import TYPE_CHECKING, Any, Optional import discord from discord import Embed, Message from discord.ext import commands from utils import contextmanagers if TYPE_CHECKING: from bot import BeattieBot class BContext(commands.Context): "...
from __future__ import annotations # type: ignore import io from typing import TYPE_CHECKING, Any, Optional import discord from discord import Embed, Message from discord.ext import commands from utils import contextmanagers if TYPE_CHECKING: from bot import BeattieBot class BContext(commands.Context): "...
mit
Python
86f2265abd1412998d9fa690d3e8173b5a50b734
add function to compare different imputation algorithms
eltonlaw/impyute
impyute/utils/compare.py
impyute/utils/compare.py
"""impyute.utils.compare.py""" from sklearn.svm import SVC from sklearn.ensemble import RandomForestClassifier from sklearn.naive_bayes import GaussianNB from sklearn.neighbors import KNeighborsClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score def compare(imput...
"""impyute.utils.compare.py""" class Tester: """Automates testing of datasets, machine learning models and imputation algorithms""" def __init__(self): """ Initializes the Tester object """ pass def add(self, key, value): pass def _load_datasets(self, name): ...
mit
Python
103a4a049cb197cf5597d1640aff5aed500f73f0
Set the clock for twosys-tsunami CPUs
kaiyuanl/gem5,briancoutinho0905/2dsampling,kaiyuanl/gem5,zlfben/gem5,yb-kim/gemV,HwisooSo/gemV-update,austinharris/gem5-riscv,yb-kim/gemV,markoshorro/gem5,HwisooSo/gemV-update,qizenguf/MLC-STT,rjschof/gem5,markoshorro/gem5,qizenguf/MLC-STT,austinharris/gem5-riscv,cancro7/gem5,sobercoder/gem5,powerjg/gem5-ci-test,TUD-OS...
tests/configs/twosys-tsunami-simple-atomic.py
tests/configs/twosys-tsunami-simple-atomic.py
# Copyright (c) 2006 The Regents of The University of Michigan # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this list ...
# Copyright (c) 2006 The Regents of The University of Michigan # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this list ...
bsd-3-clause
Python
cc93a0033d3ee4fed675e73120eaf052260fd546
set default app config of crimemodel app
jayArnel/crimemapping,jayArnel/crimemapping,jayArnel/crimemapping
crimemodel/__init__.py
crimemodel/__init__.py
default_app_config = 'crimemodel.apps.CrimeModelConfig'
bsd-2-clause
Python
5d306a2e34ca270608ed96c42a5c83742089dc9a
debug code
pisceanfoot/pselenium
plettuce/webdriver.py
plettuce/webdriver.py
# -*- coding: utf-8 -*- # heavily inspiring or copy:) from https://github.com/pisceanfoot/lettuce_webdriver/blob/master/lettuce_webdriver/webdriver.py from __future__ import absolute_import, division, print_function, with_statement import logging from lettuce import step, world from selenium.webdriver.common.keys impo...
# -*- coding: utf-8 -*- # heavily inspiring or copy:) from https://github.com/pisceanfoot/lettuce_webdriver/blob/master/lettuce_webdriver/webdriver.py from __future__ import absolute_import, division, print_function, with_statement import logging from lettuce import step, world from selenium.webdriver.common.keys impo...
apache-2.0
Python
79586ec9a899f841e846fed50c4403285d683d37
Add support for Timer type 'ms'
KyleJamesWalker/mockdog
mockdog.py
mockdog.py
import logging import socket import sys import re logging.basicConfig(format='%(asctime)s %(message)s', stream=sys.stdout, level=logging.DEBUG) logger = logging.getLogger(__name__) msg_format = re.compile( r"(?P<name>.*?):(?P<value>.*?)\|(?P<type>[a-z]*)\|#(?P<tags>.*)" ) ...
import logging import socket import sys import re logging.basicConfig(format='%(asctime)s %(message)s', stream=sys.stdout, level=logging.DEBUG) logger = logging.getLogger(__name__) msg_format = re.compile( r"(?P<name>.*?):(?P<value>.*?)\|(?P<type>[a-z])\|#(?P<tags>.*)" ) ...
mit
Python
b732f0eb5ad4fdbeef69d1f0a1da81405d69e4e0
Update addcounter.py
WebShark025/ZigZag-v2,WebShark025/ZigZag-v2,WebShark025/ZigZag-v2
plugins/addcounter.py
plugins/addcounter.py
def addcounter(message): userid = message.from_user.id m = bot.send_message(message.chat.id, "Please send your message so it will get add-countererd") zigzag.nextstep(m, adcstep2) class plecho: patterns = ["^[!/]addcounter(.*)$"] # At the 'inlines' variable, you can use DEFAULTQUERY to get when there is no ...
def addcounter(message): userid = message.from_user.id userlang = redisserver.get("settings:user:language:" + str(message.from_user.id)) banlist = redisserver.sismember('zigzag_banlist', '{}'.format(userid)) if banlist: return if len(message.text.split()) < 2: bot.reply_to(message, language[userlang][...
mit
Python
702e727ffa3bed864c79c263d5601412fce219a5
Fix tabbing
kivy/plyer,kived/plyer,johnbolia/plyer,kived/plyer,kivy/plyer,KeyWeeUsr/plyer,kivy/plyer,cleett/plyer,cleett/plyer,kostyll/plyer,kostyll/plyer,johnbolia/plyer,KeyWeeUsr/plyer,KeyWeeUsr/plyer
plyer/platforms/ios/compass.py
plyer/platforms/ios/compass.py
''' iOS Compass --------------------- ''' from plyer.facades import Compass from jnius import autoclass Hardware = autoclass('org.renpy.Ios.Hardware') class IosCompass(Compass): def __init__(self): super(IosAccelerometer, self).__init__() self.bridge = autoclass('bridge').alloc().init() ...
''' iOS Compass --------------------- ''' from plyer.facades import Compass from jnius import autoclass Hardware = autoclass('org.renpy.Ios.Hardware') class IosCompass(Compass): def __init__(self): super(IosAccelerometer, self).__init__() self.bridge = autoclass('bridge').alloc().init() sel...
mit
Python
4b2954ecc721b61f7f081fd1fcb82ceed01874cd
revert previous commit, use xdg-open to open email client
kived/plyer,kived/plyer,cleett/plyer,kivy/plyer,johnbolia/plyer,kostyll/plyer,KeyWeeUsr/plyer,johnbolia/plyer,kostyll/plyer,kivy/plyer,cleett/plyer,kivy/plyer,KeyWeeUsr/plyer,KeyWeeUsr/plyer
plyer/platforms/linux/email.py
plyer/platforms/linux/email.py
import subprocess from urllib import quote from plyer.facades import Email class LinuxEmail(Email): def _send(self, **kwargs): recipient = kwargs.get('recipient') subject = kwargs.get('subject') text = kwargs.get('text') create_chooser = kwargs.get('create_chooser') uri = "...
import subprocess from urllib import quote from plyer.facades import Email class LinuxEmail(Email): def _send(self, **kwargs): recipient = kwargs.get('recipient') subject = kwargs.get('subject') text = kwargs.get('text') create_chooser = kwargs.get('create_chooser') uri = "...
mit
Python
0406728f836319515f2f1b48a3db3f91c81f195a
add doppler
mandarjog/cfawsinit
genhosts.py
genhosts.py
#!/usr/bin/env python import socket import sys import yaml from boto3.session import Session def genhosts(elbip, sysdomain, outfile=sys.stdout): SYS_PREFIXES = [ 'console', 'uaa', 'apps', 'login', 'api', 'loggregator', 'doppler'] print >>outfile, "#"*16...
#!/usr/bin/env python import socket import sys import yaml from boto3.session import Session def genhosts(elbip, sysdomain, outfile=sys.stdout): SYS_PREFIXES = [ 'console', 'uaa', 'apps', 'login', 'api', 'loggregator'] print >>outfile, "#"*16, "Generated for /e...
apache-2.0
Python
6e61f745f9a707700e08f892b9ecfe7baf0312b0
Simplify logic for branch coverage
coala/corobo,coala/corobo
plugins/searchdocs.py
plugins/searchdocs.py
import re from errbot import BotPlugin, botcmd from plugins import constants class Searchdocs(BotPlugin): """ Search API and user docs """ API_DOCS = constants.API_DOCS USER_DOCS = constants.USER_DOCS @botcmd def search(self, msg, arg): """ Gives the url of the relevant...
import re from errbot import BotPlugin, botcmd from plugins import constants class Searchdocs(BotPlugin): """ Search API and user docs """ API_DOCS = constants.API_DOCS USER_DOCS = constants.USER_DOCS @botcmd def search(self, msg, arg): """ Gives the url of the relevant...
mit
Python
d84c09e3be3c3a63e7f1550cfde752462e69ea28
Add more utils tests
JakubPetriska/poker-cfr,JakubPetriska/poker-cfr
test/utils_tests.py
test/utils_tests.py
import unittest from tools.utils import flatten, intersection, is_unique class UtilsTests(unittest.TestCase): def test_flatten(self): self.assertEqual( flatten([1, 2], [3], [4, 5]), [1, 2, 3, 4, 5]) def test_intersection_empty(self): self.assertEqual( inte...
import unittest from tools.utils import flatten class UtilsTests(unittest.TestCase): def test_flatten(self): data = [[1, 2], [3], [4, 5]] flattened = flatten(*data) self.assertEqual(flattened, [1, 2, 3, 4, 5])
mit
Python
210d2d898c9d0d29adcd190723fe3ec7767e179f
fix example predict path changed
madjam/mxnet,ykim362/mxnet,solin319/incubator-mxnet,sergeykolychev/mxnet,dmlc/mxnet,stefanhenneking/mxnet,precedenceguo/mxnet,TuSimple/mxnet,saurabh3949/mxnet,jiajiechen/mxnet,smolix/incubator-mxnet,zhreshold/mxnet,arank/mxnet,larroy/mxnet,arank/mxnet,Prasad9/incubator-mxnet,hesseltuinhof/mxnet,wangyum/mxnet,piiswrong/...
tests/python/predict/mxnet_predict_example.py
tests/python/predict/mxnet_predict_example.py
import sys, os curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) sys.path.append("../../../amalgamation/python/") sys.path.append("../../../python/") from mxnet_predict import Predictor, load_ndarray_file import mxnet as mx import logging import numpy as np from skimage import io, transform #...
import sys, os curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) sys.path.append("../../../predict/python/") sys.path.append("../../../python/") from mxnet_predict import Predictor, load_ndarray_file import mxnet as mx import logging import numpy as np from skimage import io, transform # Load...
apache-2.0
Python
1342a8094740de2f03ce4f71c6a3b7a7b4cc47ad
update with better syntax
julzhk/codekata
instant_runoff_voting.py
instant_runoff_voting.py
from collections import defaultdict, Counter def runoff(voters): """ a function that calculates an election winner from a list of voter selections using an Instant Runoff Voting algorithm. https://en.wikipedia.org/wiki/Instant-runoff_voting Each voter selects several candidates in order of preference. ...
from collections import defaultdict, Counter def runoff(voters): """ a function that calculates an election winner from a list of voter selections using an Instant Runoff Voting algorithm. https://en.wikipedia.org/wiki/Instant-runoff_voting Each voter selects several candidates in order of preference. ...
mit
Python
c90e625e97865506b7ad721a607fb6aea2a310ac
Update validation.py
espona/ckanext-envidat_theme,espona/ckanext-envidat_theme,EnviDat/ckanext-envidat_theme,EnviDat/ckanext-envidat_theme,espona/ckanext-envidat_theme,EnviDat/ckanext-envidat_theme,EnviDat/ckanext-envidat_theme
ckanext/envidat_theme/validation.py
ckanext/envidat_theme/validation.py
from ckantoolkit import _ import ckan.lib.navl.dictization_functions as df StopOnError = df.StopOnError def envidat_shortname_validator(key, data, errors, context): value = data.get(key) if not value or len(value) > 80: errors[key].append(_('text should be maximum 80 characters long')) raise...
from ckantoolkit import _ import ckan.lib.navl.dictization_functions as df StopOnError = df.StopOnError def envidat_shortname_validator(key, data, errors, context): value = data.get(key) if not value or (value) > 80: errors[key].append(_('text should be maximum 80 characters long')) raise St...
agpl-3.0
Python
97691adf2c6ac069ef0c1321876818ce6a1b5d87
Test colors
nickfrostatx/gitcontrib
test_gitcontrib.py
test_gitcontrib.py
# -*- coding: utf-8 -*- """Test them contribs.""" import gitcontrib import pytest import subprocess @pytest.fixture def git_repo(tmpdir): subprocess.check_call(['git', 'init', str(tmpdir)]) return tmpdir def test_usage(capsys): gitcontrib.usage() out, err = capsys.readouterr() assert err == 'Us...
# -*- coding: utf-8 -*- """Test them contribs.""" import gitcontrib import pytest import subprocess @pytest.fixture def git_repo(tmpdir): subprocess.check_call(['git', 'init', str(tmpdir)]) return tmpdir def test_usage(capsys): gitcontrib.usage() out, err = capsys.readouterr() assert err == 'Us...
mit
Python
b723cbceb896f7ca8690eaa13c38ffb20fecd0be
Change DataIndex to restrict on published and archived flags only
murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado
avocado/search_indexes.py
avocado/search_indexes.py
from haystack import indexes from avocado.models import DataConcept, DataField class DataIndex(indexes.SearchIndex): text = indexes.CharField(document=True, use_template=True) text_auto = indexes.EdgeNgramField(use_template=True) def index_queryset(self, using=None): return self.get_model().objec...
import warnings from haystack import indexes from avocado.conf import settings from avocado.models import DataConcept, DataField # Warn if either of the settings are set to false if not getattr(settings, 'CONCEPT_SEARCH_ENABLED', True) or \ not getattr(settings, 'FIELD_SEARCH_ENABLED', True): warnings.warn...
bsd-2-clause
Python
526faa3e383811db46d2c1780dfbcc4ae5fd3616
use integ.matrixa instead of matrixa
boykov/abiem,boykov/abiem,boykov/abiem
mpislae.py
mpislae.py
#!/usr/bin/python # -*- coding: utf-8 -*- import sys,os from savearrays import TaskElement import petsc4py petsc4py.init(sys.argv) from petsc4py import PETSc class Del2Mat: def __init__(self): pass def create(self, A): pass def mult(self, A, x, y): "y <- A * x" scatte...
#!/usr/bin/python # -*- coding: utf-8 -*- import sys,os from savearrays import TaskElement import petsc4py petsc4py.init(sys.argv) from petsc4py import PETSc class Del2Mat: def __init__(self): pass def create(self, A): pass def mult(self, A, x, y): "y <- A * x" scatte...
mit
Python
d1dbfdb62bb487bcee9155534b8cf42bbc30185c
Insert '#!' for python3
ThePrez/python-for-IBM-i-examples,Club-Seiden/-ibmi_netstat_py,Club-Seiden/python-for-IBM-i-examples,Club-Seiden/python-for-IBM-i-examples,ThePrez/-ibmi_netstat_py,ThePrez/python-for-IBM-i-examples
netstat.py
netstat.py
#!/QOpenSys/usr/bin/python3 import argparse import ibm_db # To install on the IBM i execute # easy_install3 /QOpenSys/QIBM/ProdData/OPS/Python-pkgs/ibm_db/ibm_db-2.0.5.2-py3.4-os400-powerpc.egg # Make sure you install 5733OPS-SI58194 and that you have # ibm_db-2.0.5.2 n...
import argparse import ibm_db # To install on the IBM i execute # easy_install3 /QOpenSys/QIBM/ProdData/OPS/Python-pkgs/ibm_db/ibm_db-2.0.5.2-py3.4-os400-powerpc.egg # Make sure you install 5733OPS-SI58194 and that you have # ibm_db-2.0.5.2 not ibm_db-2.0.5.1 import pl...
mit
Python
6ff32c4393cdd82c70011e2e3b033837ff537461
Include 'url' in fields to avoid 500 from the Serializer
CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend
api/v2/serializers/details/allocation_source.py
api/v2/serializers/details/allocation_source.py
import django_filters from rest_framework import serializers from core.models.allocation_source import AllocationSource, AllocationSourceSnapshot, UserAllocationBurnRateSnapshot from core.models.user import AtmosphereUser class AllocationSourceSerializer(serializers.HyperlinkedModelSerializer): compute_used = ...
import django_filters from rest_framework import serializers from core.models.allocation_source import AllocationSource, AllocationSourceSnapshot, UserAllocationBurnRateSnapshot from core.models.user import AtmosphereUser class AllocationSourceSerializer(serializers.HyperlinkedModelSerializer): compute_used = ...
apache-2.0
Python
02d451da3d3e51e017cfff47c4f28f5b757ba02c
Increase performance of Function
keon/algorithms
algorithms/arrays/limit.py
algorithms/arrays/limit.py
""" Sometimes you need to limit array result to use. Such as you only need the value over 10 or, you need value under than 100. By use this algorithms, you can limit your array to specific value If array, Min, Max value was given, it returns array that contains values of given array which was larger than Min, and...
""" Sometimes you need to limit array result to use. Such as you only need the value over 10 or, you need value under than 100. By use this algorithms, you can limit your array to specific value If array, Min, Max value was given, it returns array that contains values of given array which was larger than Min, and...
mit
Python
c0f2535d7a1477a9504f0981bbe549e7063c0651
Tweak admin images from 64x64 to 48x48
mozilla/badges.mozilla.org,deepankverma/badges.mozilla.org,mozilla/badges.mozilla.org,mozilla/badges.mozilla.org,mozilla/badges.mozilla.org,deepankverma/badges.mozilla.org,deepankverma/badges.mozilla.org,deepankverma/badges.mozilla.org
badger/admin.py
badger/admin.py
from django.conf import settings from django.contrib import admin from django import forms from django.db import models from .models import (Badge, Award, Progress) UPLOADS_URL = getattr(settings, 'BADGER_UPLOADS_URL', '%suploads/' % getattr(settings, 'MEDIA_URL', '/media/')) def show_unicode(obj): return...
from django.conf import settings from django.contrib import admin from django import forms from django.db import models from .models import (Badge, Award, Progress) UPLOADS_URL = getattr(settings, 'BADGER_UPLOADS_URL', '%suploads/' % getattr(settings, 'MEDIA_URL', '/media/')) def show_unicode(obj): return...
bsd-3-clause
Python
c954c153525265b2b4ff0d89f0cf7f89c08a136c
Remove debug toolbar in test settings
praba230890/junction,praba230890/junction,farhaanbukhsh/junction,farhaanbukhsh/junction,pythonindia/junction,ChillarAnand/junction,pythonindia/junction,praba230890/junction,ChillarAnand/junction,pythonindia/junction,nava45/junction,nava45/junction,ChillarAnand/junction,nava45/junction,ChillarAnand/junction,praba230890/...
settings/test_settings.py
settings/test_settings.py
# -*- coding: utf-8 -*-# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import os from .common import * # noqa DEBUG = True TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(ROOT_DIR, 'test.sqlite3'), ...
# -*- coding: utf-8 -*-# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import os from .common import * # noqa DEBUG = True TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(ROOT_DIR, 'test.sqlite3'), ...
mit
Python
4b01a2853bf2612b4b5521ddeb382ce59d8c16c8
Update to use Django ORM
gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo
mygpo/userfeeds/feeds.py
mygpo/userfeeds/feeds.py
from django.core.urlresolvers import reverse from mygpo.podcasts.models import Episode from mygpo.db.couchdb.episode_state import favorite_episode_ids_for_user class FavoriteFeed(): def __init__(self, user): self.user = user def title(self): return '%s\'s Favorite Episodes' % self.user.use...
from django.core.urlresolvers import reverse from mygpo.podcasts.models import Episode from mygpo.db.couchdb.episode_state import favorite_episode_ids_for_user class FavoriteFeed(): def __init__(self, user): self.user = user def title(self): return '%s\'s Favorite Episodes' % self.user.use...
agpl-3.0
Python
2ba49a42c408e33224267acde34547bd5651d619
Fix again
zstars/weblabdeusto,weblabdeusto/weblabdeusto,zstars/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,zstars/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,weblabdeusto/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,zstars/weblabdeusto,porduna/weblabdeusto,weblabdeusto/weblabdeusto,weblabdeusto/we...
tools/dashboard/dashboardserver/run_wsgi.wsgi
tools/dashboard/dashboardserver/run_wsgi.wsgi
#!/usr/bin/env python import os import sys DASHBOARD_DIR = os.path.dirname(__file__) if DASHBOARD_DIR == '': DASHBOARD_DIR = os.path.abspath('.') sys.path.insert(0, DASHBOARD_DIR) os.chdir(DASHBOARD_DIR) from dashboardserver import flask_app as app sys.stdout = open('stdout.txt', 'w', 0) sys.stderr = open(...
#!/usr/bin/env python import os import sys from dashboardserver import flask_app as app DASHBOARD_DIR = os.path.dirname(__file__) if DASHBOARD_DIR == '': DASHBOARD_DIR = os.path.abspath('.') sys.path.insert(0, DASHBOARD_DIR) os.chdir(DASHBOARD_DIR) sys.stdout = open('stdout.txt', 'w', 0) sys.stderr = open('st...
bsd-2-clause
Python
f687b0d1d06e1ed385a235d6fd3ae715b6ab4420
Clean up
kivy/plyer,kived/plyer,cleett/plyer,KeyWeeUsr/plyer,kostyll/plyer,kived/plyer,KeyWeeUsr/plyer,KeyWeeUsr/plyer,kivy/plyer,johnbolia/plyer,kivy/plyer,kostyll/plyer,cleett/plyer,johnbolia/plyer
plyer/platforms/ios/battery.py
plyer/platforms/ios/battery.py
from pyobjus import autoclass from pyobjus.dylib_manager import load_framework from plyer.facades import Battery load_framework('/System/Library/Frameworks/UIKit.framework') UIDevice = autoclass('UIDevice') class iOSBattery(Battery): def __init__(self): super(iOSBattery, self).__init__() self.dev...
from pyobjus import autoclass from pyobjus.dylib_manager import load_framework from plyer.facades import Battery load_framework('/System/Library/Frameworks/UIKit.framework') UIDevice = autoclass('UIDevice') class iOSBattery(Battery): def _get_status(self): status = {"isCharging": None, "percentage": None...
mit
Python
db4a5e9f52f60c319ac454017fa2a653623579da
Fix calibrate script
mayhem/led-chandelier,mayhem/led-chandelier,mayhem/led-chandelier
software/bin/calibrate.py
software/bin/calibrate.py
#!/usr/bin/python import os import sys import math from hippietrap.chandelier import Chandelier, BROADCAST from time import sleep, time device = "/dev/serial0" ch = Chandelier() ch.open(device) ch.clear(BROADCAST) ch.clear(BROADCAST) ch.calibrate_timers(BROADCAST) print "Calibration is complete."
#!/usr/bin/python import os import sys import math from hippietrap.chandelier import Chandelier, BROADCAST from time import sleep, time device = "/dev/serial0" ch = Chandelier() ch.open(device) ch.off(BROADCAST) ch.calibrate_timers(BROADCAST) print "Calibration is complete."
mit
Python
031a7127ce4c49b69b0da17bcf56f383780f6d66
Add some more fields
brinkframework/brink
brink/fields.py
brink/fields.py
import sys class FieldError(Exception): pass class FieldRequired(FieldError): pass class Field(object): def __init__(self, pk=False, required=False, hidden=False): self.pk = pk self.required = required self.hidden = hidden def treat(self, data): return data def validate(s...
class FieldError(Exception): pass class FieldRequired(FieldError): pass class Field(object): def __init__(self, pk=False, required=False, hidden=False): self.pk = pk self.required = required self.hidden = hidden def treat(self, data): return data def validate(self, data): ...
bsd-3-clause
Python
33311b46e80f92814269dc7416b0bde227ada8ee
Fix valid topic/channel name tests.
wtolson/gnsq,hiringsolved/gnsq,wtolson/gnsq
tests/test_basic.py
tests/test_basic.py
import pytest from gnsq import BackoffTimer from gnsq import protocol as nsq @pytest.mark.parametrize('name,good', [ ('valid_name', True), ('invalid name with space', False), ('invalid_name_due_to_length_this_is_' + (4 * 'really_') + 'long', False), ('test-with_period.', True), ('test#ephemeral',...
import pytest from gnsq import BackoffTimer from gnsq import protocol as nsq @pytest.mark.parametrize('name,good', [ ('valid_name', True), ('invalid name with space', False), ('invalid_name_due_to_length_this_is_really_really_really_long', False), ('test-with_period.', True), ('test#ephemeral', F...
bsd-3-clause
Python
f92162c10d153f7c021aa564ef951fb1f20b45b6
remove an empty line
thefab/tbucket,thefab/tbucket
tests/test_bench.py
tests/test_bench.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import tornado.testing import tbucket class BenchTestCase(tornado.testing.AsyncTestCase): def test_generate_1B_body(self): x = tbucket.bench_generate_1B_body() self.assertEqual(len(x), 1) def test_generate_1kB_body(self): x = tbucket.be...
#!/usr/bin/env python # -*- coding: utf-8 -*- import tornado.testing import tbucket class BenchTestCase(tornado.testing.AsyncTestCase): def test_generate_1B_body(self): x = tbucket.bench_generate_1B_body() self.assertEqual(len(x), 1) def test_generate_1kB_body(self): x = tbucket.be...
mit
Python
b7ffe15b7d90c3222ec5469ea5a255221e10a818
update hist mock
morgenst/PyAnalysisTools,morgenst/PyAnalysisTools,morgenst/PyAnalysisTools
tests/unit/Mocks.py
tests/unit/Mocks.py
import ROOT from mock import MagicMock, Mock def clone_and_rename(name='Clone'): h = ROOT.TH1F(name, '', 2, 0., 1.) return h hist = Mock() hist.GetName = MagicMock(return_value='foo') hist.GetNbinsX = MagicMock(return_value=2) hist.Clone = MagicMock(side_effect=clone_and_rename)
from mock import MagicMock, Mock hist = Mock() hist.GetName = MagicMock(return_value='foo')
mit
Python
c13b3fa0522ff93aa3d12c07d00a291fad58f0b2
Add LEX_ATTRS
spacy-io/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,spacy-io/spaCy,explosion/spaCy,recognai/spaCy,explosion/spaCy,explosion/spaCy,recognai/spaCy,aikramer2/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,honnibal/spaCy,recognai/spaCy,aikramer2/spaCy,honnibal/spaCy,spacy-io/spaCy,aikramer2/...
spacy/lang/pt/__init__.py
spacy/lang/pt/__init__.py
# coding: utf8 from __future__ import unicode_literals from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS from .stop_words import STOP_WORDS from .lex_attrs import LEX_ATTRS from .lemmatizer import LOOKUP from ..tokenizer_exceptions import BASE_EXCEPTIONS from ...language import Language from ...lemmatizerlookup ...
# coding: utf8 from __future__ import unicode_literals from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS from .stop_words import STOP_WORDS from .lemmatizer import LOOKUP from ..tokenizer_exceptions import BASE_EXCEPTIONS from ...language import Language from ...lemmatizerlookup import Lemmatizer from ...attrs i...
mit
Python
fa1ac4a685ac5e2dc1ce9fde005f1ed8fd81df5e
Handle input_var_source in hook
csdms/wmt-metadata
metadata/FrostNumberGeoModel/hooks/pre-stage.py
metadata/FrostNumberGeoModel/hooks/pre-stage.py
"""A hook for modifying parameter values read from the WMT client.""" import os import shutil from wmt.utils.hook import find_simulation_input_file, yaml_dump from topoflow_utils.hook import assign_parameters file_list = [] def execute(env): """Perform pre-stage tasks for running a component. Parameters ...
"""A hook for modifying parameter values read from the WMT client.""" import os import shutil from wmt.utils.hook import find_simulation_input_file, yaml_dump from topoflow_utils.hook import assign_parameters file_list = [] def execute(env): """Perform pre-stage tasks for running a component. Parameters ...
mit
Python
cd90d26320e63563cc3be247743f5dd1e6ea6e20
fix import
caktus/rapidsms-twilio
rtwilio/views.py
rtwilio/views.py
from django.http import HttpResponse from rtwilio.models import TwilioResponse from rtwilio.forms import StatusCallbackForm from threadless_router.backends.http.forms import HttpForm from threadless_router.backends.http.views import BaseHttpBackendView class TwilioBackendView(BaseHttpBackendView): form_class =...
from django.http import HttpResponse from rtwilio.models import TwilioResponse from rtwilio.forms import StatusCallbackForm from threadless_router.backends.http.froms import HttpForm from threadless_router.backends.http.views import BaseHttpBackendView class TwilioBackendView(BaseHttpBackendView): form_class =...
bsd-3-clause
Python
40e6c319450ddfbf289575428248e92336deaa36
Handle ImportError in nanogenui script due to missing deps.
androomerrill/scikit-nano,scikit-nano/scikit-nano,androomerrill/scikit-nano,scikit-nano/scikit-nano
sknano/scripts/nanogenui.py
sknano/scripts/nanogenui.py
# -*- coding: utf-8 -*- #!/usr/bin/env python """ ====================================================== NanoGen GUI CLI (:mod:`sknano.scripts.nanogenui`) ====================================================== .. currentmodule:: sknano.scripts.nanogenui """ from __future__ import absolute_import, print_function, divi...
# -*- coding: utf-8 -*- #!/usr/bin/env python """ ====================================================== NanoGen GUI CLI (:mod:`sknano.scripts.nanogenui`) ====================================================== .. currentmodule:: sknano.scripts.nanogenui """ from __future__ import absolute_import, print_function, divi...
bsd-2-clause
Python
0ff3ccb64145620597c963132fec44a00764b139
make fresh a clone whenever this test is run, prevents --unshallow error
GoogleChrome/wptdashboard,GoogleChrome/wptdashboard,GoogleChrome/wptdashboard
run/shas_test.py
run/shas_test.py
#!/usr/bin/env python # Copyright 2017 The WPT Dashboard Project. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import logging import mock import os import shas import shutil import subprocess import unittest from datetime import date here...
#!/usr/bin/env python # Copyright 2017 The WPT Dashboard Project. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import logging import mock import os import shas import subprocess import unittest from datetime import date here = os.path.dir...
apache-2.0
Python
f36e5aa91a7cdeb70076d18a1467e7193959ec8a
Check for correct scaling in completeness check.
jgosmann/plume,jgosmann/plume
plume/check-completeness.py
plume/check-completeness.py
#!/usr/bin/env python import argparse import itertools import os.path def checkfiles_for_paramstr(directory, paramstr, num_trials): for i in range(num_trials): filename = '{}.{}.h5'.format(paramstr, i) if not os.path.exists(os.path.join(directory, filename)): print filename if __nam...
#!/usr/bin/env python import argparse import itertools import os.path def checkfiles_for_paramstr(directory, paramstr, num_trials): for i in range(num_trials): filename = '{}.{}.h5'.format(paramstr, i) if not os.path.exists(os.path.join(directory, filename)): print filename if __nam...
mit
Python
34162e5b4c44b9f898915c5f09cc7695ea24cf97
Fix import
nabla-c0d3/sslyze
sslyze/connection_helpers/http_request_generator.py
sslyze/connection_helpers/http_request_generator.py
from sslyze import __version__ class HttpRequestGenerator: HTTP_GET_FORMAT = ( "GET / HTTP/1.1\r\n" "Host: {host}\r\n" "User-Agent: {user_agent}\r\n" "Accept: */*\r\n" "Connection: close\r\n\r\n" ) DEFAULT_USER_AGENT = ( "Mozilla/5.0 (Windows NT 6.1; WOW64...
import sslyze class HttpRequestGenerator: HTTP_GET_FORMAT = ( "GET / HTTP/1.1\r\n" "Host: {host}\r\n" "User-Agent: {user_agent}\r\n" "Accept: */*\r\n" "Connection: close\r\n\r\n" ) DEFAULT_USER_AGENT = ( "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537...
agpl-3.0
Python
bcfe242b81b5594f307bbb6c6be8f6320562a971
Fix logging error for LXCImage
AdaptiveScale/lxdui,AdaptiveScale/lxdui,AdaptiveScale/lxdui,AdaptiveScale/lxdui
app/api/models/LXCImage.py
app/api/models/LXCImage.py
from app.api.models.LXDModule import LXDModule import logging class LXCImage(LXDModule): def __init__(self, input): self.data = {} if not input.get('remoteHost'): self.remoteHost = '127.0.0.1' else: self.remoteHost = input.get('remoteHost') if not input.get(...
from app.api.models.LXDModule import LXDModule import logging class LXCImage(LXDModule): def __init__(self, input): self.data = {} if not input.get('remoteHost'): self.remoteHost = '127.0.0.1' else: self.remoteHost = input.get('remoteHost') if not input.get(...
apache-2.0
Python
2fbb83c9d8ab3330e7eb6f9e5d9189b530fa6ece
Remove unused methods
ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner
app/authentication/user.py
app/authentication/user.py
import logging from app.storage.storage_factory import StorageFactory from flask_login import UserMixin logger = logging.getLogger(__name__) class User(UserMixin): def __init__(self, user_id, user_ik): if user_id and user_ik: self.user_id = user_id self.user_ik = user_ik ...
import logging from app.storage.storage_factory import StorageFactory from flask_login import UserMixin logger = logging.getLogger(__name__) class User(UserMixin): def __init__(self, user_id, user_ik): if user_id and user_ik: self.user_id = user_id self.user_ik = user_ik ...
mit
Python
b0eefd48ca7177198da248346b7b505cf52abc24
Bump version for a new deploy to pypi
cjrh/biodome
biodome.py
biodome.py
""" biodome ======= Controlled environments. """ import os import logging __version__ = '2017.6.0' logger = logging.getLogger(__name__) def biodome(name, default=None, cast=None): # type: (str, Any, Callable) -> Any raw_value = os.environ.get(name) if raw_value is None: return default raw...
""" biodome ======= Controlled environments. """ import os import logging __version__ = '0.1.0' logger = logging.getLogger(__name__) def biodome(name, default=None, cast=None): # type: (str, Any, Callable) -> Any raw_value = os.environ.get(name) if raw_value is None: return default raw_va...
apache-2.0
Python
b9f67d575a042ac7238abee835a7aee4a775ee7c
add docstrings and remove unused stuff from sift_test.py
carlodef/s2p,carlodef/s2p,mnhrdt/s2p,mnhrdt/s2p
tests/sift_test.py
tests/sift_test.py
# s2p.sift testing module # Copyright (C) 2019, Carlo de Franchis (CMLA) <carlo.de-franchis@ens-paris-saclay.fr> # Copyright (C) 2019, Julien Michel (CNES) <julien.michel@cnes.fr> import numpy as np import rpcm from s2p import sift from tests_utils import data_path def test_image_keypoints(): """ Unit test ...
# s2p (Satellite Stereo Pipeline) testing module # Copyright (C) 2019, Carlo de Franchis (CMLA) <carlo.de-franchis@ens-paris-saclay.fr> # Copyright (C) 2019, Julien Michel (CNES) <julien.michel@cnes.fr> import os import numpy as np import rpcm import s2p from s2p import sift from s2p import config from tests_utils im...
agpl-3.0
Python
2fc8acd8ed1d54c90d72dc0827d1b681dcb12ae1
test old auth headers invalid
Storj/storjcore,littleskunk/storjcore
tests/test_auth.py
tests/test_auth.py
import time import unittest from btctxstore import BtcTxStore from storjcore import auth class TestConfig(unittest.TestCase): def setUp(self): self.btctxstore = BtcTxStore() self.sender_wif = self.btctxstore.create_key() self.sender = self.btctxstore.get_address(self.sender_wif) s...
import unittest from btctxstore import BtcTxStore from storjcore import auth class TestConfig(unittest.TestCase): def test_it(self): btctxstore = BtcTxStore() sender_wif = btctxstore.create_key() timeout = 2 sender = btctxstore.get_address(sender_wif) recipient = btctxstor...
mit
Python
29918637f775ff02dfee027aa5008df169491a10
Fix deprecation warning.
skorokithakis/catt,skorokithakis/catt
tests/test_catt.py
tests/test_catt.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import unittest from catt import catt class TestThings(unittest.TestCase): def test_get_stream_url(self): url = catt.get_stream_url("https://www.youtube.com/watch?v=VZMfhtKa-wo") self.assertIn("https://", url) def test_cache(self): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import unittest from catt import catt class TestThings(unittest.TestCase): def test_get_stream_url(self): url = catt.get_stream_url("https://www.youtube.com/watch?v=VZMfhtKa-wo") self.assertIn("https://", url) def test_cache(self): ...
bsd-2-clause
Python
d36a4453eb6b62f8eda4614f276fdf9ba7afb26a
Fix compatible error about capsys.
yanqd0/csft
tests/test_main.py
tests/test_main.py
# -*- coding:utf-8 -*- from os.path import curdir, devnull from subprocess import check_call from pytest import fixture, mark, raises from csft import __main__ as main @fixture def null(): with open(devnull, 'w') as fobj: yield fobj def test_call(null): check_call(['python', '-m', 'csft', 'csft']...
# -*- coding:utf-8 -*- from os.path import curdir, devnull from subprocess import check_call from pytest import fixture, mark, raises from csft import __main__ as main @fixture def null(): with open(devnull, 'w') as fobj: yield fobj def test_call(null): check_call(['python', '-m', 'csft', 'csft']...
mit
Python
59efdc8e18d2ba74c47d8ff50fe8a521461a9c93
テスト : ログのテスト
ayziao/niascape,ayziao/niascape,ayziao/niascape,ayziao/niascape
tests/test_main.py
tests/test_main.py
from unittest import TestCase import niascape class TestMyPackage(TestCase): def test_run(self): ref = niascape.run() self.assertEqual('top', ref) ref = niascape.run('top') self.assertEqual('top', ref) # モジュール変数をうっかり呼ばないか ref = niascape.run('basedata') self.assertEqual('No Action', ref) ref = nias...
from unittest import TestCase import niascape class TestMyPackage(TestCase): def test_run(self): ref = niascape.run() self.assertEqual('top', ref) ref = niascape.run('top') self.assertEqual('top', ref) ref = niascape.run('hoge') self.assertEqual('No Action', ref) # モジュール変数をうっかり呼ばないか ref = niascap...
mit
Python
763b40d223e5e5512494a97f8335e16960e6adc3
Raise correct Warning in kubernetes/backcompat/volume_mount.py (#12432)
bolkedebruin/airflow,cfei18/incubator-airflow,mistercrunch/airflow,airbnb/airflow,lyft/incubator-airflow,mistercrunch/airflow,airbnb/airflow,apache/airflow,mrkm4ntr/incubator-airflow,nathanielvarona/airflow,nathanielvarona/airflow,sekikn/incubator-airflow,apache/airflow,mistercrunch/airflow,Acehaidrey/incubator-airflow...
airflow/providers/cncf/kubernetes/backcompat/volume_mount.py
airflow/providers/cncf/kubernetes/backcompat/volume_mount.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
e6dca4cabf195daf9918026dcec9555e5f6a4251
Add reset buffer, fix connect
dotoscat/Polytank-ASIR
polytanks/protocol.py
polytanks/protocol.py
#Copyright (C) 2017 Oscar Triano 'dotoscat' <dotoscat (at) gmail (dot) com> #This program is free software: you can redistribute it and/or modify #it under the terms of the GNU Affero General Public License as #published by the Free Software Foundation, either version 3 of the #License, or (at your option) any later ...
#Copyright (C) 2017 Oscar Triano 'dotoscat' <dotoscat (at) gmail (dot) com> #This program is free software: you can redistribute it and/or modify #it under the terms of the GNU Affero General Public License as #published by the Free Software Foundation, either version 3 of the #License, or (at your option) any later ...
agpl-3.0
Python
2b50ad020e736e75b9ed50a9bf971ce529922364
Remove second zip
alexandermendes/pybossa-analyst,alexandermendes/pybossa-analyst,alexandermendes/pybossa-analyst,LibCrowds/libcrowds-analyst
pybossa_analyst/zip_builder.py
pybossa_analyst/zip_builder.py
# -*- coding: utf8 -*- """Zip builder module for pybossa-analyst.""" import requests import zipstream def _stream_content(url): """Stream response data.""" r = requests.get(url, stream=True) for chunk in r.iter_content(): yield chunk def _generate_zip(tasks, fn_key, url_key): """Generate a ...
# -*- coding: utf8 -*- """Zip builder module for pybossa-analyst.""" import requests import zipstream def _stream_content(url): """Stream response data.""" r = requests.get(url, stream=True) for chunk in r.iter_content(): yield chunk def _generate_zip(tasks, fn_key, url_key): """Generate a ...
unknown
Python
87acf306addc60d7678ff980aef4b87f4225839b
Determine winning hand & compare to nut hand.
zimolzak/poker-experiments,zimolzak/poker-experiments,zimolzak/poker-experiments
theo_actual_nut.py
theo_actual_nut.py
from itertools import combinations from deuces.deuces import Card, Evaluator, Deck from nuts import nut_hand evaluator = Evaluator() deck = Deck() flop = deck.draw(3) def omaha_eval(hole, board): assert(len(hole)) == 4 ranks = [] for ph in combinations(hole, 2): thisrank = evaluator.evaluate(list(...
from itertools import combinations from deuces.deuces import Card, Evaluator, Deck from nuts import nut_hand evaluator = Evaluator() deck = Deck() flop = deck.draw(3) def omaha_eval(hole, board): assert(len(hole)) == 4 ranks = [] for ph in combinations(hole, 2): thisrank = evaluator.evaluate(list(...
mit
Python