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
ed491860864c363be36d99c09ff0131a5fe00aaf
test/Driver/Dependencies/Inputs/touch.py
test/Driver/Dependencies/Inputs/touch.py
#!/usr/bin/env python # touch.py - /bin/touch that writes the LLVM epoch -*- python -*- # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See http://swift.org/LI...
#!/usr/bin/env python # touch.py - /bin/touch that writes the LLVM epoch -*- python -*- # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See http://swift.org/LI...
Fix tests for file timestamps to drop the LLVM epoch offset.
Fix tests for file timestamps to drop the LLVM epoch offset. Now that Swift is not using LLVM's TimeValue (564fc6f2 and previous commit) there is no offset from the system_clock epoch. The offset could be added into the tests that use touch.py (so the times would not be back in 1984) but I decided not to do that to av...
Python
apache-2.0
aschwaighofer/swift,tinysun212/swift-windows,arvedviehweger/swift,xwu/swift,airspeedswift/swift,parkera/swift,tinysun212/swift-windows,JGiola/swift,JaSpa/swift,JGiola/swift,parkera/swift,zisko/swift,hughbe/swift,codestergit/swift,CodaFi/swift,rudkx/swift,huonw/swift,tkremenek/swift,jtbandes/swift,codestergit/swift,prac...
642908032012baf200ab227803982730c6d4b083
stdnum/ca/__init__.py
stdnum/ca/__init__.py
# __init__.py - collection of Canadian numbers # coding: utf-8 # # Copyright (C) 2017 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License,...
# __init__.py - collection of Canadian numbers # coding: utf-8 # # Copyright (C) 2017 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License,...
Add missing vat alias for Canada
Add missing vat alias for Canada
Python
lgpl-2.1
arthurdejong/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum
c2859bd8da741862ee01a276a1350fb4a5931dbc
data_access.py
data_access.py
#!/usr/bin/env python import sys import mysql.connector def insert(): cursor = connection.cursor() try: cursor.execute("drop table employees") except: pass cursor.execute("create table employees (id integer primary key, name text)") cursor.close() print("Inserting employees......
#!/usr/bin/env python from random import randint import sys import mysql.connector NUM_EMPLOYEES = 10000 def insert(): cursor = connection.cursor() try: cursor.execute("drop table employees") except: pass cursor.execute("create table employees (id integer primary key, name text)") ...
Change data access script to issue SELECTs that actually return a value
Change data access script to issue SELECTs that actually return a value This makes the part about tracing the SQL statements and tracing the number of rows returned a little more interesting.
Python
mit
goldshtn/linux-tracing-workshop,goldshtn/linux-tracing-workshop,goldshtn/linux-tracing-workshop,goldshtn/linux-tracing-workshop,goldshtn/linux-tracing-workshop,goldshtn/linux-tracing-workshop,goldshtn/linux-tracing-workshop,goldshtn/linux-tracing-workshop
807d7efe7de00950df675e78249dcada298b6cd1
systemrdl/__init__.py
systemrdl/__init__.py
from .__about__ import __version__ from .compiler import RDLCompiler from .walker import RDLListener, RDLWalker from .messages import RDLCompileError
from .__about__ import __version__ from .compiler import RDLCompiler from .walker import RDLListener, RDLWalker from .messages import RDLCompileError from .node import AddressableNode, VectorNode, SignalNode from .node import FieldNode, RegNode, RegfileNode, AddrmapNode, MemNode from .component import AddressableCom...
Bring forward more contents into top namespace
Bring forward more contents into top namespace
Python
mit
SystemRDL/systemrdl-compiler,SystemRDL/systemrdl-compiler,SystemRDL/systemrdl-compiler,SystemRDL/systemrdl-compiler
ccb90932cf967190029b3ce9494a1fd9e6cb889a
gaphor/UML/classes/tests/test_propertypages.py
gaphor/UML/classes/tests/test_propertypages.py
from gi.repository import Gtk from gaphor import UML from gaphor.UML.classes import ClassItem from gaphor.UML.classes.classespropertypages import ClassAttributes class TestClassPropertyPages: def test_attribute_editing(self, case): class_item = case.create(ClassItem, UML.Class) model = ClassAttri...
from gi.repository import Gtk from gaphor import UML from gaphor.UML.classes import ClassItem, EnumerationItem from gaphor.UML.classes.classespropertypages import ( ClassAttributes, ClassEnumerationLiterals, ) def test_attribute_editing(case): class_item = case.create(ClassItem, UML.Class) model = Cl...
Add test for enumeration editing
Add test for enumeration editing Signed-off-by: Dan Yeaw <2591e5f46f28d303f9dc027d475a5c60d8dea17a@yeaw.me>
Python
lgpl-2.1
amolenaar/gaphor,amolenaar/gaphor
f68e8cb9751a32cc4d8bdc97c6f753395381e1e1
python/dnest4/utils.py
python/dnest4/utils.py
# -*- coding: utf-8 -*- __all__ = ["randh", "wrap"] import numpy as np import numpy.random as rng def randh(): """ Generate from the heavy-tailed distribution. """ return 10.0**(1.5 - 3*np.abs(rng.randn()/np.sqrt(-np.log(rng.rand()))))*rng.randn() def wrap(x, a, b): assert b > a return (x - a...
# -*- coding: utf-8 -*- __all__ = ["randh", "wrap"] import numpy as np import numpy.random as rng def randh(N=1): """ Generate from the heavy-tailed distribution. """ if N==1: return 10.0**(1.5 - 3*np.abs(rng.randn()/np.sqrt(-np.log(rng.rand()))))*rng.randn() return 10.0**(1.5 - 3*np.abs(rng....
Allow N > 1 randhs to be generated
Allow N > 1 randhs to be generated
Python
mit
eggplantbren/DNest4,eggplantbren/DNest4,eggplantbren/DNest4,eggplantbren/DNest4,eggplantbren/DNest4
6d7d04b095eacb413b07ebcb3fed9684dc40fc80
utils/gyb_syntax_support/protocolsMap.py
utils/gyb_syntax_support/protocolsMap.py
SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES = { 'DeclBuildable': [ 'CodeBlockItem', 'MemberDeclListItem', 'SyntaxBuildable' ], 'ExprList': [ 'ConditionElement', 'SyntaxBuildable' ], 'IdentifierPattern': [ 'PatternBuildable' ], 'MemberDeclList'...
SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES = { 'DeclBuildable': [ 'CodeBlockItem', 'MemberDeclListItem', 'SyntaxBuildable' ], 'ExprList': [ 'ConditionElement', 'SyntaxBuildable' ], 'IdentifierPattern': [ 'PatternBuildable' ], 'MemberDeclList'...
Add convenience initializer for `BinaryOperatorExpr`
[SwiftSyntax] Add convenience initializer for `BinaryOperatorExpr`
Python
apache-2.0
atrick/swift,atrick/swift,apple/swift,rudkx/swift,benlangmuir/swift,roambotics/swift,rudkx/swift,glessard/swift,atrick/swift,ahoppen/swift,glessard/swift,JGiola/swift,atrick/swift,ahoppen/swift,ahoppen/swift,apple/swift,glessard/swift,JGiola/swift,rudkx/swift,rudkx/swift,atrick/swift,roambotics/swift,apple/swift,roambo...
9fb89c7e76bd3c6db5f7283b91a2852225056b40
tests/test_analyse.py
tests/test_analyse.py
"""Test analysis page.""" def test_analysis(webapp): """Test we can analyse a page.""" response = webapp.get('/analyse/646e73747769737465722e7265706f7274') assert response.status_code == 200 assert 'Use these tools to safely analyse dnstwister.report' in response.body
"""Test analysis page.""" import pytest import webtest.app def test_analysis(webapp): """Test we can analyse a page.""" response = webapp.get('/analyse/646e73747769737465722e7265706f7274') assert response.status_code == 200 assert 'Use these tools to safely analyse dnstwister.report' in response.body...
Test analyse page checks domain validity
Test analyse page checks domain validity
Python
unlicense
thisismyrobot/dnstwister,thisismyrobot/dnstwister,thisismyrobot/dnstwister
323b201b8a498402d9f45cbc5cbac049299feea8
api/bots/incrementor/incrementor.py
api/bots/incrementor/incrementor.py
# See readme.md for instructions on running this code. class IncrementorHandler(object): def __init__(self): self.number = 0 self.message_id = None def usage(self): return ''' This is a boilerplate bot that makes use of the update_message function. For the first @-men...
# See readme.md for instructions on running this code. class IncrementorHandler(object): def usage(self): return ''' This is a boilerplate bot that makes use of the update_message function. For the first @-mention, it initially replies with one message containing a `1`. Every time...
Adjust Incrementor bot to use StateHandler
Bots: Adjust Incrementor bot to use StateHandler
Python
apache-2.0
jackrzhang/zulip,zulip/zulip,Galexrt/zulip,eeshangarg/zulip,kou/zulip,brainwane/zulip,timabbott/zulip,verma-varsha/zulip,vabs22/zulip,mahim97/zulip,verma-varsha/zulip,hackerkid/zulip,rishig/zulip,zulip/zulip,rht/zulip,timabbott/zulip,punchagan/zulip,jackrzhang/zulip,punchagan/zulip,timabbott/zulip,hackerkid/zulip,punch...
58120c937e04357f6fbdcf1431f69fe7a38aacb2
app/mod_budget/model.py
app/mod_budget/model.py
from app import db from app.mod_auth.model import User class Category(db.Document): # The name of the category. name = db.StringField(required = True) class Entry(db.Document): # The amount of the entry. amount = db.DecimalField(precision = 2, required = True) # A short description for the entry....
from app import db from app.mod_auth.model import User class Category(db.Document): # The name of the category. name = db.StringField(required = True) class Income(db.Document): # The amount of the entry. amount = db.DecimalField(precision = 2, required = True) # A short description for the entry...
Split Entry into Income and Expense schemes
Split Entry into Income and Expense schemes Splitting the Entry schema into two seperate schemes allows us to use different collections to store them, which in turn makes our work easier later on.
Python
mit
Zillolo/mana-vault,Zillolo/mana-vault,Zillolo/mana-vault
d4b1c89a8d365457e1162d5a39815e7fc47781a1
src/epiweb/apps/profile/urls.py
src/epiweb/apps/profile/urls.py
from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^edit/$', 'epiweb.apps.profile.views.edit'), (r'^$', 'epiweb.apps.profile.views.index'), )
from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^$', 'epiweb.apps.profile.views.index'), )
Remove profile 'show' page, only 'edit' page is provided.
Remove profile 'show' page, only 'edit' page is provided.
Python
agpl-3.0
ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website
5a0116378b6906fbfb3146bbf635d6d9c39ec714
saleor/dashboard/collection/forms.py
saleor/dashboard/collection/forms.py
from django import forms from ...product.models import Collection class CollectionForm(forms.ModelForm): class Meta: model = Collection exclude = []
from unidecode import unidecode from django import forms from django.utils.text import slugify from ...product.models import Collection class CollectionForm(forms.ModelForm): class Meta: model = Collection exclude = ['slug'] def save(self, commit=True): self.instance.slug = slugify(...
Update CollectionForm to handle slug field
Update CollectionForm to handle slug field
Python
bsd-3-clause
mociepka/saleor,mociepka/saleor,mociepka/saleor,UITools/saleor,maferelo/saleor,UITools/saleor,maferelo/saleor,UITools/saleor,UITools/saleor,UITools/saleor,maferelo/saleor
5329c48a6f0a36809d3088560f91b427f7a2bf0b
models.py
models.py
from datetime import datetime from app import db, bcrypt class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True) email = db.Column(db.String(120), unique=True) name = db.Column(db.String()) pw_hash = db.Co...
from datetime import datetime from app import db, bcrypt class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True) email = db.Column(db.String(120), unique=True) name = db.Column(db.String()) pw_hash = db.Co...
Add title to Graph object constructor
Add title to Graph object constructor
Python
mit
ChristopherChudzicki/math3d,stardust66/math3d,stardust66/math3d,stardust66/math3d,stardust66/math3d,ChristopherChudzicki/math3d,ChristopherChudzicki/math3d,ChristopherChudzicki/math3d
44e3f48b8832dd14f8f9269c02929fa5d4a5c9af
src/librement/profile/models.py
src/librement/profile/models.py
from django.db import models from django_enumfield import EnumField from librement.utils.user_data import PerUserData from .enums import AccountEnum, CountryEnum class Profile(PerUserData('profile')): account_type = EnumField(AccountEnum) organisation = models.CharField(max_length=100, blank=True) add...
from django.db import models from django_enumfield import EnumField from librement.utils.user_data import PerUserData from .enums import AccountEnum, CountryEnum class Profile(PerUserData('profile')): account_type = EnumField(AccountEnum, default=AccountEnum.INDIVIDUAL) organisation = models.CharField(max_...
Make this the default so we can create User objects.
Make this the default so we can create User objects. Signed-off-by: Chris Lamb <29e6d179a8d73471df7861382db6dd7e64138033@debian.org>
Python
agpl-3.0
rhertzog/librement,rhertzog/librement,rhertzog/librement
e43345616e5240274e852a722c0c72c07f988b2a
registration/__init__.py
registration/__init__.py
VERSION = (0, 9, 0, 'beta', 1) def get_version(): from django.utils.version import get_version as django_get_version return django_get_version(VERSION) # pragma: no cover
VERSION = (1, 0, 0, 'final', 0) def get_version(): "Returns a PEP 386-compliant version number from VERSION." assert len(VERSION) == 5 assert VERSION[3] in ('alpha', 'beta', 'rc', 'final') # Now build the two parts of the version number: # main = X.Y[.Z] # sub = .devN - for pre-alpha releases...
Fix version number reporting so we can be installed before Django.
Fix version number reporting so we can be installed before Django.
Python
bsd-3-clause
myimages/django-registration,Troyhy/django-registration,mypebble/djregs,akvo/django-registration,Troyhy/django-registration,hacklabr/django-registration,gone/django-registration,akvo/django-registration,tdruez/django-registration,dirtycoder/django-registration,sandipagr/django-registration,kennydude/djregs,danielsamuel...
dc45f973faa5655e821364cfbdb96a3e17ff9893
app/__init__.py
app/__init__.py
import os from flask import Flask, Blueprint, request, jsonify app = Flask(__name__) # Read configuration to apply from environment config_name = os.environ.get('FLASK_CONFIG', 'development') # apply configuration cfg = os.path.join(os.getcwd(), 'config', config_name + '.py') app.config.from_pyfile(cfg) # Create a bl...
import os from flask import Flask, Blueprint, request, jsonify app = Flask(__name__) # Read configuration to apply from environment config_name = os.environ.get('FLASK_CONFIG', 'development') # apply configuration cfg = os.path.join(os.getcwd(), 'config', config_name + '.py') app.config.from_pyfile(cfg) # Create a bl...
Fix bug in token authentication
Fix bug in token authentication
Python
apache-2.0
javicacheiro/salt-git-synchronizer-proxy
f323676f1d3717ed2c84d06374cffbe2f1882cb4
blimp_boards/notifications/serializers.py
blimp_boards/notifications/serializers.py
from rest_framework import serializers from .models import Notification class NotificationSerializer(serializers.ModelSerializer): target = serializers.Field(source='data.target') action_object = serializers.Field(source='data.action_object') actor = serializers.Field(source='data.sender') timesince ...
from django.utils.six.moves.urllib import parse from rest_framework import serializers from ..files.utils import sign_s3_url from .models import Notification class NotificationSerializer(serializers.ModelSerializer): target = serializers.SerializerMethodField('get_target_data') action_object = serializers.S...
Fix action object and target thumbnail urls
Fix action object and target thumbnail urls
Python
agpl-3.0
jessamynsmith/boards-backend,jessamynsmith/boards-backend,GetBlimp/boards-backend
7bfefe50c00d86b55c0620207e9848c97aa28227
rml/units.py
rml/units.py
import numpy as np from scipy.interpolate import PchipInterpolator class UcPoly(): def __init__(self, coef): self.p = np.poly1d(coef) def machine_to_physics(self, machine_value): return self.p(machine_value) def physics_to_machine(self, physics_value): roots = (self.p - physics_v...
import numpy as np from scipy.interpolate import PchipInterpolator class UcPoly(object): def __init__(self, coef): self.p = np.poly1d(coef) def machine_to_physics(self, machine_value): return self.p(machine_value) def physics_to_machine(self, physics_value): roots = (self.p - phy...
Correct the definitions of old-style classes
Correct the definitions of old-style classes
Python
apache-2.0
razvanvasile/RML,willrogers/pml,willrogers/pml
d487e8d74d8bbbadf003cd128f80868cc5651d21
shenfun/optimization/__init__.py
shenfun/optimization/__init__.py
"""Module for optimized functions Some methods performed in Python may be slowing down solvers. In this optimization module we place optimized functions that are to be used instead of default Python methods. Some methods are implemented solely in Cython and only called from within the regular Python modules. """ impo...
"""Module for optimized functions Some methods performed in Python may be slowing down solvers. In this optimization module we place optimized functions that are to be used instead of default Python methods. Some methods are implemented solely in Cython and only called from within the regular Python modules. """ impo...
Use try clause for config in optimizer
Use try clause for config in optimizer
Python
bsd-2-clause
spectralDNS/shenfun,spectralDNS/shenfun,spectralDNS/shenfun
7c3c0fac58822bcfa7bbd69de5ce46b36f84740c
regulations/generator/link_flattener.py
regulations/generator/link_flattener.py
import re # <a> followed by another <a> without any intervening </a>s link_inside_link_regex = re.compile( ur"(?P<outer_link><a ((?!</a>).)*)(<a ((?!</a>).)*>" ur"(?P<internal_content>((?!</a>).)*)</a>)", re.IGNORECASE | re.DOTALL) def flatten_links(text): """ Fix <a> elements that have embedded ...
import re # <a> followed by another <a> without any intervening </a>s # outer_link - partial outer element up to the inner link # inner_content - content of the inner_link link_inside_link_regex = re.compile( ur"(?P<outer_link><a ((?!</a>).)*)<a .*?>(?P<inner_content>.*?)</a>", re.IGNORECASE | re.DOTALL) def...
Simplify regex using non-greedy qualifier
Simplify regex using non-greedy qualifier
Python
cc0-1.0
18F/regulations-site,tadhg-ohiggins/regulations-site,eregs/regulations-site,18F/regulations-site,tadhg-ohiggins/regulations-site,tadhg-ohiggins/regulations-site,eregs/regulations-site,18F/regulations-site,18F/regulations-site,eregs/regulations-site,eregs/regulations-site,tadhg-ohiggins/regulations-site
37b8cf1af7818fe78b31ed25622f3f91805ade01
test_bert_trainer.py
test_bert_trainer.py
import unittest import time import shutil import pandas as pd from bert_trainer import BERTTrainer from utils import * class TestBERT(unittest.TestCase): def __init__(self, *args, **kwargs): super(TestBERT, self).__init__(*args, **kwargs) self.output_dir = 'test_{}'.format(str(int(time.time()))) ...
import unittest import time import shutil import pandas as pd from bert_trainer import BERTTrainer from utils import * class TestBERT(unittest.TestCase): def __init__(self, *args, **kwargs): super(TestBERT, self).__init__(*args, **kwargs) self.output_dir = 'test_{}'.format(str(int(time.time()))) ...
Fix merge conflict in bert_trainer_example.py
Fix merge conflict in bert_trainer_example.py
Python
apache-2.0
googleinterns/smart-news-query-embeddings,googleinterns/smart-news-query-embeddings
ceb123e78b4d15c0cfe30198aa3fbbe71603472d
project/forms.py
project/forms.py
#! coding: utf-8 from django import forms from django.utils.translation import ugettext_lazy as _ from django.contrib.auth import authenticate class LoginForm(forms.Form): username = forms.CharField(label=_('Naudotojo vardas'), max_length=100, help_text=_('VU MIF uosis.mif.vu.lt ser...
#! coding: utf-8 from django import forms from django.utils.translation import ugettext_lazy as _ from django.contrib.auth import authenticate class LoginForm(forms.Form): username = forms.CharField(label=_('Naudotojo vardas'), max_length=100, help_text=_('VU MIF uosis.mif.vu.lt ser...
Update login form clean method to return full cleaned data.
Update login form clean method to return full cleaned data.
Python
agpl-3.0
InScience/DAMIS-old,InScience/DAMIS-old
d38180f627cf421268f64d94e0eec36a19573754
test_runner/utils.py
test_runner/utils.py
import logging import os import uuid from contextlib import contextmanager from subprocess import check_call, CalledProcessError LOG = logging.getLogger(__name__) def touch(directory, filename=None): file_path = os.path.join(directory, filename) if os.path.exists(file_path): os.utime(file_path, Non...
import logging import os import uuid from contextlib import contextmanager from subprocess import check_call, CalledProcessError LOG = logging.getLogger(__name__) def touch(directory, filename=None): file_path = os.path.join(directory, filename) if os.path.exists(file_path): os.utime(file_path, Non...
Add fallback to 'cwd' if not defined
Add fallback to 'cwd' if not defined
Python
mit
rcbops-qa/test_runner
096bd7e3357e85c57ec56695bfc16f0b4eab9c4d
pystil.py
pystil.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 by Florian Mounier, Kozea # This file is part of pystil, licensed under a 3-clause BSD license. """ pystil - An elegant site web traffic analyzer """ from pystil import app, config import werkzeug.contrib import sys config.freeze() if 'soup' in sys.ar...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 by Florian Mounier, Kozea # This file is part of pystil, licensed under a 3-clause BSD license. """ pystil - An elegant site web traffic analyzer """ from pystil import app, config import werkzeug.contrib.fixers import sys config.freeze() if 'soup' in...
Add the good old middleware
Add the good old middleware
Python
bsd-3-clause
Kozea/pystil,Kozea/pystil,Kozea/pystil,Kozea/pystil,Kozea/pystil
e7c5e62da700f51e69662689758ffebf70fa1494
cms/djangoapps/contentstore/context_processors.py
cms/djangoapps/contentstore/context_processors.py
import ConfigParser from django.conf import settings def doc_url(request): config_file = open(settings.REPO_ROOT / "docs" / "config.ini") config = ConfigParser.ConfigParser() config.readfp(config_file) # in the future, we will detect the locale; for now, we will # hardcode en_us, since we only ha...
import ConfigParser from django.conf import settings config_file = open(settings.REPO_ROOT / "docs" / "config.ini") config = ConfigParser.ConfigParser() config.readfp(config_file) def doc_url(request): # in the future, we will detect the locale; for now, we will # hardcode en_us, since we only have English d...
Read from doc url mapping file at load time, rather than once per request
Read from doc url mapping file at load time, rather than once per request
Python
agpl-3.0
ampax/edx-platform,Softmotions/edx-platform,dcosentino/edx-platform,chudaol/edx-platform,prarthitm/edxplatform,cyanna/edx-platform,jazztpt/edx-platform,motion2015/a3,nikolas/edx-platform,msegado/edx-platform,hkawasaki/kawasaki-aio8-0,LearnEra/LearnEraPlaftform,pabloborrego93/edx-platform,wwj718/ANALYSE,procangroup/edx-...
09f649ac0b14269067c43df9f879d963ab99cdac
backend/breach/views.py
backend/breach/views.py
import json from django.http import Http404, JsonResponse from django.views.decorators.csrf import csrf_exempt from breach.strategy import Strategy from breach.models import Victim def get_work(request, victim_id=0): assert(victim_id) try: victim = Victim.objects.get(pk=victim_id) except: ...
import json from django.http import Http404, JsonResponse from django.views.decorators.csrf import csrf_exempt from breach.strategy import Strategy from breach.models import Victim def get_work(request, victim_id=0): assert(victim_id) try: victim = Victim.objects.get(pk=victim_id) except: ...
Fix response with json for get_work
Fix response with json for get_work
Python
mit
dionyziz/rupture,dimkarakostas/rupture,dionyziz/rupture,dimkarakostas/rupture,dimriou/rupture,esarafianou/rupture,dimriou/rupture,esarafianou/rupture,dionyziz/rupture,dimkarakostas/rupture,esarafianou/rupture,dionyziz/rupture,dimriou/rupture,dimkarakostas/rupture,dionyziz/rupture,dimriou/rupture,dimkarakostas/rupture,d...
0d5c3b5f0c9278e834fc4df2a5d227972a1b513d
tests/unit/modules/file_test.py
tests/unit/modules/file_test.py
import tempfile from saltunittest import TestCase, TestLoader, TextTestRunner from salt import config as sconfig from salt.modules import file as filemod from salt.modules import cmdmod filemod.__salt__ = { 'cmd.run': cmdmod.run, } SED_CONTENT = """test some content /var/lib/foo/app/test here """ class FileMo...
import tempfile from saltunittest import TestCase, TestLoader, TextTestRunner from salt import config as sconfig from salt.modules import file as filemod from salt.modules import cmdmod filemod.__salt__ = { 'cmd.run': cmdmod.run, 'cmd.run_all': cmdmod.run_all } SED_CONTENT = """test some content /var/lib/fo...
Add `cmd.run_all` to `__salt__`. Required for the unit test.
Add `cmd.run_all` to `__salt__`. Required for the unit test.
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
fc27b35dd1ac34b19bdc2d71dd71704bd9321b9d
src/test/ed/db/pythonnumbers.py
src/test/ed/db/pythonnumbers.py
import types db = connect( "test" ); t = db.pythonnumbers t.drop() thing = { "a" : 5 , "b" : 5.5 } assert( type( thing["a"] ) == types.IntType ); assert( type( thing["b"] ) == types.FloatType ); t.save( thing ) thing = t.findOne() assert( type( thing["b"] ) == types.FloatType ); assert( type( thing["a"] ) == types...
import _10gen import types db = _10gen.connect( "test" ); t = db.pythonnumbers t.drop() thing = { "a" : 5 , "b" : 5.5 } assert( type( thing["a"] ) == types.IntType ); assert( type( thing["b"] ) == types.FloatType ); t.save( thing ) thing = t.findOne() assert( type( thing["b"] ) == types.FloatType ); assert( type( ...
Fix test for unwelded scopes.
Fix test for unwelded scopes.
Python
apache-2.0
babble/babble,babble/babble,babble/babble,babble/babble,babble/babble,babble/babble
d87a44367c5542ab8052c212e6d51f1532086dd1
testsuite/python3.py
testsuite/python3.py
#!/usr/bin/env python3 from typing import ClassVar, List # Annotated function (Issue #29) def foo(x: int) -> int: return x + 1 # Annotated variables #575 CONST: int = 42 class Class: cls_var: ClassVar[str] for_var: ClassVar[str] while_var: ClassVar[str] def_var: ClassVar[str] if_var: Class...
#!/usr/bin/env python3 from typing import ClassVar, List # Annotated function (Issue #29) def foo(x: int) -> int: return x + 1 # Annotated variables #575 CONST: int = 42 class Class: # Camel-caes cls_var: ClassVar[str] for_var: ClassVar[str] while_var: ClassVar[str] def_var: ClassVar[str] ...
Make identifiers camel-case; remove redundant space.
Make identifiers camel-case; remove redundant space.
Python
mit
PyCQA/pep8
0d96ff52ca66de8afd95fb6dc342e8529764e89b
tflitehub/lit.cfg.py
tflitehub/lit.cfg.py
import os import sys import lit.formats import lit.util import lit.llvm # Configuration file for the 'lit' test runner. lit.llvm.initialize(lit_config, config) # name: The name of this test suite. config.name = 'TFLITEHUB' config.test_format = lit.formats.ShTest() # suffixes: A list of file extensions to treat as...
import os import sys import lit.formats import lit.util import lit.llvm # Configuration file for the 'lit' test runner. lit.llvm.initialize(lit_config, config) # name: The name of this test suite. config.name = 'TFLITEHUB' config.test_format = lit.formats.ShTest() # suffixes: A list of file extensions to treat as...
Exclude test data utilities from lit.
Exclude test data utilities from lit.
Python
apache-2.0
iree-org/iree-samples,iree-org/iree-samples,iree-org/iree-samples,iree-org/iree-samples
4840763265675407ed9fc612dc8884d859bdc28e
recipe_scrapers/_abstract.py
recipe_scrapers/_abstract.py
from urllib import request from bs4 import BeautifulSoup HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7' } class AbstractScraper(): def __init__(self, url, test=False): if test: # when testing, we simply load a file ...
from urllib import request from bs4 import BeautifulSoup HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7' } class AbstractScraper(): def __init__(self, url, test=False): if test: # when testing, we simply load a file ...
Use context so the test file to get closed after tests
Use context so the test file to get closed after tests
Python
mit
hhursev/recipe-scraper
e59055e29b5cc6a027d3a24803cc05fd709cca90
functest/opnfv_tests/features/odl_sfc.py
functest/opnfv_tests/features/odl_sfc.py
#!/usr/bin/python # # Copyright (c) 2016 All rights reserved # This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # # http://www.apache.org/licenses/LICENSE-2.0 # import functest.core.feature_base...
#!/usr/bin/python # # Copyright (c) 2016 All rights reserved # This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # # http://www.apache.org/licenses/LICENSE-2.0 # import functest.core.feature_base...
Revert "Make SFC test a python call to main()"
Revert "Make SFC test a python call to main()" This reverts commit d5820bef80ea4bdb871380dbfe41db12290fc5f8. Robot test runs before SFC test and it imports https://github.com/robotframework/SSHLibrary which does a monkey patching in the python runtime / paramiko. Untill now sfc run in a new python process (clean) be...
Python
apache-2.0
opnfv/functest,mywulin/functest,opnfv/functest,mywulin/functest
f3702870cf912322061678cf7c827959cde2ac02
south/introspection_plugins/__init__.py
south/introspection_plugins/__init__.py
# This module contains built-in introspector plugins for various common # Django apps. # These imports trigger the lower-down files import south.introspection_plugins.geodjango import south.introspection_plugins.django_tagging import south.introspection_plugins.django_taggit import south.introspection_plugins.django_o...
# This module contains built-in introspector plugins for various common # Django apps. # These imports trigger the lower-down files import south.introspection_plugins.geodjango import south.introspection_plugins.django_tagging import south.introspection_plugins.django_taggit import south.introspection_plugins.django_o...
Add import of django-annoying patch
Add import of django-annoying patch
Python
apache-2.0
matthiask/south,matthiask/south
a268a886e0e3cab1057810f488feb6c2227414d3
users/serializers.py
users/serializers.py
from django.conf import settings from rest_framework import serializers from rest_framework.exceptions import ValidationError from users.models import User class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = ( 'username', 'email'...
from copy import deepcopy from django.conf import settings from django.contrib.auth import login from rest_framework import serializers from rest_framework.exceptions import ValidationError from users.models import User class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Us...
Fix bug in register aftter login
Fix: Fix bug in register aftter login
Python
bsd-2-clause
pinry/pinry,lapo-luchini/pinry,pinry/pinry,lapo-luchini/pinry,lapo-luchini/pinry,pinry/pinry,pinry/pinry,lapo-luchini/pinry
d8abffb340a852d69128977fa17bafdfc6babb71
tests/test_utils.py
tests/test_utils.py
from __future__ import print_function, division, absolute_import import numpy as np from .common import * from train.utils import preprocessImage, loadNetwork, predict from constants import * test_image = 234 * np.ones((*CAMERA_RESOLUTION, 3), dtype=np.uint8) def testPreprocessing(): image = preprocessImage(tes...
from __future__ import print_function, division, absolute_import import numpy as np from .common import * from train.utils import preprocessImage, loadNetwork, predict from constants import * test_image = 234 * np.ones((MAX_WIDTH, MAX_HEIGHT, 3), dtype=np.uint8) def testPreprocessing(): image = preprocessImage(...
Fix test for python 2
Fix test for python 2
Python
mit
sergionr2/RacingRobot,sergionr2/RacingRobot,sergionr2/RacingRobot,sergionr2/RacingRobot
9f216f1fdde41730b2680eed2174b1ba75d923be
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 .. import items class DatasetSpider(CrawlSpider): name = 'dataset' allowed_domains = ['data.gc.ca'] start_urls = ['http://data.gc.ca/data/en/datas...
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): pages = 9466 name = 'dataset' allowed_domains = ['data.gc.ca'] start_urls = [] for i in...
Add to start urls to contain all dataset pages
Add to start urls to contain all dataset pages
Python
mit
MaxLikelihood/CODE
194b72c7d3f0f60e73d1e11af716bfbdd9d4f08d
drupdates/plugins/slack/__init__.py
drupdates/plugins/slack/__init__.py
from drupdates.utils import * from drupdates.constructors.reports import * import json class slack(Reports): def __init__(self): self.currentDir = os.path.dirname(os.path.realpath(__file__)) self.settings = Settings(self.currentDir) def sendMessage(self, reportText): """ Post the report to a Slack ch...
from drupdates.utils import * from drupdates.constructors.reports import * import json class slack(Reports): def __init__(self): self.currentDir = os.path.dirname(os.path.realpath(__file__)) self.settings = Settings(self.currentDir) def sendMessage(self, reportText): """ Post the report to a Slack ch...
Add Slack channels the Slack Plugin
Add Slack channels the Slack Plugin
Python
mit
jalama/drupdates
988f4655a96076acd3bfb906d240bd4601fbe535
getalltext.py
getalltext.py
#!/usr/bin/env python3 """ A program to extract raw text from Telegram chat log """ import argparse from json import loads def main(): parser = argparse.ArgumentParser( description="Extract all raw text from a specific Telegram chat") parser.add_argument('filepath', help='the json chatlog file to ...
#!/usr/bin/env python3 """ A program to extract raw text from Telegram chat log """ import argparse from json import loads def main(): parser = argparse.ArgumentParser( description="Extract all raw text from a specific Telegram chat") parser.add_argument('filepath', help='the json chatlog file to ...
Add argument to print usernames
Add argument to print usernames
Python
mit
expectocode/telegram-analysis,expectocode/telegramAnalysis
9056746db7406e6640607210bea9e00a12c63926
ci/fix_paths.py
ci/fix_paths.py
import distutils.sysconfig from glob import glob import os from os.path import join as pjoin, basename from shutil import copy from sys import platform def main(): """ Copy HDF5 DLLs into installed h5py package """ # This is the function Tox also uses to locate site-packages (Apr 2019) sitepackages...
import distutils.sysconfig from glob import glob import os from os.path import join as pjoin, basename from shutil import copy from sys import platform def main(): """ Copy HDF5 DLLs into installed h5py package """ # This is the function Tox also uses to locate site-packages (Apr 2019) sitepackages...
Sort list of files inside h5py
Sort list of files inside h5py
Python
bsd-3-clause
h5py/h5py,h5py/h5py,h5py/h5py
3b091fba819f1ad69d0ce9e9038ccf5d14fea215
tests/core/tests/test_mixins.py
tests/core/tests/test_mixins.py
from core.models import Category from django.test.testcases import TestCase from django.urls import reverse class ExportViewMixinTest(TestCase): def setUp(self): self.url = reverse('export-category') self.cat1 = Category.objects.create(name='Cat 1') self.cat2 = Category.objects.create(na...
from core.models import Category from django.test.testcases import TestCase from django.urls import reverse class ExportViewMixinTest(TestCase): def setUp(self): self.url = reverse('export-category') self.cat1 = Category.objects.create(name='Cat 1') self.cat2 = Category.objects.create(na...
Correct mistaken assertTrue() -> assertEquals()
Correct mistaken assertTrue() -> assertEquals()
Python
bsd-2-clause
bmihelac/django-import-export,bmihelac/django-import-export,bmihelac/django-import-export,jnns/django-import-export,jnns/django-import-export,jnns/django-import-export,django-import-export/django-import-export,django-import-export/django-import-export,django-import-export/django-import-export,django-import-export/djang...
1ba3536e214e283f503db0a9bf0d1ac4aa64f771
tcconfig/_tc_command_helper.py
tcconfig/_tc_command_helper.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import, unicode_literals import errno import sys import subprocrunner as spr from ._common import find_bin_path from ._const import Tc, TcSubCommand from ._error import NetworkInterfaceNotFound...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import, unicode_literals import errno import sys import subprocrunner as spr from ._common import find_bin_path from ._const import Tc, TcSubCommand from ._error import NetworkInterfaceNotFound...
Change command installation check process
Change command installation check process To properly check even if the user is not root.
Python
mit
thombashi/tcconfig,thombashi/tcconfig
abd2df6436d7a4a1304bf521c0f0a6c8922e5826
src/benchmark_rank_filter.py
src/benchmark_rank_filter.py
#!/usr/bin/env python import sys import timeit import numpy from rank_filter import lineRankOrderFilter def benchmark(): input_array = numpy.random.normal(size=(100, 101, 102)) output_array = numpy.empty_like(input_array) lineRankOrderFilter(input_array, 25, 0.5, 0, output_array) def main(*argv): ...
#!/usr/bin/env python from __future__ import division import sys import timeit import numpy from rank_filter import lineRankOrderFilter def benchmark(): input_array = numpy.random.normal(size=(100, 101, 102)) output_array = numpy.empty_like(input_array) lineRankOrderFilter(input_array, 25, 0.5, 0, ou...
Use Python 3 division on Python 2
Use Python 3 division on Python 2 Make sure that floating point division is used on Python 2. This basically happens anyways as we have a floating point value divided by an integral value. Still it is good to ensure that our average doesn't get truncated by accident.
Python
bsd-3-clause
nanshe-org/rank_filter,DudLab/rank_filter,jakirkham/rank_filter,jakirkham/rank_filter,nanshe-org/rank_filter,nanshe-org/rank_filter,DudLab/rank_filter,DudLab/rank_filter,jakirkham/rank_filter
d608d9f474f089df8f5d6e0e899554f9324e84f3
squash/dashboard/urls.py
squash/dashboard/urls.py
from django.conf.urls import include, url from django.contrib import admin from rest_framework.authtoken.views import obtain_auth_token from rest_framework.routers import DefaultRouter from . import views api_router = DefaultRouter() api_router.register(r'jobs', views.JobViewSet) api_router.register(r'metrics', views....
from django.conf.urls import include, url from django.contrib import admin from rest_framework.authtoken.views import obtain_auth_token from rest_framework.routers import DefaultRouter from . import views admin.site.site_header = 'SQUASH Admin' api_router = DefaultRouter() api_router.register(r'jobs', views.JobViewSet...
Set title for SQUASH admin interface
Set title for SQUASH admin interface
Python
mit
lsst-sqre/qa-dashboard,lsst-sqre/qa-dashboard,lsst-sqre/qa-dashboard
918568524f1c5ef7264fee76597e8a88b6e2427f
src/ussclicore/utils/ascii_bar_graph.py
src/ussclicore/utils/ascii_bar_graph.py
# To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor. __author__="UShareSoft" def print_graph(values): max=0 for v in values: if len(v)>max: ...
__author__="UShareSoft" def print_graph(values): max=0 for v in values: if len(v)>max: max=len(v) for v in values: value = int(values[v]) if len(v)<max: newV=v+(" " * int(max-len(v))) ...
Fix bug in the ascii bar graph
Fix bug in the ascii bar graph
Python
apache-2.0
yanngit/ussclicore,usharesoft/ussclicore
205b832c287bdd587eff7ba266a4429f6aebb277
data/models.py
data/models.py
import numpy import ast from django.db import models class DataPoint(models.Model): name = models.CharField(max_length=600) exact_name = models.CharField(max_length=1000, null=True, blank=True) decay_feature = models.CharField(max_length=1000, null=True, blank=True) created = models.DateTimeField(aut...
import numpy import ast from django.db import models class DataPoint(models.Model): name = models.CharField(max_length=600) exact_name = models.CharField(max_length=1000, null=True, blank=True) decay_feature = models.CharField(max_length=1000, null=True, blank=True) created = models.DateTimeField(aut...
Fix __unicode__ for DataPoint model
Fix __unicode__ for DataPoint model
Python
mit
crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp
260daaad18e4889c0e468befd46c38d02bb1316a
tests/test_py35/test_client.py
tests/test_py35/test_client.py
import aiohttp async def test_async_with_session(loop): async with aiohttp.ClientSession(loop=loop) as session: pass assert session.closed
from contextlib import suppress import aiohttp from aiohttp import web async def test_async_with_session(loop): async with aiohttp.ClientSession(loop=loop) as session: pass assert session.closed async def test_close_resp_on_error_async_with_session(loop, test_server): async def handler(request)...
Add tests on closing connection by error
Add tests on closing connection by error
Python
apache-2.0
AraHaanOrg/aiohttp,rutsky/aiohttp,juliatem/aiohttp,singulared/aiohttp,moden-py/aiohttp,singulared/aiohttp,hellysmile/aiohttp,z2v/aiohttp,alex-eri/aiohttp-1,z2v/aiohttp,moden-py/aiohttp,alex-eri/aiohttp-1,z2v/aiohttp,arthurdarcet/aiohttp,KeepSafe/aiohttp,arthurdarcet/aiohttp,KeepSafe/aiohttp,rutsky/aiohttp,arthurdarcet/...
69d0cf6cc0d19f1669f56a361447935e375ac05c
indico/modules/events/logs/views.py
indico/modules/events/logs/views.py
# This file is part of Indico. # Copyright (C) 2002 - 2018 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
# This file is part of Indico. # Copyright (C) 2002 - 2018 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
Include SUIR JS on logs page
Include SUIR JS on logs page This is not pretty, as we don't even use SUIR there, but indico/utils/redux imports a module that imports SUIR and thus breaks the logs page if SUIR is not included.
Python
mit
DirkHoffmann/indico,indico/indico,OmeGak/indico,pferreir/indico,ThiefMaster/indico,ThiefMaster/indico,DirkHoffmann/indico,mvidalgarcia/indico,mvidalgarcia/indico,pferreir/indico,indico/indico,OmeGak/indico,mvidalgarcia/indico,indico/indico,pferreir/indico,ThiefMaster/indico,mic4ael/indico,indico/indico,DirkHoffmann/ind...
839f9edc811776b8898cdf1fa7116eec9aef50a7
tests/xmlsec/test_templates.py
tests/xmlsec/test_templates.py
import xmlsec def test_create_signature_template(): node = xmlsec.create_signature_template() assert node.tag.endswith('Signature') assert node.xpath('*[local-name() = "SignatureValue"]') assert node.xpath('*[local-name() = "SignedInfo"]') return node def test_add_reference(): node = test_...
import xmlsec def test_create_signature_template(): node = xmlsec.create_signature_template() assert node.tag.endswith('Signature') assert node.xpath('*[local-name() = "SignatureValue"]') assert node.xpath('*[local-name() = "SignedInfo"]') def test_add_reference(): node = xmlsec.create_signatur...
Add additional tests for templates.
Add additional tests for templates.
Python
mit
devsisters/python-xmlsec,concordusapps/python-xmlsec,mehcode/python-xmlsec,devsisters/python-xmlsec,mehcode/python-xmlsec,concordusapps/python-xmlsec
0d48a418787e5724078d3821d28c639f0a76c8b2
src/robot/htmldata/normaltemplate.py
src/robot/htmldata/normaltemplate.py
# Copyright 2008-2015 Nokia Networks # Copyright 2016- Robot Framework Foundation # # 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 ...
# Copyright 2008-2015 Nokia Networks # Copyright 2016- Robot Framework Foundation # # 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 reading log/report templates/dependencies in UTF-8.
Fix reading log/report templates/dependencies in UTF-8. Some of the updated js dependencies (#2419) had non-ASCII data in UTF-8 format but our code reading these files didn't take that into account.
Python
apache-2.0
robotframework/robotframework,robotframework/robotframework,HelioGuilherme66/robotframework,HelioGuilherme66/robotframework,robotframework/robotframework,HelioGuilherme66/robotframework
93fa014ea7a34834ae6bb85ea802879ae0026941
keystone/common/policies/revoke_event.py
keystone/common/policies/revoke_event.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add scope_types for revoke event policies
Add scope_types for revoke event policies This commit associates `system` to revoke event policies, since these policies were developed to assist the system in offline token validation. From now on, a warning will be logged when a project-scoped token is used to get revocation events. Operators can opt into requiring...
Python
apache-2.0
mahak/keystone,openstack/keystone,mahak/keystone,mahak/keystone,openstack/keystone,openstack/keystone
00ce59d43c4208846234652a0746f048836493f2
src/ggrc/services/signals.py
src/ggrc/services/signals.py
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: urban@reciprocitylabs.com # Maintained By: urban@reciprocitylabs.com from blinker import Namespace class Signals(object): signals = Namespace()...
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: urban@reciprocitylabs.com # Maintained By: urban@reciprocitylabs.com from blinker import Namespace class Signals(object): signals = Namespace(...
Fix new CA signal message
Fix new CA signal message
Python
apache-2.0
selahssea/ggrc-core,josthkko/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,kr41/ggrc-cor...
6c6934e8a36429e2a988835d8bd4d66fe95e306b
tensorflow_datasets/image/cifar_test.py
tensorflow_datasets/image/cifar_test.py
# coding=utf-8 # Copyright 2018 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
# coding=utf-8 # Copyright 2018 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
Move references of deleted generate_cifar10_like_example.py to the new name cifar.py
Move references of deleted generate_cifar10_like_example.py to the new name cifar.py PiperOrigin-RevId: 225386826
Python
apache-2.0
tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets
9feb84c39c6988ff31f3d7cb38852a457870111b
bin/readability_to_dr.py
bin/readability_to_dr.py
#!/usr/bin/env python3 import hashlib import json import os import sys print(sys.path) from gigacluster import Doc, dr, Tokenizer tok = Tokenizer() for root, dirs, files in os.walk(sys.argv[1]): dirs.sort() files = set(files) cluster_dr = os.path.join(root, 'cluster.dr') with open(cluster_dr, 'wb') as...
#!/usr/bin/env python3 from collections import defaultdict import hashlib import json import os import sys from gigacluster import Doc, dr, Tokenizer tok = Tokenizer() stats = defaultdict(int) for root, dirs, files in os.walk(sys.argv[1]): dirs.sort() files = set(files) cluster_dr = os.path.join(root, 'clu...
Check for empty cluster dr files.
Check for empty cluster dr files.
Python
mit
schwa-lab/gigacluster,schwa-lab/gigacluster
0d98a1c9b2682dde45196c8a3c8e89738aa3ab2a
litmus/cmds/__init__.py
litmus/cmds/__init__.py
#!/usr/bin/env python3 # Copyright 2015-2016 Samsung Electronics Co., Ltd. # # 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...
#!/usr/bin/env python3 # Copyright 2015-2016 Samsung Electronics Co., Ltd. # # 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...
Raise exception if sdb does not exist
Raise exception if sdb does not exist
Python
apache-2.0
dhs-shine/litmus
c74b777cc861963595593486cf803a1d7431ad65
matches/admin.py
matches/admin.py
from django.contrib import admin from .models import Match from .models import Tip def delete_tips(modeladmin, request, queryset): for match in queryset: tips = Tip.objects.filter(match = match) for tip in tips: tip.score = 0 tip.scoring_field = "" tip.is_score_c...
from django.contrib import admin from .models import Match from .models import Tip def delete_tips(modeladmin, request, queryset): for match in queryset: tips = Tip.objects.filter(match = match) for tip in tips: tip.score = 0 tip.scoring_field = "" tip.is_score_c...
Add action to zero out tips for given match
Add action to zero out tips for given match
Python
mit
leventebakos/football-ech,leventebakos/football-ech
d073de94f1896239bd6120893b6a94c43061a279
byceps/util/image/models.py
byceps/util/image/models.py
""" byceps.util.image.models ~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2017 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from collections import namedtuple from enum import Enum class Dimensions(namedtuple('Dimensions', ['width', 'height'])): """A 2D image's width and height.""" ...
""" byceps.util.image.models ~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2017 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from collections import namedtuple from enum import Enum class Dimensions(namedtuple('Dimensions', ['width', 'height'])): """A 2D image's width and height.""" ...
Remove type ignore comment from functional enum API call
Remove type ignore comment from functional enum API call This is supported as of Mypy 0.510 and no longer raises an error.
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps
4af5e3c9e48ff997084d5316f384b3c6411edaa3
test/dump.py
test/dump.py
import subprocess from tempfile import NamedTemporaryFile def dump_table(table): def handle_record(record, fields): def handle_field(column, field): return '%d:%d:%d %s' % (record, column, len(field), field) return '\n'.join(handle_field(column, field) for (column, field) in ...
import subprocess import tempfile def dump_table(table): def handle_record(record, fields): def handle_field(column, field): return '%d:%d:%d %s' % (record, column, len(field), field) return '\n'.join(handle_field(column, field) for (column, field) in enumerate(fields)) ...
Use 'import' for 'tempfile' module
Use 'import' for 'tempfile' module
Python
mit
jvirtanen/fields,jvirtanen/fields
5b10184e132004e2b9bd6424fc56cf7f4fc24716
imagersite/imager_profile/models.py
imagersite/imager_profile/models.py
"""Models.""" from django.db import models # Create your models here. class ImagerProfile(models.Model): """Imager Profile Model.""" camera_model = models.CharField(max_length=200) photography_type = models.TextField() friends = models.ManyToManyField('self') region = models.CharField(max_lengt...
"""Models.""" from django.db import models from django.contrib.auth.models import User # Create your models here. class ImagerProfile(models.Model): """Imager Profile Model.""" camera_model = models.CharField(max_length=200) photography_type = models.TextField() # friends = models.ManyToManyField('...
Add model manager, still needs work
Add model manager, still needs work
Python
mit
DZwell/django-imager
27d7ab7ecca0d2e6307dbcb1317b486fe77a97d7
cyder/core/system/models.py
cyder/core/system/models.py
from django.db import models from cyder.base.mixins import ObjectUrlMixin from cyder.base.models import BaseModel from cyder.cydhcp.keyvalue.models import KeyValue class System(BaseModel, ObjectUrlMixin): name = models.CharField(max_length=255, unique=False) search_fields = ('name',) display_fields = ('...
from django.db import models from cyder.base.mixins import ObjectUrlMixin from cyder.base.models import BaseModel from cyder.base.helpers import get_display from cyder.cydhcp.keyvalue.models import KeyValue class System(BaseModel, ObjectUrlMixin): name = models.CharField(max_length=255, unique=False) search...
Revert system names to normal
Revert system names to normal
Python
bsd-3-clause
drkitty/cyder,OSU-Net/cyder,drkitty/cyder,murrown/cyder,zeeman/cyder,OSU-Net/cyder,zeeman/cyder,murrown/cyder,akeym/cyder,akeym/cyder,akeym/cyder,zeeman/cyder,drkitty/cyder,OSU-Net/cyder,zeeman/cyder,murrown/cyder,akeym/cyder,murrown/cyder,drkitty/cyder,OSU-Net/cyder
78f6bda69c7cdcb52057971edc0853b0045aa31a
gitfs/views/history.py
gitfs/views/history.py
from datetime import datetime from errno import ENOENT from stat import S_IFDIR from pygit2 import GIT_SORT_TIME from gitfs import FuseOSError from log import log from .view import View class HistoryView(View): def getattr(self, path, fh=None): ''' Returns a dictionary with keys identical to th...
import os from stat import S_IFDIR from pygit2 import GIT_FILEMODE_TREE from log import log from .view import View class HistoryView(View): def getattr(self, path, fh=None): ''' Returns a dictionary with keys identical to the stat C structure of stat(2). st_atime, st_mtime and st...
Add the possibility of browsing the tree of a particular commit.
Add the possibility of browsing the tree of a particular commit.
Python
apache-2.0
PressLabs/gitfs,rowhit/gitfs,bussiere/gitfs,ksmaheshkumar/gitfs,PressLabs/gitfs
84bada1b92e18dad8499964ddf8a4f8120a9cc9e
vsut/case.py
vsut/case.py
class TestCase: def assertEqual(value, expected): if value != expected: raise CaseFailed("{0} != {1}") def assertTrue(value): assertEqual(value, True) def assertFalse(value): assertEqual(value, False) class CaseFailed(Exception): def __init__(self, message): ...
class TestCase: def assertEqual(self, value, expected): if value != expected: raise CaseFailed("{0} != {1}".format(value, expected)) def assertTrue(self, value): assertEqual(value, True) def assertFalse(self, value): assertEqual(value, False) class CaseFailed(Exceptio...
Fix missing self in class methods and wrong formatting
Fix missing self in class methods and wrong formatting
Python
mit
zillolo/vsut-python
16767206ba1a40dbe217ec9e16b052c848f84b10
converter.py
converter.py
from pydub import AudioSegment from io import BytesIO def convert_to_ogg(f): bio = BytesIO() AudioSegment.from_file(f).export(bio, format='ogg') bio.seek(0) return bio
from pydub import AudioSegment from io import BytesIO def convert_to_ogg(f): bio = BytesIO() AudioSegment.from_file(f).export(bio, format='ogg', codec='libopus') bio.seek(0) return bio
Use libopus codec while converting to Voice
Use libopus codec while converting to Voice
Python
mit
MelomanCool/telegram-audiomemes
85be5c1e0510d928f8b5a9a3de77ce674bf38dc4
datafilters/extra_lookup.py
datafilters/extra_lookup.py
class Extra(object): def __init__(self, where=None, tables=None): self.where = where if where is not None else [] self.tables = tables if tables is not None else [] def is_empty(self): return self.where or self.tables def add(self, extra): self.where.extend(extra.where) ...
class Extra(object): def __init__(self, where=None, tables=None): self.where = where if where is not None else [] self.tables = tables if tables is not None else [] def is_empty(self): return self.where or self.tables def add(self, extra): self.where.extend(extra.where) ...
Add a magic member __nonzero__ to Extra
Add a magic member __nonzero__ to Extra
Python
mit
zorainc/django-datafilters,freevoid/django-datafilters,zorainc/django-datafilters
f359aa0eef680a3cc11cacaac4b20ade29594bcd
slave/skia_slave_scripts/flavor_utils/xsan_build_step_utils.py
slave/skia_slave_scripts/flavor_utils/xsan_build_step_utils.py
#!/usr/bin/env python # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Utilities for ASAN,TSAN,etc. build steps. """ from default_build_step_utils import DefaultBuildStepUtils from utils import she...
#!/usr/bin/env python # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Utilities for ASAN,TSAN,etc. build steps. """ from default_build_step_utils import DefaultBuildStepUtils from utils import she...
Update xsan flavor now that they're running on GCE bots.
Update xsan flavor now that they're running on GCE bots. - Don't add ~/llvm-3.4 to PATH: we've installed Clang 3.4 systemwide. - Don't `which clang` or `clang --version`: tools/xsan_build does it anyway. - Explicitly disable LSAN. Clang 3.5 seems to enable this by default. Going to submit this before review fo...
Python
bsd-3-clause
Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbo...
4e7c71304710178dbd668073ecfca59e8da459df
tacker/db/models_v1.py
tacker/db/models_v1.py
# Copyright (c) 2012 OpenStack Foundation. # 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...
# Copyright (c) 2012 OpenStack Foundation. # 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...
Remove unused model class from db layer
Remove unused model class from db layer Change-Id: I42cf91dc3132d0d0f2f509b5350958b7499c68f9
Python
apache-2.0
zeinsteinz/tacker,openstack/tacker,priya-pp/Tacker,trozet/tacker,stackforge/tacker,openstack/tacker,trozet/tacker,priya-pp/Tacker,openstack/tacker,stackforge/tacker,zeinsteinz/tacker
89bc764364137d18d825d316f5433e25cf9c4ceb
jungle/cli.py
jungle/cli.py
# -*- coding: utf-8 -*- import click class JungleCLI(click.MultiCommand): """Jangle CLI main class""" def list_commands(self, ctx): """return available modules""" return ['ec2', 'elb'] def get_command(self, ctx, name): """get command""" mod = __import__('jungle.' + name,...
# -*- coding: utf-8 -*- import click from jungle import __version__ class JungleCLI(click.MultiCommand): """Jangle CLI main class""" def list_commands(self, ctx): """return available modules""" return ['ec2', 'elb'] def get_command(self, ctx, name): """get command""" mo...
Add version number to help text
Add version number to help text
Python
mit
achiku/jungle
d4f5471a7975df526751ffa5c0653e6fe058227f
trex/urls.py
trex/urls.py
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from django.conf.urls import patterns, include, url from django.contrib import admin from trex.views.project import ( ProjectListCreateAPIView, ProjectDetailAPIView) urlpat...
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from django.conf.urls import patterns, include, url from django.contrib import admin from trex.views.project import ( ProjectListCreateAPIView, ProjectDetailAPIView, EntryDet...
Add url mapping for EntryDetailAPIView
Add url mapping for EntryDetailAPIView
Python
mit
bjoernricks/trex,bjoernricks/trex
c13fb7a0decf8b5beb0399523f4e9b9b7b71b361
opps/core/tags/views.py
opps/core/tags/views.py
# -*- encoding: utf-8 -*- from django.utils import timezone from django.contrib.sites.models import get_current_site from opps.views.generic.list import ListView from opps.containers.models import Container class TagList(ListView): model = Container template_name_suffix = '_tags' def get_context_data(se...
# -*- encoding: utf-8 -*- from django.utils import timezone from django.contrib.sites.models import get_current_site from django.core.cache import cache from django.conf import settings from opps.views.generic.list import ListView from opps.containers.models import Container from .models import Tag class TagList(Li...
Add new approach on taglist get_queryset
Add new approach on taglist get_queryset
Python
mit
jeanmask/opps,YACOWS/opps,opps/opps,opps/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,williamroot/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,opps/opps,williamroot/opps,YACOWS/opps,opps/opps,YACOWS/opps
e7ccf47114bbae254f40029b9188eacc6d1c5465
IPython/html/widgets/__init__.py
IPython/html/widgets/__init__.py
from .widget import Widget, DOMWidget, CallbackDispatcher, register from .widget_bool import Checkbox, ToggleButton from .widget_button import Button from .widget_box import Box, Popup, FlexBox, HBox, VBox from .widget_float import FloatText, BoundedFloatText, FloatSlider, FloatProgress, FloatRangeSlider from .widget_...
from .widget import Widget, DOMWidget, CallbackDispatcher, register from .widget_bool import Checkbox, ToggleButton from .widget_button import Button from .widget_box import Box, Popup, FlexBox, HBox, VBox from .widget_float import FloatText, BoundedFloatText, FloatSlider, FloatProgress, FloatRangeSlider from .widget_...
Add warning to widget namespace import.
Add warning to widget namespace import.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
e90e4fe8ad2679ff978d4d8b69ea2b9402029ccd
pinax/apps/account/context_processors.py
pinax/apps/account/context_processors.py
from account.models import Account, AnonymousAccount def openid(request): return {'openid': request.openid} def account(request): if request.user.is_authenticated(): try: account = Account._default_manager.get(user=request.user) except Account.DoesNotExist: account = A...
from account.models import Account, AnonymousAccount def openid(request): if hasattr(request, "openid"): openid = request.openid else: openid = None return { "openid": openid, } def account(request): if request.user.is_authenticated(): try: account = A...
Handle no openid attribute on request in openid context processor
Handle no openid attribute on request in openid context processor
Python
mit
amarandon/pinax,alex/pinax,amarandon/pinax,amarandon/pinax,alex/pinax,amarandon/pinax,alex/pinax
207c3fc8467c7f216e06b88f87433dc4eb46e13c
tests/name_injection_test.py
tests/name_injection_test.py
"""Test for the name inject utility.""" from drudge import Drudge def test_drudge_injects_names(): """Test the name injection method of drudge.""" dr = Drudge(None) # Dummy drudge. string_name = 'string_name' dr.set_name(string_name) dr.set_name(1, 'one') dr.inject_names(suffix='_') a...
"""Test for the name inject utility.""" import types from drudge import Drudge def test_drudge_injects_names(): """Test the name injection method of drudge.""" # Dummy drudge. dr = Drudge(types.SimpleNamespace(defaultParallelism=1)) string_name = 'string_name' dr.set_name(string_name) dr.s...
Fix name injection test for the new Drudge update
Fix name injection test for the new Drudge update
Python
mit
tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge
27ab5b022dec68f18d07988b97d65ec8fd8db83e
zenaida/contrib/hints/views.py
zenaida/contrib/hints/views.py
from zenaida.contrib.hints.models import Dismissed from zenaida.contrib.hints.forms import DismissHintForm from django.http import (HttpResponse, HttpResponseNotAllowed, HttpResponseBadRequest, HttpResponseRedirect) def dismiss(request): if not request.POST: return HttpResponseNotA...
from zenaida.contrib.hints.models import Dismissed from zenaida.contrib.hints.forms import DismissHintForm from django.core.exceptions import SuspiciousOperation from django.http import (HttpResponse, HttpResponseNotAllowed, HttpResponseBadRequest, HttpResponseRedirect) from django.utils.http i...
Check url safety before redirecting. Safety first!
[hints] Check url safety before redirecting. Safety first!
Python
bsd-3-clause
littleweaver/django-zenaida,littleweaver/django-zenaida,littleweaver/django-zenaida,littleweaver/django-zenaida
d73654fd4d11a2bf5730c6fbf4bc2167593f7cc4
queue_timings.py
queue_timings.py
# queue_timings.py # Analysis script for bodyfetcher queue timings. Call from the command line using Python 3. import os.path import platform if int(platform.python_version_tuple()[0]) == 2: import cPickle as pickle elif int(platform.python_version_tuple()[0]) == 3: import pickle else: raise EnvironmentErr...
# queue_timings.py # Analysis script for bodyfetcher queue timings. Call from the command line using Python 3. import os.path import cPickle as pickle def main(): if os.path.isfile("bodyfetcherQueueTimings.p"): try: with open("bodyfetcherQueueTimings.p", "rb") as f: queue_data...
Revert "Python2/3 Reverse Compat functionality, also 'return' if EOFError"
Revert "Python2/3 Reverse Compat functionality, also 'return' if EOFError" This reverts commit f604590ca7a704ef941db5342bae3cef5c60cf2e.
Python
apache-2.0
Charcoal-SE/SmokeDetector,Charcoal-SE/SmokeDetector
8a40d0df910cf9e17db99155ba148c69737809dc
ConnorBrozic-CymonScriptA2P2.py
ConnorBrozic-CymonScriptA2P2.py
#!/usr/bin/python #SRT411 Assignment 2 - Part 2 #Cymon API Interaction #Written by: Connor Brozic #Malware Domains retrieved from https://malwaredomains.usu.edu/ #Implements Cymon API Calls #Import time for sleep function. #Import Cymon to allow for Cymon API calls import time from cymon import Cymon #Personal Key Re...
#!/usr/bin/python #SRT411 Assignment 2 - Part 2 #Cymon API Interaction #Written by: Connor Brozic #Malware Domains retrieved from https://malwaredomains.usu.edu/ #Implements Cymon API Calls #Import time for sleep function. #Import Cymon to allow for Cymon API calls import time from cymon import Cymon #Personal Key Re...
Update to Script, Fixed malware domain file name
Update to Script, Fixed malware domain file name Fixed malware domains file name to accurately represent the file opened. (Better than text.txt)
Python
mit
ConnorBrozic/SRT411-Assignment2
f2012869d3e16f0a610e18021e6ec8967eddf635
tests/sqltypes_test.py
tests/sqltypes_test.py
import enum from sqlalchemy.schema import Column from sqlalchemy.types import Integer from cliche.sqltypes import EnumType from cliche.orm import Base class Color(enum.Enum): red = 1 green = 2 blue = 3 class ColorTable(Base): __tablename__ = 'color_table' id = Column(Integer, primary_key=Tr...
import enum from sqlalchemy.schema import Column from sqlalchemy.types import Integer from cliche.sqltypes import EnumType from cliche.orm import Base class Color(enum.Enum): red = 1 green = 2 blue = 3 class ColorTable(Base): __tablename__ = 'color_table' id = Column(Integer, primary_key=Tr...
Add name to EnumType in test since pgsql needs it.
Add name to EnumType in test since pgsql needs it.
Python
mit
item4/cliche,clicheio/cliche,item4/cliche,clicheio/cliche,clicheio/cliche
3471024a63f2bf55763563693f439a704291fc7d
examples/apt.py
examples/apt.py
from pyinfra import host from pyinfra.modules import apt SUDO = True code_name = host.fact.linux_distribution['release_meta'].get('DISTRIB_CODENAME') print(host.fact.linux_name, code_name) if host.fact.linux_name in ['Debian', 'Ubuntu']: apt.packages( {'Install some packages'}, ['vim-addon-manag...
from pyinfra import host from pyinfra.modules import apt SUDO = True code_name = host.fact.linux_distribution['release_meta'].get('DISTRIB_CODENAME') print(host.fact.linux_name, code_name) if host.fact.linux_name in ['Debian', 'Ubuntu']: apt.packages( {'Install some packages'}, ['vim-addon-manag...
Comment out the bitcoin PPA code.
Comment out the bitcoin PPA code. The bitcoin PPA is no longer maintained/supported.
Python
mit
Fizzadar/pyinfra,Fizzadar/pyinfra
d20039737d1e25f4462c4865347fa22411045677
budgetsupervisor/users/models.py
budgetsupervisor/users/models.py
from django.db import models from django.contrib.auth.models import AbstractUser from django.conf import settings from django.db.models.signals import post_save from saltedge.factory import get_saltedge_app class User(AbstractUser): pass class ProfileManager(models.Manager): def create_in_saltedge(self, pro...
from django.db import models from django.contrib.auth.models import AbstractUser from django.conf import settings from django.db.models.signals import post_save from saltedge.factory import get_saltedge_app class User(AbstractUser): pass class ProfileManager(models.Manager): def create_in_saltedge(self, pro...
Add placeholder for removing customer from saltedge
Add placeholder for removing customer from saltedge
Python
mit
ltowarek/budget-supervisor
72d65a50d31fc32fadccc907c91c8e66ad192beb
source/forms/search_form.py
source/forms/search_form.py
import django_countries from django import forms from django_countries.fields import LazyTypedChoiceField class SearchForm(forms.Form): title = forms.CharField(label='', widget=forms.TextInput(attrs={'placeholder': 'Movie Title'}), max_length=150) country = LazyTypedChoiceField(choices=django_countries.count...
import django_countries from django import forms from django_countries.fields import LazyTypedChoiceField class SearchForm(forms.Form): title = forms.CharField(label='', widget=forms.TextInput(attrs={'placeholder': 'Movie Title', 'onfocus': 'this.placeholder = ""', 'onblur': 'this.placeholder = "Movie Title"'}),...
Hide text input placeholder when onfocus
Hide text input placeholder when onfocus
Python
mit
jeremyrea/caterblu,jeremyrea/caterblu,jeremyrea/caterblu,jeremyrea/caterblu
2ac69facc6da342c38c9d851f1ec53a3be0b820a
spacy/tests/regression/test_issue2800.py
spacy/tests/regression/test_issue2800.py
'''Test issue that arises when too many labels are added to NER model.''' import random from ...lang.en import English def train_model(train_data, entity_types): nlp = English(pipeline=[]) ner = nlp.create_pipe("ner") nlp.add_pipe(ner) for entity_type in list(entity_types): ner.add_label(enti...
'''Test issue that arises when too many labels are added to NER model.''' from __future__ import unicode_literals import random from ...lang.en import English def train_model(train_data, entity_types): nlp = English(pipeline=[]) ner = nlp.create_pipe("ner") nlp.add_pipe(ner) for entity_type in list(...
Fix Python 2 test failure
Fix Python 2 test failure
Python
mit
aikramer2/spaCy,spacy-io/spaCy,honnibal/spaCy,aikramer2/spaCy,recognai/spaCy,aikramer2/spaCy,spacy-io/spaCy,explosion/spaCy,recognai/spaCy,aikramer2/spaCy,honnibal/spaCy,recognai/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,recognai/spaCy,spacy-io/spaCy,aikramer2/spaCy,honnibal/s...
f52465918a1243fc17a8cc5de0b05d68c3ca9218
src/tempel/urls.py
src/tempel/urls.py
from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^\+media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), (r'^admin/', include(admin.site.urls)), url(r...
from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^\+media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), (r'^admin/', include(admin.site.urls)), url(r...
Change url pattern from /e/ to /entry/
Change url pattern from /e/ to /entry/
Python
agpl-3.0
fajran/tempel
96199b0d6dfea835d6bb23bc87060e5732ef4094
server/lib/python/cartodb_services/cartodb_services/mapzen/matrix_client.py
server/lib/python/cartodb_services/cartodb_services/mapzen/matrix_client.py
import requests import json class MatrixClient: ONE_TO_MANY_URL = 'https://matrix.mapzen.com/one_to_many' def __init__(self, matrix_key): self._matrix_key = matrix_key """Get distances and times to a set of locations. See https://mapzen.com/documentation/matrix/api-reference/ Args: ...
import requests import json class MatrixClient: """ A minimal client for Mapzen Time-Distance Matrix Service Example: client = MatrixClient('your_api_key') locations = [{"lat":40.744014,"lon":-73.990508},{"lat":40.739735,"lon":-73.979713},{"lat":40.752522,"lon":-73.985015},{"lat":40.750117,"lon"...
Add example to code doc
Add example to code doc
Python
bsd-3-clause
CartoDB/geocoder-api,CartoDB/geocoder-api,CartoDB/geocoder-api,CartoDB/dataservices-api,CartoDB/dataservices-api,CartoDB/dataservices-api,CartoDB/geocoder-api,CartoDB/dataservices-api
0c0f56dba4b9f08f4cb443f2668cdee51fe80c32
chapter02/fahrenheitToCelsius.py
chapter02/fahrenheitToCelsius.py
#!/usr/bin/env python F = input("Gimme Fahrenheit: ") print (F-32) * 5 / 9 print (F-32) / 1.8000
#!/usr/bin/env python fahrenheit = input("Gimme Fahrenheit: ") print (fahrenheit-32) * 5 / 9 print (fahrenheit-32) / 1.8000
Change variable name to fahrenheit
Change variable name to fahrenheit
Python
apache-2.0
MindCookin/python-exercises
2664e9124af6b0d8f6b2eacd50f4d7e93b91e931
examples/GoBot/gobot.py
examples/GoBot/gobot.py
from minibot.bot import Bot from minibot.hardware.rpi.gpio import PWM from minibot.interface.servo import Servo import math import time L_MOTOR_PIN = 12 R_MOTOR_PIN = 18 class GoBot(Bot): def __init__(self): Bot.__init__(self, "GoBot") self.l_motor = Servo(PWM(L_MOTOR_PIN, 2, 15)) self.r...
""" GoBot Example """ from minibot.bot import Bot from minibot.hardware.rpi.gpio import PWM from minibot.interface.servo import Servo L_MOTOR_PIN = 12 R_MOTOR_PIN = 18 class GoBot(Bot): """ GoBot """ def __init__(self): Bot.__init__(self, "GoBot") self.l_motor = Servo(PWM(L_MOTOR_PIN...
Fix linting errors in GoBot
Fix linting errors in GoBot
Python
apache-2.0
cornell-cup/cs-minibot,cornell-cup/cs-minibot,cornell-cup/cs-minibot,cornell-cup/cs-minibot,cornell-cup/cs-minibot
3121d42bdca353d459ae61a6a93bdb854fcabe13
pymacaroons/__init__.py
pymacaroons/__init__.py
__author__ = 'Evan Cordell' __version__ = "0.5.1" __version_info__ = tuple(__version__.split('.')) __short_version__ = __version__ from .macaroon import Macaroon from .caveat import Caveat from .verifier import Verifier
__author__ = 'Evan Cordell' __version__ = "0.5.1" __version_info__ = tuple(__version__.split('.')) __short_version__ = __version__ from .macaroon import Macaroon from .caveat import Caveat from .verifier import Verifier __all__ = [ 'Macaroon', 'Caveat', 'Verifier', ]
Add __all__ to main module
Add __all__ to main module
Python
mit
illicitonion/pymacaroons,ecordell/pymacaroons,matrix-org/pymacaroons,matrix-org/pymacaroons
5dcfeb2a13f3ab9fe8b20e2620cbc15593cd56dc
pytest_watch/spooler.py
pytest_watch/spooler.py
# -*- coding: utf-8 from multiprocessing import Queue, Process, Event class Timer(Process): def __init__(self, interval, function, args=[], kwargs={}): super(Timer, self).__init__() self.interval = interval self.function = function self.args = args self.kwargs = kwargs ...
from threading import Thread, Event try: from queue import Queue except ImportError: from Queue import Queue class Timer(Thread): def __init__(self, interval, function, args=[], kwargs={}): super(Timer, self).__init__() self.interval = interval self.function = function sel...
Use threading instead of multiprocessing.
Use threading instead of multiprocessing.
Python
mit
blueyed/pytest-watch,rakjin/pytest-watch,ColtonProvias/pytest-watch,joeyespo/pytest-watch
af63afb5d5a010406557e325e759cdd310214c71
setup.py
setup.py
#!/Applications/anaconda/envs/Python3/bin def main(): x = input("Enter a number: ") print("Your number is {}".format(x)) if __name__ == '__main__': main()
#!/Applications/anaconda/envs/Python3/bin def main(): # Get input from user and display it feels = input("On a scale of 1-10, how do you feel? ") print("You selected: {}".format(feels)) # Python Data Types integer = 42 floater = 3.14 stringer = 'Hello, World!' tupler = (1, 2, 3) li...
Add PY quick start examples
Add PY quick start examples
Python
mit
HKuz/Test_Code
af328240631dd31b405e90c09052c1872490713d
setup.py
setup.py
from distutils.core import setup setup( name='gapi', version='0.5.0', author='Scott Hendrickson, Josh Montague', author_email='scott@drskippy.net', packages=[], scripts=['search_api.py', 'paged_search_api.py'], url='https://github.com/DrSkippy27/Gnip-Python-Search-API-Utilities', downlo...
from distutils.core import setup setup( name='gapi', version='0.5.2', author='Scott Hendrickson, Josh Montague', author_email='scott@drskippy.net', packages=[], scripts=['search_api.py', 'paged_search_api.py'], url='https://github.com/DrSkippy27/Gnip-Python-Search-API-Utilities', downlo...
Update pip package. Added proper requests dependency
Update pip package. Added proper requests dependency
Python
bsd-2-clause
DrSkippy/Gnip-Python-Search-API-Utilities,blehman/Gnip-Python-Search-API-Utilities,DrSkippy/Gnip-Python-Search-API-Utilities,blehman/Gnip-Python-Search-API-Utilities
d7df3f73b521327a6a7879d47ced1cc8c7a47a2d
tensorbayes/layers/sample.py
tensorbayes/layers/sample.py
import tensorflow as tf def GaussianSample(mean, var, scope): with tf.name_scope(scope): return tf.random_normal(tf.shape(mean), mean, tf.sqrt(var))
import tensorflow as tf def GaussianSample(mean, var, scope): with tf.name_scope(scope): return tf.random_normal(tf.shape(mean), mean, tf.sqrt(var)) def Duplicate(x, n_iw=1, n_mc=1, scope=None): """ Duplication function adds samples according to n_iw and n_mc. This function is specifically for im...
Add importance weighting and monte carlo feature
Add importance weighting and monte carlo feature
Python
mit
RuiShu/tensorbayes
4ca8b6140ea68ee3a4824220590ecd7150cf90a4
tor.py
tor.py
import socks import socket class Tor(object): """Tor class for socks proxy and controller""" def __init__(self, socks_port=9050): self.socks_port = socks_port self.default_socket = socket.socket
import socks import socket class Tor(object): """Tor class for socks proxy and controller""" def __init__(self, socks_port=9050): self.socks_port = socks_port self.default_socket = socket.socket def connect(self): """connect to Tor socks proxy""" socks.set_default_proxy(so...
Add connect and disconnect methods
Add connect and disconnect methods
Python
mit
MA3STR0/simpletor
abebc8a1153a9529a0f805207492cf2f5edece62
cbor2/__init__.py
cbor2/__init__.py
from .decoder import load, loads, CBORDecoder, CBORDecodeError # noqa from .encoder import dump, dumps, CBOREncoder, CBOREncodeError, shareable_encoder # noqa from .types import CBORTag, CBORSimpleValue, undefined # noqa
from .decoder import load, loads, CBORDecoder # noqa from .encoder import dump, dumps, CBOREncoder, shareable_encoder # noqa from .types import ( # noqa CBORError, CBOREncodeError, CBORDecodeError, CBORTag, CBORSimpleValue, undefined ) try: from _cbor2 import * # noqa except ImportError...
Make the package import both variants
Make the package import both variants Favouring the C variant where it successfully imports. This commit also handles generating the encoding dictionaries for the C variant from those defined for the Python variant (this is much simpler than doing this in C).
Python
mit
agronholm/cbor2,agronholm/cbor2,agronholm/cbor2
ed279b7f2cfcfd4abdf1da36d8406a3f63603529
dss/mobile/__init__.py
dss/mobile/__init__.py
""" TCP Server for mobile streaming """ try: import SocketServer as socketserver except ImportError: import socketserver from dss.tools import thread, show from dss.config import config from .handler import MediaHandler class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): daemo...
""" TCP Server for mobile streaming """ try: import SocketServer as socketserver except ImportError: import socketserver from dss.tools import thread, show from dss.config import config from dss.storage import db from .handler import MediaHandler # If some streams are active, the program did no close prope...
Mark all mobile streams as inactive when the program starts.
Mark all mobile streams as inactive when the program starts.
Python
bsd-3-clause
terabit-software/dynamic-stream-server,hmoraes/dynamic-stream-server,terabit-software/dynamic-stream-server,hmoraes/dynamic-stream-server,terabit-software/dynamic-stream-server,terabit-software/dynamic-stream-server,hmoraes/dynamic-stream-server,hmoraes/dynamic-stream-server
1e1c8a80199eacb64783a3fa69673059aa04da90
boardinghouse/tests/test_template_tag.py
boardinghouse/tests/test_template_tag.py
from django.test import TestCase from .models import AwareModel, NaiveModel from ..templatetags.boardinghouse import * class TestTemplateTags(TestCase): def test_is_schema_aware_filter(self): self.assertTrue(is_schema_aware(AwareModel())) self.assertFalse(is_schema_aware(NaiveModel())) de...
from django.test import TestCase from .models import AwareModel, NaiveModel from ..templatetags.boardinghouse import schema_name, is_schema_aware, is_shared_model from ..models import Schema class TestTemplateTags(TestCase): def test_is_schema_aware_filter(self): self.assertTrue(is_schema_aware(AwareModel...
Fix tests since we changed imports.
Fix tests since we changed imports.
Python
bsd-3-clause
luzfcb/django-boardinghouse,luzfcb/django-boardinghouse,luzfcb/django-boardinghouse
0e69718b24fe24e898c605b1823db1939bcadcd4
examples/pipes-repl.py
examples/pipes-repl.py
import sys import code from diesel import Application, Pipe, until DEFAULT_PROMPT = '>>> ' def readcb(): print 'Diesel Console' cmd = '' prompt = DEFAULT_PROMPT while 1: sys.stdout.write(prompt) sys.stdout.flush() input = yield until("\n") cmd += input if input...
import sys import code from diesel import Application, Pipe, until DEFAULT_PROMPT = '>>> ' def readcb(): from diesel.app import current_app print 'Diesel Console' cmd = '' prompt = DEFAULT_PROMPT interp = code.InteractiveInterpreter(locals={'app':current_app}) while 1: sys.stdout.writ...
Switch to using InteractiveInterpreter object instead of eval
Switch to using InteractiveInterpreter object instead of eval
Python
bsd-3-clause
dieseldev/diesel
0da65e9051ec6bf0c72f8dcc856a76547a1a125d
drf_multiple_model/views.py
drf_multiple_model/views.py
from drf_multiple_model.mixins import FlatMultipleModelMixin, ObjectMultipleModelMixin from rest_framework.generics import GenericAPIView class FlatMultipleModelAPIView(FlatMultipleModelMixin, GenericAPIView): def get(self, request, *args, **kwargs): return self.list(request, *args, **kwargs) def in...
from drf_multiple_model.mixins import FlatMultipleModelMixin, ObjectMultipleModelMixin from rest_framework.generics import GenericAPIView class FlatMultipleModelAPIView(FlatMultipleModelMixin, GenericAPIView): def get(self, request, *args, **kwargs): return self.list(request, *args, **kwargs) def in...
Fix initialization ofr sorting parameters
Fix initialization ofr sorting parameters
Python
mit
Axiologue/DjangoRestMultipleModels
359c563e200431e7da13766cf106f14f36b29bd4
shuup_workbench/urls.py
shuup_workbench/urls.py
# This file is part of Shuup. # # Copyright (c) 2012-2018, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from django.conf import settings from django.conf.urls import include, url from django.con...
# This file is part of Shuup. # # Copyright (c) 2012-2018, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from django.conf import settings from django.conf.urls import include, url from django.con...
Hide Django admin URLs from the workbench
Hide Django admin URLs from the workbench Django admin shouldn't be used by default with Shuup. Enabling this would require some attention towards Django filer in multi shop situations.
Python
agpl-3.0
shoopio/shoop,shoopio/shoop,shoopio/shoop
40c5f5ec789cd820666596244d3e748fa9539732
currencies/context_processors.py
currencies/context_processors.py
from currencies.models import Currency def currencies(request): currencies = Currency.objects.all() if not request.session.get('currency'): #request.session['currency'] = Currency.objects.get(code__exact='EUR') request.session['currency'] = Currency.objects.get(is_default__exact=True) re...
from currencies.models import Currency def currencies(request): currencies = Currency.objects.all() if not request.session.get('currency'): request.session['currency'] = Currency.objects.get(is_default__exact=True) return { 'CURRENCIES': currencies, 'currency': request.session['c...
Remove an old debug comment
Remove an old debug comment
Python
bsd-3-clause
panosl/django-currencies,bashu/django-simple-currencies,barseghyanartur/django-currencies,mysociety/django-currencies,marcosalcazar/django-currencies,pathakamit88/django-currencies,bashu/django-simple-currencies,jmp0xf/django-currencies,pathakamit88/django-currencies,ydaniv/django-currencies,ydaniv/django-currencies,my...
762147b8660a507ac5db8d0408162e8463b2fe8e
daiquiri/registry/serializers.py
daiquiri/registry/serializers.py
from rest_framework import serializers from daiquiri.core.serializers import JSONListField, JSONDictField class DublincoreSerializer(serializers.Serializer): identifier = serializers.ReadOnlyField() title = serializers.ReadOnlyField() description = serializers.SerializerMethodField() publisher = ser...
from rest_framework import serializers from daiquiri.core.serializers import JSONDictField, JSONListField class DublincoreSerializer(serializers.Serializer): identifier = serializers.ReadOnlyField() title = serializers.ReadOnlyField() description = serializers.SerializerMethodField() publisher = ser...
Fix status field in OAI-PMH
Fix status field in OAI-PMH
Python
apache-2.0
aipescience/django-daiquiri,aipescience/django-daiquiri,aipescience/django-daiquiri
b1deec08fe23eb89dd51471c6f11e2e3da69a563
aospy/__init__.py
aospy/__init__.py
"""aospy: management, analysis, and plotting of gridded climate data.""" from .__config__ import (user_path, LAT_STR, LON_STR, PFULL_STR, PHALF_STR, PLEVEL_STR, TIME_STR) from . import constants from .constants import Constant from . import numerics from .numerics import FiniteDiff from . impor...
"""aospy: management, analysis, and plotting of gridded climate data.""" from .__config__ import (user_path, LAT_STR, LON_STR, PFULL_STR, PHALF_STR, PLEVEL_STR, TIME_STR, TIME_STR_IDEALIZED) from . import constants from .constants import Constant from . import numerics from .numerics import Fin...
Add TIME_STR_IDEALIZED to string labels
Add TIME_STR_IDEALIZED to string labels
Python
apache-2.0
spencerkclark/aospy,spencerahill/aospy
e1cfdb6a95e11261755064e52720a38c99f18ddf
SatNOGS/base/api/serializers.py
SatNOGS/base/api/serializers.py
from rest_framework import serializers from base.models import (Antenna, Data, Observation, Satellite, Station, Transponder) class AntennaSerializer(serializers.ModelSerializer): class Meta: model = Antenna fields = ('frequency', 'band', 'antenna_type') class StationSer...
from django.conf import settings from django.contrib.sites.models import Site from rest_framework import serializers from base.models import (Antenna, Data, Observation, Satellite, Station, Transponder) class AntennaSerializer(serializers.ModelSerializer): class Meta: model = Ant...
Add full image url to Station serializer
Add full image url to Station serializer
Python
agpl-3.0
cshields/satnogs-network,cshields/satnogs-network,cshields/satnogs-network,cshields/satnogs-network
e45f23bbdce002cfbf644f2c91f319127f64b90c
mesa/urls.py
mesa/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin urlpatterns = patterns('', url(r'^', include('statuses.urls')), url(r'^admin/', include(admin.site.urls)), )
from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^', include('statuses.urls')), url(r'^admin/', include(admin.site.urls)), ]
Change pattern tuple to list
Change pattern tuple to list
Python
mit
matthewlane/mesa,matthewlane/mesa,matthewlane/mesa,matthewlane/mesa