commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
e480204e6a44de918740056aafd0a6a68f5efe39
Add problem 4 description
edmondkotowski/project-euler
problems/problem_4.py
problems/problem_4.py
# Largest palindrome product of two 3-digit numbers def is_palindrome(product): product = str(product) reverse = product[::-1] return product == reverse def largest_palindrome_product(): left_value = 999 max_product = 0 while left_value > 0: right_value = 999 while right_value...
def is_palindrome(product): product = str(product) reverse = product[::-1] return product == reverse def largest_palindrome_product(): left_value = 999 max_product = 0 while left_value > 0: right_value = 999 while right_value > 0: product = left_value * right_value ...
mit
Python
808d089b2b93671ef3d4331007fc1c3da2dea0b5
Use django 1.10 patterns style
davidfischer/rpc4django,davidfischer/rpc4django,davidfischer/rpc4django
example/urls.py
example/urls.py
from django.conf.urls import patterns from rpc4django.views import serve_rpc_request # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^example/', include('example.foo.urls')), # Uncomment the admin/doc...
from django.conf.urls import patterns # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^example/', include('example.foo.urls')), # Uncomment the admin/doc line below and add 'django.contrib.admindocs' ...
bsd-3-clause
Python
821d6c1dfe4569add7d5af74ae64ae04eb05db42
Enable test.dart on Mac after fixing flakiness caused by signal handlers.
dart-archive/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-archive/dart-s...
tools/test_wrapper.py
tools/test_wrapper.py
#!/usr/bin/env python # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. import os import platform import string import subprocess import sys from utils imp...
#!/usr/bin/env python # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. import os import platform import string import subprocess import sys from utils imp...
bsd-3-clause
Python
2d0285447c2474b7d3b1c60cfdcce51e42306315
Update distancia3d.py
Alan-Jairo/topgeo
topgeo/distancia3d.py
topgeo/distancia3d.py
def caldist3d(X1, Y1, Z1, X2, Y2, Z2): """ Esta funcion sirve para realizar el calculo de distancias entre dos puntos arbitrarios. """ # Importamos el modulo numpy import numpy as np n = (((X1-X2)**2)+((Y1-Y2)**2)+(Z1-Z2)) Dist = np.sqrt(n) return Dist
def caldist3d(X1, Y1, Z1, X2, Y2, Z2): """ Esta funcion sirve para realizar el calculo de distancias entre dos puntos arbitrarios. """ # Importamos los modulos numpy y pandas import numpy as np n = (((X1-X2)**2)+((Y1-Y2)**2)+(Z1-Z2)) Dist = np.sqrt(n) return Dist
mit
Python
eb43d2ed017259b9aa993c3057db5e7cf9bc054f
change mensage except
GrupoAndradeMartins/totvserprm
totvserprm/baseapi.py
totvserprm/baseapi.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from auth import create_service from dicttoxml import dicttoxml from lxml import objectify from totvserprm.utils import ClassFactory, normalize_xml from totvserprm.exceptions import ApiError class BaseApi(object): dataservername = '' def __init_...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from auth import create_service from dicttoxml import dicttoxml from lxml import objectify from totvserprm.utils import ClassFactory, normalize_xml from totvserprm.exceptions import ApiError class BaseApi(object): dataservername = '' def __init__...
mit
Python
884c5f17f1f739ffea1aa16205f147cb04d5dc99
add cast to float
tourbillonpy/tourbillon-log
tourbillon/log/log.py
tourbillon/log/log.py
import logging import re import time logger = logging.getLogger(__name__) def get_logfile_metrics(agent): def follow(thefile, run_event): thefile.seek(0, 2) while run_event.is_set(): line = thefile.readline() if not line: time.sleep(config['frequency']) ...
import logging import re import time logger = logging.getLogger(__name__) def get_logfile_metrics(agent): def follow(thefile, run_event): thefile.seek(0, 2) while run_event.is_set(): line = thefile.readline() if not line: time.sleep(config['frequency']) ...
apache-2.0
Python
9aebe02e2342b628cacddb68d2f894fca0bf7463
Fix socket overflow
HWDexperte/ts3observer
ts3observer/models.py
ts3observer/models.py
''' Created on Dec 1, 2014 @author: fechnert ''' class Client(object): ''' Represents the client ''' def __init__(self, clid, socket, **kwargs): ''' Fill the object dynamically with client attributes got from telnet ''' self.clid = clid self.socket = socket for key, value in k...
''' Created on Dec 1, 2014 @author: fechnert ''' class Client(object): ''' Represents the client ''' def __init__(self, clid, socket, **kwargs): ''' Fill the object dynamically with client attributes got from telnet ''' self.clid = clid self.socket = socket for key, value in k...
mit
Python
9a68ee8ee8d94b46dd8481e6d222c82338975602
Update documentation of txt2for_prediction script
NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts
txt2for_prediction.py
txt2for_prediction.py
"""Script to convert text file to input for embem classifier. The script tokenizes the text and writes it to a new file containing: <sentence id>\t<sentence (tokens separated by space)>\tNone\n Usage: python txt2ml.py <dir in> <dir out> """ import argparse import nltk.data from nltk.tokenize import word_tokenize imp...
"""Script to convert text file to input for embem classifier. The script tokenizes the text and writes it to a new file containing: <sentence id>\t<sentence (tokens separated by space)>\tNone\n Usage: python txt2ml.py <dir in> <dir out> """ import argparse import nltk.data from nltk.tokenize import word_tokenize imp...
apache-2.0
Python
212261782cbee393c87e760688bd819de689cc51
add post support for trace search
varnish/varnish-microservice-monitor,varnish/zipnish,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/zipnish,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/varnish-microservice-monitor,varnish/varnish-microservice-monitor,varnish/zipnish
ui/app/index/views.py
ui/app/index/views.py
from flask import request, redirect, render_template from . import index from .. import db @index.route('/', methods=['GET', 'POST']) def index(): # get database engine connection connection = db.engine.connect() # populate spans spans = [] result = connection.execute("SELECT DISTINCT span_name F...
from flask import request, redirect, render_template from . import index from .. import db @index.route('/', methods=['GET']) def index(): # get database engine connection connection = db.engine.connect() # populate spans spans = [] result = connection.execute("SELECT DISTINCT span_name FROM zipk...
bsd-2-clause
Python
46ab31112853fd1819a392d2b58ba60754a14b38
fix language reference in language command
Mstrodl/jose,lnmds/jose,Mstrodl/jose
ext/joselang.py
ext/joselang.py
#!/usr/bin/env python3 import discord import asyncio import sys sys.path.append("..") import jauxiliar as jaux import joseerror as je import josecommon as jcommon class JoseLanguage(jaux.Auxiliar): def __init__(self, cl): jaux.Auxiliar.__init__(self, cl) self.LANGLIST = [ 'pt', 'en' ...
#!/usr/bin/env python3 import discord import asyncio import sys sys.path.append("..") import jauxiliar as jaux import joseerror as je import josecommon as jcommon class JoseLanguage(jaux.Auxiliar): def __init__(self, cl): jaux.Auxiliar.__init__(self, cl) self.LANGLIST = [ 'pt', 'en' ...
mit
Python
85b7ce0fd6326cb2f4a965a854b94a9534b8cfd7
Fix off-by-one errors in page handling
matthiask/survey
survey/views.py
survey/views.py
from django.shortcuts import get_object_or_404, redirect, render from django.utils import simplejson from django.utils.translation import ugettext as _ from survey.forms import QuestionForm from survey.models import Survey, Question, SurveyAnswer def home(request, code): survey = get_object_or_404(Survey.objects...
from django.shortcuts import get_object_or_404, redirect, render from django.utils import simplejson from django.utils.translation import ugettext as _ from survey.forms import QuestionForm from survey.models import Survey, Question, SurveyAnswer def home(request, code): survey = get_object_or_404(Survey.objects...
bsd-3-clause
Python
adb0576ced11713fd75aa132107456f453bca669
Revert accidental removal of __future__.unicode_literals from taggit/admin.py
izquierdo/django-taggit
taggit/admin.py
taggit/admin.py
from __future__ import unicode_literals from django.contrib import admin from taggit.models import Tag, TaggedItem class TaggedItemInline(admin.StackedInline): model = TaggedItem class TagAdmin(admin.ModelAdmin): inlines = [TaggedItemInline] list_display = ["name", "slug"] ordering = ["name", "slu...
from django.contrib import admin from taggit.models import Tag, TaggedItem class TaggedItemInline(admin.StackedInline): model = TaggedItem class TagAdmin(admin.ModelAdmin): inlines = [TaggedItemInline] list_display = ["name", "slug"] ordering = ["name", "slug"] search_fields = ["name"] prep...
bsd-3-clause
Python
446ff54b0818df5b770c1295e230fb0e4be2aeff
Add logging
allanlei/django-multitenant
tenant/utils.py
tenant/utils.py
from django.utils.functional import curry from tenant.signals import tenant_provider import threading import os import sys import urlparse import logging logger = logging.getLogger(__name__) def get_current_tenant(sender=None, **hints): if sender is None: sender = threading.current_thread() te...
from django.utils.functional import curry from tenant.signals import tenant_provider import threading import os import sys import urlparse def get_current_tenant(sender=None, **hints): if sender is None: sender = threading.current_thread() tenant = None responses = tenant_provider.send(sender=s...
bsd-3-clause
Python
1737fa10f60a736f9a3a5bc6189b9940a635924d
fix real_n
andrenarchy/pseudopy
pseudopy/visualize.py
pseudopy/visualize.py
from matplotlib import pyplot import numpy from matplotlib.tri import Triangulation from . import compute def visualize(A, real_min=-1, real_max=1, real_n=50, imag_min=-1, imag_max=1, imag_n=50, levels=None ): real = numpy.linspace(real_min, real_max, real_...
from matplotlib import pyplot import numpy from matplotlib.tri import Triangulation from . import compute def visualize(A, real_min=-1, real_max=1, real_n=50, imag_min=-1, imag_max=1, imag_n=50, levels=None ): real = numpy.linspace(real_min, real_max, real_...
mit
Python
d50d5240821cc9dbdfbf29867444df99936559bb
fix base name
krono/pycket,pycket/pycket,samth/pycket,vishesh/pycket,pycket/pycket,cderici/pycket,samth/pycket,magnusmorton/pycket,pycket/pycket,vishesh/pycket,magnusmorton/pycket,cderici/pycket,magnusmorton/pycket,vishesh/pycket,krono/pycket,cderici/pycket,krono/pycket,samth/pycket
pycket/entry_point.py
pycket/entry_point.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # from pycket.expand import load_json_ast_rpython, expand_to_ast, PermException from pycket.interpreter import interpret_one, ToplevelEnv, interpret_module, GlobalConfig from pycket.error import SchemeException from pycket.option_helper import parse_args, ensure_json_ast f...
#! /usr/bin/env python # -*- coding: utf-8 -*- # from pycket.expand import load_json_ast_rpython, expand_to_ast, PermException from pycket.interpreter import interpret_one, ToplevelEnv, interpret_module, GlobalConfig from pycket.error import SchemeException from pycket.option_helper import parse_args, ensure_json_ast f...
mit
Python
ff62b9542704f2d30da0b536b392d570181bd599
Add a missing import to the ZayPay script
diath/pyfsw,diath/pyfsw,diath/pyfsw
pyfsw/views/zaypay.py
pyfsw/views/zaypay.py
from flask import render_template, request from pyfsw import app, db from pyfsw import login_required, current_user from pyfsw import Account, ZayPayHistory from pyfsw import ZAYPAY_OPTIONS import requests from bs4 import BeautifulSoup from time import time def zaypay_show_payment(payment_id, option): request = req...
from flask import render_template, request from pyfsw import app, db from pyfsw import login_required from pyfsw import Account, ZayPayHistory from pyfsw import ZAYPAY_OPTIONS import requests from bs4 import BeautifulSoup from time import time def zaypay_show_payment(payment_id, option): request = requests.get('htt...
mit
Python
1ec8c1e0505c2b550edec6631b03e02caf41f8cf
Format docstrings in utils/exc.py
cosmoharrigan/pylearn2,hyqneuron/pylearn2-maxsom,pombredanne/pylearn2,msingh172/pylearn2,msingh172/pylearn2,kastnerkyle/pylearn2,sandeepkbhat/pylearn2,se4u/pylearn2,aalmah/pylearn2,ddboline/pylearn2,mclaughlin6464/pylearn2,kose-y/pylearn2,KennethPierce/pylearnk,w1kke/pylearn2,daemonmaker/pylearn2,pkainz/pylearn2,JesseL...
pylearn2/utils/exc.py
pylearn2/utils/exc.py
__author__ = "Ian Goodfellow" """ Exceptions used by basic support utilities. """ class EnvironmentVariableError(Exception): """ An exception raised when a required environment variable is not defined """ def __init__(self, *args): super(EnvironmentVariableError,self).__init__(*args)
__author__ = "Ian Goodfellow" """ Exceptions used by basic support utilities. """ class EnvironmentVariableError(Exception): """ An exception raised when a required environment variable is not defined """ def __init__(self, *args): super(EnvironmentVariableError,self).__init__(*args)
bsd-3-clause
Python
f585746da7e4a01eed023b15a756df5422bf42b9
Bump version
cool-RR/PySnooper,cool-RR/PySnooper
pysnooper/__init__.py
pysnooper/__init__.py
# Copyright 2019 Ram Rachum and collaborators. # This program is distributed under the MIT license. ''' PySnooper - Never use print for debugging again Usage: import pysnooper @pysnooper.snoop() def your_function(x): ... A log will be written to stderr showing the lines executed and variables ch...
# Copyright 2019 Ram Rachum and collaborators. # This program is distributed under the MIT license. ''' PySnooper - Never use print for debugging again Usage: import pysnooper @pysnooper.snoop() def your_function(x): ... A log will be written to stderr showing the lines executed and variables ch...
mit
Python
3aa4f192f4ef4807586458234708a9424bb0b8e6
make separate tests for raised 'Error'
cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy
tests/cupy_tests/binary_tests/test_packing.py
tests/cupy_tests/binary_tests/test_packing.py
import numpy import unittest import pytest import cupy from cupy import testing @testing.gpu class TestPacking(unittest.TestCase): @testing.for_int_dtypes() @testing.numpy_cupy_array_equal() def check_packbits(self, data, xp, dtype): # Note numpy <= 1.9 raises an Exception when an input array is ...
import numpy import unittest import pytest import cupy from cupy import testing @testing.gpu class TestPacking(unittest.TestCase): @testing.for_int_dtypes() @testing.numpy_cupy_array_equal() def check_packbits(self, data, xp, dtype): # Note numpy <= 1.9 raises an Exception when an input array is ...
mit
Python
be39343f8db68b33a4fc246b5a7451344353aa94
Allow arbitrary output types in job graph (#462)
google/turbinia,google/turbinia,google/turbinia,google/turbinia,google/turbinia
tools/turbinia_job_graph.py
tools/turbinia_job_graph.py
#!/usr/bin/env python -v # -*- coding: utf-8 -*- # Copyright 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
# -*- coding: utf-8 -*- # Copyright 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
apache-2.0
Python
f5b5d3f65ab3377bab3c0273367d8ab2fa5dfdaa
Use str.split maxsplit in the time component
sdague/home-assistant,tmm1/home-assistant,mikaelboman/home-assistant,mikaelboman/home-assistant,florianholzapfel/home-assistant,postlund/home-assistant,partofthething/home-assistant,robbiet480/home-assistant,morphis/home-assistant,ct-23/home-assistant,betrisey/home-assistant,fbradyirl/home-assistant,shaftoe/home-assist...
homeassistant/components/scheduler/time.py
homeassistant/components/scheduler/time.py
""" homeassistant.components.scheduler.time ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ An event in the scheduler component that will call the service every specified day at the time specified. A time event need to have the type 'time', which service to call and at which time. { "type": "time", "service": "switch....
""" homeassistant.components.scheduler.time ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ An event in the scheduler component that will call the service every specified day at the time specified. A time event need to have the type 'time', which service to call and at which time. { "type": "time", "service": "switch....
apache-2.0
Python
8e225f890fd90112a125648cbd49507340cd3224
Fix type of EventIndex fields
tuomas777/linkedevents,aapris/linkedevents,aapris/linkedevents,City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,tuomas777/linkedevents,aapris/linkedevents,tuomas777/linkedevents,City-of-Helsinki/linkedevents
events/search_indexes.py
events/search_indexes.py
from haystack import indexes from .models import Event, Place, PublicationStatus from django.utils.html import strip_tags class EventIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) autosuggest = indexes.EdgeNgramField(model_attr='name') start_time ...
from haystack import indexes from .models import Event, Place, PublicationStatus from django.utils.html import strip_tags class EventIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) autosuggest = indexes.EdgeNgramField(model_attr='name') start_time ...
mit
Python
25ae3020afbb55efc90a2c7cb88434a7e1b45b5a
Fix an issue that may lead to an excessive memory usage in Tracer. (#1208)
iamahuman/angr,schieb/angr,angr/angr,angr/angr,iamahuman/angr,schieb/angr,angr/angr,schieb/angr,iamahuman/angr
angr/procedures/tracer/random.py
angr/procedures/tracer/random.py
import angr import claripy class random(angr.SimProcedure): #pylint:disable=arguments-differ IS_SYSCALL = True def run(self, buf, count, rnd_bytes): # return code r = self.state.solver.ite_cases(((self.state.cgc.addr_invalid(buf), self.state.cgc.EFAULT), ...
import angr import claripy class random(angr.SimProcedure): #pylint:disable=arguments-differ IS_SYSCALL = True def run(self, buf, count, rnd_bytes): # return code r = self.state.solver.ite_cases(((self.state.cgc.addr_invalid(buf), self.state.cgc.EFAULT), ...
bsd-2-clause
Python
40905893c296e2c812539079925adfd25e39d44f
Change location of default settings in WSGI
petervanderdoes/wger,rolandgeider/wger,DeveloperMal/wger,rolandgeider/wger,wger-project/wger,kjagoo/wger_stark,DeveloperMal/wger,wger-project/wger,petervanderdoes/wger,rolandgeider/wger,wger-project/wger,kjagoo/wger_stark,DeveloperMal/wger,DeveloperMal/wger,kjagoo/wger_stark,wger-project/wger,petervanderdoes/wger,rolan...
wger/wsgi.py
wger/wsgi.py
""" WSGI config for workout_manager project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLIC...
""" WSGI config for workout_manager project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLIC...
agpl-3.0
Python
977f114abae2779fa64b8086b083c6563dc20d83
Add gsutil to PATH in android_compile.py
Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbo...
slave/skia_slave_scripts/android_compile.py
slave/skia_slave_scripts/android_compile.py
#!/usr/bin/env python # Copyright (c) 2012 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. """ Compile step for Android """ from build_step import BuildStep from utils import shell_utils import os import sys ENV_VAR = '...
#!/usr/bin/env python # Copyright (c) 2012 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. """ Compile step for Android """ from build_step import BuildStep from utils import shell_utils import os import sys ENV_VAR = '...
bsd-3-clause
Python
f6d2295980898b9d20dfdb7a2c539e311c75fa8e
Remove whitespace.
flask-admin/flask-admin,flask-admin/flask-admin,flask-admin/flask-admin,flask-admin/flask-admin
flask_admin/contrib/sqla/typefmt.py
flask_admin/contrib/sqla/typefmt.py
from sqlalchemy.ext.associationproxy import _AssociationList from flask_admin.model.typefmt import BASE_FORMATTERS, EXPORT_FORMATTERS, \ list_formatter from sqlalchemy.orm.collections import InstrumentedList def choice_formatter(view, choice): """ Return label of selected choice see https://s...
from sqlalchemy.ext.associationproxy import _AssociationList from flask_admin.model.typefmt import BASE_FORMATTERS, EXPORT_FORMATTERS, \ list_formatter from sqlalchemy.orm.collections import InstrumentedList def choice_formatter(view, choice): """ Return label of selected choice see https://s...
bsd-3-clause
Python
d5c65218ea57944b202a5dcd7170eff445ffe743
Fix median calculation.
miaecle/deepchem,miaecle/deepchem,ktaneishi/deepchem,lilleswing/deepchem,deepchem/deepchem,ktaneishi/deepchem,miaecle/deepchem,deepchem/deepchem,lilleswing/deepchem,peastman/deepchem,peastman/deepchem,ktaneishi/deepchem,lilleswing/deepchem
examples/low_data/sider_graph_conv_one_fold.py
examples/low_data/sider_graph_conv_one_fold.py
""" Train low-data Sider models with graph-convolution. Test last fold only. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import tempfile import numpy as np import tensorflow as tf import deepchem as dc from deepchem.models.tensorgraph.models.graph_m...
""" Train low-data Sider models with graph-convolution. Test last fold only. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import tempfile import numpy as np import tensorflow as tf import deepchem as dc from deepchem.models.tensorgraph.models.graph_m...
mit
Python
d254e85bbca12ac03e17dd3654ce0f4107b765c8
Update fx_xrates.py
iamrobinhood12345/fx_15,iamrobinhood12345/fx_15
fx_15_min/fx_xrates.py
fx_15_min/fx_xrates.py
from requests import get from bs4 import BeautifulSoup from datetime import datetime from pytz import timezone from csv import writer PAGES = [ ] rates_dict = {} rates_tags = [] for each in PAGES: page = get(each) c = page.content soup = BeautifulSoup(c, 'html.parser') for each in soup.find_all('td'...
from requests import get from bs4 import BeautifulSoup from datetime import datetime from pytz import timezone from csv import writer PAGES = [ 'http://www.x-rates.com/table/?from=USD&amount=1', 'http://www.x-rates.com/table/?from=gbp&amount=1', 'http://www.x-rates.com/table/?from=eur&amount=1', 'http...
apache-2.0
Python
91b9a00c1f866704503fc2c46689df8125ec91fd
Update filter output
takkasila/TwitGeoSpa,takkasila/TwitGeoSpa
user_travel_filter.py
user_travel_filter.py
from user_tracker import * sys.path.insert(0, './Province') from province_point import * from geopy.distance import vincenty import operator def filterUser(userList, pvcmDict, speedT=0, distT=0, timeT=0, isAbove = True): 'Threshold: Speed in km/hr, distance in km, time in hour' opt = operator.ge if isAbove els...
from user_tracker import * sys.path.insert(0, './Province') from province_point import * from geopy.distance import vincenty import operator def filterUser(userList, pvcmDict, speedT=0, distT=0, timeT=0, isAbove = True): 'Threshold: Speed in km/hr, distance in km, time in hour' opt = operator.ge if isAbove els...
mit
Python
b8f55abbbf8ec14bed4342ec8081527533fd30d9
Add models based on existing libraries
Doveps/mono,Doveps/mono,Doveps/mono,Doveps/mono
api/savant/models.py
api/savant/models.py
from django.db import models class Comparison(models.Model): """A Comparison is a collection of diffs, for example as generated and exported by the bassist.""" diffs = models.ManyToManyField("Diff") class Diff(models.Model): # Hashed so it can't get added twice content = models.CharField(max...
from django.db import models class Comparison(models.Model): pass class Set(models.Model): pass class Playbook(models.Model): pass
mit
Python
d372ee4d8318d5be039002743657465fdb3e8c26
fix name of migration file.
alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin
migrations/versions/10_create_users.py
migrations/versions/10_create_users.py
"""empty message Revision ID: create_users Revises: None Create Date: 2015-11-24 10:39:19.827534 """ # revision identifiers, used by Alembic. revision = '10_create_users' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): op.create_table('roles', sa.Column('i...
"""empty message Revision ID: create_users Revises: None Create Date: 2015-11-24 10:39:19.827534 """ # revision identifiers, used by Alembic. revision = 'create_users' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): op.create_table('roles', sa.Column('id',...
mit
Python
4e314231b7d73d8bc07d6f1a1b9b1ffd7047246a
make sure shapes match in array equality
iskandr/dsltools
treelike/testing_helpers.py
treelike/testing_helpers.py
import sys import time import numpy as np from nose.tools import nottest def run_local_functions(prefix, locals_dict = None): if locals_dict is None: last_frame = sys._getframe() locals_dict = last_frame.f_back.f_locals good = set([]) # bad = set([]) for k, test in locals_dict.items(): if k.star...
import sys import time import numpy as np from nose.tools import nottest def run_local_functions(prefix, locals_dict = None): if locals_dict is None: last_frame = sys._getframe() locals_dict = last_frame.f_back.f_locals good = set([]) # bad = set([]) for k, test in locals_dict.items(): if k.star...
bsd-3-clause
Python
98fad1af84abe13eb64baad58c8a2faf3cd6cccb
Fix every single async task was broken
texastribune/tt_dailyemailblast,texastribune/tt_dailyemailblast
tt_dailyemailblast/tasks.py
tt_dailyemailblast/tasks.py
from celery.task import task from . import models from .send_backends import sync @task def send_daily_email_blasts(blast_pk): blast = models.DailyEmailBlast.objects.get(pk=blast_pk) sync.sync_daily_email_blasts(blast) @task def send_recipients_list(recipients_list_pk, blast_pk): blast = models.DailyEm...
from celery.task import task from . import models from . import send_backends @task def send_daily_email_blasts(blast_pk): blast = models.DailyEmailBlast.objects.get(pk=blast_pk) send_backends.sync_daily_email_blasts(blast) @task def send_recipients_list(recipients_list_pk, blast_pk): blast = models.Da...
apache-2.0
Python
e0716585b34bb22f70e16609a0071228f317cc3e
Use correct pen up position
mrzl/Composition37XY,fogleman/xy
xy/device.py
xy/device.py
import serial import time PORT = '/dev/tty.wchusbserial640' BAUD = 115200 UP = 10 DOWN = 40 class Device(object): def __init__(self, port=PORT, baud=BAUD, up=UP, down=DOWN, verbose=False): self.serial = serial.Serial(port, baud) if port else None self.up = up self.down = down sel...
import serial import time PORT = '/dev/tty.wchusbserial640' BAUD = 115200 UP = 10 DOWN = 40 class Device(object): def __init__(self, port=PORT, baud=BAUD, up=UP, down=DOWN, verbose=False): self.serial = serial.Serial(port, baud) if port else None self.up = up self.down = down sel...
mit
Python
d33a624fa6aedb93ae43ba1d2c0f6a76d90ff4a6
Allow directory of files to be indexed
zivy/SimpleITK-Notebooks,InsightSoftwareConsortium/SimpleITK-Notebooks,InsightSoftwareConsortium/SimpleITK-Notebooks,zivy/SimpleITK-Notebooks,InsightSoftwareConsortium/SimpleITK-Notebooks,thewtex/SimpleITK-Notebooks,zivy/SimpleITK-Notebooks,thewtex/SimpleITK-Notebooks,thewtex/SimpleITK-Notebooks
foldermd5sums.py
foldermd5sums.py
#!/usr/bin/env python """Script to read data files in a directory, compute their md5sums, and output them to a JSON file.""" import json import os import sys import hashlib def get_relative_filepaths(base_directory): """ Return a list of file paths without the base_directory prefix""" file_list = [] for ...
#!/usr/bin/env python """Script to read data files in a directory, compute their md5sums, and output them to a JSON file.""" import json import os import sys import hashlib def get_md5sums(directory): md5sums = [] for filename in os.listdir(directory): md5 = hashlib.md5() with open(os.path.jo...
apache-2.0
Python
5b709764e4efd79165765bd4a26a1a49f40d2cb6
rename function for better understanding
misisnik/testinsta,sudoguy/instabot,AlexBGoode/instabot,instagrambot/instabot,instagrambot/instapro,ohld/instabot,instagrambot/instabot,misisnik/testinsta,rasperepodvipodvert/instabot,vkgrd/instabot,Diapostrofo/instabot
examples/unsubscribe_not_mutually_followers.py
examples/unsubscribe_not_mutually_followers.py
#!/usr/bin/env python import pandas as pd import datetime, time import random import sys, os sys.path.append(os.path.join(sys.path[0],'../')) from instabot import API def unsubscribe_from_not_mutually_followers(api): """ Unsubscribes from people that don't follow you. I know that the name of this example ...
#!/usr/bin/env python import pandas as pd import datetime, time import random import sys, os sys.path.append(os.path.join(sys.path[0],'../')) from instabot import API def unsubscribe_not_mutually_followers(api): """ Unsubscribes from people that don't follow you. I know that the name of this example and f...
apache-2.0
Python
e07c34603385563515e5c438bd575f91a8e9dd1b
Upgrade gitiles-servlet to 0.2-7
GerritCodeReview/plugins_gitiles
external_plugin_deps.bzl
external_plugin_deps.bzl
load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_CENTRAL", "MAVEN_LOCAL", "maven_jar") COMMONMARK_VERSION = "0.10.0" def external_plugin_deps(): maven_jar( name = "gitiles-servlet", artifact = "com.google.gitiles:gitiles-servlet:0.2-7", sha1 = "f23b22cb27fe5c4a78f761492082159d17873f57", ...
load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_CENTRAL", "MAVEN_LOCAL", "maven_jar") COMMONMARK_VERSION = "0.10.0" def external_plugin_deps(): maven_jar( name = "gitiles-servlet", artifact = "com.google.gitiles:gitiles-servlet:0.2-6", sha1 = "74a3b22c9283adafafa1e388d62f693e5e2fab2b", ...
apache-2.0
Python
e850fe2ec9676ba1c3006a56af46d868ecbf2887
validate email before blacklist create
StreetVoice/django-celery-ses
djcelery_ses/views.py
djcelery_ses/views.py
# coding: utf-8 import json import re from django.http import HttpResponse, HttpResponseBadRequest from django.views.decorators.csrf import csrf_exempt from django.core.mail import mail_admins from django.core.validators import validate_email from django.core.exceptions import ValidationError from .models import Blac...
# coding: utf-8 import json from django.http import HttpResponse, HttpResponseBadRequest from django.views.decorators.csrf import csrf_exempt from django.core.mail import mail_admins from .models import Blacklist @csrf_exempt def sns_notification(request): """ Receive AWS SES bounce SNS notification """...
mit
Python
33bcf1c4953bf318d4581b9f7da2ec4b5770b7fe
bump to 0.1.14
pmorissette/ffn
ffn/__init__.py
ffn/__init__.py
from . import core from . import data from .data import get #from .core import year_frac, PerformanceStats, GroupStats, merge from .core import * core.extend_pandas() __version__ = (0, 1, 14)
from . import core from . import data from .data import get #from .core import year_frac, PerformanceStats, GroupStats, merge from .core import * core.extend_pandas() __version__ = (0, 1, 13)
mit
Python
d20969aec0c312a6d60d8263e970a01c9b3b0d01
bump 0.2.1
pmorissette/ffn
ffn/__init__.py
ffn/__init__.py
from . import core from . import data from .data import get #from .core import year_frac, PerformanceStats, GroupStats, merge from .core import * core.extend_pandas() __version__ = (0, 2, 1)
from . import core from . import data from .data import get #from .core import year_frac, PerformanceStats, GroupStats, merge from .core import * core.extend_pandas() __version__ = (0, 2, 0)
mit
Python
d42e2460a411f5dbd57822df87a502866d0f9e1c
Fix _log to work on python 2 & 3
bcb/jsonrpcserver
jsonrpcserver/log.py
jsonrpcserver/log.py
"""Logging""" import logging def _configure_logger(logger, fmt): """Set up a logger, if no handler has been configured for it""" if not logging.root.handlers and logger.level == logging.NOTSET: logger.setLevel(logging.INFO) handler = logging.StreamHandler() handler.setFormatter(logging...
"""Logging""" import logging def _configure_logger(logger, fmt): """Set up a logger, if no handler has been configured for it""" if not logging.root.handlers and logger.level == logging.NOTSET: logger.setLevel(logging.INFO) handler = logging.StreamHandler() handler.setFormatter(logging...
mit
Python
493007fea95a8d3f54f5bd1e783d95a58ac02b8f
Fix typo
maruel/git-hooks-go,maruel/git-hooks-go
install.py
install.py
#!/usr/bin/env python # Copyright 2014 Marc-Antoine Ruel. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Installs git pre-commit hook on the repository one directory above.""" import os import shutil import subprocess import...
#!/usr/bin/env python # Copyright 2014 Marc-Antoine Ruel. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Installs git pre-commit hook on the repository one directory above.""" import os import shutil import subprocess import...
apache-2.0
Python
cbefb84542d9dfddd0f2fdf8bd0cb2fc89d5b824
Allow "jupyter nbextension install/enable --py jupytext"
mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext
jupytext/__init__.py
jupytext/__init__.py
"""Read and write Jupyter notebooks as text files""" from .jupytext import readf, writef, writes, reads from .formats import NOTEBOOK_EXTENSIONS, guess_format, get_format_implementation from .version import __version__ try: from .contentsmanager import TextFileContentsManager except ImportError as err: class ...
"""Read and write Jupyter notebooks as text files""" from .jupytext import readf, writef, writes, reads from .formats import NOTEBOOK_EXTENSIONS, guess_format, get_format_implementation from .version import __version__ try: from .contentsmanager import TextFileContentsManager except ImportError as err: class ...
mit
Python
c6f8153f9163e421a0684b3667c6b5425c9c2168
add form
girlsgoit/GirlsGoIT,girlsgoit/GirlsGoIT
ggit_platform/forms.py
ggit_platform/forms.py
from django import forms from .models import Track from .models import Region from .models import Member from .models import Event from .models import Story class TrackForm(forms.ModelForm): class Meta: model = Track fields = '__all__' class MemberForm(forms.ModelForm): class Meta: ...
from django import forms from .models import Track from .models import Region from .models import Member from .models import Event from .models import Story class TrackForm(forms.ModelForm): class Meta: model = Track fields = '__all__' class MemberForm(forms.ModelForm): class Meta: ...
mit
Python
de5899d60736f555f975713810d5e1936d823794
Remove ternary expressions
ludios/Strfrag
strfrag.py
strfrag.py
__version__ = '11.5.9' import sys import warnings class StringFragment(object): """ Represents a fragment of a string. Used to avoid copying, especially in network protocols. DO NOT adjust the attributes of the object after you instantiate it; this is faux-immutable. You can slice a L{StringFragment}, which ...
__version__ = '11.5.9' import sys import warnings class StringFragment(object): """ Represents a fragment of a string. Used to avoid copying, especially in network protocols. DO NOT adjust the attributes of the object after you instantiate it; this is faux-immutable. You can slice a L{StringFragment}, which ...
mit
Python
812d17c6fcf97cc1c493f2489c92af24006ea0a8
Fix pep8 error.
armet/python-armet
src/armet/resources/resource/__init__.py
src/armet/resources/resource/__init__.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals, division import six from .base import Resource as BaseResource from .meta import ResourceBase __all__ = [ 'Resource' ] class Resource(six.with_metaclass(ResourceBase, BaseResource)): """Implements the RESTful resource protocol ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals, division import six from .base import Resource as BaseResource from .meta import ResourceBase __all__ = [ 'Resource' ] class Resource(six.with_metaclass(ResourceBase, BaseResource)): """Implements the RESTful resource protocol f...
mit
Python
8cbc9498b03b68e15b1698211997b773ec263a3f
Update __init__.py
keras-team/keras-cv,keras-team/keras-cv,keras-team/keras-cv
keras_cv/__init__.py
keras_cv/__init__.py
# Copyright 2022 The KerasCV Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
# Copyright 2022 The KerasCV Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
apache-2.0
Python
e911bf6156e25f2f2da86a63fe54b9bac6ba0544
fix #191 remove_limit.py
DocNow/twarc,hugovk/twarc
utils/remove_limit.py
utils/remove_limit.py
#!/usr/bin/env python """ Utility to remove limit warnings from Filter API output. If --warnings was used, you will have the following in output: {"limit": {"track": 2530, "timestamp_ms": "1482168932301"}} This utility removes any limit warnings from output. Usage: remove_limit.py aleppo.jsonl > aleppo_no_warni...
#!/usr/bin/env python """ Utility to remove limit warnings from Filter API output. If --warnings was used, you will have the following in output: {"limit": {"track": 2530, "timestamp_ms": "1482168932301"}} This utility removes any limit warnings from output. Usage: remove_limit.py aleppo.jsonl > aleppo_no_warni...
mit
Python
5aeab439a081d7bb06777072f912d9443181aac9
Fix dhcp_build
murrown/cyder,OSU-Net/cyder,drkitty/cyder,akeym/cyder,drkitty/cyder,akeym/cyder,akeym/cyder,zeeman/cyder,OSU-Net/cyder,drkitty/cyder,drkitty/cyder,zeeman/cyder,zeeman/cyder,OSU-Net/cyder,zeeman/cyder,akeym/cyder,murrown/cyder,OSU-Net/cyder,murrown/cyder,murrown/cyder
cyder/management/commands/dhcp_build.py
cyder/management/commands/dhcp_build.py
import syslog from optparse import make_option from django.core.management.base import BaseCommand, CommandError from cyder.cydhcp.build.builder import DHCPBuilder class Command(BaseCommand): option_list = BaseCommand.option_list + ( ### action options ### make_option('-p', '--push', ...
from optparse import make_option from django.core.management.base import BaseCommand, CommandError from cyder.cydhcp.build.builder import DHCPBuilder class Command(BaseCommand): option_list = BaseCommand.option_list + ( ### action options ### make_option('-p', '--push', dest=...
bsd-3-clause
Python
d3b374a705a72ef3d0ad2da332f056f04063ae92
Add -t alias to --tag flag for preprocess command.
grow/grow,grow/grow,grow/grow,grow/grow,grow/pygrow,grow/pygrow,grow/pygrow
grow/commands/preprocess.py
grow/commands/preprocess.py
from grow.common import utils from grow.pods import pods from grow.pods import storage import click import os @click.command() @click.argument('pod_path', default='.') @click.option('--all', '-A', 'run_all', is_flag=True, default=False, help='Whether to run all preprocessors, even if a preprocessor' ...
from grow.common import utils from grow.pods import pods from grow.pods import storage import click import os @click.command() @click.argument('pod_path', default='.') @click.option('--all', '-A', 'run_all', is_flag=True, default=False, help='Whether to run all preprocessors, even if a preprocessor' ...
mit
Python
bbc97d650d1731c1e89587183f58652e254bb7bb
Tag new release: 3.9.4
Floobits/floobits-sublime,Floobits/floobits-sublime
floo/version.py
floo/version.py
PLUGIN_VERSION = '3.9.4' # The line above is auto-generated by tag_release.py. Do not change it manually. try: from .common import shared as G assert G except ImportError: from common import shared as G G.__VERSION__ = '0.11' G.__PLUGIN_VERSION__ = PLUGIN_VERSION
PLUGIN_VERSION = '3.9.3' # The line above is auto-generated by tag_release.py. Do not change it manually. try: from .common import shared as G assert G except ImportError: from common import shared as G G.__VERSION__ = '0.11' G.__PLUGIN_VERSION__ = PLUGIN_VERSION
apache-2.0
Python
1be1200b94b852b84eb8e8a7e95cbc528f5ec114
Tag new release: 3.5.1
Floobits/floobits-sublime,Floobits/floobits-sublime
floo/version.py
floo/version.py
PLUGIN_VERSION = '3.5.1' # The line above is auto-generated by tag_release.py. Do not change it manually. try: from .common import shared as G assert G except ImportError: from common import shared as G G.__VERSION__ = '0.11' G.__PLUGIN_VERSION__ = PLUGIN_VERSION
PLUGIN_VERSION = '3.5.0' # The line above is auto-generated by tag_release.py. Do not change it manually. try: from .common import shared as G assert G except ImportError: from common import shared as G G.__VERSION__ = '0.11' G.__PLUGIN_VERSION__ = PLUGIN_VERSION
apache-2.0
Python
754c00adda3e16b1a2bb61017d56f9d1d8959d59
Refresh monitoring.nagios.plugin.exceptions and fix pylint+pep8.
bigbrozer/monitoring.nagios,bigbrozer/monitoring.nagios
monitoring/nagios/plugin/exceptions.py
monitoring/nagios/plugin/exceptions.py
# -*- coding: utf-8 -*- # Copyright (C) Vincent BESANCON <besancon.vincent@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the...
# -*- coding: utf-8 -*- #=============================================================================== # Filename : exceptions # Author : Vincent BESANCON aka 'v!nZ' <besancon.vincent@gmail.com> # Description : Define class for Nagios events and plugin exceptions. #------------------------------------...
mit
Python
91cb7b80f12ebb8d8f7b1b4110dea8ec6a0c0d71
Bump version number to 0.0.4
alphagov/gapy,alphagov/gapy
gapy/__init__.py
gapy/__init__.py
__title__ = "gapy" __version__ = "0.0.4" __author__ = "Rob Young" from .error import GapyError from .client import client_from_private_key, client_from_secrets_file
__title__ = "gapy" __version__ = "0.0.3" __author__ = "Rob Young" from .error import GapyError from .client import client_from_private_key, client_from_secrets_file
mit
Python
fbf014285baa61b8294ef5dd27ea3e61c964e9b0
add depend product_uom_qty in missing_quantity
Gebesa-Dev/Addons-gebesa
mrp_shipment/models/sale_order_line.py
mrp_shipment/models/sale_order_line.py
# -*- coding: utf-8 -*- # © <YEAR(S)> <AUTHOR(S)> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import _, api, fields, models class SaleOrderLine(models.Model): _inherit = 'sale.order.line' quantity_shipped = fields.Float( string=_(u'Quantity shipped'), co...
# -*- coding: utf-8 -*- # © <YEAR(S)> <AUTHOR(S)> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import _, api, fields, models class SaleOrderLine(models.Model): _inherit = 'sale.order.line' quantity_shipped = fields.Float( string=_(u'Quantity shipped'), co...
agpl-3.0
Python
2f9e49d486a307406c72ef5f3fedb8ab97081096
Add files via upload
piyushravi/CS101-Project,piyushravi/CS101-Project
form_backend.py
form_backend.py
#!/usr/bin/python import mysql.connector from mysql.connector import errorcode # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form = cgi.FieldStorage() cnn=mysql.connector.connect(user = "root", password = "", host = "localhost", database = "shouut") cursor=cnn.cursor() name ...
#!/usr/bin/python import mysql.connector from mysql.connector import errorcode # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form = cgi.FieldStorage() cnn=mysql.connector.connect(user = "root", password = "", host = "localhost", database = "shouut") cursor=cnn.cursor() name ...
mit
Python
d4e7f49f25b7ab4bf83b273cc08e002e7e7f6c7f
Use the animator module in framebuilder
twoodford/audiovisualizer
framebuilder.py
framebuilder.py
import audiovisualizer import PIL.Image import PIL.ImageDraw import pylab import scipy import scipy.io import scipy.signal # The sample rate of the input matrix (Hz) SAMPLE_RATE=44100 # Frequency range to display (audible is 16-16384Hz) DISPLAY_FREQ=(16, 1000) # FPS of output (Hz) OUT_FPS = 30 # Size of the moving ave...
import audiovisualizer import PIL.Image import PIL.ImageDraw import pylab import scipy import scipy.io import scipy.signal # The sample rate of the input matrix (Hz) SAMPLE_RATE=44100 # Frequency range to display (audible is 16-16384Hz) DISPLAY_FREQ=(16, 1000) # FPS of output (Hz) OUT_FPS = 30 # Size of the moving ave...
apache-2.0
Python
913985dec32feadc84428b48cf463d8589ed1396
Test zero_momentum after attaching
joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue
hoomd/md/pytest/test_zero_momentum.py
hoomd/md/pytest/test_zero_momentum.py
import hoomd import numpy as np import pytest def test_before_attaching(): trigger = hoomd.trigger.Periodic(100) zm = hoomd.md.update.ZeroMomentum(trigger) assert zm.trigger is trigger trigger = hoomd.trigger.Periodic(10, 30) zm.trigger = trigger assert zm.trigger is trigger def test_after_a...
import hoomd import numpy as np import pytest def test_before_attaching(): trigger = hoomd.trigger.Periodic(100) zm = hoomd.md.update.ZeroMomentum(trigger) assert zm.trigger is trigger trigger = hoomd.trigger.Periodic(10, 30) zm.trigger = trigger assert zm.trigger is trigger
bsd-3-clause
Python
7bfe699afb9e49bc090c531c8615402012aa5ac2
Optimize gsxt_mobile code
9468305/script
gsxt_mobile/GongShiQuery.py
gsxt_mobile/GongShiQuery.py
#!/usr/local/bin/python3 # -*- coding: utf-8 -*- '''通过国家企业信用信息公示系统(www.gsxt.gov.cn) Mobile App HTTP API 查询统一社会信用代码''' import json import requests URL = 'http://yd.gsxt.gov.cn/QuerySummary' MOBILE_ACTION = 'entSearch' TOPIC = 1 PAGE_NUM = 1 PAGE_SIZE = 10 USER_ID = 'id001' USER_IP = '192.168.0.1' USER_AG...
#!/usr/local/bin/python3 # -*- coding: utf-8 -*- '''Query Uniform-Social-Credit-Code from National-Enterprise-Credit-Information-Publicity-System.''' import json import requests if __name__ == "__main__": URL = 'http://yd.gsxt.gov.cn/QuerySummary' MOBILE_ACTION = 'entSearch' KEY_WORDS = '腾讯科技' ...
mit
Python
c98879268c01a67abe88c2f8e15bff9d93d587cc
Remove test skipping since #1396954 was fixed
tsufiev/horizon,NCI-Cloud/horizon,mdavid/horizon,orbitfp7/horizon,Dark-Hacker/horizon,Tesora/tesora-horizon,Solinea/horizon,sandvine/horizon,promptworks/horizon,Daniex/horizon,watonyweng/horizon,sandvine/horizon,tellesnobrega/horizon,ChameleonCloud/horizon,ChameleonCloud/horizon,CiscoSystems/horizon,RudoCris/horizon,an...
horizon/test/jasmine/jasmine_tests.py
horizon/test/jasmine/jasmine_tests.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...
apache-2.0
Python
20d21b851d02bbcf8c6a0f065b9f05f5e0bfc662
Use format=5 in YT search to prevent "embedding disabled"
6/GeoDJ,6/GeoDJ
geodj/youtube.py
geodj/youtube.py
from gdata.youtube.service import YouTubeService, YouTubeVideoQuery from django.utils.encoding import smart_str import re class YoutubeMusic: def __init__(self): self.service = YouTubeService() def search(self, artist): query = YouTubeVideoQuery() query.vq = artist query.orderb...
from gdata.youtube.service import YouTubeService, YouTubeVideoQuery from django.utils.encoding import smart_str import re class YoutubeMusic: def __init__(self): self.service = YouTubeService() def search(self, artist): query = YouTubeVideoQuery() query.vq = artist query.orderb...
mit
Python
29076f5d1f93601bbab4783e38d2df82badf4891
Add sources to sub-objects.
rshorey/pupa,influence-usa/pupa,mileswwatkins/pupa,opencivicdata/pupa,mileswwatkins/pupa,datamade/pupa,opencivicdata/pupa,influence-usa/pupa,datamade/pupa,rshorey/pupa
pupa/scrape/helpers.py
pupa/scrape/helpers.py
""" these are helper classes for object creation during the scrape """ from larvae.person import Person from larvae.organization import Organization from larvae.membership import Membership class Legislator(Person): _is_legislator = True __slots__ = ('district', 'party', 'chamber', '_contact_details') de...
""" these are helper classes for object creation during the scrape """ from larvae.person import Person from larvae.organization import Organization from larvae.membership import Membership class Legislator(Person): _is_legislator = True __slots__ = ('district', 'party', 'chamber', '_contact_details') de...
bsd-3-clause
Python
822b119e770f3494cd622f7723350faa518bf984
Simplify redirect code and make it easier to read
Inboxen/website,Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen
views/inbox/delete.py
views/inbox/delete.py
## # Copyright (C) 2013 Jessica Tallon & Matt Molyneaux # # This file is part of Inboxen. # # Inboxen is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, o...
## # Copyright (C) 2013 Jessica Tallon & Matt Molyneaux # # This file is part of Inboxen. # # Inboxen is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, o...
agpl-3.0
Python
855ae722340cfaaef6a6e9cc1be91e43bc46f0c8
Add inclusion of jasyhelper from appcache in unify
unify/unify,unify/unify,unify/unify,unify/unify,unify/unify,unify/unify
unify/support/jasy/unify.py
unify/support/jasy/unify.py
import webbrowser, http.server, os, multiprocessing from jasy.core import Project appcache_project = Project.getProjectByName("appcache") exec(compile(open(os.path.realpath(os.path.abspath(appcache_project.getPath() + "/jasyhelper.py"))).read(), "jasyhelper.py", 'exec')) def unify_source(): # Permutation independ...
import webbrowser, http.server, os, multiprocessing def unify_source(): # Permutation independend config jsFormatting.enable("comma") jsFormatting.enable("semicolon") jsOptimization.disable("privates") jsOptimization.disable("variables") jsOptimization.disable("declarations") jsOptimization...
mit
Python
b7aef5fe6ddfced35cb7546e73b6a256f9de79d9
use requests instead of urllib
janiheikkinen/irods,janiheikkinen/irods,janiheikkinen/irods,PaulVanSchayck/irods,PaulVanSchayck/irods,janiheikkinen/irods,PaulVanSchayck/irods,janiheikkinen/irods,PaulVanSchayck/irods,janiheikkinen/irods,janiheikkinen/irods,PaulVanSchayck/irods,PaulVanSchayck/irods,PaulVanSchayck/irods,janiheikkinen/irods,PaulVanSchayc...
iRODS/scripts/python/validate_json.py
iRODS/scripts/python/validate_json.py
from __future__ import print_function import json import sys import requests if len(sys.argv) != 3: sys.exit('Usage: {0} <configuration_file> <schema_url>'.format(sys.argv[0])) def print_error(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) try: import jsonschema except ImportError: print_e...
from __future__ import print_function import json import sys try: # python 3+ from urllib.request import urlopen except ImportError: # python 2 from urllib2 import urlopen if len(sys.argv) != 3: sys.exit('Usage: {0} configuration_file schema_url'.format(sys.argv[0])) def print_error(*args, **kwarg...
bsd-3-clause
Python
cc1e2e85d86f728d2d90599c752a9d52ca3b756f
Add connection pytest fixture
jonathanstallings/learning-journal,jonathanstallings/learning-journal
test_journal.py
test_journal.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import pytest from sqlalchemy import create_engine from sqlalchemy.exc import IntegrityError TEST_DATABASE_URL = os.environ.get( 'DATABASE_URL', 'postgresql://jonathan:@localhost:5432/test-learning-journal' ) os.environ['DATABASE_URL'] =...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import pytest from sqlalchemy import create_engine from sqlalchemy.exc import IntegrityError TEST_DATABASE_URL = os.environ.get( 'DATABASE_URL', 'postgresql://jonathan:@localhost:5432/test-learning-journal' ) os.environ['DATABASE_URL'] =...
mit
Python
175f32ea419e43766216b7692436d5614405a7b2
remove print statements
TomAlanCarroll/synthia
synthia.py
synthia.py
""" Synthia ~~~~~~ The Synthetic Intelligent Assistant for your home """ from flask import Flask import weather, requests, json, play_audio app = Flask(__name__) # Calls a function to get a customer morning message, then plays it def play_morning_message(): message = get_morning_message() play_aud...
""" Synthia ~~~~~~ The Synthetic Intelligent Assistant for your home """ from flask import Flask import weather, requests, json, play_audio app = Flask(__name__) # Calls a function to get a customer morning message, then plays it def play_morning_message(): message = get_morning_message() play_aud...
apache-2.0
Python
1d6bb5e7ce706c8f54599f98744f3a5d62ce104e
Replace get_base_dir and set_base_dir with more abstract methods get and set
mmetering/mmetering-cli
src/config.py
src/config.py
import os import ConfigParser as configparser class Config(object): def __init__(self): self.config = configparser.RawConfigParser() self.configfile = os.path.expanduser('~/.mmetering-clirc') if not os.path.isfile(self.configfile): # setup a new config file self.ini...
import os import ConfigParser as configparser class Config(object): def __init__(self): self.config = configparser.RawConfigParser() self.configfile = os.path.expanduser('~/.mmetering-clirc') if not os.path.isfile(self.configfile): # setup a new config file self.ini...
mit
Python
26dc2aaa97d043efe4c82516afe1e5b09d49bd8a
add remove_subtitle
thongdong7/subfind,thongdong7/subfind,thongdong7/subfind,thongdong7/subfind
subfind/utils/subtitle.py
subfind/utils/subtitle.py
# Credit to https://github.com/callmehiphop/subtitle-extensions/blob/master/subtitle-extensions.json import os from os.path import join, exists subtitle_extensions = set([ "aqt", "gsub", "jss", "sub", "ttxt", "pjs", "psb", "rt", "smi", "slt", "ssf", "srt", "ssa", ...
# Credit to https://github.com/callmehiphop/subtitle-extensions/blob/master/subtitle-extensions.json subtitle_extensions = [ "aqt", "gsub", "jss", "sub", "ttxt", "pjs", "psb", "rt", "smi", "slt", "ssf", "srt", "ssa", "ass", "usf", "idx", "vtt" ] def ...
mit
Python
1b5e2c9b312d215a9c506064f90a010af6510c86
fix monitor_disk_usage error
samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur
utils/monitor_disk_usage.py
utils/monitor_disk_usage.py
#!/usr/local/bin/python3 import sys sys.path.append('/srv/newsblur') import subprocess import requests from newsblur_web import settings import socket def main(): df = subprocess.Popen(["df", "/"], stdout=subprocess.PIPE) output = df.communicate()[0].decode('utf-8') device, size, used, available, percent,...
#!/usr/local/bin/python3 import sys sys.path.append('/srv/newsblur') import subprocess import requests from newsblur_web import settings import socket def main(): df = subprocess.Popen(["df", "/"], stdout=subprocess.PIPE) output = df.communicate()[0] device, size, used, available, percent, mountpoint = ou...
mit
Python
546322c384de78254b166c32f994bbb3de85e248
Revert "Make sure Cassandra is started only once"
bsc-dd/hecuba,bsc-dd/hecuba,bsc-dd/hecuba,bsc-dd/hecuba
hecuba_py/tests/__init__.py
hecuba_py/tests/__init__.py
import atexit import ccmlib.cluster import os import sys import tempfile import logging from distutils.util import strtobool class TestConfig: pass test_config = TestConfig() test_config.n_nodes = int(os.environ.get('TEST_CASSANDRA_N_NODES', '2')) TEST_DEBUG = strtobool(os.environ.get("TEST_DEBUG", "False").low...
import atexit import ccmlib.cluster import os import sys import tempfile import logging from distutils.util import strtobool class TestConfig: n_nodes = int(os.environ.get('TEST_CASSANDRA_N_NODES', '2')) ccm_cluster = None TEST_DEBUG = strtobool(os.environ.get("TEST_DEBUG", "False").lower()) if TEST_DEBUG: ...
apache-2.0
Python
a7600025ec407cea7c5a80bf7d470173d01bbdf7
refactor and fix count_diacritics.py
AliOsm/arabic-text-diacritization
helpers/count_diacritics.py
helpers/count_diacritics.py
# -*- coding: utf-8 -*- import argparse import sys import pickle as pkl from os import listdir from os.path import isfile, join CONSTANTS_PATH = 'constants' def count_each_dic(FILE_PATH): each = dict() with open(CONSTANTS_PATH + '/CLASSES_LIST.pickle', 'rb') as file: CLASSES_LIST = pkl.load(file) with...
# -*- coding: utf-8 -*- import sys import pickle as pkl from os import listdir from os.path import isfile, join CONSTANTS_PATH = '../Constants' each = dict() def count_each_dic(FILE_PATH): with open(CONSTANTS_PATH + '/CLASSES_LIST.pickle', 'rb') as file: CLASSES_LIST = pkl.load(file) with open(CONSTA...
mit
Python
99df87e5ee17605e8d3d05243e7ec50bb0aa1bb9
Update __init__.py
yablochkin/vkontakte-viomg
vkontakte_viomg/__init__.py
vkontakte_viomg/__init__.py
from vkontakte_viomg.api import API, VKError, signature from vkontakte_viomg.lock import LockTimeout
from vkontakte_viomg.api import API, VKError, signature
mit
Python
e966ddd804eee2f1b053de6f0bbf943d80dccc59
Fix get value more safe
uncovertruth/django-elastipymemcache
django_elastipymemcache/client.py
django_elastipymemcache/client.py
from pymemcache.client.hash import HashClient class Client(HashClient): def get_many(self, keys, gets=False, *args, **kwargs): # pymemcache's HashClient may returns {'key': False} end = super(Client, self).get_many(keys, gets, args, kwargs) return {key: end.get(key) for key in end if end....
from pymemcache.client.hash import HashClient class Client(HashClient): def get_many(self, keys, gets=False, *args, **kwargs): # pymemcache's HashClient may returns {'key': False} end = super(Client, self).get_many(keys, gets, args, kwargs) return {key: end[key] for key in end if end[key]...
mit
Python
e382b1687e5528fcb3e19e3f0d8b589e10bcb6ad
Remove unintentional pytest dependency. Fix #6398 (#6399)
dmlc/tvm,dmlc/tvm,sxjscience/tvm,tqchen/tvm,dmlc/tvm,tqchen/tvm,tqchen/tvm,dmlc/tvm,tqchen/tvm,Laurawly/tvm-1,sxjscience/tvm,dmlc/tvm,sxjscience/tvm,Laurawly/tvm-1,Laurawly/tvm-1,Laurawly/tvm-1,dmlc/tvm,tqchen/tvm,sxjscience/tvm,tqchen/tvm,tqchen/tvm,sxjscience/tvm,tqchen/tvm,dmlc/tvm,Laurawly/tvm-1,sxjscience/tvm,sxjs...
python/tvm/__init__.py
python/tvm/__init__.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
Python
25b755c68b8f87b16adf55c7003f55aca947d39c
Update parser.py
robcza/intelmq,robcza/intelmq,certtools/intelmq,certtools/intelmq,sch3m4/intelmq,aaronkaplan/intelmq,pkug/intelmq,robcza/intelmq,pkug/intelmq,robcza/intelmq,sch3m4/intelmq,aaronkaplan/intelmq,pkug/intelmq,pkug/intelmq,sch3m4/intelmq,aaronkaplan/intelmq,certtools/intelmq,sch3m4/intelmq
intelmq/bots/parsers/openbl/parser.py
intelmq/bots/parsers/openbl/parser.py
from datetime import datetime from intelmq.lib.bot import Bot, sys from intelmq.lib.event import Event from intelmq.bots import utils class OpenBLParserBot(Bot): def process(self): report = self.receive_message() if report: for row in report.split('\n'): ...
from datetime import datetime from intelmq.lib.bot import Bot, sys from intelmq.lib.event import Event from intelmq.bots import utils class OpenBLParserBot(Bot): def process(self): report = self.receive_message() if report: for row in report.split('\n'): ...
agpl-3.0
Python
91e459a0baf240429d40e47e46dc4e1b11350f68
Add command processing decorator
kalafut/taskbug
taskbug.py
taskbug.py
import os import readline history = [] commands = {} class Track: def __init__(self, task=None): self.tasks = [] self.push(task) def push(self, task): if task: self.tasks.append(task) def pop(self): return self.tasks.pop() def top(self): if self....
history = [] class Track: def __init__(self, task=None): self.tasks = [] self.push(task) def push(self, task): if task: self.tasks.append(task) def pop(self): return self.tasks.pop() def top(self): if self.count() > 0: return self.task...
mit
Python
1978b7ba1568114a8fbabdb96b06ad712db9f54f
Add comments describing base command class.
manylabs/flow,manylabs/flow
flow/commands/command.py
flow/commands/command.py
import abc import subprocess import json import logging # # This is a base command class. # Subclasses can override the exec_impl method for handling messages. # Messages responses are automatically sent and the base class can # do some error handling. # class Command(object): __metaclass__ = abc.ABCMeta # lo...
import abc import subprocess import json import logging class Command(object): __metaclass__ = abc.ABCMeta # logging.basicConfig(level=logging.DEBUG) # # Create a new Command base class. # def __init__(self, flow, cmd_name, params): self.flow = flow self.cmd_name = cmd...
mit
Python
abb8b574395f1f4ab8be08887b7bcf54a42bb254
Revert HTTPS
fluidinfo/fluidinfo-explorer,fluidinfo/fluidinfo-explorer
fluiddbexplorer/utils.py
fluiddbexplorer/utils.py
# -*- coding: utf-8 -*- """ fluiddbexplorer.utils ~~~~~~~~~~~~~~~~~~~~~ Utility functions :copyright: 2010 by Fluidinfo Explorer Authors :license: MIT, see LICENSE for more information """ import os from flask import current_app, url_for INSTANCE_URLS = { 'main': 'http://fluiddb.fluidinfo.c...
# -*- coding: utf-8 -*- """ fluiddbexplorer.utils ~~~~~~~~~~~~~~~~~~~~~ Utility functions :copyright: 2010 by Fluidinfo Explorer Authors :license: MIT, see LICENSE for more information """ import os from flask import current_app, url_for INSTANCE_URLS = { 'main': 'https://fluiddb.fluidinfo....
mit
Python
da961ec779cc05b3629eb740a800122a493bfcaf
remove print statement
stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten
features/gestalten/templatetags/dismissible.py
features/gestalten/templatetags/dismissible.py
import json from django import template from django.db import models from django.template import Library, loader from ..models import GestaltSetting register = Library() @register.simple_tag(name='dismiss', takes_context=True) def do_dismiss(context, name, category='dismissible', type='button'): template_name ...
import json from django import template from django.db import models from django.template import Library, loader from ..models import GestaltSetting register = Library() @register.simple_tag(name='dismiss', takes_context=True) def do_dismiss(context, name, category='dismissible', type='button'): template_name ...
agpl-3.0
Python
46e52318c07a2021dafe549a84492e6cc60147e4
Add new exception types
jonahbull/rabbitpy,gmr/rabbitpy,gmr/rabbitpy
rabbitpy/exceptions.py
rabbitpy/exceptions.py
""" rabbitpy Specific Exceptions """ from pamqp import specification class ActionException(Exception): def __repr__(self): return self.args[0] class ChannelClosedException(Exception): def __repr__(self): return 'Can not perform RPC requests on a closed channel, you must ' \ '...
""" rabbitpy Specific Exceptions """ class ActionException(Exception): def __repr__(self): return self.args[0] class ChannelClosedException(Exception): def __repr__(self): return 'Can not perform RPC requests on a closed channel, you must ' \ 'create a new channel' class Con...
bsd-3-clause
Python
0faf594ee8b0bf7168e89f26bbed08c25defc568
allow config-rewrite
ulno/ulnoiot,ulno/ulnoiot,ulno/ulnoiot,ulno/micropython-extra-ulno,ulno/ulnoiot,ulno/ulnoiot,ulno/micropython-extra-ulno
lib/node_types/esp8266/freeze/uiot/_cfg.py
lib/node_types/esp8266/freeze/uiot/_cfg.py
# Configuration file management # _file = "/config.py" def write(): global config f = open(_file, "w") f.write( """wifi_name = {} wifi_pw = "{}" netrepl = "{}" mqtt_host = "{}" mqtt_topic = "{}" mqtt_user = "{}" mqtt_pw = "{}" """.format( config.wifi_name, config.wifi_pw, config.key, conf...
# Configuration file management # _file = "/config.py" def write(): global config f = open(_file, "w") f.write( """wifi_name = {} wifi_pw = {} netrepl = {} mqtt_host = {} mqtt_topic = {} mqtt_user = {} mqtt_pw = {} """.format( config.wifi_name, config.wifi_pw, ) ) f.close() def wifi(nam...
mit
Python
6389bebf4cac642d055fe1df3fe1ef4750f5861a
read data_server from environment in testing.py
GuillaumeMorini/roomfinder,Guismo1/roomfinder,GuillaumeMorini/roomfinder,Guismo1/roomfinder,Guismo1/roomfinder,GuillaumeMorini/roomfinder
testing.py
testing.py
import unittest import sys sys.path.append('roomfinder_web/roomfinder_web') import web_server class FlaskTestCase(unittest.TestCase): def setUp(self): sys.stderr.write('Setup testing.') web_server.data_server = os.getenv("roomfinder_data_server") web_server.app.config['TESTING'] = True ...
import unittest import sys sys.path.append('roomfinder_web/roomfinder_web') import web_server class FlaskTestCase(unittest.TestCase): def setUp(self): sys.stderr.write('Setup testing.') web_server.app.config['TESTING'] = True self.app = web_server.app.test_client() def test_correct_h...
apache-2.0
Python
60daa277d5c3f1d9ab07ff5beccdaa323996068b
Add assignment tag util for rendering chunks to tpl context
ixc/glamkit-feincmstools,ixc/glamkit-feincmstools
feincmstools/templatetags/feincmstools_tags.py
feincmstools/templatetags/feincmstools_tags.py
import os from django import template from feincms.templatetags.feincms_tags import feincms_render_content register = template.Library() @register.filter def is_parent_of(page1, page2): """ Determines whether a given page is the parent of another page Example: {% if page|is_parent_of:feincms_page ...
import os from django import template register = template.Library() @register.filter def is_parent_of(page1, page2): """ Determines whether a given page is the parent of another page Example: {% if page|is_parent_of:feincms_page %} ... {% endif %} """ if page1 is None: return False ...
bsd-3-clause
Python
9bb0953b7aec9dddeaa8ef3c271bde1195a9cea5
Update 3txt_tag_init.py
FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code,FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code,FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code
wangyi/wk5/3txt_tag_init.py
wangyi/wk5/3txt_tag_init.py
# coding: utf-8 # In[ ]: # In[1]: import re import os if __name__ == '__main__': # Edit Area # =================================================================== root_path= r'/usr/yyy/wk5/txt_tagged/' result_path = r'/usr/yyy/wk5/txt_tagged_init/' # ================================...
# coding: utf-8 # In[ ]: # In[1]: import re import os if __name__ == '__main__': root_path= r'/usr/yyy/wk5/txt_tagged/' result_path = r'/usr/yyy/wk5/txt_tagged_init/' if not os.path.exists(result_path): os.mkdir(result_path) file_list=os.listdir(root_path) ...
apache-2.0
Python
a388e1fd8dab1c745f750d08b75ae6ff612d8330
Add more field types
rdmorganiser/rdmo,rdmorganiser/rdmo,rdmorganiser/rdmo
rdmo/core/constants.py
rdmo/core/constants.py
from django.utils.translation import gettext_lazy as _ VALUE_TYPE_TEXT = 'text' VALUE_TYPE_URL = 'url' VALUE_TYPE_INTEGER = 'integer' VALUE_TYPE_FLOAT = 'float' VALUE_TYPE_BOOLEAN = 'boolean' VALUE_TYPE_DATETIME = 'datetime' VALUE_TYPE_OPTIONS = 'option' VALUE_TYPE_OPTIONS = 'email' VALUE_TYPE_OPTIONS = 'phone' VALUE_...
from django.utils.translation import gettext_lazy as _ VALUE_TYPE_TEXT = 'text' VALUE_TYPE_URL = 'url' VALUE_TYPE_INTEGER = 'integer' VALUE_TYPE_FLOAT = 'float' VALUE_TYPE_BOOLEAN = 'boolean' VALUE_TYPE_DATETIME = 'datetime' VALUE_TYPE_OPTIONS = 'option' VALUE_TYPE_FILE = 'file' VALUE_TYPE_CHOICES = ( (VALUE_TYPE_...
apache-2.0
Python
56a842fae1f88ee80d7ac88071819d82ee470e9f
Fix path for static_dir
lsst-sqre/ltd-keeper,lsst-sqre/ltd-keeper
keeper/dashboard/templateproviders.py
keeper/dashboard/templateproviders.py
"""Providers load templates from specific sources and provider a Jinja2 rendering environment. """ from __future__ import annotations from pathlib import Path import jinja2 from .context import BuildContextList, EditionContextList, ProjectContext from .jinjafilters import filter_simple_date class BuiltinTemplateP...
"""Providers load templates from specific sources and provider a Jinja2 rendering environment. """ from __future__ import annotations from pathlib import Path import jinja2 from .context import BuildContextList, EditionContextList, ProjectContext from .jinjafilters import filter_simple_date class BuiltinTemplateP...
mit
Python
1e5102d8bafb3b4d2cb07822129397aa56f30bbe
Handle using the input function in python 2 for getting username for examples
michaelcho/python-devicecloud,michaelcho/python-devicecloud,digidotcom/python-devicecloud,brucetsao/python-devicecloud,ctrlaltdel/python-devicecloud,digidotcom/python-devicecloud,brucetsao/python-devicecloud,ctrlaltdel/python-devicecloud
devicecloud/examples/example_helpers.py
devicecloud/examples/example_helpers.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Copyright (c) 2015 Digi International, Inc. from getpass import getpass import os from six.moves import input from de...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Copyright (c) 2015 Digi International, Inc. from getpass import getpass import os from devicecloud import DeviceCloud...
mpl-2.0
Python
f6d396157ad0b469f302506a2a55d5959d375d84
use new string formatting style
Proteogenomics/trackhub-creator,Proteogenomics/trackhub-creator
toolbox.py
toolbox.py
# # Author : Manuel Bernal Llinares # Project : trackhub-creator # Timestamp : 28-06-2017 11:03 # --- # © 2017 Manuel Bernal Llinares <mbdebian@gmail.com> # All rights reserved. # """ This module implements some useful functions for the pipeline runner """ import os import json from exceptions import ToolBoxEx...
# # Author : Manuel Bernal Llinares # Project : trackhub-creator # Timestamp : 28-06-2017 11:03 # --- # © 2017 Manuel Bernal Llinares <mbdebian@gmail.com> # All rights reserved. # """ This module implements some useful functions for the pipeline runner """ import os import json from exceptions import ToolBoxEx...
apache-2.0
Python
2d5e7a3c0804cd30db9c099842f5dc76ec9fb670
Fix tests
barseghyanartur/flower,getupcloud/flower,ChinaQuants/flower,alexmojaki/flower,alexmojaki/flower,pygeek/flower,ucb-bar/bar-crawl-web,allengaller/flower,raphaelmerx/flower,pj/flower,barseghyanartur/flower,lucius-feng/flower,getupcloud/flower,raphaelmerx/flower,marrybird/flower,lucius-feng/flower,raphaelmerx/flower,asmode...
tests/__init__.py
tests/__init__.py
try: from urllib.parse import urlencode except ImportError: from urllib import urlencode import tornado.testing import celery from flower.app import Flower from flower.urls import handlers from flower.events import Events from flower.state import State from flower.settings import APP_SETTINGS class AsyncHT...
try: from urllib.parse import urlencode except ImportError: from urllib import urlencode import tornado.testing import celery from flower.app import Flower from flower.urls import handlers from flower.events import Events from flower.state import State from flower.settings import APP_SETTINGS class AsyncHT...
bsd-3-clause
Python
70acac5b1494301b933acd00e88dfefe46715bd1
Fix webbrowser.open_url() (#319)
GoogleCloudPlatform/django-cloud-deploy,GoogleCloudPlatform/django-cloud-deploy
django_cloud_deploy/utils/webbrowser.py
django_cloud_deploy/utils/webbrowser.py
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
apache-2.0
Python
72c0d83390dbbd6053f0af3518266c3d6b517401
remove backticks from field names in query
rutube/django-sphinx-db,anatoliy-larin/django-sphinx-db
django_sphinx_db/backend/sphinx/base.py
django_sphinx_db/backend/sphinx/base.py
from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper from django.db.backends.mysql.base import DatabaseOperations as MySQLDatabaseOperations from django.db.backends.mysql.creation import DatabaseCreation as MySQLDatabaseCreation class SphinxOperations(MySQLDatabaseOperations): compile...
from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper from django.db.backends.mysql.base import DatabaseOperations as MySQLDatabaseOperations from django.db.backends.mysql.creation import DatabaseCreation as MySQLDatabaseCreation class SphinxOperations(MySQLDatabaseOperations): compile...
bsd-3-clause
Python
a89c173181283bba6cdbde26af8dbba0c6c3760c
fix test fixture
DiamondLightSource/ispyb-api,DiamondLightSource/ispyb-api
tests/conftest.py
tests/conftest.py
# pytest configuration file from __future__ import absolute_import, division, print_function import os import ispyb import pytest @pytest.fixture def testconfig(): '''Return the path to a configuration file pointing to a test database.''' config_file = os.path.abspath(os.path.join(os.path.dirname(__file__), ...
# pytest configuration file from __future__ import absolute_import, division, print_function import os import pytest @pytest.fixture def testconfig(): '''Return the path to a configuration file pointing to a test database.''' config_file = os.path.abspath(os.path.join(os.path.dirname(__file__), ...
apache-2.0
Python
4fc0b0c3f2775ad04e8f148016b2590a9ffab1df
Update errors.py
brokensound77/AlertLogic-event-api
src/errors.py
src/errors.py
"""Custom errors""" class AlApiError(Exception): """Base class for exceptions in this module""" class NotAuthenticatedError(AlApiError): """Raise when a non 200 is returned""" class CredentialsNotSet(AlApiError): """Placeholder for missing credentials""" class EventNotRetrievedError(AlApiError): ...
"""Custome errors""" class AlApiError(Exception): """Base class for exceptions in this module""" class NotAuthenticatedError(AlApiError): """Raise when a non 200 is returned""" class CredentialsNotSet(AlApiError): """Placeholder for missing credentials""" class EventNotRetrievedError(AlApiError): ...
mit
Python
3c572de428b5ec63afc38945a7c4953318fbd5df
Add EXIF filter (#46)
tfeldmann/organize
tests/conftest.py
tests/conftest.py
import os from typing import Iterable, Tuple, Union from unittest.mock import patch import pytest from organize.compat import Path from organize.utils import DotDict TESTS_FOLDER = os.path.dirname(os.path.abspath(__file__)) TESTS_FOLDER = os.path.dirname(os.path.abspath(__file__)) def create_filesystem(tmp_path, ...
import os from typing import Iterable, Tuple, Union from unittest.mock import patch import pytest from organize.compat import Path from organize.utils import DotDict TESTS_FOLDER = os.path.dirname(os.path.abspath(__file__)) def create_filesystem(tmp_path, files, config): # create files for f in files: ...
mit
Python
73c9bc5010dfa2821b54abb57a93d06087acf00f
Add new properties.
jr-garcia/Engendro3D
e3d/gui/LayerClass.py
e3d/gui/LayerClass.py
from ..Base3DObjectClass import Attachable from cycgkit.cgtypes import * class Layer(Attachable): """ Virtual top level container for gui objects. Only objects attached to this will be drawn 'above' the scene, in 2D mode. """ def __init__(self, ID, guiMan, visible=True): """ ...
from ..Base3DObjectClass import Attachable from cycgkit.cgtypes import * class Layer(Attachable): """ Virtual top level container for gui objects. Only objects attached to this will be drawn 'above' the scene, in 2D mode. """ def __init__(self, ID, guiMan, visible=True): """ ...
mit
Python
95f5baeaff85e2f1f5f36e8cb4ffa871ab0c0a30
Fix broken tutorial step
gilessbrown/wextracto,eBay/wextracto,justinvanwinkle/wextracto,gilessbrown/wextracto,eBay/wextracto,justinvanwinkle/wextracto
docs/samples/tutorial/step8/tutorial.py
docs/samples/tutorial/step8/tutorial.py
from wex.extractor import label, Attributes from wex.response import Response from wex.etree import xpath, text attrs = Attributes( name = xpath('//h1') | text, country = xpath('//dd[@id="country"]') | text, region = xpath('//dd[@id="region"]') | text ) extract = label(Response.geturl)(attrs)
from wex.extractor import label, Attributes from wex.url import get_url from wex.etree import xpath, text attrs = Attributes( name = xpath('//h1') | text, country = xpath('//dd[@id="country"]') | text, region = xpath('//dd[@id="region"]') | text ) extract = label(get_url)(attrs)
bsd-3-clause
Python
7d09dd673bd2baeb30ba529498e7e71d6278f373
Stop setting quiz finished boolean twice
kdeloach/nyc-trees,kdeloach/nyc-trees,maurizi/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,maurizi/nyc-trees,maurizi/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,maurizi/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees
src/nyc_trees/apps/home/training/views.py
src/nyc_trees/apps/home/training/views.py
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division from django.db import transaction from apps.home.training.utils import get_quiz_or_404 from apps.users.models import TrainingResult def training_list_page(request): from apps.hom...
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division from django.db import transaction from apps.home.training.utils import get_quiz_or_404 from apps.users.models import TrainingResult def training_list_page(request): from apps.hom...
agpl-3.0
Python
f5342ae1a1f8473626a59bb6987e9f072d393a0b
Fix tag url regex
devunt/hydrocarbon,devunt/hydrocarbon,devunt/hydrocarbon
board/urls/default.py
board/urls/default.py
from django.conf import settings from django.conf.urls import patterns, url, include from django.conf.urls.static import static from django.utils.functional import curry from django.views.defaults import permission_denied from redactor.forms import FileForm, ImageForm from board.views import HCLoginView, HCSettingsVie...
from django.conf import settings from django.conf.urls import patterns, url, include from django.conf.urls.static import static from django.utils.functional import curry from django.views.defaults import permission_denied from redactor.forms import FileForm, ImageForm from board.views import HCLoginView, HCSettingsVie...
mit
Python
0cfeeb68177969125adab4cad33d28137b7710ed
Clean up incorrect comment
denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase
apps/storybase_taxonomy/views.py
apps/storybase_taxonomy/views.py
from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import ugettext as _ from django.http import Http404 from storybase_story.views import ExplorerRedirectView, StoryListView, StoryListWidgetView from storybase_taxonomy.models import Category, Tag class CategoryExplorerRedirectView(Ex...
from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import ugettext as _ from django.http import Http404 from storybase_story.views import ExplorerRedirectView, StoryListView, StoryListWidgetView from storybase_taxonomy.models import Category, Tag class CategoryExplorerRedirectView(Ex...
mit
Python