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 |
|---|---|---|---|---|---|---|---|---|
c1335e241e4d39df1cd07b811f7ffd70ac923bdc | Fix broken tests | skwashd/python-acquia-cloud | acapi/resources/acquiaresource.py | acapi/resources/acquiaresource.py | """Generic Acquia Cloud API resource."""
from acapi.resources.acquiadata import AcquiaData
class AcquiaResource(AcquiaData):
"""Acquia Cloud API resource."""
#: Valid properties for this resource object
valid_keys = None
def __getitem__(self, key):
"""Get the value of an object property."""... | """Generic Acquia Cloud API resource."""
from acapi.resources.acquiadata import AcquiaData
class AcquiaResource(AcquiaData):
"""Acquia Cloud API resource."""
#: Valid properties for this resource object
valid_keys = None
def __getitem__(self, key):
"""Get the value of an object property."""... | mit | Python |
12cf7d220408971509b57cb3a60f2d87b4a37477 | Revert "Add support for server side authentication." | jgoclawski/django-facebook-auth,pozytywnie/django-facebook-auth,pozytywnie/django-facebook-auth,jgoclawski/django-facebook-auth | facebook_auth/models.py | facebook_auth/models.py | from django.contrib.auth import models as auth_models
from django.db import models
import facepy
import simplejson
from facebook_auth import utils
class FacebookUser(auth_models.User):
user_id = models.BigIntegerField(unique=True)
access_token = models.TextField(blank=True, null=True)
app_friends = models... | from uuid import uuid1
from django.conf import settings
from django.contrib.auth import models as auth_models
from django.db import models
import facepy
import simplejson
from facebook_auth import utils
class FacebookUser(auth_models.User):
user_id = models.BigIntegerField(unique=True)
access_token = models.... | mit | Python |
b88a7f03b43d8f2b1ceb34827295d37b7cd714e6 | Implement UserToken manager class. | pozytywnie/django-facebook-auth,pozytywnie/django-facebook-auth,jgoclawski/django-facebook-auth,jgoclawski/django-facebook-auth | facebook_auth/models.py | facebook_auth/models.py | import json
import logging
from django.contrib.auth import models as auth_models
from django.db import models
from django.utils import timezone
import facepy
from facebook_auth import utils
logger = logging.getLogger(__name__)
class FacebookUser(auth_models.User):
user_id = models.BigIntegerField(unique=True)
... | import json
import logging
from django.contrib.auth import models as auth_models
from django.db import models
import facepy
from facebook_auth import utils
logger = logging.getLogger(__name__)
class FacebookUser(auth_models.User):
user_id = models.BigIntegerField(unique=True)
access_token = models.TextFiel... | mit | Python |
30322e79409de2ea0e1747deed44720fe2b24fd1 | Fix minor issues and add a comment to the flag version | e-koch/VLA_Lband,e-koch/VLA_Lband | 16B/pipeline4.6.0_custom/EVLA_Lband_RFI_flag.py | 16B/pipeline4.6.0_custom/EVLA_Lband_RFI_flag.py |
'''
Several portions of the L-band have constant RFI that is unrecoverable.
This is meant to be run in the pipeline environment to remove these regions
before wasting time trying to find solutions.
'''
from glob import glob
import os
from tasks import flagdata, flagmanager
logprint("Starting EVLA_Lband_RFI_flag.p... |
'''
Several portions of the L-band have constant RFI that is unrecoverable.
This is meant to be run in the pipeline environment to remove these regions
before wasting time trying to find solutions.
'''
from glob import glob
import os
from tasks import flagdata, flagmanager
logprint("Starting EVLA_Lband_RFI_flag.p... | mit | Python |
64079b449d272fa1e06206c89ed1ba680cade50a | Fix kick message | TitanEmbeds/Titan,TitanEmbeds/Titan,TitanEmbeds/Titan | discordbot/titanembeds/commands.py | discordbot/titanembeds/commands.py | class Commands():
def __init__(self, client, database):
self.client = client
self.database = database
async def ban(self, message):
serverid = message.server.id
content = message.content.strip()
if len(content.split()) == 2:
await self.client.send_message(mes... | class Commands():
def __init__(self, client, database):
self.client = client
self.database = database
async def ban(self, message):
serverid = message.server.id
content = message.content.strip()
if len(content.split()) == 2:
await self.client.send_message(mes... | agpl-3.0 | Python |
e75bafa43908d9f66f94ffae1393f18c9262f5a1 | Add basic test for get_all_certs_keys IInstaller interface method. | letsencrypt/letsencrypt,stweil/letsencrypt,letsencrypt/letsencrypt,lmcro/letsencrypt,lmcro/letsencrypt,stweil/letsencrypt | letsencrypt-postfix/TestPostfixConfigGenerator.py | letsencrypt-postfix/TestPostfixConfigGenerator.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import logging
import unittest
import Config
import PostfixConfigGenerator as pcg
logger = logging.getLogger(_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import logging
import unittest
import Config
import PostfixConfigGenerator as pcg
logger = logging.getLogger(_... | apache-2.0 | Python |
c6c2febcf32d2316baf41b55d23162eb06253ea4 | Delete duplicate versioneer section | Josef-Friedrich/audiorename | audiorename/__init__.py | audiorename/__init__.py | # -*- coding: utf-8 -*-
"""Rename audio files from metadata tags."""
import os
from audiorename.args import parser
from .batch import Batch
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
def execute(args=None):
args = parser.parse_args(args)
args.path = os.path.... | # -*- coding: utf-8 -*-
"""Rename audio files from metadata tags."""
import os
from audiorename.args import parser
from .batch import Batch
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
def execute(args=None):
args = parser.parse_args(args)
args.path = os.path.... | mit | Python |
4805c7d7bc97ae4fc1b44e6dbd3626bfe5bd0ff9 | fix favouriting own bookmark | ev-agelos/Python-bookmarks,ev-agelos/Python-bookmarks,ev-agelos/Python-bookmarks | bookmarks/api/favourites.py | bookmarks/api/favourites.py | from flask import request, jsonify, url_for, g
from flask.views import MethodView
from flask_login import login_required
from flask_smorest import Blueprint, abort
from bookmarks import csrf
from bookmarks.models import Bookmark, Favourite
from bookmarks.logic import _save, _unsave
from .schemas import FavouriteSchem... | from flask import request, jsonify, url_for, g
from flask.views import MethodView
from flask_login import login_required
from flask_smorest import Blueprint, abort
from bookmarks import csrf
from bookmarks.models import Bookmark, Favourite
from bookmarks.logic import _save, _unsave
from .schemas import FavouriteSchem... | mit | Python |
af2bd3600fd4984886fb52aedf55eeb95a700bfc | sort events list | vhanla/CudaText,vhanla/CudaText,Alexey-T/CudaText,vhanla/CudaText,Alexey-T/CudaText,vhanla/CudaText,Alexey-T/CudaText,Alexey-T/CudaText,Alexey-T/CudaText,Alexey-T/CudaText,vhanla/CudaText,vhanla/CudaText,vhanla/CudaText,vhanla/CudaText,Alexey-T/CudaText,vhanla/CudaText,vhanla/CudaText,Alexey-T/CudaText | app/py/cuda_make_plugin/events.py | app/py/cuda_make_plugin/events.py | EVENTS = [
'on_caret',
'on_change',
'on_change_slow',
'on_click',
'on_click_dbl',
'on_click_gap',
'on_close',
'on_complete',
'on_console',
'on_console_nav',
'on_focus',
'on_func_hint',
'on_goto_caret',
'on_goto_change',
'on_goto_def',
'on_goto_enter',
... | EVENTS = [
'on_caret',
'on_change',
'on_change_slow',
'on_click',
'on_click_dbl',
'on_click_gap',
'on_close',
'on_complete',
'on_console',
'on_console_nav',
'on_focus',
'on_func_hint',
'on_goto_enter',
'on_goto_caret',
'on_goto_change',
'on_goto_key',
... | mpl-2.0 | Python |
e4b679afd6c7a43450faa668ba6454389935a668 | remove sensor | kervi/can-bot | app/sensors/__init__.py | app/sensors/__init__.py | """
Include the sensor modules that you have created here.
Kervi will load the sensors that are imported here.
"""
#from . import my_sensor
from . import system_sensors
| """
Include the sensor modules that you have created here.
Kervi will load the sensors that are imported here.
"""
from . import my_sensor
from . import system_sensors
| mit | Python |
4378aef47a7e2b80a4a22af2bbe69ce4b780ab6d | Fix due to Flask-Login version up | teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr | pokr/views/login.py | pokr/views/login.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from flask import g, render_template, redirect, request, url_for
from flask.ext.login import current_user, login_required, logout_user
from social.apps.flask_app.template_filters import backends
def register(app):
@login_required
@app.route('/done/')
def ... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from flask import g, render_template, redirect, request, url_for
from flask.ext.login import current_user, login_required, logout_user
from social.apps.flask_app.template_filters import backends
def register(app):
@login_required
@app.route('/done/')
def ... | apache-2.0 | Python |
8560139ce4380226a72c776023045faf801a2cc0 | Add missing user id constant | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | app/soc/mapreduce/convert_user.py | app/soc/mapreduce/convert_user.py | #!/usr/bin/python2.5
#
# Copyright 2012 the Melange 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... | #!/usr/bin/python2.5
#
# Copyright 2012 the Melange 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... | apache-2.0 | Python |
1c8de2450313843bba360b98814def4555608917 | Update stuffaboutcode_bridge.py | jargonautical/mcpi,jargonautical/mcpi | mcpipy/stuffaboutcode_bridge.py | mcpipy/stuffaboutcode_bridge.py | #!/usr/bin/env python
#www.stuffaboutcode.com
#Raspberry Pi, Minecraft - auto bridge
# mcpipy.com retrieved from URL below, written by stuffaboutcode
# http://www.stuffaboutcode.com/2013/02/raspberry-pi-minecraft-auto-bridge.html
#import the minecraft.py module from the minecraft directory
import mcpi.minecraft as m... | #!/usr/bin/env python
#www.stuffaboutcode.com
#Raspberry Pi, Minecraft - auto bridge
# mcpipy.com retrieved from URL below, written by stuffaboutcode
# http://www.stuffaboutcode.com/2013/02/raspberry-pi-minecraft-auto-bridge.html
#import the minecraft.py module from the minecraft directory
from .. import minecraft
f... | cc0-1.0 | Python |
71089e9cf1fd991fbcd2cccd906448c3d9bde13e | Update win_batch_md2ipynb.py | d2l-ai/d2l-zh,d2l-ai/d2l-zh,d2l-ai/d2l-zh,mli/gluon-tutorials-zh,mli/gluon-tutorials-zh,mli/gluon-tutorials-zh,mli/gluon-tutorials-zh | build/win_batch_md2ipynb.py | build/win_batch_md2ipynb.py | import glob
import nbformat
import notedown
import os
from subprocess import check_output
import sys
import time
def mkdir_if_not_exist(path):
if not os.path.exists(os.path.join(*path)):
os.makedirs(os.path.join(*path))
# timeout for each notebook, in sec
timeout = 20 * 60
# the files wi... | import glob
import nbformat
import notedown
import os
from subprocess import check_output
import sys
import time
def mkdir_if_not_exist(path):
if not os.path.exists(os.path.join(*path)):
os.makedirs(os.path.join(*path))
# timeout for each notebook, in sec
timeout = 20 * 60
# the files wi... | apache-2.0 | Python |
d015c90f06b3b8413955ebaac3ec828d4517c2d1 | upgrade java to 1.9.64 (#78) | bazelbuild/rules_appengine,bazelbuild/rules_appengine | appengine/variables.bzl | appengine/variables.bzl | """This file is a central location for configuring new SDK versions.
"""
# Not all languages are released for every SDK version. Whenever possible, set
# ${LANG}_SDK_VERSION = APPENGINE_VERSION.
APPENGINE_VERSION = "1.9.64"
SDK_URL_PREFIX = "https://storage.googleapis.com/appengine-sdks/featured"
JAVA_SDK_SHA256 = "8... | """This file is a central location for configuring new SDK versions.
"""
# Not all languages are released for every SDK version. Whenever possible, set
# ${LANG}_SDK_VERSION = APPENGINE_VERSION.
APPENGINE_VERSION = "1.9.63"
SDK_URL_PREFIX = "https://storage.googleapis.com/appengine-sdks/featured"
JAVA_SDK_SHA256 = "4... | apache-2.0 | Python |
b84ce75ab4c88e69ba6978761e5cfcae9f872b10 | add basic auth to config | crossgovernmentservices/prototypes,crossgovernmentservices/prototypes,crossgovernmentservices/prototypes,crossgovernmentservices/prototypes,crossgovernmentservices/prototypes | application/settings.py | application/settings.py | # -*- coding: utf-8 -*-
import os
class Config(object):
SECRET_KEY = os.environ.get('APPLICATION_SECRET', 'secret-key') # TODO: Change me
APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory
PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir))
BCRYPT_LOG_ROUNDS = 13
... | # -*- coding: utf-8 -*-
import os
os_env = os.environ
class Config(object):
SECRET_KEY = os_env.get('APPLICATION_SECRET', 'secret-key') # TODO: Change me
APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory
PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir))
BCRYPT_LOG_... | mit | Python |
6f0a28810acd28a0a680d82761216f7fe5518076 | Remove the log transform stub. Will add it back in later if needed. | jakirkham/bokeh,Karel-van-de-Plassche/bokeh,dennisobrien/bokeh,percyfal/bokeh,philippjfr/bokeh,azjps/bokeh,philippjfr/bokeh,DuCorey/bokeh,ericmjl/bokeh,phobson/bokeh,dennisobrien/bokeh,ericmjl/bokeh,bokeh/bokeh,ericmjl/bokeh,clairetang6/bokeh,aavanian/bokeh,dennisobrien/bokeh,jakirkham/bokeh,aiguofer/bokeh,rs2/bokeh,bo... | bokeh/models/transforms.py | bokeh/models/transforms.py | '''
'''
from __future__ import absolute_import
from ..core.enums import StepMode, JitterRandomDistribution
from ..core.properties import abstract
from ..core.properties import Either, Enum, Float, Instance, Seq, String, Tuple
from ..model import Model
from .sources import ColumnDataSource
@abstract
class Transform(M... | '''
'''
from __future__ import absolute_import
from ..core.enums import StepMode, JitterRandomDistribution
from ..core.properties import abstract
from ..core.properties import Either, Enum, Float, Instance, Seq, String, Tuple
from ..model import Model
from .sources import ColumnDataSource
@abstract
class Transform(M... | bsd-3-clause | Python |
90067f5543ec883d849cefef30f079d4e127ad59 | Improve filter_news.py and fix some small issues. | geektoni/Influenza-Like-Illness-Predictor,geektoni/Influenza-Like-Illness-Predictor | data_analysis/filter_news.py | data_analysis/filter_news.py | """Generate year files with news counts
Usage:
filter_news.py <directory> <output>
Options:
-h, --help
"""
from docopt import docopt
from os import listdir
from os.path import isfile, join
import datetime
from tqdm import *
import pandas as pd
def find_index(id, lis):
for i in range(0, len(lis)):
if id ==... | """Generate year files with news counts
Usage:
filter_news.py <directory> <output>
Options:
-h, --help
"""
from docopt import docopt
from os import listdir
from os.path import isfile, join
import datetime
import pandas as pd
if __name__ == "__main__":
# Parse the command line
args = docopt(__doc__)
# Arr... | mit | Python |
a79596be92323391ef79e3502b02e90904ec9f4e | Add PMT coordinates | CosmicLaserShow/CosmicLaserShow,CosmicLaserShow/CosmicLaserShow,CosmicLaserShow/CosmicLaserShow | globals.py | globals.py | MM = 1.
M = 1000 * MM
NS = 1.
S = 10**9 * NS
SPEED_OF_LIGHT = 299792458. * M / S
SPEED = (2./3.) * SPEED_OF_LIGHT
LENGTH = 500. * MM
PMT_COORDS = [(0., 0.), (LENGTH, 0.), (0., LENGTH), (LENGTH, LENGTH)]
| MM = 1.
M = 1000 * MM
NS = 1.
S = 10**9 * NS
SPEED_OF_LIGHT = 299792458. * M / S
SPEED = (2./3.) * SPEED_OF_LIGHT
LENGTH = 500. * MM
| mit | Python |
49026db21c3f200e68f6048ddac165ff5f5d8d17 | Update based on code review | gtagency/buzzmobile,gtagency/buzzmobile,gtagency/buzzmobile,jgkamat/buzzmobile,jgkamat/buzzmobile,jgkamat/buzzmobile | buzzmobile/sense/inputer/inputer.py | buzzmobile/sense/inputer/inputer.py | #!/usr/bin/env python
import rospy
from std_msgs.msg import String
def input_node():
pub = rospy.Publisher('input_value', String, queue_size=0)
rospy.init_node('inputer', anonymous=True)
# Publish a nonsense initial value to make sure subscribers don't explode
pub.publish("")
while not rospy.is_shu... | #!/usr/bin/env python
import rospy
from std_msgs.msg import String
def input_node():
pub = rospy.Publisher('dst', String, queue_size=0)
rospy.init_node('inputer', anonymous=True)
pub.publish("")
while not rospy.is_shutdown():
new_dst = raw_input("Dest> ")
pub.publish(new_dst)
if __name... | mit | Python |
05e651b0e606f216a78c61ccfb441ce7ed41d852 | Exclude from coverage the code pathways that are specific to Python 2. | morepath/reg,taschini/reg | reg/compat.py | reg/compat.py | import sys
from types import MethodType
# True if we are running on Python 3.
PY3 = sys.version_info[0] == 3
if PY3:
string_types = (str,)
else: # pragma: no cover
string_types = (basestring,) # noqa
if PY3:
def create_method_for_class(callable, type):
return MethodType(callable, type)
d... | import sys
from types import MethodType
# True if we are running on Python 3.
PY3 = sys.version_info[0] == 3
if PY3:
string_types = (str,)
else: # pragma: no cover
string_types = (basestring,) # noqa
if PY3:
def create_method_for_class(callable, type):
return MethodType(callable, type)
d... | bsd-3-clause | Python |
d00f510f69bacd6a9888f4cea77da110fa7165d7 | add install list generator | ReanGD/ansible-personal,ReanGD/ansible-personal,ReanGD/py-pacman-manager,ReanGD/py-pacman-manager | mngpacman.py | mngpacman.py | #!/usr/bin/env python
import os
import platform
import subprocess
class PackageManager(object):
def all_packages(self):
raise NotImplementedError()
def explicit_packages(self):
raise NotImplementedError()
def depend_packages(self, package):
raise NotImplementedError()
def gr... | #!/usr/bin/env python
import os
import platform
import subprocess
class PackageManager(object):
def all_packages(self):
raise NotImplementedError()
def explicit_packages(self):
raise NotImplementedError()
def depend_packages(self, package):
raise NotImplementedError()
def gr... | apache-2.0 | Python |
f450af8eb2b64e2f1eaccd6098a4004b6d0c766e | Add url validation. move imports to top of method. | anthonyw12123/4chanwebscraper | 4ChanWebScraper.py | 4ChanWebScraper.py | #downloads an IMAGE to the provided path.
#this fails on .WEBM or other media
def downloadImage(url,path):
import requests
from PIL import Image
img = requests.get(url)
i = Image.open(StringIO(img.content))
i.save(path)
#Checks if input folder exists in the current directory. If not, create it.
de... | #downloads an IMAGE to the provided path.
#this fails on .WEBM or other media
def downloadImage(url,path):
import requests
from PIL import Image
img = requests.get(url)
i = Image.open(StringIO(img.content))
i.save(path)
#Checks if input folder exists in the current directory. If not, create it.
de... | mit | Python |
b8b60bf646126ed3b2a4eb15b6ed51d7eba687a6 | add world bank example | Impactstory/oadoi,Impactstory/oadoi,Impactstory/sherlockoa,Impactstory/oadoi,Impactstory/sherlockoa | oa_manual.py | oa_manual.py | from collections import defaultdict
from time import time
from util import elapsed
# things to set here:
# license, free_metadata_url, free_pdf_url
# free_fulltext_url is set automatically from free_metadata_url and free_pdf_url
def get_overrides_dict():
override_dict = defaultdict(dict)
# cindy wu ex... | from collections import defaultdict
from time import time
from util import elapsed
# things to set here:
# license, free_metadata_url, free_pdf_url
# free_fulltext_url is set automatically from free_metadata_url and free_pdf_url
def get_overrides_dict():
override_dict = defaultdict(dict)
# cindy wu ex... | mit | Python |
56186c985b87fbbf0a7ea0f04c8b089a13b29fe3 | Test execution: Remove unneeded variable | Tanmay28/coala,Tanmay28/coala,meetmangukiya/coala,arush0311/coala,NalinG/coala,Tanmay28/coala,incorrectusername/coala,yashtrivedi96/coala,shreyans800755/coala,sagark123/coala,jayvdb/coala,MariosPanag/coala,Nosferatul/coala,vinc456/coala,damngamerz/coala,MattAllmendinger/coala,ManjiriBirajdar/coala,andreimacavei/coala,r... | execute_all_tests.py | execute_all_tests.py | #! /bin/python3
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be us... | #! /bin/python3
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be us... | agpl-3.0 | Python |
ace9947582aec32d8e03b214bbf6e270c8978a50 | Add stack-docs clean command | lsst-sqre/documenteer,lsst-sqre/sphinxkit,lsst-sqre/documenteer | documenteer/stackdocs/stackcli.py | documenteer/stackdocs/stackcli.py | """Implements the ``stack-docs`` CLI for stack documentation builds.
"""
__all__ = ('main',)
import logging
import os
import shutil
import sys
import click
from .build import build_stack_docs
# Add -h as a help shortcut option
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group(context_setti... | """Implements the ``stack-docs`` CLI for stack documentation builds.
"""
__all__ = ('main',)
import logging
import sys
import click
from .build import build_stack_docs
# Add -h as a help shortcut option
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group(context_settings=CONTEXT_SETTINGS)
@c... | mit | Python |
94e0dc267e159014675556687f52157371c5a813 | order standings by position | wefner/w2pfooty,wefner/w2pfooty,wefner/w2pfooty | controllers/matches.py | controllers/matches.py | import tempfile
from datetime import datetime
@auth.requires_login()
def next_match():
where_next_match = (((db.matches.visiting_team == auth.user.team_name) |
(db.matches.home_team == auth.user.team_name)) &
(db.matches.datetime > datetime.today()))
match = d... | import tempfile
from datetime import datetime
@auth.requires_login()
def next_match():
where_next_match = (((db.matches.visiting_team == auth.user.team_name) |
(db.matches.home_team == auth.user.team_name)) &
(db.matches.datetime > datetime.today()))
match = d... | apache-2.0 | Python |
07a7a24d231a6807c1512632b903bb439d46f4e8 | remove default=uuid.uuid4, which does not work | vmprof/vmprof-server,vmprof/vmprof-server,vmprof/vmprof-server,vmprof/vmprof-server | vmlog/models.py | vmlog/models.py | import uuid
from jitlog.parser import _parse_jitlog
from django.db import models
from django.contrib import admin
from vmprofile.models import RuntimeData
from vmcache.cache import get_reader
def get_profile_storage_directory(profile, filename):
return "log/%d/%s" % (profile.pk, filename)
class BinaryJitLog(m... | import uuid
from jitlog.parser import _parse_jitlog
from django.db import models
from django.contrib import admin
from vmprofile.models import RuntimeData
from vmcache.cache import get_reader
def get_profile_storage_directory(profile, filename):
return "log/%d/%s" % (profile.pk, filename)
class BinaryJitLog(m... | mit | Python |
097aa0bc21f8eea28edff148fb36146bbced92c4 | Exclude duecredit from the documentation. | arokem/sklearn-forest-ci,scikit-learn-contrib/forest-confidence-interval,arokem/sklearn-forest-ci,uwescience/sklearn-forest-ci,kpolimis/sklearn-forest-ci,scikit-learn-contrib/forest-confidence-interval,kpolimis/sklearn-forest-ci,uwescience/sklearn-forest-ci | doc/tools/buildmodref.py | doc/tools/buildmodref.py | #!/usr/bin/env python
"""Script to auto-generate API docs.
"""
from __future__ import print_function, division
# stdlib imports
import sys
import re
# local imports
from apigen import ApiDocWriter
# version comparison
from distutils.version import LooseVersion as V
#*************************************************... | #!/usr/bin/env python
"""Script to auto-generate API docs.
"""
from __future__ import print_function, division
# stdlib imports
import sys
import re
# local imports
from apigen import ApiDocWriter
# version comparison
from distutils.version import LooseVersion as V
#*************************************************... | mit | Python |
be29e195bbdfd9acad4841d0e241554e735baf3a | add -dev suffix to version for code in master | ASP1234/voc,pombredanne/voc,gEt-rIgHt-jR/voc,ASP1234/voc,cflee/voc,cflee/voc,gEt-rIgHt-jR/voc,freakboy3742/voc,pombredanne/voc,freakboy3742/voc | voc/__init__.py | voc/__init__.py | # Examples of valid version strings
# __version__ = '1.2.3.dev1' # Development release 1
# __version__ = '1.2.3a1' # Alpha Release 1
# __version__ = '1.2.3b1' # Beta Release 1
# __version__ = '1.2.3rc1' # RC Release 1
# __version__ = '1.2.3' # Final Release
# __version__ = '1.2.3.post1' # Post Release... | # Examples of valid version strings
# __version__ = '1.2.3.dev1' # Development release 1
# __version__ = '1.2.3a1' # Alpha Release 1
# __version__ = '1.2.3b1' # Beta Release 1
# __version__ = '1.2.3rc1' # RC Release 1
# __version__ = '1.2.3' # Final Release
# __version__ = '1.2.3.post1' # Post Release... | bsd-3-clause | Python |
39f327bb9e37d6d290eb3f3179f7e79d60b5ab6d | Switch from ORM to Core | labhack/whiskeynovember,labhack/whiskeynovember,labhack/whiskeynovember | model.py | model.py | from sqlalchemy import create_engine
engine = create_engine('postgresql://wn:wn@localhost:5432/wndb')
from sqlalchemy import Column, Integer, Float, DateTime, Boolean, String, MetaData
metadata = MetaData()
table = Table('obs', metadata, Column(Integer, primary_key=True),
Column('station_name',String),
Colum... | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
engine = create_engine('postgresql://wn:wn@localhost:5432/wndb')
Base = declarative_base()
from sqlalchemy import Column, Integer, Float, DateTime, Boolean, String
class Observation(Base):
__tablename__ = 'obs'
id =... | mit | Python |
3ccb2f688a568ff2193bf1f1e19cecc112c2054f | add losetup context manager | lamyj/tmbackup | mount.py | mount.py | import os
import subprocess
import tempfile
class mount(object):
""" Context manager mounting and un-mounting a filesystem on a temporary directory.
>>> with mount("/dev/sdc1") as directory:
... print os.listdir(directory)
"""
def __init__(self, source, command="mount", *args):
... | import os
import subprocess
import tempfile
class mount(object):
""" Context manager mounting and un-mounting a filesystem on a temporary directory.
>>> with mount("/dev/sdc1") as directory:
... print os.listdir(directory)
"""
def __init__(self, source, command="mount", *args):
... | agpl-3.0 | Python |
a5b89ed7aa9e2fe4305f6431a3bdd675a7eda03f | Fix newline at the end of file. | honzajavorek/python.cz,honzajavorek/python.cz,honzajavorek/python.cz,honzajavorek/python.cz | web/__init__.py | web/__init__.py | # -*- coding: utf-8 -*-
from os import path
from flask import Flask
PACKAGE_DIR = path.dirname(path.realpath(__file__))
ROOT_DIR = path.realpath(path.join(PACKAGE_DIR, '..'))
ROOT_URL = 'http://pythoncz.herokuapp.com'
GITHUB_URL = (
'https://github.com/honzajavorek/python.cz/'
'blob/master/{template_fold... | # -*- coding: utf-8 -*-
from os import path
from flask import Flask
PACKAGE_DIR = path.dirname(path.realpath(__file__))
ROOT_DIR = path.realpath(path.join(PACKAGE_DIR, '..'))
ROOT_URL = 'http://pythoncz.herokuapp.com'
GITHUB_URL = (
'https://github.com/honzajavorek/python.cz/'
'blob/master/{template_fold... | mit | Python |
76c09dfe2e151a59d5017b661a6f751245c35270 | Update version info | suminb/tldr-web,suminb/tldr-web,suminb/tldr-web | web/__init__.py | web/__init__.py | import os
from flask import Flask
__version__ = '0.1.2'
def create_app(name=__name__):
app = Flask(name)
from web.main import main_module
app.register_blueprint(main_module, url_prefix='/')
return app
app = create_app()
if __name__ == '__main__':
host = os.environ.get('HOST', '0.0.0.0')
... | import os
from flask import Flask
__version__ = '0.1.1'
def create_app(name=__name__):
app = Flask(name)
from web.main import main_module
app.register_blueprint(main_module, url_prefix='/')
return app
app = create_app()
if __name__ == '__main__':
host = os.environ.get('HOST', '0.0.0.0')
... | bsd-3-clause | Python |
c4f7cc009e94f50562a985d0bc377cd696580c15 | fix output utf8 | StalkR/misc,StalkR/misc,StalkR/misc,StalkR/misc,StalkR/misc,StalkR/misc,StalkR/misc,StalkR/misc | web/imdb_cli.py | web/imdb_cli.py | #!/usr/bin/python
# Search a title on IMDb and display a nice line.
import imdb
import sys
def main(argv):
if len(argv) < 2:
print 'Usage: %s <search query>' % argv[0]
raise SystemExit(0)
result = imdb.SearchTitle(' '.join(argv[1:]))
if not result:
print 'Not found.'
rais... | #!/usr/bin/python
# Search a title on IMDb and display a nice line.
import imdb
import sys
def main(argv):
if len(argv) < 2:
print 'Usage: %s <search query>' % argv[0]
raise SystemExit(0)
result = imdb.SearchTitle(' '.join(argv[1:]))
if not result:
print 'Not found.'
rais... | apache-2.0 | Python |
6598b684892c061e1e17174e1435b5770d3f2933 | use CmsRepoException instead of KeyError | universalcore/unicore-cms,universalcore/unicore-cms,universalcore/unicore-cms | cms/__init__.py | cms/__init__.py | from cms.utils import CmsRepo, CmsRepoException
from pyramid_beaker import set_cache_regions_from_settings
from pyramid.config import Configurator
import logging
log = logging.getLogger(__name__)
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
set_cache_reg... | from cms.utils import CmsRepo
from pyramid_beaker import set_cache_regions_from_settings
from pyramid.config import Configurator
import logging
log = logging.getLogger(__name__)
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
set_cache_regions_from_settings... | bsd-2-clause | Python |
70adbbb8b575adef43ef7907e21c1e13616fd73c | Update LogisticRegr.py | konemshad/ML,mahesh-9/ML | ml/GLM/LogisticRegr.py | ml/GLM/LogisticRegr.py | from math import log,e
from ..numc import *
from .lr import LR
class LogisticRegression():
def fit(self,X,Y):
LR.fit(self,X,Y)
return self
def hypo(self,it):
res=1/(1+e**(-LR.hyp(self,it)))
return res
def cost(self):
s=0
for _ in range(self.m):
s+=self.target[_]*log(self.hypo(_))+(1-self.target[_])*... | from math import log,e
from ..numc import *
from .lr import LR
class LogisticRegression():
def fit(self,X,Y):
LR.fit(self,X,Y)
#self.ran=0
return self
def hypo(self,it):
res=1/(1+e**(-LR.hyp(self,it)))
return res
def cost(self):
s=0
for _ in range(self.m):
s+=self.target[_]*log(self.hypo(_))+(1-se... | mit | Python |
c2ee17b335d686b44d6cd05adadc17b69797993b | fix bugs | Charleo85/SIS-Rebuild,Charleo85/SIS-Rebuild,Charleo85/SIS-Rebuild,Charleo85/SIS-Rebuild | web/web/urls.py | web/web/urls.py | """web URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... | """web URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... | bsd-3-clause | Python |
a321d58730d491417dc08c7b8370149d07b460eb | Update count python script for 2.10 | zapbot/zap-mgmt-scripts,zapbot/zap-mgmt-scripts,zapbot/zap-mgmt-scripts | count-zap-downloads.py | count-zap-downloads.py | #!/usr/bin/env python
# This script generates the dynamic data for http://zapbot.github.io/zap-mgmt-scripts/downloads.html
import glob,json,os,sys
# The file names
REL = 'v2.10.0'
CORE = 'ZAP_2.10.0_Core.zip'
CROSS = 'ZAP_2.10.0_Crossplatform.zip'
LINUX = 'ZAP_2.10.0_Linux.tar.gz'
UNIX = 'ZAP_2_10_0_unix.sh'
MAC = 'Z... | #!/usr/bin/env python
# This script generates the dynamic data for http://zapbot.github.io/zap-mgmt-scripts/downloads.html
import glob,json,os,sys
# The file names
REL = 'v2.9.0'
CORE = 'ZAP_2.9.0_Core.zip'
CROSS = 'ZAP_2.9.0_Crossplatform.zip'
LINUX = 'ZAP_2.9.0_Linux.tar.gz'
UNIX = 'ZAP_2_9_0_unix.sh'
MAC = 'ZAP_2.... | apache-2.0 | Python |
d5deb7149c633fffe34f2a264bdba01e4d920942 | 添加 poll 函数 | encorehu/webqq | webqq/client.py | webqq/client.py | class WebQQClient(object):
def login(self, username=None, password=None):
return True
def logout(self):
pass
def heartbeat(self):
print 'Bom..bong!'
def poll(self):
return 'poll'
def run_forever(self):
i=0
while True:
... | class WebQQClient(object):
def login(self, username=None, password=None):
return True
def logout(self):
pass
def heartbeat(self):
print 'Bom..bong!'
def run_forever(self):
i=0
while True:
i=i+1
if i>100:
... | mit | Python |
54e0c6cb69f0d1cd659d4ed6f0ce3592daaf73c5 | raise error if status code not 200 in timegetter | m0re4u/SmartLight,m0re4u/SmartLight,m0re4u/SmartLight | modules/time_getter.py | modules/time_getter.py | import json
import yaml
import requests
from datetime import datetime
def light_on(yml_path="../config.yml"):
with open(yml_path) as f:
config = yaml.load(f)
r = requests.get(
"http://api.sunrise-sunset.org/json?lat={}&lng={}&date=today".format(
config['longitude'], config['latitud... | import json
import yaml
import requests
from datetime import datetime
def light_on(yml_path="../config.yml"):
with open(yml_path) as f:
config = yaml.load(f)
r = requests.get(
"http://api.sunrise-sunset.org/json?lat={}&lng={}&date=today".format(
config['longitude'], config['latitud... | mit | Python |
d505f346eb1efc01b1f75ea91c2e52616430645f | tweak route being tested | mozilla/make.mozilla.org,mozilla/make.mozilla.org,mozilla/make.mozilla.org,mozilla/make.mozilla.org | make_mozilla/users/tests/test_views.py | make_mozilla/users/tests/test_views.py | from django.conf import settings
from django.utils import unittest
from mock import patch, Mock
from nose.tools import eq_, ok_
from make_mozilla.base.tests.assertions import assert_routing
from make_mozilla.users import views
class LoginJumpPageTest(unittest.TestCase):
def test_that_it_routes(self):
ass... | from django.conf import settings
from django.utils import unittest
from mock import patch, Mock
from nose.tools import eq_, ok_
from make_mozilla.base.tests.assertions import assert_routing
from make_mozilla.users import views
rf = RequestFactory()
class LoginJumpPageTest(unittest.TestCase):
def test_that_it_ro... | bsd-3-clause | Python |
5f716da231aa3f338300295695b1513aa404ae7d | Use http instead of https | lino-framework/xl,lino-framework/xl,lino-framework/xl,lino-framework/xl | lino_xl/lib/appypod/__init__.py | lino_xl/lib/appypod/__init__.py | # Copyright 2014-2019 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""
Adds functionality for generating printable documents using
LibreOffice and the `appy.pod <http://appyframework.org/pod.html>`__
package.
See also :ref:`lino.admin.appypod` and :doc:`/specs/appypod`.
"""
import six
from lino.api i... | # Copyright 2014-2019 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""
Adds functionality for generating printable documents using
LibreOffice and the `appy.pod <http://appyframework.org/pod.html>`__
package.
See also :ref:`lino.admin.appypod` and :doc:`/specs/appypod`.
"""
import six
from lino.api i... | bsd-2-clause | Python |
6f6bf45582ad06977e890d295b85290b1d169a01 | update doc | pfnet/chainercv,yuyu2172/chainercv,chainer/chainercv,chainer/chainercv,yuyu2172/chainercv | chainercv/transforms/image/pca_lighting.py | chainercv/transforms/image/pca_lighting.py | import numpy
def pca_lighting(img, sigma, eigen_value=None, eigen_vector=None):
"""AlexNet style color augmentation
This method adds a noise vector drawn from a Gaussian. The direction of
the Gaussian is same as that of the principal components of the dataset.
This method is used in training of Alex... | import numpy
def pca_lighting(img, sigma, eigen_value=None, eigen_vector=None):
"""Alter the intensities of input image using PCA.
This is used in training of AlexNet [1].
.. [1] Alex Krizhevsky, Ilya Sutskever, Geoffrey E. Hinton. \
ImageNet Classification with Deep Convolutional Neural Networks. \... | mit | Python |
b49f733d675d537779bed931d0a079888a83a735 | Revert "Bump dev version to 0.3.0-dev.1" | missionpinball/mpf-monitor | mpfmonitor/_version.py | mpfmonitor/_version.py | # mpf-monitor
__version__ = '0.2.0-dev.3'
__short_version__ = '0.2'
__bcp_version__ = '1.1'
__config_version__ = '4'
__mpf_version_required__ = '0.33.0.dev15'
version = "MPF Monitor v{} (config_version={}, BCP v{}, Requires MPF v{})".format(
__version__, __config_version__, __bcp_version__, __mpf_version_required_... | # mpf-monitor
__version__ = '0.3.0-dev.1'
__short_version__ = '0.3'
__bcp_version__ = '1.1'
__config_version__ = '4'
__mpf_version_required__ = '0.33.0'
version = "MPF Monitor v{} (config_version={}, BCP v{}, Requires MPF v{})".format(
__version__, __config_version__, __bcp_version__, __mpf_version_required__)
| mit | Python |
e353ec6950edc4137cd8fa937e40cb0f6c76ca86 | Add support for lists to assert_equal_ignore | CybOXProject/python-cybox | cybox/test/__init__.py | cybox/test/__init__.py | import json
def assert_equal_ignore(item1, item2, ignore_keys=None):
"""Recursively compare two dictionaries, ignoring differences in some keys.
"""
if not ignore_keys:
ignore_keys = []
if isinstance(item1, dict) and isinstance(item2, dict):
item1keys = set(item1.keys())
item2... | import json
def assert_equal_ignore(item1, item2, ignore_keys=None):
"""Recursively compare two dictionaries, ignoring differences in some keys.
"""
if not ignore_keys:
ignore_keys = []
if not (isinstance(item1, dict) and isinstance(item2, dict)):
assert item1 == item2, "%s != %s" % (... | bsd-3-clause | Python |
0c29ee8be7ba2ccb9dd16c98065b56f1c6e4c92e | fix lint | plotly/dash,plotly/dash,plotly/dash,plotly/dash,plotly/dash | dash/testing/plugin.py | dash/testing/plugin.py | # pylint: disable=missing-docstring,redefined-outer-name
import pytest
from selenium import webdriver
from dash.testing.application_runners import ThreadedRunner, ProcessRunner
from dash.testing.browser import Browser
from dash.testing.composite import DashComposite
WEBDRIVERS = {
"Chrome": webdriver.Chrome,
... | # pylint: disable=missing-docstring
import pytest
from selenium import webdriver
from dash.testing.application_runners import ThreadedRunner, ProcessRunner
from dash.testing.browser import Browser
from dash.testing.composite import DashComposite
WEBDRIVERS = {
"Chrome": webdriver.Chrome,
"Firefox": webdriver... | mit | Python |
b8c82af3b98e30ca9447d610a6a6b5859c1c90de | Bump version to 0.21.11 | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | mythril/__version__.py | mythril/__version__.py | """This file contains the current Mythril version.
This file is suitable for sourcing inside POSIX shell, e.g. bash as well
as for importing into Python.
"""
__version__ = "v0.21.11"
| """This file contains the current Mythril version.
This file is suitable for sourcing inside POSIX shell, e.g. bash as well
as for importing into Python.
"""
__version__ = "v0.21.10"
| mit | Python |
07726b187b6dc6a6c49a3ea701cd1f1be11cb6d0 | Use mocks to test the decorators. | jaapverloop/knot | test_knot.py | test_knot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from mock import MagicMock
from knot import Container, factory, service, provider
class TestContainer(unittest.TestCase):
def test_returns_return_value_provider(self):
c = Container()
def foo(container):
return 'bar'
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from knot import Container, factory, service, provider
class TestContainer(unittest.TestCase):
def test_returns_return_value_provider(self):
c = Container()
def foo(container):
return 'bar'
c.add_provider(foo, Fal... | mit | Python |
a36d128a1af653760a7ea20f803e3f39d4e514e5 | Use the new optional argument to endRequest in the middleware | SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange | app/soc/middleware/value_store.py | app/soc/middleware/value_store.py | #!/usr/bin/python2.5
#
# Copyright 2009 the Melange 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... | #!/usr/bin/python2.5
#
# Copyright 2009 the Melange 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... | apache-2.0 | Python |
60a4010e25404e0211e938a2a2109e9244273d78 | fix for filer_gui_file_thumb templatetag | rouxcode/django-filer-addons,rouxcode/django-filer-addons,rouxcode/django-filer-addons,rouxcode/django-filer-addons | filer_addons/filer_gui/templatetags/filer_gui_tags.py | filer_addons/filer_gui/templatetags/filer_gui_tags.py | from django import template
from easy_thumbnails.exceptions import InvalidImageFormatError
from easy_thumbnails.files import get_thumbnailer
# support very big images
# https://stackoverflow.com/questions/51152059/pillow-in-python-wont-let-me-open-image-exceeds-limit
import PIL.Image
PIL.Image.MAX_IMAGE_PIXELS = 933120... | from django import template
from easy_thumbnails.exceptions import InvalidImageFormatError
from easy_thumbnails.files import get_thumbnailer
# support very big images
# https://stackoverflow.com/questions/51152059/pillow-in-python-wont-let-me-open-image-exceeds-limit
import PIL.Image
PIL.Image.MAX_IMAGE_PIXELS = 933120... | mit | Python |
aa077a89ac66787a90fcf066c5466a8152d8dc31 | Set final_link field of Work model as optional | fernandolobato/balarco,fernandolobato/balarco,fernandolobato/balarco | works/models.py | works/models.py | from django.db import models
from django.contrib.auth.models import User
from clients.models import Client, Contact
from balarco import utils
class WorkType(models.Model):
name = models.CharField(max_length=100)
class ArtType(models.Model):
work_type = models.ForeignKey(WorkType, related_name='art_types', ... | from django.db import models
from django.contrib.auth.models import User
from clients.models import Client, Contact
from balarco import utils
class WorkType(models.Model):
name = models.CharField(max_length=100)
class ArtType(models.Model):
work_type = models.ForeignKey(WorkType, related_name='art_types', ... | mit | Python |
eb6b21ed3cbb1607910f10c21a93d120591d1190 | move to wasabi for printing messages | datascopeanalytics/scrubadub,deanmalmgren/scrubadub,deanmalmgren/scrubadub,datascopeanalytics/scrubadub | tests/run.py | tests/run.py | #!/usr/bin/env python
"""Run the test suite that is specified in the .travis.yml file
"""
import os
import sys
import subprocess
import yaml
from wasabi import msg
def run_test(command, directory):
"""Execute a command that runs a test"""
wrapped_command = "cd %s && %s" % (directory, command)
pipe = sub... | #!/usr/bin/env python
"""Run the test suite that is specified in the .travis.yml file
"""
import os
import sys
import subprocess
import yaml
from colors import green, red
def run_test(command, directory):
"""Execute a command that runs a test"""
wrapped_command = "cd %s && %s" % (directory, command)
pi... | mit | Python |
ad1131a3382963a4a17f78ed12194aeb67a2a240 | Clean up lint and long lines in local.py | yougov/pmxbot,yougov/pmxbot,yougov/pmxbot | local.py | local.py | """
Local pmxbot extensions, incude the path to this file in your config.yaml.
"""
import random
import urllib
from pmxbot import command, execdelay
@command("yahoolunch", doc="Find a random neary restaurant for lunch using "
"Yahoo Local. Defaults to 1 mile radius, but append Xmi to the end to "
"change the... | """
Local pmxbot extensions, incude the path to this file in your config.yaml.
"""
@command("yahoolunch", doc="Find a random neary restaurant for lunch using Yahoo Local. Defaults to 1 mile radius, but append Xmi to the end to change the radius.")
def lunch(client, event, channel, nick, rest):
yahooid = "eeGETYOUR... | mit | Python |
11a144016b66361d79e1fdcc5e6b15085051929b | add websites to admin | Fresnoy/kart,Fresnoy/kart | common/admin.py | common/admin.py | from django.contrib import admin
from .models import Website
admin.site.register(Website)
| from django.contrib import admin
# Register your models here.
| agpl-3.0 | Python |
55d95118d3d694bef0656a4403d7a24e321cf332 | Update to set functions. | iShoto/testpy | codes/20200107_arcface_pytorch/src/temp.py | codes/20200107_arcface_pytorch/src/temp.py | from __future__ import print_function
import os
import numpy as np
import random
import time
import torch
from torch.utils import data
import torch.nn.functional as F
from torch.nn import DataParallel
from torch.optim.lr_scheduler import StepLR
import torchvision
from config import config
from utils import visualize... | from __future__ import print_function
import os
import numpy as np
import random
import time
import torch
from torch.utils import data
import torch.nn.functional as F
from torch.nn import DataParallel
from torch.optim.lr_scheduler import StepLR
import torchvision
from config import config
from utils import visualize... | mit | Python |
329305b3da831bff3b883e368396f7c74b0bea90 | print slug of new docs | hoover/search,hoover/search,hoover/search | collector/management/commands/configure.py | collector/management/commands/configure.py | import yaml
from django.core.management.base import BaseCommand
from django.utils.module_loading import import_string
from ...models import Document
class Command(BaseCommand):
help = "Imprt configuration file"
def add_arguments(self, parser):
parser.add_argument('config_path')
def handle(self,... | import yaml
from django.core.management.base import BaseCommand
from django.utils.module_loading import import_string
from ...models import Document
class Command(BaseCommand):
help = "Imprt configuration file"
def add_arguments(self, parser):
parser.add_argument('config_path')
def handle(self,... | mit | Python |
d99011bc623f0c02c3fa35050c282f273f153d87 | Update RestartProgram.py | VitorHugoAguiar/ProBot,VitorHugoAguiar/ProBot,VitorHugoAguiar/ProBot,VitorHugoAguiar/ProBot | ProBot_BeagleBone/RestartProgram.py | ProBot_BeagleBone/RestartProgram.py | #!/usr/bin/python
import sys
import os
import zmq
import SocketCommunication
# Initialization of classes from local files
Pub_Sub = SocketCommunication.publisher_and_subscriber()
class Restart():
def RestartProgram (self):
while True:
# Checking if the program needs to restart
restartVar = Pub_Sub.subscriber... | #!/usr/bin/python
import sys
import os
import zmq
import SocketCommunication
Pub_Sub = SocketCommunication.publisher_and_subscriber()
class Restart():
def RestartProgram (self):
while True:
# Checking if the program needs to restart
restartVar = Pub_Sub.subscriber2()
if restartVar is None:
restartVa... | agpl-3.0 | Python |
36ebb3e124335fc99d14b8721164e4ea14a889b4 | Add --force option to backfill_course_outlines. | eduNEXT/edx-platform,arbrandes/edx-platform,arbrandes/edx-platform,eduNEXT/edunext-platform,eduNEXT/edx-platform,eduNEXT/edunext-platform,angelapper/edx-platform,edx/edx-platform,EDUlib/edx-platform,arbrandes/edx-platform,EDUlib/edx-platform,EDUlib/edx-platform,EDUlib/edx-platform,eduNEXT/edunext-platform,angelapper/ed... | cms/djangoapps/contentstore/management/commands/backfill_course_outlines.py | cms/djangoapps/contentstore/management/commands/backfill_course_outlines.py | """
Management command to create the course outline for all courses that are missing
an outline. Outlines are built automatically on course publish and manually
using the `update_course_outline` command, but they can be backfilled using this
command. People updating to Lilac release should run this command as part of t... | """
Management command to create the course outline for all courses that are missing
an outline. Outlines are built automatically on course publish and manually
using the `update_course_outline` command, but they can be backfilled using this
command. People updating to Lilac release should run this command as part of t... | agpl-3.0 | Python |
37956a6f0fae8506abd026d4f9eb70fdfb496c84 | handle errors in AsyncRequest | oconnor663/fbmessenger,oconnor663/fbmessenger,oconnor663/fbmessenger | network.py | network.py | import threading
try:
# python3
from urllib.request import urlopen
from urllib.parse import urlsplit, parse_qs, urlencode, urlunsplit
except ImportError:
#python2
from urllib import urlopen, urlencode
from urlparse import urlsplit, parse_qs, urlunsplit
import settings
import event
class AsyncRequest(thre... | import threading
try:
# python3
from urllib.request import urlopen
from urllib.parse import urlsplit, parse_qs, urlencode, urlunsplit
except ImportError:
#python2
from urllib import urlopen, urlencode
from urlparse import urlsplit, parse_qs, urlunsplit
import settings
import event
class AsyncRequest(thre... | bsd-3-clause | Python |
047a8fb22717fcee8a4725827c85cb1013d07e15 | Change send-alert script | ivantsov/lens_alert_proto,ShpuntiK/lens_alert_proto,ivantsov/lens_alert_proto,ShpuntiK/lens_alert_proto | app/management/commands/send_alert.py | app/management/commands/send_alert.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from django.core.mail import send_mass_mail
from django.contrib.auth.models import User
from app.models import Alert
from datetime import datetime
class Command(BaseCommand):
args = ''
help = 'Run alerts ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from django.core.mail import send_mass_mail
from django.contrib.auth.models import User
from app.models import Alert
from datetime import datetime
class Command(BaseCommand):
args = ''
help = 'Run alerts ... | mit | Python |
e606d44c7fcaf28adbae8c68e23fa33366a57dd7 | Change script for email alerts | ivantsov/lens_alert_proto,ShpuntiK/lens_alert_proto,ivantsov/lens_alert_proto,ShpuntiK/lens_alert_proto | app/management/commands/send_alert.py | app/management/commands/send_alert.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from django.core.mail import send_mass_mail
from django.contrib.auth.models import User
from app.models import Alert
from datetime import datetime, date, timedelta
class Command(BaseCommand):
args = ''
he... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from django.core.mail import send_mass_mail
from django.contrib.auth.models import User
from app.models import Alert
from datetime import datetime
class Command(BaseCommand):
args = ''
help = 'Run alerts ... | mit | Python |
1c59bae012249d5e1624d1b9445590b499546d80 | change save interval | iizukak/nupic-nlp-experiment | src/pos_prediction.py | src/pos_prediction.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import unicodecsv as csv
from nupic.data.inference_shifter import InferenceShifter
from nupic.frameworks.opf.modelfactory import ModelFactory
import pprint
import os
import model_params.model_params as model_params
import pos_tags
DATA_DIR = "data/"
INPUT_FILE = "firef... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import unicodecsv as csv
from nupic.data.inference_shifter import InferenceShifter
from nupic.frameworks.opf.modelfactory import ModelFactory
import pprint
import os
import model_params.model_params as model_params
import pos_tags
DATA_DIR = "data/"
INPUT_FILE = "firef... | agpl-3.0 | Python |
48587d0c7a5906bd95c2c26db92365bf0843ddee | add Music | zhengze/zblog,zhengze/zblog,zhengze/zblog,zhengze/zblog | zblog/models.py | zblog/models.py | from django.db import models
class Classify(models.Model):
name = models.CharField(max_length=20)
def __unicode__(self):
return self.name
class Tag(models.Model):
name = models.CharField(max_length=20)
def __unicode__(self):
return self.name
class Article(models.Model):
titl... | from django.db import models
class Classify(models.Model):
name = models.CharField(max_length=20)
def __unicode__(self):
return self.name
class Tag(models.Model):
name = models.CharField(max_length=20)
def __unicode__(self):
return self.name
class Article(models.Model):
title ... | mit | Python |
a677e25a75291091a23e309afd30c2542f8a61f1 | Bump version (0.3.10) | cgwire/zou | zou/__init__.py | zou/__init__.py | __version__ = "0.3.10"
| __version__ = "0.3.9"
| agpl-3.0 | Python |
2ff50deea8f8b605af7e21fa8a448bc68d2844b4 | Fix is_locked() | stuartarchibald/numba,sklam/numba,IntelLabs/numba,cpcloud/numba,stonebig/numba,cpcloud/numba,seibert/numba,gmarkall/numba,numba/numba,IntelLabs/numba,numba/numba,jriehl/numba,seibert/numba,seibert/numba,sklam/numba,numba/numba,cpcloud/numba,cpcloud/numba,sklam/numba,sklam/numba,gmarkall/numba,gmarkall/numba,jriehl/numb... | numba/compiler_lock.py | numba/compiler_lock.py | import threading
import functools
# Lock for the preventing multiple compiler execution
class _CompilerLock(object):
def __init__(self):
self._lock = threading.RLock()
self._locked = 0
def acquire(self):
self._lock.acquire()
self._locked += 1
def release(self):
se... | import threading
import functools
# Lock for the preventing multiple compiler execution
class _CompilerLock(object):
def __init__(self):
self._lock = threading.RLock()
self._locked = False
def acquire(self):
self._lock.acquire()
self._locked = True
def release(self):
... | bsd-2-clause | Python |
8f37c13394143f90421ffcea45dbdf4282ecbdce | Add function to scan the network for IPs | dimriou/rupture,dionyziz/rupture,dimriou/rupture,esarafianou/rupture,dionyziz/rupture,dimriou/rupture,esarafianou/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dionyziz/rupture,dionyziz/rupture,dimkarakostas/rupture,esarafianou/rupture,dimkarakostas/rupture,esarafianou/rupture,dimkarakostas/rupture,dionyziz/ruptu... | backend/breach/helpers/network.py | backend/breach/helpers/network.py | import netifaces
import ipaddress
import subprocess
import os
from bs4 import BeautifulSoup
def get_interface():
return netifaces.gateways()['default'][netifaces.AF_INET][1]
def get_local_IP():
def_gw_device = get_interface()
return netifaces.ifaddresses(def_gw_device)[netifaces.AF_INET][0]['addr']
de... | import netifaces
def get_interface():
return netifaces.gateways()['default'][netifaces.AF_INET][1]
def get_local_IP():
def_gw_device = get_interface()
return netifaces.ifaddresses(def_gw_device)[netifaces.AF_INET][0]['addr']
def get_netmask():
def_gw_device = get_interface()
return netifaces.i... | mit | Python |
f8df32c28905cd97b6bfd562d16ed2394a67d297 | Fix Dick Blick scraper | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/dick_blick.py | locations/spiders/dick_blick.py | # -*- coding: utf-8 -*-
import scrapy
import re
from locations.items import GeojsonPointItem
class DickBlickSpider(scrapy.Spider):
name = "dick_blick"
allowed_domains = ["www.dickblick.com"]
start_urls = (
'https://www.dickblick.com/stores/',
)
def parse_store(self, response):
co... | # -*- coding: utf-8 -*-
import scrapy
import re
from scrapy.utils.url import urljoin_rfc
from scrapy.utils.response import get_base_url
from locations.items import GeojsonPointItem
class DickBlickSpider(scrapy.Spider):
name = "dick_blick"
allowed_domains = ["www.dickblick.com"]
start_urls = (
'htt... | mit | Python |
3af2a5b6eda4af972e3a208e727483384f313cb9 | Remove index and check filename | jason-neal/equanimous-octo-tribble,jason-neal/equanimous-octo-tribble,jason-neal/equanimous-octo-tribble | octotribble/csv2tex.py | octotribble/csv2tex.py | #!/usr/bin/env python
"""Convert a CSV table into a latex tabular using pandas."""
import argparse
import pandas as pd
def convert(filename, transpose=False):
"""convert csv to tex table."""
df = pd.read_csv(filename)
if transpose:
df = df.transpose()
tex_name = filename.replace(".csv", ... | #!/usr/bin/env python
"""Convert a CSV table into a latex tabular using pandas."""
import argparse
import pandas as pd
def convert(filename, transpose=False):
"""convert csv to tex table."""
df = pd.read_csv(filename)
if transpose:
df = df.transpose()
tex_name = filename.replace(".csv", ... | mit | Python |
bae92f91baa43e44582d78a4183868b8b32016e9 | Put new values from supervisor | atooma/makerfaire-2014,atooma/makerfaire-2014 | GreenThumb/supervisor.py | GreenThumb/supervisor.py | # -*- coding: utf-8 -*-
import dht11
import time
import os
import requests
import json
measurements_buffer = {}
def ouput_val(pin):
pin_hash = str(pin)
try:
(humidity, temperature) = dht11.read(pin)
measurements_buffer[pin_hash] = (humidity, temperature)
except:
if pin_hash in mea... | # -*- coding: utf-8 -*-
import dht11
import time
import os
measurements_buffer = {}
def ouput_val(pin):
pin_hash = str(pin)
try:
(humidity, temperature) = dht11.read(pin)
measurements_buffer[pin_hash] = (humidity, temperature)
except:
if pin_hash in measurements_buffer:
... | mit | Python |
75b50ffcb6575e38e6792356dd58612089ee4f55 | Return 400 for inexistant accounts | asermax/django-mercadopago | django_mercadopago/views.py | django_mercadopago/views.py | import logging
from django.conf import settings
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from .models import Notification, Account
logger = logging.getLogger(__name__)
# Maybe use a form for this? :D
@csrf_exempt
def create_notification(request, slug):
topic = ... | import logging
from django.conf import settings
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from .models import Notification, Account
logger = logging.getLogger(__name__)
# Maybe use a form for this? :D
@csrf_exempt
def create_notification(request, slug):
topic = ... | isc | Python |
08be96e39db786b1187ab7acc8beafe5c186ae54 | Bump Version | mishbahr/djangocms-forms,mishbahr/djangocms-forms,mishbahr/djangocms-forms | djangocms_forms/__init__.py | djangocms_forms/__init__.py | __version__ = '0.2.4'
default_app_config = 'djangocms_forms.apps.DjangoCMSFormsConfig'
| __version__ = '0.2.3'
default_app_config = 'djangocms_forms.apps.DjangoCMSFormsConfig'
| bsd-3-clause | Python |
e2d5fcf9997ff7cdac1ba55b6fe47e4e6ad2b182 | simplify options | claman/apollo,claman/percival | percy.py | percy.py | #!/usr/bin/python
import argparse
file = open('your filename here', 'r') # change this to correspond to your list
def getYear(date):
slashDate = date.split('/')
year = slashDate[2]
return year
def info(title, author, owned, start, end, format, date):
print title + ' by ' + author
print 'Owned: ' + owned
pr... | #!/usr/bin/python
import argparse
file = open('your filename here', 'r') # change this to correspond to your list
def getYear(date):
slashDate = date.split('/')
year = slashDate[2]
return year
def info(title, author, owned, start, end, format, date):
print title + ' by ' + author
print 'Owned: ' + owned
pr... | mit | Python |
d52c9460411fee14a66eaf8f4793ea25e349d6f7 | Make sure the _texture is always defined. | onitake/Uranium,onitake/Uranium | UM/Scene/Platform.py | UM/Scene/Platform.py | from . import SceneNode
from UM.Application import Application
from UM.View.Renderer import Renderer
from UM.Resources import Resources
class Platform(SceneNode.SceneNode):
def __init__(self, parent):
super().__init__(parent)
self._settings = None
self._material = None
self._textu... | from . import SceneNode
from UM.Application import Application
from UM.View.Renderer import Renderer
from UM.Resources import Resources
class Platform(SceneNode.SceneNode):
def __init__(self, parent):
super().__init__(parent)
self._settings = None
self._material = None
Application... | agpl-3.0 | Python |
d7dacfc6bdb80a9ad09bd58c20e97516a62da58f | Update zipslip_good.py | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | python/ql/src/experimental/Security/CWE-022/zipslip_good.py | python/ql/src/experimental/Security/CWE-022/zipslip_good.py | import zipfile
def unzip(filename, dir):
zf = zipfile.ZipFile(filename)
zf.extractall(dir)
def unzip1(filename, dir):
zf = zipfile.ZipFile(filename)
zf.extract(dir)
| import zipfile
zf = zipfile.ZipFile(filename)
with zipfile.open() as zipf:
for entry in zipf:
zipf.extract(entry, "/tmp/unpack/")
| mit | Python |
109a6aec8b8b4a888462129bb9f5cac01ddc97f9 | Update jupyter_notebook_config.py (#3664) | davidzchen/tensorflow,xzturn/tensorflow,thjashin/tensorflow,haeusser/tensorflow,with-git/tensorflow,handroissuazo/tensorflow,vrv/tensorflow,alisidd/tensorflow,aam-at/tensorflow,ZhangXinNan/tensorflow,anand-c-goog/tensorflow,allenlavoie/tensorflow,yufengg/tensorflow,apark263/tensorflow,snnn/tensorflow,rabipanda/tensorfl... | tensorflow/tools/docker/jupyter_notebook_config.py | tensorflow/tools/docker/jupyter_notebook_config.py | # Copyright 2015 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 2015 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 |
05e671a41641746802f6ae6155f79fdcb13a3c6a | Fix Authorization header that is not a Bearer to not return a token | oauthlib/oauthlib | oauthlib/openid/connect/core/tokens.py | oauthlib/openid/connect/core/tokens.py | """
authlib.openid.connect.core.tokens
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains methods for adding JWT tokens to requests.
"""
from oauthlib.oauth2.rfc6749.tokens import TokenBase, random_token_generator
class JWTToken(TokenBase):
__slots__ = (
'request_validator', 'token_generator',
... | """
authlib.openid.connect.core.tokens
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains methods for adding JWT tokens to requests.
"""
from oauthlib.oauth2.rfc6749.tokens import TokenBase, random_token_generator
class JWTToken(TokenBase):
__slots__ = (
'request_validator', 'token_generator',
... | bsd-3-clause | Python |
8063970bd063d53cf2a05734643f6326f69bcd97 | move to release 0.0.7 | Eric89GXL/sphinx-gallery,sphinx-gallery/sphinx-gallery,Titan-C/sphinx-gallery,Titan-C/sphinx-gallery,lesteve/sphinx-gallery,Eric89GXL/sphinx-gallery,sphinx-gallery/sphinx-gallery,lesteve/sphinx-gallery | sphinxgallery/__init__.py | sphinxgallery/__init__.py | """Sphinx Gallery
"""
import os
__version__ = '0.0.7'
def path_static():
"""Returns path to packaged static files"""
return os.path.abspath(os.path.dirname(__file__))+'/_static'
| """Sphinx Gallery
"""
import os
__version__ = '0.0.6'
def _path_static():
"""Returns path to packaged static files"""
return os.path.abspath(os.path.dirname(__file__))+'/_static'
| bsd-3-clause | Python |
7777bb182906e7808f407d0d0c9eb25adaae5417 | Define debug. | soasme/riotpy | riot/utils.py | riot/utils.py | # -*- coding: utf-8 -*-
import sys
def debug(*args):
for arg in args:
print >> sys.stderr, arg,
print >> sys.stderr, ''
def walk(root, function, path=None):
if not root:
return
path = path or []
if not function(root, path):
return
for index, child in enumerate(root.chil... | # -*- coding: utf-8 -*-
import sys
def walk(root, function, path=None):
if not root:
return
path = path or []
if not function(root, path):
return
for index, child in enumerate(root.children().items()):
walk(child, function, path + [index])
def get_ui_by_path(root, path):
im... | mit | Python |
2ab0083a2b143130d19552a37ae4366b2a681720 | Add a comment explaining what these tests are for, and where to look for tests of complex(). | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_complex.py | Lib/test/test_complex.py | from test_support import TestFailed
from random import random
# These tests ensure that complex math does the right thing; tests of
# the complex() function/constructor are in test_b1.py.
# XXX need many, many more tests here.
nerrors = 0
def check_close_real(x, y, eps=1e-9):
"""Return true iff floats x and y "... | from test_support import TestFailed
from random import random
# XXX need many, many more tests here.
nerrors = 0
def check_close_real(x, y, eps=1e-9):
"""Return true iff floats x and y "are close\""""
# put the one with larger magnitude second
if abs(x) > abs(y):
x, y = y, x
if y == 0:
... | mit | Python |
a2810fb4154685456e8ad4381234e109cf657d6e | modify assert in distance.py | k2kobayashi/sprocket | sprocket/util/distance.py | sprocket/util/distance.py | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import numpy as np
def melcd(array1, array2):
"""Calculate mel-cepstrum distortion
Calculate mel-cepstrum distortion between the arrays.
This function assumes the shapes of arrays are same.
Parameters
----... | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import numpy as np
def melcd(array1, array2):
"""Calculate mel-cepstrum distortion
Calculate mel-cepstrum distortion between the arrays
or vectors. This function assumes the shapes of arrays
or vectors are same... | mit | Python |
870915b4ff62911a4d19295b45ff9e95a92532d3 | Simplify runner for installer | SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview | installers/sasview.py | installers/sasview.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
Run sasview from an installed bundle
"""
import sys
sys.dont_write_bytecode = True
from sas.qtgui.MainWindow.MainWindow import run_sasview
run_sasview()
| # -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
Run sasview in place. This allows sasview to use the python
files in the source tree without having to call setup.py install
first. A rebuild is still necessary when working on sas models
or c modules.
Usage:
./run.py [(module|script) args...]
Without arguments ru... | bsd-3-clause | Python |
d4a1282e7e7c3a6cc804d2f583d37d484961adad | handle the case where a package has no downloads | crateio/crate.io | crate_project/apps/packages/stats/views.py | crate_project/apps/packages/stats/views.py | import collections
import json
import time
import isoweek
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from packages.models import Package, Release, DownloadDelta, DownloadStatsCache
def fetch_stats(package):
releases = Release.objects.filter(package=package)
releases... | import collections
import json
import time
import isoweek
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from packages.models import Package, Release, DownloadDelta, DownloadStatsCache
def fetch_stats(package):
releases = Release.objects.filter(package=package)
releases... | bsd-2-clause | Python |
2d6ea66a5ef078ec000dee05ba855ee5e22fbd6c | Address review comments, fix signatures that the docs lied about | sholsapp/cryptography,skeuomorf/cryptography,kimvais/cryptography,Hasimir/cryptography,dstufft/cryptography,dstufft/cryptography,sholsapp/cryptography,dstufft/cryptography,sholsapp/cryptography,skeuomorf/cryptography,dstufft/cryptography,bwhmather/cryptography,skeuomorf/cryptography,Ayrx/cryptography,Ayrx/cryptography,... | cryptography/hazmat/bindings/openssl/dh.py | cryptography/hazmat/bindings/openssl/dh.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | bsd-3-clause | Python |
c2699d9769aff771985bac7fbb6dd60a943307f9 | add the tests results to pull | redhat-cip/dci-control-server,redhat-cip/dci-control-server | dci/analytics/access_data_layer.py | dci/analytics/access_data_layer.py | # -*- coding: utf-8 -*-
#
# Copyright (C) Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # -*- coding: utf-8 -*-
#
# Copyright (C) Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 | Python |
cf7b1be0c416142c6f0b991f715b9c9df88a0c05 | handle event priority in the DI extension | rande/python-simple-ioc,rande/python-simple-ioc | ioc/extra/event/di.py | ioc/extra/event/di.py | import ioc.loader, ioc.component, ioc.exceptions
import os, datetime
class Extension(ioc.component.Extension):
def load(self, config, container_builder):
container_builder.add('ioc.extra.event_dispatcher', ioc.component.Definition('ioc.event.Dispatcher'))
def post_build(self, container_builder, contai... | import ioc.loader, ioc.component, ioc.exceptions
import os, datetime
class Extension(ioc.component.Extension):
def load(self, config, container_builder):
container_builder.add('ioc.extra.event_dispatcher', ioc.component.Definition('ioc.event.Dispatcher'))
def post_build(self, container_builder, contai... | apache-2.0 | Python |
277222434b184cab036445aee95aac4e7dec8e31 | Revert "Let's ignore utf8 issues for now." | kbussell/django-docusign,kbussell/django-docusign,novafloss/django-docusign | demo/django_docusign_demo/tests.py | demo/django_docusign_demo/tests.py | # coding=utf8
import os
from django.core.urlresolvers import reverse
import django.test
from django_docusign_demo import models
here = os.path.abspath(os.path.dirname(__file__))
fixtures_dir = os.path.join(here, 'fixtures')
class SignatureFunctionalTestCase(django.test.TestCase):
"""Functional test suite for ... | # coding=utf8
import os
from django.core.urlresolvers import reverse
import django.test
from django_docusign_demo import models
here = os.path.abspath(os.path.dirname(__file__))
fixtures_dir = os.path.join(here, 'fixtures')
class SignatureFunctionalTestCase(django.test.TestCase):
"""Functional test suite for ... | bsd-3-clause | Python |
d3c753a145b173cd5cad9e053c691d8460dad8f0 | add _add_child to ForeignFutureOperation | genome/flow-workflow,genome/flow-workflow,genome/flow-workflow | flow_workflow/future_operation.py | flow_workflow/future_operation.py | from flow_workflow.factory import operation_variable_name
class FutureOperation(object):
def __init__(self, operation_class, operation_id, name, parent, **kwargs):
self.operation_class = operation_class
self.operation_id = int(operation_id)
self.name = name
self.parent = parent
... | from flow_workflow.factory import operation_variable_name
class FutureOperation(object):
def __init__(self, operation_class, operation_id, name, parent, **kwargs):
self.operation_class = operation_class
self.operation_id = int(operation_id)
self.name = name
self.parent = parent
... | agpl-3.0 | Python |
afce0f198e47b1fd1d8ba70ac748eda5e3943d25 | Remove get_normalized_sentiment. Sentiment score need not to be normalized. | studiawan/pygraphc | pygraphc/anomaly/SentimentAnalysis.py | pygraphc/anomaly/SentimentAnalysis.py | from textblob import TextBlob
from operator import itemgetter
class SentimentAnalysis(object):
"""Get sentiment analysis with only positive and negative considered.
Positive means normal logs and negative sentiment refers to possible attacks.
This class uses sentiment analysis feature from the TextBlob l... | from textblob import TextBlob
from operator import itemgetter
class SentimentAnalysis(object):
"""Get sentiment analysis with only positive and negative considered.
Positive means normal logs and negative sentiment refers to possible attacks.
This class uses sentiment analysis feature from the TextBlob l... | mit | Python |
2a63e93dc2ecb8f3d195411a140c6fc3c0c50bf7 | Remove missed `website.models` import | brianjgeiger/osf.io,icereval/osf.io,binoculars/osf.io,caneruguz/osf.io,adlius/osf.io,cslzchen/osf.io,baylee-d/osf.io,cslzchen/osf.io,chennan47/osf.io,cslzchen/osf.io,crcresearch/osf.io,chennan47/osf.io,CenterForOpenScience/osf.io,crcresearch/osf.io,cwisecarver/osf.io,mattclark/osf.io,caseyrollins/osf.io,caneruguz/osf.i... | framework/celery_tasks/signals.py | framework/celery_tasks/signals.py | # -*- coding: utf-8 -*-
"""Attach callbacks to signals emitted by Celery. This module should only be
imported by Celery and is not used elsewhere in the application.
"""
import logging
from celery import signals
from framework.mongo import StoredObject
from website import settings
logger = logging.getLogger(__name__... | # -*- coding: utf-8 -*-
"""Attach callbacks to signals emitted by Celery. This module should only be
imported by Celery and is not used elsewhere in the application.
"""
import logging
from celery import signals
from framework.mongo import storage, set_up_storage, StoredObject
from website import models, settings
lo... | apache-2.0 | Python |
b639e094f0ac9feb008c0d13deb26c55bbb50793 | Make jumping between changes loop back around | michaelhogg/GitGutter,biodamasceno/GitGutter,biodamasceno/GitGutter,robfrawley/sublime-git-gutter,robfrawley/sublime-git-gutter,robfrawley/sublime-git-gutter,robfrawley/sublime-git-gutter,biodamasceno/GitGutter,natecavanaugh/GitGutter,tushortz/GitGutter,michaelhogg/GitGutter,akpersad/GitGutter,akpersad/GitGutter,nateca... | git_gutter_change.py | git_gutter_change.py | import sublime
import sublime_plugin
try:
from GitGutter.view_collection import ViewCollection
except ImportError:
from view_collection import ViewCollection
class GitGutterBaseChangeCommand(sublime_plugin.WindowCommand):
def lines_to_blocks(self, lines):
blocks = []
last_line = -2
... | import sublime
import sublime_plugin
try:
from GitGutter.view_collection import ViewCollection
except ImportError:
from view_collection import ViewCollection
class GitGutterBaseChangeCommand(sublime_plugin.WindowCommand):
def lines_to_blocks(self, lines):
blocks = []
last_line = -2
... | mit | Python |
71e1369eab7a389cb8d89e62eaa24724a249524e | FIX constrains sale.order.type | ingadhoc/sale,ingadhoc/sale,ingadhoc/sale,ingadhoc/sale | sale_order_type_automation/sale_order_type.py | sale_order_type_automation/sale_order_type.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields, api, _
from op... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields, api, _
from op... | agpl-3.0 | Python |
926dc5a10fd9d54a6b183266f21834013ad05abb | Fix debugging issue in VSCode | nixxa/SecretShopper,nixxa/SecretShopper,nixxa/SecretShopper | frontui/app.py | frontui/app.py | """ Creat and init application """
import logging
from logging.handlers import TimedRotatingFileHandler
import os
from flask import Flask
from frontui import BASE_DIR
from frontui.views.public import public_ui
from frontui.views.member import member_ui
from frontui.views.customer import customer_ui
def create_app(app... | """ Creat and init application """
import logging
from logging.handlers import TimedRotatingFileHandler
import os
from flask import Flask
from frontui import BASE_DIR
from frontui.views.public import public_ui
from frontui.views.member import member_ui
from frontui.views.customer import customer_ui
def create_app(app... | mit | Python |
2ad6cdefabec041ace5afcdcffce7f6e6c2352fa | Add priors import to __init__.py | jrg365/gpytorch,jrg365/gpytorch,jrg365/gpytorch | gpytorch/__init__.py | gpytorch/__init__.py | from . import models
from . import means
from . import mlls
from . import kernels
from . import priors
from .module import Module
from .mlls import ExactMarginalLogLikelihood, VariationalMarginalLogLikelihood
from .functions import add_diag, add_jitter, dsmm, log_normal_cdf, normal_cdf
from .functions import inv_matmul... | from . import models
from . import means
from . import mlls
from . import kernels
from .module import Module
from .mlls import ExactMarginalLogLikelihood, VariationalMarginalLogLikelihood
from .functions import add_diag, add_jitter, dsmm, log_normal_cdf, normal_cdf
from .functions import inv_matmul, inv_quad, inv_quad_... | mit | Python |
66920331012c49b84f2d4d4f8d0ffbf058adc073 | tweak internet explorer so to avoid popups | cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo | analyzer/windows/modules/packages/ie.py | analyzer/windows/modules/packages/ie.py | # Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from _winreg import OpenKey, SetValueEx, CloseKey
from _winreg import HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER
from _winreg import KEY_SET_VALUE, REG_DWOR... | # Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from lib.common.abstracts import Package
class IE(Package):
"""Internet Explorer analysis package."""
PATHS = [
("ProgramFiles", "Inte... | mit | Python |
a6fa6fd8595510748d4d4fb06a1383dcea3288c2 | fix deoplete mark | lvht/phpcd.vim,przepompownia/phpcd.vim,lvht/phpcd.vim,przepompownia/phpcd.vim,przepompownia/phpcd.vim,lvht/phpcd.vim | rplugin/python3/deoplete/sources/phpcd.py | rplugin/python3/deoplete/sources/phpcd.py | from .base import Base
class Source(Base):
def __init__(self, vim):
Base.__init__(self, vim)
self.name = 'phpcd'
self.mark = '[phpcd]'
self.filetypes = ['php']
self.is_bytepos = True
self.input_pattern = '\w+|[^. \t]->\w*|\w+::\w*'
self.rank = 500
se... | from .base import Base
class Source(Base):
def __init__(self, vim):
Base.__init__(self, vim)
self.name = 'phpcd'
self.mark = '[php]'
self.filetypes = ['php']
self.is_bytepos = True
self.input_pattern = '\w+|[^. \t]->\w*|\w+::\w*'
self.rank = 500
self... | apache-2.0 | Python |
ba943a9c46f20b6f1b061ca1fff62df36a5d9562 | fix deoplete error | lvht/phpcd.vim,lvht/phpcd.vim,lvht/phpcd.vim | rplugin/python3/deoplete/sources/phpcd.py | rplugin/python3/deoplete/sources/phpcd.py | from .base import Base
from neovim.api.nvim import NvimError
class Source(Base):
def __init__(self, vim):
Base.__init__(self, vim)
self.name = 'phpcd'
self.mark = '[phpcd]'
self.filetypes = ['php']
self.is_bytepos = True
self.input_pattern = '\w+|[^. \t]->\w*|\w+::\... | from .base import Base
class Source(Base):
def __init__(self, vim):
Base.__init__(self, vim)
self.name = 'phpcd'
self.mark = '[phpcd]'
self.filetypes = ['php']
self.is_bytepos = True
self.input_pattern = '\w+|[^. \t]->\w*|\w+::\w*'
self.rank = 500
se... | apache-2.0 | Python |
21dd97cec5003f1e53f02b079da3130a606feb3a | Fix marker script support for '-c' flag (#18418) | DonJayamanne/pythonVSCode,DonJayamanne/pythonVSCode,DonJayamanne/pythonVSCode,DonJayamanne/pythonVSCode,DonJayamanne/pythonVSCode | pythonFiles/get_output_via_markers.py | pythonFiles/get_output_via_markers.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import runpy
import sys
# Sometimes executing scripts can print out stuff before the actual output is
# printed. For eg. when activating conda. Hence, printing out markers to make
# it more resilient to pull the output.
prin... | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import runpy
import sys
# Sometimes executing scripts can print out stuff before the actual output is
# printed. For eg. when activating conda. Hence, printing out markers to make
# it more resilient to pull the output.
prin... | mit | Python |
572c2f4a0a3a0ffedaa45184848e2d5a37fd2078 | Update helpers.py with new problems | samanehsan/spark_github,samanehsan/spark_github,samanehsan/learn-git,samanehsan/learn-git | helpers.py | helpers.py | """ A bunch of helper functions that, when fixed up, will return the things we
need to make this website work!
"""
## Import python libraries we need up here.
import requests
import random
###############################################
### Problem One! ###
##############################... | """ A bunch of helper functions that, when fixed up, will return the things we
need to make this website work!
"""
## Import python libraries we need up here.
import requests
import random
###############################################
### Problem One! ###
##############################... | apache-2.0 | Python |
4286953271952bfcfce0b122d1338b75e1daed70 | Remove unused parameter (#3306) | kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines | samples/core/exit_handler/exit_handler.py | samples/core/exit_handler/exit_handler.py | #!/usr/bin/env python3
# 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... | #!/usr/bin/env python3
# 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... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.