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 |
|---|---|---|---|---|---|---|---|---|
8d459d86d33992129726ef177ed24fe8a00e9b75 | Bump version to 4.0.0rc1 | platformio/platformio,platformio/platformio-core,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
5f917746e86c733d37c56e15a97f7aecb73fa75f | fix bug comparing string with int. int(games) | ChelseaStats/mssngVwlsRnd | python/guess_the_player.py | python/guess_the_player.py | # importing modules
import os
import csv
import time
import random
import tweepy
import player
# secrets
consumer_key = os.getenv('c_key')
consumer_secret = os.getenv('c_secret')
access_token = os.getenv('a_token')
access_token_secret = os.getenv('a_secret')
# authentication
auth = tweepy.OAuthHandler(consumer_key, c... | # importing modules
import os
import csv
import time
import random
import tweepy
import player
# secrets
consumer_key = os.getenv('c_key')
consumer_secret = os.getenv('c_secret')
access_token = os.getenv('a_token')
access_token_secret = os.getenv('a_secret')
# authentication
auth = tweepy.OAuthHandler(consumer_key, c... | unlicense | Python |
a172a17c815e8fcbe0f8473c6bac1ea1d9714817 | Bump version to 4.4.0a4 | platformio/platformio,platformio/platformio-core,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
54921c5dbdc68893fe45649d07d067818c36889b | Bump version to 4.0.0b3 | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
74ecf023ef13fdba6378d6b50b3eaeb06b9e0c97 | Rename env vars & modify query | avatao-content/challenge-toolbox,avatao-content/challenge-toolbox,avatao-content/challenge-toolbox,avatao-content/challenge-toolbox,avatao-content/challenge-toolbox,avatao-content/challenge-toolbox,avatao-content/challenge-toolbox,avatao-content/challenge-toolbox,avatao-content/challenge-toolbox | rebuild_dependant_repos.py | rebuild_dependant_repos.py | import os, sys, re
import requests
from github import Github
CIRCLECI_BASEURL = "https://circleci.com/api/v2"
CIRCLECI_ACCESS_TOKEN = os.environ["AVATAO_CIRCLECI_TOKEN"]
GITHUB_ACCESS_TOKEN = os.environ["AVATAO_GITHUB_TOKEN"]
g = Github(GITHUB_ACCESS_TOKEN)
if len(sys.argv) < 2:
raise AttributeError("The image na... | import os, sys, re, logging
import requests
from github import Github
logging.basicConfig(level=logging.DEBUG)
CIRCLECI_BASEURL = "https://circleci.com/api/v2"
CIRCLECI_ACCESS_TOKEN = os.environ["TAO_CIRCLECI_TOKEN"]
GITHUB_ACCESS_TOKEN = os.environ["TAO_GITHUB_TOKEN"]
g = Github(GITHUB_ACCESS_TOKEN)
if len(sys.argv... | apache-2.0 | Python |
0ba2b371e08c40e7c4d56efee6f4a828f1e7aeb0 | Update functions.py | KouKariya/tic-tac-toe-py | ref/functions/functions.py | ref/functions/functions.py | #functions.py
#Written by Jesse Gallarzo
#Add code here
#def functionOne():
#def functionTwo():
#def functionThree():
def main():
#Add code here
print('Test')
main()
| #functions.py
#Written by Jesse Gallarzo
#Add code here
#def function One:
def main():
#Add code here
print('Test')
main()
| mit | Python |
7847d22f95f44792e35108af24267161411c5bf1 | Remove settings override with no effect | bittner/django-analytical,pjdelport/django-analytical,jcassee/django-analytical | analytical/tests/test_tag_gosquared.py | analytical/tests/test_tag_gosquared.py | """
Tests for the GoSquared template tags and filters.
"""
from django.contrib.auth.models import User, AnonymousUser
from django.http import HttpRequest
from django.template import Context
from django.test.utils import override_settings
from analytical.templatetags.gosquared import GoSquaredNode
from analytical.test... | """
Tests for the GoSquared template tags and filters.
"""
from django.contrib.auth.models import User, AnonymousUser
from django.http import HttpRequest
from django.template import Context
from django.test.utils import override_settings
from analytical.templatetags.gosquared import GoSquaredNode
from analytical.test... | mit | Python |
8713f44fbd35f012ac7e01a64cffcfdf846fee9f | Remove a relative import that escaped test.test_importlib. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_importlib/__init__.py | Lib/test/test_importlib/__init__.py | import os
import sys
from test import support
import unittest
def test_suite(package=__package__, directory=os.path.dirname(__file__)):
suite = unittest.TestSuite()
for name in os.listdir(directory):
if name.startswith(('.', '__')):
continue
path = os.path.join(directory, name)
... | import os
import sys
from .. import support
import unittest
def test_suite(package=__package__, directory=os.path.dirname(__file__)):
suite = unittest.TestSuite()
for name in os.listdir(directory):
if name.startswith(('.', '__')):
continue
path = os.path.join(directory, name)
... | mit | Python |
4d597a8e71c0020b0f1d36e1cca64b5a353b0643 | modify version | weifind/abepos,weifind/abepos,weifind/abepos,weifind/abepos | Abe/version.py | Abe/version.py | __version__ = '0.88'
| __version__ = '0.8pre'
| agpl-3.0 | Python |
8c7abe561cd95331fef17b4fd1c7fe67386826a2 | change the input url | elixirhub/events-portal-scraping-scripts | AddDataTest.py | AddDataTest.py | __author__ = 'chuqiao'
import EventsPortal
from datetime import datetime
import logging
def logger():
"""
Function that initialises logging system
"""
global logger
# create logger with 'syncsolr'
logger = logging.getLogger('adddata')
logger.setLevel(logging.DEBUG)
# specifies the ... | __author__ = 'chuqiao'
import EventsPortal
from datetime import datetime
import logging
def logger():
"""
Function that initialises logging system
"""
global logger
# create logger with 'syncsolr'
logger = logging.getLogger('adddata')
logger.setLevel(logging.DEBUG)
# specifies the ... | mit | Python |
d98cdb7eae40b5bb11b5d1fc0eacc35ef6bf310d | Order filter for report page | pythonindia/wye,pythonindia/wye,pythonindia/wye,pythonindia/wye | wye/reports/views.py | wye/reports/views.py | from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from wye.organisations.models import Organisation
from wye.workshops.models import Workshop
from wye.profiles.models import Profile
import datetime
from wye.base.constants import WorkshopStatus
@login_required
def index(requ... | from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from wye.organisations.models import Organisation
from wye.workshops.models import Workshop
from wye.profiles.models import Profile
import datetime
from wye.base.constants import WorkshopStatus
@login_required
def index(requ... | mit | Python |
42442f234e6e364a52acbcb788fbeda6c6ffcd8c | Adjust tests for urls. | jakeharding/repo-health,jakeharding/repo-health,jakeharding/repo-health,jakeharding/repo-health | repo_health/index/tests.py | repo_health/index/tests.py | """
Test the index view is being accessed properly.
"""
from django.test import TestCase, Client
from django.urls import reverse
class TestIndexView(TestCase):
client = None
def setUp(self):
self.client = Client()
def test_view_init(self):
"""Test the view can be accessed from the url."... | """
Test the index view is being accessed properly.
"""
from django.test import TestCase, Client
class TestIndexView(TestCase):
client = None
def setUp(self):
self.client = Client()
def test_view_init(self):
"""Test the view can be accessed from the url.'''
res = self.client.get... | mit | Python |
10f7938e37180c0cb3b701223cf6d1855e7d8f93 | Drop python_2_unicode_compatible for Settings, fix docs build on rtfd | watchdogpolska/watchdog-kj-kultura,watchdogpolska/watchdog-kj-kultura,watchdogpolska/watchdog-kj-kultura | watchdog_kj_kultura/main/models.py | watchdog_kj_kultura/main/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils.models import TimeStampedModel
from tinymce.models import HTMLField
from django.contrib.sites.models import Site
class SettingsQuerySet(models.QuerySet):
pass
class Settings(TimeStampedModel):
site = models... | from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from model_utils.models import TimeStampedModel
from tinymce.models import HTMLField
from django.contrib.sites.models import Site
class SettingsQuerySet(models.QuerySet):
... | mit | Python |
5f8580e9d28d08e13f40692a2247f41ea8c5b4b9 | Remove extra newline. | jakirkham/nanshe,jakirkham/nanshe,DudLab/nanshe,DudLab/nanshe,nanshe-org/nanshe,nanshe-org/nanshe | tests/test_additional_io.py | tests/test_additional_io.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Jul 28, 2014 11:50:37 EDT$"
import nanshe.nanshe.additional_io
class TestAdditionalIO(object):
num_files = 10
def setup(self):
import tempfile
self.temp_dir = tempfile.mkdtemp()
self.temp_files = []
for ... | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Jul 28, 2014 11:50:37 EDT$"
import nanshe.nanshe.additional_io
class TestAdditionalIO(object):
num_files = 10
def setup(self):
import tempfile
self.temp_dir = tempfile.mkdtemp()
self.temp_files = []
for ... | bsd-3-clause | Python |
f356adde3cb4776ad0a34b47be54a6e14972ce17 | Improve Python 3.x compatibility | varunarya10/oslo.utils,magic0704/oslo.utils,openstack/oslo.utils,dims/oslo.utils | tests/unit/test_excutils.py | tests/unit/test_excutils.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, 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
#
... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, 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
#
... | apache-2.0 | Python |
514064ce5a0bc7d3ecab10d1b810e5b751ed79af | update supported thumbnail types | chen-chan/nntpchan,majestrate/nntpchan,chen-chan/nntpchan,majestrate/nntpchan,majestrate/nntpchan,majestrate/nntpchan,chen-chan/nntpchan,chen-chan/nntpchan,chen-chan/nntpchan,chen-chan/nntpchan,majestrate/nntpchan,chen-chan/nntpchan,chen-chan/nntpchan,majestrate/nntpchan,majestrate/nntpchan | contrib/frontends/django/nntpchan/nntpchan/thumbnail.py | contrib/frontends/django/nntpchan/nntpchan/thumbnail.py | from django.conf import settings
import subprocess
import os
img_ext = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'ico']
vid_ext = ['mp4', 'webm', 'm4v', 'ogv', 'avi', 'txt']
def generate(fname, tname, placeholder):
"""
generate thumbnail
"""
ext = fname.split('.')[-1]
cmd = None
if ext in img_ext:
... | from django.conf import settings
import subprocess
import os
img_ext = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'ico', 'pdf', 'ps']
vid_ext = ['mp4', 'webm', 'm4v', 'ogv', 'avi', 'txt']
def generate(fname, tname, placeholder):
"""
generate thumbnail
"""
ext = fname.split('.')[-1]
cmd = None
if ext... | mit | Python |
14b473fc1b3a084a22c3e1ef37e2589d91650b2f | Add td_includes argument to allow more flexible relative include paths for td files. | jhseu/tensorflow,xzturn/tensorflow,aldian/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,yongtang/tensorflow,davidzchen/tensorflow,gunan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,aldian/tensorflow,a... | third_party/mlir/tblgen.bzl | third_party/mlir/tblgen.bzl | """BUILD extensions for MLIR table generation."""
def gentbl(name, tblgen, td_file, tbl_outs, td_srcs = [], td_includes = [], strip_include_prefix = None):
"""gentbl() generates tabular code from a table definition file.
Args:
name: The name of the build rule for use in dependencies.
tblgen: The b... | """BUILD extensions for MLIR table generation."""
def gentbl(name, tblgen, td_file, tbl_outs, td_srcs = [], strip_include_prefix = None):
"""gentbl() generates tabular code from a table definition file.
Args:
name: The name of the build rule for use in dependencies.
tblgen: The binary used to prod... | apache-2.0 | Python |
45b778c637d263208699a16ba926f0da10d5b0f4 | Fix incorrect behaviour with check.py | JuhaniImberg/tmc.py,JuhaniImberg/tmc.py | tmc/exercise_tests/check.py | tmc/exercise_tests/check.py | import re
import xml.etree.ElementTree as ET
from os import path
from tmc.exercise_tests.basetest import BaseTest, TestResult
class CheckTest(BaseTest):
def __init__(self):
super().__init__("Check")
def applies_to(self, exercise):
return path.isfile(path.join(exercise.path(), "Makefile"))
... | import re
import xml.etree.ElementTree as ET
from os import path
from tmc.exercise_tests.basetest import BaseTest, TestResult
class CheckTest(BaseTest):
def __init__(self):
super().__init__("Check")
def applies_to(self, exercise):
return path.isfile(path.join(exercise.path(), "Makefile"))
... | mit | Python |
85aa5449a040247a6156801e88857048a7db6dd5 | update revnum | ipython/ipython,ipython/ipython | IPython/Release.py | IPython/Release.py | # -*- coding: utf-8 -*-
"""Release data for the IPython project.
$Id: Release.py 2446 2007-06-14 22:30:58Z vivainio $"""
#*****************************************************************************
# Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
#
# Copyright (c) 2001 Janko Hauser <jhause... | # -*- coding: utf-8 -*-
"""Release data for the IPython project.
$Id: Release.py 2409 2007-05-28 18:45:23Z vivainio $"""
#*****************************************************************************
# Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
#
# Copyright (c) 2001 Janko Hauser <jhause... | bsd-3-clause | Python |
5e409ec1d8d53cd3005022ff090043a9e5f5cb31 | Update nyan.py | Rayvenden/python-utilities | NyanCheck/nyan.py | NyanCheck/nyan.py | #!/usr/bin/python3
from gi.repository import Gtk
from gi.repository import GObject
import webbrowser
import urllib.request
import re
def getNyan():
USER_AGENT = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
r = urllib.request.Request("http://nyanyan.it/", h... | #!/usr/bin/python3
from gi.repository import Gtk
from gi.repository import GObject
import webbrowser
import urllib.request
import re
def getNyan():
USER_AGENT = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
r = urllib.request.Request("http://nyanyan.it/", h... | bsd-3-clause | Python |
992dc795d1f7c7ef670832a5144b7e72a9374af8 | update test_forms | project-callisto/callisto-core,SexualHealthInnovations/callisto-core,project-callisto/callisto-core,SexualHealthInnovations/django-wizard-builder,SexualHealthInnovations/django-wizard-builder,SexualHealthInnovations/callisto-core | wizard_builder/tests/test_forms.py | wizard_builder/tests/test_forms.py | from django.test import TestCase
from .. import managers
class FormSerializationTest(TestCase):
manager = managers.FormManager
fixtures = [
'wizard_builder_data',
]
expected_data = [{
'descriptive_text': 'answer wisely',
'field_id': 'question_2',
'id': 2,
'page... | from django.test import TestCase
from .. import managers
class FormSerializationTest(TestCase):
manager = managers.FormManager
fixtures = [
'wizard_builder_data',
]
expected_data = [{
'descriptive_text': 'answer wisely',
'field_id': 'question_2',
'id': 2,
'page... | agpl-3.0 | Python |
a9465bcfe387a3eb8ba730eeda5285be079044d3 | test cleanup | project-callisto/callisto-core,SexualHealthInnovations/django-wizard-builder,SexualHealthInnovations/callisto-core,SexualHealthInnovations/django-wizard-builder,project-callisto/callisto-core,SexualHealthInnovations/callisto-core,scattermagic/django-wizard-builder,scattermagic/django-wizard-builder | wizard_builder/tests/test_views.py | wizard_builder/tests/test_views.py | from unittest import mock
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from .. import view_helpers
class ViewTest(TestCase):
fixtures = [
'wizard_builder_data',
]
@classmethod
def setUpClass(cls):
settings.SITE_ID = 1... | from unittest import mock
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from .. import view_helpers
class ViewTest(TestCase):
fixtures = [
'wizard_builder_data',
]
@classmethod
def setUpClass(cls):
settings.SITE_ID = 1... | agpl-3.0 | Python |
12b806a0c68ceb146eed3b4a9406f36e9f930ba6 | Fix bug with closing socket without creating it again. | harvitronix/rl-rc-car | rl-rc-car/sensor_client.py | rl-rc-car/sensor_client.py | """
This is used to gather our readings from the remote sensor server.
http://ilab.cs.byu.edu/python/socket/echoclient.html
"""
import socket
import numpy as np
import time
class SensorClient:
def __init__(self, host='192.168.2.9', port=8888, size=1024):
self.host = host
self.port = port
... | """
This is used to gather our readings from the remote sensor server.
http://ilab.cs.byu.edu/python/socket/echoclient.html
"""
import socket
import numpy as np
import time
class SensorClient:
def __init__(self, host='192.168.2.9', port=8888, size=1024):
self.host = host
self.port = port
... | mit | Python |
a45d744a73c4ac54990854655dfec7e57df67eb4 | Add the device keyword to the array creation functions | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | numpy/_array_api/creation_functions.py | numpy/_array_api/creation_functions.py | def arange(start, /, *, stop=None, step=1, dtype=None, device=None):
from .. import arange
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
return arange(start, stop=stop, step=step, dtype=dtype... | def arange(start, /, *, stop=None, step=1, dtype=None):
from .. import arange
return arange(start, stop=stop, step=step, dtype=dtype)
def empty(shape, /, *, dtype=None):
from .. import empty
return empty(shape, dtype=dtype)
def empty_like(x, /, *, dtype=None):
from .. import empty_like
return ... | mit | Python |
8dcb778c62c3c6722e2f6dabfd97f6f75c349e62 | Set celery max tasks child to 1 | puruckertom/ubertool_ecorest,quanted/ubertool_ecorest,puruckertom/ubertool_ecorest,quanted/ubertool_ecorest,quanted/ubertool_ecorest,puruckertom/ubertool_ecorest,puruckertom/ubertool_ecorest,quanted/ubertool_ecorest | celery_cgi.py | celery_cgi.py | import os
import logging
from celery import Celery
from temp_config.set_environment import DeployEnv
runtime_env = DeployEnv()
runtime_env.load_deployment_environment()
redis_server = os.environ.get('REDIS_HOSTNAME')
redis_port = os.environ.get('REDIS_PORT')
celery_tasks = [
'hms_flask.modules.hms_controller',
... | import os
import logging
from celery import Celery
from temp_config.set_environment import DeployEnv
runtime_env = DeployEnv()
runtime_env.load_deployment_environment()
redis_server = os.environ.get('REDIS_HOSTNAME')
redis_port = os.environ.get('REDIS_PORT')
celery_tasks = [
'hms_flask.modules.hms_controller',
... | unlicense | Python |
3d6fcb5c5ef05224f0129caf58507b555d17f35d | Fix indentation error in Flask | watson-developer-cloud/python-primer-companion-code,watson-developer-cloud/python-primer-companion-code,watson-developer-cloud/python-primer-companion-code,watson-developer-cloud/python-primer-companion-code | episode-2/flask/src/translation.py | episode-2/flask/src/translation.py | # -*- coding: utf-8 -*-
# Copyright 2016 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | # -*- coding: utf-8 -*-
# Copyright 2016 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | apache-2.0 | Python |
4026d575cac94d98f8fa5467674020b18442359d | Update h-index.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,jaredkoontz/leetcode,kamyu104/LeetCode,githubutilities/LeetCode,kamyu104/LeetCode,githubutilities/LeetCo... | Python/h-index.py | Python/h-index.py | # Time: O(nlogn)
# Space: O(1)
# Given an array of citations (each citation is a non-negative integer)
# of a researcher, write a function to compute the researcher's h-index.
#
# According to the definition of h-index on Wikipedia:
# "A scientist has index h if h of his/her N papers have
# at least h citations each... | # Time: O(nlogn)
# Space: O(1)
# Given an array of citations (each citation is a non-negative integer)
# of a researcher, write a function to compute the researcher's h-index.
#
# According to the definition of h-index on Wikipedia:
# "A scientist has index h if h of his/her N papers have
# at least h citations each... | mit | Python |
8deb3e45511950cc1a5d317f79f30bf59ed4821a | Update Changedate | ricaportela/convert-data-nbf,ricaportela/convert-data-nbf | changedate.py | changedate.py | """ Calcular Data a partir de uma quantidade de minutos """
def alterar_data(data_ent, op, minutos_ent):
""" Calcular nova data """
spl_Data_ent, spl_Hora_ent = data_ent.split(" ", 2)
spl_Dia_ent, spl_Mes_ent, spl_Ano_ent = spl_Data_ent.split("/", 3)
spl_Hora_ent, spl_Minu_ent = spl_Hora_ent.split(":",... | """ Calcular Data a partir de uma quantidade de minutos """
MINUTOSENTRADA = 4000
OPERADOR = "+"
DATA_E, HORA_E = "31/12/2016 23:35".split(" ", 2)
DIA_E, MES_E, ANO_E = DATA_E.split("/", 3)
HR_E, MINU_E = HORA_E.split(":", 2)
# transformar tudo em minutos
# converter horas em minutos
MIN_TOT_E = (int(HR_E) * 60) + in... | mit | Python |
62a2b5ab62a5c1080cdc30e3334cc62f4a51d6a9 | Make job mode API update change. | eurekaclinical/eureka-python-client | eurekaclinical/analytics/client.py | eurekaclinical/analytics/client.py | from eurekaclinical import APISession, API, Struct, construct_api_session_context_manager
class Job(Struct):
def __init__(self):
super(Job, self).__init__()
self.sourceConfigId = None
self.destinationId = None
self.dateRangePhenotypeKey = None
self.earliestDate = None
... | from eurekaclinical import APISession, API, Struct, construct_api_session_context_manager
class Job(Struct):
def __init__(self):
super(Job, self).__init__()
self.sourceConfigId = None
self.destinationId = None
self.dateRangePhenotypeKey = None
self.earliestDate = None
... | apache-2.0 | Python |
11cc0c5f8aae526eddb372fbe339f649f2c654eb | Update pattern for inline comments to allow anything after '#' | hackebrot/poyo | poyo/patterns.py | poyo/patterns.py | # -*- coding: utf-8 -*-
INDENT = r"(?P<indent>^ *)"
VARIABLE = r"(?P<variable>.+):"
VALUE = r"(?P<value>((?P<q2>['\"]).*?(?P=q2))|[^#]+?)"
NEWLINE = r"$\n"
BLANK = r" +"
INLINE_COMMENT = r"( +#.*)?"
COMMENT = r"^ *#.*" + NEWLINE
BLANK_LINE = r"^[ \t]*" + NEWLINE
SECTION = INDENT + VARIABLE + INLINE_COMMENT + NEWLINE... | # -*- coding: utf-8 -*-
INDENT = r"(?P<indent>^ *)"
VARIABLE = r"(?P<variable>.+):"
VALUE = r"(?P<value>((?P<q2>['\"]).*?(?P=q2))|[^#]+?)"
NEWLINE = r"$\n"
BLANK = r" +"
INLINE_COMMENT = r"( +#\w*)?"
COMMENT = r"^ *#.*" + NEWLINE
BLANK_LINE = r"^[ \t]*" + NEWLINE
SECTION = INDENT + VARIABLE + INLINE_COMMENT + NEWLIN... | mit | Python |
0f9b5bdba841d707e236bb8ed8df5ba4aa7806c2 | Allow a None value for os_config_path. | 13steinj/praw,13steinj/praw,voussoir/reddit,tehp/reddit,nmtake/praw,tehp/reddit,voussoir/reddit,iAmMrinal0/reddit,TacticalGoat/reddit,RGood/praw,darthkedrik/praw,gschizas/praw,tehp/reddit,leviroth/praw,TacticalGoat/reddit,darthkedrik/praw,leviroth/praw,praw-dev/praw,iAmMrinal0/reddit,RGood/praw,nmtake/praw,gschizas/pra... | praw/settings.py | praw/settings.py | # This file is part of PRAW.
#
# PRAW 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.
#
# PRAW is distributed in the hope that it will ... | # This file is part of PRAW.
#
# PRAW 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.
#
# PRAW is distributed in the hope that it will ... | bsd-2-clause | Python |
d84a4efcf880bb668b2721af3f4ce18220e8baab | Use np.genfromtext to handle missing values | jonathansick/xvistaprof | xvistaprof/reader.py | xvistaprof/reader.py | #!/usr/bin/env python
# encoding: utf-8
"""
Reader for XVISTA .prof tables.
"""
import numpy as np
from astropy.table import Table
from astropy.io import registry
def xvista_table_reader(filename):
dt = [('R', np.float), ('SB', np.float), ('SB_err', np.float),
('ELL', np.float), ('PA', np.float), ('EMA... | #!/usr/bin/env python
# encoding: utf-8
"""
Reader for XVISTA .prof tables.
"""
import numpy as np
from astropy.table import Table
from astropy.io import registry
def xvista_table_reader(filename):
dt = [('R', np.float), ('SB', np.float), ('SB_err', np.float),
('ELL', np.float), ('PA', np.float), ('E... | bsd-2-clause | Python |
0dde9454d05a6d5533454fbac8996c560d007c67 | make a proper hook/task split in cython. | abadger/Bento,abadger/Bento,abadger/Bento,abadger/Bento,cournape/Bento,cournape/Bento,cournape/Bento,cournape/Bento | yaku/tools/cython.py | yaku/tools/cython.py | import os
import sys
from yaku.task_manager \
import \
extension, get_extension_hook
from yaku.task \
import \
Task
from yaku.compiled_fun \
import \
compile_fun
from yaku.utils \
import \
ensure_dir, find_program
import yaku.errors
@extension(".pyx")
def cython_hook(se... | import os
import sys
from yaku.task_manager \
import \
extension, get_extension_hook
from yaku.task \
import \
Task
from yaku.compiled_fun \
import \
compile_fun
from yaku.utils \
import \
ensure_dir, find_program
import yaku.errors
@extension(".pyx")
def cython_task(se... | bsd-3-clause | Python |
af96c316f485ebed2ad342aa2ea720d8b699f649 | bump version | ArabellaTech/ydcommon,ArabellaTech/ydcommon,ArabellaTech/ydcommon | ydcommon/__init__.py | ydcommon/__init__.py | """
YD Technology common libraries
"""
VERSION = (0, 1, 2)
__version__ = '.'.join((str(each) for each in VERSION[:4]))
def get_version():
"""
Returns shorter version (digit parts only) as string.
"""
version = '.'.join((str(each) for each in VERSION[:3]))
if len(VERSION) > 3:
version += ... | """
YD Technology common libraries
"""
VERSION = (0, 1, 1)
__version__ = '.'.join((str(each) for each in VERSION[:4]))
def get_version():
"""
Returns shorter version (digit parts only) as string.
"""
version = '.'.join((str(each) for each in VERSION[:3]))
if len(VERSION) > 3:
version += ... | mit | Python |
5a31ed001626937772a30ab46b94fe2b4bb5cfb8 | allow 2013 candidates | sunlightlabs/read_FEC,sunlightlabs/read_FEC,sunlightlabs/read_FEC,sunlightlabs/read_FEC | fecreader/summary_data/management/commands/add_candidates.py | fecreader/summary_data/management/commands/add_candidates.py | from django.core.management.base import BaseCommand, CommandError
from ftpdata.models import Candidate
from summary_data.models import Candidate_Overlay
from summary_data.utils.overlay_utils import make_candidate_overlay_from_masterfile
election_year = 2014
cycle = str(election_year)
class Command(BaseCommand):
... | from django.core.management.base import BaseCommand, CommandError
from ftpdata.models import Candidate
from summary_data.models import Candidate_Overlay
from summary_data.utils.overlay_utils import make_candidate_overlay_from_masterfile
election_year = 2014
cycle = str(election_year)
class Command(BaseCommand):
... | bsd-3-clause | Python |
bf4a197618bf09a164f03a53cd6998bcd6ee8196 | Fix function name | thenenadx/forseti-security,thenenadx/forseti-security,thenenadx/forseti-security | google/cloud/security/common/data_access/violation_format.py | google/cloud/security/common/data_access/violation_format.py | # Copyright 2017 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 or agreed to in writing, s... | # Copyright 2017 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 or agreed to in writing, s... | apache-2.0 | Python |
17b9ccbcf940c653c2ee0994eefec87ca2961b75 | Fix extension scraper on Python 3.x | Microsoft/PTVS,huguesv/PTVS,fivejjs/PTVS,bolabola/PTVS,huguesv/PTVS,juanyaw/PTVS,zooba/PTVS,int19h/PTVS,MetSystem/PTVS,Microsoft/PTVS,DEVSENSE/PTVS,Microsoft/PTVS,MetSystem/PTVS,ChinaQuants/PTVS,DEVSENSE/PTVS,int19h/PTVS,xNUTs/PTVS,mlorbetske/PTVS,crwilcox/PTVS,alanch-ms/PTVS,msunardi/PTVS,jkorell/PTVS,jkorell/PTVS,Din... | Release/Product/Python/PythonTools/ExtensionScraper.py | Release/Product/Python/PythonTools/ExtensionScraper.py | # ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution.... | # ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution.... | apache-2.0 | Python |
9780274756ef4bc2966a0f8290ca28bd3c1e8163 | update dev version after 0.31.1 tag [skip ci] | desihub/desisim,desihub/desisim | py/desisim/_version.py | py/desisim/_version.py | __version__ = '0.31.1.dev1940'
| __version__ = '0.31.1'
| bsd-3-clause | Python |
edc13c1309d550a3acc5b833d0efedaf7be4045e | Fix several off-by-one errors in split_tex_string() and add regression tests. | live-clones/pybtex | pybtex/bibtex/utils.py | pybtex/bibtex/utils.py | # Copyright (C) 2007, 2008, 2009 Andrey Golovizin
#
# 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 ... | # Copyright (C) 2007, 2008, 2009 Andrey Golovizin
#
# 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 ... | mit | Python |
32c9b0ead88e8ecd570f7fda1bb50808c8fb73b8 | Hide log call capture | hamzasheikh/pytest-hidecaptured | pytest_hidecaptured.py | pytest_hidecaptured.py | # -*- coding: utf-8 -*-
import pytest
@pytest.mark.tryfirst
def pytest_runtest_logreport(report):
"""Overwrite report by removing any captured stderr."""
# print("PLUGIN SAYS -> report -> {0}".format(report))
# print("PLUGIN SAYS -> report.sections -> {0}".format(report.sections))
# print("PLUGIN SAYS... | # -*- coding: utf-8 -*-
import pytest
@pytest.mark.tryfirst
def pytest_runtest_logreport(report):
"""Overwrite report by removing any captured stderr."""
# print("PLUGIN SAYS -> report -> {0}".format(report))
# print("PLUGIN SAYS -> report.sections -> {0}".format(report.sections))
# print("PLUGIN SAYS ... | mit | Python |
a1dd37c9127501ad440c7777d14fb28b1b59b85b | Add list guests function | tomviner/dojo-adventure-game | characters.py | characters.py | from adventurelib import Item, Bag, when
class Man(Item):
subject_pronoun = 'he'
object_pronoun = 'him'
class Woman(Item):
subject_pronoun = 'she'
object_pronoun = 'her'
dr_black = the_victim = Man('Dr. Black', 'Dr Black', 'the victim')
dr_black.def_name = 'the victim'
dr_black.description = """\
... | from adventurelib import Item, Bag
class Man(Item):
subject_pronoun = 'he'
object_pronoun = 'him'
class Woman(Item):
subject_pronoun = 'she'
object_pronoun = 'her'
dr_black = the_victim = Man('Dr. Black', 'Dr Black', 'the victim')
dr_black.def_name = 'the victim'
dr_black.description = """\
Dr. Bl... | mit | Python |
919d67e6f46d4f991cc5caa5893beebfe94e0d9e | Add hash mock | MizukiSonoko/iroha-cli,MizukiSonoko/iroha-cli | cli/crypto.py | cli/crypto.py | from ctypes import *
import base64
import os
def generate_hex_sstr():
publicKey64 = "Not implemente"
privateKey64 = "Not implemente"
return (publicKey64,privateKey64)
def hash(msg):
return "Not implemente" | from ctypes import *
import base64
import os
def generate_hex_sstr():
publicKey64 = "Not implemente"
privateKey64 = "Not implemente"
return (publicKey64,privateKey64)
| apache-2.0 | Python |
2159a35811cac75b0c68677fc41443aa8eac6e5b | Stop conn_join from overriding channel restrictions | Heufneutje/txircd,DesertBus/txircd,ElementalAlchemist/txircd | txircd/modules/conn_join.py | txircd/modules/conn_join.py | from txircd.channel import IRCChannel
from txircd.modbase import Module
class Autojoin(Module):
def joinOnConnect(self, user):
if "client_join_on_connect" in self.ircd.servconfig:
for channel in self.ircd.servconfig["client_join_on_connect"]:
user.handleCommand("JOIN", None, [ch... | from txircd.channel import IRCChannel
from txircd.modbase import Module
class Autojoin(Module):
def joinOnConnect(self, user):
if "client_join_on_connect" in self.ircd.servconfig:
for channel in self.ircd.servconfig["client_join_on_connect"]:
user.join(self.ircd.channels[channel... | bsd-3-clause | Python |
142538049bd1bf8ae92c80060435965104ec54bb | Add ability to use the pattern ((args, kwargs), callable) when specifying schema | fabianvf/scrapi,mehanig/scrapi,felliott/scrapi,erinspace/scrapi,felliott/scrapi,icereval/scrapi,mehanig/scrapi,ostwald/scrapi,alexgarciac/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,jeffreyliu3230/scrapi | scrapi/base/transformer.py | scrapi/base/transformer.py | from __future__ import unicode_literals
import abc
import logging
logger = logging.getLogger(__name__)
class BaseTransformer(object):
__metaclass__ = abc.ABCMeta
def transform(self, doc):
return self._transform(self.schema, doc)
def _transform(self, schema, doc):
transformed = {}
... | from __future__ import unicode_literals
import abc
import logging
logger = logging.getLogger(__name__)
class BaseTransformer(object):
__metaclass__ = abc.ABCMeta
def transform(self, doc):
return self._transform(self.schema, doc)
def _transform(self, schema, doc):
transformed = {}
... | apache-2.0 | Python |
465c1c1c9d7c102b4d35eb8c228565dbf8d35910 | simplify the code | uutils/coreutils,uutils/coreutils,uutils/coreutils | util/remaining-gnu-error.py | util/remaining-gnu-error.py | #!/usr/bin/env python3
# This script lists the GNU failing tests by size
# Just like with util/run-gnu-test.sh, we expect the gnu sources
# to be in ../
import urllib.request
import urllib
import os
import glob
import json
base = "../gnu/tests/"
urllib.request.urlretrieve(
"https://raw.githubusercontent.com/uutil... | #!/usr/bin/env python3
# This script lists the GNU failing tests by size
# Just like with util/run-gnu-test.sh, we expect the gnu sources
# to be in ../
import urllib.request
import urllib
import os
import glob
import json
base = "../gnu/tests/"
urllib.request.urlretrieve(
"https://raw.githubusercontent.com/uutil... | mit | Python |
b2a4967e956c07831516d90411f16d9f46a62cfb | Update script for py3 and cross-platform TMPDIR access | OpenChemistry/avogadroapp,ghutchis/avogadroapp,ghutchis/avogadroapp,ghutchis/avogadroapp,OpenChemistry/avogadroapp,OpenChemistry/avogadroapp,ghutchis/avogadroapp,OpenChemistry/avogadroapp | scripts/avogadro-remote.py | scripts/avogadro-remote.py | #!/usr/bin/python
from __future__ import print_function
import sys
import json
import time
import socket
import struct
import tempfile
class Connection:
def __init__(self, name = "avogadro"):
# create socket
self.sock = socket.socket(socket.AF_UNIX,
socket.SOCK_STREAM)
# ... | #!/usr/bin/python
import sys
import json
import time
import socket
import struct
class Connection:
def __init__(self, name = "avogadro"):
# create socket
self.sock = socket.socket(socket.AF_UNIX,
socket.SOCK_STREAM)
# connect
self.sock.connect("/tmp/" + name)
def se... | bsd-3-clause | Python |
5489fe0abc5dda3b6d41bee368cd0b9727459af3 | Add search urls for projects | Hackfmi/Diaphanum,Hackfmi/Diaphanum | projects/urls.py | projects/urls.py | from django.conf.urls import patterns, url
urlpatterns = patterns('projects.views',
url(r'^add/$', 'add_project', name='add-project'),
url(r'^edit/(?P<project_id>\d+)/$', 'edit_project', name='edit-project'),
url(r'^edit_status/(?P<project_id>\d+)/$', 'edit_status', name='edit-status'),
url(r'^archive... | from django.conf.urls import patterns, url
urlpatterns = patterns('projects.views',
url(r'^add/$', 'add_project', name='add-project'),
url(r'^edit/(?P<project_id>\d+)/$', 'edit_project', name='edit-project'),
url(r'^edit_status/(?P<project_id>\d+)/$', 'edit_status', name='edit-status'),
url(r'^archive... | mit | Python |
35b0af0fafb117e3cc613d3073602902fadb9c5c | Add daily-view to worker | SEC-i/ecoControl,SEC-i/ecoControl,SEC-i/ecoControl | server/worker/functions.py | server/worker/functions.py | import logging
import time
from django.db import connection
from server.models import SensorValue, Threshold, Notification
import functions
logger = logging.getLogger('worker')
def check_thresholds():
for threshold in Threshold.objects.all():
try:
latest_sensorvalue = SensorValue.objects.fi... | import logging
import time
from django.db import connection
from server.models import SensorValue, Threshold, Notification
import functions
logger = logging.getLogger('worker')
def check_thresholds():
for threshold in Threshold.objects.all():
try:
latest_sensorvalue = SensorValue.objects.fi... | mit | Python |
13bb0a7ea546fed050b68c73730384c168370ac3 | Add typing for plogger. | KarlGong/ptest,KarlGong/ptest | ptest/plogger.py | ptest/plogger.py | import logging
import sys
from datetime import datetime
from . import config
class PConsole:
def __init__(self, out):
self.out = out
def write(self, msg: str):
self.out.write(str(msg))
def write_line(self, msg: str):
self.out.write(str(msg) + "\n")
pconsole = PConsole(sys.stdo... | import logging
import sys
from datetime import datetime
from . import config
class PConsole:
def __init__(self, out):
self.out = out
def write(self, msg):
self.out.write(str(msg))
def write_line(self, msg):
self.out.write(str(msg) + "\n")
pconsole = PConsole(sys.stdout)
pconso... | apache-2.0 | Python |
3b5b3afbc66f60df45f0458ffdd0d37b9a7c50d0 | Add homemade fast width/height reader for JPEG files | vperron/picasa-toolbox | ptoolbox/tags.py | ptoolbox/tags.py | # -*- coding: utf-8 -*-
import struct
from datetime import datetime
TAG_WIDTH = 'EXIF ExifImageWidth'
TAG_HEIGHT = 'EXIF ExifImageLength'
TAG_DATETIME = 'Image DateTime'
def jpeg_size(path):
"""Get image size.
Structure of JPEG file is:
ffd8 [ffXX SSSS DD DD ...] [ffYY SSSS DDDD ...] (S is 16bit si... | # -*- coding: utf-8 -*-
from datetime import datetime
TAG_WIDTH = 'EXIF ExifImageWidth'
TAG_HEIGHT = 'EXIF ExifImageLength'
TAG_DATETIME = 'Image DateTime'
def parse_time(tags):
tag = tags.get(TAG_DATETIME, None)
if not tag:
raise KeyError(TAG_DATETIME)
return datetime.strptime(str(tag), "%Y:%m:%... | mit | Python |
7a64ac255f53e85f888093daac83b3c0fabcf15e | Update ESPEC_tests.py | jmbattle/pyESPEC | ESPEC_tests.py | ESPEC_tests.py | # -*- coding: utf-8 -*-
"""ESPEC_tests.py: Simple test routine for pyESPEC library
__author__ = "Jason M. Battle"
__copyright__ = "Copyright 2016, Jason M. Battle"
__license__ = "MIT"
__email__ = "jason.battle@gmail.com"
"""
from ESPEC import SH241
if __name__ == '__main__':
test = SH241()
tes... | # -*- coding: utf-8 -*-
"""ESPEC_tests.py: Simple test routine for pyESPEC library
__author__ = "Jason M. Battle"
__copyright__ = "Copyright 2016, Jason M. Battle"
__license__ = "MIT"
__email__ = "jason.battle@gmail.com"
"""
from ESPEC import SH241
if __name__ == '__main__':
test = SH241()
tes... | mit | Python |
72d905e1e4098cf929213f59662c0c3090fd93cf | remove debug print | zbraniecki/pyast | pyast/dump/js.py | pyast/dump/js.py | import json
import pyast
from collections import OrderedDict
import sys
if sys.version >= '3':
basestring = str
else:
pass
def _dump_node_name(node):
return node.__class__.__name__.lower()
def _dump_node(node, name=None, indent=0):
if isinstance(node, basestring):
return node
elif isins... | import json
import pyast
from collections import OrderedDict
import sys
if sys.version >= '3':
basestring = str
else:
pass
def _dump_node_name(node):
return node.__class__.__name__.lower()
def _dump_node(node, name=None, indent=0):
if isinstance(node, basestring):
return node
elif isins... | bsd-3-clause | Python |
c46e472755c7b7dd450626e136f31a29ca9a5321 | Fix a regression in accessing the username for the session. | reviewboard/rbtools,halvorlu/rbtools,beol/rbtools,datjwu/rbtools,davidt/rbtools,datjwu/rbtools,davidt/rbtools,reviewboard/rbtools,haosdent/rbtools,halvorlu/rbtools,haosdent/rbtools,haosdent/rbtools,reviewboard/rbtools,beol/rbtools,beol/rbtools,datjwu/rbtools,halvorlu/rbtools,davidt/rbtools | rbtools/utils/users.py | rbtools/utils/users.py | from __future__ import unicode_literals
import getpass
import logging
import sys
from six.moves import input
from rbtools.api.errors import AuthorizationError
from rbtools.commands import CommandError
def get_authenticated_session(api_client, api_root, auth_required=False):
"""Return an authenticated session.
... | from __future__ import unicode_literals
import getpass
import logging
import sys
from six.moves import input
from rbtools.api.errors import AuthorizationError
from rbtools.commands import CommandError
def get_authenticated_session(api_client, api_root, auth_required=False):
"""Return an authenticated session.
... | mit | Python |
2beb589edc2f7b57be0d6a559e2f29471490bc91 | FIX py2 support! | hayd/pyfaker | pyfaker/utils.py | pyfaker/utils.py | import re
import random
import os
import json
from string import Formatter
class BaseFake(object):
pass
class CallFormatter(Formatter):
def get_field(self, field_name, *args, **kwargs):
obj, used_key = Formatter.get_field(self, field_name, *args, **kwargs)
return obj(), used_key
'''
class C... | import re
import random
import os
import json
from string import Formatter
class BaseFake(object):
pass
class CallFormatter(Formatter):
def get_field(self, field_name, *args, **kwargs):
obj, used_key = Formatter.get_field(self, field_name, *args, **kwargs)
return obj(), used_key
'''
class C... | mit | Python |
cf644a17bd8c2abe436a37159bdf3eec7d2a358d | Remove premature optimization | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | luigi/tasks/quickgo/load_annotations.py | luigi/tasks/quickgo/load_annotations.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | apache-2.0 | Python |
23ab13f192b58f8b550aa2e16d5861e14535698a | Add slot fot empty_patch in cli pop command | vadmium/python-quilt,bjoernricks/python-quilt | quilt/cli/pop.py | quilt/cli/pop.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | mit | Python |
2c386cc3e81caffd906b68a6d527bd8bdd1d5ae5 | Replace nltk.model.NgramModel with nltk.ngrams | qe-team/marmot | marmot/features/lm_feature_extractor.py | marmot/features/lm_feature_extractor.py | from nltk import ngrams, word_tokenize
#from nltk.model import NgramModel
from marmot.features.feature_extractor import FeatureExtractor
from marmot.util.simple_corpus import SimpleCorpus
# Class that extracts various LM features
# Calling an external LM is very slow, so a new lm is constructed with nltk
class LMF... | from nltk.model import NgramModel
from marmot.features.feature_extractor import FeatureExtractor
from marmot.util.simple_corpus import SimpleCorpus
def check_lm_recursive(words, lm, low_order='left'):
if len(words) < lm._n:
return check_lm_recursive(words, lm._backoff, low_order=low_order)
if tuple(words... | isc | Python |
5d393ff5c007bafb731aaf703a5225081b99f69a | Align the add/remove URL with the filter URL | eallrich/checkniner,eallrich/checkniner,eallrich/checkniner | cotracker/cotracker/urls.py | cotracker/cotracker/urls.py | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from checkouts.views import (
PilotList,
PilotDetail,
AirstripList,
AirstripDetail,
BaseList,
BaseAttachedDetail,
BaseUnattachedDetail,
FilterFormView,
CheckoutUpdat... | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from checkouts.views import (
PilotList,
PilotDetail,
AirstripList,
AirstripDetail,
BaseList,
BaseAttachedDetail,
BaseUnattachedDetail,
FilterFormView,
CheckoutUpdat... | mit | Python |
3c9d45ad67b1a1c274cc5ee7a78d174595445733 | Update websocket | EarEEG/eareeg-backend | websocket_data_collector.py | websocket_data_collector.py | #!venv/bin/python
'''
websocket_data_collector.py
This script uses websockets to transmit data collected by the NeuroPy module to a remote server.
'''
import NeuroPy.NeuroPy as NP
import socketIO_client
import json
import click
from threading import Lock
CLIENT_ID = "CLIENT1"
# declare this globally
socketIO = None... | #!venv/bin/python
'''
websocket_data_collector.py
This script uses websockets to transmit data collected by the NeuroPy module to a remote server.
'''
import NeuroPy.NeuroPy as NP
import socketIO_client
import json
import click
from threading import Lock
CLIENT_ID = "CLIENT1"
# declare this globally
socketIO = None... | mit | Python |
0cc7fbea3952485e8274c8df1b223fc791181035 | Complete migrate from django to toilets script | praekelt/go-imali-yethu-js,praekelt/go-imali-yethu-js,praekelt/go-imali-yethu-js | ona_migration_script/migrate_toilets.py | ona_migration_script/migrate_toilets.py | import argparse
from ona import OnaApiClient
def generate_location(lat, lon):
return ' '.join([str(lat), str(lon)])
CONVERSIONS = {
'code': 'toilet_code', 'section': 'toilet_section',
'cluster': 'toilet_cluster'}
ADDITIONS = {
'toilet_location': (generate_location, ['lat', 'lon'])
}
DEFAULTS = {
... | bsd-3-clause | Python | |
a7827ecf5e480c228c881180e63633712e3dbc3c | Modify ARDUINO_SEARCH_PATHS to include default ubuntu package location | wheeler-microfluidics/dmf-control-board-firmware,wheeler-microfluidics/dmf-control-board-firmware,wheeler-microfluidics/dmf-control-board-firmware,wheeler-microfluidics/dmf-control-board-firmware,wheeler-microfluidics/dmf_control_board_plugin | site_scons/find_avrdude.py | site_scons/find_avrdude.py | import sys
import os
from itertools import chain
from path import path
home_dir = path('~').expand()
ARDUINO_SEARCH_PATHS = [home_dir, ]
if os.name == 'nt':
from win32com.shell import shell, shellcon
mydocs = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, 0, 0)
AVRDUDE_NAME = 'avrdude.exe'
ARDUINO_... | import sys
import os
from itertools import chain
from path import path
home_dir = path('~').expand()
ARDUINO_SEARCH_PATHS = [home_dir, ]
if os.name == 'nt':
from win32com.shell import shell, shellcon
mydocs = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, 0, 0)
AVRDUDE_NAME = 'avrdude.exe'
ARDUINO_... | bsd-3-clause | Python |
028abc55a2c0e7bf9d727fa73eafff98e5f917d2 | Add sparkhistogram package | LucaCanali/Miscellaneous | Spark_Notes/Spark_Histograms/python/setup.py | Spark_Notes/Spark_Histograms/python/setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
description = "Sparkhistogram contains helper functions for generating data histograms with the Spark DataFrame API."
long_description = """
Use this package, sparkhistogram, together with PySpark for generating data histograms using the Spark DataFra... | #!/usr/bin/env python
from setuptools import setup, find_packages
description = "sparkhistogram contains helper functions for generating data histograms with the Spark DataFrame API and with Spark SQL."
long_description = "sparkhistogram contains helper functions for generating data histograms with the Spark DataFra... | apache-2.0 | Python |
03c237551aa08cb70fd397cc348e75531cdabd0e | fix schemas for password views | SUNET/eduid-webapp,SUNET/eduid-webapp,SUNET/eduid-webapp | src/eduid_webapp/security/schemas.py | src/eduid_webapp/security/schemas.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 NORDUnet A/S
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 NORDUnet A/S
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... | bsd-3-clause | Python |
daa92b15852b3572d7ef03392b061184dbbc76c1 | fix to use the right cert in AuthServer provisioning | kevinawalsh/cloudproxy,William-J-Earl/cloudproxy,jlmucb/cloudproxy,cjpatton/cloudproxy,jlmucb/cloudproxy,jethrogb/cloudproxy,jethrogb/cloudproxy,William-J-Earl/cloudproxy,cjpatton/cloudproxy,tmroeder/cloudproxy,jlmucb/cloudproxy,jethrogb/cloudproxy,cjpatton/cloudproxy,tmroeder/cloudproxy,kevinawalsh/cloudproxy,jethrogb... | Code/scripts/provisionAuthServer.py | Code/scripts/provisionAuthServer.py | #!/usr/bin/env python
from __future__ import print_function
from subprocess import check_call
import os
import argparse
parser = argparse.ArgumentParser(description="Generates the keys for authServer.exe")
parser.add_argument("--scriptPath", required="true", help="The path to the directory that contains the scripts u... | #!/usr/bin/env python
from __future__ import print_function
from subprocess import check_call
import os
import argparse
parser = argparse.ArgumentParser(description="Generates the keys for authServer.exe")
parser.add_argument("--scriptPath", required="true", help="The path to the directory that contains the scripts u... | apache-2.0 | Python |
fe4c62acd52a4060eebf4284c15c465970ea8932 | remove duplicate enum key (#7173) | Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py | sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | mit | Python |
5f1f1145d4f01f4b30e8782d284feb44781c21ad | Use sorted on the set to parametrize tests so that pytest-xdist works | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/cupyx_tests/scipy_tests/special_tests/test_ufunc_dispatch.py | tests/cupyx_tests/scipy_tests/special_tests/test_ufunc_dispatch.py | import numpy
import cupy
import scipy.special
import cupyx.scipy.special
from cupy import testing
import pytest
scipy_ufuncs = {
f
for f in scipy.special.__all__
if isinstance(getattr(scipy.special, f), numpy.ufunc)
}
cupyx_scipy_ufuncs = {
f
for f in dir(cupyx.scipy.special)
if isinstance(get... | import numpy
import cupy
import scipy.special
import cupyx.scipy.special
from cupy import testing
import pytest
scipy_ufuncs = {
f
for f in scipy.special.__all__
if isinstance(getattr(scipy.special, f), numpy.ufunc)
}
cupyx_scipy_ufuncs = {
f
for f in dir(cupyx.scipy.special)
if isinstance(get... | mit | Python |
030e38a7d69bca5bbe72b51c5fbc667793ffce6b | Expand test history coverage | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | tests/zeus/api/resources/test_repository_tests_history_by_build.py | tests/zeus/api/resources/test_repository_tests_history_by_build.py | from zeus import factories
def test_repository_tests_history_by_build(
client,
default_login,
default_build,
default_testcase,
default_repo,
default_repo_access,
default_source,
):
build2 = factories.BuildFactory(source=default_source, finished=True)
job2 = factories.JobFactory(bui... | from zeus import factories
def test_repository_tests_history_by_build(
client,
default_login,
default_build,
default_testcase,
default_repo,
default_repo_access,
default_source,
):
other_build = factories.BuildFactory(source=default_source, finished=True)
other_job = factories.JobF... | apache-2.0 | Python |
fabd8e5a1fbb8dd083b05b053320b090fedad119 | Fix cryptostate to no longer assign multiple states at once (issue #620) | jparyani/Mailpile,jparyani/Mailpile,jparyani/Mailpile,laborautonomo/Mailpile,laborautonomo/Mailpile,laborautonomo/Mailpile | mailpile/plugins/cryptostate.py | mailpile/plugins/cryptostate.py | from gettext import gettext as _
from mailpile.plugins import PluginManager
from mailpile.crypto.state import EncryptionInfo, SignatureInfo
_plugins = PluginManager(builtin=__file__)
##[ Keywords ]################################################################
def text_kw_extractor(index, msg, ctype, text):
... | from gettext import gettext as _
from mailpile.plugins import PluginManager
_plugins = PluginManager(builtin=__file__)
##[ Keywords ]################################################################
def text_kw_extractor(index, msg, ctype, text):
kw = set()
if ('-----BEGIN PGP' in text and '\n-----END PGP'... | apache-2.0 | Python |
d5c30bdae34450b4052f83f773ef993e89fc8bef | Prepare 1.1 release | nr-plugins/c4ddev,nr-plugins/c4ddev | c4ddev.pyp | c4ddev.pyp | # Copyright (C) 2014-2016 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | # Copyright (C) 2014-2016 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | mit | Python |
8c0e1a976e6341d565140725d51562cc9021f90e | add hostname to all messages | markokr/cc,markokr/cc | cc/reqs.py | cc/reqs.py | import time
from cc.json import Struct, Field
from cc.message import CCMessage
from socket import gethostname
__all__ = ['LogMessage', 'InfofileMessage', 'JobRequestMessage', 'JobConfigReplyMessage', 'TaskRegisterMessage', 'TaskSendMessage']
class BaseMessage(Struct):
req = Field(str)
hostname = Field(str, de... | import time
from cc.json import Struct, Field
from cc.message import CCMessage
__all__ = ['LogMessage', 'InfofileMessage', 'JobRequestMessage', 'JobConfigReplyMessage', 'TaskRegisterMessage', 'TaskSendMessage']
class BaseMessage(Struct):
req = Field(str)
def send_to(self, sock):
cmsg = CCMessage(jmsg... | bsd-2-clause | Python |
89d9328696a01e70428fccfa890d847e91f5f5c4 | Fix copy-paste bug | nanonyme/syscertifi | certifi.py | certifi.py | import platform
if platform.system() == "Windows":
import wincertstore
import atexit
import ssl
certfile = wincertstore.CertFile()
certfile.addstore("CA")
certfile.addstore("ROOT")
atexit.register(certfile.close) # cleanup and remove files on shutdown
def where():
return certfil... | import platform
if platform.system() == "Windows":
import wincertstore
import atexit
import ssl
certfile = wincertstore.CertFile()
certfile.addstore("CA")
certfile.addstore("ROOT")
atexit.register(certfile.close) # cleanup and remove files on shutdown
def where():
return certfil... | isc | Python |
57d9d4fe1b46d9dd45629dc5fc461c0b8c51c5ec | Fix music helper | Blindle/Raspberry | src/helpers/musicHelper.py | src/helpers/musicHelper.py | import pygame
import os
import sys
sys.path.append(os.path.dirname(__file__) + "/../audios/letters")
pygame.mixer.init()
def play_word(word):
for letter in word:
_play_letter(letter)
def _play_letter(letter):
pygame.mixer.music.load("audios/letters/" + letter.lower() + ".mp3")
pygame.mixer.music... | #import pygame
import os
import sys
import pyglet
sys.path.append(os.path.dirname(__file__) + "/../audios/letters")
pyglet.options['audio'] = ('openal', 'pulse', 'silent')
player = pyglet.media.Player()
#pygame.mixer.init()
def play_file(file_path):
pass
#pygame.mixer.music.load(file_path)
# playAudioLoa... | mit | Python |
38d96e4ddbe44af8f028dfb29eca17dc8ecd478d | test case for clean module | prem2014/html2latex,prem2014/html2latex,psjinx/html2latex,psjinx/html2latex | src/html2latex/__init__.py | src/html2latex/__init__.py | from .html2latex import html2latex
html2latex
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
| from .html2latex import html2latex
html2latex
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
| mit | Python |
46f15a00d2324da4b9f12c9168ddda8dddb1b607 | use notebook-style for plot_logistic_path.py (#22536) | saiwing-yeung/scikit-learn,anntzer/scikit-learn,AlexandreAbraham/scikit-learn,lesteve/scikit-learn,ivannz/scikit-learn,scikit-learn/scikit-learn,TomDLT/scikit-learn,scikit-learn/scikit-learn,espg/scikit-learn,AlexandreAbraham/scikit-learn,scikit-learn/scikit-learn,betatim/scikit-learn,saiwing-yeung/scikit-learn,lesteve... | examples/linear_model/plot_logistic_path.py | examples/linear_model/plot_logistic_path.py | """
==============================================
Regularization path of L1- Logistic Regression
==============================================
Train l1-penalized logistic regression models on a binary classification
problem derived from the Iris dataset.
The models are ordered from strongest regularized to least r... | """
==============================================
Regularization path of L1- Logistic Regression
==============================================
Train l1-penalized logistic regression models on a binary classification
problem derived from the Iris dataset.
The models are ordered from strongest regularized to least r... | bsd-3-clause | Python |
fd6899578bc8e6149921998d42be383f21adbe9a | add plots | cjekel/piecewise_linear_fit_py,cjekel/piecewise_linear_fit_py,cjekel/piecewiseLinearFitPython | examples/tf/bench_run_times/plot_results.py | examples/tf/bench_run_times/plot_results.py | import numpy as np
import matplotlib.pyplot as plt
# factor for 90% coverage with 90% confidence using Normal distribution
# with 10 samples from table XII in [1]
# [1] Montgomery, D. C., & Runger, G. C. (2014). Applied statistics and
# probability for engineers. Sixth edition. John Wiley & Sons.
k = 2.535
amd_fx_run... | import numpy as np
import matplotlib.pyplot as plt
amd_fx_run_times = np.load('amd_fx_8350_titanXP/6_break_times.npy')
n = np.load('amd_fx_8350_titanXP/n.npy') | mit | Python |
064802e0354cd9d27a7ea0d1c69a45baf0587c63 | add pool example | mylokin/redisext,mylokin/redisext | redisext/pool.py | redisext/pool.py | '''
Pool
----
.. autoclass:: Pool
:members:
The simpliest example of pool usage is token pool::
class TokenPool(Connection, redisext.pool.Pool):
SERIALIZER = redisext.serializer.String
and this pool could be used like::
>>> facebook = TokenPool('facebook')
>>> facebook.push('fb1')
True
>>> ... | '''
Pool
^^^^
.. autoclass:: Pool
:members:
SortedSet
^^^^^^^^^
.. autoclass:: SortedSet
:members:
'''
from __future__ import absolute_import
import redisext.models.abc
class Pool(redisext.models.abc.Model):
def pop(self):
item = self.connect_to_master().spop(self.key)
return self.decod... | mit | Python |
398496ccfbad5e4452192663a6daa49f11ee0f59 | Hide 'yield from' code from py.test | Jc2k/libcloudcore | libcloudcore/tests/test_asyncio_drivers.py | libcloudcore/tests/test_asyncio_drivers.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | apache-2.0 | Python |
e5ed6ef0c201d9a29c5934e3687abec7e13ae551 | update models to use a hashids for naming files | gitgik/updown | api/models.py | api/models.py | """
This file represents the models for the api app.
"""
from django.db import models
from .utils import get_file_upload_path, generate_uid
class DateMixin(models.Model):
"""A model mixin for date creation."""
created = models.DateField(auto_now_add=True)
class File(DateMixin):
"""This class represents... | """
This file represents the models for the api app.
"""
from django.db import models
class DateMixin(models.Model):
"""A model mixin for date creation."""
created = models.DateField(auto_now_add=True)
class File(DateMixin):
"""This class represents the file model."""
name = models.CharField(max_l... | mit | Python |
6e2515f4db3b6b9913e252cd52237574002637f2 | Add missing user_id in revoke_certs_by_user_and_project() | jianghuaw/nova,petrutlucian94/nova_dev,devendermishrajio/nova,CloudServer/nova,whitepages/nova,gooddata/openstack-nova,mikalstill/nova,openstack/nova,rahulunair/nova,dims/nova,ted-gould/nova,gspilio/nova,thomasem/nova,CiscoSystems/nova,jeffrey4l/nova,cloudbau/nova,akash1808/nova_test_latest,citrix-openstack-build/nova,... | nova/cert/manager.py | nova/cert/manager.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack, 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
#... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack, 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
#... | apache-2.0 | Python |
b45ce22e0d688e5c2a9a56f5eb87744cea87a263 | Fix scimath.power for negative integer input. | teoliphant/numpy-refactor,efiring/numpy-work,Ademan/NumPy-GSoC,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,illume/numpy3k,teoliphant/numpy-refactor,Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,jasonmccampbell/numpy-refactor-sprint,teoliphant/numpy-refactor,efiring/numpy-work,teoliphant/numpy-refactor,illume/... | numpy/lib/scimath.py | numpy/lib/scimath.py | """
Wrapper functions to more user-friendly calling of certain math functions
whose output data-type is different than the input data-type in certain
domains of the input.
"""
__all__ = ['sqrt', 'log', 'log2', 'logn','log10', 'power', 'arccos',
'arcsin', 'arctanh']
import numpy.core.numeric as nx
import nu... | """
Wrapper functions to more user-friendly calling of certain math functions
whose output data-type is different than the input data-type in certain
domains of the input.
"""
__all__ = ['sqrt', 'log', 'log2', 'logn','log10', 'power', 'arccos',
'arcsin', 'arctanh']
import numpy.core.numeric as nx
import nu... | bsd-3-clause | Python |
3c299bf2682a9b8d5be2c9c8f308720182935d12 | Add missing username to log statement | lutris/website,lutris/website,lutris/website,lutris/website | accounts/tasks.py | accounts/tasks.py | import logging
from celery import task
from django.db import IntegrityError
from django.utils.text import slugify
import games.models
from accounts.models import User
from emails.messages import send_daily_mod_mail
from games.util.steam import create_game
LOGGER = logging.getLogger()
@task
def sync_steam_library(u... | import logging
from celery import task
from django.db import IntegrityError
from django.utils.text import slugify
import games.models
from accounts.models import User
from emails.messages import send_daily_mod_mail
from games.util.steam import create_game
LOGGER = logging.getLogger()
@task
def sync_steam_library(u... | agpl-3.0 | Python |
3b6d5fd80eb4d95679b969e8809b154d6254de8d | Replace get_user_profile_by_email with get_user. | jrowan/zulip,Galexrt/zulip,punchagan/zulip,amanharitsh123/zulip,rishig/zulip,synicalsyntax/zulip,vaidap/zulip,timabbott/zulip,tommyip/zulip,rishig/zulip,shubhamdhama/zulip,punchagan/zulip,mahim97/zulip,tommyip/zulip,hackerkid/zulip,dhcrzf/zulip,brainwane/zulip,jackrzhang/zulip,tommyip/zulip,rht/zulip,dhcrzf/zulip,mahim... | zerver/management/commands/bankrupt_users.py | zerver/management/commands/bankrupt_users.py | from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import CommandError
from zerver.lib.actions import do_update_message_flags
from zerver.lib.management import ZulipBaseCommand
from zerver.models imp... | from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from zerver.lib.actions import do_update_message_flags
from zerver.models import UserProfile, Message, get_user_profile_by_email
... | apache-2.0 | Python |
3135bda8970a2fdefa92b932c15cf5c559392c9c | allow to specify db session callable directly | ergo/ziggurat_foundations,ergo/ziggurat_foundations | ziggurat_foundations/ext/pyramid/get_user.py | ziggurat_foundations/ext/pyramid/get_user.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import importlib
import logging
from ziggurat_foundations.models.base import get_db_session
from ziggurat_foundations.models.services.user import UserService
CONFIG_KEY = "ziggurat_foundations"
log = logging.getLogger(__name__)
def includeme(config):
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import importlib
import logging
from ziggurat_foundations.models.base import get_db_session
from ziggurat_foundations.models.services.user import UserService
CONFIG_KEY = "ziggurat_foundations"
log = logging.getLogger(__name__)
def includeme(config):
... | bsd-3-clause | Python |
07def114287bc3488e76e2516ca7682954ba4a09 | Use default alphabet | odtvince/APITaxi,l-vincent-l/APITaxi,openmaraude/APITaxi,odtvince/APITaxi,openmaraude/APITaxi,odtvince/APITaxi,odtvince/APITaxi,l-vincent-l/APITaxi | APITaxi/extensions.py | APITaxi/extensions.py | #coding: utf-8
from flask_sqlalchemy import SQLAlchemy as BaseSQLAlchemy
from sqlalchemy.pool import QueuePool as BaseQueuePool
class SQLAlchemy(BaseSQLAlchemy):
def apply_driver_hacks(self, app, info, options):
BaseSQLAlchemy.apply_driver_hacks(self, app, info, options)
class QueuePool(BaseQueueP... | #coding: utf-8
from flask_sqlalchemy import SQLAlchemy as BaseSQLAlchemy
from sqlalchemy.pool import QueuePool as BaseQueuePool
class SQLAlchemy(BaseSQLAlchemy):
def apply_driver_hacks(self, app, info, options):
BaseSQLAlchemy.apply_driver_hacks(self, app, info, options)
class QueuePool(BaseQueueP... | agpl-3.0 | Python |
9f500668555292add5d87c942e0cd804aefa6df2 | Replace cat usage for fgrep | stackforge/fuel-ostf,eayunstack/fuel-ostf,stackforge/fuel-ostf,eayunstack/fuel-ostf | fuel_health/tests/cloudvalidation/test_disk_space_db.py | fuel_health/tests/cloudvalidation/test_disk_space_db.py | # Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python |
2284f9f944ef72c7e2f6c9a4e93e395b09196719 | modify initial config | fatrix/django-golive,fatrix/django-golive | golive/management/commands/create_config.py | golive/management/commands/create_config.py | from django.core.management import BaseCommand
from fabric.state import output
import sys
from golive.stacks.stack import StackFactory, Stack
import yaml
class Command(BaseCommand):
help = 'Creates a basic exampe configuration file'
output['stdout'] = False
example = """CONFIG:
PLATFORM: DEDICATED
... | from django.core.management import BaseCommand
from fabric.state import output
import sys
from golive.stacks.stack import StackFactory, Stack
import yaml
class Command(BaseCommand):
help = 'Creates a basic exampe configuration file'
output['stdout'] = False
example = """CONFIG:
PLATFORM: DEDICATED
... | bsd-2-clause | Python |
bc85dffa594c292094d2aa1f5a456e0a0690ea79 | Remove debug code | pombredanne/grumpy,pombredanne/grumpy | grumpy-tools-src/tests/test_grumpy_tools.py | grumpy-tools-src/tests/test_grumpy_tools.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `grumpy_tools` package."""
import tempfile
import unittest
import pytest
from click.testing import CliRunner
from grumpy_tools import cli
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixt... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `grumpy_tools` package."""
import tempfile
import unittest
import pytest
from click.testing import CliRunner
from grumpy_tools import cli
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixt... | apache-2.0 | Python |
f42fdde5404c3025236ad7dcade4b08529e7ce36 | repair Noneuser_bug | ifwenvlook/blog,ifwenvlook/blog,ifwenvlook/blog,ifwenvlook/blog | app/delete.py | app/delete.py | from .models import User
from . import db
def deletenone():
noneuser=User.query.filter_by(username=None).all()
for user in noneuser:
db.session.delete(user)
db.session.commit()
| from .models import User
from . import db
def deletenone():
noneuser=User.query.filter_by(username=None).all()
for user in noneuser:
db.session.delete(user)
db.session.commit()
| mit | Python |
9ac03fa54f0134905033f615f6e02804f704b1a0 | Add User and Items | Alweezy/cp2-bucketlist-api,Alweezy/cp2-bucketlist-api,Alweezy/cp2-bucketlist-api | app/models.py | app/models.py | from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from app import db
class User(UserMixin, db.Model):
"""This class represents the user table."""
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.Str... | from app import db
class Bucketlist(db.Model):
"""This class represents the bucketlist table."""
__tablename__ = 'bucketlists'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255))
date_created = db.Column(db.DateTime, default=db.func.current_timestamp())
date_modifie... | mit | Python |
06d71ede1c1feaa597b442f4ead63d2b2e31e715 | fix `trigger` -> `__call__` | chainer/chainer,keisuke-umezawa/chainer,niboshi/chainer,tkerola/chainer,niboshi/chainer,keisuke-umezawa/chainer,wkentaro/chainer,chainer/chainer,wkentaro/chainer,keisuke-umezawa/chainer,hvy/chainer,hvy/chainer,hvy/chainer,okuta/chainer,hvy/chainer,chainer/chainer,okuta/chainer,pfnet/chainer,wkentaro/chainer,niboshi/cha... | chainer/training/triggers/once_trigger.py | chainer/training/triggers/once_trigger.py | class OnceTrigger(object):
"""Trigger based on the starting point of the iteration.
This trigger accepts only once at starting point of the iteration. There
are two ways to specify the starting point: only starting point in whole
iteration or called again when training resumed.
Args:
call... | class OnceTrigger(object):
"""Trigger based on the starting point of the iteration.
This trigger accepts only once at starting point of the iteration. There
are two ways to specify the starting point: only starting point in whole
iteration or called again when training resumed.
Args:
call... | mit | Python |
ddec6067054cc4408ac174e3ea4ffeca2a962201 | Remove unnecessary assert from view for Notice home. | 18F/regulations-site,18F/regulations-site,eregs/regulations-site,tadhg-ohiggins/regulations-site,tadhg-ohiggins/regulations-site,tadhg-ohiggins/regulations-site,eregs/regulations-site,eregs/regulations-site,eregs/regulations-site,tadhg-ohiggins/regulations-site,18F/regulations-site,18F/regulations-site | regulations/views/notice_home.py | regulations/views/notice_home.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from operator import itemgetter
import logging
from django.http import Http404
from django.template.response import TemplateResponse
from django.views.generic.base import View
from regulations.generator.api_reader import ApiReader
from regulations.vie... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from operator import itemgetter
import logging
from django.http import Http404
from django.template.response import TemplateResponse
from django.views.generic.base import View
from regulations.generator.api_reader import ApiReader
from regulations.vie... | cc0-1.0 | Python |
91946410f14b21e510a104b105a6f5036cc8944f | build updated | CountZer0/PipelineConstructionSet,CountZer0/PipelineConstructionSet,CountZer0/PipelineConstructionSet | python/common/core/globalVariables.py | python/common/core/globalVariables.py | '''
Author: Jason Parks
Created: Apr 22, 2012
Module: common.core.globalVariables
Purpose: to import globalVariables
'''
# Location of Toolset
toolsLocation = 'C:/Users/jason/git/PipelineConstructionSet'
# NOTE!: It is necessary to manually add the above location's
# python directory, i.e-
#
# PYTHONPATH = 'C:/Us... | '''
Author: Jason Parks
Created: Apr 22, 2012
Module: common.core.globalVariables
Purpose: to import globalVariables
'''
# Location of Toolset
toolsLocation = 'C:/Users/jason/git/PipelineConstructionSet'
# NOTE!: It is necessary to manually add the above location's
# python directory, i.e-
#
# PYTHONPATH = 'C:/Us... | bsd-3-clause | Python |
c573263511bcbf0ffe37f538142aedd9064f8ae0 | Remove copying devdata.env as it's only used for the Google API key we've removed | hypothesis/via,hypothesis/via,hypothesis/via | bin/devdata.py | bin/devdata.py | """Download .devdata from github.com:hypothesis/devdata.git."""
import os
from pathlib import Path
from shutil import copyfile
from subprocess import check_call
from tempfile import TemporaryDirectory
def _get_devdata():
# The directory that we'll clone the devdata git repo into.
with TemporaryDirectory() as... | """Download .devdata.env from github.com:hypothesis/devdata.git."""
import os
from pathlib import Path
from shutil import copyfile
from subprocess import check_call
from tempfile import TemporaryDirectory
def _get_devdata():
# The directory that we'll clone the devdata git repo into.
with TemporaryDirectory(... | bsd-2-clause | Python |
81b5961cdf4b9ca7e20920eda3c7f76f96a35a9b | Bump version | pbs/django-filer,pbs/django-filer,pbs/django-filer,pbs/django-filer,pbs/django-filer | filer/__init__.py | filer/__init__.py | #-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9pbs.105' # pragma: nocover
default_app_config = 'filer.apps.FilerConfig'
| #-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9pbs.105.dev1' # pragma: nocover
default_app_config = 'filer.apps.FilerConfig'
| bsd-3-clause | Python |
eef9d75a7d019a397d2026612ece76d217747e5b | mark oddity | ZeitOnline/zeit.edit,ZeitOnline/zeit.edit,ZeitOnline/zeit.edit | src/zeit/edit/browser/tests/test_form.py | src/zeit/edit/browser/tests/test_form.py | # Copyright (c) 2012 gocept gmbh & co. kg
# See also LICENSE.txt
from mock import Mock
import zeit.cms.testing
import zeit.edit.browser.form
import zope.formlib.form
import zope.interface
import zope.publisher.browser
import zope.schema
class IExample(zope.interface.Interface):
foo = zope.schema.TextLine(title=... | # Copyright (c) 2012 gocept gmbh & co. kg
# See also LICENSE.txt
from mock import Mock
import zeit.cms.testing
import zeit.edit.browser.form
import zope.formlib.form
import zope.interface
import zope.publisher.browser
import zope.schema
class IExample(zope.interface.Interface):
foo = zope.schema.TextLine(title=... | bsd-3-clause | Python |
22c727e0e38953f3647a8a825b01fcf142c06c64 | Bump version. | armet/python-armet | armet/_version.py | armet/_version.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
__version_info__ = (0, 4, 17)
__version__ = '.'.join(map(str, __version_info__))
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
__version_info__ = (0, 4, 16)
__version__ = '.'.join(map(str, __version_info__))
| mit | Python |
7a1ddf38db725f0696482a271c32fa297d629316 | Set the version to the next patch release number (in dev mode) | jszakmeister/trac-backlog,jszakmeister/trac-backlog | backlog/__init__.py | backlog/__init__.py | __version__ = (0, 2, 2, 'dev', 0)
def get_version():
version = '%d.%d.%d' % __version__[0:3]
if __version__[3]:
version = '%s-%s%s' % (version, __version__[3],
(__version__[4] and str(__version__[4])) or '')
return version
| __version__ = (0, 2, 1, '', 0)
def get_version():
version = '%d.%d.%d' % __version__[0:3]
if __version__[3]:
version = '%s-%s%s' % (version, __version__[3],
(__version__[4] and str(__version__[4])) or '')
return version
| bsd-3-clause | Python |
b808784711242099d8fbf9f0f1c7d13ca5a5a1d7 | Bump the version to 0.3.2 | dmtucker/backlog | backlog/__init__.py | backlog/__init__.py | """A Simple Note Manager"""
from __future__ import absolute_import
from backlog.backlog import Backlog
__version__ = '0.3.2'
| """A Simple Note Manager"""
from __future__ import absolute_import
from backlog.backlog import Backlog
__version__ = '0.3.1'
| lgpl-2.1 | Python |
d0c6ae0dbb68fad31c5f3e51d934b8c7f5e8534f | Add ability to override issue JQL in runner | ianunruh/jira-zd-bridge | jzb/runner.py | jzb/runner.py | from argparse import ArgumentParser
import logging
import sys
import jira
from redis import StrictRedis
import yaml
import zendesk
from jzb import LOG
from jzb.bridge import Bridge
from jzb.util import objectize
def configure_logger(level):
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(level)
... | from argparse import ArgumentParser
import logging
import sys
import jira
from redis import StrictRedis
import yaml
import zendesk
from jzb import LOG
from jzb.bridge import Bridge
from jzb.util import objectize
def configure_logger(level):
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(level)
... | apache-2.0 | Python |
122b0982d1e10aada383bbd373518d049e54b906 | Prepare for release 0.9pbs.107 | pbs/django-filer,pbs/django-filer,pbs/django-filer,pbs/django-filer,pbs/django-filer | filer/__init__.py | filer/__init__.py | #-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9pbs.107' # pragma: nocover
default_app_config = 'filer.apps.FilerConfig'
| #-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9pbs.107.dev1' # pragma: nocover
default_app_config = 'filer.apps.FilerConfig'
| bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.