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 |
|---|---|---|---|---|---|---|---|---|
9f01ba69ebe041b19ba1e2870648a3746cc4ea4b | Add failing test for #363 | kwinkunks/lasio,kinverarity1/lasio,kinverarity1/las-reader | tests/test_read_header_line.py | tests/test_read_header_line.py | # coding=utf-8
import os, sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from pprint import pprint
from lasio.reader import read_header_line
def test_time_str_and_colon_in_desc():
line = "TIML.hh:mm 23:15 23-JAN-2001: Time Logger: At Bottom"
result = read_header_line(line, section_na... | # coding=utf-8
import os, sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from pprint import pprint
from lasio.reader import read_header_line
def test_time_str_and_colon_in_desc():
line = "TIML.hh:mm 23:15 23-JAN-2001: Time Logger: At Bottom"
result = read_header_line(line, section_na... | mit | Python |
17e8ee96665c9c99803a34b2ca430ccdbb28428f | Revert "printデバッグ" | rearn/wq8pw | dbi.py | dbi.py | from pymongo import MongoClient
class dbi():
def __init__(self, uri, db_name):
self.__client = MongoClient(uri)
self.__db = self.__client[db_name]
def find_uri(self, uri_id):
db_uri = self.__db.uri
ret = list(db_uri.find({'id': uri_id}))
if len(ret) == 1:
r... | from pymongo import MongoClient
class dbi():
def __init__(self, uri, db_name):
self.__client = MongoClient(uri)
self.__db = self.__client[db_name]
def find_uri(self, uri_id):
db_uri = self.__db.uri
ret = list(db_uri.find({'id': uri_id}))
print(ret)
if len(ret) ... | agpl-3.0 | Python |
a2f91f68c9124ead218e929b6a8053e9c87b09b5 | Add several grid methods | rmsare/scarplet,stgl/scarplet | dem.py | dem.py | """ Classes for loading digital elevation models as numeric grids """
import os, sys
import numpy as np
from osgeo import gdal, gdal_const
class CalculationMixin(object):
def _caclulate_slope(self, dx):
PAD_DX = 2
PAD_DY = 2
grid = self._pad_boundary(PAD_DX, PAD_DY)
slope_x = (gri... | """ Classes for loading digital elevation models as numeric grids """
import os, sys
import numpy as np
from osgeo import gdal, gdal_const
class CalculationMixin(object):
def _caclulate_slope(self, dx):
PAD_DX = 2
PAD_DY = 2
z = self._griddata
z_pad = self._pad_boundary(PAD_DX, PA... | mit | Python |
7a17facf68a90d246b4bee55491c9495a8c5ca50 | Make JinjaTemplateLoader work with Python 2.4. | lucius-feng/tg2,lucius-feng/tg2 | tg/dottednames/jinja_lookup.py | tg/dottednames/jinja_lookup.py | """Genshi template loader that supports dotted names."""
from os.path import exists, getmtime
from jinja2.exceptions import TemplateNotFound
from jinja2.loaders import FileSystemLoader
from tg import config
class JinjaTemplateLoader(FileSystemLoader):
"""Jinja template loader supporting dotted filenames. Based... | """Genshi template loader that supports dotted names."""
from os.path import exists, getmtime
from jinja2.exceptions import TemplateNotFound
from jinja2.loaders import FileSystemLoader
from tg import config
class JinjaTemplateLoader(FileSystemLoader):
"""Jinja template loader supporting dotted filenames. Based on... | mit | Python |
50e16edbfabc855f585916539421e7fe615c9450 | Integrate LLVM at llvm/llvm-project@81896f88cef4 | google/tsl,google/tsl,google/tsl | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "81896f88cef4cfe1cf982250601a0c954344e1e8"
LLVM_SHA256 = "2d89b97a4eff06504db27d3e5d82e261bb69d619bc7cf8dd476b901b85fce411"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "e1b88c8a09be25b86b13f98755a9bd744b4dbf14"
LLVM_SHA256 = "99c76ba24dcf26bee589f7446f2108e264e1a3148118edb1ce64795708359672"
tf_http_archive(
... | apache-2.0 | Python |
d322476b66cabc0c3a26eae7e67af3a85fe1370b | Integrate LLVM at llvm/llvm-project@a83e9266b96c | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "a83e9266b96c4e5f92611af6f4d95fef6aeef12a"
LLVM_SHA256 = "677821396643162de4ba2d44d0cd37cc8747f75f2b27ac9b15f6b940e384e666"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "e01e4c9115ad49479d01b6b6de4e83ee454bab24"
LLVM_SHA256 = "8013e27f0ef0d92763a652098f3c05459011c365fcd204b73ff075d9c154c9ac"
tfrt_http_archive(
... | apache-2.0 | Python |
9bed445aceb610ce09335883fd84cc6ca237e58c | Integrate LLVM at llvm/llvm-project@7ded25c0cb29 | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "7ded25c0cb298f474ffc1d9691a7d7c57c08c9f6"
LLVM_SHA256 = "7dc4720857512aa6bb3c00900a5fc79df2f9f3b97ae5a0627f66648ea6a18a2f"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "96ad51e3ebafdaed345a699d752ee4d96b00d82c"
LLVM_SHA256 = "e30ecbd64b9ee076ce90ddb728cd26559f4b8046f330bd1ccdd693c49bb69cad"
tfrt_http_archive(
... | apache-2.0 | Python |
fd9a713555564277e59fe9aa1b09689e3f633c2f | Integrate LLVM at llvm/llvm-project@aeab9d9570ac | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "aeab9d9570ac8cb554aff6e1af24a471fdf5b4e5"
LLVM_SHA256 = "9b4fd19ed137f8c96ca4f664195bb7976f0800a3a8740a1e1a15dc934e4ec717"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "f7b1fa6f5ebec5780e626aa48d582f2519a01632"
LLVM_SHA256 = "6d52d29347b5b9866ee92b825d1c977d137615a84e7ae8e3c3e0b0747f04c696"
tfrt_http_archive(
... | apache-2.0 | Python |
c3d08b94edfd40490e6548ba9e6a26f6de25eb73 | Integrate LLVM at llvm/llvm-project@a3ea9052d6a1 | gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-Corporation/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,karllessard/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,yongtang/ten... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "a3ea9052d6a16b13607046df6a324403fb51888d"
LLVM_SHA256 = "2e983ee9ae76fee40432fbae8dd51cad81779fb49a8e5bc517f37ade54312bdd"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "55c71c9eac9bc7f956a05fa9258fad4f86565450"
LLVM_SHA256 = "1459d328ea67802f5b7c64349ba300b5ddc4a78838d6b77a8a970fe99ed3e78c"
tf_http_archive(
... | apache-2.0 | Python |
51889bbcb9f018b4cd2128552381bf28f3fea52f | Integrate LLVM at llvm/llvm-project@638dcea010cf | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "638dcea010cfc280f428d0cc13f4aa8578a1d69d"
LLVM_SHA256 = "38580afa46a4d1cc294012e044a3d74da45f135c8fbcee9ffbe1658749cdd608"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "f63b1bf7f49edcb4e5eb05000ddb3d2f5e9052e6"
LLVM_SHA256 = "60b8ea849cb74797a06bfd134cd377785db0fa1021de2fcd36b67e8407d36dfc"
tfrt_http_archive(
... | apache-2.0 | Python |
8f212946c29901c12135999460978f05687425cf | Integrate LLVM at llvm/llvm-project@21d91a8ef319 | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "21d91a8ef319eec9c2c272e19beee726429524aa"
LLVM_SHA256 = "39f116f6ad3f759ff96c851818a52b5a94e364a1278c610ba78abb6d48ac0e6c"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "45ac5f5441818afa1b0ee4a3734583c8cc915a79"
LLVM_SHA256 = "a901060c2252ce5fe864e9b50e19c5925724e707e3eaf9d2dc411dc11334b897"
tfrt_http_archive(
... | apache-2.0 | Python |
f2023900431dc0ce2b07974cdc3a11fa9d379682 | Add some example command executions | kirberich/gag | gag.py | gag.py | import gui
import random
from parser import GagParser
if __name__ == "__main__":
test_gui = gui.Gui()
white = gui.Color()
gray = gui.Color(0.5, 0.5, 0.5, 0.3)
blue = gui.Color(0.1, 0.2, 0.7, 0.3)
red = gui.Color(0.8, 0, 0, 0.3)
test_gui.fill(white)
loop_count = 0
try:
while Tr... | import gui
import random
if __name__ == "__main__":
test_gui = gui.Gui(virtual_width = 10, virtual_height = 10)
white = gui.Color()
gray = gui.Color(0.5, 0.5, 0.5, 0.3)
blue = gui.Color(0.1, 0.2, 0.7, 0.3)
red = gui.Color(0.8, 0, 0, 0.3)
test_gui.fill(white)
loop_count = 0
try:
... | mit | Python |
ee693725b94b440b02a237f9c0467822bc213d1c | fix docstring lint | gboeing/osmnx,gboeing/osmnx | osmnx/bearing.py | osmnx/bearing.py | """Calculate graph edge bearings."""
import math
import numpy as np
def get_bearing(origin_point, destination_point):
"""
Calculate the bearing between two lat-lng points.
Each argument tuple should represent (lat, lng) as decimal degrees.
Bearing represents angle in degrees (clockwise) between nor... | """Calculate graph edge bearings."""
import math
import numpy as np
def get_bearing(origin_point, destination_point):
"""
Calculate the bearing between two lat-lng points.
Each argument tuple should represent (lat, lng) as decimal degrees.
Bearing represents angle in degrees (clockwise) between nor... | mit | Python |
48dfbdf1023cd53f869fca9a3f98ef6afe2d6f83 | Sort campaign shifts by district, location and date/time | mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign | src/campaigns/models.py | src/campaigns/models.py | from django.db import models
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.formats import date_format
from tinymce.models import HTMLField
from locations.models import Location
from volunteers.models import Volunteer
class Campaign(model... | from django.db import models
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.formats import date_format
from tinymce.models import HTMLField
from locations.models import Location
from volunteers.models import Volunteer
class Campaign(model... | mit | Python |
c390b97f43dbdc59dd4e9b7775a3d3d7859a1afa | Send from myeventbot.com domain | eentzel/myeventbot,eentzel/myeventbot,eentzel/myeventbot,eentzel/myeventbot,eentzel/myeventbot | outgoing_mail.py | outgoing_mail.py | #!/usr/bin/env python
#
# Copyright 2010 Eric Entzel <eric@ubermac.net>
#
from google.appengine.api import mail
from google.appengine.ext.webapp import template
import os
from_address = '"EventBot" <admin@myeventbot.com>'
def send(to, template_name, values):
path = os.path.join(os.path.dirname(__file__), 'emai... | #!/usr/bin/env python
#
# Copyright 2010 Eric Entzel <eric@ubermac.net>
#
from google.appengine.api import mail
from google.appengine.ext.webapp import template
import os
from_address = '"EventBot" <theeventbot@gmail.com>'
def send(to, template_name, values):
path = os.path.join(os.path.dirname(__file__), 'ema... | mit | Python |
565eea79648d44f9d2c666a1ba449507a4cd08da | Update mono to 4.0.0 | BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild | packages/mono.py | packages/mono.py | class MonoPackage (Package):
def __init__ (self):
Package.__init__ (self, 'mono', '4.0.0',
sources = [
'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2'
],
configure_flags = [
'--with-jit=yes',
'--with-ikvm=no',
'--with-mcs-docs=no',
'--with-moonlight=no',
... | class MonoPackage (Package):
def __init__ (self):
Package.__init__ (self, 'mono', '2.10.9',
sources = [
'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2',
'patches/mono-gtk-sharp-profiler.patch',
'patches/xbuild-bug4365.patch'
],
configure_flags = [
'--with-jit=ye... | mit | Python |
9c7462fc706c2ec7cb1275dd00e2ecb4654b44fb | swap the two parenthesis removal methods; removes brackets as well | elfxiong/wiktionary-translations-parser | parser/helper.py | parser/helper.py | """
The common methods in different editions
"""
import re
import requests
from bs4 import BeautifulSoup, Tag
HEADING_TAG = re.compile(r'^h(?P<level>[1-6])$', re.I)
COMMA_OR_SEMICOLON = re.compile('[,;]')
PARENTHESIS_WITH_TEXT = re.compile(r'\([^()]*\)') # no nesting
def infer_edition_from_url(url):
# print(url... | """
The common methods in different editions
"""
import re
import requests
from bs4 import BeautifulSoup, Tag
HEADING_TAG = re.compile(r'^h(?P<level>[1-6])$', re.I)
COMMA_OR_SEMICOLON = re.compile('[,;]')
PARENTHESIS_WITH_TEXT = re.compile(r'\([^()]*\)') # no nesting
def infer_edition_from_url(url):
# print(url... | mit | Python |
36e86c01361bdbdc1cdfdea3c9334e618556de53 | make secret key random | eikevons/yorik-photos,eikevons/yorik-photos | photos/config.py | photos/config.py | DATABASE = '/var/local/yorik-photos/data/db.sqlite'
DEBUG = True
CSRF = True
SECRET_KEY = 'd49f8220e94b4cfea4610a115c9c6b62'
SERVER_NAME = '5.231.41.206'
PHOTO_STORAGE = '/var/local/yorik-photos/data/photos'
THUMB_WIDTH = '162' # pixels
| DATABASE = '/var/local/yorik-photos/data/db.sqlite'
DEBUG = True
CSRF = True
SECRET_KEY = 'this is not a secret'
SERVER_NAME = '5.231.41.206'
PHOTO_STORAGE = '/var/local/yorik-photos/data/photos'
THUMB_WIDTH = '162' # pixels
| mit | Python |
fd23173819f525caa829483334655976930b7ab2 | update import | betterin30days/PerpendicularPaths,Jagermeister/PerpendicularPaths | model/primative/wall.py | model/primative/wall.py | from .direction import Direction
class Wall (object):
name = ""
direction = None
def __init__ (self, name, direction):
assert isinstance(name, str)
self.name = name.upper()
assert isinstance(direction, Direction)
self.direction = direction | from primative import Direction
class Wall (object):
name = ""
direction = None
def __init__ (self, name, direction):
assert isinstance(name, str)
self.name = name.upper()
assert isinstance(direction, Direction)
self.direction = direction | mit | Python |
fa5e316740cc728d90615e27218b4e3c85cf8718 | Put fatal exception traceback in the log, in response to #315. | XDestination/mongo-connector,agolo/mongo-connector,MartinNowak/mongo-connector,Sebmaster/mongo-connector,10gen-labs/mongo-connector,10gen-labs/mongo-connector,mongodb-labs/mongo-connector,ShaneHarvey/mongo-connector,hzwjava/mongo-connector,XDestination/mongo-connector,Sebmaster/mongo-connector,sailthru/mongo-connector,... | mongo_connector/util.py | mongo_connector/util.py | # Copyright 2013-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | # Copyright 2013-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | apache-2.0 | Python |
132839b85c7927f3e80e382848e0840fadd337e4 | Tweak vectorization. | helgee/plyades | plyades/orbit.py | plyades/orbit.py | from __future__ import division
import numpy as np
def rhs(s, t):
pass
class Propagator:
pass
def elements(vector, mu):
r = np.atleast_2d(vector)[:, 0:3]
v = np.atleast_2d(vector)[:, 3:6]
r_mag = np.sqrt((r ** 2).sum(axis=1, keepdims=True))
v_mag = np.sqrt((v ** 2).sum(axis=1, keepdims=Tru... | from __future__ import division
import numpy as np
def rhs(s, t):
pass
class Propagator:
pass
def elements(vector, mu):
r = np.atleast_2d(vector)[:, 0:3]
v = np.atleast_2d(vector)[:, 3:6]
r_mag = np.sqrt((r ** 2).sum(axis=1))[:, np.newaxis]
v_mag = np.sqrt((v ** 2).sum(axis=1))[:, np.newax... | mit | Python |
2147df557bfb922fd640e2da1b105a60644dece0 | Determine DEBUG flag at runtime - if we are under the SDK, we are debugging | rbanffy/testable_appengine,rbanffy/testable_appengine | src/main.py | src/main.py | import webapp2
DEBUG = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')
class SampleIndex(webapp2.RequestHandler):
"""Stub request handler"""
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write("helloworld")
application = webapp2.WSGIApplicatio... | import webapp2
import settings
class SampleIndex(webapp2.RequestHandler):
"""Stub request handler"""
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write("helloworld")
application = webapp2.WSGIApplication([
('/', SampleIndex),
], debug=settings.DE... | apache-2.0 | Python |
ddb64a0b7a09203c8367c47d34ac29a82af012c0 | Use directory for all interaction - duh! | rabramley/telomere,rabramley/telomere,rabramley/telomere | produceEports.py | produceEports.py | #!/usr/bin/env python
from app.views.export import write_all_measurements_csv
import tempfile
import os
exportDirectory = "{0}/app/static/exports".format(os.path.dirname(os.path.realpath(__file__))
workingFile = "{0}/AllMeasurements_inprogress.csv".format(exportDirectory)
finalFile = "{0}/AllMeasurements.csv".format(e... | #!/usr/bin/env python
from app.views.export import write_all_measurements_csv
import tempfile
import os
f = open("{0}/app/static/exports/AllMeasurements_inprogress.csv".format(os.path.dirname(os.path.realpath(__file__))), "w")
try:
write_all_measurements_csv(f)
finally:
f.close
os.rename("app/static/exports... | mit | Python |
2ea65004f08e58eadbe5b9215d4fb76974854599 | Add a interface object to netman's vlan. | internap/netman,idjaw/netman,lindycoder/netman,internaphosting/netman | netman/core/objects/vlan.py | netman/core/objects/vlan.py | # Copyright 2015 Internap.
#
# 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, so... | # Copyright 2015 Internap.
#
# 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, so... | apache-2.0 | Python |
b6cb5d3cb21a529a2b9dc32e7049ed521c7097ab | Add flag sharing info endpoint | royragsdale/picoCTF,picoCTF/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,picoCTF/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF | picoCTF-web/api/apps/v1/groups.py | picoCTF-web/api/apps/v1/groups.py | """Group manangement."""
from flask import jsonify
from flask_restplus import Namespace, Resource
import api.group
import api.team
import api.user
from api.common import PicoException
ns = Namespace('groups', description='Group management')
@ns.route('/')
class GroupList(Resource):
"""Get the list of groups, or... | """Group manangement."""
from flask import jsonify
from flask_restplus import Namespace, Resource
import api.group
import api.team
import api.user
from api.common import PicoException
ns = Namespace('groups', description='Group management')
@ns.route('/')
class GroupList(Resource):
"""Get the list of groups, or... | mit | Python |
40fa21d7ab841b5f9657ed3ce26ba12651a8c598 | Correct some Rfam output filenames | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | rnacentral_pipeline/cli/rfam.py | rnacentral_pipeline/cli/rfam.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... | apache-2.0 | Python |
6a213a429a1e8d735fde7251a4916040d853b0e5 | add pylint ignore in django returner | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/returners/django_return.py | salt/returners/django_return.py | # -*- coding: utf-8 -*-
'''
A returner that will inform a Django system that
returns are available using Django's signal system.
https://docs.djangoproject.com/en/dev/topics/signals/
It is up to the Django developer to register necessary
handlers with the signals provided by this returner
and process returns as neces... | # -*- coding: utf-8 -*-
'''
A returner that will inform a Django system that
returns are available using Django's signal system.
https://docs.djangoproject.com/en/dev/topics/signals/
It is up to the Django developer to register necessary
handlers with the signals provided by this returner
and process returns as neces... | apache-2.0 | Python |
8a544ac2db71d4041c77fdb0ddfe27b84b565bb5 | Revert "Catch and ignore CTRL_LOGOFF_EVENT when run as a windows service" | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/utils/saltminionservice.py | salt/utils/saltminionservice.py | # Import salt libs
from salt.utils.winservice import Service, instart
import salt
# Import third party libs
import win32serviceutil
import win32service
import winerror
# Import python libs
import sys
class MinionService(Service):
def start(self):
self.runflag = True
self.log("Starting the Salt ... | # Import salt libs
from salt.utils.winservice import Service, instart
import salt
# Import third party libs
import win32serviceutil
import win32service
import winerror
import win32api
# Import python libs
import sys
class MinionService(Service):
def start(self):
self.runflag = True
self.log("St... | apache-2.0 | Python |
73ef78a210a1a7b7c96f1d2a12c23cc4863c7e25 | Update eigenvalues plot (still outdated). | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | plots/plot-posture-eigenvalues.py | plots/plot-posture-eigenvalues.py | #!/usr/bin/env python
import climate
import lmj.cubes
import lmj.pca
import lmj.plot
import numpy as np
import pandas as pd
@climate.annotate(
pca='load PCA from this file on disk',
root='load experiment data from this directory tree',
pattern=('load trials matching this pattern', 'option'),
output=(... | #!/usr/bin/env python
import climate
import lmj.pca
import lmj.plot
def main(root, pca):
pca = lmj.pca.PCA(filename=pca)
K = 100
annkw = dict(
color='#d62728',
arrowprops=dict(
color='#d62728',
arrowstyle='->',
connectionstyle='angle,angleA=-100,angleB... | mit | Python |
7f27dd6d7cdb80a1c30533d49abb3d8d34e8076d | Support split of ppp_core. | ProjetPP/PPP-QuestionParsing-ML-Standalone,ProjetPP/PPP-QuestionParsing-ML-Standalone | ppp_nlp_ml_standalone/__init__.py | ppp_nlp_ml_standalone/__init__.py | """Example python module for the PPP."""
from ppp_libmodule import HttpRequestHandler
from .requesthandler import RequestHandler
def app(environ, start_response):
"""Function called by the WSGI server."""
return HttpRequestHandler(environ, start_response, RequestHandler) \
.dispatch()
| """Example python module for the PPP."""
from ppp_core import HttpRequestHandler
from .requesthandler import RequestHandler
def app(environ, start_response):
"""Function called by the WSGI server."""
return HttpRequestHandler(environ, start_response, RequestHandler) \
.dispatch()
| mit | Python |
69f8eba05380062ba8e5e182d6f62257d84776fe | Add hypo_test_sqrt_log | jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools | problem/numeric/sqrt_hypo_test.py | problem/numeric/sqrt_hypo_test.py | #! /usr/bin/env python
# Copyright 2021 John Hanley.
#
# 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 rights to use, copy, modify, me... | #! /usr/bin/env python
# Copyright 2021 John Hanley.
#
# 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 rights to use, copy, modify, me... | mit | Python |
166199b50c18e1b27f6fe95fe7359118c673ef52 | fix typo | stackforge/fuel-octane,Mirantis/octane,Mirantis/octane,stackforge/fuel-octane | octane/helpers/clean_env.py | octane/helpers/clean_env.py | #!/usr/bin/python
# 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
# d... | #!/usr/bin/python
# 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
# d... | apache-2.0 | Python |
eeb8057fb5ff65eb89e3b5a8ff94bf58adc511ee | Refactor test incase results are backwards | llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,apple/swift-llv... | utils/lit/tests/test-output.py | utils/lit/tests/test-output.py | # RUN: %{lit} -j 1 -v %{inputs}/test-data --output %t.results.out > %t.out
# RUN: FileCheck < %t.results.out %s
# CHECK: {
# CHECK: "__version__"
# CHECK: "elapsed"
# CHECK-NEXT: "tests": [
# CHECK-NEXT: {
# CHECK-NEXT: "code": "PASS",
# CHECK-NEXT: "elapsed": {{[0-9.]+}},
# CHECK-NEXT: "metrics": {
# CH... | # RUN: %{lit} -j 1 -v %{inputs}/test-data --output %t.results.out > %t.out
# RUN: FileCheck < %t.results.out %s
# CHECK: {
# CHECK: "__version__"
# CHECK: "elapsed"
# CHECK-NEXT: "tests": [
# CHECK-NEXT: {
# CHECK-NEXT: "code": "PASS",
# CHECK-NEXT: "elapsed": {{[0-9.]+}},
# CHECK-NEXT: "metrics": {
# CH... | apache-2.0 | Python |
a62840b001a75a59cc2c202831e93f6a014f06ff | bump version to 1.5.4 | kronenthaler/openstep-parser | openstep_parser/__init__.py | openstep_parser/__init__.py | from .openstep_parser import OpenStepDecoder
__version__ = '1.5.4'
| from .openstep_parser import OpenStepDecoder
__version__ = '1.5.3'
| bsd-2-clause | Python |
9208a5e94cffd575b58f7ee746985774c25a6c5d | Add some helpful output to ddev env ls command (#5576) | DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core | datadog_checks_dev/datadog_checks/dev/tooling/commands/env/ls.py | datadog_checks_dev/datadog_checks/dev/tooling/commands/env/ls.py | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import click
from ...e2e import get_configured_checks, get_configured_envs
from ...testing import get_available_tox_envs
from ...utils import get_testable_checks
from ..console import CONTEXT_SETTINGS, ec... | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import click
from ...e2e import get_configured_checks, get_configured_envs
from ...testing import get_available_tox_envs
from ...utils import get_testable_checks
from ..console import CONTEXT_SETTINGS, ec... | bsd-3-clause | Python |
8d10a6967dd43249deaf006f6fec6900491c6336 | fix array syntax | jimoconnell/electrobrain,FactoryMakerSpace/electrobrain | led.py | led.py | #!/usr/bin/env python2.7
# script by Alex Eames http://RasPi.tv
#http://RasPi.tv/2013/how-to-use-soft-pwm-in-rpi-gpio-pt-2-led-dimming-and-motor-speed-control
# Using PWM with RPi.GPIO pt 2 - requires RPi.GPIO 0.5.2a or higher
import RPi.GPIO as GPIO # always needed with RPi.GPIO
from time import sleep # pull in the ... | #!/usr/bin/env python2.7
# script by Alex Eames http://RasPi.tv
#http://RasPi.tv/2013/how-to-use-soft-pwm-in-rpi-gpio-pt-2-led-dimming-and-motor-speed-control
# Using PWM with RPi.GPIO pt 2 - requires RPi.GPIO 0.5.2a or higher
import RPi.GPIO as GPIO # always needed with RPi.GPIO
from time import sleep # pull in the ... | mit | Python |
a9ae9a0ade14301e3f1111503a715f42ad3cadc5 | Add support for compressed input files. | lebedov/nseindia_lob | lob.py | lob.py | #!/usr/bin/env python
"""
Limit order book simulation for Indian security exchange.
"""
import _lob
import glob
import gzip
import logging
import pandas
import time
if __name__ == '__main__':
start = time.time()
format = '%(asctime)s %(name)s %(levelname)s [%(funcName)s] %(message)s'
logging.basicConfi... | #!/usr/bin/env python
"""
Limit order book simulation for Indian security exchange.
"""
import _lob
import glob
import logging
import pandas
import time
if __name__ == '__main__':
start = time.time()
format = '%(asctime)s %(name)s %(levelname)s [%(funcName)s] %(message)s'
logging.basicConfig(level=logg... | bsd-3-clause | Python |
3acd07433f7835da251f6990659482663686a8d1 | test math.fabs() | xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples | pythonPractiseSamples/mathExcercises.py | pythonPractiseSamples/mathExcercises.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Damian Ziobro <damian@xmementoit.com>
import unittest
import math
class TestMathMethods(unittest.TestCase):
def setUp(self):
self.number = 3.5
self.negativeNumber = -3.5
def test_ceil(self):
self.as... | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Damian Ziobro <damian@xmementoit.com>
import unittest
import math
class TestMathMethods(unittest.TestCase):
def setUp(self):
self.number = 3.5
def test_ceil(self):
self.assertEqual(math.ceil(self.number), 4... | apache-2.0 | Python |
1e040499984b2d3e566520e24c724300d57ec7d4 | Add Prediction class | pdarragh/MinSem | mwe.py | mwe.py | #!/usr/bin/env python3
"""
A machine learning classifier for identifying minimal semantic units. See the README.md for more information.
"""
from enum import Enum
from typing import Dict, List, Tuple
FeatureID = int
class Label(Enum):
O = 0
B = 1
I = 2
class Frequency:
def __init__(self):
... | #!/usr/bin/env python3
"""
A machine learning classifier for identifying minimal semantic units. See the README.md for more information.
"""
from enum import Enum
from typing import Dict, List, Tuple
FeatureID = int
class Label(Enum):
O = 0
B = 1
I = 2
class Frequency:
def __init__(self):
... | mit | Python |
778f732f6a3ce81149f08f338aab243fe0d71f6d | add forward euler method | DaisukeMiyamoto/test_numericalmethods | ode.py | ode.py | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 21:39:30 2015
@author: nebula
"""
import matplotlib.pyplot as plt
import numpy as np
def calc_euler(x0, y0, dt, n , f):
x = [x0]
y = [y0]
for i in range(n):
y.append(y[-1] + dt * f(x[-1], y[-1]))
x.append(x[-1] + dt)
return x,... | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 21:39:30 2015
@author: nebula
"""
import matplotlib.pyplot as plt
import numpy as np
def func(x, y):
return x + y
def main():
h = 0.1
x0 = 0.0
y0 = 1.0
n = 109
y = {}
for i in range(0, n, 10):
print '%10.4f :' % x[i] ,
... | mit | Python |
356c56d7ebb2cc8e837308536c085b8dd399b01f | Use argparse for more flexible usage. | materialsvirtuallab/flamyngo,materialsvirtuallab/flamyngo,materialsvirtuallab/flamyngo | run.py | run.py | #!/usr/bin/env python
"""
TODO: Modify module doc.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Virtual Lab"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__date__ = "7/30/14"
import os
import argparse
if __name__ == "__main__":
parser... | #!/usr/bin/env python
"""
TODO: Modify module doc.
"""
from __future__ import division
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Virtual Lab"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__date__ = "7/30/14"
import os
os.environ["FLAMYNGO"]... | bsd-3-clause | Python |
afd4ead2f8676c464a948223f5d15c82451a1b9b | Fix wrong permissions applied to Equipment endpoint | GETLIMS/LIMS-Backend,GETLIMS/LIMS-Backend | lims/equipment/views.py | lims/equipment/views.py |
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.exceptions import PermissionDenied
import django_filters
from lims.permissions.permissions import IsInStaffGroupOrRO
from .models import Equipment, EquipmentReservation
from .serializers import EquipmentSerializer, ... |
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.exceptions import PermissionDenied
import django_filters
from lims.permissions.permissions import IsInAdminGroupOrRO
from .models import Equipment, EquipmentReservation
from .serializers import EquipmentSerializer, ... | mit | Python |
cf94f6d78f6bc47352fdbfc5c4d4556e32e41a9d | Update ipc_lista1.11.py | any1m1c/ipc20161 | lista1/ipc_lista1.11.py | lista1/ipc_lista1.11.py | #ipc_lista1.11
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
#Faça um programa que peça 2 numeros inteiros e um numero real. Calcule e mostre:
#a- o produto do dobro do primeiro com metade do segundo.
#b- a soma do triplo do primeiro com o terceiro.
#c- o terceiro elevado ao cubo.
import math
num1 = input("... | #ipc_lista1.11
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
#Faça um programa que peça 2 numeros inteiros e um numero real. Calcule e mostre:
#a- o produto do dobro do primeiro com metade do segundo.
#b- a soma do triplo do primeiro com o terceiro.
#c- o terceiro elevado ao cubo.
import math
num1 = input("... | apache-2.0 | Python |
4632aa1230710bb88fd4f09a378ba78a97f79114 | Update ipc_lista1.17.py | any1m1c/ipc20161 | lista1/ipc_lista1.17.py | lista1/ipc_lista1.17.py | #ipc_lista1.17
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
import math
#Calculo para verificar quantas latas/galoes de tintas sera necessarias e o valor delas
metros = input("Entre como o tamnho em metros quadrdados da are a ser pintada: ")
MetrosLtas = metros/6
if (MetrosLatas <= 0):
Me... | #ipc_lista1.17
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
import math
#Calculo para verificar quantas latas/galoes de tintas sera necessarias e o valor delas
metros = input("Entre como o tamnho em metros quadrdados da are a ser pintada: ")
MetrosLtas = metros/6
if (MetrosLatas <= 0):
Me... | apache-2.0 | Python |
9b68d63a7385a0f9ab6ad0a1fe699eff6df88995 | Update ipc_lista2.16.py | any1m1c/ipc20161 | lista2/ipc_lista2.16.py | lista2/ipc_lista2.16.py | #EQUIPE 2
#Nahan Trindade Passos - 1615310021
#Ana Beatriz Frota - 1615310027
#
#
#
#
#
import math
print("Digite os termos da equacao ax2+bx+c")
a = float(input("Digite o valor de A:\n"))
if(a==0):
print("Nao e uma equacao de segundo grau")
else:
b = float(input("Valor de B:\n"))
c = float(input("Valor ... | #EQUIPE 2
#Nahan Trindade Passos - 1615310021
#Ana Beatriz Frota - 1615310027
#
#
#
import math
print("Digite os termos da equacao ax2+bx+c")
a = float(input("Digite o valor de A:\n"))
if(a==0):
print("Nao e uma equacao de segundo grau")
else:
b = float(input("Valor de B:\n"))
c = float(input("Valor de ... | apache-2.0 | Python |
3fe701c037055754c0f12bece845c68102b96948 | check for None so an empty string is valid for a password | polimediaupv/edx-platform,beni55/edx-platform,xuxiao19910803/edx-platform,vasyarv/edx-platform,nanolearningllc/edx-platform-cypress-2,SravanthiSinha/edx-platform,hastexo/edx-platform,AkA84/edx-platform,alexthered/kienhoc-platform,JCBarahona/edX,msegado/edx-platform,sudheerchintala/LearnEraPlatForm,beacloudgenius/edx-pl... | lms/envs/aws_migrate.py | lms/envs/aws_migrate.py | """
A Django settings file for use on AWS while running
database migrations, since we don't want to normally run the
LMS with enough privileges to modify the database schema.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=... | """
A Django settings file for use on AWS while running
database migrations, since we don't want to normally run the
LMS with enough privileges to modify the database schema.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=... | agpl-3.0 | Python |
cf76b86538a1c87449a74097ec9deabbea01a898 | Fix a problem where you run provy without any arguments in a directory with a provyfile, as the server was None | python-provy/provy,python-provy/provy | provy/console.py | provy/console.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# provy provisioning
# https://github.com/heynemann/provy
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Bernardo Heynemann heynemann@gmail.com
import sys
import os
import re
from os.path import exists, abspath, sp... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# provy provisioning
# https://github.com/heynemann/provy
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Bernardo Heynemann heynemann@gmail.com
import sys
import os
import re
from os.path import exists, abspath, sp... | mit | Python |
7b26bf6544d89c67c12f036f23cc96ac7369cf77 | Add TestingMultiprocessingRunner | tkf/buildlet | buildlet/tests/test_dumpedmocktask_directory_multiprocessing.py | buildlet/tests/test_dumpedmocktask_directory_multiprocessing.py | from ..runner.multiprocessingpool import MultiprocessingRunner
from . import test_dumpedmocktask_directory
class TestingMultiprocessingRunner(MultiprocessingRunner):
def wait_tasks(self):
super(TestingMultiprocessingRunner, self).wait_tasks()
for task in self.nodetaskmap.values():
ta... | from ..runner.multiprocessingpool import MultiprocessingRunner
from . import test_dumpedmocktask_directory
class TestDumpedMockTaskDirectoryMultiprocessing(
test_dumpedmocktask_directory.TestDumpedMockTaskDirectory):
RunnerClass = MultiprocessingRunner
| bsd-3-clause | Python |
89fc25ab15cb038b4a77a9f8832c4b7ee6603d2f | Fix fallback from headers to fields | limbera/django-nap,MarkusH/django-nap | nap/extras/simplecsv.py | nap/extras/simplecsv.py |
class Writer(object):
'''
A generator friendly, unicode aware CSV encoder class built for speed.
'''
# What to put between fields
SEP = u','
# What to wrap fields in, if they contain SEP
QUOTE = u'"'
# What to replace a QUOTE in a field with
ESCQUOTE = QUOTE + QUOTE
# What to p... |
class Writer(object):
'''
A generator friendly, unicode aware CSV encoder class built for speed.
'''
# What to put between fields
SEP = u','
# What to wrap fields in, if they contain SEP
QUOTE = u'"'
# What to replace a QUOTE in a field with
ESCQUOTE = QUOTE + QUOTE
# What to p... | bsd-3-clause | Python |
ece6d0bd524638a107297f93b1e92b20462afb1b | Bump version number. | GreatFruitOmsk/nativeconfig | nativeconfig/version.py | nativeconfig/version.py | VERSION = '3.1.1'
| VERSION = '3.1.0'
| mit | Python |
8c5b6187215f6a8159293df741027a585699e4ce | test for link form | j00bar/django-widgy,j00bar/django-widgy,j00bar/django-widgy | tests/modeltests/core_tests/tests/links.py | tests/modeltests/core_tests/tests/links.py | from django import forms
from django.test import TestCase
from widgy.models.links import (
get_all_linkable_classes, get_all_linker_classes,
get_link_field_from_model, LinkFormMixin, LinkFormField
)
from modeltests.core_tests.models import (
LinkableThing, ThingWithLink, AnotherLinkableThing,
Bucket, ... | from django.test import TestCase
from widgy.models.links import (
get_all_linkable_classes, get_all_linker_classes,
get_link_field_from_model
)
from modeltests.core_tests.models import (
LinkableThing, ThingWithLink, AnotherLinkableThing,
Bucket, VersionPageThrough
)
class TestLinkRelations(TestCase... | apache-2.0 | Python |
c66548894da945b854b35b044e7b6aa937b36d85 | remove empty spaces | faneshion/MatchZoo,faneshion/MatchZoo | tests/unit_test/engine/test_param_table.py | tests/unit_test/engine/test_param_table.py | import pytest
from matchzoo.engine import Param, ParamTable
from matchzoo.engine.hyper_spaces import quniform
@pytest.fixture
def param_table():
params = ParamTable()
params.add(Param('ham', 'Parma Ham'))
return params
def test_get(param_table):
assert param_table['ham'] == 'Parma Ham'
def test_set(... | import pytest
from matchzoo.engine import Param, ParamTable
from matchzoo.engine.hyper_spaces import quniform
@pytest.fixture
def param_table():
params = ParamTable()
params.add(Param('ham', 'Parma Ham'))
return params
def test_get(param_table):
assert param_table['ham'] == 'Parma Ham'
def test_set(... | apache-2.0 | Python |
d27acc605c3b083928583266f74216701ff15d6a | Add tests for factors of ten | ianfieldhouse/number_to_words | number_to_words_test.py | number_to_words_test.py | import unittest
from number_to_words import NumberToWords
class TestNumberToWords(unittest.TestCase):
def setUp(self):
self.n2w = NumberToWords()
def tearDown(self):
self.n2w = None
def test_zero_and_single_digits(self):
NUMBERS = {
0: 'zero', 1: 'one', 2: 'two', 3: '... | import unittest
from number_to_words import NumberToWords
class TestNumberToWords(unittest.TestCase):
def setUp(self):
self.n2w = NumberToWords()
def tearDown(self):
self.n2w = None
def test_zero_and_single_digits(self):
NUMBERS = {
0: 'zero', 1: 'one', 2: 'two', 3: '... | mit | Python |
b22b8c2249dc64d99e297dfe2ca24abbf30ec00d | Implement Staction Controller * Fixing mis-typed name. | punalpatel/st2,lakshmi-kannan/st2,armab/st2,StackStorm/st2,jtopjian/st2,emedvedev/st2,pixelrebel/st2,alfasin/st2,Plexxi/st2,pinterb/st2,Itxaka/st2,pixelrebel/st2,nzlosh/st2,nzlosh/st2,peak6/st2,grengojbo/st2,pinterb/st2,emedvedev/st2,lakshmi-kannan/st2,alfasin/st2,Itxaka/st2,punalpatel/st2,StackStorm/st2,StackStorm/st2... | st2common/st2common/models/api/stormbase.py | st2common/st2common/models/api/stormbase.py | from wsme import types as wtypes
from mirantis.resource import Resource
class BaseAPI(Resource):
# TODO: Does URI need a custom type?
uri = wtypes.text
name = wtypes.text
description = wtypes.text
id = wtypes.text
| from wsme import types as wtypes
from mirantas.resource import Resource
class BaseAPI(Resource):
# TODO: Does URI need a custom type?
uri = wtypes.text
name = wtypes.text
description = wtypes.text
id = wtypes.text
| apache-2.0 | Python |
d840fb4c6e19616663f5b16d4ece759ffe2cf47b | handle anonymous user | nthall/django-stored-messages,xrmx/django-stored-messages,xrmx/django-stored-messages,evonove/django-stored-messages,evonove/django-stored-messages,nthall/django-stored-messages,b0bbywan/django-stored-messages,b0bbywan/django-stored-messages | stored_messages/backends/default/backend.py | stored_messages/backends/default/backend.py | from ..base import StoredMessagesBackend
from ..exceptions import MessageTypeNotSupported, InboxDoesNotExist
from ...models import Inbox, Message, MessageArchive
class DefaultBackend(StoredMessagesBackend):
"""
"""
def inbox_list(self, user):
if user.is_anonymous():
return Inbox.objec... | from ..base import StoredMessagesBackend
from ..exceptions import MessageTypeNotSupported, InboxDoesNotExist
from ...models import Inbox, Message, MessageArchive
class DefaultBackend(StoredMessagesBackend):
"""
"""
def inbox_list(self, user):
inbox = Inbox.objects.filter(user=user.pk).select_rela... | bsd-3-clause | Python |
4b2c61873c6d880b2c34a8d5fc8c552411e6f1a4 | Add Debian to list of recognized Linux flavors | luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py | appengine/components/components/machine_provider/dimensions.py | appengine/components/components/machine_provider/dimensions.py | # Copyright 2015 The LUCI Authors. 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.
"""Dimensions for the Machine Provider."""
from protorpc import messages
class Backend(messages.Enum):
"""Lists valid backends."""
DUMMY = ... | # Copyright 2015 The LUCI Authors. 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.
"""Dimensions for the Machine Provider."""
from protorpc import messages
class Backend(messages.Enum):
"""Lists valid backends."""
DUMMY = ... | apache-2.0 | Python |
6dc4bdf3b312d46c6f25d952097a0718753c3a97 | test empty exceptions | smspillaz/pychecker,smspillaz/pychecker,smspillaz/pychecker | pychecker/pychecker2/utest/ops.py | pychecker/pychecker2/utest/ops.py | from pychecker2 import TestSupport
from pychecker2 import OpChecks
class OpTests(TestSupport.WarningTester):
def testOperator(self):
for op in ['--', '++']:
self.warning('def f(x):\n'
' return %sx' % op,
2, OpChecks.OpCheck.operator, op)
... | from pychecker2 import TestSupport
from pychecker2 import OpChecks
class OpTests(TestSupport.WarningTester):
def testOperator(self):
for op in ['--', '++']:
self.warning('def f(x):\n'
' return %sx' % op,
2, OpChecks.OpCheck.operator, op)
... | bsd-3-clause | Python |
45be5e2e7ff0a764dbc933ab6b28db47d3112bbc | Add scrunch to blocks/__init__.py and avoid error if libportaudio not installed. | ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost | python/bifrost/blocks/__init__.py | python/bifrost/blocks/__init__.py |
# Copyright (c) 2016, The Bifrost Authors. All rights reserved.
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must r... |
# Copyright (c) 2016, The Bifrost Authors. All rights reserved.
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must r... | bsd-3-clause | Python |
4fa48a91774862e12331e69542beaad787a05aec | Remove exit from conductor | hongbin/magnum,dimtruck/magnum,eshijia/SUR,Alzon/SUR,annegentle/magnum,sajuptpm/magnum,mjbrewer/testindex,ramielrowe/magnum,paulczar/magnum,ffantast/magnum,openstack/magnum,sajuptpm/magnum,ffantast/magnum,Alzon/SUR,ArchiFleKs/magnum,Tennyson53/SUR,annegentle/magnum,jay-lau/magnum,eshijia/magnum,eshijia/magnum,LaynePeng... | magnum/cmd/conductor.py | magnum/cmd/conductor.py | # Copyright 2014 - Rackspace Hosting
#
# 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... | # Copyright 2014 - Rackspace Hosting
#
# 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... | apache-2.0 | Python |
52a73feb381c77013f42ee85c21bc61d2e96641c | Fix 'indentation' warnings. | gmist/3dhero2,gmist/gae-de-init | main/apps/user/forms.py | main/apps/user/forms.py | # coding: utf-8
from flask.ext import wtf
from apps.auth.decorators import permission_registered
from core import util
###############################################################################
# User Update
###############################################################################
class UserUpdateForm(wtf... | # coding: utf-8
from flask.ext import wtf
from apps.auth.decorators import permission_registered
from core import util
###############################################################################
# User Update
###############################################################################
class UserUpdateForm(wtf... | mit | Python |
b367e2919c0de02f3514dfac5c890ffd70603918 | Fix expert request filter by customer and project name. | opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur | src/nodeconductor_assembly_waldur/experts/filters.py | src/nodeconductor_assembly_waldur/experts/filters.py | import django_filters
from nodeconductor.core import filters as core_filters
from . import models
class ExpertProviderFilter(django_filters.FilterSet):
customer = core_filters.URLFilter(view_name='customer-detail', name='customer__uuid')
customer_uuid = django_filters.UUIDFilter(name='customer__uuid')
... | import django_filters
from nodeconductor.core import filters as core_filters
from . import models
class ExpertProviderFilter(django_filters.FilterSet):
customer = core_filters.URLFilter(view_name='customer-detail', name='customer__uuid')
customer_uuid = django_filters.UUIDFilter(name='customer__uuid')
... | mit | Python |
9546b85ddd3330416bcfabf45f744e8b87d2c6c0 | set severity 3 as the default when there is no severity | screepers/screeps_console,screepers/screeps_console | screeps_console/outputparser.py | screeps_console/outputparser.py |
import colorama
from colorama import Fore, Back, Style
import re
colorama.init()
SEVERITY_RE = re.compile(r'<.*severity="(\d)">')
TYPE_RE = re.compile(r'<.*type="([a-zA-Z0-9]*)">')
TAG_RE = re.compile(r'<[^>]+>')
def parseLine(line):
severity = getSeverity(line)
# Add color based on severity
if 'severit... |
import colorama
from colorama import Fore, Back, Style
import re
colorama.init()
SEVERITY_RE = re.compile(r'<.*severity="(\d)">')
TYPE_RE = re.compile(r'<.*type="([a-zA-Z0-9]*)">')
TAG_RE = re.compile(r'<[^>]+>')
def parseLine(line):
severity = getSeverity(line)
# Add color based on severity
if 'severit... | mit | Python |
d5e0b6ab45c36a57344b9540b61684280bb5333b | fix typo in field label | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/sale_stock/wizard/stock_rules_report.py | addons/sale_stock/wizard/stock_rules_report.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class StockRulesReport(models.TransientModel):
_inherit = 'stock.rules.report'
so_route_ids = fields.Many2many('stock.location.route', string='Apply specific routes',
... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class StockRulesReport(models.TransientModel):
_inherit = 'stock.rules.report'
so_route_ids = fields.Many2many('stock.location.route', string='Apply specific rotues',
... | agpl-3.0 | Python |
17cb5e556476220a2bc8230abd06a27472b63765 | check empty json | ez4u/ijust_backend,ez4u/ijust_backend | project/utils/validators.py | project/utils/validators.py | # -*- coding: utf-8 -*-
# python imports
from functools import wraps
from good import Invalid
import collections
# project imports
from project import app
# flask imports
from flask import request, jsonify
def validate_schema(schema_name, api=False):
def wrapper(f):
@wraps(f)
def decorated(*args, **kwargs):
... | # -*- coding: utf-8 -*-
# python imports
from functools import wraps
from good import Invalid
import collections
# project imports
from project import app
# flask imports
from flask import request, jsonify
def validate_schema(schema_name, api=False):
def wrapper(f):
@wraps(f)
def decorated(*args, **kwargs):
... | apache-2.0 | Python |
2f8c3ab7ecd0606069d524192c551e7be77ca461 | Switch to use database for image ui | lord63/zhihudaily,lord63/zhihudaily,lord63/zhihudaily | zhihudaily/views/with_image.py | zhihudaily/views/with_image.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from flask import render_template, Blueprint, json
from zhihudaily.cache import cache
from zhihudaily.models import Zhihudaily
from zhihudaily.utils import Date
image_ui = Blueprint('image_ui', __name__, templat... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import datetime
from flask import render_template, Blueprint
from zhihudaily.utils import make_request
from zhihudaily.cache import cache
image_ui = Blueprint('image_ui', __name__, template_folder='templates')
... | mit | Python |
5c405745c954c2aa6121ddd82fb13ffef11b3150 | Revert the commit "bc85b4e" to keep the current solution | henrysher/spec4pypi | pyp2rpm/utils.py | pyp2rpm/utils.py | import functools
from pyp2rpm import settings
def memoize_by_args(func):
"""Memoizes return value of a func based on args."""
memory = {}
@functools.wraps(func)
def memoized(*args):
if not args in memory.keys():
value = func(*args)
memory[args] = value
return ... | import functools
from pyp2rpm import settings
def memoize_by_args(func):
"""Memoizes return value of a func based on args."""
memory = {}
@functools.wraps(func)
def memoized(*args):
if not args in memory.keys():
value = func(*args)
memory[args] = value
return ... | mit | Python |
67c1dcd2654104a069a8e6a71fa7ddf11d133f21 | Add setter to sender attribute of Message | wairton/zephyrus-mas | zephyrus/message.py | zephyrus/message.py | import json
class Message:
def __init__(self, sender, receiver=None, message_type=None, content=None):
self.message = {
'sender': sender,
'receiver': receiver,
'type': message_type,
'content': content
}
def __str__(self):
return json.dum... | import json
class Message:
def __init__(self, sender, receiver=None, message_type=None, content=None):
self.message = {
'sender': sender,
'receiver': receiver,
'type': message_type,
'content': content
}
def __str__(self):
return json.dum... | mit | Python |
7f5fea8ec90d66b5f717fb432b0887446b85bfdf | Change word2vec preprocessing. | knub/master-thesis,knub/master-thesis,knub/master-thesis,knub/master-thesis | code/python/knub/thesis/word2vec_gaussian_lda_preprocessing.py | code/python/knub/thesis/word2vec_gaussian_lda_preprocessing.py | import argparse
from codecs import open
import logging
import os
from gensim.models import Word2Vec
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
if __name__ == "__main__":
parser = argparse.ArgumentParser("Prepare model for Gaussian LDA")
parser.add_argument("--... | import argparse
from codecs import open
import logging
import os
from gensim.models import Word2Vec
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
if __name__ == "__main__":
parser = argparse.ArgumentParser("Prepare model for Gaussian LDA")
parser.add_argument("--... | apache-2.0 | Python |
578c7e03ad850a0d7084010cb2e4105c51098ffc | Make 'topic' nullable in document search index | litui/openparliament,litui/openparliament,rhymeswithcycle/openparliament,litui/openparliament,rhymeswithcycle/openparliament,rhymeswithcycle/openparliament | parliament/hansards/search_indexes.py | parliament/hansards/search_indexes.py | from haystack import indexes
from parliament.hansards.models import Statement
class StatementIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr='text_plain')
searchtext = indexes.CharField(stored=False, use_template=True)
date = indexes.DateTimeField(model_at... | from haystack import indexes
from parliament.hansards.models import Statement
class StatementIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr='text_plain')
searchtext = indexes.CharField(stored=False, use_template=True)
date = indexes.DateTimeField(model_at... | agpl-3.0 | Python |
2bd0e9fa621a6a5dd50a517acf18e1362835232c | Update Chapter07/transpositionEncrypt.py added docstrings | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter07/transpositionEncrypt.py | books/CrackingCodesWithPython/Chapter07/transpositionEncrypt.py | """Transposition Cipher Encryption
Demonstrates how to implement a transposition cipher.
Note:
https://www.nostarch.com/crackingcodes/ (BSD Licensed)
"""
from books.CrackingCodesWithPython.pyperclip import copy
def main():
myMessage = 'Common sense is not so common.'
myKey = 8
ciphertext = encrypt... | # Transposition Cipher Encryption
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
from books.CrackingCodesWithPython.pyperclip import copy
def main():
myMessage = 'Common sense is not so common.'
myKey = 8
ciphertext = encryptMessage(myKey, myMessage)
# Print the encrypted string in ciphert... | mit | Python |
ab81837b707280b960ca02675a85da7918d17fec | Adjust to match modern style conventions. | pypa/setuptools,pypa/setuptools,pypa/setuptools | setuptools/command/bdist_rpm.py | setuptools/command/bdist_rpm.py | # This is just a kludge so that bdist_rpm doesn't guess wrong about the
# distribution name and version, if the egg_info command is going to alter
# them, another kludge to allow you to build old-style non-egg RPMs.
from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm
class bdist_rpm(_bdist_rpm):
def ... | # This is just a kludge so that bdist_rpm doesn't guess wrong about the
# distribution name and version, if the egg_info command is going to alter
# them, another kludge to allow you to build old-style non-egg RPMs.
from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm
class bdist_rpm(_bdist_rpm):
def ... | mit | Python |
58eb4b2b034d90f45b3daa12900f24a390bb4782 | Replace outdated deprecating comments with a proper doc string. | pypa/setuptools,pypa/setuptools,pypa/setuptools | setuptools/command/bdist_rpm.py | setuptools/command/bdist_rpm.py | from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm
class bdist_rpm(_bdist_rpm):
"""
Override the default bdist_rpm behavior to do the following:
1. Run egg_info to ensure the name and version are properly calculated.
2. Always run 'install' using --single-version-externally-managed to
... | # This is just a kludge so that bdist_rpm doesn't guess wrong about the
# distribution name and version, if the egg_info command is going to alter
# them, another kludge to allow you to build old-style non-egg RPMs.
from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm
class bdist_rpm(_bdist_rpm):
def ... | mit | Python |
57c99f8d9cfd4f395af7d9f1bd7e923c851e32d9 | Clean up accumulator correlation test | yugangzhang/scikit-beam,danielballan/scikit-xray,licode/scikit-xray,tacaswell/scikit-beam,yugangzhang/scikit-beam,ericdill/scikit-xray,danielballan/scikit-xray,scikit-xray/scikit-xray,tacaswell/scikit-beam,CJ-Wright/scikit-beam,tacaswell/scikit-beam,danielballan/scikit-xray,tacaswell/scikit-xray,CJ-Wright/scikit-beam,y... | skxray/core/accumulators/tests/test_correlation.py | skxray/core/accumulators/tests/test_correlation.py | from skxray.core.correlation.correlation import multi_tau_auto_corr
from skxray.core.accumulators.correlation import (MultiTauCorrelation,
intermediate_data)
from skxray.core.accumulators.corr_gen import lazy_correlation
import numpy as np
# turn off auto wrapping of p... | from skxray.core.correlation.correlation import multi_tau_auto_corr
from skxray.core.accumulators.correlation import (MultiTauCorrelation,
intermediate_data)
import numpy as np
import pandas as pd
# turn off auto wrapping of pandas dataframes
pd.set_option('display.expa... | bsd-3-clause | Python |
678532961cbc676fb3b82fa58185b281a8a4a7b3 | Fix a bug that leads to failures in pickling. | shellphish/rex,shellphish/rex | rex/preconstrained_file_stream.py | rex/preconstrained_file_stream.py |
from angr.state_plugins.plugin import SimStatePlugin
from angr.storage.file import SimFileStream
class SimPreconstrainedFileStream(SimFileStream):
def __init__(self, name, preconstraining_handler=None, **kwargs):
super().__init__(name, **kwargs)
self.preconstraining_handler = preconstraining_han... |
from angr.state_plugins.plugin import SimStatePlugin
from angr.storage.file import SimFileStream
class SimPreconstrainedFileStream(SimFileStream):
def __init__(self, name, preconstraining_handler=None, **kwargs):
super().__init__(name, **kwargs)
self.preconstraining_handler = preconstraining_han... | bsd-2-clause | Python |
038fcdd6e836050caf2145ff0453867c14dee90a | add unit test for retrieving a shared variable | chatelak/RMG-Py,nyee/RMG-Py,nyee/RMG-Py,pierrelb/RMG-Py,nickvandewiele/RMG-Py,chatelak/RMG-Py,pierrelb/RMG-Py,nickvandewiele/RMG-Py | rmgpy/scoop_framework/utilTest.py | rmgpy/scoop_framework/utilTest.py | #!/usr/bin/env python
# encoding: utf-8 -*-
"""
This module contains unit tests of the rmgpy.parallel module.
"""
import os
import sys
import unittest
from rmgpy.scoop_framework.framework import TestScoopCommon
try:
from scoop import futures, _control, shared
except ImportError, e:
import logging as logging... | #!/usr/bin/env python
# encoding: utf-8 -*-
"""
This module contains unit tests of the rmgpy.parallel module.
"""
import os
import sys
import unittest
from rmgpy.scoop_framework.framework import TestScoopCommon
try:
from scoop import futures, _control, shared
except ImportError, e:
import logging as logging... | mit | Python |
73f8db94051002bc477e25629c56ed5dd2936a8e | change filtered stimulus sampling_rate value | tyarkoni/featureX,tyarkoni/pliers | pliers/filters/audio.py | pliers/filters/audio.py | ''' Filters that operate on TextStim inputs. '''
from pliers.stimuli import AudioStim
from pliers.utils import attempt_to_import, verify_dependencies
from .base import Filter, TemporalTrimmingFilter
librosa = attempt_to_import('librosa')
class AudioFilter(Filter):
''' Base class for all audio filters. '''
... | ''' Filters that operate on TextStim inputs. '''
from pliers.stimuli import AudioStim
from pliers.utils import attempt_to_import, verify_dependencies
from .base import Filter, TemporalTrimmingFilter
librosa = attempt_to_import('librosa')
class AudioFilter(Filter):
''' Base class for all audio filters. '''
... | bsd-3-clause | Python |
14f048a0dae5bdcdc7d61c3f72df8797aebadae8 | Change syntax to git.pull [dir] | Tehnix/PyIRCb | src/commands/git/git.py | src/commands/git/git.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Git commands!
"""
import subprocess
class Git(object):
def __init__(self, settingsInstance, commandInstance, cmdName, *args):
super(Git, self).__init__()
self.settingsInstance = settingsInstance
self.commandInstance = commandInstan... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Git commands!
"""
import subprocess
class Git(object):
def __init__(self, settingsInstance, commandInstance, cmdName, *args):
super(Git, self).__init__()
self.settingsInstance = settingsInstance
self.commandInstance = commandInstan... | bsd-3-clause | Python |
275136aeac316bd56eecc175df146826f3b52e00 | Add scanner for Cython dependencies (#19722) | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | site_scons/site_tools/cython.py | site_scons/site_tools/cython.py | import re
import SCons
from SCons.Action import Action
from SCons.Scanner import Scanner
pyx_from_import_re = re.compile(r'^from\s+(\S+)\s+cimport', re.M)
pyx_import_re = re.compile(r'^cimport\s+(\S+)', re.M)
cdef_import_re = re.compile(r'^cdef extern from\s+.(\S+).:', re.M)
def pyx_scan(node, env, path, arg=None):
... | import SCons
from SCons.Action import Action
cythonAction = Action("$CYTHONCOM")
def create_builder(env):
try:
cython = env['BUILDERS']['Cython']
except KeyError:
cython = SCons.Builder.Builder(
action = cythonAction,
emitter = {},
suffix = cython_suffix_emitte... | mit | Python |
841fdd7f788781d5a7ccc1750c950b2aad2895ad | Fix https://github.com/rec/echomesh/issues/472 | rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh | code/python/echomesh/base/MakeEmptyProject.py | code/python/echomesh/base/MakeEmptyProject.py | from __future__ import absolute_import, division, print_function, unicode_literals
import copy
import os.path
from echomesh.base import MakeDirs
from echomesh.base import Name
_CREATE_MISSING_DIRECTORY_PROJECT = """
There doesn't seem to be an echomesh project in your directory %s.
Would you like an empty project c... | from __future__ import absolute_import, division, print_function, unicode_literals
import copy
import os.path
from echomesh.base import MakeDirs
from echomesh.base import Name
_CREATE_MISSING_DIRECTORY_PROJECT = """
There doesn't seem to be an echomesh project in your directory %s.
Would you like an empty project c... | mit | Python |
cfef2bd20e9938499903d2e45e74c2a5b29393eb | Allow to call "which" without explicitly using --script or --dir | mnieber/dodo_commands | dodo_commands/extra/standard_commands/which.py | dodo_commands/extra/standard_commands/which.py | """Finds a directory or file inside the current project."""
from . import DodoCommand
from dodo_commands.framework.config import (CommandPath, get_project_dir)
import os
import sys
class Command(DodoCommand): # noqa
def add_arguments_imp(self, parser): # noqa
"""
Entry point for subclassed comma... | """Finds a directory or file inside the current project."""
from . import DodoCommand
from dodo_commands.framework.config import (CommandPath, get_project_dir)
import os
import sys
class Command(DodoCommand): # noqa
def add_arguments_imp(self, parser): # noqa
"""
Entry point for subclassed comma... | mit | Python |
6bc22b5e8b6d43858887112eca9cd69bdf50eefd | Handle cases where the IPAddress serializer field is missing. | thedrow/drf-benchmarks | drf_benchmarks/serializers/immutable/fields.py | drf_benchmarks/serializers/immutable/fields.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from rest_framework import serializers
class ImmutableFieldMixin(object):
def __init__(self, *args, **kwargs):
self.is_bound = False
super(ImmutableFieldMixin, self).__init__(*args, **kwargs)
def bind(self, field_name, parent):
if self.is_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from rest_framework import serializers
class ImmutableFieldMixin(object):
def __init__(self, *args, **kwargs):
self.is_bound = False
super(ImmutableFieldMixin, self).__init__(*args, **kwargs)
def bind(self, field_name, parent):
if self.is_... | bsd-3-clause | Python |
d94e0f85f7a1cfedbfcbf40da1fcc8deb07e1a01 | Bump version to 1.3 | rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug | rdmo/__init__.py | rdmo/__init__.py | __title__ = 'rdmo'
__version__ = '1.3.0'
__author__ = 'Jochen Klar'
__email__ = 'jklar@aip.de'
__license__ = 'Apache-2.0'
__copyright__ = 'Copyright 2015-2020 Leibniz Institute for Astrophysics Potsdam (AIP)'
VERSION = __version__
| __title__ = 'rdmo'
__version__ = '1.2.0'
__author__ = 'Jochen Klar'
__email__ = 'jklar@aip.de'
__license__ = 'Apache-2.0'
__copyright__ = 'Copyright 2015-2020 Leibniz Institute for Astrophysics Potsdam (AIP)'
VERSION = __version__
| apache-2.0 | Python |
9327b08201e88fc05c97f08515c6c2314600b05d | Add settings. | racker/pod-manager | pod_manager/settings.py | pod_manager/settings.py | from libcloud.compute.providers import Provider
# Redis
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379
REDIS_DB = 0
# Provider settings
PROVIDER = Provider.RACKSPACE
PROVIDER_CREDENTIALS = ('username', 'password')
# Logging
LOG_FORMAT = '%(asctime)s %(levelname)s (%(ip)s - %(session_id)s) - %(message)s'
try:
from l... | # Redis
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379
REDIS_DB = 0
# Logging
LOG_FORMAT = '%(asctime)s %(levelname)s (%(ip)s - %(session_id)s) - %(message)s'
try:
from local_settings import *
except:
print 'ERROR: Failed to import local settings!'
import traceback
import sys
traceback.print_stack()
... | apache-2.0 | Python |
0ff5a91558d88e4541b1958561d1ed6b4c71c816 | Update utility script for Python 3 compatibility | evansd/whitenoise,evansd/whitenoise,evansd/whitenoise | scripts/generate_default_media_types.py | scripts/generate_default_media_types.py | #!/usr/bin/env python
from __future__ import print_function
import pprint
EXTRA_MIMETYPES = {
'apple-app-site-association': 'application/pkc7-mime',
'.woff': 'application/font-woff',
'.woff2': 'font/woff2'
}
FUNCTION_TEMPLATE = """
def default_types():
{triple_quote}
We use our own set of defau... | #!/usr/bin/env python
import pprint
EXTRA_MIMETYPES = {
'apple-app-site-association': 'application/pkc7-mime',
'.woff': 'application/font-woff',
'.woff2': 'font/woff2'
}
FUNCTION_TEMPLATE = """
def default_types():
{triple_quote}
We use our own set of default media types rather than the system-s... | mit | Python |
961fc18b7f7ddcc5c973139e8125dc67ba13059b | Speed up problem 34 | cryvate/project-euler,cryvate/project-euler | project_euler/solutions/problem_34.py | project_euler/solutions/problem_34.py | from math import factorial
from ..library.base import number_to_list
def solve(base: int=10) -> int:
factorials = [factorial(digit) for digit in range(base)]
bound = 0
maximum = 0
necessary = 0
while maximum >= necessary:
maximum += factorials[-1]
necessary = (base - 1) * necess... | from math import factorial
def solve() -> int:
factorials = [factorial(digit) for digit in range(10)]
bound = 0
maximum = 0
necessary = 0
while maximum >= necessary:
maximum += factorials[-1]
necessary = 9 * necessary + 9
bound += 1
counter = 0
for i in range(3... | mit | Python |
91f503cd99dfa6fc6562afc1b627b6f8b0f1d91b | Fix ImportError: No module named 'stdnum.ar.cbu' | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/l10n_ar/models/res_partner_bank.py | addons/l10n_ar/models/res_partner_bank.py | # Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, api, _
from odoo.exceptions import ValidationError
import stdnum.ar
import logging
_logger = logging.getLogger(__name__)
def validate_cbu(cbu):
try:
return stdnum.ar.cbu.validate(cbu)
except Exception a... | # Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, api, _
import stdnum.ar.cbu
def validate_cbu(cbu):
return stdnum.ar.cbu.validate(cbu)
class ResPartnerBank(models.Model):
_inherit = 'res.partner.bank'
@api.model
def _get_supported_account_types(se... | agpl-3.0 | Python |
aec56a36a1d11db55c443df781113612acb5a875 | update docstring for install hook | battlemidget/juju-layer-node | reactive/node.py | reactive/node.py | import os
import sys
from subprocess import Popen, PIPE
from charms.reactive import (
hook,
set_state,
remove_state,
main
)
from charmhelpers.core import hookenv
from charmhelpers.fetch import (
apt_install,
apt_purge
)
config = hookenv.config()
node_version_map = {
'0.10': {
'rem... | import os
import sys
from subprocess import Popen, PIPE
from charms.reactive import (
hook,
set_state,
remove_state,
main
)
from charmhelpers.core import hookenv
from charmhelpers.fetch import (
apt_install,
apt_purge
)
config = hookenv.config()
node_version_map = {
'0.10': {
'rem... | mit | Python |
e397050536b154e6b2511c99826945c5a75490aa | Format the example? | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/rest_sample_utils.py | salt/modules/rest_sample_utils.py | # -*- coding: utf-8 -*-
'''
Utility functions for the rest_sample
'''
from __future__ import absolute_import
__proxyenabled__ = ['rest_sample']
def fix_outage():
'''
"Fix" the outage
Example::
>>> salt 'rest-sample-proxy' rest_sample.fix_outage
'''
return __proxy__['rest_sample.fix_outage'... | # -*- coding: utf-8 -*-
'''
Utility functions for the rest_sample
'''
from __future__ import absolute_import
__proxyenabled__ = ['rest_sample']
def fix_outage():
'''
"Fix" the outage
>>> salt 'rest-sample-proxy' rest_sample.fix_outage
'''
return __proxy__['rest_sample.fix_outage']()
| apache-2.0 | Python |
5cd0507e99d8f78597d225266ec09f6588308396 | Revert "Fixed faoiling jenkins tests. Mocked the required functions" | alphagov/notifications-api,alphagov/notifications-api | tests/app/public_contracts/test_POST_notification.py | tests/app/public_contracts/test_POST_notification.py | from flask import json
from . import return_json_from_response, validate_v0
from tests import create_authorization_header
def _post_notification(client, template, url, to):
data = {
'to': to,
'template': str(template.id)
}
auth_header = create_authorization_header(service_id=template.ser... | from flask import json
from . import return_json_from_response, validate_v0
from tests import create_authorization_header
def _post_notification(client, template, url, to):
data = {
'to': to,
'template': str(template.id)
}
auth_header = create_authorization_header(service_id=template.ser... | mit | Python |
6c44396baa315bf704b792f0a48c04955e535c58 | Add env.include(scripts=[...]) support. | lewissbaker/cake,lewissbaker/cake,lewissbaker/cake,lewissbaker/cake | src/cake/library/script.py | src/cake/library/script.py | """Script Tool.
"""
from cake.engine import Script
from cake.library import Tool
class ScriptTool(Tool):
"""Builder that provides utilities for performing Script operations.
"""
def include(self, path=None, scripts=None):
"""Include another script within the context of the currently
executing script.... | """Script Tool.
"""
from cake.engine import Script
from cake.library import Tool
class ScriptTool(Tool):
"""Builder that provides utilities for performing Script operations.
"""
def include(self, path):
"""Include another script within the context of the currently
executing script.
A given s... | mit | Python |
aeb33b1575e44dd36dff109a65b4a29049117caf | check selection is not empty | desihub/desispec,desihub/desispec | py/desispec/qproc/flavor.py | py/desispec/qproc/flavor.py | import numpy as np
from desiutil.log import get_logger
# tool to check the flavor of a qframe
def check_qframe_flavor(qframe,input_flavor=None):
"""
Tool to check the flavor of a qframe
Args:
qframe : DESI QFrame object
Optional:
input_flavor
Return:
flavor str... | import numpy as np
from desiutil.log import get_logger
# tool to check the flavor of a qframe
def check_qframe_flavor(qframe,input_flavor=None):
"""
Tool to check the flavor of a qframe
Args:
qframe : DESI QFrame object
Optional:
input_flavor
Return:
flavor str... | bsd-3-clause | Python |
fc8f82b118be98276f1d422719e2ca82ff859545 | change domain recouncile=1 | christophlsa/odoo,ShineFan/odoo,CopeX/odoo,eino-makitalo/odoo,Endika/OpenUpgrade,steedos/odoo,shingonoide/odoo,ccomb/OpenUpgrade,Gitlab11/odoo,MarcosCommunity/odoo,NeovaHealth/odoo,SAM-IT-SA/odoo,cysnake4713/odoo,optima-ict/odoo,fossoult/odoo,fjbatresv/odoo,fossoult/odoo,addition-it-solutions/project-all,codekaki/odoo,... | addons/account/wizard/wizard_reconcile_select.py | addons/account/wizard/wizard_reconcile_select.py | ##############################################################################
#
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole respons... | ##############################################################################
#
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole respons... | agpl-3.0 | Python |
99a5d3537a10c419f4044a67a2c1f073d4132c29 | Fix wolfram attributeerror bug | sevazhidkov/leonard | modules/wolframalpha.py | modules/wolframalpha.py | import os
from urllib.parse import quote_plus
import jinja2
import wolframalpha
from telegram import InlineKeyboardButton
from telegram import InlineKeyboardMarkup
from leonard import Leonard
UNKNOWN_COMMAND = 'Wolfram Alpha doesn\'t know anything about that 😢'
def register(bot):
bot.wolfram_client = wolframa... | import os
from urllib.parse import quote_plus
import jinja2
import wolframalpha
from telegram import InlineKeyboardButton
from telegram import InlineKeyboardMarkup
from leonard import Leonard
UNKNOWN_COMMAND = 'Wolfram Alpha doesn\'t know anything about that 😢'
def register(bot):
bot.wolfram_client = wolframa... | mit | Python |
ce4060a7d0dbae36da55622ff040f9f9080fad80 | update dev version after 0.24.0 tag [skip ci] | desihub/desispec,desihub/desispec | py/desispec/_version.py | py/desispec/_version.py | __version__ = '0.24.0.dev3001'
| __version__ = '0.24.0'
| bsd-3-clause | Python |
576b0fc791b8e61aaee68e9cc722b83e4869a76a | update copyright to 2018 | MSLNZ/msl-loadlib,MSLNZ/msl-loadlib,MSLNZ/msl-loadlib,MSLNZ/msl-loadlib,MSLNZ/msl-loadlib | msl/loadlib/__init__.py | msl/loadlib/__init__.py | """
Load a shared library.
The following constants are provided in the **msl.loadlib** package.
"""
import sys
from collections import namedtuple
__author__ = 'Joseph Borbely'
__copyright__ = '\xa9 2017 - 2018, ' + __author__
__version__ = '0.3.3.dev0'
version_info = namedtuple('version_info', 'major minor micro')(*... | """
Load a shared library.
The following constants are provided in the **msl.loadlib** package.
"""
import sys
from collections import namedtuple
__author__ = 'Joseph Borbely'
__copyright__ = '\xa9 2017, ' + __author__
__version__ = '0.3.3.dev0'
version_info = namedtuple('version_info', 'major minor micro')(*map(int... | mit | Python |
5e0d7cd0270fc0e3dc4be9a828034f24ce18a05f | Use six.string_types to get a py2/py3 equivalent of `isinstance(arg, (str, unicode))`. | deepmind/pysc2 | pysc2/lib/point_flag.py | pysc2/lib/point_flag.py | # Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 | Python |
76c58988585b4b09e2fd8d8b6a0b57f49a94205a | add exception handling for ddns update | twhtanghk/docker.esp8266,twhtanghk/docker.esp8266,twhtanghk/docker.esp8266,twhtanghk/docker.esp8266 | python/ddns/__init__.py | python/ddns/__init__.py | from config import Config
from util import ok
import ujson
import logging
logger = logging.getLogger(__name__)
class Model(Config):
def __init__(self):
Config.__init__(self, '/ddns.json')
self.pins = {}
def factory(self):
self.save({
'url': 'https://dynupdate.no-ip.com/nic/update',
'enable... | from config import Config
from util import ok
import ujson
import logging
logger = logging.getLogger(__name__)
class Model(Config):
def __init__(self):
Config.__init__(self, '/ddns.json')
self.pins = {}
def factory(self):
self.save({
'url': 'https://dynupdate.no-ip.com/nic/update',
'enable... | mit | Python |
3fc9966bf4d6fbd27dbcb2352e990d088795b5ff | Rewrite docustring in sphinx format | attwad/python-osc | pythonosc/udp_client.py | pythonosc/udp_client.py | """UDP Clients for sending OSC messages to an OSC server"""
from collections import Iterable
import socket
from .osc_message_builder import OscMessageBuilder
from pythonosc.osc_message import OscMessage
from pythonosc.osc_bundle import OscBundle
from typing import Union
class UDPClient(object):
"""OSC client t... | """Client to send OSC datagrams to an OSC server via UDP."""
from collections import Iterable
import socket
from .osc_message_builder import OscMessageBuilder
from pythonosc import osc_message
from typing import Union
class UDPClient(object):
"""OSC client to send OscMessages or OscBundles via UDP."""
def... | unlicense | Python |
24318c8ca4c96bb0646a0b6789db105fd3e04fab | add a hash function for a permuted string | nguyentu1602/pyexp | pyexp/string_permu_check.py | pyexp/string_permu_check.py | '''Module to solve the algoritm question:
Given a string S, how to count how many permutations
of S is in a longer string L, assuming, of course, that
permutations of S must be in contagious blocks in L.
I will solve it in O(len(L)) time.
For demonstration purpose, let's assume the characters
are ASCII lowercase lette... | '''Module to solve the algoritm question:
Given a string S, how to count how many permutations
of S is in a longer string L, assuming, of course, that
permutations of S must be in contagious blocks in L.
I will solve it in O(len(L)) time.
'''
| mit | Python |
4467ffe669eec09bab16f4e5a3256ed333c5d3d5 | Set bytes_mode=False for future compatability with Python3 | ResearchComputing/RCAMP,ResearchComputing/RCAMP,ResearchComputing/RCAMP,ResearchComputing/RCAMP | rcamp/lib/ldap_utils.py | rcamp/lib/ldap_utils.py | from django.conf import settings
from ldapdb import escape_ldap_filter
import ldap
def authenticate(dn,pwd,ldap_conf_key):
# Setup connection
ldap_conf = settings.LDAPCONFS[ldap_conf_key]
server = ldap_conf['server']
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)
conn = ldap.in... | from django.conf import settings
from ldapdb import escape_ldap_filter
import ldap
def authenticate(dn,pwd,ldap_conf_key):
# Setup connection
ldap_conf = settings.LDAPCONFS[ldap_conf_key]
server = ldap_conf['server']
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)
conn = ldap.in... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.