commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
d041c9244a36db5aef29412824e9346aceb53c9f
editorconfig/__init__.py
editorconfig/__init__.py
""" Modules exported by ``editorconfig`` package: - handler: used by plugins for locating and parsing EditorConfig files - exceptions: provides special exceptions used by other modules """ from versiontools import join_version VERSION = (0, 9, 0, "alpha") __all__ = ['handler', 'exceptions', 'main'] __version__ = j...
""" Modules exported by ``editorconfig`` package: - handler: used by plugins for locating and parsing EditorConfig files - exceptions: provides special exceptions used by other modules """ from versiontools import join_version VERSION = (0, 9, 0, "alpha") __all__ = ['get_properties', 'EditorConfigError', 'handler',...
Add get_properties class for simpler plugin usage
Add get_properties class for simpler plugin usage
Python
bsd-2-clause
VictorBjelkholm/editorconfig-vim,VictorBjelkholm/editorconfig-vim,pocke/editorconfig-vim,dublebuble/editorconfig-gedit,benjifisher/editorconfig-vim,benjifisher/editorconfig-vim,dublebuble/editorconfig-gedit,johnfraney/editorconfig-vim,dublebuble/editorconfig-gedit,VictorBjelkholm/editorconfig-vim,johnfraney/editorconfi...
898ce6f5c77b6a63b0c34bd2a858483d0cb7083a
schedule.py
schedule.py
#!/usr/bin/python NUMTEAMS = 12 ROUNDBITS = 4 MATCHBITS = 4 SLOTBITS = 2 print "(set-info :status unknown)" print "(set-option :produce-models true)" print "; Logic is now \"Whatever Z3 accepts\" (set-logic AUFBV)" print "" # Configurable number of enum members print "(declare-datatypes () ((TEAM " for i in range(N...
#!/usr/bin/python # More flexible parameters NUMROUNDS = 2 NUMMATCHES = 3 # More built in parameters. NUMTEAMS = 12 ROUNDBITS = 4 MATCHBITS = 4 SLOTBITS = 2 print "(set-info :status unknown)" print "(set-option :produce-models true)" print "; Logic is now \"Whatever Z3 accepts\" (set-logic AUFBV)" print "" # Config...
Prepare to distinct all slots per round.
Prepare to distinct all slots per round.
Python
bsd-2-clause
jmorse/numbness
0a73d75d5b58c3326d248875cac46ab1bc95bea3
viper/parser/grammar_parsing/production.py
viper/parser/grammar_parsing/production.py
from .production_part import ProductionPart from typing import List class Production: def __str__(self): return repr(self) class RuleAliasProduction(Production): def __init__(self, rule_name: str): self.name = rule_name def __repr__(self): return "<" + self.name + ">" class N...
from .production_part import ProductionPart from typing import List class Production: def __init__(self, name: str): self.name = name def __str__(self): return repr(self) class RuleAliasProduction(Production): def __init__(self, rule_name: str): super().__init__(rule_name) ...
Move name field to Production superclass
Move name field to Production superclass
Python
apache-2.0
pdarragh/Viper
97c9cb7e80e72f13befc4cc7effb11402b238df9
i3pystatus/pianobar.py
i3pystatus/pianobar.py
from i3pystatus import IntervalModule class Pianobar(IntervalModule): """ Shows the title and artist name of the current music In pianobar config file must be setted the fifo and event_command options (see man pianobar for more information) Mouse events: - Left click play/pauses - Right ...
from i3pystatus import IntervalModule class Pianobar(IntervalModule): """ Shows the title and artist name of the current music In pianobar config file must be setted the fifo and event_command options (see man pianobar for more information) For the event_cmd use: https://github.com/jlucchese...
Add optional event_cmd bash file into the docs
Add optional event_cmd bash file into the docs
Python
mit
onkelpit/i3pystatus,paulollivier/i3pystatus,opatut/i3pystatus,ismaelpuerto/i3pystatus,fmarchenko/i3pystatus,paulollivier/i3pystatus,schroeji/i3pystatus,asmikhailov/i3pystatus,facetoe/i3pystatus,opatut/i3pystatus,yang-ling/i3pystatus,plumps/i3pystatus,claria/i3pystatus,richese/i3pystatus,ncoop/i3pystatus,MaicoTimmerman/...
0c6480390f7984b2a85649bb539e7d6231506ef9
oneflow/base/templatetags/base_utils.py
oneflow/base/templatetags/base_utils.py
# -*- coding: utf-8 -*- from django import template from django.template.base import Node, TemplateSyntaxError from django.utils.encoding import smart_text register = template.Library() class FirstOfAsNode(Node): def __init__(self, vars, variable_name=None): self.vars = vars self.variable_name =...
# -*- coding: utf-8 -*- from django import template from django.template.base import Node, TemplateSyntaxError from django.utils.encoding import smart_text register = template.Library() class FirstOfAsNode(Node): def __init__(self, args, variable_name=None): self.vars = args self.variable_name =...
Fix the `firstofas` template tag returning '' too early.
Fix the `firstofas` template tag returning '' too early.
Python
agpl-3.0
WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow
aa6c638f6aac2f452049f6314e5885c8e02fd874
quotations/apps/api/v1.py
quotations/apps/api/v1.py
from tastypie.authorization import DjangoAuthorization from tastypie import fields from tastypie.resources import ModelResource, ALL_WITH_RELATIONS from quotations.apps.quotations import models as quotations_models from quotations.libs.auth import MethodAuthentication from quotations.libs.serializers import Serializer ...
from tastypie.authorization import DjangoAuthorization from tastypie import fields from tastypie.resources import ModelResource, ALL_WITH_RELATIONS from quotations.apps.quotations import models as quotations_models from quotations.libs.auth import MethodAuthentication from quotations.libs.serializers import Serializer ...
Allow filtering by author name
Allow filtering by author name
Python
mit
jessamynsmith/underquoted,jessamynsmith/socialjusticebingo,jessamynsmith/underquoted,jessamynsmith/underquoted,jessamynsmith/socialjusticebingo,jessamynsmith/socialjusticebingo,jessamynsmith/underquoted
e189844bd6179d49665deb1c9ef56206213fc800
hungry/__init__.py
hungry/__init__.py
__version__ = '0.0.5' def eat(*ex, **kwargs): error_handler = kwargs.get('error_handler', None) error_value = kwargs.get('error_value', None) def inner(func): def wrapper(*args, **kw): def caught_it(e): """ Calls the error handler or returns ...
__version__ = '0.0.5' def eat(*ex, **kwargs): error_handler = kwargs.get('error_handler', None) error_value = kwargs.get('error_value', None) def inner(func): def wrapper(*args, **kw): def caught_it(e): """ Calls the error handler or returns ...
Fix bug: Did not catch all exceptions
Fix bug: Did not catch all exceptions
Python
mit
denizdogan/hungry
4303a55096edae7f7968bd0b252aa2eddaba2e9b
registries/serializers.py
registries/serializers.py
from rest_framework import serializers from registries.models import Organization from gwells.models import ProvinceState class DrillerListSerializer(serializers.ModelSerializer): province_state = serializers.ReadOnlyField() class Meta: model = Organization # Using all fields for now ...
from rest_framework import serializers from registries.models import Organization from gwells.models import ProvinceState class DrillerListSerializer(serializers.ModelSerializer): """ Serializer for Driller model "list" view. """ province_state = serializers.ReadOnlyField(source="province_state.code"...
Add fields to driller list serializer
Add fields to driller list serializer
Python
apache-2.0
bcgov/gwells,bcgov/gwells,bcgov/gwells,rstens/gwells,rstens/gwells,bcgov/gwells,rstens/gwells,rstens/gwells
13e70f822e3cf96a0604bb4ce6ed46dbe2dcf376
zsl/application/initializers/__init__.py
zsl/application/initializers/__init__.py
""" :mod:`asl.application.initializers` -- ASL initializers ======================================================= :platform: Unix, Windows :synopsis: The Atteq Service Layer initialization infrastructure .. moduleauthor:: Martin Babka <babka@atteq.com> """ from .logger_initializer import LoggerInitializer fr...
""" :mod:`asl.application.initializers` -- ASL initializers ======================================================= :platform: Unix, Windows :synopsis: The Atteq Service Layer initialization infrastructure .. moduleauthor:: Martin Babka <babka@atteq.com> """ injection_views = [] injection_modules = [] def in...
FIX import order - cyclic dependencies
FIX import order - cyclic dependencies
Python
mit
AtteqCom/zsl,AtteqCom/zsl
47de6d882c41eda98cda7e8e6ade2457591bbfa1
CoTeTo/CoTeTo/__init__.py
CoTeTo/CoTeTo/__init__.py
#-*- coding:utf-8 -*- # # This file is part of CoTeTo - a code generation tool # 201500225 Joerg Raedler jraedler@udk-berlin.de # import sys __version__ = '0.2' # python version check # please handle py27 a s a special case which may be removed later v = sys.version_info if v >= (3, 3): py33 = True py27 = F...
#-*- coding:utf-8 -*- # # This file is part of CoTeTo - a code generation tool # 201500225 Joerg Raedler jraedler@udk-berlin.de # import sys __version__ = '0.2' # python version check # please handle py27 a s a special case which may be removed later v = sys.version_info if v >= (3, 3): py33 = True py27 = F...
Add hot patching of mako at runtime to fix the line ending bug. This is just a temporary solution.
Add hot patching of mako at runtime to fix the line ending bug. This is just a temporary solution.
Python
mit
EnEff-BIM/EnEffBIM-Framework,EnEff-BIM/EnEffBIM-Framework,EnEff-BIM/EnEffBIM-Framework
389ca2213c2ba3c86c783372e3e933a12f90506e
ckanext/requestdata/controllers/admin.py
ckanext/requestdata/controllers/admin.py
from ckan.lib import base from ckan import logic from ckan.plugins import toolkit get_action = logic.get_action NotFound = logic.NotFound NotAuthorized = logic.NotAuthorized redirect = base.redirect abort = base.abort BaseController = base.BaseController class AdminController(BaseController): def email(self): ...
from ckan.lib import base from ckan import logic from ckan.plugins import toolkit from ckan.controllers.admin import AdminController get_action = logic.get_action NotFound = logic.NotFound NotAuthorized = logic.NotAuthorized redirect = base.redirect abort = base.abort BaseController = base.BaseController class Admi...
Extend Admin instead of Base controller
Extend Admin instead of Base controller
Python
agpl-3.0
ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata
b0ce15be3e9e24a5540215e9931ffbddc2ae42f7
glanceclient/__init__.py
glanceclient/__init__.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack LLC # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack LLC # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
Fix problem running glance --version
Fix problem running glance --version __version__ should point to a string and not VersionInfo Fixes LP# 1164760 Change-Id: I27d366af5ed89d0931ef46eb1507e6ba0eec0b6e
Python
apache-2.0
metacloud/python-glanceclient,openstack/python-glanceclient,varunarya10/python-glanceclient,ntt-sic/python-glanceclient,klmitch/python-glanceclient,klmitch/python-glanceclient,ntt-sic/python-glanceclient,metacloud/python-glanceclient,alexpilotti/python-glanceclient,varunarya10/python-glanceclient,mmasaki/python-glancec...
c252281ab4ba9570c8f54f3fff6e173cf4d60866
learning_journal/scripts/initializedb.py
learning_journal/scripts/initializedb.py
import os import sys import transaction from sqlalchemy import engine_from_config from pyramid.paster import ( get_appsettings, setup_logging, ) from pyramid.scripts.common import parse_vars from ..models import ( DBSession, Entry, Base, ) def usage(argv): cmd = os.path.basename(ar...
import os import sys import transaction from sqlalchemy import engine_from_config from pyramid.paster import ( get_appsettings, setup_logging, ) from pyramid.scripts.common import parse_vars from ..models import ( DBSession, Entry, Base, ) def usage(argv): cmd = os.path.basename(ar...
Remove multiple users capability from initailize_db
Remove multiple users capability from initailize_db
Python
mit
DZwell/learning_journal,DZwell/learning_journal,DZwell/learning_journal
35af67eb270c5ee177eb264c339c6f9dd390a288
fits/make_fit_feedmes.py
fits/make_fit_feedmes.py
#!/usr/bin/env python from glob import glob import os import re def make_feedmes(): # One-time script # Used to convert all the fit*.galfit files to fit*.diff ids = glob('*/') for id in ids: os.chdir(id) feedmes = glob('fit*diff') # output starting models for f in feedm...
#!/usr/bin/env python from glob import glob import os import re def make_feedmes(): # One-time script # Used to convert all the fit*.galfit files to fit*.diff ids = glob('*/') for id in ids: os.chdir(id) feedmes = glob('fit*diff') # output starting models for f in feedm...
Make sure all fit feedmes get made
Make sure all fit feedmes get made
Python
mit
MegaMorph/galfitm-illustrations,MegaMorph/galfitm-illustrations
7e407d1185235f4a89bddcaffcde240a33b522f4
expand_region_handler.py
expand_region_handler.py
try: import javascript import html except: from . import javascript from . import html def expand(string, start, end, extension=None): if(extension in ["html", "htm", "xml"]): return html.expand(string, start, end) return javascript.expand(string, start, end)
import re try: import javascript import html except: from . import javascript from . import html def expand(string, start, end, extension=None): if(re.compile("html|htm|xml").search(extension)): return html.expand(string, start, end) return javascript.expand(string, start, end)
Use html strategy for any file that has xml/html in file extension. This will will match shtml, xhtml and so on.
Use html strategy for any file that has xml/html in file extension. This will will match shtml, xhtml and so on.
Python
mit
aronwoost/sublime-expand-region,johyphenel/sublime-expand-region,johyphenel/sublime-expand-region
4e0e29199ce01c7ac8f71af78013911da11a8dc0
LandPortalEntities/lpentities/interval.py
LandPortalEntities/lpentities/interval.py
''' Created on 02/02/2014 @author: Miguel Otero ''' from .time import Time class Interval(Time): ''' classdocs ''' MONTHLY = "http://purl.org/linked-data/sdmx/2009/code#freq-M" YEARLY = "http://purl.org/linked-data/sdmx/2009/code#freq-A" def __init__(self, frequency = YEARLY, start_time=Non...
''' Created on 02/02/2014 @author: Miguel Otero ''' from .time import Time class Interval(Time): ''' classdocs ''' MONTHLY = "freq-M" YEARLY = "freq-A" def __init__(self, frequency=YEARLY, start_time=None, end_time=None): ''' Constructor ''' self.frequency = ...
Remove ontology reference in Interval frequency value
Remove ontology reference in Interval frequency value
Python
mit
weso/landportal-importers,landportal/landbook-importers,landportal/landbook-importers
f888de27f382b295af889da37fcb289c582bc4bd
appserver/controllers/nfi_nav_handler.py
appserver/controllers/nfi_nav_handler.py
import os import shutil import splunk.appserver.mrsparkle.controllers as controllers from splunk.appserver.mrsparkle.lib.decorators import expose_page APP = 'SplunkforPaloAltoNetworks' ENABLED_NAV = os.path.join(os.environ['SPLUNK_HOME'], 'etc', 'apps', APP, 'default', 'data', 'ui', 'nav', 'default.xml.nfi_enabled') D...
import os import shutil import splunk.appserver.mrsparkle.controllers as controllers from splunk.appserver.mrsparkle.lib.decorators import expose_page APP = 'SplunkforPaloAltoNetworks' ENABLED_NAV = os.path.join(os.environ['SPLUNK_HOME'], 'etc', 'apps', APP, 'default', 'data', 'ui', 'nav', 'default.xml.nfi_enabled') D...
Revert "Corrected issue with Navigation change controller so it uses 'local' directory instead of 'default'."
Revert "Corrected issue with Navigation change controller so it uses 'local' directory instead of 'default'." This reverts commit 167a753db3ff6027c19a06db8adeecfabedb7ee1. The commit may cause an issue with upgrades because users would have to remove the default.xml from the local directory after every upgrade. Furt...
Python
isc
PaloAltoNetworks-BD/SplunkforPaloAltoNetworks
b4d8329f1d586160c60963270794d72372f38b03
rollbar/examples/twisted/simpleserv.py
rollbar/examples/twisted/simpleserv.py
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # # From https://twistedmatrix.com/documents/current/_downloads/simpleserv.py from twisted.internet import reactor, protocol import rollbar def bar(p): # These local variables will be sent to Rollbar and available in the UI a = 33 ...
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # # From https://twistedmatrix.com/documents/current/_downloads/simpleserv.py # NOTE: pyrollbar requires both `Twisted` and `treq` packages to be installed from twisted.internet import reactor, protocol import rollbar def bar(p): # These ...
Add note about required additional packages installation
Add note about required additional packages installation
Python
mit
rollbar/pyrollbar
339c27437287949b7fb2e1d36be08c922da80bc4
rotational-cipher/rotational_cipher.py
rotational-cipher/rotational_cipher.py
import string UPPER = string.ascii_uppercase LOWER = string.ascii_lowercase def rotate(s, n): return "".join(rot_gen(s,n)) def shift_rules(n): shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n] return {k:v for k,v in zip(UPPER+LOWER, shifted)} def rot_gen(s, n): rules = shift_rules(n) f...
import string UPPER = string.ascii_uppercase LOWER = string.ascii_lowercase def rotate(s, n): rules = shift_rules(n) return "".join(map(lambda k: rules.get(k, k), s)) def shift_rules(n): shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n] return {k:v for k,v in zip(UPPER+LOWER, shifted)}
Use lambda function with method
Use lambda function with method
Python
agpl-3.0
CubicComet/exercism-python-solutions
d0c71df95c4024462339396638397939893d1abb
httpobs/scanner/utils.py
httpobs/scanner/utils.py
import socket def valid_hostname(hostname: str): """ :param hostname: The hostname requested in the scan :return: Hostname if it's valid, otherwise None """ # First, let's try to see if it's an IPv4 address try: socket.inet_aton(hostname) # inet_aton() will throw an exception if host...
import socket def valid_hostname(hostname: str): """ :param hostname: The hostname requested in the scan :return: Hostname if it's valid, otherwise None """ # Block attempts to scan things like 'localhost' if '.' not in hostname or 'localhost' in hostname: return False # First, l...
Add additional invalid host detection
Add additional invalid host detection
Python
mpl-2.0
mozilla/http-observatory,april/http-observatory,mozilla/http-observatory,april/http-observatory,mozilla/http-observatory,april/http-observatory
6a55bacff334905ad19e437c3ea26653f452dfbe
mastering-python/ch04/CollectionsComprehensions.py
mastering-python/ch04/CollectionsComprehensions.py
#List l = [x for x in range(1, 10)] print(l) l2 = [x ** 2 for x in range(1, 10)] print(l2) l3 = [x for x in range(1, 10) if x % 2 == 0] print(l3) tlist = [(x, y) for x in range(1, 3) for y in (5, 7)] print(tlist) print(list(range(10))) matrix = [ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12] ] for x in...
#List l = [x for x in range(1, 10)] print(l) l2 = [x ** 2 for x in range(1, 10)] print(l2) l3 = [x for x in range(1, 10) if x % 2 == 0] print(l3) tlist = [(x, y) for x in range(1, 3) for y in (5, 7)] print(tlist) print(list(range(10))) matrix = [ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12] ] for x in...
Add dict and set comprehension demo.
Add dict and set comprehension demo.
Python
apache-2.0
precompiler/python-101
17e20665a5d9675e82bf1aadbc9eb4cb0f79c07f
housing/listings/urls.py
housing/listings/urls.py
from django.conf.urls import url from django.contrib.auth.decorators import login_required from django.contrib.auth import views from . import views app_name="listings" urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^accounts/register/$', views.register, name='register'), url(r'^accounts/re...
from django.conf.urls import url from django.contrib.auth.decorators import login_required from django.contrib.auth import views from django.contrib import admin from django.conf import settings from django.conf.urls.static import static from . import views app_name="listings" urlpatterns = [ url(r'^$', views.i...
Add media to url, for development only
Add media to url, for development only
Python
mit
xyb994/housing,xyb994/housing,xyb994/housing,xyb994/housing
3d6e25bd2df7e3591b9810888ae24ad2317b2b96
tests/drawing/demo_rectangle.py
tests/drawing/demo_rectangle.py
#!/usr/bin/env python3 """A green rectangle should take up most of the screen.""" import pyglet import glooey import vecrec print(__doc__) window = pyglet.window.Window() batch = pyglet.graphics.Batch() rect = vecrec.Rect.from_pyglet_window(window) rect.shrink(50) glooey.drawing.Rectangle(rect, batch=batch) @win...
#!/usr/bin/env python3 """Two green rectangles should take up most of the screen.""" import pyglet import glooey import vecrec print(__doc__) window = pyglet.window.Window() batch = pyglet.graphics.Batch() full = vecrec.Rect.from_pyglet_window(window) left = vecrec.Rect(full.left, full.bottom, full.width/2, full.h...
Make sure GL_QUADS don't end up weirdly connected.
Make sure GL_QUADS don't end up weirdly connected.
Python
mit
kxgames/glooey,kxgames/glooey
c46ee50229c13dc8b10e72fe8cb0f6dc9755cda4
indra/bel/ndex_client.py
indra/bel/ndex_client.py
import requests import json import time ndex_base_url = 'http://general.bigmech.ndexbio.org:8082' #ndex_base_url = 'http://52.37.175.128' def send_request(url_suffix, params): res = requests.post(ndex_base_url + url_suffix, data=json.dumps(params)) res_json = get_result(res) return res_json def get_resul...
import requests import json import time ndex_base_url = 'http://bel2rdf.bigmech.ndexbio.org' #ndex_base_url = 'http://52.37.175.128' def send_request(url_suffix, params): res = requests.post(ndex_base_url + url_suffix, data=json.dumps(params)) res_json = get_result(res) return res_json def get_result(res...
Update URL for bel2rdf service
Update URL for bel2rdf service
Python
bsd-2-clause
sorgerlab/belpy,pvtodorov/indra,sorgerlab/belpy,jmuhlich/indra,johnbachman/belpy,sorgerlab/indra,johnbachman/indra,pvtodorov/indra,johnbachman/indra,jmuhlich/indra,pvtodorov/indra,sorgerlab/indra,bgyori/indra,johnbachman/belpy,sorgerlab/indra,sorgerlab/belpy,johnbachman/belpy,jmuhlich/indra,johnbachman/indra,bgyori/ind...
eae949e483e1d30e8c11b662bb07e9d30dcf39c5
lc0049_group_anagrams.py
lc0049_group_anagrams.py
"""Leetcode 49. Group Anagrams Medium URL: https://leetcode.com/problems/group-anagrams/ Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] Note: - All inputs will be in lowercase. - The order ...
"""Leetcode 49. Group Anagrams Medium URL: https://leetcode.com/problems/group-anagrams/ Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] Note: - All inputs will be in lowercase. - The order ...
Revise to anagram_lists and rename to sorted anagram dict class
Revise to anagram_lists and rename to sorted anagram dict class
Python
bsd-2-clause
bowen0701/algorithms_data_structures
a9844bad75c66e10f85be4555c9ad7aa2df15585
src/trajectory_server.py
src/trajectory_server.py
#!/usr/bin/env python import rospy from trajectory_tracking.srv import TrajectoryPoint, TrajectoryPointResponse from geometry_msgs.msg import Point def compute_position(request): t = request.t position = Point() position.x = 0.05 * t position.y = 0.05 * t position.z = 0.0 return position if...
#!/usr/bin/env python import rospy from trajectory_tracking.srv import TrajectoryPoint from geometry_msgs.msg import Point def compute_position(request): t = request.t position = Point() position.x = 0.05 * t position.y = 0.05 * t position.z = 0.0 return position if __name__ == '__main__': ...
Remove import that was not used
Remove import that was not used
Python
mit
bit0001/trajectory_tracking,bit0001/trajectory_tracking
09927a3ff7594213419c1445896aaa0e1d86f4f8
pavement.py
pavement.py
from paver.easy import * @task def clean(): for fl in ['BuildNotify.egg-info', 'build', 'dist', 'deb_dist']: p = path(fl) p.rmtree() @task def mk_resources(): sh('pyuic4 -o buildnotifylib/preferences_ui.py data/preferences.ui') sh('pyuic4 -o buildnotifylib/server_configuration_ui.p...
from paver.easy import * @task def clean(): for fl in ['BuildNotify.egg-info', 'build', 'dist', 'deb_dist']: p = path(fl) p.rmtree() @task def mk_resources(): sh('pyuic4 -o buildnotifylib/preferences_ui.py data/preferences.ui') sh('pyuic4 -o buildnotifylib/server_configuration_ui.p...
Set force-buildsystem to false so that it can work on opensuse buildservice
Set force-buildsystem to false so that it can work on opensuse buildservice
Python
mit
rwilsonncsa/buildnotify
dbdab865343c0c17655fb662ac5e939eb24758c8
labelprinterServeConf.py
labelprinterServeConf.py
import os # HTTP-Server SERVER_PORT = 8000 SERVER_DEFAULT_TEMPLATE = '/choose' # PRINTER PRINTER_TIMEOUT = 10 # in seconds PRINTER_HOST = '172.22.26.67' PRINTER_PORT = 9100 # error logging SENTRY_DSN = None # try to overwrite default vars with the local config file try: from labelprinterServeConf_local import ...
import os # HTTP-Server SERVER_PORT = 8000 SERVER_DEFAULT_TEMPLATE = '/choose' # PRINTER PRINTER_TIMEOUT = 10 # in seconds PRINTER_HOST = '172.22.26.67' PRINTER_PORT = 9100 # error logging SENTRY_DSN = None # try to overwrite default vars with the local config file try: from labelprinterServeConf_local import ...
Read SENTRY_DSN from a secret if it exists.
Read SENTRY_DSN from a secret if it exists.
Python
mit
chaosdorf/labello,chaosdorf/labello,chaosdorf/labello
cbb925f09f4ad5fbe3a23ec7e9816184653e0acf
tests/test_web_caller.py
tests/test_web_caller.py
from unittest import TestCase from modules.web_caller import get_google class TestWebCaller(TestCase): """ Tests for the `web_caller` module. """ def test_get_google(self): """ Calling `get_google` works as expected. """ response = get_google() self.assertEqu...
from unittest import TestCase from mock import NonCallableMock, patch from modules.web_caller import get_google, GOOGLE_URL class TestWebCaller(TestCase): """ Tests for the `web_caller` module. """ @patch('modules.web_caller.requests.get') def test_get_google(self, get): """ Call...
Change get_google test to use mock
Change get_google test to use mock
Python
mit
tkh/test-examples,tkh/test-examples
40b6b5db450c92fd5d64186981be433c47b43afd
tests/test_wish_utils.py
tests/test_wish_utils.py
# -*- coding: utf-8 -*- import pkg_resources import wish_utils def test_import_modules(): # normal code path, pytest is a dependency distributions = [pkg_resources.get_distribution('pytest')] distributions_modules = wish_utils.import_modules(distributions) assert len(distributions_modules) == 1 ...
# -*- coding: utf-8 -*- import pkg_resources import wish_utils def test_import_coverage(): """Fix the coverage by pytest-cov, that may trigger after pytest_wish is already imported.""" from imp import reload # Python 2 and 3 reload import wish_utils reload(wish_utils) def test_import_modules(): ...
Fix pytest-cov coverage of wish_utils.
Fix pytest-cov coverage of wish_utils.
Python
mit
alexamici/pytest-wish,nodev-io/pytest-nodev,alexamici/pytest-nodev
f3d8cb7f173b671b38dda6c4a917b1056dbab767
benchexec/tools/lctd.py
benchexec/tools/lctd.py
""" BenchExec is a framework for reliable benchmarking. This file is part of BenchExec. Copyright (C) 2007-2015 Dirk Beyer 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 ...
""" BenchExec is a framework for reliable benchmarking. This file is part of BenchExec. Copyright (C) 2007-2015 Dirk Beyer 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 ...
Add assertion that no options are passed to LCTD
Add assertion that no options are passed to LCTD Attempting to pass options to the current version of LCTD would cause it to crash.
Python
apache-2.0
sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,martin-neuhaeusser/benchexec,IljaZakharov/benchexec,dbeyer/benchexec,IljaZakharov/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,martin-neuhaeusser/benchexec,martin-neuhaeusser/benchexec,IljaZakharo...
28c88cbc34dcf2af5c98ce3f3eed3774dd5be15e
lcapy/discretetime.py
lcapy/discretetime.py
"""This module provides discrete-time support. It introduces three special variables: n for discrete-time sequences k for discrete-frequency sequences z for z-transforms. Copyright 2020--2021 Michael Hayes, UCECE """ import sympy as sym from .sym import sympify from .nexpr import nexpr, n from .kexpr impor...
"""This module provides discrete-time support. It introduces three special variables: n for discrete-time sequences k for discrete-frequency sequences z for z-transforms. Copyright 2020--2021 Michael Hayes, UCECE """ import sympy as sym from .sym import sympify from .nexpr import nexpr, n from .kexpr impor...
Handle container types for discrete-time expr
Handle container types for discrete-time expr
Python
lgpl-2.1
mph-/lcapy
a2b9777cc7ec4d606d3a33400c4f242bc9177fab
awx/main/migrations/0004_rbac_migrations.py
awx/main/migrations/0004_rbac_migrations.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from awx.main.migrations import _rbac as rbac from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main', '0003_rbac_changes'), ] operations = [ migrations.RunPython(rbac.migrate_organi...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from awx.main.migrations import _rbac as rbac from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main', '0003_rbac_changes'), ] operations = [ migrations.RunPython(rbac.migrate_users)...
Add migrate_users and migrate_projects to our migration plan
Add migrate_users and migrate_projects to our migration plan
Python
apache-2.0
wwitzel3/awx,snahelou/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx
946213058ba049fecaffdfa6e88e69295e042edf
mining/urls.py
mining/urls.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from .views import MainHandler, ProcessHandler, DashboardHandler INCLUDE_URLS = [ (r"/process/(?P<slug>[\w-]+).json", ProcessHandler), (r"/dashboard/(?P<slug>[\w-]+)", DashboardHandler), (r"/", MainHandler), ]
#!/usr/bin/env python # -*- coding: utf-8 -*- from .views import MainHandler, ProcessHandler, DashboardHandler from .views import ProcessWebSocket INCLUDE_URLS = [ (r"/process/(?P<slug>[\w-]+).ws", ProcessWebSocket), (r"/process/(?P<slug>[\w-]+).json", ProcessHandler), (r"/dashboard/(?P<slug>[\w-]+)", Das...
Create url enter Process WebSocket
Create url enter Process WebSocket
Python
mit
seagoat/mining,mlgruby/mining,AndrzejR/mining,seagoat/mining,mining/mining,AndrzejR/mining,chrisdamba/mining,avelino/mining,mlgruby/mining,jgabriellima/mining,mining/mining,mlgruby/mining,chrisdamba/mining,avelino/mining,jgabriellima/mining
023109283545141dc0ed88a8a7f67d7c21da2a89
oauth/api/serializers.py
oauth/api/serializers.py
from rest_framework import serializers class UserSerializer(serializers.Serializer): username = serializers.CharField(max_length=255) email = serializers.CharField(max_length=255) id = serializers.IntegerField()
from rest_framework import serializers class UserSerializer(serializers.Serializer): username = serializers.CharField(max_length=200) id = serializers.IntegerField()
Revert "Try to add email to OAuth response"
Revert "Try to add email to OAuth response" This reverts commit 91a047755a66dc2cf0e029b1de606b94925dd297.
Python
mit
ZeusWPI/oauth,ZeusWPI/oauth
8006e448aae885c9eb9255dec01bb11cb5c19f5c
migrations/versions/201505061404_3b997c7a4f0c_use_proper_type_and_fk_for_booked_for_id.py
migrations/versions/201505061404_3b997c7a4f0c_use_proper_type_and_fk_for_booked_for_id.py
"""Use proper type and FK for booked_for_id Revision ID: 3b997c7a4f0c Revises: 2b4b4bce2165 Create Date: 2015-05-06 14:04:14.590496 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '3b997c7a4f0c' down_revision = '2b4b4bce2165' def upgrade(): op.execute('AL...
"""Use proper type and FK for booked_for_id Revision ID: 3b997c7a4f0c Revises: 2bb9dc6f5c28 Create Date: 2015-05-06 14:04:14.590496 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '3b997c7a4f0c' down_revision = '2bb9dc6f5c28' def upgrade(): op.execute('AL...
Fix alembic branch due to change in master
Fix alembic branch due to change in master
Python
mit
ThiefMaster/indico,ThiefMaster/indico,ThiefMaster/indico,indico/indico,mvidalgarcia/indico,OmeGak/indico,DirkHoffmann/indico,mic4ael/indico,mvidalgarcia/indico,DirkHoffmann/indico,DirkHoffmann/indico,OmeGak/indico,OmeGak/indico,indico/indico,mic4ael/indico,pferreir/indico,mvidalgarcia/indico,DirkHoffmann/indico,pferrei...
beee964585dfc79b3c83deadce7b68922350f9be
pneumatic/utils.py
pneumatic/utils.py
import time class Utils(object): """ A few things we'll (eventually) use. """ def __init__(self): # These are file types we do not want to send to DocumentCloud. self.file_excludes = ( 'aiff', 'DS_Store', 'flac', 'mid', 'mdb'...
import os import time class Utils(object): """ A few things we'll (eventually) use. """ def __init__(self): # These are file types we do not want to send to DocumentCloud. self.file_excludes = ( 'aiff', 'DS_Store', 'flac', 'mid', ...
Remove files with size larger than 400MB from upload list
Remove files with size larger than 400MB from upload list
Python
mit
anthonydb/pneumatic
b2803c40b2fcee7ab466c83fc95bb693a28576d0
messageboard/views.py
messageboard/views.py
from django.shortcuts import render from .models import Message from .serializers import MessageSerializer from .permissions import IsOwnerOrReadOnly from rest_framework import generics, permissions from rest_framework.permissions import IsAuthenticated from rest_framework import viewsets from rest_framework.decorators...
from django.shortcuts import render from .models import Message from .serializers import MessageSerializer from .permissions import IsOwnerOrReadOnly from rest_framework import generics, permissions from rest_framework.permissions import IsAuthenticated from rest_framework import viewsets from rest_framework.decorators...
Use temporary file and fix to image save handling
Use temporary file and fix to image save handling
Python
mit
DjangoBeer/message-board,DjangoBeer/message-board,fmarco/message-board,DjangoBeer/message-board,fmarco/message-board,fmarco/message-board
9a9ab21b66991171fc7b6288d9c734dc05d82a3d
firecares/firestation/management/commands/export-building-fires.py
firecares/firestation/management/commands/export-building-fires.py
from django.core.management.base import BaseCommand from firecares.firestation.models import FireDepartment class Command(BaseCommand): """ This command is used to export data that department heat maps visualize. """ help = 'Creates a sql file to export building fires from.' def handle(self, *ar...
from django.core.management.base import BaseCommand from firecares.firestation.models import FireDepartment class Command(BaseCommand): """ This command is used to export data that department heat maps visualize. """ help = 'Creates a sql file to export building fires from.' def handle(self, *ar...
Update export building fires command.
Update export building fires command.
Python
mit
FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,meilinger/firecares,HunterConnelly/firecares,meilinger/firecares,FireCARES/firecares,FireCARES/firecares,HunterConnelly/firecares,HunterConnelly/firecares,HunterConnelly/firecares,meilinger/firecares,meilinger/firecares
aa50aa09416512003f95eefa83a805d4bb2bc96a
cheroot/test/test_wsgi.py
cheroot/test/test_wsgi.py
"""Test wsgi.""" import threading import pytest import portend from cheroot import wsgi @pytest.fixture def simple_wsgi_server(): """Fucking simple wsgi server fixture (duh).""" port = portend.find_available_local_port() def app(environ, start_response): status = '200 OK' response_head...
"""Test wsgi.""" import threading import pytest import portend from cheroot import wsgi @pytest.fixture def simple_wsgi_server(): """Fucking simple wsgi server fixture (duh).""" port = portend.find_available_local_port() def app(environ, start_response): status = '200 OK' response_head...
Stop the server when done.
Stop the server when done.
Python
bsd-3-clause
cherrypy/cheroot
7f345e78f6825c676282114029a6c230dd063bfe
pinax/images/admin.py
pinax/images/admin.py
from django.contrib import admin from .models import ImageSet, Image class ImageInline(admin.TabularInline): model = Image fields = ["image", "preview"] readonly_fields = ["preview"] def preview(self, obj): return "<img src='{}' />".format(obj.small_thumbnail.url) preview.allow_tags = Tr...
from django.contrib import admin from .models import ImageSet, Image class ImageInline(admin.TabularInline): model = Image fields = ["image", "created_by", "preview"] readonly_fields = ["preview"] def preview(self, obj): return "<img src='{}' />".format(obj.small_thumbnail.url) preview.a...
Add "created_by" in inline fields
Add "created_by" in inline fields Image couldn't be added via django admin, simply add "created_by" in inlines fields to make it working.
Python
mit
arthur-wsw/pinax-images,pinax/pinax-images
5a2fcbbc12c1876ff01ad3a4a14ad2077ffedf5c
runtests.py
runtests.py
#!/usr/bin/python import unittest import doctest import sys from optparse import OptionParser # Import this now to avoid it throwing errors. import pytz if __name__ == '__main__': suite = unittest.TestSuite() from firmant import du suite.addTest(doctest.DocTestSuite(du)) from firmant import entries ...
#!/usr/bin/python import unittest import doctest import sys from optparse import OptionParser from firmant.utils import get_module # Import this now to avoid it throwing errors. import pytz if __name__ == '__main__': suite = unittest.TestSuite() modules = ['firmant.du', 'firmant.entries', ...
Change module doctest creation to be more dynamic.
Change module doctest creation to be more dynamic.
Python
bsd-3-clause
rescrv/firmant
fcd15442281428c6c3edcf88ecf65dd162246070
rcamp/lib/pam_backend.py
rcamp/lib/pam_backend.py
from django.conf import settings from accounts.models import ( RcLdapUser, User ) import pam class PamBackend(): def authenticate(self, request, username=None, password=None): rc_user = RcLdapUser.objects.get_user_from_suffixed_username(username) if not rc_user: return None ...
from django.conf import settings from accounts.models import ( RcLdapUser, User ) import pam import logging logger = logging.getLogger('accounts') class PamBackend(): def authenticate(self, request, username=None, password=None): rc_user = RcLdapUser.objects.get_user_from_suffixed_username(usernam...
Add logging for user auth attempts
Add logging for user auth attempts
Python
mit
ResearchComputing/RCAMP,ResearchComputing/RCAMP,ResearchComputing/RCAMP,ResearchComputing/RCAMP
d488c1e021c3ce4335223a407cbd82182fd83708
symposion/cms/managers.py
symposion/cms/managers.py
from datetime import datetime from django.db import models class PublishedPageManager(models.Manager): return qs.filter(publish_date__lte=datetime.now()) def get_queryset(self): qs = super(PublishedPageManager, self).get_queryset()
from django.utils import timezone from django.db import models class PublishedPageManager(models.Manager): def get_queryset(self): qs = super(PublishedPageManager, self).get_queryset() return qs.filter(publish_date__lte=timezone.now())
Use timezone.now instead of datetime.now
Use timezone.now instead of datetime.now
Python
bsd-3-clause
pyconau2017/symposion,pydata/symposion,faulteh/symposion,pyohio/symposion,euroscipy/symposion,pinax/symposion,euroscipy/symposion,pyconau2017/symposion,toulibre/symposion,miurahr/symposion,faulteh/symposion,miurahr/symposion,pydata/symposion,pinax/symposion,pyohio/symposion,toulibre/symposion
ac3edaab39a32d4108ec04746358f833d3dee7ca
convert_caffe_to_chainer.py
convert_caffe_to_chainer.py
#!/usr/bin/env python from __future__ import print_function import sys from chainer.functions import caffe import cPickle as pickle import_model = "bvlc_googlenet.caffemodel" print('Loading Caffe model file %s...' % import_model, file=sys.stderr) model = caffe.CaffeFunction(import_model) print('Loaded', file=sys.std...
#!/usr/bin/env python from __future__ import print_function import sys from chainer.functions import caffe import cPickle as pickle # import_model = "bvlc_googlenet.caffemodel" # # print('Loading Caffe model file %s...' % import_model, file=sys.stderr) # # model = caffe.CaffeFunction(import_model) # print('Loaded', fi...
Add input file name and output file name setting function
Add input file name and output file name setting function
Python
mit
karaage0703/deeplearning-learning
8e7cabd8e3bb9e3e01f49823692c5609665cd4ad
conda_manager/app/main.py
conda_manager/app/main.py
# -*- coding:utf-8 -*- # # Copyright © 2015 The Spyder Development Team # Copyright © 2014 Gonzalo Peña-Castellanos (@goanpeca) # # Licensed under the terms of the MIT License """ Application entry point. """ # Standard library imports import sys # Local imports from conda_manager.utils.qthelpers import qapplication...
# -*- coding:utf-8 -*- # # Copyright © 2015 The Spyder Development Team # Copyright © 2014 Gonzalo Peña-Castellanos (@goanpeca) # # Licensed under the terms of the MIT License """ Application entry point. """ # Standard library imports import sys # Local imports from conda_manager.utils.qthelpers import qapplication...
Set AppUserModelID so that the app has the right icon on Windows
Set AppUserModelID so that the app has the right icon on Windows
Python
mit
spyder-ide/conda-manager,spyder-ide/conda-manager
29dbdd805eb401da5a46ff26d759f249650bedeb
src/enru.py
src/enru.py
import urllib from bs4 import BeautifulSoup class Enru: def __init__(self, parser): self.parser = parser def run(self, word, show_examples): # TODO: throw error if there's no word url = self.get_url(word) markup = self.fetch(url) content = self.parse(markup, show_exa...
import urllib from bs4 import BeautifulSoup class Enru: def __init__(self, parser): self.parser = parser def run(self, word, show_examples): url = self.get_url(word) markup = self.fetch(url) content = self.parse(markup, show_examples) return content def fetch(sel...
Remove unneeded TODO Click takes care of arguments actually
Remove unneeded TODO Click takes care of arguments actually
Python
mit
everyonesdesign/enru,everyonesdesign/enru-python,everyonesdesign/enru-python,everyonesdesign/enru
4336a5d3eaf5500a6f3041b30c7887361dea5737
tests/test_formatting.py
tests/test_formatting.py
# -*- coding: utf-8 -*- import click def test_basic_functionality(runner): @click.command() def cli(): """First paragraph. This is a very long second paragraph and not correctly wrapped but it will be rewrapped. \b This is a paragraph without r...
# -*- coding: utf-8 -*- import click def test_basic_functionality(runner): @click.command() def cli(): """First paragraph. This is a very long second paragraph and not correctly wrapped but it will be rewrapped. \b This is a paragraph without r...
Add failing test for formatting
Add failing test for formatting
Python
bsd-3-clause
her0e1c1/click,MakerDAO/click,Akasurde/click,scalp42/click,khwilson/click,polinom/click,amjith/click,hellodk/click,jvrsantacruz/click,naoyat/click,lucius-feng/click,dastergon/click,TomRegan/click,hackebrot/click,cbandera/click,oss6/click,GeoffColburn/click,willingc/click,pallets/click,pgkelley4/click,glorizen/click,mit...
219f67e3e15c548b81211b0baff475621f66a7fa
scripts/dbutil/compute_asos_sts.py
scripts/dbutil/compute_asos_sts.py
# Look into the ASOS database and figure out the start time of various # sites for a given network. import sys sys.path.insert(0, '../lib') import db, network asos = db.connect('asos') mesosite = db.connect('mesosite') net = sys.argv[1] table = network.Table( net ) ids = `tuple(table.sts.keys())` rs = asos.query("...
# Look into the ASOS database and figure out the start time of various # sites for a given network. import iemdb, network, sys asos = iemdb.connect('asos', bypass=True) acursor = asos.cursor() mesosite = iemdb.connect('mesosite') mcursor = mesosite.cursor() net = sys.argv[1] table = network.Table( net ) ids = `tup...
Make the output less noisey, more informative
Make the output less noisey, more informative
Python
mit
akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem
9ea29573841307ffe24b597dd8d1e0b783f81a2a
tests/app/views/test_application.py
tests/app/views/test_application.py
import mock from nose.tools import assert_equal, assert_true from ...helpers import BaseApplicationTest class TestApplication(BaseApplicationTest): def setup(self): super(TestApplication, self).setup() def test_should_have_analytics_on_page(self): res = self.client.get('/') assert_equ...
import mock from nose.tools import assert_equal, assert_true from ...helpers import BaseApplicationTest class TestApplication(BaseApplicationTest): def setup(self): super(TestApplication, self).setup() def test_analytics_code_should_be_in_javascript(self): res = self.client.get('/static/javas...
Correct test to point at application.js
Correct test to point at application.js The JS to search was previously in the page rather than concatenated into the main JavaScript file.
Python
mit
alphagov/digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,mtekel/digitalmarketplace-buyer-frontend,mtekel/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,AusDTO/dto-digitalm...
f7a1a849161007e3703b41758e99dd45609c9753
renovation_tax_be/models/account_invoice.py
renovation_tax_be/models/account_invoice.py
from odoo import models, api class AccountInvoice(models.Model): _inherit = "account.invoice" @api.onchange('fiscal_position_id') def somko_update_tax(self): for line in self.invoice_line_ids: line._onchange_product_id()
from odoo import models, api class AccountInvoice(models.Model): _inherit = "account.invoice" @api.onchange('fiscal_position_id') def somko_update_tax(self): for line in self.invoice_line_ids: price = line.unit_price line._onchange_product_id() line.unit_price ...
Fix loss of unit price if edited
Fix loss of unit price if edited
Python
agpl-3.0
Somko/Odoo-Public,Somko/Odoo-Public
84c4aa73e6792dad6853866c66c756073df71f27
tests/test_replace_all.py
tests/test_replace_all.py
import unittest, os, sys from custom_test_case import CustomTestCase PROJECT_ROOT = os.path.dirname(__file__) sys.path.append(os.path.join(PROJECT_ROOT, "..")) from CodeConverter import CodeConverter class TestReplaceAll(unittest.TestCase, CustomTestCase): # All replacement def test_replace_objc(self): ...
import unittest, os, sys from custom_test_case import CustomTestCase PROJECT_ROOT = os.path.dirname(__file__) sys.path.append(os.path.join(PROJECT_ROOT, "..")) from CodeConverter import CodeConverter class TestReplaceAll(unittest.TestCase, CustomTestCase): # All replacement def test_replace_objc(self): ...
Test for block with multi args
Test for block with multi args
Python
mit
kyamaguchi/SublimeObjC2RubyMotion,kyamaguchi/SublimeObjC2RubyMotion
a47b5506476f9d0e4dbb2eb24cd22da61f42eb65
bixi/api.py
bixi/api.py
from tastypie.resources import ModelResource from models import Station class StationResource(ModelResource): class Meta: allowed_methods = ['get'] queryset = Station.objects.all() resource_name = 'station'
from tastypie.resources import ModelResource from models import Station, Update class StationResource(ModelResource): def dehydrate(self, bundle): update = Update.objects.filter(station__id=bundle.data['id']).latest() bundle.data['nb_bikes'] = update.nb_bikes bundle.data['nb_empty_docks']...
Include the number of available bikes and docks from the latest update.
Include the number of available bikes and docks from the latest update.
Python
bsd-3-clause
flebel/django-bixi
5fc0854f54f2946c2b38a8b3c03a553c8a838aed
shale/webdriver.py
shale/webdriver.py
from selenium import webdriver from selenium.webdriver.remote.switch_to import SwitchTo from selenium.webdriver.remote.mobile import Mobile from selenium.webdriver.remote.errorhandler import ErrorHandler from selenium.webdriver.remote.remote_connection import RemoteConnection class ResumableRemote(webdriver.Remote): ...
from selenium import webdriver from selenium.webdriver.remote.switch_to import SwitchTo from selenium.webdriver.remote.mobile import Mobile from selenium.webdriver.remote.errorhandler import ErrorHandler from selenium.webdriver.remote.remote_connection import RemoteConnection class ResumableRemote(webdriver.Remote): ...
Fix a string type-checking bug.
Fix a string type-checking bug.
Python
mit
cardforcoin/shale,mhluongo/shale,mhluongo/shale,cardforcoin/shale
023568228dc2ffcf772edb4d5335c0c755a7e37c
revel/setup.py
revel/setup.py
import subprocess import sys import os import setup_util import time def start(args): setup_util.replace_text("revel/src/benchmark/conf/app.conf", "tcp\(.*:3306\)", "tcp(" + args.database_host + ":3306)") subprocess.call("go get github.com/robfig/revel/cmd", shell=True, cwd="revel") subprocess.call("go build -o ...
import subprocess import sys import os import setup_util import time def start(args): setup_util.replace_text("revel/src/benchmark/conf/app.conf", "tcp\(.*:3306\)", "tcp(" + args.database_host + ":3306)") subprocess.call("go get -u github.com/robfig/revel/revel", shell=True, cwd="revel") subprocess.call("go buil...
Update start process to reflect new path for /cmd
Update start process to reflect new path for /cmd
Python
bsd-3-clause
raziel057/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,sxend/FrameworkBenchmarks,Dith3r/FrameworkBenchmarks,kbrock/FrameworkBenchmarks,Synchro/FrameworkBenchmarks,kbrock/FrameworkBenchmarks,xitrum-framework/FrameworkBenchmarks,circlespainter/FrameworkBenchmarks,Ocramius/FrameworkBenchmarks,fabianmurariu/Framework...
999ff373d40dd98f3ffccb2478ac6d464e3332e3
flask_gzip.py
flask_gzip.py
import gzip import StringIO from flask import request class Gzip(object): def __init__(self, app, compress_level=6): self.app = app self.compress_level = compress_level self.app.after_request(self.after_request) def after_request(self, response): accept_encoding = request.head...
import gzip import StringIO from flask import request class Gzip(object): def __init__(self, app, compress_level=6, minimum_size=500): self.app = app self.compress_level = compress_level self.minimum_size = minimum_size self.app.after_request(self.after_request) def after_requ...
Fix Accept-Encoding match (split would result in ' gzip', which doesn't match.
Fix Accept-Encoding match (split would result in ' gzip', which doesn't match. Add minimum_size attribute.
Python
mit
libwilliam/flask-compress,libwilliam/flask-compress,saymedia/flask-compress,libwilliam/flask-compress,saymedia/flask-compress,wichitacode/flask-compress,wichitacode/flask-compress
c878a67815ef47abdb0bf4203a23ac0ece4feda6
src/CameraImage.py
src/CameraImage.py
import gtk, gobject import numpy as N class CameraImage(gtk.Image): __gproperties__ = { 'data' : (gobject.TYPE_PYOBJECT, 'Image data', 'NumPy ndarray containing the data', gobject.PARAM_READWRITE) } def __init__(self): gtk.Image.__gobject_init__...
import gtk, gobject import numpy as N class CameraImage(gtk.Image): __gproperties__ = { 'data' : (gobject.TYPE_PYOBJECT, 'Image data', 'NumPy ndarray containing the data', gobject.PARAM_READWRITE) } def __init__(self): gtk.Image.__gobject_init__...
Convert data to unsigned 8-bit when displaying
Convert data to unsigned 8-bit when displaying
Python
mit
ptomato/Beams
4a65dacb992ef48dbbaf9ca168f0b4e5567abe90
falmer/content/models/selection_grid.py
falmer/content/models/selection_grid.py
from wagtail.core import blocks from wagtail.core.blocks import RichTextBlock from wagtail.core.fields import StreamField from wagtail.admin.edit_handlers import TabbedInterface, StreamFieldPanel, ObjectList from falmer.content.blocks import HeroImageBlock, FalmerImageChooserBlock from falmer.content.models.core impor...
from wagtail.core import blocks from wagtail.core.blocks import RichTextBlock from wagtail.core.fields import StreamField from wagtail.admin.edit_handlers import TabbedInterface, StreamFieldPanel, ObjectList from falmer.content import components from falmer.content.blocks import HeroImageBlock, FalmerImageChooserBlock...
Add text to selection grid
Add text to selection grid
Python
mit
sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer
ecd0c00766304f1e5b12e6067a846033a4ee36d5
txlege84/topics/admin.py
txlege84/topics/admin.py
from django.contrib import admin from topics.models import Issue, StoryPointer, Stream, Topic admin.site.register(Topic) admin.site.register(Issue) admin.site.register(Stream) admin.site.register(StoryPointer)
from django.contrib import admin from topics.models import Issue, StoryPointer, Stream, Topic @admin.register(Issue) class IssueAdmin(admin.ModelAdmin): prepopulated_fields = {'slug': ('name',)} admin.site.register(Topic) admin.site.register(Stream) admin.site.register(StoryPointer)
Move Issue ModelAdmin to new register syntax
Move Issue ModelAdmin to new register syntax
Python
mit
texastribune/txlege84,texastribune/txlege84,texastribune/txlege84,texastribune/txlege84
d76cbdd768964a2583cf28ab9efaf46964c815ae
swf/core.py
swf/core.py
# -*- coding:utf-8 -*- from boto.swf.layer1 import Layer1 AWS_CREDENTIALS = { 'aws_access_key_id': None, 'aws_secret_access_key': None } def set_aws_credentials(aws_access_key_id, aws_secret_access_key): """Set default credentials.""" AWS_CREDENTIALS.update({ 'aws_access_key_id': aws_access_...
# -*- coding:utf-8 -*- from boto.swf.layer1 import Layer1 AWS_CREDENTIALS = { #'aws_access_key_id': AWS_ACCESS_KEY_ID, #'aws_secret_access_key': AWS_SECRET_ACCESS_KEY, } def set_aws_credentials(aws_access_key_id, aws_secret_access_key): """Set default credentials.""" AWS_CREDENTIALS.update({ ...
Update ConnectedSWFObject: raise KeyError if credentials are not set
Update ConnectedSWFObject: raise KeyError if credentials are not set
Python
mit
botify-labs/python-simple-workflow,botify-labs/python-simple-workflow
abb1d2db9052391c78fb09952b58a5331046aae5
pylinks/links/tests.py
pylinks/links/tests.py
from django.test import TestCase from .models import Category, Link class CategoryModelTests(TestCase): def test_category_sort(self): Category(title='Test 2', slug='test2').save() Category(title='Test 1', slug='test1').save() self.assertEqual(['Test 1', 'Test 2'], map(str, Category.objec...
from django.test import Client, TestCase from .models import Category, Link class CategoryModelTests(TestCase): def test_category_sort(self): Category(title='Test 2', slug='test2').save() Category(title='Test 1', slug='test1').save() self.assertEqual(['Test 1', 'Test 2'], map(str, Catego...
Add test for link redirect
Add test for link redirect
Python
mit
michaelmior/pylinks,michaelmior/pylinks,michaelmior/pylinks
4f1bbe6435f2c899915ab72d990a649d4e494553
grum/views.py
grum/views.py
from grum import app, db from grum.models import User from flask import render_template, request @app.route("/") def main(): # # Login verification code # username = request.form('username') # password = request.form('password') # # user = User.query.filter_by(username=username).first_or_404() ...
from grum import app, db from grum.models import User from flask import render_template, request, redirect @app.route("/", methods=['GET', 'POST']) def main(): if request.method == "POST": # Login verification code username = request.form['username'] password = request.form['password'] ...
Fix register and login y0
Fix register and login y0
Python
mit
Grum-Hackdee/grum-web,Grum-Hackdee/grum-web,Grum-Hackdee/grum-web,Grum-Hackdee/grum-web
252cfa3baa7973a923952ecb3c83cdfb9f28ab67
l10n_br_account/models/fiscal_document.py
l10n_br_account/models/fiscal_document.py
# Copyright (C) 2009 - TODAY Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import api, models class FiscalDocument(models.Model): _inherit = 'l10n_br_fiscal.document' @api.multi def unlink(self): invoices = self.env['account.invoice'].search( ...
# Copyright (C) 2009 - TODAY Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import _, api, models from odoo.exceptions import UserError from odoo.addons.l10n_br_fiscal.constants.fiscal import ( SITUACAO_EDOC_EM_DIGITACAO, ) class FiscalDocument(models.Model): ...
Allow delete only fiscal documents with draft state
[REF] Allow delete only fiscal documents with draft state
Python
agpl-3.0
OCA/l10n-brazil,akretion/l10n-brazil,akretion/l10n-brazil,akretion/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil
21f6d03449217952cb981719345eccfbb1ec84b3
isogram/isogram.py
isogram/isogram.py
from string import ascii_lowercase LOWERCASE = set(ascii_lowercase) def is_isogram(s): chars = [c for c in s.lower() if c in LOWERCASE] return len(chars) == len(set(chars))
from string import ascii_lowercase LOWERCASE = set(ascii_lowercase) def is_isogram(s): chars = [c for c in s.lower() if c in LOWERCASE] return len(chars) == len(set(chars)) # You could also achieve this using "c.isalpha()" instead of LOWERCASE # You would then not need to import from `string`, but it's ma...
Add note about str.isalpha() method as an alternative
Add note about str.isalpha() method as an alternative
Python
agpl-3.0
CubicComet/exercism-python-solutions
54a1f1774517faf377ae43f1bad4a4f5c0b0c562
accelerator/tests/contexts/judging_round_context.py
accelerator/tests/contexts/judging_round_context.py
from accelerator.tests.factories import ( JudgingFormFactory, JudgingFormElementFactory, JudgingRoundFactory, ) from accelerator_abstract.models import FORM_ELEM_OVERALL_RECOMMENDATION class JudgingRoundContext: def __init__(self, **kwargs): if kwargs.get("is_active") is True: shoul...
from accelerator.tests.factories import ( JudgingFormFactory, JudgingFormElementFactory, JudgingRoundFactory, ) from accelerator_abstract.models import FORM_ELEM_OVERALL_RECOMMENDATION class JudgingRoundContext: def __init__(self, **kwargs): if kwargs.get("is_active") is True: shoul...
Add some values to the default judging_form_element
[AC-7310] Add some values to the default judging_form_element
Python
mit
masschallenge/django-accelerator,masschallenge/django-accelerator
dfeccf96499584d6b19c0734e6041e0d4b5947a1
knowledge/admin.py
knowledge/admin.py
from django.contrib import admin from knowledge.models import Question, Response, Category from portalpractices.models import Company, Author class CategoryAdmin(admin.ModelAdmin): list_display = [f.name for f in Category._meta.fields] prepopulated_fields = {'slug': ('title', )} admin.site.register(Category...
from django.contrib import admin from knowledge.models import Question, Response, Category class CategoryAdmin(admin.ModelAdmin): list_display = [f.name for f in Category._meta.fields] prepopulated_fields = {'slug': ('title', )} admin.site.register(Category, CategoryAdmin) class QuestionAdmin(admin.ModelA...
Update to remove references to Portal Practices
Update to remove references to Portal Practices
Python
isc
CantemoInternal/django-knowledge,CantemoInternal/django-knowledge,CantemoInternal/django-knowledge
a8bbe98f07e00cc6a9e9d076c6ed39c5d3136658
aldryn_apphooks_config/models.py
aldryn_apphooks_config/models.py
# -*- coding: utf-8 -*- from app_data import AppDataField from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class AppHookConfig(models.Model): """ This is the generic (abstract) model ...
# -*- coding: utf-8 -*- from app_data import AppDataField from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class AppHookConfig(models.Model): """ This is the generic (abstract) model ...
Add shortcut to get configuration data
Add shortcut to get configuration data
Python
bsd-3-clause
aldryn/aldryn-apphooks-config,aldryn/aldryn-apphooks-config,aldryn/aldryn-apphooks-config
2f280e34762ad4910ff9e5041c2bf24f8283368c
src-backend/registration/tests/test_user.py
src-backend/registration/tests/test_user.py
from django.test import TestCase from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist from rest_framework.authtoken.models import Token class UserTest(TestCase): def setUp(self): self.test_user = User.objects.create_user('username', 'test@test.com', 'password')...
from django.test import TestCase from django.contrib.auth.models import User from rest_framework.authtoken.models import Token from nose.tools import assert_false class UserTest(TestCase): def setUp(self): self.test_user = User.objects.create_user('username', 'test@test.com', 'password') self.test...
Use nose test tools for the user test
Use nose test tools for the user test
Python
bsd-3-clause
SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder
40c9c762ce65e0e231a14745cdc274be6c927a74
byceps/services/shop/storefront/models.py
byceps/services/shop/storefront/models.py
""" byceps.services.shop.storefront.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from ....database import db from ....util.instances import ReprBuilder from ..sequence.transfer.models import NumberSequenceID from ..shop....
""" byceps.services.shop.storefront.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from ....database import db from ....util.instances import ReprBuilder from ..sequence.transfer.models import NumberSequenceID from ..shop....
Add index for storefront's shop ID
Add index for storefront's shop ID DDL: CREATE INDEX ix_shop_storefronts_shop_id ON shop_storefronts (shop_id);
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
4e3773d96a47b88529a01fa4c4a0f25bf1b77b1c
lib/github_test.py
lib/github_test.py
import unittest import github class TestGithub(unittest.TestCase): def setUp(self): pass def test_user(self): u = github.user() u1 = github.user() self.assertTrue(u) # make sure hash works self.assertTrue(u is u1) def test_has_issues(self): ...
import unittest import github class TestGithub(unittest.TestCase): def setUp(self): pass def test_user(self): u = github.user() u1 = github.user() self.assertTrue(u) # make sure hash works self.assertTrue(u is u1) def test_has_issues(self): ...
Remove old repo_from_path tests. This is a very hard functionality to test
Remove old repo_from_path tests. This is a very hard functionality to test
Python
mit
jonmorehouse/vimhub
76282391f35725ee42ac0671a9a77b68e1f34081
rest_tester/test_info.py
rest_tester/test_info.py
class TestInfo(object): """Read test information from JSON data.""" PATH_API = 'api' PATH_API_URL = 'url' PATH_API_PARAMS = 'params' PATH_API_TIMEOUT = 'timeout' PATH_TESTS = 'tests' DEFAULT_TIME_OUT = 10 @classmethod def read(cls, json_data): """Read test information fro...
class TestInfo(object): """Read test information from JSON data.""" PATH_API = 'api' PATH_API_URL = 'url' PATH_API_PARAMS = 'params' PATH_API_TIMEOUT = 'timeout' PATH_TESTS = 'tests' DEFAULT_TIME_OUT = 10 @classmethod def read(cls, json_data): """Read test information fro...
Use get for params and timeout.
Use get for params and timeout.
Python
mit
ridibooks/lightweight-rest-tester,ridibooks/lightweight-rest-tester
fecb9624379057a98aeaf2bb5cf42d7e526bbf0a
vumi/blinkenlights/heartbeat/__init__.py
vumi/blinkenlights/heartbeat/__init__.py
from vumi.blinkenlights.heartbeat.publisher import (HeartBeatMessage, HeartBeatPublisher) __all__ = ["HeartBeatMessage", "HeartBeatPublisher"]
"""Vumi worker heartbeating.""" from vumi.blinkenlights.heartbeat.publisher import (HeartBeatMessage, HeartBeatPublisher) __all__ = ["HeartBeatMessage", "HeartBeatPublisher"]
Add module docstring from vumi.blinkenlights.heartbeat.
Add module docstring from vumi.blinkenlights.heartbeat.
Python
bsd-3-clause
vishwaprakashmishra/xmatrix,harrissoerja/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,harrissoerja/vumi,harrissoerja/vumi,TouK/vumi,TouK/vumi
fbf2a59d9cf25c3d3a041afa839d0d44f6f385a5
win_unc/internal/utils.py
win_unc/internal/utils.py
""" Contains generic helper funcitons to aid in parsing. """ import itertools def take_while(predicate, items): return list(itertools.takewhile(predicate, items)) def drop_while(predicate, items): return list(itertools.dropwhile(predicate, items)) def not_(func): return lambda *args, **kwargs: not fu...
""" Contains generic helper funcitons to aid in parsing. """ import itertools def take_while(predicate, items): return list(itertools.takewhile(predicate, items)) def drop_while(predicate, items): return list(itertools.dropwhile(predicate, items)) def not_(func): return lambda *args, **kwargs: not fu...
Return None explicitly instead of implicitly
Return None explicitly instead of implicitly
Python
mit
CovenantEyes/py_win_unc,nithinphilips/py_win_unc
62a6b78b62631c0b1de7d0497250aa3d0310d47d
winthrop/common/models.py
winthrop/common/models.py
from django.db import models # abstract models with common fields to be # used as mix-ins class Named(models.Model): '''Abstract model with a 'name' field; by default, name is used as the string display.''' name = models.CharField(max_length=255, unique=True) class Meta: abstract = True ...
from django.db import models # abstract models with common fields to be # used as mix-ins class Named(models.Model): '''Abstract model with a 'name' field; by default, name is used as the string display.''' name = models.CharField(max_length=255, unique=True) class Meta: abstract = True ...
Add alpha ordering on Named abstract class
Add alpha ordering on Named abstract class
Python
apache-2.0
Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django
09506e7ae8dbc1ad06b35c075e15946dd2c6092b
examples/my_test_suite.py
examples/my_test_suite.py
from seleniumbase import BaseCase class MyTestSuite(BaseCase): def test_1(self): self.open("http://xkcd.com/1663/") for p in xrange(4): self.click('a[rel="next"]') self.find_text("Algorithms", "div#ctitle", timeout=3) def test_2(self): # This test will fail ...
from seleniumbase import BaseCase class MyTestSuite(BaseCase): def test_1(self): self.open("http://xkcd.com/1663/") self.find_text("Garden", "div#ctitle", timeout=3) for p in xrange(4): self.click('a[rel="next"]') self.find_text("Algorithms", "div#ctitle", timeout=3) ...
Update the example test suite
Update the example test suite
Python
mit
possoumous/Watchers,mdmintz/SeleniumBase,possoumous/Watchers,seleniumbase/SeleniumBase,mdmintz/seleniumspot,ktp420/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase,ktp420/SeleniumBase,ktp420/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,ktp420/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/Sele...
5aca109f486786266164f4ac7a10e4d76f0730e4
scrappyr/scraps/forms.py
scrappyr/scraps/forms.py
from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from django import forms from .models import Scrap class ScrapForm(forms.ModelForm): class Meta: model = Scrap fields = ['raw_title'] def __init__(self, *args, **kwargs): super(ScrapForm, self).__init_...
from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from django import forms from .models import Scrap class ScrapForm(forms.ModelForm): class Meta: model = Scrap fields = ['raw_title'] def __init__(self, *args, **kwargs): super(ScrapForm, self).__init_...
Make add-scrap title user friendly
Make add-scrap title user friendly
Python
mit
tonysyu/scrappyr-app,tonysyu/scrappyr-app,tonysyu/scrappyr-app,tonysyu/scrappyr-app
bdb38a935dbbe6b70b0b960ba132dc6870455ceb
validate.py
validate.py
"""Check for inconsistancies in the database.""" from server.db import ( BuildingBuilder, BuildingRecruit, BuildingType, load, UnitType ) def main(): load() for name in UnitType.resource_names(): if UnitType.count(getattr(UnitType, name) >= 1): continue else: print...
"""Check for inconsistancies in the database.""" from server.db import ( BuildingBuilder, BuildingRecruit, BuildingType, load, UnitType, setup, options ) def main(): load() setup() for name in UnitType.resource_names(): if UnitType.count(getattr(UnitType, name) >= 1): continue...
Check that start building can recruit something.
Check that start building can recruit something.
Python
mpl-2.0
chrisnorman7/pyrts,chrisnorman7/pyrts,chrisnorman7/pyrts
15efe5ecd3f17ec05f3dc9054cd823812c4b3743
utils/http.py
utils/http.py
import requests def retrieve_json(url): r = requests.get(url) r.raise_for_status() return r.json()
import requests DEFAULT_TIMEOUT = 10 def retrieve_json(url, timeout=DEFAULT_TIMEOUT): r = requests.get(url, timeout=timeout) r.raise_for_status() return r.json()
Add a default timeout parameter to retrieve_json
Add a default timeout parameter to retrieve_json
Python
bsd-3-clause
tebriel/dd-agent,jyogi/purvar-agent,pmav99/praktoras,gphat/dd-agent,manolama/dd-agent,pmav99/praktoras,gphat/dd-agent,Wattpad/dd-agent,brettlangdon/dd-agent,cberry777/dd-agent,pmav99/praktoras,brettlangdon/dd-agent,tebriel/dd-agent,tebriel/dd-agent,Wattpad/dd-agent,jyogi/purvar-agent,cberry777/dd-agent,manolama/dd-agen...
fe89b50d87c37c83170de74e5f88f59d88ba2c89
vispy/visuals/tests/test_arrows.py
vispy/visuals/tests/test_arrows.py
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import numpy as np from vispy.visuals.line.arrow import ARROW_TYPES from vispy.scene import visuals, transforms from vispy.testing import (requires_application, TestingCanvas...
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import numpy as np from vispy.visuals.line.arrow import ARROW_TYPES from vispy.scene import visuals, transforms from vispy.testing import (requires_application, TestingCanvas...
Add 0.33 to the vertices to prevent misalignment
Add 0.33 to the vertices to prevent misalignment
Python
bsd-3-clause
michaelaye/vispy,ghisvail/vispy,QuLogic/vispy,jdreaver/vispy,Eric89GXL/vispy,srinathv/vispy,dchilds7/Deysha-Star-Formation,jay3sh/vispy,sbtlaarzc/vispy,jay3sh/vispy,julienr/vispy,sbtlaarzc/vispy,michaelaye/vispy,jay3sh/vispy,bollu/vispy,drufat/vispy,RebeccaWPerry/vispy,julienr/vispy,Eric89GXL/vispy,bollu/vispy,jdreaver...
a75ca43b3035f3f391b39393802ea46d440b22c5
bookvoyage-backend/core/admin.py
bookvoyage-backend/core/admin.py
from leaflet.admin import LeafletGeoAdmin from django.contrib import admin from import_export import resources from import_export.admin import ImportExportModelAdmin # Register your models here. from .models import Author, Book, BookInstance, BookHolding, BookOwning, BookBatch class BookResource(resources.ModelResour...
from leaflet.admin import LeafletGeoAdmin from django.contrib import admin from import_export import resources from import_export.admin import ImportExportModelAdmin # Register models from .models import Author, Book, BookInstance, BookHolding, BookOwning, BookBatch from django.contrib.auth.models import User class B...
Add option to bulk-add users
Add option to bulk-add users Warning: excel import is shaky with importing groups; json import is recommended.
Python
mit
edushifts/book-voyage,edushifts/book-voyage,edushifts/book-voyage,edushifts/book-voyage
a8b0a1f20264506beec9ffc1299b82277a339556
chipy_org/apps/profiles/views.py
chipy_org/apps/profiles/views.py
from django.contrib.auth.models import User from django.views.generic import ListView, UpdateView from .forms import ProfileForm from .models import UserProfile class ProfilesList(ListView): context_object_name = "profiles" template_name = "profiles/list.html" queryset = User.objects.filter(profile__show...
from django.contrib.auth.models import User from django.views.generic import ListView, UpdateView from .forms import ProfileForm from .models import UserProfile class ProfilesList(ListView): context_object_name = "profiles" template_name = "profiles/list.html" queryset = User.objects.filter(profile__show...
Add ordering for profiles by name
Add ordering for profiles by name
Python
mit
chicagopython/chipy.org,chicagopython/chipy.org,chicagopython/chipy.org,chicagopython/chipy.org
fbe4761d2d679a983d2625c4969dab53500634b7
fases/rodar_fase_exemplo.py
fases/rodar_fase_exemplo.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from atores import PassaroAmarelo, PassaroVermelho, Obstaculo, Porco from fase import Fase from placa_grafica_tkinter import rodar_fase if __name__=='__main__': fase = Fase(intervalo_de_colisao=10) # Adicionar Pássaros Vermelhos for i in ra...
# -*- coding: utf-8 -*- from os import path import sys project_dir = path.dirname(__file__) project_dir = path.join('..') sys.path.append(project_dir) from atores import PassaroAmarelo, PassaroVermelho, Obstaculo, Porco from fase import Fase from placa_grafica_tkinter import rodar_fase if __name__ == '__main__': ...
Refactor para funfar via linha de comando
Refactor para funfar via linha de comando
Python
mit
guoliveer/pythonbirds,deniscampos/pythonbirds,renzon/pythonbirds-fatec,giovaneliberato/python_birds_fp,pythonprobr/pythonbirds,jvitorlb/pythonbirds,evertongoncalves/pythonbirds,renzon/python-birds-t5,Cleitoon1/pythonbirds,gomesfelipe/pythonbirds,igorlimasan/pythonbirds
a0df14a38bcc4f71cf073298e078160488b143ca
sheldon/basic_classes.py
sheldon/basic_classes.py
# -*- coding: utf-8 -*- """ Declaration of classes needed for bot working: Adapter class, Plugin class @author: Lises team @contact: zhidkovseva@gmail.com @license: The MIT license Copyright (C) 2015 """ from time import sleep class Adapter: """ Adapter class contains information about adapter: name, ...
# -*- coding: utf-8 -*- """ Declaration of classes needed for bot working: Adapter class, Plugin class @author: Lises team @contact: zhidkovseva@gmail.com @license: The MIT license Copyright (C) 2015 """ from time import sleep class Adapter: """ Adapter class contains information about adapter: name, ...
Change docs of send_message method
Change docs of send_message method
Python
mit
lises/sheldon
07ccbc36fd5148db2efc5f676fd13d4b24aa004f
hackasmlexer/hacklexer.py
hackasmlexer/hacklexer.py
import re from pygments.lexer import RegexLexer, include from pygments.token import * class HackAsmLexer(RegexLexer): name = 'Hack Assembler' aliases = ['hack_asm'] filenames = ['*.asm'] identifier = r'[a-zA-Z$._?][a-zA-Z0-9$._?]*' flags = re.IGNORECASE | re.MULTILINE tokens = { 'root...
import re from pygments.lexer import RegexLexer, include from pygments.token import * class HackAsmLexer(RegexLexer): name = 'Hack Assembler' aliases = ['hack_asm'] filenames = ['*.asm'] identifier = r'[a-zA-Z$._?][a-zA-Z0-9$._?]*' flags = re.IGNORECASE | re.MULTILINE tokens = { 'root...
Add register and IO addresses
Add register and IO addresses
Python
mit
cprieto/pygments_hack_asm
20224987f7c1ac34b13587a6dc7c1241e0466663
dataset/dataset/spiders/dataset_spider.py
dataset/dataset/spiders/dataset_spider.py
from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor from scrapy.selector import Selector from dataset import DatasetItem class DatasetSpider(CrawlSpider): name = 'dataset' allowed_domains = ['data.gc.ca/data/en'] start_urls = ['http://data....
from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor from scrapy.selector import Selector from .. import items class DatasetSpider(CrawlSpider): name = 'dataset' allowed_domains = ['data.gc.ca/data/en'] start_urls = ['http://data.gc.ca/data/...
Fix import post merge to project directory
Fix import post merge to project directory
Python
mit
MaxLikelihood/CODE
6c0287a3ba1c98d9f4879c4f2ec95a3d6406b6ae
meinberlin/apps/dashboard/filtersets.py
meinberlin/apps/dashboard/filtersets.py
import django_filters from django.utils.translation import ugettext_lazy as _ from adhocracy4.filters import widgets as filters_widgets from adhocracy4.filters.filters import DefaultsFilterSet from adhocracy4.filters.filters import FreeTextFilter from adhocracy4.projects.models import Project from meinberlin.apps.proj...
import django_filters from django.utils.translation import ugettext_lazy as _ from adhocracy4.filters import widgets as filters_widgets from adhocracy4.filters.filters import DefaultsFilterSet from adhocracy4.filters.filters import FreeTextFilter from adhocracy4.projects.models import Project from meinberlin.apps.proj...
Remove typ filter from dashboard
Remove typ filter from dashboard
Python
agpl-3.0
liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin
8f6a19bade1a0591f3feba4521fdf42c157c179d
skyline_path/algorithms/growing_graph.py
skyline_path/algorithms/growing_graph.py
class GrowingGraph: def __init__(self, neighbors_table, start_nodes): self.neighbors_table = neighbors_table self.outer_nodes = set(start_nodes) self.inner_nodes = set() def growing(self): for old_node in self.outer_nodes.copy(): self._update_nodes(old_node) def...
class GrowingGraph: def __init__(self, neighbors_table, start_nodes): self.neighbors_table = neighbors_table self.outer_nodes = set(start_nodes) self.inner_nodes = set() def all_nodes(self): return self.outer_nodes | self.inner_nodes def growing(self, times=1): for ...
Add all_nodes and growing times param
Add all_nodes and growing times param
Python
mit
shadow3x3x3/renew-skyline-path-query
2aab3167f70fa736fafb3507e71a6233a02363eb
space-age/space_age.py
space-age/space_age.py
class SpaceAge(object): def __init__(self, seconds): self.seconds = seconds @property def years(self): return self.seconds/31557600 def on_earth(self): return round(self.years, 2) def on_mercury(self): return round(self.years/0.2408467, 2) def on_venus(self): ...
class SpaceAge(object): YEARS = {"on_earth": 1, "on_mercury": 0.2408467, "on_venus": 0.61519726, "on_mars": 1.8808158, "on_jupiter": 11.862615, "on_saturn": 29.447498, "on_uranus": 84.016846, "on_neptune": 164.79132} def...
Implement __getattr__ to reduce code
Implement __getattr__ to reduce code
Python
agpl-3.0
CubicComet/exercism-python-solutions
47c50f9e3f8c0643e0e76cd60fa5694701e73afe
scanner/ScannerApplication.py
scanner/ScannerApplication.py
from Cura.Application import Application class ScannerApplication(Application): def __init__(self): super(ScannerApplication, self).__init__() self._plugin_registry.loadPlugin("STLReader") self._plugin_registry.loadPlugin("STLWriter") self._plugin_registry.loadPlugin("MeshV...
from Cura.WxApplication import WxApplication class ScannerApplication(WxApplication): def __init__(self): super(ScannerApplication, self).__init__() self._plugin_registry.loadPlugin("STLReader") self._plugin_registry.loadPlugin("STLWriter") self._plugin_registry.loadPlugin(...
Use WxApplication as base class for the scanner
Use WxApplication as base class for the scanner
Python
agpl-3.0
onitake/Uranium,onitake/Uranium
6bef0dc50470bc71c15e0fb7c86f03e69c416e67
scrapi/harvesters/datacite.py
scrapi/harvesters/datacite.py
''' Harvester for the DataCite MDS for the SHARE project Example API call: http://oai.datacite.org/oai?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester from scrapi.base.helpers import updated_schema, oai_extract_dois class DataciteHarvester(OAIH...
''' Harvester for the DataCite MDS for the SHARE project Example API call: http://oai.datacite.org/oai?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester from scrapi.base.helpers import updated_schema, oai_extract_dois class DataciteHarvester(OAIH...
Add docstring explaiing why to take the second description
Add docstring explaiing why to take the second description
Python
apache-2.0
CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,ostwald/scrapi,erinspace/scrapi,mehanig/scrapi,felliott/scrapi,fabianvf/scrapi,erinspace/scrapi,alexgarciac/scrapi,felliott/scrapi,mehanig/scrapi,jeffreyliu3230/scrapi
40af3e546a9024f7bb7786828d22534f8dff103a
neutron_fwaas/common/fwaas_constants.py
neutron_fwaas/common/fwaas_constants.py
# Copyright 2015 Cisco Systems, Inc # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
# Copyright 2015 Cisco Systems, Inc # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
Remove unused constant for topics
Remove unused constant for topics While reading the code, I found "L3_AGENT" topic is defined but never be used. Change-Id: I9b6da61f9fe5224d2c25bbe7cc55fd508b4e240f
Python
apache-2.0
openstack/neutron-fwaas,openstack/neutron-fwaas
5055e01bb7ea340ef96204a360002907c43fac91
tsserver/models.py
tsserver/models.py
from tsserver import db from tsserver.dtutils import datetime_to_str class Telemetry(db.Model): """ All the data that is going to be obtained in regular time intervals (every second or so). """ timestamp = db.Column(db.DateTime, primary_key=True) temperature = db.Column(db.Float) """Tempe...
from tsserver import db from tsserver.dtutils import datetime_to_str class Telemetry(db.Model): """ All the data that is going to be obtained in regular time intervals (every second or so). """ timestamp = db.Column(db.DateTime, primary_key=True) temperature = db.Column(db.Float) """Tempe...
Remove Telemetry.__init__ as not necessary
Remove Telemetry.__init__ as not necessary
Python
mit
m4tx/techswarm-server
9f42cd231375475d27c6fe298ec862065c34f8ca
armstrong/core/arm_sections/views.py
armstrong/core/arm_sections/views.py
from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import reverse from django.views.generic import TemplateView from django.utils.translation import ugettext as _ from django.contrib.syndication.views import Feed from django.shortcuts import get_object_or_404 from .models import Sect...
from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import reverse from django.views.generic import DetailView from django.utils.translation import ugettext as _ from django.contrib.syndication.views import Feed from django.shortcuts import get_object_or_404 from .models import Sectio...
Refactor SimpleSectionView to inherit DetailView
Refactor SimpleSectionView to inherit DetailView
Python
apache-2.0
armstrong/armstrong.core.arm_sections,texastribune/armstrong.core.tt_sections,armstrong/armstrong.core.arm_sections,texastribune/armstrong.core.tt_sections,texastribune/armstrong.core.tt_sections
2ca5ccb861962a021f81b6e794f5372d8079216f
fml/generatechangedfilelist.py
fml/generatechangedfilelist.py
import sys import os import commands import fnmatch import re import subprocess, shlex def cmdsplit(args): if os.sep == '\\': args = args.replace('\\', '\\\\') return shlex.split(args) def main(): md5dir = os.path.abspath(sys.argv[1]) list_file = os.path.abspath(sys.argv[2]) prelist = os.p...
import sys import os import commands import fnmatch import re import subprocess, shlex mcp_root = os.path.abspath(sys.argv[1]) sys.path.append(os.path.join(mcp_root,"runtime")) from filehandling.srgshandler import parse_srg def cmdsplit(args): if os.sep == '\\': args = args.replace('\\', '\\\\') retur...
Tweak file list script to print obf names
Tweak file list script to print obf names
Python
lgpl-2.1
Zaggy1024/MinecraftForge,luacs1998/MinecraftForge,simon816/MinecraftForge,karlthepagan/MinecraftForge,jdpadrnos/MinecraftForge,bonii-xx/MinecraftForge,mickkay/MinecraftForge,dmf444/MinecraftForge,Theerapak/MinecraftForge,ThiagoGarciaAlves/MinecraftForge,blay09/MinecraftForge,shadekiller666/MinecraftForge,Mathe172/Minec...
18332cdac7c7dcb2ef64e3a9ad17b8b229387af8
spraakbanken/s5/spr_local/reconstruct_corpus.py
spraakbanken/s5/spr_local/reconstruct_corpus.py
#!/usr/bin/env python3 import argparse import collections import random import sys def reconstruct(f_in, f_out): sentence_starts = [] contexts = {} for line in f_in: parts = line.split() words = parts[:-1] count = int(parts[-1]) if words[0] == "<s>" and words[-1] == "<...
#!/usr/bin/env python3 from __future__ import print_function import argparse import collections import random import sys def reconstruct(f_in, f_out): sentence_starts = [] contexts = {} for line in f_in: parts = line.split() words = parts[:-1] count = int(parts[-1]) i...
Add reconstruct corpus as a test
Add reconstruct corpus as a test
Python
apache-2.0
psmit/kaldi-recipes,phsmit/kaldi-recipes,psmit/kaldi-recipes,psmit/kaldi-recipes,phsmit/kaldi-recipes
29c5391078aaa9e3c18356a18ca1c5d6f3bf82e9
src/temp_functions.py
src/temp_functions.py
def k_to_c(temp): return temp - 273.15 def f_to_k(temp): return ((temp - 32) * (5 / 9)) + 273.15
def k_to_c(temp): return temp - 273.15 def f_to_k(temp): return ((temp - 32) * (5 / 9)) + 273.15 def f_to_c(temp): temp_k = f_to_k(temp) result = k_to_c(temp_k) return result
Write a function covert far to cesis
Write a function covert far to cesis
Python
mit
xykang/2015-05-12-BUSM-git,xykang/2015-05-12-BUSM-git
5b6f4f51eb761b87881d99148e7dae013af09eb6
zgres/utils.py
zgres/utils.py
import sys import time import asyncio import logging def pg_lsn_to_int(pos): # http://www.postgresql.org/docs/9.4/static/datatype-pg-lsn.html # see http://eulerto.blogspot.com.es/2011/11/understanding-wal-nomenclature.html logfile, offset = pos.split('/') return 0xFF000000 * int(logfile, 16) + int(offs...
import sys import time import asyncio import logging def pg_lsn_to_int(pos): # http://www.postgresql.org/docs/9.4/static/datatype-pg-lsn.html # see http://eulerto.blogspot.com.es/2011/11/understanding-wal-nomenclature.html logfile, offset = pos.split('/') return 0xFF000000 * int(logfile, 16) + int(offs...
Remove sleep time as it appeared to hang forever
Remove sleep time as it appeared to hang forever
Python
mit
jinty/zgres,jinty/zgres
34fe6e4f499385cc437a720db0f54db0f0ba07d2
tests/tests_twobody/test_mean_elements.py
tests/tests_twobody/test_mean_elements.py
import pytest from poliastro.twobody.mean_elements import get_mean_elements def test_get_mean_elements_raises_error_if_invalid_body(): body = "Sun" with pytest.raises(ValueError) as excinfo: get_mean_elements(body) assert f"The input body is invalid." in excinfo.exconly()
import pytest from poliastro.twobody.mean_elements import get_mean_elements def test_get_mean_elements_raises_error_if_invalid_body(): body = "Sun" with pytest.raises(ValueError) as excinfo: get_mean_elements(body) assert f"The input body '{body}' is invalid." in excinfo.exconly()
Add test for error check
Add test for error check
Python
mit
poliastro/poliastro
dddf89e519e40ce118509dcb5823ad932fea88f8
chainer/training/triggers/__init__.py
chainer/training/triggers/__init__.py
from chainer.training.triggers import interval_trigger # NOQA from chainer.training.triggers import minmax_value_trigger # NOQA # import class and function from chainer.training.triggers.interval_trigger import IntervalTrigger # NOQA from chainer.training.triggers.manual_schedule_trigger import ManualScheduleTrigg...
from chainer.training.triggers import interval_trigger # NOQA from chainer.training.triggers import minmax_value_trigger # NOQA # import class and function from chainer.training.triggers.early_stopping_trigger import EarlyStoppingTrigger # NOQA from chainer.training.triggers.interval_trigger import IntervalTrigger...
Fix the order of importing
Fix the order of importing
Python
mit
niboshi/chainer,wkentaro/chainer,ktnyt/chainer,keisuke-umezawa/chainer,jnishi/chainer,hvy/chainer,chainer/chainer,niboshi/chainer,wkentaro/chainer,hvy/chainer,okuta/chainer,anaruse/chainer,keisuke-umezawa/chainer,tkerola/chainer,keisuke-umezawa/chainer,wkentaro/chainer,okuta/chainer,ktnyt/chainer,keisuke-umezawa/chaine...
d128b13e9c05516dcba587c684ef2f54884d6bb6
api/migrations/0001_create_application.py
api/migrations/0001_create_application.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-26 20:29 from __future__ import unicode_literals from django.db import migrations from oauth2_provider.models import Application class Migration(migrations.Migration): def add_default_application(apps, schema_editor): Application.objects.cre...
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-26 20:29 from __future__ import unicode_literals from django.db import migrations from oauth2_provider.models import Application class Migration(migrations.Migration): def add_default_application(apps, schema_editor): Application.objects.cre...
Add an additional default redirect_uri
Add an additional default redirect_uri (runserver's default port)
Python
bsd-3-clause
hotosm/osm-export-tool2,hotosm/osm-export-tool2,hotosm/osm-export-tool2,hotosm/osm-export-tool2