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 |
|---|---|---|---|---|---|---|---|---|
842e31e11725984538f396ee3be59e3a7970f03a | Add comment regarding the ‘led’ property | gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x,thelonious/g2x,gizmo-cda/g2x,gizmo-cda/g2x | scratchpad/ncurses.py | scratchpad/ncurses.py | #!/usr/bin/env python3
import curses
import platform
if platform.system() == "Darwin":
from mockcamera import PiCamera
else:
from picamera import PiCamera
# create access to camera
camera = PiCamera()
# create list of properties to display
properties = [
"analog_gain",
"annotate_text",
"annotate_text_size",
"... | #!/usr/bin/env python3
import curses
import platform
if platform.system() == "Darwin":
from mockcamera import PiCamera
else:
from picamera import PiCamera
# create access to camera
camera = PiCamera()
# create list of properties to display
properties = [
"analog_gain",
"annotate_text",
"annotate_text_size",
"... | mit | Python |
2b1e4f64eb493d8b373bc0bd0681ac05564b71a8 | add name arg | timothydmorton/isochrones,timothydmorton/isochrones | scripts/clusterfit.py | scripts/clusterfit.py | #!/usr/bin/env python
import argparse
import re
import pandas as pd
from isochrones.cluster import StarClusterModel, StarCatalog
from isochrones import get_ichrone
from isochrones.priors import FehPrior
try:
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
except ImportError:
rank... | #!/usr/bin/env python
import argparse
import re
import pandas as pd
from isochrones.cluster import StarClusterModel, StarCatalog
from isochrones import get_ichrone
from isochrones.priors import FehPrior
try:
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
except ImportError:
rank... | mit | Python |
be5ac190312b0a1ba4c6dd1c0689784cabc65dfe | use only subdirectories in dirname | nlesc-sherlock/analyzing-corpora,nlesc-sherlock/analyzing-corpora,nlesc-sherlock/analyzing-corpora | scripts/clustering.py | scripts/clustering.py | #!/usr/bin/env python
__author__ = 'daniela'
from scipy.spatial.distance import cosine
from corpora.scikit import ScikitLda
import zipfile
import os
import tarfile
import gzip
import zlib
if __name__ == '__main__':
dirname = "./data/data/enron_out_0.1/"
for subdir in [x[0] for x in os.walk(dirname)][1:]:
... | #!/usr/bin/env python
__author__ = 'daniela'
from scipy.spatial.distance import cosine
from corpora.scikit import ScikitLda
import zipfile
import os
import tarfile
import gzip
import zlib
if __name__ == '__main__':
dirname = "./data/data/enron_out_0.1/"
for subdir in os.listdir(dirname):
# print("subd... | apache-2.0 | Python |
6de588ea65d603cf551408c32bd547299d4a0bd5 | migrate another commit() call | Turbo87/skylines,Harry-R/skylines,skylines-project/skylines,Harry-R/skylines,kerel-fs/skylines,TobiasLohner/SkyLines,shadowoneau/skylines,skylines-project/skylines,skylines-project/skylines,shadowoneau/skylines,TobiasLohner/SkyLines,RBE-Avionik/skylines,skylines-project/skylines,Turbo87/skylines,TobiasLohner/SkyLines,T... | scripts/merge_user.py | scripts/merge_user.py | #!/usr/bin/env python
#
# Merge two User records.
#
import sys
import os
import argparse
from config import to_envvar
sys.path.append(os.path.dirname(sys.argv[0]))
parser = argparse.ArgumentParser(description='Merge two SkyLines user accounts.')
parser.add_argument('--config', metavar='config.ini',
... | #!/usr/bin/env python
#
# Merge two User records.
#
import sys
import os
import argparse
from config import to_envvar
sys.path.append(os.path.dirname(sys.argv[0]))
parser = argparse.ArgumentParser(description='Merge two SkyLines user accounts.')
parser.add_argument('--config', metavar='config.ini',
... | agpl-3.0 | Python |
edddb16cdf323aae3105736f15f1c5571a204a90 | add in superscript, subscript | shulinye/dotfiles,shulinye/dotfiles | scripts/zim/tohtml.py | scripts/zim/tohtml.py | import datetime
import markdown
import re
import sys
headers = re.compile(r'(=+)(.*?)\1')
checkboxes = re.compile(r'\[[ *x]\]')
newlines = re.compile(r'\n')
strike = re.compile(r'~~(.*?)~~')
superscript = re.compile(r'\^\{(.*?)\}')
subscript = re.compile(r'_\{(.*?)\}')
verbatim = re.compile(r"''(.*?)''")
states = {' ... | import datetime
import markdown
import re
import sys
headers = re.compile(r'(=+)(.*?)\1')
checkboxes = re.compile(r'\[[ *x]\]')
newlines = re.compile(r'\n')
strike = re.compile(r'~~(.*?)~~')
states = {' ': r'☐',
'*': r'☑',
'x': r'☒'}
def prettify_checkbox(match):
return ... | mit | Python |
b993cb47b8c087f374409d86e89175f0caf29e59 | Add full schema validation | cdunklau/alexandria,bertjwregeer/alexandria,bertjwregeer/alexandria,cdunklau/alexandria,cdunklau/alexandria | alexandria/schemas/domain.py | alexandria/schemas/domain.py | from pyramid.i18n import TranslationStringFactory
_ = TranslationStringFactory('alexandria')
import colander
from .. import models as m
@colander.deferred
def _new_domain(node, kw):
request = kw.get('request')
if request is None:
raise KeyError('Require bind: request')
def new_domain(form, valu... | from pyramid.i18n import TranslationStringFactory
_ = TranslationStringFactory('alexandria')
import colander
from ..models import Domain
class DomainSchema(colander.Schema):
"""The schema for a domain"""
@classmethod
def create_schema(cls, request):
return cls().bind(request=request)
id = c... | isc | Python |
d641e6cce6bc8549d7d8421c263b38d6b4ba82d4 | Revert part of #5319: don't use `traceback_util.path_starts` in `source_info_util.user_frame`. | google/jax,google/jax,google/jax,google/jax | jax/_src/source_info_util.py | jax/_src/source_info_util.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
7b497d2a6f9318acdcf8f257f7296892befb7141 | Add required_properties to LicenseSerializer. [skip ci] | alexschiller/osf.io,binoculars/osf.io,saradbowman/osf.io,felliott/osf.io,chrisseto/osf.io,rdhyee/osf.io,HalcyonChimera/osf.io,adlius/osf.io,leb2dg/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,HalcyonChimera/osf.io,mluo613/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,chrisseto/osf.io,alexschiller/osf.io,crcresearch/o... | api/licenses/serializers.py | api/licenses/serializers.py | from rest_framework import serializers as ser
from api.base.serializers import (
JSONAPISerializer, LinksField, IDField, TypeField
)
from api.base.utils import absolute_reverse
class LicenseSerializer(JSONAPISerializer):
filterable_fields = frozenset([
'name',
'id',
])
non_anonymized_... | from rest_framework import serializers as ser
from api.base.serializers import (
JSONAPISerializer, LinksField, IDField, TypeField
)
from api.base.utils import absolute_reverse
class LicenseSerializer(JSONAPISerializer):
filterable_fields = frozenset([
'name',
'id',
])
non_anonymized_... | apache-2.0 | Python |
988126c234a1610d6e856be65b00fb48991eacb9 | Update read_book_views.py | OlegKlimenko/Plamber,OlegKlimenko/Plamber,OlegKlimenko/Plamber,OlegKlimenko/Plamber | api/views/read_book_views.py | api/views/read_book_views.py | # -*- coding: utf-8 -*-
import logging
from django.shortcuts import get_object_or_404
from rest_framework.decorators import api_view
from rest_framework.response import Response
from app.models import Book, AddedBook, TheUser
logger = logging.getLogger('changes')
# -----------------------------------------------... | # -*- coding: utf-8 -*-
import logging
from django.shortcuts import get_object_or_404
from rest_framework.decorators import api_view
from rest_framework.response import Response
from app.models import Book, AddedBook, TheUser
logger = logging.getLogger('changes')
# -----------------------------------------------... | apache-2.0 | Python |
2b19b6bbfaaab0620e28efb5ab71aaf30da2d6dd | add y/n to msg | dataversioncontrol/dvc,efiop/dvc,efiop/dvc,dataversioncontrol/dvc,dmpetrov/dataversioncontrol,dmpetrov/dataversioncontrol | dvc/prompt.py | dvc/prompt.py | import sys
try:
# NOTE: in Python3 raw_input() was renamed to input()
input = raw_input
except NameError:
pass
def prompt(msg, default=False):
if not sys.stdout.isatty():
return default
answer = input(msg + u' (y/n)\n').lower()
while answer not in ['yes', 'no', 'y', 'n']:
ans... | import sys
try:
# NOTE: in Python3 raw_input() was renamed to input()
input = raw_input
except NameError:
pass
def prompt(msg, default=False):
if not sys.stdout.isatty():
return default
answer = input(msg + u'\n').lower()
while answer not in ['yes', 'no', 'y', 'n']:
answer = ... | apache-2.0 | Python |
e205d576579b575e3cfc2646f94ca96819aadf3f | Update utils.short_name for VotingClassifier | jrmontag/mnist-sklearn,jrmontag/mnist-sklearn,jrmontag/classifier-comp-year2,jrmontag/classifier-comp-year2 | utils.py | utils.py | # -*- coding: UTF-8 -*-
__author__="Josh Montague"
__license__="MIT License"
#
# This module defines a number of helper functions.
#
from datetime import datetime
import logging
import numpy as np
import os
import sys
def short_name(model):
"""Return a simplified name for this model. A bit brittle."""
# *T... | # -*- coding: UTF-8 -*-
__author__="Josh Montague"
__license__="MIT License"
#
# This module defines a number of helper functions.
#
from datetime import datetime
import logging
import numpy as np
import os
import sys
def short_name(model):
"""Return a simplified name for this model. A bit brittle."""
if h... | mit | Python |
73fb76bae813c05787c56d85d040b9e90c4f5676 | use sendtextplus | randy3k/R-Box,randy3k/R-Box,hafen/R-Box,hafen/R-Box | sendtext_installer.py | sendtext_installer.py | import sublime
import sys
def plugin_loaded():
rsettings = sublime.load_settings('R-Box.sublime-settings')
ssettings = sublime.load_settings('SendText+.sublime-settings')
psettings = sublime.load_settings('Preferences.sublime-settings')
if not rsettings.get("show_sendtext_installer_message", True):
... | import sublime
import sys
def plugin_loaded():
rsettings = sublime.load_settings('R-Box.sublime-settings')
ssettings = sublime.load_settings('SendText+.sublime-settings')
psettings = sublime.load_settings('Preferences.sublime-settings')
if not rsettings.get("show_sendtext_installer_message", True):
... | mit | Python |
e055874545dcc0e1205bad2b419076c204ffcf9c | Add a 0.0 duty cycle: brief moment of off time. | zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie | duty_cycle.py | duty_cycle.py | #!/usr/bin/env python
from blinkenlights import dimmer, setup, cleanup
pin = 18
bpm = 70
setup(pin)
up = range(10)
down = range(9)
down.reverse()
spectrum = up + down + [-1]
period = 60.0 / bpm # seconds
time_per_level = period / len(spectrum)
for i in range(10):
for j in (spectrum):
brightness = (j+1... | #!/usr/bin/env python
from blinkenlights import dimmer, setup, cleanup
pin = 18
setup(pin)
up = range(10)
down = range(9)
down.reverse()
bpm = 70
period = 60.0 / bpm # seconds
time_per_level = period / len(up + down)
for i in range(10):
for j in (up + down):
brightness = (j+1) / 10.0
dimmer(... | mit | Python |
0f69d9e42e59d86fdecbca63b60f18160a28bac1 | fix bugs | jermowery/xos,xmaruto/mcord,cboling/xos,jermowery/xos,xmaruto/mcord,jermowery/xos,xmaruto/mcord,cboling/xos,cboling/xos,cboling/xos,cboling/xos,xmaruto/mcord,jermowery/xos | planetstack/model_policies/model_policy_Slice.py | planetstack/model_policies/model_policy_Slice.py |
def handle(slice):
from core.models import Controller,ControllerSlices,Controller,Network,NetworkSlice,NetworkTemplate
from collections import defaultdict
ctrl_site_deployments = SiteDeployments.objects.all()
slice_controllers = ControllerSlices.objects.all()
slice_deploy_lookup = defaultdict(list)
for slice_c... |
def handle(slice):
from core.models import Controller, ControllerSiteDeployments, ControllerSlices,Controller,Network,NetworkSlice,NetworkTemplate
from collections import defaultdict
ctrl_site_deployments = ControllerSiteDeployments.objects.all()
site_deploy_lookup = defaultdict(list)
for ctrl_site_deployment in ... | apache-2.0 | Python |
28e1d0236ce23b7b99eb61a25283664e7eef5d2a | Update settings.py | STPackageBundler/package-bundler | package_bundler/settings.py | package_bundler/settings.py | def pb_settings_filename():
return 'Package Bundler.sublime-settings'
def st_settings_filename():
if int(sublime.version()) >= 2174:
return 'Preferences.sublime-settings'
return 'Global.sublime-settings
| def pb_settings_filename():
return 'Package Bundler.sublime-settings'
def st_settings_filename():
return 'Preferences.sublime-settings' | mit | Python |
320f84a63815f3e247d7cbada0cf5f4af9968d7b | add system tests and clean repo | fogelomer/cloudify-telegraf-plugin,fogelomer/cloudify-telegraf-plugin | system_tests/telegraf_openstack_ubuntu_centos_test.py | system_tests/telegraf_openstack_ubuntu_centos_test.py | ########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | ########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | apache-2.0 | Python |
e8ce9948ded6949fce2752ebb719d1d5b8bcf1a8 | test run_recipe | sunlightlabs/saucebrush | saucebrush/tests/recipes.py | saucebrush/tests/recipes.py | import doctest
import unittest
from saucebrush import Recipe, run_recipe
from saucebrush.filters import Filter
class Raiser(Filter):
def process_record(self, record):
raise Exception("bad record")
class Saver(Filter):
def __init__(self):
self.saved = []
def process_record(self, record):... | import doctest
import unittest
from saucebrush import Recipe
from saucebrush.filters import Filter
class Raiser(Filter):
def process_record(self, record):
raise Exception("bad record")
class Saver(Filter):
def __init__(self):
self.saved = []
def process_record(self, record):
sel... | bsd-3-clause | Python |
29da22825820d0409b7f5c5af800099f9ec3f956 | include integrate.nquad in reference guide. | andim/scipy,vanpact/scipy,pschella/scipy,ndchorley/scipy,dominicelse/scipy,bkendzior/scipy,WillieMaddox/scipy,sauliusl/scipy,minhlongdo/scipy,andyfaff/scipy,jjhelmus/scipy,ilayn/scipy,Kamp9/scipy,gfyoung/scipy,piyush0609/scipy,petebachant/scipy,mgaitan/scipy,mortonjt/scipy,tylerjereddy/scipy,jseabold/scipy,juliantaylor... | scipy/integrate/__init__.py | scipy/integrate/__init__.py | """
=============================================
Integration and ODEs (:mod:`scipy.integrate`)
=============================================
.. currentmodule:: scipy.integrate
Integrating functions, given function object
============================================
.. autosummary::
:toctree: generated/
quad ... | """
=============================================
Integration and ODEs (:mod:`scipy.integrate`)
=============================================
.. currentmodule:: scipy.integrate
Integrating functions, given function object
============================================
.. autosummary::
:toctree: generated/
quad ... | bsd-3-clause | Python |
a8a51cc610fe4f818a64a0b1633864fa7c5c344e | Update ltree again | DisruptiveLabs/sqlalchemy_postgresql_json | sqlalchemy_postgresql_json/ltree.py | sqlalchemy_postgresql_json/ltree.py | from sqlalchemy.dialects.postgresql.base import ischema_names, PGTypeCompiler, ARRAY
from sqlalchemy import types as sqltypes
from sqlalchemy.sql import expression
class LTREE(sqltypes.Concatenable, sqltypes.TypeEngine):
"""Postgresql LTREE type.
The LTREE datatype can be used for representing labels of data ... | from sqlalchemy.dialects.postgresql.base import ischema_names, PGTypeCompiler, ARRAY
from sqlalchemy import types as sqltypes
from sqlalchemy.sql import expression
class LTREE(sqltypes.Concatenable, sqltypes.TypeEngine):
"""Postgresql LTREE type.
The LTREE datatype can be used for representing labels of data ... | mit | Python |
0e740b5fd924b113173b546f2dd2b8fa1e55d074 | Print XML parse errors in Sparser API | sorgerlab/belpy,bgyori/indra,johnbachman/belpy,bgyori/indra,johnbachman/indra,johnbachman/belpy,johnbachman/belpy,pvtodorov/indra,sorgerlab/indra,bgyori/indra,sorgerlab/indra,johnbachman/indra,pvtodorov/indra,sorgerlab/belpy,pvtodorov/indra,pvtodorov/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra | indra/sparser/sparser_api.py | indra/sparser/sparser_api.py | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import logging
import xml.etree.ElementTree as ET
from indra.util import UnicodeXMLTreeBuilder as UTB
from indra.sparser.processor import SparserProcessor
logger = logging.getLogger('sparser')
def process_xml(xml_s... | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import logging
import xml.etree.ElementTree as ET
from indra.util import UnicodeXMLTreeBuilder as UTB
from indra.sparser.processor import SparserProcessor
logger = logging.getLogger('sparser')
def process_xml(xml_s... | bsd-2-clause | Python |
0a850f935ce6cc48a68cffbef64c127daa22a42f | Print table if no file format provided | kshvmdn/github-list,kshvmdn/github-list,kshvmdn/github-list | write.py | write.py | import csv
import json
import os
from tabulate import tabulate
def write_data(d, u, f=None):
if f is not None:
directory = './data/'
if not os.path.exists(directory):
os.makedirs(directory)
file = open(directory + u + '.' + f, 'w')
if f == 'json':
file.w... | import colour
import csv
import json
import os
import pprint
# write to file as json, csv, markdown, plaintext or print table
def write_data(data, user, format=None):
if format is not None:
directory = './data/'
if not os.path.exists(directory):
os.makedirs(directory)
f = ... | mit | Python |
781f0dc84ee8ad8935b6df4a20b3e84a298b51d1 | Change order of string comparisons to perform the most likely first | PrFalken/exaproxy,jbfavre/exaproxy,PrFalken/exaproxy,jbfavre/exaproxy,david-farrar/exaproxy,PrFalken/exaproxy,david-farrar/exaproxy,david-farrar/exaproxy | lib/exaproxy/http/request.py | lib/exaproxy/http/request.py | # encoding: utf-8
"""
request.py
Created by Thomas Mangin on 2012-02-27.
Copyright (c) 2012 Exa Networks. All rights reserved.
"""
class Request (object):
def __init__ (self,request):
self.raw = request
method, self.uri, version = request.split()
self.method = method.upper()
version = version.split('/')[-1]... | # encoding: utf-8
"""
request.py
Created by Thomas Mangin on 2012-02-27.
Copyright (c) 2012 Exa Networks. All rights reserved.
"""
class Request (object):
def __init__ (self,request):
self.raw = request
method, self.uri, version = request.split()
self.method = method.upper()
version = version.split('/')[-1]... | bsd-2-clause | Python |
20caa367954b50d7eaef9af353b9df9af87e0198 | remove debug print call | tyarkoni/transitions,pytransitions/transitions,pytransitions/transitions | transitions/extensions/asyncio.py | transitions/extensions/asyncio.py | from ..core import Condition, Machine, Transition
import logging
import asyncio
_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())
class AsyncCondition(Condition):
async def check(self, event_data):
predicate = event_data.machine.resolve_callable(self.func, event_data)
... | from ..core import Condition, Machine, Transition
import logging
import asyncio
_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())
class AsyncCondition(Condition):
async def check(self, event_data):
predicate = event_data.machine.resolve_callable(self.func, event_data)
... | mit | Python |
48c45bb492c3764ba5906a701892008da01c3df7 | improve header parsing information when it goes wrong | PrFalken/exaproxy,david-farrar/exaproxy,jbfavre/exaproxy,david-farrar/exaproxy,jbfavre/exaproxy,PrFalken/exaproxy,PrFalken/exaproxy,david-farrar/exaproxy | lib/exaproxy/http/headers.py | lib/exaproxy/http/headers.py | #!/usr/bin/env python
# encoding: utf-8
"""
http.py
Created by Thomas Mangin on 2011-12-02.
Copyright (c) 2011 Exa Networks. All rights reserved.
"""
#import re
#reg=re.compile('(\w+)[:=] ?"?(\w+)"?')
#reg=re.compile('(\w+)[:=] ?"?([^" ,]+)"?')
#dict(reg.findall(headers))
class Headers (object):
def __init__ (self... | #!/usr/bin/env python
# encoding: utf-8
"""
http.py
Created by Thomas Mangin on 2011-12-02.
Copyright (c) 2011 Exa Networks. All rights reserved.
"""
#import re
#reg=re.compile('(\w+)[:=] ?"?(\w+)"?')
#reg=re.compile('(\w+)[:=] ?"?([^" ,]+)"?')
#dict(reg.findall(headers))
class Headers (object):
def __init__ (self... | bsd-2-clause | Python |
5ae3f6577d246537154beb2a4077b16e88dd653b | raise exception when can't connect to ngrok on local | yeastgenome/SGDFrontend,yeastgenome/SGDFrontend,yeastgenome/SGDFrontend,yeastgenome/SGDFrontend | lib/ghost/run_local_ghost.py | lib/ghost/run_local_ghost.py | # uses ENV variables to ping the ghost inspector API and run test suite for 'SGD Acceptance.'
import os
import requests
NGROK_URL = 'http://localhost:4040/api/tunnels'
ghost_suite_id = os.environ.get('GHOST_SUITE_ID')
ghost_key = os.environ.get('GHOST_API_KEY')
# get start URL from ngrok API
try:
ngrok_response = ... | # uses ENV variables to ping the ghost inspector API and run test suite for 'SGD Acceptance.'
import os
import requests
NGROK_URL = 'http://localhost:4040/api/tunnels'
ghost_suite_id = os.environ.get('GHOST_SUITE_ID')
ghost_key = os.environ.get('GHOST_API_KEY')
# get start URL from ngrok API
try:
ngrok_response = ... | mit | Python |
22de15ddc2a1e0fde84b8ec294530b74ed553528 | Bump version to 0.4.0 for new release. | tensorflow/model-optimization,tensorflow/model-optimization | tensorflow_model_optimization/python/core/version.py | tensorflow_model_optimization/python/core/version.py | # Copyright 2019 The TensorFlow Authors. 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 applica... | # Copyright 2019 The TensorFlow Authors. 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 applica... | apache-2.0 | Python |
97e091d3e3a7e1501074e3ad1bd5fcbbb92a2be0 | use the params, not hardcoded tag name/val | mooreds/amazonmachinelearning-anintroduction,mooreds/amazonmachinelearning-anintroduction | managing/predictfromtags.py | managing/predictfromtags.py | import boto3
client = boto3.client('machinelearning')
def lookup_by_tag(key,val):
res = client.describe_ml_models(FilterVariable='MLModelType', EQ='BINARY')
resource_type = 'MLModel'
model_id = None
endpoint_url = ''
for model in res['Results']:
tags_response = client.describe_tags(ResourceId=model['... | import boto3
client = boto3.client('machinelearning')
def lookup_by_tag(key,val):
res = client.describe_ml_models(FilterVariable='MLModelType', EQ='BINARY')
resource_type = 'MLModel'
model_id = None
endpoint_url = ''
for model in res['Results']:
tags_response = client.describe_tags(ResourceId=model['... | apache-2.0 | Python |
7ed263fe2bca2aaddf23b41ac9cf77f030dc0d19 | Fix paths I broke. | nprapps/elections14,nprapps/elections14,nprapps/elections14,nprapps/elections14 | static_app.py | static_app.py | #!/usr/bin/env python
import json
from mimetypes import guess_type
import subprocess
from flask import abort, Blueprint
import app_config
import copytext
from render_utils import flatten_app_config
static_app = Blueprint('static_app', __name__)
@static_app.route('/js/templates.js')
def _templates_js():
"""
... | #!/usr/bin/env python
import json
from mimetypes import guess_type
import subprocess
from flask import abort, Blueprint
import app_config
import copytext
from render_utils import flatten_app_config
static_app = Blueprint('static_app', __name__)
@static_app.route('/js/templates.js')
def _templates_js():
"""
... | mit | Python |
b1e76587c55fbde0394fe0bcb2ae1e5db2425c37 | refactor FSMens.py to work system independent | RichardEssery/FSM,RichardEssery/FSM | FSMens.py | FSMens.py | """
Run an ensemble of FSM simulations
Richard Essery
School of GeoSciences
University of Edinburgh
"""
import os
import sys
def perform_fsm_routine(input_filename: str, fsm_binary: str, total_runs: int = 32):
print(f"Performing routing with input namelist {input_filename}")
nlst_filename = ... | """
Run an ensemble of FSM simulations
Richard Essery
School of GeoSciences
University of Edinburgh
"""
import numpy as np
import os
import sys
namelist = sys.argv[1]
os.system('./compil.sh')
try:
os.mkdir('output')
except:
pass
for n in range(32):
config = np.binary_repr(n, width=... | mit | Python |
57636244e4b00699fc1d9bd3d920e4352a8f634d | Fix docx/unicode encoding error | rdhyee/modular-file-renderer,haoyuchen1992/modular-file-renderer,rdhyee/modular-file-renderer,chrisseto/modular-file-renderer,icereval/modular-file-renderer,Johnetordoff/modular-file-renderer,haoyuchen1992/modular-file-renderer,CenterForOpenScience/modular-file-renderer,TomBaxter/modular-file-renderer,haoyuchen1992/mod... | mfr_docx/render.py | mfr_docx/render.py | # -*- coding: utf-8 -*-
"""Docx renderer module."""
import sys
if not sys.version_info >= (3, 0):
import pydocx
from mfr import RenderResult
def render_docx(fp, *args, **kwargs):
content = pydocx.Docx2Html(fp)._parsed
return RenderResult(content=content.encode('ascii', 'ignore'), assets={... | """Docx renderer module."""
import sys
if not sys.version_info >= (3, 0):
import pydocx
from mfr import RenderResult
def render_docx(fp, *args, **kwargs):
content = pydocx.Docx2Html(fp)._parsed
return RenderResult(content=content, assets={})
| apache-2.0 | Python |
991889003ca31bf13b326b7c1788ecbe32801528 | Add det4 to global dets | NSLS-II-IXS/ipython_ophyd,NSLS-II-IXS/ipython_ophyd | profile_collection/startup/99-bluesky.py | profile_collection/startup/99-bluesky.py | from bluesky.global_state import (resume, abort, stop, panic, all_is_well,
state)
from bluesky.callbacks.olog import OlogCallback
from bluesky.global_state import gs
olog_cb = OlogCallback('Data Acquisition')
gs.RE.subscribe('start', olog_cb)
gs.DETS.append(det4)
#from bluesky.sci... | from bluesky.global_state import (resume, abort, stop, panic, all_is_well,
state)
from bluesky.callbacks.olog import OlogCallback
from bluesky.global_state import gs
olog_cb = OlogCallback('Data Acquisition')
gs.RE.subscribe('start', olog_cb)
from bluesky.scientific_callbacks impor... | bsd-2-clause | Python |
cdb51112cbacfca6cf06f14fd969fabc724016ce | Update __init__.py | mindflayer/python-mocket,mocketize/python-mocket | mocket/__init__.py | mocket/__init__.py | from mocket.mocket import Mocket, MocketEntry, Mocketizer, mocketize
__all__ = ("mocketize", "Mocket", "MocketEntry", "Mocketizer")
__version__ = "3.9.44"
| from mocket.mocket import Mocket, MocketEntry, Mocketizer, mocketize
__all__ = ("mocketize", "Mocket", "MocketEntry", "Mocketizer")
__version__ = "3.9.43"
| bsd-3-clause | Python |
103bfb8f8e35e36d1e20519505c1fd46d11cf6a9 | fix for new namespacing | rcbops/opencenter-agent,rcbops/opencenter-agent | roushagent/plugins/output/plugin_adventurator.py | roushagent/plugins/output/plugin_adventurator.py | #!/usr/bin/env python
import base64
import json
import logging
import os
import random
import time
from roushclient.client import RoushEndpoint
from state import StateMachine, StateMachineState
from primitives import OrchestratorTasks
name = 'adventurator'
roush_endpoint = 'http://localhost:8080'
def setup(config={... | #!/usr/bin/env python
import base64
import json
import logging
import os
import random
import time
from roushclient.client import RoushEndpoint
from state import StateMachine, StateMachineState
from primitives import OrchestratorTasks
name = 'adventurator'
roush_endpoint = 'http://localhost:8080'
def setup(config={... | apache-2.0 | Python |
ba38bb300c7f570b630add0bc2e577fda5939e8c | increase timeout to 180 sec | efiop/dvc,dmpetrov/dataversioncontrol,efiop/dvc,dmpetrov/dataversioncontrol | scripts/pyinstaller/sign.py | scripts/pyinstaller/sign.py | import argparse
import os
import pathlib
import sys
from subprocess import STDOUT, check_call
if sys.platform != "darwin":
raise NotImplementedError
parser = argparse.ArgumentParser()
parser.add_argument(
"--application-id",
required=True,
help="Certificate ID (should be added to the keychain).",
)
ar... | import argparse
import os
import pathlib
import sys
from subprocess import STDOUT, check_call
if sys.platform != "darwin":
raise NotImplementedError
parser = argparse.ArgumentParser()
parser.add_argument(
"--application-id",
required=True,
help="Certificate ID (should be added to the keychain).",
)
ar... | apache-2.0 | Python |
1d0a981fc082995ba75fcf8efc127b761e8f4379 | Update geogig_sync_osm.py | state-hiu/cybergis-scripts,state-hiu/cybergis-scripts | lib/rogue/geogig_sync_osm.py | lib/rogue/geogig_sync_osm.py | from base64 import b64encode
from optparse import make_option
import json
import urllib
import urllib2
import argparse
parser = argparse.ArgumentParser(description='Synchronize GeoGig repository with OpenStreetMap (OSM)')
parser.add_argument("url", help="The url to the repository you want to sync.")
parser.add_argumen... | from base64 import b64encode
from optparse import make_option
import json
import urllib
import urllib2
import argparse
parser = argparse.ArgumentParser(description='Synchronize GeoGig repository with OpenStreetMap (OSM)')
parser.add_argument("url", help="The url to the repository you want to sync.")
parser.add_argumen... | mit | Python |
6394f21e7f6ed772624302608f24fb0f52554589 | Split startup and bashrc | Kkevsterrr/backdoorme,Kkevsterrr/backdoorme,Kkevsterrr/backdoorme,Kkevsterrr/backdoorme | modules/startup.py | modules/startup.py | from .module import *
class Startup(Module):
def __init__(self, target, backdoor, core):
self.core = core
self.target = target
self.name = "startup"
self.backdoor = backdoor
self.options = {
}
def exploit(self):
self.target.ssh.exec_command("ech... | from .module import *
class Startup(Module):
def __init__(self, target, backdoor, core):
self.core = core
self.target = target
self.name = "startup"
self.backdoor = backdoor
self.options = {
"bash": Option("bash", True, "Add to bashrc", False),
... | mit | Python |
f6e9e18af457a033b9d5daf7d02b6755228eb1e0 | Fix Swarm Command Argument | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/master/factory/swarm_commands.py | scripts/master/factory/swarm_commands.py | # 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.
"""Set of utilities to add commands to a buildbot factory.
This is based on commands.py and adds swarm-specific commands."""
from buildbot.process.prop... | # 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.
"""Set of utilities to add commands to a buildbot factory.
This is based on commands.py and adds swarm-specific commands."""
from buildbot.process.prop... | bsd-3-clause | Python |
b063b743ed9e50c45d72688433159fac52aada1d | Use bzip2 instead of gzip to package chromium sources for codesearch | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/slave/chromium/package_source.py | scripts/slave/chromium/package_source.py | #!/usr/bin/python
# Copyright (c) 2011 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.
"""A tool to package a checkout's source and upload it to Google Storage."""
import os
import re
import sys
from common import chrom... | #!/usr/bin/python
# Copyright (c) 2011 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.
"""A tool to package a checkout's source and upload it to Google Storage."""
import os
import re
import sys
from common import chrom... | bsd-3-clause | Python |
b65c5157c9e4515b01558201b983727d3a3154bd | Fix detection of relative clause | Somsubhra/Simplify,Somsubhra/Simplify,Somsubhra/Simplify | src/syntax/relative_clauses.py | src/syntax/relative_clauses.py | __author__ = 's7a'
# All imports
from nltk.tree import Tree
# The Relative clauses class
class RelativeClauses:
# Constructor for the Relative Clauses class
def __init__(self):
self.has_wh_word = False
# Break the tree
def break_tree(self, tree):
t = Tree.fromstring(str(tree))
... | __author__ = 's7a'
# All imports
from nltk.tree import Tree
# The Relative clauses class
class RelativeClauses:
# Constructor for the Relative Clauses class
def __init__(self):
self.has_wh_word = False
# Break the tree
def break_tree(self, tree):
t = Tree.fromstring(str(tree))
... | mit | Python |
5d2b37c7089a3441f54bb1b4c0fa344abb48e738 | Update simple.py | ztp99/pyweb,zatuper/pywebstepic,zatuper/pywebstepic,ztp99/pyweb,ztp99/pyweb,zatuper/pywebstepic | etc/simple.py | etc/simple.py |
CONFIG = {
'mode': 'wsgi',
'working_dir': '/path/to/my/app',
'python': '/usr/bin/python',
'args': (
'--bind=127.0.0.1:8080',
'--workers=16',
'--timeout=60',
'app.module',
),
}
import urlparse
spisok=''
def application(env, start_response):
start_response('200 O... |
CONFIG = {
'mode': 'wsgi',
'working_dir': '/path/to/my/app',
'python': '/usr/bin/python',
'args': (
'--bind=127.0.0.1:8080',
'--workers=16',
'--timeout=60',
'app.module',
),
}
import urlparse
spisok=''
def application(env, start_response):
start_response('200 O... | apache-2.0 | Python |
73071051b984504cf98872e28084384dd74046b9 | fix oversight - when git node is None, distance should be 0 | RonnyPfannschmidt/setuptools_scm,pypa/setuptools_scm,pypa/setuptools_scm,RonnyPfannschmidt/setuptools_scm | setuptools_scm/git.py | setuptools_scm/git.py | from .utils import do_ex, trace
from .version import meta
from os.path import abspath, normcase, realpath
FILES_COMMAND = 'git ls-files'
DEFAULT_DESCRIBE = 'git describe --tags --long --match *.*'
def _normalized(path):
return normcase(abspath(realpath(path)))
class GitWorkdir(object):
def __init__(self, ... | from .utils import do_ex, trace
from .version import meta
from os.path import abspath, normcase, realpath
FILES_COMMAND = 'git ls-files'
DEFAULT_DESCRIBE = 'git describe --tags --long --match *.*'
def _normalized(path):
return normcase(abspath(realpath(path)))
class GitWorkdir(object):
def __init__(self, ... | mit | Python |
42654f3bf4f61b74a841853dc5f42bdfb42b101a | fix cache.purge method for integration teets under multi CPU | thomasyu888/synapsePythonClient | tests/integration/synapseclient/core/test_download.py | tests/integration/synapseclient/core/test_download.py | import filecmp
import os
import tempfile
import shutil
import time
import pytest
from synapseclient import File
from synapseclient.core.exceptions import SynapseMd5MismatchError
import synapseclient.core.utils as utils
def test_download_check_md5(syn, project, schedule_for_cleanup):
tempfile_path = utils.make_b... | import filecmp
import os
import tempfile
import shutil
import time
import pytest
from synapseclient import File
from synapseclient.core.exceptions import SynapseMd5MismatchError
import synapseclient.core.utils as utils
def test_download_check_md5(syn, project, schedule_for_cleanup):
tempfile_path = utils.make_b... | apache-2.0 | Python |
037dbe02303d66d5b9f585c335dc28a0a71517ab | Edit command takes 1 argument | eonpatapon/contrail-api-cli | contrail_api_cli/commands/edit.py | contrail_api_cli/commands/edit.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import tempfile
from six import b
import subprocess
import json
from ..command import Command, Arg, Option, expand_paths
from ..resource import Resource
from ..exceptions import CommandError
from ..utils import md5
class Edit(Command):
"""... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import tempfile
from six import b
import subprocess
import json
from ..command import Command, Arg, Option, expand_paths
from ..resource import Resource
from ..exceptions import CommandError
from ..utils import md5
class Edit(Command):
"""... | mit | Python |
ad30f224cb12a0e4da8a1ecee98cfbe37a79d4ad | fix tests | cgwire/zou | tests/export/test_edits_to_csv.py | tests/export/test_edits_to_csv.py | from zou.app.models.metadata_descriptor import MetadataDescriptor
from tests.edits.base import BaseEditTestCase
class EditCsvExportTestCase(BaseEditTestCase):
def test_export(self):
csv_edits = self.get_raw(
"/export/csv/projects/%s/edits.csv" % self.project.id
)
expected_resu... | from zou.app.models.metadata_descriptor import MetadataDescriptor
from tests.edits.base import BaseEditTestCase
class EditCsvExportTestCase(BaseEditTestCase):
def test_export(self):
csv_edits = self.get_raw(
"/export/csv/projects/%s/edits.csv" % self.project.id
)
expected_resu... | agpl-3.0 | Python |
b481d3b444f900450df540e3c5ad0d8daf2e8829 | Add suspend_instance from abyssinian-nightjar. modified: scripts/suspend_instance.py | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | scripts/suspend_instance.py | scripts/suspend_instance.py | #!/usr/bin/env python
import argparse
import sys
from traceback import print_exc
from api import get_esh_driver
from core.models import Provider, Identity
from service.instance import suspend_instance, resume_instance
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--user", required=Tru... | #!/usr/bin/env python
#NOTE: REMOVE THIS FILE BEFORE PULLING ABYSINNIAN. This is the WRONG one to keep! -Steve
import argparse
from service.instance import suspend_instance, resume_instance
from api import get_esh_driver
from core.models import Provider, Identity
def main():
parser = argparse.ArgumentParser()
... | apache-2.0 | Python |
da1f73380436623019e249cf5ddefc15818630d2 | test for src.blastFunctions.test_create_blastdb()" | phac-nml/ecoli_serotyping | tests/blastFunctions_test.py | tests/blastFunctions_test.py | import src.blastFunctions
from argparse import Namespace
from definitions import ROOT_DIR
import tempfile
tempfile = tempfile.gettempdir()
CONST_CSV = False
CONST_INPUT = 'filename'
CONST_MINGENOMES = 1
CONST_PERIDENT = 90
CONST_PERIDENT_F = 101
CONST_PERLEN = 90
CONST_PERLEN_F = 101
CONST_SER = True
CONST_VIR = Tru... | import src.blastFunctions
from argparse import Namespace
CONST_CSV = False
CONST_INPUT = 'filename'
CONST_MINGENOMES = 1
CONST_PERIDENT = 90
CONST_PERIDENT_F = 101
CONST_PERLEN = 90
CONST_PERLEN_F = 101
CONST_SER = True
CONST_VIR = True
args = Namespace(csv = CONST_CSV, input = CONST_INPUT, minimumGenomes = CONST_MI... | apache-2.0 | Python |
dc83e43ab828e2a4468fddecc0ae3a98273b6b3b | Update style. | svenkreiss/databench,svenkreiss/databench,svenkreiss/databench,svenkreiss/databench | analyses_packaged/dummypi.py | analyses_packaged/dummypi.py | """Calculating \\(\\pi\\) the simple way, but this is called
dummypi to avoid conflict with simplepi in the databench_examples repo."""
import math
from time import sleep
from random import random
import databench
ANALYSIS = databench.Analysis('dummypi', __name__, __doc__)
ANALYSIS.thumbnail = 'dummypi.png'
@ANAL... | """Calculating \\(\\pi\\) the simple way, but this is called
dummypi to avoid conflict with simplepi in the databench_examples repo."""
import math
from time import sleep
from random import random
import databench
dummypi = databench.Analysis('dummypi', __name__)
dummypi.thumbnail = 'dummypi.png'
dummypi.descriptio... | mit | Python |
c57066d751ac82b66cfb0796bf9fed526e81fbf3 | Remove a useless configuration parameter | tiramiseb/awesomeshop,tiramiseb/awesomeshop,tiramiseb/awesomeshop,tiramiseb/awesomeshop | awesomeshop/defaultconfig.py | awesomeshop/defaultconfig.py | # -*- coding: utf8 -*-
# Copyright 2015 Sébastien Maccagnoni-Munch
#
# This file is part of AwesomeShop.
#
# AwesomeShop 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,... | # -*- coding: utf8 -*-
# Copyright 2015 Sébastien Maccagnoni-Munch
#
# This file is part of AwesomeShop.
#
# AwesomeShop 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,... | agpl-3.0 | Python |
c0ef06fe3e92f0e6d23319657f9571a0ec375fa6 | Set offscreen and force width/height | westernx/mayatools,westernx/mayatools | mayatools/playblast/core.py | mayatools/playblast/core.py | from maya import cmds
from .. import context
__also_reload__ = [
'..context',
]
settings = {
'attrs': {
'defaultRenderGlobals.imageFormat': 8, # JPEG.
'defaultResolution.width': 1280,
'defaultResolution.height': 720,
'defaultResolution.deviceAspectRatio': 1280.0 / 720,
... | from maya import cmds
from .. import context
__also_reload__ = [
'..context',
]
settings = {
'attrs': {
'defaultRenderGlobals.imageFormat': 8, # JPEG.
'defaultResolution.width': 1280,
'defaultResolution.height': 720,
'defaultResolution.deviceAspectRatio': 1280.0 / 720,
... | bsd-3-clause | Python |
a1772bfcc48c2fe361053d81483ee7f31d330f45 | Add better simulation selection | neuro-lyon/multiglom-model,neuro-lyon/multiglom-model | analysis_plot_granule_fig.py | analysis_plot_granule_fig.py | # -*- coding:utf-8 -*-
"""
Select a specific simulation from a HDF5 file and plot its granule figure.
"""
import numpy as np
import matplotlib.pyplot as plt
import tables
import h5manager as h5m
from plotting import granule_pop_figure
from analysis import fftmax
DB_FILENAME = "data/db30x30_two_glom_beta_new_ps_int... | # -*- coding:utf-8 -*-
"""
Select a specific simulation from a HDF5 file and plot its granule figure.
"""
import numpy as np
import matplotlib.pyplot as plt
import tables
import h5manager as h5m
from plotting import granule_pop_figure
from analysis import fftmax
DB_FILENAME = "db_two_glom_beta_new_ps_interco_stren... | mit | Python |
3c887b351933decdf0115aa6758c7547c788b689 | fix #1291 previously merged hello-world branch. Made height/weight graph more interesting. Updated wiki | mrakitin/sirepo,mkeilman/sirepo,mrakitin/sirepo,radiasoft/sirepo,radiasoft/sirepo,radiasoft/sirepo,mkeilman/sirepo,mrakitin/sirepo,mrakitin/sirepo,radiasoft/sirepo,radiasoft/sirepo,mkeilman/sirepo,mkeilman/sirepo | sirepo/pkcli/myapp.py | sirepo/pkcli/myapp.py | # -*- coding: utf-8 -*-
"""Wrapper to run myapp from the command line.
:copyright: Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkio
from pykern.pkdebug import pk... | # -*- coding: utf-8 -*-
"""Wrapper to run myapp from the command line.
:copyright: Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkio
from pykern.pkdebug import pk... | apache-2.0 | Python |
8488e5edf1bf041411ffd9ece8a8e662efed868c | add asset_count to columns | kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi | scripts/user-list-export.py | scripts/user-list-export.py | import csv
import sys
import time
from django.contrib.auth.models import User
from django.db.models import CharField, F, Count
from django.db.models.functions import Cast
USER_COLS = [
'id',
'username',
'is_superuser',
'is_staff',
'date_joined_str',
'last_login_str',
'first_name',
'la... | import csv
import sys
import time
from django.contrib.auth.models import User
from django.db.models import CharField, F
from django.db.models.functions import Cast
USER_COLS = [
'id',
'username',
'is_superuser',
'is_staff',
'date_joined_str',
'last_login_str',
'first_name',
'last_name... | agpl-3.0 | Python |
9d364b32b7a82c637aa60d12fd2411ee8d44af7e | Add custom PrimaryFileRelationshipField to allow for getting the correct object and returning correct internal value, use the field for the primary file along with read_only=False, add create method that calls proper methods to add attributes to node to create a preprint | aaxelb/osf.io,crcresearch/osf.io,Nesiehr/osf.io,caneruguz/osf.io,saradbowman/osf.io,adlius/osf.io,alexschiller/osf.io,cslzchen/osf.io,acshi/osf.io,crcresearch/osf.io,cslzchen/osf.io,laurenrevere/osf.io,baylee-d/osf.io,Nesiehr/osf.io,sloria/osf.io,TomBaxter/osf.io,brianjgeiger/osf.io,chennan47/osf.io,monikagrabowska/osf... | api/preprints/serializers.py | api/preprints/serializers.py | from rest_framework import serializers as ser
from modularodm import Q
from api.base.serializers import (
JSONAPISerializer, IDField, JSONAPIListField, LinksField, RelationshipField
)
from api.base.utils import absolute_reverse, get_user_auth
from api.nodes.serializers import NodeTagField, NodeContributorsSerializ... | from rest_framework import serializers as ser
from modularodm import Q
from modularodm.exceptions import NoResultsFound, MultipleResultsFound
from api.base.serializers import (
JSONAPISerializer, RelationshipField, IDField, JSONAPIListField, LinksField
)
from website.models import Node
from api.base.utils import ab... | apache-2.0 | Python |
3b278eb1db2b2ab2b339d756ec3b9f167649dba7 | Switch to abstract run_hooks method | gterzian/exam,Fluxx/exam,gterzian/exam,Fluxx/exam | exam/cases.py | exam/cases.py | from __future__ import absolute_import
from exam.decorators import before, after, around, patcher # NOQA
from exam.objects import noop # NOQA
from exam.asserts import AssertsMixin
import inspect
class MultipleGeneratorsContextManager(object):
def __init__(self, *generators):
self.generators = generat... | from __future__ import absolute_import
from exam.decorators import before, after, around, patcher # NOQA
from exam.objects import noop # NOQA
from exam.asserts import AssertsMixin
import inspect
class MultipleGeneratorsContextManager(object):
def __init__(self, *generators):
self.generators = generat... | mit | Python |
c390b1bacc4a796329694a67ca81638d2af1115f | fix for django tests at sites.dev.settings env | dgk/django-business-logic,dgk/django-business-logic,dgk/django-business-logic,dgk/django-business-logic,dgk/django-business-logic | sites/dev/settings.py | sites/dev/settings.py | from ..settings import *
DEBUG = True
ALLOWED_HOSTS = ['*']
INSTALLED_APPS += [
# 'django_extensions',
'bootstrap3',
'sites.dev.books',
]
ROOT_URLCONF = 'sites.dev.urls'
WSGI_APPLICATION = 'sites.dev.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
... | from ..settings import *
DEBUG = True
ALLOWED_HOSTS = ['*']
INSTALLED_APPS += [
# 'django_extensions',
'bootstrap3',
'sites.dev.books',
]
ROOT_URLCONF = 'sites.dev.urls'
WSGI_APPLICATION = 'sites.dev.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
... | mit | Python |
e1090b4e600d6dec16ec7f7bd5fe4d3e221eaee6 | add a test case where seidel fails for zero motion | hungpham2511/toppra,hungpham2511/toppra,hungpham2511/toppra | tests/retime/test_zero_motions.py | tests/retime/test_zero_motions.py | """This test suite contains tests to verify that TOPPRA can produce
reasonable results to trajectories of very small movements. Almost
zero.
"""
import pytest
import numpy as np
import toppra
toppra.setup_logging(level="INFO")
@pytest.mark.parametrize("scaling", [1e-1, 1e-2, 1e-3])
@pytest.mark.parametrize("Ngrid", ... | """This test suite contains tests to verify that TOPPRA can produce
reasonable results to trajectories of very small movements. Almost
zero.
"""
| mit | Python |
16a440cb9d3476b71e9e7ebd975a16ee609159f5 | use official python images, not ubuntu | scorphus/thefuck,mlk/thefuck,Clpsplug/thefuck,nvbn/thefuck,SimenB/thefuck,mlk/thefuck,Clpsplug/thefuck,nvbn/thefuck,scorphus/thefuck,SimenB/thefuck | tests/functional/test_zsh.py | tests/functional/test_zsh.py | import pytest
from tests.functional.plots import with_confirmation, without_confirmation, \
refuse_with_confirmation, history_changed, history_not_changed, \
select_command_with_arrows, how_to_configure
containers = (('thefuck/python3-zsh',
u'''FROM python:3
RUN apt-get update... | import pytest
from tests.functional.plots import with_confirmation, without_confirmation, \
refuse_with_confirmation, history_changed, history_not_changed, \
select_command_with_arrows, how_to_configure
containers = (('thefuck/ubuntu-python3-zsh',
u'''FROM ubuntu:latest
RUN ap... | mit | Python |
45e7a404a67598b0a6695dfb95f087dedaf73aab | Remove update. | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | backend/scripts/mcnewuser.py | backend/scripts/mcnewuser.py | #!/usr/bin/env python
import rethinkdb as r
from optparse import OptionParser
from pbkdf2 import crypt
import uuid
import sys
class User(object):
def __init__(self, name, email, password):
self.name = name
self.email = email
self.fullname = ""
self.password = password
self.... | #!/usr/bin/env python
import rethinkdb as r
from optparse import OptionParser
from pbkdf2 import crypt
import uuid
import sys
class User(object):
def __init__(self, name, email, password):
self.name = name
self.email = email
self.fullname = ""
self.password = password
self.... | mit | Python |
f0605d7f218d3d324694e2c5142c12b94d13ccce | Fix TournamentPlayer admin. | michal-k/SnailBucket2,michal-k/SnailBucket2,michal-k/SnailBucket2 | backend/tournaments/admin.py | backend/tournaments/admin.py | from django.conf.urls import url
from django.contrib import admin
from django.shortcuts import redirect
from .models import *
from .tools import generate_tournament_rounds
class TournamentPlayerAdmin(admin.ModelAdmin):
list_display = ('member', 'tournament', 'bucket')
list_filter = ('bucket', 'member')
class Ro... | from django.conf.urls import url
from django.contrib import admin
from django.shortcuts import redirect
from .models import *
from .tools import generate_tournament_rounds
class TournamentPlayerAdmin(admin.ModelAdmin):
list_display = ('member', 'tournament_name', 'bucket_name')
list_filter = ('bucket', 'member')
... | apache-2.0 | Python |
3f5e2ad7d7119e955aae98131acfa6c1fb25e628 | Refactor refresh_varsnap | albertyw/base-flask,albertyw/base-flask,albertyw/base-flask,albertyw/base-flask | baseflask/refresh_varsnap.py | baseflask/refresh_varsnap.py | """
This script refreshes production varsnap snaps
"""
import os
from flask.testing import FlaskClient
from dotenv import dotenv_values
from syspath import git_root # NOQA
from app import serve
def get_client() -> tuple[FlaskClient, str]:
config = dotenv_values('.env.production')
server_name = ''
if c... | """
This script refreshes production varsnap snaps
"""
import os
from dotenv import dotenv_values
from syspath import git_root # NOQA
from app import serve
config = dotenv_values('.env.production')
base_url = 'https://' + config.get('SERVER_NAME', '')
os.environ['ENV'] = 'production'
serve.app.config['SERVER_NAME... | mit | Python |
a49093e6ad62864b7c0e72980c9028a825fd809a | add test metavar | ratnania/pyccel,ratnania/pyccel | tests/parser/test_headers.py | tests/parser/test_headers.py | # coding: utf-8
from pyccel.parser.syntax.headers import parse
def test_variable():
print (parse(stmts='#$ header variable x :: int'))
print (parse(stmts='#$ header variable x float [:, :]'))
def test_function():
print (parse(stmts='#$ header function f(float [:], int [:]) results(int)'))
def test_funct... | # coding: utf-8
from pyccel.parser.syntax.headers import parse
def test_variable():
print (parse(stmts='#$ header variable x :: int'))
print (parse(stmts='#$ header variable x float [:, :]'))
def test_function():
print (parse(stmts='#$ header function f(float [:], int [:]) results(int)'))
def test_funct... | mit | Python |
ff1c9dff1bd5321b20048790563bb0be73fbd782 | Fix test case | ymyzk/kawasemi,ymyzk/django-channels | tests/tests/backends/test_base.py | tests/tests/backends/test_base.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from channels.backends.base import BaseChannel
from channels.exceptions import ImproperlyConfigured
class BaseChannelTestCase(TestCase):
def test_init(self):
with self.assertRaises(TypeError):
Ba... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from channels.backends.base import BaseChannel
from channels.exceptions import ImproperlyConfigured
class TestChannel(BaseChannel):
def send(self, message):
pass
class BaseChannelTestCase(TestCase):
de... | mit | Python |
c295dd0290b4b1c2bb927366db710ccc713eada3 | Fix unrequested settings being loaded from DB. | douglaskastle/mezzanine,Cajoline/mezzanine,dustinrb/mezzanine,sjdines/mezzanine,scarcry/snm-mezzanine,cccs-web/mezzanine,SoLoHiC/mezzanine,mush42/mezzanine,molokov/mezzanine,PegasusWang/mezzanine,ryneeverett/mezzanine,joshcartme/mezzanine,christianwgd/mezzanine,gradel/mezzanine,jerivas/mezzanine,ryneeverett/mezzanine,w... | mezzanine/settings/__init__.py | mezzanine/settings/__init__.py |
import sys
from django.conf import settings
from mezzanine.settings.models import Setting
registry = {}
def register_setting(name="", editable=False, description="", default=None):
"""
Registers a setting that can be edited via the admin.
"""
default = getattr(settings, "MEZZANINE_%s" % name, def... |
import sys
from django.conf import settings
from mezzanine.settings.models import Setting
registry = {}
def register_setting(name="", editable=False, description="", default=None):
"""
Registers a setting that can be edited via the admin.
"""
default = getattr(settings, "MEZZANINE_%s" % name, def... | bsd-2-clause | Python |
32e036faf7699c0781ae487072a2045ca31bb391 | Fix bf9cc3e - actually capture sale date! | Techbikers/techbikers,Techbikers/techbikers,Techbikers/techbikers,mwillmott/techbikers,Techbikers/techbikers,mwillmott/techbikers,mwillmott/techbikers,mwillmott/techbikers | server/core/models/sales.py | server/core/models/sales.py | import stripe
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
class Sale(models.Model):
sale_date = models.DateTimeField(editable=False)
charge_id = models.CharField(max_length=32) # store the stripe charge id for this ... | import stripe
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
class Sale(models.Model):
sale_date = models.DateTimeField(editable=False)
charge_id = models.CharField(max_length=32) # store the stripe charge id for this ... | mit | Python |
25d9db1a6126b36412fb21a5d6c59cb4001fb39c | Fix incorrect path in settings | flip111/portia,asa1253/portia,PrasannaVenkadesh/portia,chennqqi/portia,flip111/portia,sntran/portia,Youwotma/portia,asa1253/portia,naveenvprakash/portia,Youwotma/portia,CENDARI/portia,hanicker/portia,flip111/portia,Suninus/portia,NoisyText/portia,verylasttry/portia,sntran/portia,hanicker/portia,asa1253/portia,Suninus/p... | slyd/slyd/settings.py | slyd/slyd/settings.py | """Scrapy settings"""
from os.path import join, dirname
EXTENSIONS = {
'scrapy.contrib.logstats.LogStats': None,
'scrapy.webservice.WebService': None,
'scrapy.telnet.TelnetConsole': None,
'scrapy.contrib.throttle.AutoThrottle': None
}
LOG_LEVEL = 'DEBUG'
# location of slybot projects - assumes a subd... | """Scrapy settings"""
from os.path import join, dirname
EXTENSIONS = {
'scrapy.contrib.logstats.LogStats': None,
'scrapy.webservice.WebService': None,
'scrapy.telnet.TelnetConsole': None,
'scrapy.contrib.throttle.AutoThrottle': None
}
LOG_LEVEL = 'DEBUG'
# location of slybot projects - assumes a subd... | bsd-3-clause | Python |
3d696d93967e83c0b6b8611efb3aafb84f0d71b3 | test showFeedback | gotcha/vimpdb | src/vimpdb/tests/test_proxy.py | src/vimpdb/tests/test_proxy.py | def test_ProxyToVim_instantiation():
from vimpdb.proxy import ProxyToVim
to_vim = ProxyToVim()
assert isinstance(to_vim, ProxyToVim)
def test_ProxyToVim_setupRemote():
from vimpdb.testing import ProxyToVimForTests
to_vim = ProxyToVimForTests()
to_vim.setState(to_vim.IS_REMOTE_SETUP_IS_FALSE)
... | def test_ProxyToVim_instantiation():
from vimpdb.proxy import ProxyToVim
to_vim = ProxyToVim()
assert isinstance(to_vim, ProxyToVim)
def test_ProxyToVim_setupRemote():
from vimpdb.testing import ProxyToVimForTests
to_vim = ProxyToVimForTests()
to_vim.setState(to_vim.IS_REMOTE_SETUP_IS_FALSE)
... | mit | Python |
5b1dec6373ef0946a887dd195726180044658901 | bump version to 4.1.0 | RaRe-Technologies/smart_open,RaRe-Technologies/smart_open | smart_open/version.py | smart_open/version.py | __version__ = '4.1.0'
if __name__ == '__main__':
print(__version__)
| __version__ = '4.0.1.dev1'
if __name__ == '__main__':
print(__version__)
| mit | Python |
8a4406869d1d2d7d9f74e29560c91fd713299b21 | allow users to modify .gitignore at top level as well | benjaminvialle/Markus,MarkUsProject/Markus,benjaminvialle/Markus,MarkUsProject/Markus,benjaminvialle/Markus,MarkUsProject/Markus,benjaminvialle/Markus,MarkUsProject/Markus,benjaminvialle/Markus,MarkUsProject/Markus,MarkUsProject/Markus,MarkUsProject/Markus,benjaminvialle/Markus,benjaminvialle/Markus,MarkUsProject/Marku... | lib/repo/git_hooks/update.d/02-block_change_top_level_master.py | lib/repo/git_hooks/update.d/02-block_change_top_level_master.py | #!/usr/bin/env python3
import os
import subprocess
import sys
if __name__ == '__main__':
ref_name = sys.argv[1]
old_commit = sys.argv[2]
new_commit = sys.argv[3]
# check 1: allow branches other than master
if ref_name != 'refs/heads/master':
sys.exit()
# no need to check at this point... | #!/usr/bin/env python3
import os
import subprocess
import sys
if __name__ == '__main__':
ref_name = sys.argv[1]
old_commit = sys.argv[2]
new_commit = sys.argv[3]
# check 1: allow branches other than master
if ref_name != 'refs/heads/master':
sys.exit()
# no need to check at this point... | mit | Python |
f006cad1cf66d691086df058698404cd4bdf2216 | fix missing subTest | PythonCharmers/python-future,PythonCharmers/python-future | tests/test_past/test_misc.py | tests/test_past/test_misc.py | # -*- coding: utf-8 -*-
"""
Tests for the resurrected Py2-like cmp function
"""
from __future__ import absolute_import, unicode_literals, print_function
import os.path
import sys
import traceback
from contextlib import contextmanager
from future.tests.base import unittest
from past.builtins import cmp
_dir = os.pat... | # -*- coding: utf-8 -*-
"""
Tests for the resurrected Py2-like cmp function
"""
from __future__ import absolute_import, unicode_literals, print_function
import os.path
import sys
import traceback
from future.tests.base import unittest
from past.builtins import cmp
_dir = os.path.dirname(os.path.abspath(__file__))
s... | mit | Python |
943cfa776178ba1be72ef44c4cdcf43b3668f7b2 | Fix the run.py commands for the texture-wrapfill test. | sambler/oiio,micler/oiio,YangYangTL/oiio,scott-wilson/oiio,lgritz/oiio,lgritz/oiio,cwilling/oiio,mcanthony/oiio,bdeluca/oiio,sambler/oiio,scott-wilson/oiio,bdeluca/oiio,lgritz/oiio,lgritz/oiio,OpenImageIO/oiio,micler/oiio,micler/oiio,cwilling/oiio,cwilling/oiio,mcanthony/oiio,scott-wilson/oiio,bdeluca/oiio,OpenImageIO/... | testsuite/texture-wrapfill/run.py | testsuite/texture-wrapfill/run.py | #!/usr/bin/python
# This tests a particular tricky case: the interplay of "black" wrap mode
# with fill color. Outside the s,t [0,1] range, it should be black, NOT
# fill color.
# Make an RGB grid for our test
command += (oiio_app("oiiotool")
+ parent + "/oiio-images/grid.tif"
+ " -ch R,G,... | #!/usr/bin/python
# This tests a particular tricky case: the interplay of "black" wrap mode
# with fill color. Outside the s,t [0,1] range, it should be black, NOT
# fill color.
# Make an RGB grid for our test
command += (oiio_app("oiiotool")
+ parent + "/oiio-images/grid.tif"
+ " -ch R,G,... | bsd-3-clause | Python |
85e0de853fdc6c80555e0958e3f68be2b18fd6e0 | Update UltrasonicSensor.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | service/UltrasonicSensor.py | service/UltrasonicSensor.py | python = Runtime.start("python","Python")
sr04 = Runtime.start("sr04", "UltrasonicSensor")
arduino = Runtime.start("arduino", "Arduino")
arduino.connect("COM15")
sr04.attach(arduino, 12, 11)
sr04.addRangeListener(python)
def onRange(distance):
print "distance ", distance, " cm"
# event driven ranging
# start rangin... | python = Runtime.start("python","Python")
sr04 = Runtime.start("sr04", "UltrasonicSensor")
sr04.attach("COM15", 12, 11)
sr04.addRangeListener(python)
def onRange(distance):
print "distance ", distance, " cm"
# event driven ranging
# start ranging for 5 seconds - the publishRange(distance) will be
# called for every... | apache-2.0 | Python |
46abb35382613b416cece7dbdd0a5329a313f001 | Fix test | explosion/srsly,explosion/srsly,explosion/srsly,explosion/srsly | srsly/tests/test_pickle_api.py | srsly/tests/test_pickle_api.py | # coding: utf8
from __future__ import unicode_literals
from .._pickle_api import pickle_dumps, pickle_loads
def test_pickle_dumps():
data = {"hello": "world", "test": 123}
expected = [
b"\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00}\x94(\x8c\x05hello\x94\x8c\x05world\x94\x8c\x04test\x94K{u.",
... | # coding: utf8
from __future__ import unicode_literals
from .._pickle_api import pickle_dumps, pickle_loads
def test_pickle_dumps():
data = {"hello": "world", "test": 123}
expected = [
b"\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00}\x94(\x8c\x05hello\x94\x8c\x05world\x94\x8c\x04test\x94K{u.",
... | mit | Python |
8ffacc79befc93958b3a2a675d693fda9f876c07 | remove static from mock | EndyKaufman/django-postgres-angularjs-blog,EndyKaufman/django-postgres-angularjs-blog,EndyKaufman/django-postgres-angularjs-blog,EndyKaufman/django-postgres-angularjs-blog | app/home/helpers_fixtures.py | app/home/helpers_fixtures.py | # -*- coding: utf-8 -*-
import django.middleware.csrf
def getConfig(request):
config = {}
config['host'] = request.get_host()
config['hostName'] = request.get_host().decode('idna')
config['csrf_token'] = django.middleware.csrf.get_token(request)
config['user'] = {}
return config
| # -*- coding: utf-8 -*-
import django.middleware.csrf
from django.contrib.staticfiles.templatetags.staticfiles import static
def getConfig(request):
config = {}
config['host'] = request.get_host()
config['hostName'] = request.get_host().decode('idna')
config['csrf_token'] = django.middleware.csrf.get... | mit | Python |
02e4a051e6e463d06195e9efe6a25c84cc046b55 | Add authorization and content-type headers to request for tests | brayoh/bucket-list-api | tests/base.py | tests/base.py | import unittest
import json
from app import create_app, db
from app.models import User
class Base(unittest.TestCase):
def setUp(self):
self.app = create_app("testing")
self.client = self.app.test_client()
self.user = json.dumps({
"username": "brian",
"password": "pa... | import unittest
from app import create_app, db
class Base(unittest.TestCase):
def setUp(self):
self.app = create_app("testing")
self.client = self.app.test_client()
self.user = {
"username": "brian",
"password": "password"
}
with self.app.app_contex... | mit | Python |
6d08ca01e9d3529c6d751561cad43bc210756124 | Fix stash merge conflicts | juliema/aTRAM | tests/mock.py | tests/mock.py | """Utility to mock function calls."""
import inspect
from itertools import cycle
history = []
monkeypatch = None
def it(module, func_name, returns=None):
"""Append the function call to the history.
Save all of the arguments of each function call in the order they
were called. You can pass in a set of r... | """Utility to mock function calls."""
import inspect
from itertools import cycle
history = []
monkeypatch = None
def it(module, func_name, returns=None):
"""Append the function call to the history.
Save all of the arguments of each function call in the order they
were called. You can pass in a set of r... | bsd-3-clause | Python |
1138f17bfb78e51fa8c82cb2242c74bd3f18687a | remove test_douyin | xyuanmu/you-get,xyuanmu/you-get | tests/test.py | tests/test.py | #!/usr/bin/env python
import unittest
from you_get.extractors import (
imgur,
magisto,
youtube,
yixia,
bilibili,
douyin,
)
class YouGetTests(unittest.TestCase):
def test_imgur(self):
imgur.download('http://imgur.com/WVLk5nD', info_only=True)
imgur.download('http://imgur.c... | #!/usr/bin/env python
import unittest
from you_get.extractors import (
imgur,
magisto,
youtube,
yixia,
bilibili,
douyin,
)
class YouGetTests(unittest.TestCase):
def test_imgur(self):
imgur.download('http://imgur.com/WVLk5nD', info_only=True)
imgur.download('http://imgur.c... | mit | Python |
13851912eaedc53fa0715280813c4f7aaabd9cee | Update test.py | astorfi/speech_feature_extraction,astorfi/speechpy | tests/test.py | tests/test.py | import scipy.io.wavfile as wav
import numpy as np
import speechpy
file_name = 'Alesis-Sanctuary-QCard-AcoustcBas-C2.wav'
fs, signal = wav.read(file_name)
signal = signal[:,0]
############# Extract MFCC features #############
mfcc = speechpy.mfcc(signal, sampling_frequency=fs, frame_length=0.020, frame_stride=0.01,
... | import scipy.io.wavfile as wav
import numpy as np
import speechpy
file_name = 'Alesis-Sanctuary-QCard-AcoustcBas-C2.wav'
fs, signal = wav.read(file_name)
signal = signal[:,0]
############# Extract MFCC features #############
mfcc = speechpy.mfcc_feature(signal, sampling_frequency=fs, frame_length=0.020, frame_stride=... | apache-2.0 | Python |
7cb77573831b899900951940029130b11cf1c42d | Update urls.py | raiderrobert/django-webhook | tests/urls.py | tests/urls.py | from django.conf.urls import url, include
from webhook.base import WebhookBase
class WebhookView(WebhookBase):
def process_webhook(self, data):
pass
urlpatterns = [
url(r'^webhook-receiver', WebhookView.as_view(), name='web_hook'),
]
| from django.conf.urls import url, include
from webhook.base import WebhookBase
class WebhookView(WebhookBase):
def process_webhook(self, data, meta):
pass
urlpatterns = [
url(r'^webhook-receiver', WebhookView.as_view(), name='web_hook'),
]
| mit | Python |
cba7f258239f1a049c91a87c5eb1e6831f7b5028 | Reset config.py | bderstine/WebsiteMixer-App-Base,bderstine/WebsiteMixer-App-Base,bderstine/WebsiteMixer-App-Base | config.py | config.py | DEBUG = True
DEBUG_TB_INTERCEPT_REDIRECTS = False
DEBUG_TB_PROFILER_ENABLED = True
DEBUG_TB_TEMPLATE_EDITOR_ENABLED = True
SECRET_KEY = 'websitemixersupersecretkey1234567890'
SQLALCHEMY_TRACK_MODIFICATIONS = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:'
| import os
basedir = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
DEBUG_TB_INTERCEPT_REDIRECTS = False
DEBUG_TB_PROFILER_ENABLED = True
DEBUG_TB_TEMPLATE_EDITOR_ENABLED = False
SECRET_KEY = '6f9ce79437e3fd1e11cdba78198a31b4fb9225b84efe39cc'
UPLOAD_FOLDER = basedir+'/websitemixer/static/upload/'
ALLOWED_EXTEN... | mit | Python |
96bf9b6882899b216754f176353f04fa74a974f4 | edit emotions list fields | NickyLebedev/MoodBook_BSU,NickyLebedev/MoodBook_BSU,NickyLebedev/MoodBook_BSU | MoodBook/app/models.py | MoodBook/app/models.py | """
Definition of models.
"""
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Mood(models.Model):
name = models.CharField(max_length=60)
class Record(models.Model):
name = models.CharField(max_length=60)
date = models.DateTimeField(auto_created... | """
Definition of models.
"""
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Mood(models.Model):
name = models.CharField(max_length=60)
class Record(models.Model):
name = models.CharField(max_length=60)
date = models.DateTimeField(auto_created... | mit | Python |
6ad77e5a9cdbe63ca706bd7c7d3aebb7a34e4cc5 | Exit if imported on Python 2 | kingosticks/mopidy,adamcik/mopidy,jcass77/mopidy,jodal/mopidy,mopidy/mopidy,kingosticks/mopidy,mopidy/mopidy,adamcik/mopidy,jcass77/mopidy,kingosticks/mopidy,jodal/mopidy,jodal/mopidy,mopidy/mopidy,jcass77/mopidy,adamcik/mopidy | mopidy/__init__.py | mopidy/__init__.py | from __future__ import absolute_import, print_function, unicode_literals
import platform
import sys
import warnings
if not sys.version_info >= (3, 7):
sys.exit(
'ERROR: Mopidy requires Python >= 3.7, but found %s.' %
platform.python_version())
warnings.filterwarnings('ignore', 'could not open d... | from __future__ import absolute_import, print_function, unicode_literals
import platform
import sys
import warnings
compatible_py2 = (2, 7) <= sys.version_info < (3,)
compatible_py3 = (3, 7) <= sys.version_info
if not (compatible_py2 or compatible_py3):
sys.exit(
'ERROR: Mopidy requires Python 2.7 or >=... | apache-2.0 | Python |
4e23d48a82a019322df08fd10f5e83de681f1315 | Add missing copyright from pygobject | lazka/pgi,lazka/pgi | pgi/overrides/GObject.py | pgi/overrides/GObject.py | # -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2013 Christoph Reiter
# Copyright (C) 2012 Canonical Ltd.
# Author: Martin Pitt <martin.pitt@ubuntu.com>
# Copyright (C) 2012 Simon Feltman <sfeltman@src.gnome.org>
# Copyright (C) 2012 Bastian Winkler <buz@netbuz.org>... | # Copyright 2012 Christoph Reiter
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
from pgi.repository import... | lgpl-2.1 | Python |
a64f5538dca74a4339fd02d6641bbfb039eed6e3 | Fix Bugs | LanceVan/SciCycle | NewtonInterpolation.py | NewtonInterpolation.py | import numpy as np
from Interpolation import *
class NewtonInterpolation(Interpolation):
def __init__(self, x, y):
Interpolation.__init__(self, x, y)
self.diffQuotient(x, y)
def diffQuotient(self, x, y):
self.dquo = np.zeros(self.size - 1)
self.dquo = self.dquo.reshape(self.s... | import numpy as np
from Interpolation import *
class NewtonInterpolation(Interpolation):
def __init__(self, x, y):
Interpolation.__init__(self, x, y)
self.diffQuotient(x, y)
def diffQuotient(self, x, y):
self.dquo = np.zeros(self.size - 1)
self.dquo = self.dquo.reshape(self.s... | mit | Python |
6ada8a6187235b8b2886a5966b6b63f570d2ad42 | use np.real instead of np.imag | krenzlin/bilthoven | bilthoven/transformations.py | bilthoven/transformations.py | import numpy as np
def template(current_block, previous_block, random_parameter):
"""This is just a no-op transformation for you to see what interface you should provide."""
return current_block
def reverse(current_block, *args):
"""Reverses the data of the current block."""
return current_block[::-... | import numpy as np
def template(current_block, previous_block, random_parameter):
"""This is just a no-op transformation for you to see what interface you should provide."""
return current_block
def reverse(current_block, *args):
"""Reverses the data of the current block."""
return current_block[::-... | mit | Python |
803447a8d8b143061b0e1727e45cca185d73f218 | disable non-critical failing test after reverting shapefile polygon handling - refs #1093 | rouault/mapnik,kapouer/mapnik,yohanboniface/python-mapnik,yiqingj/work,kapouer/mapnik,tomhughes/python-mapnik,pnorman/mapnik,Mappy/mapnik,strk/mapnik,mapnik/python-mapnik,whuaegeanse/mapnik,jwomeara/mapnik,strk/mapnik,sebastic/python-mapnik,naturalatlas/mapnik,mbrukman/mapnik,mapnik/mapnik,jwomeara/mapnik,Uli1/mapnik,m... | tests/python_tests/ogr_and_shape_geometries_test.py | tests/python_tests/ogr_and_shape_geometries_test.py | #!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, Todo
import os, sys, glob, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
# TODO - fix truncation in shapefile...... | #!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, Todo
import os, sys, glob, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
# TODO - fix truncation in shapefile...... | lgpl-2.1 | Python |
9da9f8f6cd6805a2f6d30dd25306909f302a0655 | Replace F.cast test asserts | ktnyt/chainer,hvy/chainer,tkerola/chainer,niboshi/chainer,wkentaro/chainer,keisuke-umezawa/chainer,chainer/chainer,jnishi/chainer,ktnyt/chainer,hvy/chainer,wkentaro/chainer,okuta/chainer,niboshi/chainer,niboshi/chainer,keisuke-umezawa/chainer,wkentaro/chainer,hvy/chainer,niboshi/chainer,jnishi/chainer,ktnyt/chainer,pfn... | tests/chainer_tests/functions_tests/array_tests/test_cast.py | tests/chainer_tests/functions_tests/array_tests/test_cast.py | import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product_dict(
[
{'shape': (3, 4)},
{'shape': ()},
],
... | import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product_dict(
[
{'shape': (3, 4)},
{'shape': ()},
],
... | mit | Python |
6f0454669be842309d1c31deee9c377d9c6ffff5 | Add access token from auth not report | lightstephq/lightstep-tracer-python | lightstep/http_connection.py | lightstep/http_connection.py | """ Connection class establishes HTTP connection with server.
Utilized to send Proto Report Requests.
"""
import threading
import requests
from lightstep.collector_pb2 import ReportResponse
class _HTTPConnection(object):
"""Instances of _Connection are used to establish a connection to the
server via HTT... | """ Connection class establishes HTTP connection with server.
Utilized to send Proto Report Requests.
"""
import threading
import requests
from lightstep.collector_pb2 import ReportResponse
class _HTTPConnection(object):
"""Instances of _Connection are used to establish a connection to the
server via HTT... | mit | Python |
0c7edcd453ed8a4748df3fb9631cfd65b108ea82 | Fix room_occupation script | mic4ael/indico,indico/indico,OmeGak/indico,DirkHoffmann/indico,mvidalgarcia/indico,DirkHoffmann/indico,OmeGak/indico,OmeGak/indico,mvidalgarcia/indico,DirkHoffmann/indico,pferreir/indico,indico/indico,OmeGak/indico,ThiefMaster/indico,mvidalgarcia/indico,indico/indico,pferreir/indico,ThiefMaster/indico,mic4ael/indico,Th... | bin/utils/room_occupation.py | bin/utils/room_occupation.py | # -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; eith... | # -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; eith... | mit | Python |
21aeff37954fec7e997b326d0ea3f20c6ce24d8d | update unit tests | DucAnhPhi/LinguisticAnalysis | linguistic_analysis_tests.py | linguistic_analysis_tests.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 23 18:53:50 2017
Unit test for linguistic_analysis.py
@author: duc
"""
import unittest
import linguistic_analysis as la
tweets = ["Is this not a question?! Interactive introduction reference information", "Sure! Why not?"]
norm = [
[["is"... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 23 18:53:50 2017
Unit test for linguistic_analysis.py
@author: duc
"""
import unittest
import linguistic_analysis as la
tweets = ["Is this not a question?!", "Sure! Why not?"]
norm = [[["is", "this", "not", "a", "question"]],[["sure", "why", "not... | mit | Python |
7924064d98817edb7408f9e280368eb25fa1ce76 | Update app.py | illotum/sdn-fabric,illotum/sdn-fabric | fabric/app.py | fabric/app.py | """
This module contains controller application to manage
a set of OpenFlow switches
"""
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3 as ofp
f... | """
This module contains controller application to manage
a set of OpenFlow switches
"""
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3 as ofp
f... | apache-2.0 | Python |
3ce54f4e4e5142cd11f08ec58466242ae864f1d7 | fix mysql import for python2 | knightingal/git_fav,knightingal/git_fav,knightingal/git_fav | mysite/__init__.py | mysite/__init__.py | # pip install PyMySQL
import sys
if sys.version_info.major == 3:
import pymysql
pymysql.install_as_MySQLdb() | # pip install PyMySQL
import pymysql
pymysql.install_as_MySQLdb() | apache-2.0 | Python |
486222e10fbbf58bbe2f35032acca848ea7bf743 | Fix #397 (don't try to remove an NTFS-locked file after test) | smartfile/django-south,smartfile/django-south | south/tests/logger.py | south/tests/logger.py | import os
import unittest
import tempfile
from django.conf import settings
from django.db import connection, models
from south.db import db
from south.logger import close_logger
class TestLogger(unittest.TestCase):
"""
Tests if the logging is working reasonably. Some tests ignored if you don't
have writ... | import os
import unittest
import tempfile
from django.conf import settings
from django.db import connection, models
from south.db import db
from south.logger import close_logger
class TestLogger(unittest.TestCase):
"""
Tests if the logging is working reasonably. Some tests ignored if you don't
have writ... | apache-2.0 | Python |
8ace49cfbf835715c9c49c4e02354cd075c187fb | Add synonyms to spacegrids/_config.py | willo12/spacegrids | spacegrids/_config.py | spacegrids/_config.py | import warnings
import numpy as np
import os
# choose from netcdf4, scientificio, scipyio
cdf_lib = 'netcdf4'
#cdf_lib = 'scipyio'
#use_scientificio = False
# Set the path here. This path will be used to find your experiments.
if os.getenv("LOC") == "standard":
# For now, the same behaviour as other locations
hom... | import warnings
import numpy as np
import os
# choose from netcdf4, scientificio, scipyio
cdf_lib = 'netcdf4'
#cdf_lib = 'scipyio'
#use_scientificio = False
# Set the path here. This path will be used to find your experiments.
if os.getenv("LOC") == "standard":
# For now, the same behaviour as other locations
hom... | bsd-3-clause | Python |
55242ee3836fa7a8baa7483d6709c257dc525a15 | Bump version to 2.1.0 | epochblue/nanogen,epochblue/nanogen | nanogen/version.py | nanogen/version.py | __version__ = (2, 1, 0)
version = '.'.join(map(str, __version__))
| __version__ = (2, 0, 1)
version = '.'.join(map(str, __version__))
| mit | Python |
0bf5127953ea2345af424715d064e72b0e85d4ec | Remove unused json | CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,felliott/scrapi,fabianvf/scrapi,erinspace/scrapi,mehanig/scrapi,mehanig/scrapi,erinspace/scrapi,fabianvf/scrapi | scrapi/util.py | scrapi/util.py | from datetime import datetime
import six
import pytz
import logging
logger = logging.getLogger()
def timestamp():
return pytz.utc.localize(datetime.utcnow()).isoformat()
def copy_to_unicode(element):
""" used to transform the lxml version of unicode to a
standard version of unicode that can be pickala... | from datetime import datetime
import six
import json
import pytz
import logging
logger = logging.getLogger()
def timestamp():
return pytz.utc.localize(datetime.utcnow()).isoformat()
def copy_to_unicode(element):
""" used to transform the lxml version of unicode to a
standard version of unicode that ca... | apache-2.0 | Python |
ce9cbc4144c105e9cb59836274ef25a29a9b20a7 | Handle attempts to tag empty shell repos | siggame/webserver,siggame/webserver,siggame/webserver | webserver/codemanagement/tasks.py | webserver/codemanagement/tasks.py | from celery import task
from celery.result import AsyncResult
from .models import TeamSubmission
import logging
logger = logging.getLogger(__name__)
@task()
def create_shellai_tag(instance):
"""Tags the repo's HEAD as "ShellAI" to provide a default tag for
the arena to use"""
team_name = instance.team.... | from celery import task
from celery.result import AsyncResult
from .models import TeamSubmission
import logging
logger = logging.getLogger(__name__)
@task()
def create_shellai_tag(instance):
"""Tags the repo's HEAD as "ShellAI" to provide a default tag for
the arena to use"""
team_name = instance.team.... | bsd-3-clause | Python |
70b0f8bee88298d3b186354c5a373c0ba45c8f6a | Add load_word_list function and chain replace calls | jkvoorhis/cheeseburger_backpack_bot | plugins/plugin_repeat.py | plugins/plugin_repeat.py | from __future__ import unicode_literals
import re
from collections import Counter
from rtmbot.core import Plugin
class PluginRepeat(Plugin):
def __init__(self,slack_client=None, plugin_config=None):
# because of the way plugins are called we must explicitly pass the
# arguments to the super
... | from __future__ import unicode_literals
import re
from collections import Counter
from rtmbot.core import Plugin
class PluginRepeat(Plugin):
def __init__(self,slack_client=None, plugin_config=None):
# because of the way plugins are called we must explicitly pass the
# arguments to the super
... | apache-2.0 | Python |
5e957853fcd7368ddf9d5fdebe812b7605dd1f35 | Remove deprecated patterns | mjumbewu/django-nopassword,relekang/django-nopassword,relekang/django-nopassword,mjumbewu/django-nopassword | nopassword/urls.py | nopassword/urls.py | # -*- coding: utf8 -*-
from django.conf.urls import url
urlpatterns = [
url(r'^login/$', 'nopassword.views.login', name='login'),
url(r'^login-code/(?P<login_code>[a-zA-Z0-9]+)/$',
'nopassword.views.login_with_code'),
url(r'^login-code/(?P<username>[a-zA-Z0-9_@\.-]+)/(?P<login_code>[a-zA-Z0-9]+)/$'... | # -*- coding: utf8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(r'^login/$', 'nopassword.views.login', name='login'),
url(r'^login-code/(?P<login_code>[a-zA-Z0-9]+)/$',
'nopassword.views.login_with_code'),
url(r'^login-code/(?P<username>[a-zA-Z0-9_@\.-]+)/(?P<l... | mit | Python |
a659996c9611008028324df20934dde67dd24550 | fix slug | CARocha/sitioreddes,CARocha/sitioreddes,CARocha/sitioreddes | noticias/models.py | noticias/models.py | #encoding: utf-8
from django.db import models
from ckeditor.fields import RichTextField
from django.template.defaultfilters import slugify
from multimedia.models import Fotos
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.core.urlresolvers import reverse
from ta... | #encoding: utf-8
from django.db import models
from ckeditor.fields import RichTextField
from django.template.defaultfilters import slugify
from multimedia.models import Fotos
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.core.urlresolvers import reverse
from ta... | mit | Python |
cb38133ec520fbad0e99d839d258bfc09c567de2 | Fix test errors | jonathanstallings/data-structures | test_bst.py | test_bst.py | from __future__ import unicode_literals
from bst import Node
from random import randint
import pytest
@pytest.fixture()
def rand_setup():
root = Node(randint(1, 100))
for idx in range(20):
val = randint(1, 100)
try:
root.insert(val)
except AttributeError:
contin... | from __future__ import unicode_literals
from bst import Node
from random import randint
import pytest
@pytest.fixture()
def rand_setup():
root = Node(randint(1, 100))
for idx in range(20):
val = randint(1, 100)
try:
root.insert(val)
except AttributeError:
contin... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.