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
2b614aa7562563833ad17408966dee016be032af
Use correct deadline flag on darwin
mpolden/jarvis2,martinp/jarvis2,mpolden/jarvis2,mpolden/jarvis2,martinp/jarvis2,martinp/jarvis2
jarvis/jobs/uptime.py
jarvis/jobs/uptime.py
#!/usr/bin/env python from jobs import AbstractJob from subprocess import Popen, PIPE from sys import platform class Uptime(AbstractJob): def __init__(self, conf): self.hosts = conf['hosts'] self.interval = conf['interval'] self.timeout = conf.get('timeout', 1) def get(self): ...
#!/usr/bin/env python from jobs import AbstractJob from subprocess import Popen, PIPE class Uptime(AbstractJob): def __init__(self, conf): self.hosts = conf['hosts'] self.interval = conf['interval'] self.timeout = conf.get('timeout', 1) def get(self): hosts = [] for ...
mit
Python
f9d1a34fdd4d8065acb2e9ab9ed4a7b0338b66bd
Fix nested HTML dictionaries. Closes #3314.
YBJAY00000/django-rest-framework,nhorelik/django-rest-framework,callorico/django-rest-framework,potpath/django-rest-framework,werthen/django-rest-framework,atombrella/django-rest-framework,potpath/django-rest-framework,sbellem/django-rest-framework,bluedazzle/django-rest-framework,agconti/django-rest-framework,sehmasch...
rest_framework/utils/html.py
rest_framework/utils/html.py
""" Helpers for dealing with HTML input. """ import re from django.utils.datastructures import MultiValueDict def is_html_input(dictionary): # MultiDict type datastructures are used to represent HTML form input, # which may have more than one value for each key. return hasattr(dictionary, 'getlist') de...
""" Helpers for dealing with HTML input. """ import re from django.utils.datastructures import MultiValueDict def is_html_input(dictionary): # MultiDict type datastructures are used to represent HTML form input, # which may have more than one value for each key. return hasattr(dictionary, 'getlist') de...
bsd-2-clause
Python
12fd6f6a4a2cc121e8fac071dede9e0b0d488908
support django 1.11
ieiayaobb/lushi8,ieiayaobb/lushi8,ieiayaobb/lushi8
web/views.py
web/views.py
import requests from django.http import Http404 from django.shortcuts import render, render_to_response, redirect # Create your views here. from django.template import RequestContext from web.fetch import Fetcher from settings import LEAN_CLOUD_ID, LEAN_CLOUD_SECRET import leancloud # @api_view(('GET',)...
import requests from django.http import Http404 from django.shortcuts import render, render_to_response, redirect # Create your views here. from django.template import RequestContext from web.fetch import Fetcher from settings import LEAN_CLOUD_ID, LEAN_CLOUD_SECRET import leancloud # @api_view(('GET',)...
mit
Python
0254a3fe1180c57bd3596b4b5831398e99849c00
Improve lagging message description (#24208)
commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot
common/realtime.py
common/realtime.py
"""Utilities for reading real time clocks and keeping soft real time constraints.""" import gc import os import time from typing import Optional from setproctitle import getproctitle # pylint: disable=no-name-in-module from common.clock import sec_since_boot # pylint: disable=no-name-in-module, import-error from se...
"""Utilities for reading real time clocks and keeping soft real time constraints.""" import gc import os import time import multiprocessing from typing import Optional from common.clock import sec_since_boot # pylint: disable=no-name-in-module, import-error from selfdrive.hardware import PC, TICI # time step for ea...
mit
Python
ade17d0c100d618c9306738df8dd1e467e3b8e93
change label (plans to tasks)
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
dbaas/djcelery_dbaas/admin.py
dbaas/djcelery_dbaas/admin.py
from django.contrib import admin from djcelery.admin import PeriodicTaskAdmin from djcelery.models import PeriodicTask class PeriodicTaskDbaas(PeriodicTaskAdmin): actions = ['action_enable_plans','action_disable_plans'] def action_enable_plans(self, request, queryset): queryset.update(enabled=True) ...
from django.contrib import admin from djcelery.admin import PeriodicTaskAdmin from djcelery.models import PeriodicTask class PeriodicTaskDbaas(PeriodicTaskAdmin): actions = ['action_enable_plans','action_disable_plans'] def action_enable_plans(self, request, queryset): queryset.update(enabled=True) ...
bsd-3-clause
Python
9457f9ebff4d84f1a6f6b83669dc2aa6a3c1521e
remove .well-known prefix from path
cloudfleet/blimp-wellknown,cloudfleet/blimp-wellknown
wellknown.py
wellknown.py
from flask import Flask, jsonify, request import settings, getopt, sys, os app = Flask(__name__) @app.route('/.well-known/host-meta.json', methods=['GET']) def send_host_meta_json(): return jsonify({ "links": settings.LINKS }) @app.route('/host-meta', methods=['GET']) def send_host_meta_xrd(): re...
from flask import Flask, jsonify, request import settings, getopt, sys, os app = Flask(__name__) @app.route('/.well-known/host-meta.json', methods=['GET']) def send_host_meta_json(): return jsonify({ "links": settings.LINKS }) @app.route('/.well-known/host-meta', methods=['GET']) def send_host_meta_x...
agpl-3.0
Python
d6e87778c82eecc07b73a91d50cc2d9034a4428c
Fix imports for Python 2 & 3 compatibility
suchow/judicious,suchow/judicious,suchow/judicious
judicious/__init__.py
judicious/__init__.py
# -*- coding: utf-8 -*- """Top-level package for judicious.""" __author__ = """Jordan W. Suchow""" __email__ = 'jwsuchow@gmail.com' __version__ = '0.1.0' from .judicious import ( BASE_URL, register, ) __all__ = ( "BASE_URL", "register", )
# -*- coding: utf-8 -*- """Top-level package for judicious.""" __author__ = """Jordan W. Suchow""" __email__ = 'jwsuchow@gmail.com' __version__ = '0.1.0' from judicious import ( BASE_URL, register, ) __all__ = ( "BASE_URL", "register", )
mit
Python
0461581dae5d1f0cb922cddd4bc484e7a1e0dfb7
remove __init__ from pipelines list
audy/cram
metacram/cram_cli.py
metacram/cram_cli.py
#!/usr/bin/env python import sys import os from glob import glob from metacram import * # get list of pipelines # this returns a list of paths to pipelines # pipeline name is the full path minus directories and extension # PIPELINES = { 'name': 'path', ... } this_dir, this_filename = os.path.split(__file__) PIPELINE...
#!/usr/bin/env python import sys import os from glob import glob from metacram import * # get list of pipelines # this returns a list of paths to pipelines # pipeline name is the full path minus directories and extension # PIPELINES = { 'name': 'path', ... } this_dir, this_filename = os.path.split(__file__) PIPELIN...
bsd-3-clause
Python
758b7de1b15cf85df30190c63634167df1a114fb
Clean up
Eric89GXL/vispy,Eric89GXL/vispy,Eric89GXL/vispy
examples/basics/scene/mesh_texture.py
examples/basics/scene/mesh_texture.py
import argparse import numpy as np from vispy import app, scene from vispy.io import imread, load_data_file, read_mesh from vispy.scene.visuals import Mesh from vispy.visuals.filters import TextureFilter parser = argparse.ArgumentParser() parser.add_argument('--shading', default='smooth', choices...
import argparse import numpy as np from vispy import app, scene from vispy.io import imread, load_data_file, read_mesh from vispy.scene.visuals import Mesh from vispy.visuals.filters import TextureFilter parser = argparse.ArgumentParser() parser.add_argument('--shading', default='smooth', choices...
bsd-3-clause
Python
938ea70e284a7ee0562468471ad0368d01112b5d
Allow null hstore fields
alukach/django-hstore-mixin,OspreyInformatics/django-hstore-mixin
django_hstore_mixin/models.py
django_hstore_mixin/models.py
import datetime import json from django.core.exceptions import ValidationError from django.db import models from django_hstore import hstore from django_hstore_mixin.data_types import JsonDict from django_hstore_mixin.serializers import toJson class HstoreMixin(models.Model): """ Data field to be added to model...
import datetime import json from django.core.exceptions import ValidationError from django.db import models from django_hstore import hstore from django_hstore_mixin.data_types import JsonDict from django_hstore_mixin.serializers import toJson class HstoreMixin(models.Model): """ Data field to be added to model...
mit
Python
b12e23dbb70cad868fc07f0686f765865a4d0ca3
Remove redundant sublime.Region call
everyonesdesign/OpenSearchInNewTab
OpenSearchInNewTab.py
OpenSearchInNewTab.py
import re from threading import Timer import sublime_plugin import sublime DEFAULT_NAME = 'Find Results' ALT_NAME_BASE = DEFAULT_NAME + ' ' MAX_QUERY = 16 NEXT_LINE_SYMBOL = 'โ†ฒ' ELLIPSIS = 'โ€ฆ' def truncate(str): return str[:MAX_QUERY].rstrip() + ELLIPSIS if len(str) > MAX_QUERY else str class OpenSearchInNewT...
import re from threading import Timer import sublime_plugin import sublime DEFAULT_NAME = 'Find Results' ALT_NAME_BASE = DEFAULT_NAME + ' ' MAX_QUERY = 16 NEXT_LINE_SYMBOL = 'โ†ฒ' ELLIPSIS = 'โ€ฆ' def truncate(str): return str[:MAX_QUERY].rstrip() + ELLIPSIS if len(str) > MAX_QUERY else str class OpenSearchInNewT...
mit
Python
4c36b2470b7ef4c33a13cf4dfeb3088dce7c934c
Fix example typo
AlienVault-Labs/OTX-Python-SDK
examples/is_malicious/is_malicious.py
examples/is_malicious/is_malicious.py
# This script tells if a File, IP, Domain or URL may be malicious according to the data in OTX from OTXv2 import OTXv2 import argparse import get_malicious import hashlib # Your API key API_KEY = '' OTX_SERVER = 'https://otx.alienvault.com/' otx = OTXv2(API_KEY, server=OTX_SERVER) parser = argparse.ArgumentParser(d...
# This script tells if a File, IP, Domain or URL may be malicious according to the data in OTX from OTXv2 import OTXv2 import argparse import get_malicious import hashlib # Your API key API_KEY = '' OTX_SERVER = 'https://otx.alienvault.com/' otx = OTXv2(API_KEY, server=OTX_SERVER) parser = argparse.ArgumentParser(d...
apache-2.0
Python
317a5e903f5b1c3214c0a03b59cfb36314acd5ed
Allow commands that do not require a permission.
automatron/automatron
twisted/plugins/automatron_control.py
twisted/plugins/automatron_control.py
from twisted.internet import defer from zope.interface import classProvides, implements from automatron.command import IAutomatronCommandHandler from automatron.plugin import IAutomatronPluginFactory, STOP class AutomatronControlPlugin(object): classProvides(IAutomatronPluginFactory) implements(IAutomatronCom...
from twisted.internet import defer from zope.interface import classProvides, implements from automatron.command import IAutomatronCommandHandler from automatron.plugin import IAutomatronPluginFactory, STOP class AutomatronControlPlugin(object): classProvides(IAutomatronPluginFactory) implements(IAutomatronCom...
mit
Python
24b10cbfcfb1334a096463a008c2ada4e23b03fe
Fix the tox tool
allmightyspiff/softlayer-python,softlayer/softlayer-python
SoftLayer/CLI/virt/capacity/__init__.py
SoftLayer/CLI/virt/capacity/__init__.py
"""Manages Reserved Capacity.""" # :license: MIT, see LICENSE for more details. import importlib import os import click CONTEXT = {'help_option_names': ['-h', '--help'], 'max_content_width': 999} class CapacityCommands(click.MultiCommand): """Loads module for capacity related commands. Will aut...
"""Manages Reserved Capacity.""" # :license: MIT, see LICENSE for more details. import importlib import os import click CONTEXT = {'help_option_names': ['-h', '--help'], 'max_content_width': 999} class CapacityCommands(click.MultiCommand): """Loads module for capacity related commands. Will aut...
mit
Python
546bc3d6b25daba9619152183904031bf602f9f2
test archaeo convnet
reinvantveer/Topology-Learning,reinvantveer/Topology-Learning,reinvantveer/Topology-Learning
model/grid_search.py
model/grid_search.py
import os import socket import sys # import numpy as np from sklearn.model_selection import ParameterGrid from topoml_util.slack_send import notify SCRIPT_NAME = os.path.basename(__file__) SCRIPT_VERSION = '1.0.1' SIGNATURE = '{} {} on {}'.format(SCRIPT_NAME, SCRIPT_VERSION, socket.gethostname()) N_TIMES = 1 if len...
import os import socket import sys # import numpy as np from sklearn.model_selection import ParameterGrid from topoml_util.slack_send import notify SCRIPT_NAME = os.path.basename(__file__) SCRIPT_VERSION = '1.0.1' SIGNATURE = '{} {} on {}'.format(SCRIPT_NAME, SCRIPT_VERSION, socket.gethostname()) N_TIMES = 1 if len...
mit
Python
c5f85200315750fbd8fec1fd1eb020cc1216aaaf
Revise time/space complexity
bowen0701/algorithms_data_structures
lc046_permutations.py
lc046_permutations.py
"""Leetcode 46. Permutations Medium URL: https://leetcode.com/problems/permutations/ Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ] """ class Solution(object): def _backtrack(self, pe...
"""Leetcode 46. Permutations Medium URL: https://leetcode.com/problems/permutations/ Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ] """ class Solution(object): def _backtrack(self, pe...
bsd-2-clause
Python
d2a8e54aaf40a3c69a18fb0140ea0309fea713ee
Fix typo
harvitronix/rl-rc-car
rl-rc-car/rccar_server.py
rl-rc-car/rccar_server.py
""" This lets us connect to the Pi that controls the RCCar. It acts as an interface to the RCcar class. """ import socket from rccar import RCCar class RCCarServer: def __init__(self, host='', port=8888, size=1024, backlog=5): print("Setting up server.") self.size = size self.s = socket.so...
""" This lets us connect to the Pi that controls the RCCar. It acts as an interface to the RCcar class. """ import socket from rccar import RCCar class RCCarServer: def __init__(self, host='', port=8888, size=1024, backlog=5): print("Setting up server.") self.size = size self.s = socket.so...
mit
Python
977aeae2bfb8c7c70cd99db7aa23b368e52368b7
Bump version to 0.11.1
diefenbach/lfs-theme,diefenbach/lfs-theme
lfs_theme/__init__.py
lfs_theme/__init__.py
__version__ = "0.11.1"
__version__ = "0.11"
bsd-3-clause
Python
615ca7c6ee8964779240656862e030c1d457e0db
use environment variables to set parameters for postgresql
armijnhemel/binaryanalysis
src/bat/batdb.py
src/bat/batdb.py
#!/usr/bin/python ## Binary Analysis Tool ## Copyright 2015 Armijn Hemel for Tjaldur Software Governance Solutions ## Licensed under Apache 2.0, see LICENSE file for details ''' Abstraction class for BAT databases. Currently supported: sqlite3, postgresql ''' import os.path class BatDb(): def __init__(self, dbback...
#!/usr/bin/python ## Binary Analysis Tool ## Copyright 2015 Armijn Hemel for Tjaldur Software Governance Solutions ## Licensed under Apache 2.0, see LICENSE file for details ''' Abstraction class for BAT databases. Currently supported: sqlite3, postgresql ''' import os.path class BatDb(): def __init__(self, dbback...
apache-2.0
Python
0038ad7cf15a1cb9cd29bc446e91e5cc0144d3c9
Update tests_output.py
RonsenbergVI/trendpy,RonsenbergVI/trendpy
trendpy/tests/tests_output.py
trendpy/tests/tests_output.py
# -*- coding: utf-8 -*- # tests_output.py # MIT License # Copyright (c) 2017 Rene Jean Corneille # 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 lim...
# -*- coding: utf-8 -*- # tests_output.py # MIT License # Copyright (c) 2017 Rene Jean Corneille # 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 lim...
mit
Python
8e16ce1605201187e3618a2f3650951ac40e188e
Make it keyword-only.
mwchase/class-namespaces,mwchase/class-namespaces
class_namespaces/inspector.py
class_namespaces/inspector.py
"""Inspector. Wrapper around objects, helps expose protocols. """ import collections class _Inspector(collections.namedtuple('_Inspector', ['object', 'dict'])): """Wrapper around objects. Provides access to protocold.""" __slots__ = () def __new__(cls, obj, *, mro): dct = collections.ChainMa...
"""Inspector. Wrapper around objects, helps expose protocols. """ import collections class _Inspector(collections.namedtuple('_Inspector', ['object', 'dict'])): """Wrapper around objects. Provides access to protocold.""" __slots__ = () def __new__(cls, obj, mro): dct = collections.ChainMap(*...
mit
Python
b6451ef1f00bdfe1ed2cbbc88526fee4cb50e6ca
Remove signxml requirement (#1081)
cloudify-cosmo/cloudify-manager,cloudify-cosmo/cloudify-manager,cloudify-cosmo/cloudify-manager
rest-service/setup.py
rest-service/setup.py
######## # Copyright (c) 2013 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) 2013 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
7917dadd98207688fb1c40451310c953827c7589
Add comments and contour line label to the decision plot
eliben/deep-learning-samples,eliben/deep-learning-samples
logistic-regression/plot_binary_decision.py
logistic-regression/plot_binary_decision.py
# Helper code to plot a binary decision region. # # Eli Bendersky (http://eli.thegreenplace.net) # This code is in the public domain from __future__ import print_function import matplotlib.pyplot as plt import numpy as np if __name__ == '__main__': # Our input is (x,y) -- 2D. Output is the scalar y^ computed by t...
# Helper code to plot a binary decision region. # # Eli Bendersky (http://eli.thegreenplace.net) # This code is in the public domain from __future__ import print_function import matplotlib.pyplot as plt import numpy as np if __name__ == '__main__': # Note: if we flip all values here we get the same intersection. ...
unlicense
Python
8b27fd2b172373dc8fe59449076b01c332676cf8
Update comment to match example code
matplotlib/basemap,matplotlib/basemap,guziy/basemap,guziy/basemap
doc/users/figures/contour1.py
doc/users/figures/contour1.py
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np # set up orthographic map projection with # perspective of satellite looking down at 45N, 100W. # use low resolution coastlines. map = Basemap(projection='ortho',lat_0=45,lon_0=-100,resolution='l') # draw coastlines, country bou...
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np # set up orthographic map projection with # perspective of satellite looking down at 50N, 100W. # use low resolution coastlines. map = Basemap(projection='ortho',lat_0=45,lon_0=-100,resolution='l') # draw coastlines, country bou...
mit
Python
82a5b0262c3f8d2dd16a860b7d4689b76969b98a
bump version to 0.8.2
ivilata/pymultihash
multihash/version.py
multihash/version.py
__version__ = '0.8.2'
__version__ = '0.9.0.dev1'
mit
Python
d5f75398a80d466c5638b8af5ad254eb6229cd87
Apply homography
superquadratic/beat-bricks
lego.py
lego.py
import numpy as np import cv2 WINDOW_NAME = 'hello' def global_on_mouse(event, x, y, unknown, lego_player): lego_player.on_mouse(event, x, y) class LegoPlayer(object): def __init__(self): self.homography = None self.rect = np.empty((4, 2)) self.rect_index = -1 cv2.namedWindow...
import numpy as np import cv2 WINDOW_NAME = 'hello' def global_on_mouse(event, x, y, unknown, lego_player): lego_player.on_mouse(event, x, y) class LegoPlayer(object): def __init__(self): self.rect = np.empty((4, 2)) self.rect_index = -1 cv2.namedWindow(WINDOW_NAME) cv2.setMo...
mit
Python
64d3bc5190ec101a59891c6a085056bc6a780ff4
remove unnecessary import
CyberReboot/vcontrol,cglewis/vcontrol,CyberReboot/vcontrol,cglewis/vcontrol,CyberReboot/vcontrol,cglewis/vcontrol
vcontrol/rest/commands/plugins/remove.py
vcontrol/rest/commands/plugins/remove.py
from ...helpers import get_allowed import ast import json import subprocess import web class RemovePluginCommandR: """ This endpoint is for removing a new plugin repository on a Vent machine. """ allow_origin, rest_url = get_allowed.get_allowed() def OPTIONS(self): return self.POST() ...
from ...helpers import get_allowed import ast import json import os import subprocess import web class RemovePluginCommandR: """ This endpoint is for removing a new plugin repository on a Vent machine. """ allow_origin, rest_url = get_allowed.get_allowed() def OPTIONS(self): return self.PO...
apache-2.0
Python
6fe5a416ed229e7ec8efab9d6b3dac43f16515b6
Add the new domains db
dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq
corehq/apps/domain/__init__.py
corehq/apps/domain/__init__.py
from corehq.preindex import ExtraPreindexPlugin from django.conf import settings ExtraPreindexPlugin.register('domain', __file__, ( settings.NEW_DOMAINS_DB, settings.NEW_USERS_GROUPS_DB, settings.NEW_FIXTURES_DB, 'meta', ))
from corehq.preindex import ExtraPreindexPlugin from django.conf import settings ExtraPreindexPlugin.register('domain', __file__, ( settings.NEW_USERS_GROUPS_DB, settings.NEW_FIXTURES_DB, 'meta'))
bsd-3-clause
Python
1de53534c48d1eecc7fea5d2040977afd97dacb2
Make sure AVAILABLE_LAYOUTS is a tuple
ghisvail/vispy,drufat/vispy,drufat/vispy,Eric89GXL/vispy,ghisvail/vispy,michaelaye/vispy,Eric89GXL/vispy,drufat/vispy,michaelaye/vispy,ghisvail/vispy,Eric89GXL/vispy,michaelaye/vispy
vispy/visuals/graphs/layouts/__init__.py
vispy/visuals/graphs/layouts/__init__.py
import inspect from .random import random from .circular import circular from .force_directed import fruchterman_reingold _layout_map = { 'random': random, 'circular': circular, 'force_directed': fruchterman_reingold, 'spring_layout': fruchterman_reingold } AVAILABLE_LAYOUTS = tuple(_layout_map.keys...
import inspect from .random import random from .circular import circular from .force_directed import fruchterman_reingold _layout_map = { 'random': random, 'circular': circular, 'force_directed': fruchterman_reingold, 'spring_layout': fruchterman_reingold } AVAILABLE_LAYOUTS = _layout_map.keys() d...
bsd-3-clause
Python
023e3cd0a2ef5717c5923c986690c28d070bdaaa
Update 0001.py
rusia-rak/My-Solutions-For-Show-Me-The-Code
rusia-rak/0001/0001.py
rusia-rak/0001/0001.py
#!/usr/bin/env python3 # This script generates 200 codes of length 10 and writes them to file result.txt # Number varies in range of 0 to 9 inclusive. import random f = open("result.txt", 'w') for _ in range(200): code = '' for _ in range(10): num = random.randint(0,9) code += str(num) f.write(code + '\n')...
#!/usr/bin/env python3 # This script generates 200 codes of length 10 and writes them to file results.txt # Number varies in range of 0 to 9 inclusive. import random f = open("result.txt", 'w') for _ in range(200): code = '' for _ in range(10): num = random.randint(0,9) code += str(num) f.write(code + '\n'...
mpl-2.0
Python
742b35fad64fbf2019877b75bcc92af71ad0bd5a
Fix minor issue with linux install
hamnox/dotfiles,lahwran/dotfiles,lahwran/dotfiles
dotfiles/os_specific/linux.py
dotfiles/os_specific/linux.py
from dotfiles import wrap_process debian_mapping = { "pip": "python-pip", "ntp-daemon": "ntp" } def install_packages(packages): deps = [debian_mapping.get(package, package) for package in packages] wrap_process.call("apt-get", ["apt-get", "install", "-y"] + deps)
from dotfiles import wrap_process debian_mapping = { "git": "git", "vim": "vim", "pip": "python-pip", "fail2ban": "fail2ban", "build-essential": "build-essential", "python-dev": "python-dev", "ntp-daemon": "ntp" } def install_packages(packages): deps = [debian_mapping[package] for pac...
mit
Python
e12432b0c97d1ddebf16df821fe6c77bb8b6a66b
Move Sites to the settings menu (and use decorator syntax for hooks)
mixxorz/wagtail,wagtail/wagtail,KimGlazebrook/wagtail-experiment,gasman/wagtail,mayapurmedia/wagtail,kaedroho/wagtail,jnns/wagtail,serzans/wagtail,hanpama/wagtail,iho/wagtail,marctc/wagtail,kurtw/wagtail,nilnvoid/wagtail,nrsimha/wagtail,gasman/wagtail,jorge-marques/wagtail,Toshakins/wagtail,rsalmaso/wagtail,takeflight/...
wagtail/wagtailsites/wagtail_hooks.py
wagtail/wagtailsites/wagtail_hooks.py
from django.conf.urls import include, url from django.core import urlresolvers from django.utils.translation import ugettext_lazy as _ from wagtail.wagtailcore import hooks from wagtail.wagtailadmin.menu import MenuItem from wagtail.wagtailsites import urls @hooks.register('register_admin_urls') def register_admin_...
from django.conf.urls import include, url from django.core import urlresolvers from django.utils.translation import ugettext_lazy as _ from wagtail.wagtailcore import hooks from wagtail.wagtailadmin.menu import MenuItem from wagtail.wagtailsites import urls def register_admin_urls(): return [ url(r'^sit...
bsd-3-clause
Python
89b567c199ccf4835afa90ac9370191038918ed2
Create method to open and release a connection from pyramid to the db.
bm5w/learning-journal,bm5w/learning-journal
journal.py
journal.py
# -*- coding: utf-8 -*- import os import logging from pyramid.config import Configurator from pyramid.session import SignedCookieSessionFactory from pyramid.view import view_config from waitress import serve import psycopg2 from contextlib import closing from pyramid.events import NewRequest, subscriber DB_SCHEMA = "...
# -*- coding: utf-8 -*- import os import logging from pyramid.config import Configurator from pyramid.session import SignedCookieSessionFactory from pyramid.view import view_config from waitress import serve import psycopg2 from contextlib import closing DB_SCHEMA = """ CREATE TABLE IF NOT EXISTS entries ( id seri...
mit
Python
4103384be8a7407c92711bf2f6652cc36a0efbe4
Add doc string to cmd module
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/functions/cmd.py
salt/functions/cmd.py
''' Module for shelling out commands, inclusion of this module should be configurable for security reasons '''
apache-2.0
Python
377dcc76ebd986154070a220b2b035b275085090
Change server error email domain.
bboe/update_checker_app
update_checker_app/helpers.py
update_checker_app/helpers.py
"""Defines various one-off helpers for the package.""" from functools import wraps from time import time import requests def configure_logging(app): """Send ERROR log to ADMINS emails.""" ADMINS = ['bbzbryce@gmail.com'] if not app.debug: import logging from logging.handlers import SMTPHand...
"""Defines various one-off helpers for the package.""" from functools import wraps from time import time import requests def configure_logging(app): """Send ERROR log to ADMINS emails.""" ADMINS = ['bbzbryce@gmail.com'] if not app.debug: import logging from logging.handlers import SMTPHand...
bsd-2-clause
Python
85db19ec07f70ed6fdc19b5c5eecfb45eedded28
Update Adafruit16CServoDriverPi.py
MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab
home/Mats/Adafruit16CServoDriverPi.py
home/Mats/Adafruit16CServoDriverPi.py
webgui = Runtime.createAndStart("WebGui","WebGui") # Create and start the RasPi raspi = Runtime.createAndStart("RasPi","RasPi") # Start the Adafruit16CServidriver that can be used for all PCA9685 devices # and connect it to the Arduino i2c interface using the default bus and # address adaFruit16c = Runtime.createAndSta...
webgui = Runtime.createAndStart("WebGui","WebGui") # Create and start the RasPi raspi = Runtime.createAndStart("RasPi","RasPi") # Start the Adafruit16CServidriver that can be used for all PCA9685 devices # and connect it to the Arduino i2c interface using the default bus and # address adaFruit16c = Runtime.createAndSta...
apache-2.0
Python
cbb914476696c32988a3ab661c7c6babd5f436fd
Remove utests for exposed parsing APIs that have been removed
HelioGuilherme66/robotframework,robotframework/robotframework,HelioGuilherme66/robotframework,robotframework/robotframework,robotframework/robotframework,HelioGuilherme66/robotframework
utest/api/test_exposed_api.py
utest/api/test_exposed_api.py
import unittest from os.path import abspath, join from robot import api, model, reporting, result, running from robot.utils.asserts import assert_equal, assert_true class TestExposedApi(unittest.TestCase): def test_execution_result(self): assert_equal(api.ExecutionResult, result.ExecutionResult) ...
import unittest from os.path import abspath, join from robot import api, model, parsing, reporting, result, running from robot.utils.asserts import assert_equal, assert_true class TestExposedApi(unittest.TestCase): def test_test_case_file(self): assert_equal(api.TestCaseFile, parsing.TestCaseFile) ...
apache-2.0
Python
6b2fca4549783e7ca89583948a98434d0047136c
Update "unicode_to_ascii.py" utility.
colour-science/colour-hdri
utilities/unicode_to_ascii.py
utilities/unicode_to_ascii.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Unicode to ASCII Utility ======================== """ import sys if sys.version_info[0] < 3: # Smelly hack for Python 2.x: https://stackoverflow.com/q/3828723/931625 reload(sys) # noqa sys.setdefaultencoding('utf-8') import codecs import os import unicode...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Unicode to ASCII Utility ======================== """ import sys if sys.version_info[0] < 3: # Smelly hack for Python 2.x: https://stackoverflow.com/q/3828723/931625 reload(sys) # noqa sys.setdefaultencoding('utf-8') import codecs import os import unicode...
bsd-3-clause
Python
efd4b69a95d4bd18e675a8211def3e8b29752024
Fix type in authors.
rschnapka/hr,charbeljc/hr,vrenaville/hr,Eficent/hr,raycarnes/hr,VitalPet/hr,yelizariev/hr,microcom/hr,abstract-open-solutions/hr,damdam-s/hr,hbrunn/hr,Antiun/hr,yelizariev/hr,xpansa/hr,open-synergy/hr,microcom/hr,iDTLabssl/hr,Antiun/hr,VitalPet/hr,hbrunn/hr,Eficent/hr,charbeljc/hr,vrenaville/hr,abstract-open-solutions/...
hr_contract_multi_jobs/__openerp__.py
hr_contract_multi_jobs/__openerp__.py
# -*- coding:utf-8 -*- ############################################################################## # # Copyright (C) 2014 Savoir-faire Linux. All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as publish...
# -*- coding:utf-8 -*- ############################################################################## # # Copyright (C) 2014 Savoir-faire Linux. All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as publish...
agpl-3.0
Python
5bd8e58785773a9a43bba6956dd8d236da36ab66
Remove debug print statement
SysTheron/adhocracy,DanielNeugebauer/adhocracy,alkadis/vcv,SysTheron/adhocracy,DanielNeugebauer/adhocracy,alkadis/vcv,SysTheron/adhocracy,phihag/adhocracy,liqd/adhocracy,phihag/adhocracy,liqd/adhocracy,DanielNeugebauer/adhocracy,phihag/adhocracy,liqd/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,DanielNeugebauer/adh...
adhocracy/lib/tiles/badge_tiles.py
adhocracy/lib/tiles/badge_tiles.py
def badge(badge): from adhocracy.lib.templating import render_def return render_def('/badge/tiles.html', 'badge', badge=badge, cached=True) def badges(badges): from adhocracy.lib.templating import render_def return render_def('/badge/tiles.html', 'badges', badges=badges, ...
def badge(badge): from adhocracy.lib.templating import render_def return render_def('/badge/tiles.html', 'badge', badge=badge, cached=True) def badges(badges): from adhocracy.lib.templating import render_def return render_def('/badge/tiles.html', 'badges', badges=badges, ...
agpl-3.0
Python
a3004d2de9c15b9d7efebb98ea6533a1a6e07062
Improve dispatch of actions in main
fancystats/nhlstats
nhlstats/__init__.py
nhlstats/__init__.py
import logging from version import __version__ logger = logging.getLogger(__name__) logger.debug('Loading %s ver %s' % (__name__, __version__)) # Actions represents the available textual items that can be passed to main # to drive dispatch. These should be all lower case, no spaces or underscores. actions = [ ...
import logging from version import __version__ logger = logging.getLogger(__name__) logger.debug('Loading %s ver %s' % (__name__, __version__)) # Actions represents the available textual items that can be passed to main # to drive dispatch. These should be all lower case, no spaces or underscores. actions = [ ...
mit
Python
39e6cc46486ef603db977eedf5d8a87ce526fe47
Fix #4073, the versions, if from git, can be compared without
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/runners/manage.py
salt/runners/manage.py
''' General management functions for salt, tools like seeing what hosts are up and what hosts are down ''' import distutils.version # Import salt libs import salt.key import salt.client import salt.output def status(output=True): ''' Print the status of all known salt minions ''' client = salt.clien...
''' General management functions for salt, tools like seeing what hosts are up and what hosts are down ''' import distutils.version # Import salt libs import salt.key import salt.client import salt.output def status(output=True): ''' Print the status of all known salt minions ''' client = salt.clien...
apache-2.0
Python
472dd5d5d97dbb9860e1d2a132217b4080db2a5c
Bump catalog version
edgedb/edgedb,edgedb/edgedb,edgedb/edgedb
edb/server/defines.py
edb/server/defines.py
# # This source file is part of the EdgeDB open source project. # # Copyright 2016-present MagicStack Inc. and the EdgeDB authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http...
# # This source file is part of the EdgeDB open source project. # # Copyright 2016-present MagicStack Inc. and the EdgeDB authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http...
apache-2.0
Python
1ffaf904b2d66e5da2fd0d0171802b347273d0b4
Update run.py
ngoduykhanh/PowerDNS-Admin,ngoduykhanh/PowerDNS-Admin,ngoduykhanh/PowerDNS-Admin,ngoduykhanh/PowerDNS-Admin
run.py
run.py
#!/usr/bin/env python3 from app import app from config import PORT from config import BIND_ADDRESS if __name__ == '__main__': app.run(debug = True, host=BIND_ADDRESS, port=PORT)
#!/usr/bin/env python3 from app import app from config import PORT from config import BIND_ADDRESS if __name__ == '__main__': app.run(debug = True, host=BIND_ADDRESS, port=PORT, use_reloader=False)
mit
Python
3ef9916c99003ceba71d9d54a7ba86747f09b714
fix comment
rapidpro/dash,peterayeni/dash,rapidpro/dash,peterayeni/dash,caktus/dash,caktus/dash
dash/orgs/tasks.py
dash/orgs/tasks.py
import logging import time from celery import shared_task from django_redis import get_redis_connection from .models import Invitation, Org logger = logging.getLogger(__name__) @shared_task(track_started=True, name='send_invitation_email_task') def send_invitation_email_task(invitation_id): invitation = Invit...
import logging import time from celery import shared_task from django_redis import get_redis_connection from .models import Invitation, Org logger = logging.getLogger(__name__) @shared_task(track_started=True, name='send_invitation_email_task') def send_invitation_email_task(invitation_id): invitation = Invit...
bsd-3-clause
Python
91065cd14998855853f207f81af93c747bb54753
add daemon() option
USCC-LAB/Weekly
scheduler/scheduler.py
scheduler/scheduler.py
import sched, time, datetime, threading class Scheduler: def __init__(self, timef = time.time, delayf = time.sleep): self.sched_obj = sched.scheduler(timef, delayf) def show(self): print('*' * 20) print('Total Event Number: %d\n' %len(self.sched_obj.queue)) for index, item in e...
import sched, time, datetime class Scheduler: def __init__(self, timef = time.time, delayf = time.sleep): self.sched_obj = sched.scheduler(timef, delayf) def show(self): print('*' * 20) print('Total Event Number: %d\n' %len(self.sched_obj.queue)) for index, item in enumerate(se...
apache-2.0
Python
b4cdb38c92210fc0c909ea8f0622654972a4886a
use __all__ to bypass unused import
awesto/django-shop,nimbis/django-shop,nimbis/django-shop,khchine5/django-shop,khchine5/django-shop,awesto/django-shop,divio/django-shop,nimbis/django-shop,divio/django-shop,nimbis/django-shop,divio/django-shop,khchine5/django-shop,awesto/django-shop,khchine5/django-shop
shop/money/serializers.py
shop/money/serializers.py
# -*- coding: utf-8 -*- """ Override django.core.serializers.json.Serializer which renders our MoneyType as float. """ from __future__ import unicode_literals import json from django.core.serializers.json import DjangoJSONEncoder, Serializer as DjangoSerializer from django.core.serializers.json import Deserializer fro...
# -*- coding: utf-8 -*- """ Override django.core.serializers.json.Serializer which renders our MoneyType as float. """ from __future__ import unicode_literals import json from django.core.serializers.json import DjangoJSONEncoder, Serializer as DjangoSerializer from django.core.serializers.json import Deserializer # n...
bsd-3-clause
Python
6689858b2364a668b362a5f00d4c86e57141dc37
Reorder FloatModel checks in ascending order
cpcloud/numba,numba/numba,numba/numba,seibert/numba,cpcloud/numba,cpcloud/numba,seibert/numba,seibert/numba,cpcloud/numba,numba/numba,IntelLabs/numba,numba/numba,IntelLabs/numba,cpcloud/numba,seibert/numba,IntelLabs/numba,IntelLabs/numba,seibert/numba,IntelLabs/numba,numba/numba
numba/cuda/models.py
numba/cuda/models.py
from llvmlite import ir from numba.core.datamodel.registry import register_default from numba.core.extending import register_model, models from numba.core import types from numba.cuda.types import Dim3, GridGroup, CUDADispatcher @register_model(Dim3) class Dim3Model(models.StructModel): def __init__(self, dmm, f...
from llvmlite import ir from numba.core.datamodel.registry import register_default from numba.core.extending import register_model, models from numba.core import types from numba.cuda.types import Dim3, GridGroup, CUDADispatcher @register_model(Dim3) class Dim3Model(models.StructModel): def __init__(self, dmm, f...
bsd-2-clause
Python
385a88f22d0ff4f850a3ca6c60403d7d3e426ae3
Bump version to 1.14.0
open-io/oio-swift,open-io/oio-swift
oioswift/__init__.py
oioswift/__init__.py
__version__ = '1.14.0'
__version__ = '1.13.0'
apache-2.0
Python
5d9356ef82af6b377f8fe4c4982724cf273624a8
Fix popular
RiiConnect24/File-Maker,RiiConnect24/File-Maker
Channels/Check_Mii_Out_Channel/popular.py
Channels/Check_Mii_Out_Channel/popular.py
from cmoc import QuickList, Prepare import MySQLdb from json import load from time import sleep with open("/var/rc24/File-Maker/Channels/Check_Mii_Out_Channel/config.json", "r") as f: config = load(f) # gets the most popular miis ordered by their volatile likes which resets to 0 when spot_list resets ql = QuickLi...
from cmoc import QuickList, Prepare import MySQLdb from json import load from time import sleep with open("/var/rc24/File-Maker/Channels/Check_Mii_Out_Channel/config.json", "r") as f: config = load(f) # gets the most popular miis ordered by their volatile likes which resets to 0 when spot_list resets ql = QuickLi...
agpl-3.0
Python
4dc7fef8d244ce0964ec3949fe99f70344f268e4
Kill noisy debug log
HumanDynamics/OpenBadge,HumanDynamics/OpenBadge,HumanDynamics/OpenBadge,HumanDynamics/OpenBadge
IntegrationTests/test_5_record_no_gaps.py
IntegrationTests/test_5_record_no_gaps.py
import time from integration_test import * from BadgeFramework.badge import timestamps_to_time TEST_LENGTH_SECONDS = 3 * 60; SAMPLE_PERIOD_MS = 50 SAMPLES_PER_SECOND = 1000 / SAMPLE_PERIOD_MS # Maximum allowed delay between recording start command sent and first sample recorded in seconds. MAX_ALLOWED_STARTUP_DELAY =...
import time from integration_test import * from BadgeFramework.badge import timestamps_to_time TEST_LENGTH_SECONDS = 5 * 60; SAMPLE_PERIOD_MS = 50 SAMPLES_PER_SECOND = 1000 / SAMPLE_PERIOD_MS # Maximum allowed delay between recording start command sent and first sample recorded in seconds. MAX_ALLOWED_STARTUP_DELAY =...
mit
Python
b865cfa3bdd19f93993f832b7218aead84532153
Improve gdb build; depend on python.
BreakawayConsulting/xyz
rules/gdb.py
rules/gdb.py
import xyz import os import shutil class Gdb(xyz.BuildProtocol): crosstool = True pkg_name = 'gdb' supported_targets = ['arm-none-eabi'] deps = ['texinfo', 'python'] def check(self, config): target = config.get('target') if target not in self.supported_targets: raise xy...
import xyz import os import shutil class Gdb(xyz.BuildProtocol): pkg_name = 'gdb' supported_targets = ['arm-none-eabi'] deps = ['expat'] def check(self, builder): if builder.target not in self.supported_targets: raise xyz.UsageError("Invalid target ({}) for {}".format(builder.targe...
mit
Python
ae8a0416dcdbb908cd592cd43422a45333d567ff
Add missing import
mattupstate/flask-social-example,rmelly/flask-social-example,rmelly/flask-social-example,mattupstate/flask-social-example,mattupstate/flask-social-example,talizon/flask-social-example,talizon/flask-social-example,talizon/flask-social-example,rmelly/flask-social-example
wsgi.py
wsgi.py
import os from app import create_app application = create_app() if __name__ == '__main__': port = int(os.environ.get('PORT', 5000)) application.run(host='0.0.0.0', port=port)
from app import create_app application = create_app() if __name__ == '__main__': port = int(os.environ.get('PORT', 5000)) application.run(host='0.0.0.0', port=port)
mit
Python
4a650922ee97b9cb54b203cab9709d511487d9ff
Add factory for the Provider model
PressLabs/silver,PressLabs/silver,PressLabs/silver
silver/tests/factories.py
silver/tests/factories.py
import factory from silver.models import Provider class ProviderFactory(factory.django.DjangoModelFactory): class Meta: model = Provider
"""Factories for the silver app.""" # import factory # from .. import models
apache-2.0
Python
bc279265f1e266ac2601c655d1ba37a8403aeba0
test rsa
ffee21/samil,ffee21/samil,ffee21/samil
runserver.py
runserver.py
from waitress import serve from samil import app # app.run(debug=True, host="0.0.0.0", port=8080) serve(app, port=8080) # test
from waitress import serve from samil import app # app.run(debug=True, host="0.0.0.0", port=8080) serve(app, port=8080)
mit
Python
8c4c8e6bbee7cc73a94a566e2a89829e737ddc52
update code stats script
commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot
scripts/code_stats.py
scripts/code_stats.py
#!/usr/bin/env python3 import os import ast import stat import subprocess fouts = set([x.decode('utf-8') for x in subprocess.check_output(['git', 'ls-files']).strip().split()]) pyf = [] for d in ["cereal", "common", "scripts", "selfdrive", "tools"]: for root, dirs, files in os.walk(d): for f in files: if ...
#!/usr/bin/env python3 import os import ast import stat import subprocess fouts = set([x.decode('utf-8') for x in subprocess.check_output(['git', 'ls-files']).strip().split()]) pyf = [] for d in ["cereal", "common", "scripts", "selfdrive", "tools"]: for root, dirs, files in os.walk(d): for f in files: if ...
mit
Python
3a05e26f843867bbfe8d68c500b227c2d011b03f
Add response headers logging
steven-lee-qadium/django-request-logging,rhumbixsf/django-request-logging,Rhumbix/django-request-logging
request_logging/middleware.py
request_logging/middleware.py
import logging import re from django.utils.termcolors import colorize from django.utils.deprecation import MiddlewareMixin MAX_BODY_LENGTH = 50000 # log no more than 3k bytes of content request_logger = logging.getLogger('django.request') class LoggingMiddleware(MiddlewareMixin): def process_request(self, requ...
import logging import re from django.utils.termcolors import colorize from django.utils.deprecation import MiddlewareMixin MAX_BODY_LENGTH = 50000 # log no more than 3k bytes of content request_logger = logging.getLogger('django.request') class LoggingMiddleware(MiddlewareMixin): def process_request(self, requ...
mit
Python
f63d451d5f3351c5f8f0b74285eaf7bebd1062bb
Move default config file location to /tmp to avoid access problems
fgrsnau/sipa,agdsn/sipa,agdsn/sipa,MarauderXtreme/sipa,agdsn/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,MarauderXtreme/sipa,lukasjuhrich/sipa,agdsn/sipa,fgrsnau/sipa,MarauderXtreme/sipa,fgrsnau/sipa
sipa/default_config.py
sipa/default_config.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ all configuration options and dicts of external information (dormitory mapping etc.) Project-specific options should be included in the `config_local.py`, which is a file not tracked in git containing IPs, user names, passwords, etc. """ from flask.ext.babel import ge...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ all configuration options and dicts of external information (dormitory mapping etc.) Project-specific options should be included in the `config_local.py`, which is a file not tracked in git containing IPs, user names, passwords, etc. """ from flask.ext.babel import ge...
mit
Python
ce386516eef2ded1ddd8ed45c07d7e0b5f751c3a
Fix a bug where batch creators were not stored properly
ImageMarkup/isic-archive,ImageMarkup/isic-archive,ImageMarkup/isic-archive,ImageMarkup/isic-archive
server/models/batch.py
server/models/batch.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright Kitware 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 ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright Kitware 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 ...
apache-2.0
Python
8d7c283768dbb42487c3fc1fbe72c977a42ab165
load configs from config file
googleinterns/cloud-monitoring-notification-delivery-integration-sample-code,googleinterns/cloud-monitoring-notification-delivery-integration-sample-code
main.py
main.py
# Copyright 2019 Google, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2019 Google, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
apache-2.0
Python
086b5ecd90c65e975d138cc3ac396dd3bb84a1df
Remove comment from codebase. I hate comments.
AmosGarner/PyInventory
main.py
main.py
from editCollection import editCollection from ObjectFactories.ItemFactory import ItemFactory from osOps import * from collectionOps import * import datetime, argparse CONST_COLLECTIONS_NAME = 'collections' def generateArgumentsFromParser(): parser = parser = argparse.ArgumentParser(description="Runs the PyInvent...
from editCollection import editCollection from ObjectFactories.ItemFactory import ItemFactory from osOps import * from collectionOps import * import datetime, argparse CONST_COLLECTIONS_NAME = 'collections' def generateArgumentsFromParser(): parser = parser = argparse.ArgumentParser(description="Runs the PyInvent...
apache-2.0
Python
431c88741ef324ef4801d69ebad905ccfa096eab
Add reference to LICENSE
ohyou/vk-poster
main.py
main.py
''' For licence, see: LICENSE ''' import http.client, sys, json, os, vk, datetime, time, imghdr import requests as r from PIL import Image class Connection: def __init__(self): self.established = False self.attempts = 0 self.vkapi = None # API requests here def authorize(self): if os.path.exists("access...
import http.client, sys, json, os, vk, datetime, time, imghdr import requests as r from PIL import Image class Connection: def __init__(self): self.established = False self.attempts = 0 self.vkapi = None # API requests here def authorize(self): if os.path.exists("access_token"): file = open("access_tok...
mit
Python
2ada5466f18c5f342dfece46281f806e8f9cdc8b
Use a threading instead of a forking server
Foxboron/HyREPL,Foxboron/HyREPL
main.py
main.py
import time import sys from HyREPL.session import Session from HyREPL import bencode import threading from socketserver import ThreadingMixIn, ForkingMixIn, TCPServer, BaseRequestHandler class ReplServer(ThreadingMixIn, TCPServer): pass sessions = {} class ReplRequestHandler(BaseRequestHandler): session = None ...
import time import sys from HyREPL.session import Session from HyREPL import bencode import threading from socketserver import ForkingMixIn, TCPServer, BaseRequestHandler class ReplServer(ForkingMixIn, TCPServer): pass sessions = {} class ReplRequestHandler(BaseRequestHandler): session = None def handle(se...
mit
Python
752d3b5c1301d4acd1539831fd03abd63ac19cf5
Switch between two different lists.
philsc/vbox-tui
main.py
main.py
#!/usr/bin/env python import urwid class VMWidget (urwid.WidgetWrap): def __init__ (self, state, name): self.state = state self.content = name self.item = urwid.AttrMap( urwid.Text('%-15s %s' % (state, name)), 'body', 'focus' ) self.__super.__init_...
#!/usr/bin/env python import urwid class VMWidget (urwid.WidgetWrap): def __init__ (self, state, name): self.state = state self.content = name self.item = urwid.AttrMap( urwid.Text('%-15s %s' % (state, name)), 'body', 'focus' ) self.__super.__init_...
mit
Python
805536cc2e30da3eb676f86b3382e592e616b793
rename install function
AmosGarner/PyInventory
main.py
main.py
from createCollection import createCollectionFile from updateCollection import updateCollection, getCollectionLength from removeCollection import removeCollection from editCollection import editCollection from ObjectFactories.ItemFactory import ItemFactory from DataObjects.Collection import Collection from osOps import...
from createCollection import createCollectionFile from updateCollection import updateCollection, getCollectionLength from removeCollection import removeCollection from editCollection import editCollection from ObjectFactories.ItemFactory import ItemFactory from DataObjects.Collection import Collection from osOps import...
apache-2.0
Python
ac16841a56450954fc566bd1a2997bf78c3ac195
Fix error during start (related to sprofile folder)
UPOLSearch/UPOL-Search-Engine,UPOLSearch/UPOL-Search-Engine,UPOLSearch/UPOL-Search-Engine,UPOLSearch/UPOL-Search-Engine
main.py
main.py
import datetime import shutil from time import sleep import pymongo from celery.app.control import Control from crawler import crawler, tasks from crawler.celery import app from crawler.db import db_mongodb as db from crawler.settings import * print("******************************") print("UPOL-Crawler v" + CONFIG.ge...
import datetime import shutil from time import sleep import pymongo from celery.app.control import Control from crawler import crawler, tasks from crawler.celery import app from crawler.db import db_mongodb as db from crawler.settings import * print("******************************") print("UPOL-Crawler v" + CONFIG.ge...
mit
Python
6c3561f43d5e3e5b9b824ac49898d831af81efd4
change name
AliGhahraei/nao-classroom
main.py
main.py
import sys import motion import almath import time from naoqi import ALProxy def StiffnessOn(proxy): #We use the "Body" name to signify the collection of all joints pNames = "Body" pStiffnessLists = 1.0 pTimeLists = 1.0 proxy.stiffnessInterpolation(pNames, pStiffnessLists, pTimeLists) def main(robotIP): ...
import sys import motion import almath import time from naoqi import ALProxy def StiffnessOn(proxy): #We use the "Body" name to signify the collection of all joints pNames = "Body" pStiffnessLists = 1.0 pTimeLists = 1.0 proxy.stiffnessInterpolation(pNames, pStiffnessLists, pTimeLists) def main(robotIP): ...
mit
Python
9a51358871f04e2a5552621b6ac2c9dbe1ee8345
Save temporary pictures to local directory
jollex/SnapchatBot
main.py
main.py
!/usr/bin/env python from pysnap import Snapchat import secrets s = Snapchat() s.login(secrets.USERNAME, secrets.PASSWORD) friends_to_add = [friend['name'] for friend in s.get_updates()['added_friends'] if friend['type'] == 1] for friend in friends_to_add: s.add_friend(friend) snaps = [snap['id'] for snap in s....
#!/usr/bin/env python from pysnap import Snapchat import secrets s = Snapchat() s.login(secrets.USERNAME, secrets.PASSWORD) friends_to_add = [friend['name'] for friend in s.get_updates()['added_friends'] if friend['type'] == 1] for friend in friends_to_add: s.add_friend(friend) snaps = [snap['id'] for snap in s...
mit
Python
3ba97ec3f98d9b40c0681cd6550d0fbd1ec4f626
create a base handler class to deal with templates
thiago6891/ai-experiments,thiago6891/ai-experiments
main.py
main.py
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
mit
Python
da30c13891bc4180d7bf8d94059b5cdbc88db1ed
update main
HeavenH/teleGit
main.py
main.py
from GitApi import GitHub import configparser from telegram.ext import Updater, CommandHandler # Configuraรงรฃo do Bot config = configparser.ConfigParser() config.read_file(open('config.ini')) # Conectando a API do telegram # Updater pegarรก as informaรงรตes e dispatcher conectarรก a mensagem ao bot up = Update...
import configparser from requests import get from json import loads from telegram.ext import Updater, CommandHandler #Configuraรงรฃo do Bot config = configparser.ConfigParser() config.read_file(open('config.ini')) #Conectando a API do telegram #Updater pegarรก as informaรงรตes e dispatcher conectarรก a mensagem...
mit
Python
565861256c9cf0f41217df13c4244315b4ebd74d
Remove deprecation warning by using new style item pipeline definition
verylasttry/portia,amikey/portia,pombredanne/portia,chennqqi/portia,NoisyText/portia,NoisyText/portia,hmilywb/portia,flip111/portia,NoisyText/portia,nju520/portia,asa1253/portia,NicoloPernigo/portia,amikey/portia,CENDARI/portia,naveenvprakash/portia,PrasannaVenkadesh/portia,CENDARI/portia,lodow/portia-proxy,nju520/port...
slybot/slybot/settings.py
slybot/slybot/settings.py
SPIDER_MANAGER_CLASS = 'slybot.spidermanager.SlybotSpiderManager' EXTENSIONS = {'slybot.closespider.SlybotCloseSpider': 1} ITEM_PIPELINES = {'slybot.dupefilter.DupeFilterPipeline': 1} SPIDER_MIDDLEWARES = {'slybot.spiderlets.SpiderletsMiddleware': 999} # as close as possible to spider output SLYDUPEFILTER_ENABLED = Tru...
SPIDER_MANAGER_CLASS = 'slybot.spidermanager.SlybotSpiderManager' EXTENSIONS = {'slybot.closespider.SlybotCloseSpider': 1} ITEM_PIPELINES = ['slybot.dupefilter.DupeFilterPipeline'] SPIDER_MIDDLEWARES = {'slybot.spiderlets.SpiderletsMiddleware': 999} # as close as possible to spider output SLYDUPEFILTER_ENABLED = True P...
bsd-3-clause
Python
04a5d2fb004625379ef58a4e5ea10a837c28c1bc
Sort articles in main page by time
xenx/recommendation_system,xenx/recommendation_system
data/data_utils.py
data/data_utils.py
#!/usr/bin/env python # coding=utf-8 import os from pymongo import MongoClient import random class TvrainData(): def __init__(self): """ Just load data from Mongo. """ self.sequences = MongoClient(os.environ['MONGODB_URL']).tvrain.sequences self.collection = MongoClient(os....
#!/usr/bin/env python # coding=utf-8 import os from pymongo import MongoClient import random class TvrainData(): def __init__(self): """ Just load data from Mongo. """ self.sequences = MongoClient(os.environ['MONGODB_URL']).tvrain.sequences self.collection = MongoClient(os....
mit
Python
67d63a4a5bc4f1d61f50d3f6e933f2898f218caf
check for updates every day
dmpetrov/dataversioncontrol,efiop/dvc,dataversioncontrol/dvc,dmpetrov/dataversioncontrol,dataversioncontrol/dvc,efiop/dvc
dvc/updater.py
dvc/updater.py
import os import time import requests from dvc import VERSION_BASE from dvc.logger import Logger class Updater(object): URL = 'https://4ki8820rsf.execute-api.us-east-2.amazonaws.com/' \ 'prod/latest-version' UPDATER_FILE = 'updater' TIMEOUT = 24 * 60 * 60 # every day TIMEOUT_GET = 10 ...
import os import time import requests from dvc import VERSION_BASE from dvc.logger import Logger class Updater(object): URL = 'https://4ki8820rsf.execute-api.us-east-2.amazonaws.com/' \ 'prod/latest-version' UPDATER_FILE = 'updater' TIMEOUT = 7 * 24 * 60 * 60 # every week TIMEOUT_GET = 10 ...
apache-2.0
Python
a42d4f2c90ae604d6cb98bfc37c1fef9840b5ff9
bump to 0.82.3
dmpetrov/dataversioncontrol,dmpetrov/dataversioncontrol,efiop/dvc,efiop/dvc
dvc/version.py
dvc/version.py
# Used in setup.py, so don't pull any additional dependencies # # Based on: # - https://github.com/python/mypy/blob/master/mypy/version.py # - https://github.com/python/mypy/blob/master/mypy/git.py import os import subprocess _BASE_VERSION = "0.82.3" def _generate_version(base_version): """Generate a versio...
# Used in setup.py, so don't pull any additional dependencies # # Based on: # - https://github.com/python/mypy/blob/master/mypy/version.py # - https://github.com/python/mypy/blob/master/mypy/git.py import os import subprocess _BASE_VERSION = "0.82.2" def _generate_version(base_version): """Generate a versio...
apache-2.0
Python
9f8bd896ddbde017574ef98e09cbc76b21e9a4b0
swap documentation for lerp and norm (oops)
davelab6/drawbotlab,djrrb/drawbotlab
math.py
math.py
# MATH HELPERS def lerp(start, stop, amt): """ Return the interpolation factor (between 0 and 1) of a VALUE between START and STOP. https://processing.org/reference/lerp_.html """ return float(amt-start) / float(stop-start) def norm(value, start, stop): """ Interpolate. Get Interpolated value, between zero a...
# MATH HELPERS def lerp(start, stop, amt): """ Get Interpolated value. https://processing.org/reference/lerp_.html """ return float(amt-start) / float(stop-start) def norm(value, start, stop): """ Interpolate. Return the interpolation factor (between 0 and 1) of a VALUE between START and STOP. See also: htt...
mit
Python
c596b30999a8743e6f16cf7eadceca72a0f82c2b
fix if statements to exit properly.
constanthatz/network_tools
echo_server.py
echo_server.py
#!/usr/bin/env python from __future__ import print_function import socket import email.utils def server_socket_function(): server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_IP) server_socket.bind(('127.0.0.1', 50000)) server_socket.listen(1) try: while True: ...
#!/usr/bin/env python from __future__ import print_function import socket import email.utils def server_socket_function(): server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_IP) server_socket.bind(('127.0.0.1', 50000)) server_socket.listen(1) try: while True: ...
mit
Python
a68f4ddf71584a53fca39a28f008f7657a485f44
add extra fields in seller_form
tejesh95/Zubio.in,tejesh95/Zubio.in,tejesh95/Zubio.in
sellapp/app1/views.py
sellapp/app1/views.py
from django.shortcuts import render from django.http import HttpResponse from datetime import datetime from elasticsearch import Elasticsearch from django import forms es = Elasticsearch() class SellerForm(forms.Form): prod_description = forms.CharField( label='Looking for buyers interested in..', max_le...
from django.shortcuts import render from django.http import HttpResponse from datetime import datetime from elasticsearch import Elasticsearch from django import forms es = Elasticsearch() class SellerForm(forms.Form): prod_description = forms.CharField(label='Looking for buyers interested in..',max_length=5000) #...
mit
Python
c1120bd8a1b91ba2903515b18ea50ca6aaf0bce7
Add method custom.check.CheckBox.Reset
AntumDeluge/desktop_recorder,AntumDeluge/desktop_recorder
source/custom/check.py
source/custom/check.py
# -*- coding: utf-8 -*- ## \package custom.check # MIT licensing # See: LICENSE.txt import wx ## wx.CheckBox class that defines a 'Default' attribute class CheckBox(wx.CheckBox): def __init__(self, parent, win_id=wx.ID_ANY, value=False, label=wx.EmptyString, pos=wx.DefaultPosition, size=wx.Default...
# -*- coding: utf-8 -*- ## \package custom.check # MIT licensing # See: LICENSE.txt import wx ## wx.CheckBox class that defines a 'Default' attribute class CheckBox(wx.CheckBox): def __init__(self, parent, win_id=wx.ID_ANY, value=False, label=wx.EmptyString, pos=wx.DefaultPosition, size=wx.Default...
mit
Python
d0a907872749f1bb54d6e8e160ea170059289623
Set ComboBox class default ID to wx.ID_ANY
AntumDeluge/desktop_recorder,AntumDeluge/desktop_recorder
source/custom/combo.py
source/custom/combo.py
# -*- coding: utf-8 -*- ## \package custom.combo # MIT licensing # See: LICENSE.txt import wx from wx.combo import OwnerDrawnComboBox class ComboBox(OwnerDrawnComboBox): def __init__(self, parent, win_id=wx.ID_ANY, value=wx.EmptyString, pos=wx.DefaultPosition, size=wx.DefaultSize, choices=[], styl...
# -*- coding: utf-8 -*- ## \package custom.combo # MIT licensing # See: LICENSE.txt import wx from wx.combo import OwnerDrawnComboBox class ComboBox(OwnerDrawnComboBox): def __init__(self, parent, win_id, value=wx.EmptyString, pos=wx.DefaultPosition, size=wx.DefaultSize, choices=[], style=0, valid...
mit
Python
183bc364676ad463f90e49340a05987707a15f31
Access accelerometer without bridge.m (#13)
kivy/pyobjus,kivy/pyobjus,kivy/pyobjus
examples/ball-example/main.py
examples/ball-example/main.py
from random import random from kivy.app import App from kivy.uix.widget import Widget from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty from kivy.vector import Vector from kivy.clock import Clock from kivy.graphics import Color from kivy.logger import Logger from pyobjus import autoclas...
from random import random from kivy.app import App from kivy.uix.widget import Widget from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty from kivy.vector import Vector from kivy.clock import Clock from kivy.graphics import Color from pyobjus import autoclass class Ball(Widget): vel...
mit
Python
5fa489bcded8114c0fc9a440d00b47784daab4a1
Update interface.py
gael-sng/PicToASCII
src/interface.py
src/interface.py
#Initializes op = 0; edgechoice = "L8" #Default choice save = True #Default printText = False #Default while(op != 3): # Main menu print("\n\n\n\n") print("Image to ascii software.") print("Choose an option:") # Main menu choices print("\t1- Transform image.") print("\t2- Set options.") print("\t3- Close prog...
#Initializes op = 0; edgechoice = "L8" #Default choice save = True #Default printText = False #Default while(op != 3): # Main menu print("\n\n\n\n") print("Image to ascii software.") print("Choose an option:") # Main menu choices print("\t1- Transform image.") print("\t2- Set options.") print("\t3- Close prog...
agpl-3.0
Python
f3f43500a2f07dafd7a6f00f5c59044e873d6478
fix formatting
IanDCarroll/xox
source/player_chair.py
source/player_chair.py
from announcer_chair import * class Player(object): def __init__(self, marker_code): self.announcer = Announcer() self.marker_code = marker_code def move(self, board): choice = self.choose(board) board[choice] = self.marker_code return board def choose(self, board...
from announcer_chair import * class Player(object): def __init__(self, marker_code): self.announcer = Announcer() self.marker_code = marker_code def move(self, board): choice = self.choose(board) board[choice] = self.marker_code return board def choose(self, board...
mit
Python
1f12445bd9b04c8d8ce3cb5c15c76e39e1e97781
Fix absl cops flag names. (#307)
census-instrumentation/opencensus-cpp,census-instrumentation/opencensus-cpp,census-instrumentation/opencensus-cpp,census-instrumentation/opencensus-cpp
opencensus/copts.bzl
opencensus/copts.bzl
# Copyright 2018, OpenCensus Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
# Copyright 2018, OpenCensus Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
apache-2.0
Python
3971260dad534e4d3816fe580c55480acce26abe
refactor mock computer player move
IanDCarroll/xox
source/player_chair.py
source/player_chair.py
class Player(object): def move(self, board): board[4] = "spam" return board def get_legal_moves(self, board): legal_moves = [] for i in range(0, len(board)): if board[i] == 0: legal_moves.append(i) return legal_moves class Human(Player): ...
class Player(object): def move(self, board): board[4] = "spam" return board def get_legal_moves(self, board): legal_moves = [] for i in range(0, len(board)): if board[i] == 0: legal_moves.append(i) return legal_moves class Human(Player): ...
mit
Python
7c4cfca409d3df177658c427ab203e95bdb808d5
Make kiosk mode sessions permanent
fsmi/odie-server,fjalir/odie-server,fjalir/odie-server,fsmi/odie-server,fjalir/odie-server,Kha/odie-server,fsmi/odie-server,Kha/odie-server,Kha/odie-server
odie.py
odie.py
#! /usr/bin/env python3 from functools import partial from datetime import timedelta import logging from flask import Flask, session from flask.ext.babelex import Babel from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.seasurf import SeaSurf # CSRF. Got it? app = Flask("odie", template_folder='admin/templa...
#! /usr/bin/env python3 from functools import partial import logging from flask import Flask, session from flask.ext.babelex import Babel from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.seasurf import SeaSurf # CSRF. Got it? app = Flask("odie", template_folder='admin/templates', static_folder='admin/stat...
mit
Python
87d3d0597d075a6d5eb9d3866f6cc4ffb506b950
Add version number.
hodgestar/overalls
overalls/__init__.py
overalls/__init__.py
__version__ = "0.1"
bsd-3-clause
Python
c5ea439c86c0ed8e3a00a9c10e4a50a4c07fc136
simplify the way to detect Py_TRACE_REFS enabled
hideaki-t/sqlite-fts-python
sqlitefts/tokenizer.py
sqlitefts/tokenizer.py
# coding: utf-8 ''' a proof of concept implementation of SQLite FTS tokenizers in Python ''' import sys import ctypes from cffi import FFI # type: ignore from typing import Any, Union, TYPE_CHECKING if TYPE_CHECKING: import sqlite3 import apsw # type: ignore SQLITE3DBHandle = Any # ffi.CData SQLITE_OK = ...
# coding: utf-8 ''' a proof of concept implementation of SQLite FTS tokenizers in Python ''' import sys import ctypes from cffi import FFI # type: ignore from typing import Any, Union, TYPE_CHECKING if TYPE_CHECKING: import sqlite3 import apsw # type: ignore SQLITE3DBHandle = Any # ffi.CData SQLITE_OK = ...
mit
Python
fedbaa8fe93934d9632c0a6533eb18a201df1bdf
Make ots compile on Win64
davelab6/ots,anthrotype/ots,anthrotype/ots,davelab6/ots,irori/ots,khaledhosny/ots,irori/ots
ots.gyp
ots.gyp
# Copyright (c) 2009 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. { 'variables': { 'chromium_code': 1, }, 'includes': [ 'ots-common.gypi', ], 'targets': [ { 'target_name': 'ots', 'type'...
# Copyright (c) 2009 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. { 'variables': { 'chromium_code': 1, }, 'includes': [ 'ots-common.gypi', ], 'targets': [ { 'target_name': 'ots', 'type'...
bsd-3-clause
Python
763cb888eabe0e5e0bb42f77140e32f1df114e99
update 14 to cache
ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler
p014.py
p014.py
cache = [0] * 10**6 def seq_length(n): orig = n iterations = 0 while n != 1: if n < 10**6 and cache[n] > 0: iterations += cache[n] break iterations += 1 if n % 2 == 0: n /= 2 else: n = 3*n + 1 iterations += 1 cache[...
def seq_length(n): iterations = 1 while n != 1: if n % 2 == 0: n /= 2 else: n = 3*n + 1 iterations += 1 return iterations max = -1 maxi = 0 for i in xrange(1, 10**6): length = seq_length(i) if length > max: max = length maxi = i print...
bsd-3-clause
Python
65b517b832c3b39da6ec6acb1f905c7ad5f633e7
Remove unused import.
chrinide/theanets,lmjohns3/theanets,devdoer/theanets
examples/mnist-autoencoder.py
examples/mnist-autoencoder.py
#!/usr/bin/env python import cPickle import gzip import logging import os import tempfile import urllib import lmj.tnn lmj.tnn.enable_default_logging() URL = 'http://www.iro.umontreal.ca/~lisa/deep/data/mnist/mnist.pkl.gz' DATASET = os.path.join(tempfile.gettempdir(), 'mnist.pkl.gz') if not os.path.isfile(DATASET)...
#!/usr/bin/env python import cPickle import gzip import logging import os import sys import tempfile import urllib import lmj.tnn lmj.tnn.enable_default_logging() URL = 'http://www.iro.umontreal.ca/~lisa/deep/data/mnist/mnist.pkl.gz' DATASET = os.path.join(tempfile.gettempdir(), 'mnist.pkl.gz') if not os.path.isfi...
mit
Python
4b0ef589466d4f0d154c7b52ac4eccdf7447d3c1
make dicegame
imn00133/pythonSeminar17
exercise/dicegame/dicegame.py
exercise/dicegame/dicegame.py
import random def dice_make(): """ ์ฃผ์‚ฌ์œ„์˜ ๋ฉด์„ ๋ฐ›์•„ ์กฐ๊ฑด์„ ํ™•์ธํ•˜๋Š” ํ•จ์ˆ˜ ์ด ๋ถ€๋ถ„์—์„œ dice_face๋ฐ dice_num์€ ๋ชจ๋“  ํ•จ์ˆ˜์—์„œ ์‚ฌ์šฉ๋˜์•ผ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ „์—ญ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ๋ฐ–์— ์—†๋‹ค. ๊ณผ์ œ ์ž˜๋ชป ๋งŒ๋“ค์—ˆ๋‹ค... """ global dice_face, dice_num while True: dice_face = int(input("์ฃผ์‚ฌ์œ„ ๋ฉด์˜ ๊ฐœ์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”: ")) if not (dice_face == 4 or dice_face == 6 ...
mit
Python
1ce77f8efdccbb82e615c5e1d75d19d9f5b92e0f
put node modules bin in path
chriswatrous/scripts,chriswatrous/scripts,chriswatrous/scripts
path.py
path.py
#!/usr/bin/env python import sys import os from os.path import exists def uniq(L): out = [] seen = set() for item in L: if item not in seen: out.append(item) seen.add(item) return out paths = [ './node_modules/.bin', '~/bin', '~/stuff/bin', '~/scripts/...
#!/usr/bin/env python import sys import os from os.path import exists def uniq(L): out = [] seen = set() for item in L: if item not in seen: out.append(item) seen.add(item) return out paths = [ '~/bin', '~/stuff/bin', '~/scripts/bin', '/usr/local/opt/c...
mit
Python
30e030ee548fe1a89efd749b29b812816c53478e
add version and author as metafields
PixelwarStudio/PyTree
Tree/__init__.py
Tree/__init__.py
""" Package for creating and drawing trees. """ __version__ = "0.2.2" __author__ = "Pixelwar"
""" Package for creating and drawing trees. """
mit
Python
e55452d2d0bf5d2c95b022a96e751b2d636dfbe8
Fix config_path
rizar/attention-lvcsr,nke001/attention-lvcsr,nke001/attention-lvcsr,rizar/attention-lvcsr,rizar/attention-lvcsr,rizar/attention-lvcsr,rizar/attention-lvcsr,nke001/attention-lvcsr,nke001/attention-lvcsr,nke001/attention-lvcsr
lvsr/firsttry/main.py
lvsr/firsttry/main.py
#!/usr/bin/env python """Learn to reverse the words in a text.""" import logging import argparse from lvsr.firsttry import main if __name__ == "__main__": logging.basicConfig( level=logging.INFO, format="%(asctime)s: %(name)s: %(levelname)s: %(message)s") parser = argparse.ArgumentParser( ...
#!/usr/bin/env python """Learn to reverse the words in a text.""" import logging import argparse from lvsr.firsttry import main if __name__ == "__main__": logging.basicConfig( level=logging.INFO, format="%(asctime)s: %(name)s: %(levelname)s: %(message)s") parser = argparse.ArgumentParser( ...
mit
Python
2560ca287e81cbefb6037e5688bfa4ef74d85149
Change call method for Python2.7
oinume/lekcije,oinume/dmm-eikaiwa-fft,oinume/lekcije,oinume/dmm-eikaiwa-fft,oinume/lekcije,oinume/dmm-eikaiwa-fft,oinume/lekcije,oinume/lekcije,oinume/lekcije,oinume/dmm-eikaiwa-fft
clock.py
clock.py
from __future__ import print_function from apscheduler.schedulers.blocking import BlockingScheduler import logging import subprocess logging.basicConfig() scheduler = BlockingScheduler() @scheduler.scheduled_job('interval', minutes=1) def timed_job_min1(): print("Run notifier") subprocess.check_call( ...
from __future__ import print_function from apscheduler.schedulers.blocking import BlockingScheduler import logging import subprocess logging.basicConfig() scheduler = BlockingScheduler() @scheduler.scheduled_job('interval', minutes=1) def timed_job_min1(): print("Run notifier") subprocess.run( "notif...
mit
Python
1e4055da7d14355821d2d72b40b1e6d463fe4ecd
Fix Tracing mode TS export for LayerNorm layer
pytorch/fairseq,pytorch/fairseq,pytorch/fairseq
fairseq/modules/layer_norm.py
fairseq/modules/layer_norm.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F try: from apex.normalization import FusedLayerNorm as _FusedLayerNorm ...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F try: from apex.normalization import FusedLayerNorm as _FusedLayerNorm ...
mit
Python
ca16ca52992c162832c1aaf878788ecf8bdcc4f7
Add message for previewing
sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer
falmer/content/models/core.py
falmer/content/models/core.py
from django.conf import settings from django.db import models from django.http import HttpResponse from django.shortcuts import redirect from wagtail.admin.edit_handlers import FieldPanel, PageChooserPanel from wagtail.core.models import Page as WagtailPage from falmer.content.utils import get_public_path_for_page c...
from django.conf import settings from django.db import models from django.http import HttpResponse from django.shortcuts import redirect from wagtail.admin.edit_handlers import FieldPanel, PageChooserPanel from wagtail.core.models import Page as WagtailPage from falmer.content.utils import get_public_path_for_page c...
mit
Python
042748899edaa217fbfd4022c8cd49de97161af4
Fix import of `trim_whitespace`.
potatolondon/fluent-2.0,potatolondon/fluent-2.0
fluent/templatetags/fluent.py
fluent/templatetags/fluent.py
from __future__ import absolute_import from django import template from django.templatetags.i18n import do_translate, do_block_translate from django.utils.translation import get_language, trim_whitespace register = template.Library() @register.tag("trans") def trans_override(parser, token): """ Wraps a...
from __future__ import absolute_import from django import template from django.templatetags.i18n import do_translate, do_block_translate from django.utils.translation import get_language from fluent.utils import trim_whitespace register = template.Library() @register.tag("trans") def trans_override(parser, token):...
mit
Python
9ac8b664e4bd084cbb64c961b85c2b0fb1bf12e6
add log
hiroyuki-kasuga/street-movie,hiroyuki-kasuga/street-movie,hiroyuki-kasuga/street-movie
src/main/street_movie/web/views.py
src/main/street_movie/web/views.py
# coding: utf-8 import logging from django.conf import settings from django.core.urlresolvers import reverse from django.http import HttpResponse, Http404 from django.template import RequestContext from django.template import loader from django.views.decorators.csrf import csrf_exempt from api.models import Movie from...
# coding: utf-8 import logging from django.conf import settings from django.core.urlresolvers import reverse from django.http import HttpResponse, Http404 from django.template import RequestContext from django.template import loader from django.views.decorators.csrf import csrf_exempt from api.models import Movie from...
mit
Python
c27a22d6750c1c8dfacd018aa932896489bab20f
Improve readability of error
getavalon/core,mindbender-studio/core,mindbender-studio/core,getavalon/core
avalon/tools/projectmanager/lib.py
avalon/tools/projectmanager/lib.py
"""Utility script for updating database with configuration files Until assets are created entirely in the database, this script provides a bridge between the file-based project inventory and configuration. - Migrating an old project: $ python -m avalon.inventory --extract --silo-parent=f02_prod $ python -m av...
"""Utility script for updating database with configuration files Until assets are created entirely in the database, this script provides a bridge between the file-based project inventory and configuration. - Migrating an old project: $ python -m avalon.inventory --extract --silo-parent=f02_prod $ python -m av...
mit
Python