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 |
|---|---|---|---|---|---|---|---|---|
13b2ea6c46513cb0b85e2a24b67903bab30a1333 | Add test to show exception | stvstnfrd/edx-platform,msegado/edx-platform,edx/edx-platform,angelapper/edx-platform,msegado/edx-platform,angelapper/edx-platform,mitocw/edx-platform,msegado/edx-platform,arbrandes/edx-platform,eduNEXT/edx-platform,msegado/edx-platform,appsembler/edx-platform,eduNEXT/edunext-platform,eduNEXT/edunext-platform,eduNEXT/ed... | openedx/core/tests/test_admin_view.py | openedx/core/tests/test_admin_view.py | """
Tests that verify that the admin view loads.
This is not inside a django app because it is a global property of the system.
"""
from django.test import TestCase, Client
from django.urls import reverse
from student.tests.factories import UserFactory, TEST_PASSWORD
from openedx.core.djangoapps.user_authn.views.logi... | """
Tests that verify that the admin view loads.
This is not inside a django app because it is a global property of the system.
"""
from django.test import TestCase, Client
from django.urls import reverse
from student.tests.factories import UserFactory, TEST_PASSWORD
from openedx.core.djangoapps.user_authn.views.logi... | agpl-3.0 | Python |
89e8051b6841969d2f3056b684ff1cac98a7d913 | Remove unused imports | WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos | lexos/views/bct_view.py | lexos/views/bct_view.py | from flask import session, render_template, Blueprint
from lexos.helpers import constants
from lexos.managers import session_manager
from lexos.models.bct_model import BCTModel
from lexos.views.base_view import detect_active_docs
from lexos.models.filemanager_model import FileManagerModel
# this is a flask blue print
... | from flask import session, render_template, Blueprint, send_from_directory, \
send_file
import io
from lexos.helpers import constants
from lexos.managers import session_manager
from lexos.models.bct_model import BCTModel
from lexos.views.base_view import detect_active_docs
from lexos.models.filemanager_model import... | mit | Python |
2a8752a75bc8c53c7d184934410532cc1f5f395b | change the default template to readthedocs | sdpython/python3_module_template | _doc/sphinxdoc/source/conf_base.py | _doc/sphinxdoc/source/conf_base.py | import sphinx_rtd_theme
try:
from pyquickhelper.helpgen.default_conf import set_sphinx_variables, get_default_stylesheet
except ImportError as e:
import os
import sys
paths = "\n".join(sys.path)
raise ImportError("pyquickhelper is not installed. PYTHONPATH={0}\nsys.path=\n{1}".format(
os.en... | import wild_sphinx_theme
try:
from pyquickhelper.helpgen.default_conf import set_sphinx_variables, get_default_stylesheet
except ImportError as e:
import os
import sys
paths = "\n".join(sys.path)
raise ImportError("pyquickhelper is not installed. PYTHONPATH={0}\nsys.path=\n{1}".format(
os.e... | mit | Python |
60db7bed76bfe0e6b7b85ba1fe8846bb330ce99d | Update mplot1.py | warnerem/pyASC,teuben/masc,teuben/pyASC,warnerem/pyASC,warnerem/pyASC,teuben/pyASC,warnerem/pyASC,warnerem/pyASC,warnerem/pyASC,warnerem/pyASC,JamesGaitan2018/pyASC,teuben/masc,teuben/pyASC,JamesGaitan2018/pyASC,teuben/pyASC,JamesGaitan2018/pyASC,teuben/pyASC,teuben/pyASC,teuben/pyASC,teuben/masc | examples/mplot1.py | examples/mplot1.py | #! /usr/bin/env python
#
# quick and dirty processing of the MD All Sky images
from astropy.io import fits
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import aplpy
def d(ff):
h = fits.open(ff)
return h[0].header, h[0].data
def dsum(i0,i1):
for i in range(i0,i1)... | #! /usr/bin/env python
#
# quick and dirty processing of the MD All Sky images
from astropy.io import fits
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import aplpy
def d(ff):
h = fits.open(ff)
return h[0].data
def dsum(i0,i1):
for i in range(i0,i1):
ff ... | mit | Python |
8d25a4d4ff1fab9b1b1d1b1ea3c07a62dcacec8e | Update idb_eth_bokolmanyo.py | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ideascube/conf/idb_eth_bokolmanyo.py | ideascube/conf/idb_eth_bokolmanyo.py | # -*- coding: utf-8 -*-
"""Bokolmanyo box in Ethiopia"""
from .base import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_NAME = u"Bokolmanyo"
COUNTRIES_FIRST = ['SO', 'ET']
TIME_ZONE = 'Africa/Addis_Ababa'
LANGUAGE_CODE = 'en'
MONITORING_ENTRY_EXPORT_FIELDS = ['serial', 'refugee_id', 'bir... | # -*- coding: utf-8 -*-
"""Bokolmanyo box in Ethiopia"""
from .base import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_NAME = u"Bokolmanyo"
COUNTRIES_FIRST = ['SO', 'ET']
TIME_ZONE = 'Africa/Addis_Ababa'
LANGUAGE_CODE = 'en'
MONITORING_ENTRY_EXPORT_FIELDS = ['serial', 'refugee_id', 'bir... | agpl-3.0 | Python |
eb5a40d76162ae4130ffce5d4fed8139fe03fb04 | add java creator | yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL,intel-analytics/BigDL,yangw1234/BigDL | python/friesian/src/bigdl/friesian/__init__.py | python/friesian/src/bigdl/friesian/__init__.py | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
b9a20d1cf65fb89debbad15d4451efbf77cddb5d | use one single FILENAME | fatcloud/PyCV-time | projects/laser_drawing/laser_drawing.py | projects/laser_drawing/laser_drawing.py | import cv2
import numpy as np
from screen_finder.screen_finder import ScreenFinder
from cam import OpenCV_Cam
def draw_burning(canvas, location):
cv2.circle(canvas, (lx, ly), 5, (255, 0, 0, 255))
return canvas
def find_laser_loc(img, threshold):
red_part = img[:,:,2]
max_pos = red_part.arg... | import cv2
import numpy as np
from screen_finder.screen_finder import ScreenFinder
from cam import OpenCV_Cam
def draw_burning(canvas, location):
cv2.circle(canvas, (lx, ly), 5, (255, 0, 0, 255))
return canvas
def find_laser_loc(img, threshold):
red_part = img[:,:,2]
max_pos = red_part.arg... | mit | Python |
5c9ae4db0892e706fec146853c72619819bfd0a6 | Add DICOM knee download example | akaszynski/vtkInterface | vtki/examples/downloads.py | vtki/examples/downloads.py | """Functions to download sampe datasets from the VTK data repository
"""
import shutil
import os
import sys
import vtki
DOWNLOAD_TEMP_FOLDER = True
"""
A flag to save downloads in a temporary directory or the current working
directory.
"""
# Helpers:
def _get_vtk_file_url(filename):
return 'https://github.com/... | """Functions to download sampe datasets from the VTK data repository
"""
import shutil
import os
import sys
import vtki
DOWNLOAD_TEMP_FOLDER = True
"""
A flag to save downloads in a temporary directory or the current working
directory.
"""
# Helpers:
def _get_vtk_file_url(filename):
return 'https://github.com/... | mit | Python |
a8dca5c271ed0ff618e0fbfb6a1403d435e2022f | Correct geom_st_box2d column | ioda-net/geo-infra,ioda-net/geo-infra,ioda-net/geo-infra,ioda-net/geo-infra | scripts/utils/shape-to-csv.py | scripts/utils/shape-to-csv.py | #!/usr/bin/env python3
import csv
import ogr
import osr
import sys
import unicodedata
def usage():
print('shape-to-csv.py PATH_TO_INPUT_SHAPE PATH_TO_OUTPUT_CSV')
def main():
# Inspired by http://gis.stackexchange.com/a/19178
# This is design to work with the places.shp from Swisstzerland.
shpfile ... | #!/usr/bin/env python3
import csv
import ogr
import osr
import sys
import unicodedata
def usage():
print('shape-to-csv.py PATH_TO_INPUT_SHAPE PATH_TO_OUTPUT_CSV')
def main():
# Inspired by http://gis.stackexchange.com/a/19178
# This is design to work with the places.shp from Swisstzerland.
shpfile ... | agpl-3.0 | Python |
328242061ecff1485ce4be073f457400ca557d59 | Send event when refresh method is called. | mharriger/reui | reui/Box.py | reui/Box.py | import reui
from pydispatch import dispatcher
'''
A box is a region of a display that can be drawn to. Boxes can optionally have borders.
'''
class Box:
'''
width = width of box
height = height of box
'''
def __init__(self, display, width, height, border_flags=0, x=0, y=0):
self.display = d... | import reui
'''
A box is a region of a display that can be drawn to. Boxes can optionally have borders.
'''
class Box:
'''
width = width of box
height = height of box
'''
def __init__(self, display, width, height, border_flags=0, x=0, y=0):
self.display = display
self.width = width
... | mit | Python |
ce054f08701bb712c6a9ac4844d26c7ce634a1d0 | Fix "django.conf.urls.patterns() is deprecated" | opencivicdata/imago | imago/urls.py | imago/urls.py | from django.conf.urls import url
from imago.views import (JurisdictionList,
PeopleList,
VoteList,
EventList,
BillList,
OrganizationList,
DivisionList,
... | from django.conf.urls import patterns, url
from imago.views import (JurisdictionList,
PeopleList,
VoteList,
EventList,
BillList,
OrganizationList,
DivisionList,
... | bsd-3-clause | Python |
66e77ad31a0b9600be9560a9b069673d23026d5c | rename vars for clarity | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/app_manager/tests/test_suite_usercase.py | corehq/apps/app_manager/tests/test_suite_usercase.py | from django.test import SimpleTestCase
from corehq.apps.app_manager.models import (
Application,
ConditionalCaseUpdate,
Module,
PreloadAction,
UpdateCaseAction,
)
from corehq.apps.app_manager.tests.util import (
SuiteMixin,
TestXmlMixin,
patch_get_xform_resource_overrides,
)
@patch_ge... | from django.test import SimpleTestCase
from corehq.apps.app_manager.models import (
Application,
ConditionalCaseUpdate,
Module,
PreloadAction,
UpdateCaseAction,
)
from corehq.apps.app_manager.tests.util import (
SuiteMixin,
TestXmlMixin,
patch_get_xform_resource_overrides,
)
@patch_ge... | bsd-3-clause | Python |
c46f2bd3117f991ad84b2421fbea4c16d6fa0613 | Update doscrap.py | sakib7/scrapper,sakib7/scrapper | doscrap.py | doscrap.py | from urllib.request import urlopen as ureq
from bs4 import BeautifulSoup as soup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
my_url = 'https://summerofcode.withgoogle.com/organizations/'
# uClient = ureq(my_url)
# pagehtml = uClient.read()
# uClient.close()
... | from urllib.request import urlopen as ureq
from bs4 import BeautifulSoup as soup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
my_url = 'https://summerofcode.withgoogle.com/organizations/'
# uClient = ureq(my_url)
# pagehtml = uClient.read()
# uClient.close()
... | mit | Python |
4c5f971625d354948c83c96e5c7163809bffda64 | add splitList function | kennell/ftpknocker,kevvvvv/ftpknocker | ftpknocker.py | ftpknocker.py | #!/usr/bin/env python3
from argparse import ArgumentParser
from netaddr import IPSet
from random import shuffle
from time import sleep
import ftplib
import threading
def split_list(l, parts):
newlist = []
splitsize = 1.0/parts*len(l)
for i in range(parts):
newlist.append(l[int(r... | #!/usr/bin/env python3
from argparse import ArgumentParser
from netaddr import IPSet
from random import shuffle
from time import sleep
import ftplib
import threading
def tryFtpConnect(host):
ftp = ftplib.FTP()
try:
ftp.connect(host=host, timeout=args.timeout)
if '230' in ftp.login():
print(host)
ftp.quit(... | unknown | Python |
9bc83a8922d274f0da408f6c4b0c9e6d34d6e30b | Refactor certified languages method to use more generic request method | anapaulagomes/reviews-assigner | hunter/reviewsapi.py | hunter/reviewsapi.py | import requests
import os
from .endpoints import *
class UnauthorizedToken(Exception):
pass
class ReviewsAPI:
def __init__(self):
token = os.environ['UDACITY_AUTH_TOKEN']
self.headers = {'Authorization': token, 'Content-Length': '0'}
def go(self, request):
try:
raw_... | import requests
import os
from .endpoints import *
class UnauthorizedToken(Exception):
pass
class ReviewsAPI:
def __init__(self):
token = os.environ['UDACITY_AUTH_TOKEN']
self.headers = {'Authorization': token, 'Content-Length': '0'}
def go(self, request):
try:
raw_... | mit | Python |
2b037230ad60ba0107350512408909aa1bba89c2 | use correct call_command import | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/users/migrations/0032_add_download_reports_permission.py | corehq/apps/users/migrations/0032_add_download_reports_permission.py | import traceback
from django.db import migrations
from django.core.management import call_command
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def migrate_download_reports_permissions(apps, schema_editor):
try:
call_command(
"add_download_reports_perm... | import traceback
from django.db import migrations
from corehq.apps.couch_sql_migration.tests.test_migration import call_command
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def migrate_download_reports_permissions(apps, schema_editor):
try:
call_command(
... | bsd-3-clause | Python |
06d55076e284cb79a91ea40cd659d7212083f9fb | document generate_debug_id function | tjcsl/director,tjcsl/director,tjcsl/director,tjcsl/director | web3/apps/users/helpers.py | web3/apps/users/helpers.py | from .models import User, Group
from ..sites.models import Site, Domain
from ..sites.helpers import create_site_users, make_site_dirs, create_config_files, flush_permissions, reload_nginx_config
from ...utils.tjldap import get_uid, get_full_name
def generate_debug_id(username):
"""Used in development environments... | from .models import User, Group
from ..sites.models import Site, Domain
from ..sites.helpers import create_site_users, make_site_dirs, create_config_files, flush_permissions, reload_nginx_config
from ...utils.tjldap import get_uid, get_full_name
def generate_debug_id(username):
if User.objects.filter(username=use... | mit | Python |
602ecde97e390c8e4acaf679b00e9b1237b0e95c | Update redis_key. | dvhbru/dvhb-hybrid | dvhb_hybrid/redis.py | dvhb_hybrid/redis.py | def redis_key(project_slug, key, *namespaces):
"""
Generates project dependent Redis key
>>> redis_key('a', 'b')
'a:b'
>>> redis_key('a', 'b', 'c', 'd')
'a:c:d:b'
"""
if namespaces:
namespace = ':'.join(namespaces)
return '{}:{}:{}'.format(project_slug, namespace, key)
... | def redis_key(project_slug, key, namespace=None):
return '{}:{}:{}'.format(
project_slug,
namespace.replace('/', ':'),
key)
class RedisMixin:
project_slug = None
@classmethod
def redis_key(cls, key, namespace=None):
return redis_key(cls.project_slug, key, namespace=nam... | mit | Python |
3259d50d2963aace2bb2a952771a4ec9c5cf7ea3 | change admin widget for projectextra | k4ml/harga,k4ml/harga | harga/admin.py | harga/admin.py | from django.contrib import admin
from django import forms
from harga.models import Product, ProductExtra
class ProductAdmin(admin.ModelAdmin):
pass
class ProductExtraAdminForm(forms.ModelForm):
class Meta:
model = ProductExtra
widgets = {
'tarikh': forms.TextInput,
'na... | from django.contrib import admin
from harga.models import Product, ProductExtra
class ProductAdmin(admin.ModelAdmin):
pass
class ProductExtraAdmin(admin.ModelAdmin):
pass
admin.site.register(Product, ProductAdmin)
admin.site.register(ProductExtra, ProductExtraAdmin)
| agpl-3.0 | Python |
b8d7a44db08eab7736f89ace3e306c919a145a84 | fix tests | dalou/django-fontforge-watcher | runtests.py | runtests.py | #!/usr/bin/env python
import os
import sys
from django.conf import settings
from django.core.management import execute_from_command_line
if not settings.configured:
settings.configure(
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
... | #!/usr/bin/env python
import sys
from os.path import dirname, abspath
from django.conf import settings
if not settings.configured:
settings.configure(
INSTALLED_APPS=[
'stylus_watcher',
]
)
def runtests(*test_args):
# if not test_args:
# test_args = ['stylus_watcher... | bsd-3-clause | Python |
619d26937140acb7ec16cccd5d2cacf733ec1a22 | Remove conditionals from runtests. | mlavin/django-all-access,iXioN/django-all-access,mlavin/django-all-access,iXioN/django-all-access | runtests.py | runtests.py | #!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
try:
import social_auth
except ImportError:
social_auth = None
SWAPPED = os.environ.get('SWAPPED', False)
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
... | #!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
try:
import social_auth
except ImportError:
social_auth = None
try:
import south
except ImportError:
south = None
SWAPPED = os.environ.get('SWAPPED', False)
INSTALLED_APPS = [
'django.contrib.auth',
'd... | bsd-2-clause | Python |
801094dbd539a29ba2d0b41d29ce09e824580698 | handle conflicts during queue-pop | kokosing/git-gifi,kokosing/git-gifi | gifi/queue.py | gifi/queue.py | from command import Command, AggregatedCommand, CommandException
from utils.git_utils import get_repo, check_repo_is_clean
from git import GitCommandError
import feature
def _pop():
repo = get_repo()
check_repo_is_clean(repo)
if repo.git.stash('list') == '':
raise CommandException('There is nothin... | from command import Command, AggregatedCommand, CommandException
from utils.git_utils import get_repo, check_repo_is_clean
import feature
def _pop():
repo = get_repo()
check_repo_is_clean(repo)
if repo.git.stash('list') == '':
raise CommandException('There is nothing in the queue to pop from.')
... | apache-2.0 | Python |
8e9ee1dd29df011f63298e06bceded8fd3a288b6 | create switch_master function | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/drivers/replication_topologies/mysql_single.py | dbaas/drivers/replication_topologies/mysql_single.py | # -*- coding: utf-8 -*-
from base import BaseTopology, STOP_RESIZE_START
class MySQLSingle(BaseTopology):
def get_deploy_steps(self):
return (
'workflow.steps.util.deploy.build_databaseinfra.BuildDatabaseInfra',
'workflow.steps.mysql.deploy.create_virtualmachines.CreateVirtualMach... | # -*- coding: utf-8 -*-
from base import BaseTopology, STOP_RESIZE_START
class MySQLSingle(BaseTopology):
def get_deploy_steps(self):
return (
'workflow.steps.util.deploy.build_databaseinfra.BuildDatabaseInfra',
'workflow.steps.mysql.deploy.create_virtualmachines.CreateVirtualMach... | bsd-3-clause | Python |
1d7a7af8667fed9106841dc127b6cc583c7129c1 | add default name for nameless exports | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | couchexport/shortcuts.py | couchexport/shortcuts.py | from django.http import HttpResponse
from StringIO import StringIO
def export_data_shared(export_tag, format=None,
filename=None):
"""
Shared method for export. If there is data, return an HTTPResponse
with the appropriate data. If there is not data returns None.
"""
from co... | from django.http import HttpResponse
from StringIO import StringIO
def export_data_shared(export_tag, format=None,
filename=None):
"""
Shared method for export. If there is data, return an HTTPResponse
with the appropriate data. If there is not data returns None.
"""
from co... | bsd-3-clause | Python |
3644957369154731f429476d9998dd03ad454ec1 | Update boundbox test to use python code. | nightstrike/blender_nif_plugin,amorilia/blender_nif_plugin,nightstrike/blender_nif_plugin,amorilia/blender_nif_plugin | testframework/test/collisions/test_bounds.py | testframework/test/collisions/test_bounds.py | """Export and import bound meshes."""
import bpy
import nose.tools
import os
import io_scene_nif.nif_export
from pyffi.formats.nif import NifFormat
from test import SingleNif
from test.collisions import gen_boundbox
class TestBBox(SingleNif):
n_name = "collisions/boundbox"
b_name = "BBoxTest"
def b_cre... | """Export and import bound meshes."""
import bpy
import nose.tools
import os
import io_scene_nif.nif_export
from pyffi.formats.nif import NifFormat
from test.geometry.trishape.test_geometry import TestBaseGeometry
class TestBound(TestBaseGeometry):
n_name = "collisions/boundbox/bound_box"
b_name = "Bounding... | bsd-3-clause | Python |
48323d6d9904adb3abf492f430cd93a6346315b3 | bump 3.0.10 (#1384) | F5Networks/f5-common-python,F5Networks/f5-common-python | f5/__init__.py | f5/__init__.py | # Copyright 2016 F5 Networks 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 writi... | # Copyright 2016 F5 Networks 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 writi... | apache-2.0 | Python |
636f853a324ffc38f9ebe26ff1489bc2631d26ea | add 0.1 timeout | viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker | scripts/__travis_test__.py | scripts/__travis_test__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
os.system('python nettacker.py --help')
os.system("python nettacker.py -i 127.0.0.1 -u user1,user2 -p pass1,pass2 -m all -g 21,25,80,443 -t 2 -T 0.1")
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
os.system('python nettacker.py --help')
os.system("python nettacker.py -i 127.0.0.1 -u user1,user2 -p pass1,pass2 -m all -g 21,25,80,443 -t 2")
| apache-2.0 | Python |
10ab84c132b2377961fca03a46b2d0f4e47151e2 | change the name groups to groupss | moranmo29/ShareLink,moranmo29/ShareLink,moranmo29/ShareLink | web/pages/mygroupschat.py | web/pages/mygroupschat.py | from google.appengine.ext.webapp import template
import webapp2
import json
from models.user import User
from models.link import Link
from models.group import Group
class GroupHandler(webapp2.RequestHandler):
def get(self, group_id):
template_params={}
user = None
if self.request.cookies.get('our_token'): #... | from google.appengine.ext.webapp import template
import webapp2
import json
from models.user import User
from models.link import Link
from models.group import Group
class GroupHandler(webapp2.RequestHandler):
def get(self, group_id):
template_params={}
user = None
if self.request.cookies.get('our_token'): #... | mit | Python |
93948727719e5c8c91e4d82ccac1a801603c9546 | make dictionary | mprat/sentence-encoder | encoder.py | encoder.py | import argparse
import string
def construct_dictionary(keyword):
keyword_letters = set(list(keyword))
if len(keyword_letters) != len(keyword):
raise ValueError("Keyword should have unique letters")
lowercase_letters = list(string.ascii_lowercase)
for letter in keyword_letters:
lowercase_letters.remove(letter... | import argparse
def encode(sentence, keyword):
print "keyword is %s" % keyword
return sentence
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Encode a sentnce with a keyword.")
parser.add_argument("-s", dest="sentence", type=str, required=True)
parser.add_argument("-k", dest="keyword"... | bsd-3-clause | Python |
7f43af4a8105afb9e00ab8df478c039610d7944b | set version to 1.7.1 | emory-libraries/findingaids,mprefer/findingaids,emory-libraries/findingaids,mprefer/findingaids | findingaids/__init__.py | findingaids/__init__.py | # file findingaids/__init__.py
#
# Copyright 2012 Emory University Library
#
# 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
#
# U... | # file findingaids/__init__.py
#
# Copyright 2012 Emory University Library
#
# 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
#
# U... | apache-2.0 | Python |
3a300d741a75f44c78aac8dbd2f57f8d66ae33f4 | Update activate-devices.py | JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub | cron/activate-devices.py | cron/activate-devices.py | #!/usr/bin/env python
import MySQLdb
#import datetime
#import urllib2
#import os
import datetime
import RPi.GPIO as GPIO
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO!")
servername = "localhost"
username = "pi"
password = "password"
dbname = "pi_heating_db"
GPIO.setmode(G... | #!/usr/bin/env python
import MySQLdb
#import datetime
#import urllib2
#import os
import datetime
import RPi.GPIO as GPIO
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO!")
servername = "localhost"
username = "pi"
password = "password"
dbname = "pi_heating_db"
GPIO.setmode(G... | apache-2.0 | Python |
10f8dbfa466b8bdbf579f1a42dcc2c8d936f68c0 | Handle options passed to clear_collectstatic_cache | nanolearningllc/edx-platform-cypress,cselis86/edx-platform,etzhou/edx-platform,Livit/Livit.Learn.EdX,zadgroup/edx-platform,amir-qayyum-khan/edx-platform,xingyepei/edx-platform,jelugbo/tundex,chand3040/cloud_that,naresh21/synergetics-edx-platform,UXE/local-edx,miptliot/edx-platform,analyseuc3m/ANALYSE-v1,cecep-edu/edx-p... | common/djangoapps/static_replace/management/commands/clear_collectstatic_cache.py | common/djangoapps/static_replace/management/commands/clear_collectstatic_cache.py | ###
### Script for importing courseware from XML format
###
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = \
'''Import the specified data directory into the default ModuleStore'''
def handle_noargs(self, **options):
staticfiles_cache = get_cache('staticfile... | ###
### Script for importing courseware from XML format
###
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = \
'''Import the specified data directory into the default ModuleStore'''
def handle_noargs(self):
staticfiles_cache = get_cache('staticfiles')
... | agpl-3.0 | Python |
6538a682a5b0d03ca70e097ef390551e4d68033e | fix import modules | statlab/cryptorandom | cryptorandom/__init__.py | cryptorandom/__init__.py | from ..cryptorandom import *
from ..prng import * | from cryptorandom import *
from prng import * | bsd-2-clause | Python |
8920f4b2dff2a3fb087e139fe0b8cc9bcdaa5a4c | create coupon model | Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup | customermanage/models.py | customermanage/models.py | from django.db import models
from storemanage.models import Currency, Ticket
from django.contrib.auth.models import User
# Create your models here.
class Wallet(models.Model):
currency = models.ForeignKey(Currency, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
amount = ... | from django.db import models
from storemanage.models import Currency
from django.contrib.auth.models import User
# Create your models here.
class Wallet(models.Model):
currency = models.ForeignKey(Currency, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
amount = models.P... | mit | Python |
75afb1126ec327a29b422ffa60a07152396b613f | Update for v4.6.0 | maxmind/GeoIP2-python,maxmind/GeoIP2-python | geoip2/__init__.py | geoip2/__init__.py | # pylint:disable=C0111
__title__ = "geoip2"
__version__ = "4.6.0"
__author__ = "Gregory Oschwald"
__license__ = "Apache License, Version 2.0"
__copyright__ = "Copyright (c) 2013-2022 Maxmind, Inc."
| # pylint:disable=C0111
__title__ = "geoip2"
__version__ = "4.5.0"
__author__ = "Gregory Oschwald"
__license__ = "Apache License, Version 2.0"
__copyright__ = "Copyright (c) 2013-2022 Maxmind, Inc."
| apache-2.0 | Python |
67774cd1ec339d815914a2894f8653a1cb08de16 | Fix author test | dropbox/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes | tests/changes/api/test_author_build_index.py | tests/changes/api/test_author_build_index.py | from uuid import uuid4
from changes.config import db
from changes.models import Author
from changes.testutils import APITestCase
class AuthorBuildListTest(APITestCase):
def test_simple(self):
fake_author_id = uuid4()
self.create_build(self.project)
path = '/api/0/authors/{0}/builds/'.fo... | from uuid import uuid4
from changes.config import db
from changes.models import Author
from changes.testutils import APITestCase
class AuthorBuildListTest(APITestCase):
def test_simple(self):
fake_author_id = uuid4()
self.create_build(self.project)
path = '/api/0/authors/{0}/builds/'.fo... | apache-2.0 | Python |
20183214c736efe695af7cb0c8416639c6289e91 | Update P04_drawingOnImages fixed OSError by using font on system | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter17/P04_drawingOnImages.py | books/AutomateTheBoringStuffWithPython/Chapter17/P04_drawingOnImages.py | # This program uses the pillow module to draw on digital images
from PIL import Image, ImageDraw
im = Image.new('RGBA', (200, 200), 'white')
draw = ImageDraw.Draw(im)
# Drawing Shapes
draw.line([(0, 0), (199, 0), (199, 199), (0, 199), (0, 0)], fill='black')
draw.rectangle((20, 30, 60, 60), fill='blue')
draw.ellipse((... | # This program uses the pillow module to draw on digital images
from PIL import Image, ImageDraw
im = Image.new('RGBA', (200, 200), 'white')
draw = ImageDraw.Draw(im)
# Drawing Shapes
draw.line([(0, 0), (199, 0), (199, 199), (0, 199), (0, 0)], fill='black')
draw.rectangle((20, 30, 60, 60), fill='blue')
draw.ellipse((... | mit | Python |
bdd51ef09ad15c31545d58e1aa53b806e78c041d | update import with renamed file | jjrennie/GHCNpy | ghcnpy/__init__.py | ghcnpy/__init__.py | # Import Modules
from .iotools import *
from .metadata import *
from .plotting import *
def intro():
print("################################################################################")
print("GHCNPy")
print("A python package to analyze and Displaying Weather Stations from GHCN-Daily")
return None
| # Import Modules
from .io import *
from .metadata import *
from .plotting import *
def intro():
print("################################################################################")
print("GHCNPy")
print("A python package to analyze and Displaying Weather Stations from GHCN-Daily")
return None
| bsd-3-clause | Python |
3c1810c1e95ebc641d966ee1c0a927fa2d871501 | Update read.py | hanbing718/OMOOC2py,hanbing718/OMOOC2py | _src/om2py0w/0wex1/read.py | _src/om2py0w/0wex1/read.py | # -*- coding: utf-8 -*-
import os
ls =os.linesep
#get filename
fname = raw_input('input a file name to save filenames:%s' % ls)
#
all=[]
print"\nEnter lines *'.'by itself to quit).\n"
#loop until user terminates input
while True:
entry=raw_input('>')
if entry=='EXIT':
break
elif entry=='READ'... | import dir.main
print dir.main.name
| mit | Python |
7d10c18c1feb0c61aee9d3a44c3a7fa24e4e3c25 | Revert "Document AgentCheck count and monotonic_count methods" | inokappa/documentation,macobo/documentation,inokappa/documentation,jhotta/documentation,jhotta/documentation,jhotta/documentation,macobo/documentation,macobo/documentation,inokappa/documentation,jhotta/documentation,jhotta/documentation,jhotta/documentation,inokappa/documentation,inokappa/documentation,macobo/documenta... | code_snippets/guides-agentchecks-methods.py | code_snippets/guides-agentchecks-methods.py | self.gauge( ... ) # Sample a gauge metric
self.increment( ... ) # Increment a counter metric
self.decrement( ... ) # Decrement a counter metric
self.histogram( ... ) # Sample a histogram metric
self.rate( ... ) # Sample a point, with the rate calculated at the end of the check
| self.gauge( ... ) # Sample a gauge metric
self.increment( ... ) # Increment a counter metric
self.decrement( ... ) # Decrement a counter metric
self.histogram( ... ) # Sample a histogram metric
self.rate( ... ) # Sample a point, with the rate calculated at the end of the check
self.count( ... ) # Sample a raw coun... | bsd-3-clause | Python |
c0e870064512f81298c4feacf51efa4568c1a775 | Update Player.py | juanjo78git/py6Nimmt | py6Nimmt/Player.py | py6Nimmt/Player.py | # -*- coding: utf-8 -*-
from py6Nimmt import Deck
class Player(object):
""" Player """
def __init__(self, ids, name='Player', hand=None, pile=None):
self.id = ids
self.name = name
if hand is None:
self.hand = Deck.Deck(ids)
else:
self.hand = hand
... | # -*- coding: utf-8 -*-
from py6Nimmt import Deck
class Player(object):
""" Player """
def __init__(self, id, name='Player', hand=None, pile=None):
self.id = id
self.name = name
if hand is None:
self.hand = Deck.Deck(id)
else:
self.hand = hand
... | mit | Python |
11ee7b385031d493faa241bf81e407c69c5b67ef | Increase version to sync with pypi. | alejandroautalan/pygubu,alejandroautalan/pygubu | pygubu/__init__.py | pygubu/__init__.py | # encoding: utf8
from __future__ import unicode_literals
__all__ = ['Builder', 'TkApplication', 'BuilderObject', 'register_widget',
'register_property', 'remove_binding', 'ApplicationLevelBindManager']
import pygubu.builder.builderobject
from pygubu.builder import Builder
from pygubu.builder.builderobject ... | # encoding: utf8
from __future__ import unicode_literals
__all__ = ['Builder', 'TkApplication', 'BuilderObject', 'register_widget',
'register_property', 'remove_binding', 'ApplicationLevelBindManager']
import pygubu.builder.builderobject
from pygubu.builder import Builder
from pygubu.builder.builderobject ... | mit | Python |
78f199628afeec3a0aaac5abc579aeecdc971463 | Make current_week an int | mkokotovich/footballpicks,mkokotovich/footballpicks,mkokotovich/footballpicks,mkokotovich/footballpicks | footballseason/views.py | footballseason/views.py | from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from datetime i... | from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from datetime i... | mit | Python |
3d35f842aeec225688a2923f394fa167e8977011 | Put ctypes under if condition | pyblub/pyload,pyblub/pyload | pyload/utils/fs.py | pyload/utils/fs.py | # -*- coding: utf-8 -*-
import os
import sys
from os.path import join
from . import decode, remove_chars
# File System Encoding functions:
# Use fs_encode before accessing files on disk, it will encode the string properly
if sys.getfilesystemencoding().startswith('ANSI'):
def fs_encode(string):
if type(s... | # -*- coding: utf-8 -*-
import ctypes
import os
import sys
from os.path import join
from . import decode, remove_chars
# File System Encoding functions:
# Use fs_encode before accessing files on disk, it will encode the string properly
if sys.getfilesystemencoding().startswith('ANSI'):
def fs_encode(string):
... | agpl-3.0 | Python |
997d36c0dc422e8bcef3cf6cae5eea55883f76d9 | Sort files/dirs, and use oxygen icons | funkybob/django-filem,funkybob/django-filem,funkybob/django-filem | filem/utils.py | filem/utils.py | import mimetypes
from pathlib import PurePath, Path
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.contrib.staticfiles.templatetags.staticfiles import static
from easy_thumbnails.files import Thumbnailer
ROOT = Path(settings.MEDIA_ROOT).resolve()
staff_requ... | import mimetypes
from pathlib import PurePath, Path
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.contrib.staticfiles.templatetags.staticfiles import static
from easy_thumbnails.files import Thumbnailer
ROOT = Path(settings.MEDIA_ROOT).resolve()
staff_requ... | mit | Python |
4699d0aa2a868051ab3fdb4d76e763dd2000c9a6 | Fix version | mcuadros/pynats | pynats/__init__.py | pynats/__init__.py | from pynats.subscription import *
from pynats.connection import Connection
__version__ = '0.1.0'
| from pynats.subscription import *
from pynats.connection import Connection
__version__ = '0.0.1'
| mit | Python |
b59920e343bf57b83b8a31046f6ef2f66cb35098 | Remove list creation | paetzke/format-sql | format_sql/shortcuts.py | format_sql/shortcuts.py | # -*- coding: utf-8 -*-
"""
format-sql
Copyright (c) 2014, Friedrich Paetzke (paetzke@fastmail.fm)
All rights reserved.
"""
from .parser import parse
from .styler import style
from .tokenizer import normalize_sql, tokenize
def format_sql(sql):
sql, has_semicolon = normalize_sql(sql)
tokens = tokenize(sql)
... | # -*- coding: utf-8 -*-
"""
format-sql
Copyright (c) 2014, Friedrich Paetzke (paetzke@fastmail.fm)
All rights reserved.
"""
from .parser import parse
from .styler import style
from .tokenizer import normalize_sql, tokenize
def format_sql(sql):
sql, has_semicolon = normalize_sql(sql)
tokens = list(tokenize(s... | bsd-2-clause | Python |
d6d443c1ce95d04f0ded8aff2ee1cb0e07c01532 | Bump version to 3.1 | isaac-s/cloudify-manager,cloudify-cosmo/cloudify-manager,isaac-s/cloudify-manager,konradxyz/dev_fileserver,geokala/cloudify-manager,cloudify-cosmo/cloudify-manager,codilime/cloudify-manager,codilime/cloudify-manager,konradxyz/dev_fileserver,codilime/cloudify-manager,konradxyz/cloudify-manager,geokala/cloudify-manager,i... | plugins/plugin-installer/plugin_installer/tests/mock-plugin/setup.py | plugins/plugin-installer/plugin_installer/tests/mock-plugin/setup.py | # ***************************************************************************
# * Copyright (c) 2013 GigaSpaces Technologies Ltd. All rights reserved
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy of ... | # ***************************************************************************
# * Copyright (c) 2013 GigaSpaces Technologies Ltd. All rights reserved
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy of ... | apache-2.0 | Python |
dd63cc71c896446180352734ef09c6d9096bdb9b | Remove ipdb call. | lbeltrame/bcbio-nextgen,elkingtonmcb/bcbio-nextgen,brainstorm/bcbio-nextgen,vladsaveliev/bcbio-nextgen,a113n/bcbio-nextgen,mjafin/bcbio-nextgen,guillermo-carrasco/bcbio-nextgen,brainstorm/bcbio-nextgen,mjafin/bcbio-nextgen,Cyberbio-Lab/bcbio-nextgen,verdurin/bcbio-nextgen,elkingtonmcb/bcbio-nextgen,fw1121/bcbio-nextgen... | bcbio/rnaseq/cufflinks.py | bcbio/rnaseq/cufflinks.py | """Assess transcript abundance in RNA-seq experiments using Cufflinks.
http://cufflinks.cbcb.umd.edu/manual.html
"""
import os
from bcbio.utils import get_in, file_exists
from bcbio.distributed.transaction import file_transaction
from bcbio.pipeline import config_utils
from bcbio.provenance import do
def run(align_... | """Assess transcript abundance in RNA-seq experiments using Cufflinks.
http://cufflinks.cbcb.umd.edu/manual.html
"""
import os
from bcbio.utils import get_in, file_exists
from bcbio.distributed.transaction import file_transaction
from bcbio.pipeline import config_utils
from bcbio.provenance import do
def run(align_... | mit | Python |
3aec97767b0eaa497e0344c1e2177adefa9b6bf6 | Fix crypt key creation for GPGv1 | scorphus/passpie,scorphus/passpie,eiginn/passpie,marcwebbie/passpie,eiginn/passpie,marcwebbie/pysswords,marcwebbie/passpie | pysswords/crypt.py | pysswords/crypt.py | import gnupg
from .utils import which
def getgpg(path):
return gnupg.GPG(binary=which("gpg"), homedir=path)
def generate_key_input(path, passphrase):
return getgpg(path).gen_key_input(
name_real="Pysswords",
name_email="pysswords@pysswords",
name_comment="Auto-generated by Pysswords"... | import gnupg
from .utils import which
def getgpg(path):
return gnupg.GPG(binary=which("gpg"), homedir=path)
def generate_key_input(path, passphrase):
return getgpg(path).gen_key_input(
name_real="Pysswords",
name_email="pysswords@pysswords",
name_comment="Auto-generated by Pysswords"... | mit | Python |
3af1e8cc6d41e965ba7ab1ffbc658b778c70c1c3 | Reorder the imports | luistorresm/odoo,savoirfairelinux/odoo,JonathanStein/odoo,Endika/odoo,Drooids/odoo,OSSESAC/odoopubarquiluz,kirca/OpenUpgrade,makinacorpus/odoo,mvaled/OpenUpgrade,gavin-feng/odoo,RafaelTorrealba/odoo,guewen/OpenUpgrade,arthru/OpenUpgrade,agrista/odoo-saas,chiragjogi/odoo,xzYue/odoo,bkirui/odoo,JGarcia-Panach/odoo,srsman... | addons/account/__init__.py | addons/account/__init__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
#... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
#... | agpl-3.0 | Python |
f6e33d67aef41b10d4b128cb55880a763775a616 | Update example to set run duration | csdms/dakota,csdms/dakota | examples/pymt-hydrotrend-centered-parameter-study.py | examples/pymt-hydrotrend-centered-parameter-study.py | """An example of using Dakota as a component with PyMT.
This example requires a WMT executor with PyMT installed, as well as
the CSDMS Dakota interface and Hydrotrend installed as
components.
"""
import os
from pymt.components import CenteredParameterStudy, Hydrotrend
from dakotathon.utils import configure_parameters... | """An example of using Dakota as a component with PyMT.
This example requires a WMT executor with PyMT installed, as well as
the CSDMS Dakota interface and Hydrotrend installed as
components.
"""
import os
from pymt.components import CenteredParameterStudy, Hydrotrend
from dakotathon.utils import configure_parameters... | mit | Python |
7888918b139ed7dc18852fedf0afdde6c7e61329 | remove redundant code | jalanb/jab,jalanb/dotjab,jalanb/jab,jalanb/dotjab | python/doctests.py | python/doctests.py | import os
import sys
import doctest
import commands
import test_file
import fail_file
from pprint import pprint
def parse_files(stem):
test = '%s.test' % stem
tests = '%s.tests' % stem
fail = '%s.fail' % stem
return test_file.parse(test), test_file.parse(tests), fail_file.read_fail_file(fail)
def write_failing_... | import os
import sys
import doctest
import commands
import test_file
import fail_file
from pprint import pprint
def parse_files(stem):
test = '%s.test' % stem
tests = '%s.tests' % stem
fail = '%s.fail' % stem
return test_file.parse(test), test_file.parse(tests), fail_file.read_fail_file(fail)
def write_failing_... | mit | Python |
6a1941070fe4e2400ff92fca344cf1b11ae21f9b | Fix import order and whitespace | yola/yolapy | tests/test_integration/test_site_resource.py | tests/test_integration/test_site_resource.py | from tests.test_integration.helpers import (
create_site, create_user_with_subscription)
from tests.test_integration.test_case import YolaServiceTestCase
class TestYolaSite(YolaServiceTestCase):
"""Yola: Site resource"""
@classmethod
def setUpClass(cls):
super(TestYolaSite, cls).setUpClass()
... | from tests.test_integration.test_case import YolaServiceTestCase
from tests.test_integration.helpers import (
create_site, create_user_with_subscription)
class TestYolaSite(YolaServiceTestCase):
"""Yola: Site resource"""
@classmethod
def setUpClass(cls):
super(TestYolaSite, cls).setUpClass()... | mit | Python |
4403e9a7358ffa6ed43b91ff1a7577db2da83378 | add bd.py | aiit2016/2016-2Q-SP,aiit2016/2016-2Q-SP | ex11/bd.py | ex11/bd.py | # -*- coding: utf-8 -*-
from datetime import datetime
import sys
birthday = datetime.strptime(sys.argv[1], "%Y/%M/%d")
now = datetime.now()
how_old = int((now - birthday).days / 365.25)
if (now.month - birthday.month) > 0:
month = now.month - birthday.month
else:
month = (now.month + 12) - birthday... | # -*- coding: utf-8 -*-
from datetime import datetime
import sys
birthday = datetime.strptime(sys.argv[1], "%Y/%M/%d")
now = datetime.now()
how_old = int((now - birthday).days / 365.25)
if (now.month - birthday.month) > 0 :
month = now.month - birthday.month
else:
month = (now.month + 12) - birthda... | mit | Python |
ddcedf4506fd85aca5f4c144056cadd9ecf8a11e | use str for token | jamesturk/django-secretballot,jamesturk/django-secretballot | secretballot/middleware.py | secretballot/middleware.py | # -*- coding: utf-8 -*-
from hashlib import md5
from django.utils.deprecation import MiddlewareMixin
class SecretBallotMiddleware(MiddlewareMixin):
def process_request(self, request):
request.secretballot_token = self.generate_token(request)
def generate_token(self, request):
raise NotImpleme... | # -*- coding: utf-8 -*-
from hashlib import md5
from django.utils.deprecation import MiddlewareMixin
class SecretBallotMiddleware(MiddlewareMixin):
def process_request(self, request):
request.secretballot_token = self.generate_token(request)
def generate_token(self, request):
raise NotImpleme... | bsd-2-clause | Python |
ff2588992f467628b8f2fae68b33ebde014ad220 | add /sta/scan handler | twhtanghk/docker.esp8266,twhtanghk/docker.esp8266,twhtanghk/docker.esp8266,twhtanghk/docker.esp8266 | python/wlan/sta.py | python/wlan/sta.py | import ujson
import network
import picoweb
import logging
logger = logging.getLogger(__name__)
class STA:
def __init__(self):
self.interface = network.WLAN(network.STA_IF)
self.interface.active()
def get(self):
return self.interface.ifconfig()
def set(self, opts):
ssid = opts.get('ssid', [''])[... | import ujson
import network
import picoweb
import logging
logger = logging.getLogger(__name__)
class STA:
def __init__(self):
self.interface = network.WLAN(network.STA_IF)
self.interface.active()
def get(self):
return self.interface.ifconfig()
def set(self, opts):
self.interface.connect(opts.ss... | mit | Python |
863a9a38e9e0c2e642fcd277a2e804c9bef47227 | remove assert xml | sve-odoo/odoo,hbrunn/OpenUpgrade,guewen/OpenUpgrade,kittiu/odoo,kittiu/odoo,draugiskisprendimai/odoo,rowemoore/odoo,dkubiak789/odoo,damdam-s/OpenUpgrade,tinkhaven-organization/odoo,pplatek/odoo,CubicERP/odoo,takis/odoo,draugiskisprendimai/odoo,mustafat/odoo-1,salaria/odoo,spadae22/odoo,jusdng/odoo,cloud9UG/odoo,syci/OC... | addons/account/__terp__.py | addons/account/__terp__.py | {
"name" : "Accounting and financial management",
"version" : "1.0",
"depends" : ["product", "base"],
"author" : "Tiny",
"description": """Financial and accounting module that covers:
General accounting
Cost / Analytic accounting
Third party accounting
Taxes management
Budgets
""",
"website" : "http://tinye... | {
"name" : "Accounting and financial management",
"version" : "1.0",
"depends" : ["product", "base"],
"author" : "Tiny",
"description": """Financial and accounting module that covers:
General accounting
Cost / Analytic accounting
Third party accounting
Taxes management
Budgets
""",
"website" : "http://tinye... | agpl-3.0 | Python |
544147218b28abde51feb9eced95e0c705091a82 | Add remove mentions | hyharryhuang/python-keywords | python_keywords.py | python_keywords.py | #!/usr/bin/python
# coding: utf8
from nltk.corpus import stopwords
import re
import string
cachedStopWords = stopwords.words("english")
def removeStopWordsFromString(string):
return ' '.join([word for word in string.split() if word.lower() not in cachedStopWords])
def removeLinksFromString(string):
return re.su... | #!/usr/bin/python
# coding: utf8
from nltk.corpus import stopwords
import re
import string
cachedStopWords = stopwords.words("english")
def removeStopWordsFromString(string):
return ' '.join([word for word in string.split() if word.lower() not in cachedStopWords])
def removeLinksFromString(string):
return re.su... | mit | Python |
25f662a568db38c8cebac1f12444d76f72b1cebf | use multiple parsers | rsmoorthy/docker,rsmoorthy/docker,rsmoorthy/docker,rsmoorthy/docker | pythontools/web.py | pythontools/web.py | #!/usr/bin/python
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse, parse_qs
import subprocess
import os
import pql
import json
class S(BaseHTTPRequestHandler, object):
def __init__(self, *args, **kwargs):
self.parsers = {}
self.parsers['SchemaFreeParser'] = pql.... | #!/usr/bin/python
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse, parse_qs
import subprocess
import os
import pql
import json
class S(BaseHTTPRequestHandler, object):
def __init__(self, *args, **kwargs):
self.parser = pql.SchemaFreeParser()
super(S, self).__ini... | mit | Python |
da78958a4dbff76ec6fd2d34ff3a064048105742 | Switch to "Authorization" header | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | zeus/api/authentication.py | zeus/api/authentication.py | from flask import g, request
from sqlalchemy.orm import joinedload
from zeus import auth
from zeus.models import ApiToken, RepositoryApiToken, UserApiToken
class AuthenticationFailed(Exception):
pass
class ApiTokenAuthentication(object):
def authenticate(self):
header = request.headers.get('Authori... | from flask import g, request
from sqlalchemy.orm import joinedload
from zeus import auth
from zeus.models import ApiToken, RepositoryApiToken, UserApiToken
class AuthenticationFailed(Exception):
pass
class ApiTokenAuthentication(object):
def authenticate(self):
header = request.headers.get('Authent... | apache-2.0 | Python |
57a61538aecb9e102ee9e2e1365e80e3dbc8ed4f | Fix plural in modules app config | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | adhocracy4/modules/apps.py | adhocracy4/modules/apps.py | from django.apps import AppConfig
class ModulesConfig(AppConfig):
name = 'adhocracy4.modules'
label = 'a4modules'
| from django.apps import AppConfig
class ModuleConfig(AppConfig):
name = 'adhocracy4.modules'
label = 'a4modules'
| agpl-3.0 | Python |
1706fd54e50c6e4a67c84ceaa17708ca9346efe8 | Modify the version numbering guideline. | ohsu-qin/qipipe | qipipe/__init__.py | qipipe/__init__.py | """The top-level Quantitative Imaging Pipeline module."""
__version__ = '4.5.3'
"""
The one-based major.minor.patch version.
The version numbering scheme loosely follows http://semver.org/.
The major version is incremented when a significant feature
set is introduced. The minor version is incremented when there
is a f... | """The top-level Quantitative Imaging Pipeline module."""
__version__ = '4.5.3'
"""
The one-based major.minor.patch version.
The version numbering scheme loosely follows http://semver.org/.
The major version is incremented when there is an incompatible
public API change. The minor version is incremented when there
is ... | bsd-2-clause | Python |
6dd43f5fcd6af5582423af5a34a5fcf273026f1b | Change names of timing pvs | lnls-fac/sirius | sirius/TI_V00/record_names.py | sirius/TI_V00/record_names.py |
import sirius
def get_record_names(family_name = None):
"""Return a dictionary of record names for given subsystem
each entry is another dictionary of model families whose
values are the indices in the pyaccel model of the magnets
that belong to the family. The magnet models ca be segmented,
in wh... |
import sirius
def get_record_names(family_name = None):
"""Return a dictionary of record names for given subsystem
each entry is another dictionary of model families whose
values are the indices in the pyaccel model of the magnets
that belong to the family. The magnet models ca be segmented,
in wh... | mit | Python |
fd43d6afea23a202c2d979c3149df80146af7b7e | Use str.endswith() | CubicComet/exercism-python-solutions | bob/bob.py | bob/bob.py | def hey(s):
s = s.strip()
if s.isupper():
return "Whoa, chill out!"
elif s == "":
return "Fine. Be that way!"
elif s.endswith("?"):
return "Sure."
else:
return "Whatever."
| def hey(s):
s = s.strip()
if s.isupper():
return "Whoa, chill out!"
elif s == "":
return "Fine. Be that way!"
elif s[-1] == "?":
return "Sure."
else:
return "Whatever."
| agpl-3.0 | Python |
5c3d8f38ffd09abb330193c33b5fa58b828f3491 | Set erstellt_von and veraendert_von automatically on save in admin | n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb | adressverzeichnis/admin.py | adressverzeichnis/admin.py | # https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model
# speichere zuletzt angefasst von nutzer und wann
from django.contrib import admin
from .models import Person, Amt, GruppierungsTyp, Gruppierung, Adresse, Telefon
admin.site.register(Amt)
admin.site.register(Gruppie... | # https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model
# speichere zuletzt angefasst von nutzer und wann
from django.contrib import admin
from .models import Person, Amt, GruppierungsTyp, Gruppierung, Adresse, Telefon
admin.site.register(Amt)
admin.site.register(Gruppie... | mit | Python |
c2bea77a82ded6ebb56cc138670da0f360eeaf7f | Fix path fixture | dcos/dcos-launch,dcos/dcos-launch | advanced_tests/conftest.py | advanced_tests/conftest.py | import json
import os
import time
import pytest
import dcos_launch.config
import dcos_launch.util
from dcos_test_utils import logging
logging.setup_logging('DEBUG')
@pytest.fixture(scope='session')
def create_cluster():
if 'TEST_CREATE_CLUSTER' not in os.environ:
raise Exception('TEST_CREATE_CLUSTER mu... | import json
import os
import time
import pytest
import dcos_launch.config
import dcos_launch.util
from dcos_test_utils import logging
logging.setup_logging('DEBUG')
@pytest.fixture(scope='session')
def create_cluster():
if 'TEST_CREATE_CLUSTER' not in os.environ:
raise Exception('TEST_CREATE_CLUSTER mu... | apache-2.0 | Python |
e76d27186e33587f205a82d468aacc7be8d07e59 | Bump version | BT-aestebanez/l10n-switzerland | l10n_ch_import_winbiz/__openerp__.py | l10n_ch_import_winbiz/__openerp__.py | # -*- coding: utf-8 -*-
# Copyright 2016 Open Net Sàrl
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Accounting Import WinBIZ',
'version': '9.0.1.0.1',
'category': 'Localization',
'website': 'https://opennet.ch',
'author': 'Open Net Sàrl, Camptocamp, Odoo Community Asso... | # -*- coding: utf-8 -*-
# Copyright 2016 Open Net Sàrl
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Accounting Import WinBIZ',
'version': '9.0.1.0.0',
'category': 'Localization',
'website': 'https://opennet.ch',
'author': 'Open Net Sàrl, Camptocamp, Odoo Community Asso... | agpl-3.0 | Python |
5f5082dacf92b7665498e520298ee8853f5db1b7 | update fabric deploy script to use new .yaml ignored file | konklone/oversight.io,konklone/oversight.io,konklone/oversight.io,konklone/oversight.io | fabfile.py | fabfile.py | import time
from fabric.api import run, execute, env
environment = "production"
env.use_ssh_config = True
env.hosts = ["unitedstates"]
branch = "master"
repo = "git@github.com:konklone/oversight.git"
username = "unitedstates"
home = "/home/unitedstates/oversight"
logs = "/home/unitedstates/oversight"
shared_path = ... | import time
from fabric.api import run, execute, env
environment = "production"
env.use_ssh_config = True
env.hosts = ["unitedstates"]
branch = "master"
repo = "git@github.com:konklone/oversight.git"
username = "unitedstates"
home = "/home/unitedstates/oversight"
logs = "/home/unitedstates/oversight"
shared_path = ... | cc0-1.0 | Python |
219f5aa9a17bfe9856c4ac57b890f8db81436581 | Bump version: 0.1.2 → 0.1.3 | grappa-py/grappa | grappa/__init__.py | grappa/__init__.py | # -*- coding: utf-8 -*
"""
`grappa` provides two different testing styles: `should` and `expect`.
should
------
Example using ``should`` style::
from grappa import should
should('foo').be.equal.to('foo')
'foo' | should.be.equal.to('foo')
expect
------
Example using ``expect`` style::
from grappa ... | # -*- coding: utf-8 -*
"""
`grappa` provides two different testing styles: `should` and `expect`.
should
------
Example using ``should`` style::
from grappa import should
should('foo').be.equal.to('foo')
'foo' | should.be.equal.to('foo')
expect
------
Example using ``expect`` style::
from grappa ... | mit | Python |
a441346f5b2090d99ae6d59b2b5838f1413b7fce | Fix backward compatibility | watchdogpolska/django-tinycontent,dominicrodger/django-tinycontent,ad-m/django-tinycontent,ad-m/django-tinycontent,dominicrodger/django-tinycontent,watchdogpolska/django-tinycontent | tinycontent/templatetags/tinycontent_tags.py | tinycontent/templatetags/tinycontent_tags.py | from django import template
from django.template.loader import render_to_string
from tinycontent.models import TinyContent
register = template.Library()
class TinyContentNode(template.Node):
def __init__(self, args, nodelist):
self.args = args
self.nodelist = nodelist
def get_name(self, cont... | from django import template
from django.template.loader import render_to_string
from tinycontent.models import TinyContent
register = template.Library()
class TinyContentNode(template.Node):
def __init__(self, content_name, nodelist):
self.content_name = content_name
self.nodelist = nodelist
... | bsd-3-clause | Python |
ebe15bdf1866893c0920404e88824182700ceca0 | remove unnecessary overrides | malmiron/incubator-airflow,malmiron/incubator-airflow,wangtuanjie/airflow,sekikn/incubator-airflow,DEVELByte/incubator-airflow,danielvdende/incubator-airflow,apache/airflow,yk5/incubator-airflow,nathanielvarona/airflow,CloverHealth/airflow,Acehaidrey/incubator-airflow,Drooids/airflow,yati-sagade/incubator-airflow,d-lee... | airflow/hooks/jdbc_hook.py | airflow/hooks/jdbc_hook.py | __author__ = 'janomar'
import logging
import jaydebeapi
from airflow.hooks.dbapi_hook import DbApiHook
class JdbcHook(DbApiHook):
"""
General hook for jdbc db access.
If a connection id is specified, host, port, schema, username and password will be taken from the predefined connection.
Raises an ai... | __author__ = 'janomar'
import logging
import jaydebeapi
from airflow.hooks.dbapi_hook import DbApiHook
class JdbcHook(DbApiHook):
"""
General hook for jdbc db access.
If a connection id is specified, host, port, schema, username and password will be taken from the predefined connection.
Raises an ai... | apache-2.0 | Python |
1a44fa7186a2b3c050d6416cb8581c8b392718a6 | add get_comments functions | danielwillgeorge/google-app-engine-flask,danielwillgeorge/google-app-engine-flask,danielwillgeorge/google-app-engine-flask | sheepdog.py | sheepdog.py | def frozen(princess):
return princess
def get_upload_list(youtube, channelId):
"""Retrieve the contentDetails part of the channel resource for the
authenticated user's channel."""
channels_response = youtube.channels().list(
#id=AUTH_USER_CHANNEL_ID,
id=channelId,
part="contentDetails"
).exe... | def frozen(princess):
return princess
def get_upload_list(youtube, channelId):
"""Retrieve the contentDetails part of the channel resource for the
authenticated user's channel."""
channels_response = youtube.channels().list(
#id=AUTH_USER_CHANNEL_ID,
id=channelId,
part="contentDetails"
).exe... | mit | Python |
143edf7f0216cddfb1d16b7bb9905f79f48c58e3 | Test return values in flaskutil_test | mesonbuild/wrapweb,mesonbuild/wrapweb,mesonbuild/wrapweb | wrapweb/flaskutil_test.py | wrapweb/flaskutil_test.py | import unittest
from unittest import mock
import flask
from wrapweb import flaskutil
TEST_APP = flask.Flask(__name__)
def creator_proxy():
pass
@flaskutil.appcontext_var(TEST_APP)
def appvar():
return creator_proxy()
@appvar.teardown
def appvar_close(obj):
obj.close()
TEST_BP = flask.Blueprint('t... | import unittest
from unittest import mock
import flask
from wrapweb import flaskutil
TEST_APP = flask.Flask(__name__)
def creator_proxy():
pass
@flaskutil.appcontext_var(TEST_APP)
def appvar():
return creator_proxy()
@appvar.teardown
def appvar_close(obj):
obj.close()
TEST_BP = flask.Blueprint('t... | apache-2.0 | Python |
162bd41999a3416a34f0bc100023134f3419efce | Adjust `hosts` | skylines-project/skylines,skylines-project/skylines,skylines-project/skylines,skylines-project/skylines | fabfile.py | fabfile.py | from fabric.api import env, task, local, cd, lcd, run, sudo, put
from tempfile import NamedTemporaryFile
env.use_ssh_config = True
env.hosts = ["skylines@skylines.aero"]
APP_DIR = "/home/skylines"
SRC_DIR = "%s/src" % APP_DIR
@task
def deploy(branch="master", force=False):
push(branch, force)
restart()
@... | from fabric.api import env, task, local, cd, lcd, run, sudo, put
from tempfile import NamedTemporaryFile
env.use_ssh_config = True
env.hosts = ["skylines@skylines"]
APP_DIR = "/home/skylines"
SRC_DIR = "%s/src" % APP_DIR
@task
def deploy(branch="master", force=False):
push(branch, force)
restart()
@task
... | agpl-3.0 | Python |
9d263a878a8b4babee0a17103f51c7eb66e4a24e | use SSH config | clubadm/clubadm,clubadm/clubadm,clubadm/clubadm | fabfile.py | fabfile.py | from fabric.api import *
from fabric.contrib.project import rsync_project
env.user = 'root'
env.hosts = ['habra-adm.ru']
env.use_ssh_config = True
def pack():
local('python3 setup.py sdist --formats=gztar', capture=False)
def deploy():
dist = local('python3 setup.py --fullname', capture=True).strip()
... | from fabric.api import *
from fabric.contrib.project import rsync_project
env.user = 'root'
env.hosts = ['habra-adm.ru']
def pack():
local('python3 setup.py sdist --formats=gztar', capture=False)
def deploy():
dist = local('python3 setup.py --fullname', capture=True).strip()
put('dist/%s.tar.gz' % dis... | mit | Python |
ece381293f5c5d8704f8d8c754a8d647de01078c | Add redirect_url parameter. Refs #338 | sk7/django-social-auth,vuchau/django-social-auth,dongguangming/django-social-auth,czpython/django-social-auth,mayankcu/Django-social,WW-Digital/django-social-auth,beswarm/django-social-auth,lovehhf/django-social-auth,getsentry/django-social-auth,1st/django-social-auth,omab/django-social-auth,vxvinh1511/django-social-au... | social_auth/backends/utils.py | social_auth/backends/utils.py | from urllib2 import urlopen
from oauth2 import Consumer as OAuthConsumer, Token, Request as OAuthRequest, \
SignatureMethod_HMAC_SHA1
from django.utils import simplejson
from social_auth.models import User
def consumer_oauth_url_request(backend, url, user_or_id, redirect_uri='/',
... | from urllib2 import urlopen
from oauth2 import Consumer as OAuthConsumer, Token, Request as OAuthRequest, \
SignatureMethod_HMAC_SHA1
from django.utils import simplejson
from social_auth.models import User
def consumer_oauth_url_request(backend, url, user_or_id, json=True):
"""Builds and retr... | bsd-3-clause | Python |
cf8c623ff8fb77333101cc3819b68320e901d5aa | Create raw_prescribing table from CSVs in prescribing_v2 | annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc | openprescribing/pipeline/management/commands/create_bq_measure_views.py | openprescribing/pipeline/management/commands/create_bq_measure_views.py | import os
from django.conf import settings
from django.core.management.base import BaseCommand
from frontend.bq_schemas import RAW_PRESCRIBING_SCHEMA
from gcutils.bigquery import Client, build_schema
from google.cloud.exceptions import Conflict
class Command(BaseCommand):
help = "Creates or updates all BQ views... | import os
from django.conf import settings
from django.core.management.base import BaseCommand
from frontend.bq_schemas import RAW_PRESCRIBING_SCHEMA
from gcutils.bigquery import Client, build_schema
from google.cloud.exceptions import Conflict
class Command(BaseCommand):
help = "Creates or updates all BQ views... | mit | Python |
2eb8bec56ae1b91be5b2149310590dd4e2649056 | Add test for make_gaussian_image | larrybradley/photutils,astropy/photutils | photutils/datasets/tests/test_make.py | photutils/datasets/tests/test_make.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from numpy.testing import assert_allclose
from astropy.tests.helper import pytest
from astropy.table import Table
from .. import... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from numpy.testing import assert_allclose
from astropy.tests.helper import pytest
from astropy.table import Table
from .. import make_gaussian_imag... | bsd-3-clause | Python |
2911fa8af7cc35dca8071c56c5febbea247c4a7c | Bump version. | guaguadev/redash,chriszs/redash,EverlyWell/redash,getredash/redash,pubnative/redash,alexanderlz/redash,guaguadev/redash,pubnative/redash,easytaxibr/redash,guaguadev/redash,EverlyWell/redash,vishesh92/redash,ninneko/redash,stefanseifert/redash,chriszs/redash,useabode/redash,akariv/redash,jmvasquez/redashtest,getredash/r... | redash/__init__.py | redash/__init__.py | import logging
import urlparse
import redis
from statsd import StatsClient
from redash import settings
from redash.query_runner import import_query_runners
__version__ = '0.6.4'
def setup_logging():
handler = logging.StreamHandler()
formatter = logging.Formatter('[%(asctime)s][PID:%(process)d][%(levelname)s... | import logging
import urlparse
import redis
from statsd import StatsClient
from redash import settings
from redash.query_runner import import_query_runners
__version__ = '0.6.3'
def setup_logging():
handler = logging.StreamHandler()
formatter = logging.Formatter('[%(asctime)s][PID:%(process)d][%(levelname)s... | bsd-2-clause | Python |
76ae3b536247b4d32624655b6bbe351415fcb285 | fix serveral syntax errors in models | Chris7/django-referral,byteweaver/django-referral | referral/models.py | referral/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
class Campaign(models.Model):
name = models.CharField(_("Name"), max_length=255, unique=True)
description = models.TextField(_("Description"), blank=True, null=True)
class Meta:
ordering = ['name']
def __uni... | from django.db import models
from django.utils.translation import ugettext_lazy as _
class Campaign(models.Model):
name = models.CharField(_("Name"), max_length=255, unique=True
description models.TextField(_("Description"), blank=True, null=True)
class Meta:
ordering['name']
def __unicode__... | mit | Python |
ce73ca426945261ff6674a43f58c70e23c11e2e8 | Fix imports? | scikit-learn-contrib/forest-confidence-interval,arokem/sklearn-forest-ci,kpolimis/sklearn-forest-ci,uwescience/sklearn-forest-ci,scikit-learn-contrib/forest-confidence-interval,kpolimis/sklearn-forest-ci,arokem/sklearn-forest-ci,uwescience/sklearn-forest-ci | forestci/__init__.py | forestci/__init__.py | from .forestci import (calc_inbag, random_forest_error,
_core_computation, _bias_correction) # noqa
from .calibration import * # noqa
from .version import __version__ # noqa
__all__ = ("calc_inbag", "random_forest_error")
| from .forestci import (calc_inbag, random_forest_error,
_core_computation, _bias_correction)
from .version import __version__ # noqa
__all__ = ["calc_inbag", "random_forest_error"]
| mit | Python |
27cdf73938772eaf551fe0f68f2af1cd6418f099 | Bump version to 4.3.1 | luoliyan/incremental-reading-for-anki,luoliyan/incremental-reading-for-anki | ir/__init__.py | ir/__init__.py | from aqt import mw
from .main import ReadingManager
__version__ = '4.3.1'
mw.readingManager = ReadingManager()
| from aqt import mw
from .main import ReadingManager
__version__ = '4.3.0'
mw.readingManager = ReadingManager()
| isc | Python |
6da316d820a2ec4a1569dfda0794818e38276831 | Add textual feedback, cleanup main | kshvmdn/nowplaying | nowplaying.py | nowplaying.py | #!/usr/bin/env python3
import sys
from appscript import *
from termcolor import colored
def open_(itunes):
return itunes.activate()
def close(itunes):
return itunes.quit()
def is_playing(itunes):
return itunes.player_state.get() == k.playing
def now_playing(itunes):
if not is_playing(itunes):
... | #!/usr/bin/env python3
import sys
from appscript import *
from termcolor import colored
def open_(itunes):
return itunes.activate()
def close(itunes):
return itunes.quit()
def is_playing(itunes):
return itunes.player_state.get() == k.playing
def now_playing(itunes):
if not is_playing(itunes):
... | mit | Python |
8e07e000f4af8a2b457f218b66f9615972618c41 | Make sure we raise an exception if output projection is not understood | barentsen/reproject,barentsen/reproject,astrofrog/reproject,barentsen/reproject,astrofrog/reproject,astrofrog/reproject | reproject/utils.py | reproject/utils.py | import numpy as np
from astropy.io import fits
from astropy.io.fits import PrimaryHDU, ImageHDU, CompImageHDU, Header, HDUList
from astropy.wcs import WCS
from astropy.extern import six
def parse_input_data(input_data, hdu_in=None):
"""
Parse input data to return a Numpy array and WCS object.
"""
if... | import numpy as np
from astropy.io import fits
from astropy.io.fits import PrimaryHDU, ImageHDU, CompImageHDU, Header, HDUList
from astropy.wcs import WCS
from astropy.extern import six
def parse_input_data(input_data, hdu_in=None):
"""
Parse input data to return a Numpy array and WCS object.
"""
if... | bsd-3-clause | Python |
4e8e7b59125b2ba4ffd1efce5c329d61d6fd18a8 | Update mitelegram.py | HackLab-Almeria/clubpythonalm-taller-bots-telegram | 04-MiTelegram/mitelegram.py | 04-MiTelegram/mitelegram.py | #!/usr/bin/env python3
# -*- coding: utf-8-*-
"""
Fichero para importar todos los datos de bot necesarios
Libreria: pyTelegramBotAPI 1.4.2 [ok]
Libreria: pyTelegramBotAPI 2.0 [ok]
Python: 3.5.1
"""
import telebot
import sys
TOKEN = 'AQUÍ EL NUMERO DE VUESTRO TOKEN entre comillas'
telegram = telebot.TeleBot(TOKEN... | #!/usr/bin/env python3
# -*- coding: utf-8-*-
import telebot
import sys
TOKEN = 'AQUÍ EL NUMERO DE VUESTRO TOKEN entre comillas'
telegram = telebot.TeleBot(TOKEN) # Combinamos la declaración del Token con la función de la API
chatID=0000 # Cuando ya tengáis vuestro chatID. Siempre AQUÏ
nombre_bot="Club_Python_Almer... | mit | Python |
6edbfb1cd88ab2b0cb4c96bf7235b495390a105b | Fix analyze github action. (#520) | google/osv.dev,google/osv.dev,google/osv.dev,google/osv.dev,google/osv.dev | actions/analyze/analyze.py | actions/analyze/analyze.py | #!/usr/bin/env python3
# Copyright 2021 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 2021 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 |
b097975316c5eb05a8f4329a7f42c8842209dda7 | Bump to version 0.3.0 | kizkoh/wsgi_status,kizkoh/wsgi_status | wsgi_status/__init__.py | wsgi_status/__init__.py | # -*- coding: utf-8 -*-
version_info = (0, 3, 0)
__version__ = ".".join([str(v) for v in version_info])
| # -*- coding: utf-8 -*-
version_info = (0, 2, 5)
__version__ = ".".join([str(v) for v in version_info])
| mit | Python |
2a59c5d51d27a97a7e394e80a3720893a0e33308 | Add picture message type (for image wall posts) | yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend | yunity/models/entities.py | yunity/models/entities.py | from django.db.models import TextField, ForeignKey, FloatField, DateTimeField, ManyToManyField
from yunity.models.utils import BaseModel, MaxLengthCharField
from yunity.utils.decorators import classproperty
class Versionable(BaseModel):
pass
class Metadata(BaseModel):
key = MaxLengthCharField()
value = ... | from django.db.models import TextField, ForeignKey, FloatField, DateTimeField, ManyToManyField
from yunity.models.utils import BaseModel, MaxLengthCharField
from yunity.utils.decorators import classproperty
class Versionable(BaseModel):
pass
class Metadata(BaseModel):
key = MaxLengthCharField()
value = ... | agpl-3.0 | Python |
abdaa2fba16aec83a3e74394f07aa930ed0fd523 | Remove legacy struct dependency | tum-pbs/PhiFlow,tum-pbs/PhiFlow | tests/commit/physics/test_legacy.py | tests/commit/physics/test_legacy.py | from unittest import TestCase
from phi import math
from phi.geom import Sphere, Box
from phi.math import batch, channel
from phi.physics._boundaries import Domain, Obstacle
class TestLegacyPhysics(TestCase):
def test_domain(self):
dom = Domain(x=16, y=16)
dom.scalar_grid(0)
| from unittest import TestCase
from phi import struct, math
from phi.geom import Sphere, Box
from phi.math import batch, channel
from phi.physics._boundaries import Domain, Obstacle
class TestLegacyPhysics(TestCase):
def test_domain(self):
dom = Domain(x=16, y=16)
dom.scalar_grid(0)
| mit | Python |
3bde9f5e220ec9f39680ea1450aefaff74daee63 | Convert Context to dict. | alexsilva/django-xadmin,alexsilva/django-xadmin,alexsilva/django-xadmin,alexsilva/django-xadmin | xadmin/plugins/utils.py | xadmin/plugins/utils.py | from django.template.context import RequestContext, Context
def get_context_dict(context):
"""
Contexts in django version 1.9+ must be dictionaries. As xadmin has a legacy with older versions of django,
the function helps the transition by converting the [RequestContext, Context] object to the dictionary... | from django.template.context import RequestContext
def get_context_dict(context):
"""
Contexts in django version 1.9+ must be dictionaries. As xadmin has a legacy with older versions of django,
the function helps the transition by converting the [RequestContext] object to the dictionary when necessary.
... | bsd-3-clause | Python |
e3363fd40cbf0356883ad8853e12610a8dcfce1e | remove catch-all exception | eman/iotrelay-influxdb | iotrelay_influxdb.py | iotrelay_influxdb.py | '''
Copyright (c) 2016, Emmanuel Levijarvi
All rights reserved.
License BSD
'''
import logging
import calendar
from collections import defaultdict
from influxdb import client as influxdb
logger = logging.getLogger(__name__)
__version__ = "1.0.3"
DEFAULT_BATCH_SIZE = 30
INFLUXDB_PORT = 8086
class Handler(object):
... | '''
Copyright (c) 2016, Emmanuel Levijarvi
All rights reserved.
License BSD
'''
import logging
import calendar
from collections import defaultdict
from influxdb import client as influxdb
logger = logging.getLogger(__name__)
__version__ = "1.0.3"
DEFAULT_BATCH_SIZE = 30
INFLUXDB_PORT = 8086
class Handler(object):
... | bsd-2-clause | Python |
d6c59f9f76b41945fb363f94d65956fbf1a18dac | Add dummy test for flake8 | hvy/chainer,niboshi/chainer,chainer/chainer,ktnyt/chainer,wkentaro/chainer,tkerola/chainer,wkentaro/chainer,pfnet/chainer,niboshi/chainer,jnishi/chainer,hvy/chainer,okuta/chainer,keisuke-umezawa/chainer,chainer/chainer,ktnyt/chainer,okuta/chainer,wkentaro/chainer,keisuke-umezawa/chainer,jnishi/chainer,niboshi/chainer,c... | tests/python_tests/test_routines.py | tests/python_tests/test_routines.py | # TODO(niboshi): Currently this file is just a placeholder for future migration of routine tests from test_array.py.
# In order to do that, we need to somehow share check logics/test parameters with test_array.py.
def test_dummy():
pass
| # TODO(niboshi): Currently this file is just a placeholder for future migration of routine tests from test_array.py.
# In order to do that, we need to somehow share check logics/test parameters with test_array.py.
| mit | Python |
225751e0c2ee6bf49c86c75e1974df5cc7f1c050 | Add min_err_version to go along with update import statements. | krismolendyke/err-diehardbot | dieHardBot.py | dieHardBot.py | #!/usr/bin/env python
"""A bot which will respond to various Die Hard character name commands and
mentions and respond with a random line spoken by that character in the film.
"""
from errbot.botplugin import BotPlugin
from errbot import botcmd
from dieHard import DieHard
def generate(character):
f = lambda ... | #!/usr/bin/env python
"""A bot which will respond to various Die Hard character name commands and
mentions and respond with a random line spoken by that character in the film.
"""
from errbot.botplugin import BotPlugin
from errbot import botcmd
from dieHard import DieHard
def generate(character):
f = lambda ... | mit | Python |
d9c8f230197a6751314b90dddf4879dd16c7bc93 | Fix mail suffix | MarauderXtreme/sipa,agdsn/sipa,agdsn/sipa,MarauderXtreme/sipa,agdsn/sipa,MarauderXtreme/sipa,agdsn/sipa | sipa/model/hss/__init__.py | sipa/model/hss/__init__.py | # -*- coding: utf-8 -*-
import logging
from ipaddress import IPv4Network
from sipa.backends import DataSource, Dormitory
from sipa.backends.exceptions import InvalidConfiguration
from . import user
logger = logging.getLogger(__name__)
def init_context(app):
try:
app.config['SQLALCHEMY_BINDS'].update({
... | # -*- coding: utf-8 -*-
import logging
from ipaddress import IPv4Network
from sipa.backends import DataSource, Dormitory
from sipa.backends.exceptions import InvalidConfiguration
from . import user
logger = logging.getLogger(__name__)
def init_context(app):
try:
app.config['SQLALCHEMY_BINDS'].update({
... | mit | Python |
7851fdae372cd13b7b8932b1fc6484df79536c60 | update get_user template | samsu/api_client | api_client/common/utils.py | api_client/common/utils.py | # Copyright 2015 Fortinet, Inc.
#
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | # Copyright 2015 Fortinet, Inc.
#
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 | Python |
c8f04c5a278c0dfde8bd4dfe8b6f80790d3b9f65 | Fix highprios being defined as dict | atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot | src/autobot/src/obstruction.py | src/autobot/src/obstruction.py | #!/usr/bin/env python
class ObstructionInfo(object):
def __init__(self):
self.distance = 999
self.position = 0
self.className = ""
class ObstructionMap(object):
""" TODO: Write down class information
Store objects into a dict?
Or a numpy type of array? Numpy can get things b... | #!/usr/bin/env python
class ObstructionInfo(object):
def __init__(self):
self.distance = 999
self.position = 0
self.className = ""
class ObstructionMap(object):
""" TODO: Write down class information
Store objects into a dict?
Or a numpy type of array? Numpy can get things b... | mit | Python |
e4f09573d7d255e884bf01ca20002601a4cbded5 | make search to function. | PyLadiesSeoul/LampGenie | lamp_genie.py | lamp_genie.py | #-*- coding: utf-8 -*-
import requests
import bs4 as BeautifulSoup
import sys
mobile_site_url = "http://www.aladin.co.kr"
search_url = "http://off.aladin.co.kr/usedstore/wsearchresult.aspx?SearchWord=%s&x=0&y=0"
def get_shoplist():
response = requests.get(mobile_site_url + '/m/off/gate.aspx?')
content = resp... | #-*- coding: utf-8 -*-
import requests
import bs4 as BeautifulSoup
import sys
mobile_site_url = "http://www.aladin.co.kr"
search_url = "http://off.aladin.co.kr/usedstore/wsearchresult.aspx?SearchWord=%s&x=0&y=0"
def get_shoplist():
response = requests.get(mobile_site_url + '/m/off/gate.aspx?')
content = resp... | mit | Python |
72591d6bd49f1f0f31cbf7b0f4b83e81bfc50c1e | Tweak regular expression for URLs. | sushi-irc/tekka | helper/url.py | helper/url.py | # coding: UTF-8
"""
Copyright (c) 2008 Marian Tietz
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
notice, this list of conditions a... | # coding: UTF-8
"""
Copyright (c) 2008 Marian Tietz
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
notice, this list of conditions a... | bsd-2-clause | Python |
d1417a338a17cc795b10742360d497b82c807a9e | Remove semicolon | JKO/nsearch,JKO/nsearch | helpernmap.py | helpernmap.py | import nmap
class HelperNmap:
def __init__(self,args=""):
self.args = args
def process(self):
print "Running Scan"
nm = nmap.PortScanner()
nm.scan(hosts='173.255.243.189', arguments='-sV -p1-5000')
for host in nm.all_hosts():
print('----------------------------------------------------')... | import nmap
class HelperNmap:
def __init__(self,args=""):
self.args = args
def process(self):
print "Running Scan"
nm = nmap.PortScanner()
nm.scan(hosts='173.255.243.189', arguments='-sV -p1-5000')
for host in nm.all_hosts():
print('----------------------------------------------------')... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.