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 |
|---|---|---|---|---|---|---|---|---|
7fcfe4ece5d7b792b2f38b9b0115f590d3fe0e60 | Fix glu.py for windows | tuttleofx/sconsProject | autoconf/glu.py | autoconf/glu.py | from _external import *
from gl import *
if windows:
glu = LibWithHeaderChecker('GLU32', ['windows.h','GL/glu.h'], 'c', dependencies=[gl])
elif macos:
glu = LibWithHeaderChecker('OpenGL', ['OpenGL/glu.h'], 'c', name='glu')
else :
glu = LibWithHeaderChecker('GLU', ['GL/glu.h'], 'c', dependencies=[gl])
| from _external import *
from gl import *
if windows:
glu = LibWithHeaderChecker('GLU32', ['windows.h','GL/glu.h'], 'c', dependencies=[gl])
if macos:
glu = LibWithHeaderChecker('OpenGL', ['OpenGL/glu.h'], 'c', name='glu')
else :
glu = LibWithHeaderChecker('GLU', ['GL/glu.h'], 'c', dependencies=[gl])
| mit | Python |
2e3d31dd20936574d238fc61c1d43983d8b9ff1c | Add out_path input. | ohsu-qin/qipipe | qipipe/interfaces/fix_dicom.py | qipipe/interfaces/fix_dicom.py | from nipype.interfaces.base import (BaseInterface,
BaseInterfaceInputSpec, traits, Directory, TraitedSpec)
import os
from qipipe.staging.fix_dicom import fix_dicom_headers
class FixDicomInputSpec(BaseInterfaceInputSpec):
source = Directory(exists=True, desc='The input patient directory', mandatory=True)
de... | from nipype.interfaces.base import (BaseInterface,
BaseInterfaceInputSpec, traits, Directory, TraitedSpec)
import os
from qipipe.staging.fix_dicom import fix_dicom_headers
class FixDicomInputSpec(BaseInterfaceInputSpec):
source = Directory(exists=True, desc='The input patient directory', mandatory=True)
de... | bsd-2-clause | Python |
9d3d541faaf993665040d39a5cacb52d7a096cde | Add in a model concept for settings | jalama/drupdates | drupdates/utils.py | drupdates/utils.py | import datetime
import requests
import os
from os.path import expanduser
import yaml
def nextFriday():
# Get the data string for the following Friday
today = datetime.date.today()
if datetime.datetime.today().weekday() == 4:
friday = str(today + datetime.timedelta( (3-today.weekday())%7+1 ))
else:
frid... | import datetime
import requests
import os
from os.path import expanduser
import yaml
def nextFriday():
# Get the data string for the following Friday
today = datetime.date.today()
if datetime.datetime.today().weekday() == 4:
friday = str(today + datetime.timedelta( (3-today.weekday())%7+1 ))
else:
frid... | mit | Python |
3972594787f4ed33d656ff0c097fdb3633a96b14 | add testcase for #1 | Thor77/TeamspeakStats,Thor77/TeamspeakStats | tsstats/tests/test_log.py | tsstats/tests/test_log.py | from time import sleep
import pytest
from tsstats.exceptions import InvalidLog
from tsstats.log import parse_log, parse_logs
@pytest.fixture
def clients():
return parse_log('tsstats/tests/res/test.log')
def test_log_client_count(clients):
assert len(clients) == 3
def test_log_onlinetime(clients):
as... | import pytest
from tsstats.exceptions import InvalidLog
from tsstats.log import parse_log, parse_logs
@pytest.fixture
def clients():
return parse_log('tsstats/tests/res/test.log')
def test_log_client_count(clients):
assert len(clients) == 3
def test_log_onlinetime(clients):
assert clients['1'].online... | mit | Python |
07f86c47c58d6266bd4b42c81521001aca072ff1 | Add some more rubbish to example string | bwhmather/json-config-parser | jsonconfigparser/test/__init__.py | jsonconfigparser/test/__init__.py | import unittest
from jsonconfigparser import JSONConfigParser
class JSONConfigTestCase(unittest.TestCase):
def test_init(self):
JSONConfigParser()
def test_read_string(self):
string = '[section]\n' + \
'# comment comment\n' + \
'foo = "bar"\n' + \
... | import unittest
from jsonconfigparser import JSONConfigParser
class JSONConfigTestCase(unittest.TestCase):
def test_init(self):
JSONConfigParser()
def test_read_string(self):
string = '[section]\n' + \
'foo = "bar"\n'
cf = JSONConfigParser()
cf.read_string(s... | bsd-3-clause | Python |
60039cd74693982ef38808a63366aa1454b50bd1 | Bump version to 13.3.2 | hhursev/recipe-scraper | recipe_scrapers/__version__.py | recipe_scrapers/__version__.py | __version__ = "13.3.2"
| __version__ = "13.3.1"
| mit | Python |
87a720dc526efe9732fd1b4633e773ef4a11352a | Use earliest consultation if legal date is unavailable | meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent | mainapp/management/commands/fix-sort-date.py | mainapp/management/commands/fix-sort-date.py | import datetime
from dateutil import tz
from django.core.management.base import BaseCommand
from django.db.models import F, Subquery, OuterRef, Q
from mainapp.models import Paper, File, Consultation
class Command(BaseCommand):
help = "After the initial import, this command guesses the sort_date-Attribute of pap... | import datetime
from django.core.management.base import BaseCommand
from django.db.models import F
from mainapp.models import Paper, File
class Command(BaseCommand):
help = "After the initial import, this command guesses the sort_date-Attribute of papers and files"
def add_arguments(self, parser):
... | mit | Python |
5320f9bd74aeab70849cf288d5da4a94bd98cccd | store labels in a separate text field | osma/annif,osma/annif,osma/annif | load_corpus.py | load_corpus.py | #!/usr/bin/env python
from elasticsearch import Elasticsearch
from elasticsearch.client import IndicesClient
import os
es = Elasticsearch()
index = IndicesClient(es)
if index.exists('yso'):
index.delete('yso')
indexconf = {
'mappings': {
'concept': {
'properties': {
'labe... | #!/usr/bin/env python
from elasticsearch import Elasticsearch
from elasticsearch.client import IndicesClient
import os
es = Elasticsearch()
index = IndicesClient(es)
if index.exists('yso'):
index.delete('yso')
indexconf = {
'mappings': {
'concept': {
'properties': {
'text... | cc0-1.0 | Python |
4a719e275c3639b2a2186711d9d616ce9435d614 | Update agent for environment | danieloconell/Louis | reinforcement-learning/play.py | reinforcement-learning/play.py | """This is the agent which currently takes the action with highest immediate reward."""
import env
env.make("text")
for episode in range(10):
env.reset()
episode_reward = 0
for t in range(100):
episode_reward += env.actual_reward
if env.done:
print(
"Episode %d ... | """This is the agent which currently takes the action with highest immediate reward."""
import pandas as pd
import numpy as np
import env
actions = ["left", "right", "stay"]
left = {x: [0]*(env.screen_width - 1) for x in range(2)}
right = {x: [0]*(env.screen_width - 1) for x in range(2)}
table = pd.DataFrame(left)
... | mit | Python |
2a2ab3f758facfafe3604325ecec08cfcfa2b6e9 | Update tests.py | CSE360G3/assginment5 | image_space_app/tests.py | image_space_app/tests.py | import datetime
import unittest
from django.utils import timezone
from django.test import TestCase
class ImageSpaceTests(unittest.TestCase):
def setUp(self):
self.url="http://localhost:8000"
self.email="John@doe.com"
self.password="password"
def tearDown(self):
del self.ur... | import datetime
import unittest
from django.utils import timezone
from django.test import TestCase
class ImageSpaceTests(unittest.TestCase):
def setUp(self):
self.url="http://localhost:8000"
self.email="John@doe.com"
self.password="password"
def tearDown(self):
del self.ur... | bsd-3-clause | Python |
7fb829cf17b8274ca67f98356e2d47abedc2df5b | Add type information to component registry | amolenaar/gaphor,amolenaar/gaphor | gaphor/services/componentregistry.py | gaphor/services/componentregistry.py | """
A registry for components (e.g. services) and event handling.
"""
from typing import Iterator, Set, Tuple, Type, TypeVar
from gaphor.abc import Service
from gaphor.application import ComponentLookupError
T = TypeVar("T", bound=Service)
class ComponentRegistry(Service):
"""
The ComponentRegistry provide... | """
A registry for components (e.g. services) and event handling.
"""
from typing import Set, Tuple
from gaphor.abc import Service
from gaphor.application import ComponentLookupError
class ComponentRegistry(Service):
"""
The ComponentRegistry provides a home for application wide components.
"""
def ... | lgpl-2.1 | Python |
907165cf323d2492ee2fc2f837a0aff2fec8ef77 | Update utils.py | tsurubee/banpei | banpei/utils.py | banpei/utils.py | import numpy as np
def power_method(A, iter_num=1):
"""
Calculate the first singular vector/value of a target matrix based on the power method.
Parameters
----------
A : numpy array
Target matrix
iter_num : int
Number of iterations
Returns
-------
u : numpy ... | import numpy as np
def power_method(A, iter_num=1):
"""
Calculate the first singular vector/value of a target matrix based on the power method.
Parameters
----------
A : numpy array
Target matrix
iter_num : int
Number of iterations
Returns
-------
u : numpy ... | mit | Python |
c793401befa1efed0b5ad1eb77809c23f6855372 | Fix ES thread mapping. | EthanBlackburn/sync-engine,EthanBlackburn/sync-engine,gale320/sync-engine,EthanBlackburn/sync-engine,wakermahmud/sync-engine,EthanBlackburn/sync-engine,wakermahmud/sync-engine,gale320/sync-engine,Eagles2F/sync-engine,closeio/nylas,ErinCall/sync-engine,gale320/sync-engine,ErinCall/sync-engine,gale320/sync-engine,wakerma... | inbox/search/mappings.py | inbox/search/mappings.py | # TODO[k]: participants as nested, tags too.
# first/last_message_timestamp as {'type': 'date', 'format': 'dateOptionalTime'}
# for range filters and such?
THREAD_MAPPING = {
'properties': {
'namespace_id': {'type': 'string'},
'tags': {'type': 'string'},
'last_message_timestamp': {'type': 's... | # TODO[k]: participants as nested, tags too.
THREAD_MAPPING = {
'properties': {
'namespace_id': {'type': 'string'},
'tags': {'type': 'string'},
'last_message_timestamp': {'type': 'date', 'format': 'dateOptionalTime'},
'object': {'type': 'string'},
'message_ids': {'type': 'str... | agpl-3.0 | Python |
e0dac0a621cbeed615553e5c3544f9c49de96eb2 | Subtract 1 from model end_year | csdms/wmt-metadata | metadata/FrostNumberModel/hooks/pre-stage.py | metadata/FrostNumberModel/hooks/pre-stage.py | """A hook for modifying parameter values read from the WMT client."""
import os
import shutil
from wmt.utils.hook import find_simulation_input_file, yaml_dump
from topoflow_utils.hook import assign_parameters
file_list = []
def execute(env):
"""Perform pre-stage tasks for running a component.
Parameters
... | """A hook for modifying parameter values read from the WMT client."""
import os
import shutil
from wmt.utils.hook import find_simulation_input_file
from topoflow_utils.hook import assign_parameters
file_list = []
def execute(env):
"""Perform pre-stage tasks for running a component.
Parameters
-------... | mit | Python |
be7ee0ba4cdfab1ef03b0d58913cddb00c572c0f | Revise descriptive comments | bowen0701/algorithms_data_structures | lc0131_palindrome_partitioning.py | lc0131_palindrome_partitioning.py | """Leetcode 131. Palindrome Partitioning
Medium
URL: https://leetcode.com/problems/palindrome-partitioning/
Given a string s, partition s such that
every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
Example:
Input: "aab"
Output:
[
["aa","b"],
["a","a","b"]
]
"""... | """Leetcode 131. Palindrome Partitioning
Medium
URL: https://leetcode.com/problems/palindrome-partitioning/
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
Example:
Input: "aab"
Output:
[
["aa","b"],
["a","a","b"]
]
"""
... | bsd-2-clause | Python |
9d29061f8520506d798ad75aa296be8dc838aaf7 | Remove leftover print call in paginator | genialis/resolwe,jberci/resolwe,genialis/resolwe,jberci/resolwe | resolwe/elastic/pagination.py | resolwe/elastic/pagination.py | """.. Ignore pydocstyle D400.
==================
Elastic Paginators
==================
Paginator classes used in Elastic app.
.. autoclass:: resolwe.elastic.pagination.LimitOffsetPostPagination
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from rest_framework.pagination im... | """.. Ignore pydocstyle D400.
==================
Elastic Paginators
==================
Paginator classes used in Elastic app.
.. autoclass:: resolwe.elastic.pagination.LimitOffsetPostPagination
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from rest_framework.pagination im... | apache-2.0 | Python |
ee1effb3a91bca7fcf1c590955f45e5b631a0598 | Revise documentation | hankcs/HanLP,hankcs/HanLP | hanlp/pretrained/ner.py | hanlp/pretrained/ner.py | # -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-12-30 20:07
from hanlp_common.constant import HANLP_URL
MSRA_NER_BERT_BASE_ZH = HANLP_URL + 'ner/ner_bert_base_msra_20200104_185735.zip'
'BERT model (:cite:`devlin-etal-2019-bert`) trained on MSRA with 3 entity types.'
MSRA_NER_ALBERT_BASE_ZH = HANLP_URL + 'ner/ner_... | # -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-12-30 20:07
from hanlp_common.constant import HANLP_URL
MSRA_NER_BERT_BASE_ZH = HANLP_URL + 'ner/ner_bert_base_msra_20200104_185735.zip'
'BERT model (:cite:`devlin-etal-2019-bert`) trained on MSRA with 3 entity types.'
MSRA_NER_ALBERT_BASE_ZH = HANLP_URL + 'ner/ner_... | apache-2.0 | Python |
a5d3c78295d951fd29f00fc8d8480c2a518fd615 | set srid explicit | geometalab/drf-utm-zone-info,geometalab/drf-utm-zone-info | utm_zone_info/viewsets.py | utm_zone_info/viewsets.py | from rest_framework import status, viewsets
from rest_framework.response import Response
from utm_zone_info.coordinate_reference_system import utm_zones_for_representing
from utm_zone_info.serializers import GeometrySerializer
class UTMZoneInfoViewSet(viewsets.ViewSet):
"""
A simple ViewSet for posting Point... | from rest_framework import status, viewsets
from rest_framework.response import Response
from utm_zone_info.coordinate_reference_system import utm_zones_for_representing
from utm_zone_info.serializers import GeometrySerializer
class UTMZoneInfoViewSet(viewsets.ViewSet):
"""
A simple ViewSet for posting Point... | isc | Python |
b62423f6ccb47a6f4074ec8e95d9861a3bb06874 | Change error message | ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata | ckanext/requestdata/logic/validators.py | ckanext/requestdata/logic/validators.py | from email_validator import validate_email
from ckan.plugins.toolkit import _
from ckan.plugins.toolkit import get_action
def email_validator(key, data, errors, context):
email = data[key]
try:
validate_email(email)
except Exception:
message = _('Please provide a valid email address.')
... | from email_validator import validate_email
from ckan.plugins.toolkit import _
from ckan.plugins.toolkit import get_action
def email_validator(key, data, errors, context):
email = data[key]
try:
validate_email(email)
except Exception:
message = _('Please provide a valid email address.')
... | agpl-3.0 | Python |
cd1e6ddbf8038c7f65357ec42eaa31b9ddf3f1d6 | add statistics module | lmdu/krait,lmdu/krait,lmdu/krait,lmdu/krait | statistics.py | statistics.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from PySide.QtSql import *
from db import *
class Statistics:
meta_table = MetaTable()
class SequenceStatistics(Statistics):
def __init__(self, unit='Mb', letter='ATCG'):
self.table = FastaTable()
self.unit = unit
self.letter = letter
self._bases = {'A':0,'G':0... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from PySide.QtSql import *
from db import *
class Statistics:
meta_table = MetaTable()
class SequenceStatistics(Statistics):
def __init__(self):
self.table = FastaTable()
self._bases = {'A':0,'G':0,'C':0,'T':0}
self._total_sequences = 0
self._total_bases = 0
... | agpl-3.0 | Python |
09e8dd8ed521105aedeb9d35234998d7fa82bb4d | Format max line length to 79. | freshbooks/sqlcop | sqlcop/cli.py | sqlcop/cli.py | from __future__ import print_function
import sys
import sqlparse
import optparse
from sqlcop.checks.cross_join import CrossJoinCheck
from sqlcop.checks.order_by_count import OrderByCountCheck
def parse_file(filename):
try:
return open(filename, 'r').readlines()
except UnicodeDecodeError:
# It'... | from __future__ import print_function
import sys
import sqlparse
import optparse
from sqlcop.checks.cross_join import CrossJoinCheck
from sqlcop.checks.order_by_count import OrderByCountCheck
def parse_file(filename):
try:
return open(filename, 'r').readlines()
except UnicodeDecodeError:
# It'... | bsd-3-clause | Python |
51257ca1ebb61d48b8c8dd5b1562fdc73e4ecc99 | Load .solv file from testdata | openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings | bindings/python/tests/relation.py | bindings/python/tests/relation.py | #
# test Relation
#
# Relations are the primary means to specify dependencies.
# Relations combine names and version through an operator.
# Relations can be compared (<=> operator) or matched (=~ operator)
#
# The following operators are defined:
# REL_GT: greater than
# REL_EQ: equals
# REL_GE: greater equal
# ... | #
# test Relation
#
# Relations are the primary means to specify dependencies.
# Relations combine names and version through an operator.
# Relations can be compared (<=> operator) or matched (=~ operator)
#
# The following operators are defined:
# REL_GT: greater than
# REL_EQ: equals
# REL_GE: greater equal
# ... | bsd-3-clause | Python |
e64d922a7e7c64921c90d81c44014f7287ba83fa | disable logging in travis | dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | .travis/localsettings.py | .travis/localsettings.py | import os
####### Configuration for CommCareHQ Running on Travis-CI #####
from docker.dockersettings import *
USE_PARTITIONED_DATABASE = os.environ.get('USE_PARTITIONED_DATABASE', 'no') == 'yes'
PARTITION_DATABASE_CONFIG = get_partitioned_database_config(USE_PARTITIONED_DATABASE)
BASE_ADDRESS = '{}:8000'.format(os.... | import os
####### Configuration for CommCareHQ Running on Travis-CI #####
from docker.dockersettings import *
USE_PARTITIONED_DATABASE = os.environ.get('USE_PARTITIONED_DATABASE', 'no') == 'yes'
PARTITION_DATABASE_CONFIG = get_partitioned_database_config(USE_PARTITIONED_DATABASE)
BASE_ADDRESS = '{}:8000'.format(os.... | bsd-3-clause | Python |
6f69a770ef3b55a7d846abfc306e41025131d8a6 | Fix FeedEntry custom model admin | jpadilla/feedleap,jpadilla/feedleap | apps/feeds/admin.py | apps/feeds/admin.py | from django.contrib import admin
from .models import Feed, FeedEntry
class FeedAdmin(admin.ModelAdmin):
list_display = ('feed_url', 'created_by')
class FeedEntryAdmin(admin.ModelAdmin):
list_display = ('title', 'link', 'feed',
'feed_created_by', 'added_to_kippt')
def feed_created_b... | from django.contrib import admin
from .models import Feed, FeedEntry
class FeedEntryAdmin(admin.ModelAdmin):
list_display = ('title', 'link', 'feed',
'feed__created_by', 'added_to_kippt')
admin.site.register(Feed)
admin.site.register(FeedEntry, FeedEntryAdmin)
| mit | Python |
034070458b18805d7282f2bb7f0880f688bf3e6e | Remove all subdir functionality | anjos/website,anjos/website | stuff/urls.py | stuff/urls.py | import settings
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/(.*)', admin.site.root),
(r'^publication/', include('stuff.publications.urls')),
(r'^file/', include('stuff.files.urls')),
(r'^photo/', include('stuff.pica... | import settings
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
subdir = ''
urlpatterns = patterns('',
(r'^%sadmin/(.*)' % subdir, admin.site.root),
(r'^%spublication/' % subdir, include('stuff.publications.urls')),
(r'^%sfile/' % subdir, include('stuff.files.... | bsd-2-clause | Python |
be800d70ef3085035bc8330037f0881203e978cc | fix SSL vdsClient connections | oVirt/ovirt-hosted-engine-ha,oVirt/ovirt-hosted-engine-ha,oVirt/ovirt-hosted-engine-ha,oVirt/ovirt-hosted-engine-ha | ovirt_hosted_engine_ha/broker/submonitor_util.py | ovirt_hosted_engine_ha/broker/submonitor_util.py | #
# ovirt-hosted-engine-ha -- ovirt hosted engine high availability
# Copyright (C) 2013 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the Licens... | #
# ovirt-hosted-engine-ha -- ovirt hosted engine high availability
# Copyright (C) 2013 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the Licens... | lgpl-2.1 | Python |
bf460618bc0b2e535de46a0dc0ddb08b8680ab6c | Stop to use the __future__ module. | openstack/octavia,openstack/octavia,openstack/octavia | octavia/db/migration/alembic_migrations/env.py | octavia/db/migration/alembic_migrations/env.py | # Copyright 2014 Rackspace
#
# 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 agree... | # Copyright 2014 Rackspace
#
# 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 agree... | apache-2.0 | Python |
25866e86338ac2cf0f042dded6a343a00b5f7241 | Bump version to 0.5.0-alpha.4. | fls-bioinformatics-core/RnaChipIntegrator | rnachipintegrator/__init__.py | rnachipintegrator/__init__.py | # Current version of the library
__version__ = '0.5.0-alpha.4'
def get_version():
"""Returns a string with the current version of the library (e.g., "0.2.0")
"""
return __version__
| # Current version of the library
__version__ = '0.5.0-alpha.3'
def get_version():
"""Returns a string with the current version of the library (e.g., "0.2.0")
"""
return __version__
| artistic-2.0 | Python |
1193980f77d715e1ca2b22bcb8a4b74eaed1122c | Add missing import | lino-framework/book,lsaffre/lino_book,lsaffre/lino_book,lsaffre/lino_book,lino-framework/book,lino-framework/book,lino-framework/book | lino_book/projects/polls/test.py | lino_book/projects/polls/test.py | from lino.utils.test import DocTest
from lino.utils.djangotest import WebIndexTestCase
| from lino.utils.djangotest import WebIndexTestCase
| unknown | Python |
84159dae072424b0cc8d457b9e64e7b2490f08df | Remove some redundant URL configs. | hello-base/web,hello-base/web,hello-base/web,hello-base/web | base/components/people/urls.py | base/components/people/urls.py | from django.conf.urls import patterns, url
from django.http import Http404
from django.views.generic.base import RedirectView
from multiurl import ContinueResolving, multiurl
from .views import (GroupBrowseView, GroupDetailView, GroupDiscographyView, GroupMembershipView,
IdolBrowseView, IdolDetailView, IdolDiscog... | from django.conf.urls import patterns, url
from django.http import Http404
from django.views.generic.base import RedirectView
from multiurl import ContinueResolving, multiurl
from .views import (GroupBrowseView, GroupDetailView, GroupDiscographyView, GroupMembershipView,
IdolBrowseView, IdolDetailView, IdolDiscog... | apache-2.0 | Python |
fc5b13f413713cacd147bbd29daac5df7f5bd2de | update notification sending tests | wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,snahelou/awx | awx/main/tests/unit/test_tasks.py | awx/main/tests/unit/test_tasks.py | import pytest
from contextlib import contextmanager
from awx.main.models import (
UnifiedJob,
Notification,
)
from awx.main.tasks import (
send_notifications,
run_administrative_checks,
)
from awx.main.task_engine import TaskEnhancer
@contextmanager
def apply_patches(_patches):
[p.start() for p ... | import pytest
from contextlib import contextmanager
from awx.main.models import (
UnifiedJob,
Notification,
)
from awx.main.tasks import (
send_notifications,
run_administrative_checks,
)
from awx.main.task_engine import TaskEnhancer
@contextmanager
def apply_patches(_patches):
[p.start() for p ... | apache-2.0 | Python |
25ff7901a495a140e4c8d0890fdc0746f54104b7 | rename bundled assets files | mattoufoutu/EventViz,mattoufoutu/EventViz | eventviz/assets.py | eventviz/assets.py | # -*- coding: utf-8 -*-
from flask.ext.assets import Bundle, Environment
JS_ASSETS = [
'js/jquery-1.9.1.js',
'js/jquery.tablesorter.js',
'js/bootstrap.js'
]
JS_TIMELINE_ASSETS = [
'js/timeline.js',
'js/eventviz-timeline.js'
]
CSS_ASSETS = [
'css/bootstrap.css',
'css/eventviz.css'
]
CSS_TIM... | # -*- coding: utf-8 -*-
from flask.ext.assets import Bundle, Environment
JS_ASSETS = [
'js/jquery-1.9.1.js',
'js/jquery.tablesorter.js',
'js/bootstrap.js'
]
JS_TIMELINE_ASSETS = [
'js/timeline.js',
'js/eventviz-timeline.js'
]
CSS_ASSETS = [
'css/bootstrap.css',
'css/eventviz.css'
]
CSS_TIM... | mit | Python |
61e4693988c5b89b4a82457181813e7a6e73403b | Fix slugify for use without validator | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | utils/text.py | utils/text.py | import codecs
from django.core import exceptions
from django.utils import text
import translitcodec
def no_validator(arg):
pass
def slugify(model, field, value, validator=no_validator):
orig_slug = slug = text.slugify(codecs.encode(value, 'translit/long'))[:45]
i = 0
while True:
try:
... | import codecs
from django.core import exceptions
from django.utils import text
import translitcodec
def slugify(model, field, value, validator):
orig_slug = slug = text.slugify(codecs.encode(value, 'translit/long'))[:45]
i = 0
while True:
try:
try:
validator(slug)
... | agpl-3.0 | Python |
f2ffb339714ba848ea48008f20fa7adc71609b7f | add --update command to pr management util | openstates/openstates.org,openstates/openstates.org,openstates/openstates.org,openstates/openstates.org | people_admin/management/commands/create_pulls.py | people_admin/management/commands/create_pulls.py | from django.core.management.base import BaseCommand
from people_admin.models import DeltaSet, PullStatus
from people_admin.git import delta_set_to_pr, get_pr_status
class Command(BaseCommand):
help = "create pull requests from deltas"
def add_arguments(self, parser):
parser.add_argument("--list", def... | from django.core.management.base import BaseCommand
from people_admin.models import DeltaSet, PullStatus
from people_admin.git import delta_set_to_pr
class Command(BaseCommand):
help = "create pull requests from deltas"
def add_arguments(self, parser):
parser.add_argument("--list", default=False, act... | mit | Python |
efef8389f2536179ebea189fed33c3ca446e68ac | Refactor indicators | jmelett/pyfx,jmelett/pyFxTrader,jmelett/pyfx | pyFxTrader/utils/indicators.py | pyFxTrader/utils/indicators.py | # -*- coding: utf-8 -*-
import numpy as np
def moving_average(x, n, type='simple'):
"""
compute an n period moving average.
type is 'simple' | 'exponential'
"""
x = np.asarray(x)
if type == 'simple':
weights = np.ones(n)
else:
weights = np.exp(np.linspace(-1., 0., n))
... | # -*- coding: utf-8 -*-
import numpy as np
def moving_average(x, n, type='simple'):
"""
compute an n period moving average.
type is 'simple' | 'exponential'
"""
x = np.asarray(x)
if type == 'simple':
weights = np.ones(n)
else:
weights = np.exp(np.linspace(-1., 0., n))
... | mit | Python |
2eef6612a046b2982327a36ffe03beb4a0aa54f3 | Remove dependancies on lmi-sdp and sympy for is_passive. | python-control/python-control | control/passivity.py | control/passivity.py | '''
Author: Mark Yeatman
Date: May 15, 2022
'''
from . import statesp as ss
import numpy as np
import cvxopt as cvx
def is_passive(sys):
'''
Indicates if a linear time invarient system is passive
Constructs a linear matrix inequality and a feasibility optimization
such that is a solution exists, t... | '''
Author: Mark Yeatman
Date: May 15, 2022
'''
from . import statesp as ss
from sympy import symbols, Matrix, symarray
from lmi_sdp import LMI_NSD, to_cvxopt
from cvxopt import solvers
import numpy as np
def is_passive(sys):
'''
Indicates if a linear time invarient system is passive
Constructs a lin... | bsd-3-clause | Python |
28455c541b45ef6ca8e098702e0b7ea7c49a4a71 | Update ASDF version. | mchung94/latest-versions | versions/software/asdf.py | versions/software/asdf.py | from versions.software.utils import get_response, get_text_between
def name():
"""Return the precise name for the software."""
return 'asdf'
def installed_version():
"""Return the installed version of asdf."""
# I don't have a command-line version to run to get this from
return '3.3.2'
def lat... | from versions.software.utils import get_response, get_text_between
def name():
"""Return the precise name for the software."""
return 'asdf'
def installed_version():
"""Return the installed version of asdf."""
# I don't have a command-line version to run to get this from
return '3.3.1'
def lat... | mit | Python |
4011c54fc1e20f9d2e9514c1344ce3ee5bf032db | fix docstring | harpolea/pyro2,zingale/pyro2,harpolea/pyro2,zingale/pyro2 | lm_atm/__init__.py | lm_atm/__init__.py | """The pyro solver for low Mach number atmospheric flow. This
implements as second-order approximate projection method. The general
flow is:
* create the limited slopes of rho, u and v (in both directions)
* get the advective velocities through a piecewise linear Godunov
method
* enforce the divergence constrain... | """The pyro solver for low Mach number atmospheric flow. This
implements as second-order approximate projection method. The general
flow is:
* create the limited slopes of rho, u and v (in both directions)
* get the advective velocities through a piecewise linear Godunov
method
* enforce the divergence constrai... | bsd-3-clause | Python |
9362511d420a297fc1ed27f0642c4dcd527b4aff | Swap incorrect argument | jevinw/rec_utilities,jevinw/rec_utilities | babel_util/scripts/wos_to_edge.py | babel_util/scripts/wos_to_edge.py | #!/usr/bin/env python3
from parsers.wos import WOSStream
from util.PajekFactory import PajekFactory
from util.misc import open_file, Benchmark
if __name__ == "__main__":
import argparse
import sys
parser = argparse.ArgumentParser(description="Creates Pajek (.net) files from WOS XML")
parser.add_argumen... | #!/usr/bin/env python3
from parsers.wos import WOSStream
from util.PajekFactory import PajekFactory
from util.misc import open_file, Benchmark
if __name__ == "__main__":
import argparse
import sys
parser = argparse.ArgumentParser(description="Creates Pajek (.net) files from WOS XML")
parser.add_argumen... | agpl-3.0 | Python |
7b6a16f2dc418e7898d5cca248228d50becf9d05 | Add a method representation() for transition calendars. | jwg4/qual,jwg4/calexicon | calexicon/calendars/historical.py | calexicon/calendars/historical.py | from datetime import date
from base import Calendar
from calexicon.dates import InvalidDate, DateWithCalendar
from main import JulianCalendar, ProlepticGregorianCalendar
class SwitchDateWithCalendar(DateWithCalendar):
def __str__(self):
return "%s (%s - %s)" % (
self.calendar.date_display_stri... | from datetime import date
from base import Calendar
from calexicon.dates import InvalidDate, DateWithCalendar
from main import JulianCalendar, ProlepticGregorianCalendar
class SwitchDateWithCalendar(DateWithCalendar):
def __str__(self):
return "%s (%s - %s)" % (
self.calendar.date_display_stri... | apache-2.0 | Python |
daed100280b615ab7bd50bbf54d7f40f1d5d2a42 | Add CAN_DETECT | Asnelchristian/coala-bears,vijeth-aradhya/coala-bears,refeed/coala-bears,mr-karan/coala-bears,kaustubhhiware/coala-bears,madhukar01/coala-bears,sounak98/coala-bears,horczech/coala-bears,kaustubhhiware/coala-bears,coala/coala-bears,SanketDG/coala-bears,yash-nisar/coala-bears,madhukar01/coala-bears,gs0510/coala-bears,hor... | bears/python/PyDocStyleBear.py | bears/python/PyDocStyleBear.py | from coalib.bearlib.abstractions.Lint import Lint
from coalib.bears.LocalBear import LocalBear
from coalib.bears.requirements.PipRequirement import PipRequirement
from coalib.settings.Setting import typed_list
class PyDocStyleBear(LocalBear, Lint):
executable = 'pydocstyle'
output_regex = r'(.*\.py):(?P<line>... | from coalib.bearlib.abstractions.Lint import Lint
from coalib.bears.LocalBear import LocalBear
from coalib.bears.requirements.PipRequirement import PipRequirement
from coalib.settings.Setting import typed_list
class PyDocStyleBear(LocalBear, Lint):
executable = 'pydocstyle'
output_regex = r'(.*\.py):(?P<line>... | agpl-3.0 | Python |
51872cd1a966f10976200dcdf9998a9119072d43 | write warnings to stderr, not stdout (which might be muted) | blixt/py-starbound,6-lasers/py-starbound | export.py | export.py | #!/usr/bin/env python
import optparse
import os
import sys
import starbound
def main():
p = optparse.OptionParser()
p.add_option('-d', '--destination', dest='path',
help='Destination directory')
options, arguments = p.parse_args()
if len(arguments) != 1:
raise ValueError('On... | #!/usr/bin/env python
import optparse
import os
import sys
import starbound
def main():
p = optparse.OptionParser()
p.add_option('-d', '--destination', dest='path',
help='Destination directory')
options, arguments = p.parse_args()
if len(arguments) != 1:
raise ValueError('On... | mit | Python |
8785cade9bfe7cc3c54db0d0a068f99c5883ef1b | Allow locations to be imported from codelists management page | markbrough/maedi-projects,markbrough/maedi-projects,markbrough/maedi-projects | maediprojects/views/codelists.py | maediprojects/views/codelists.py | from flask import Flask, render_template, flash, request, Markup, \
session, redirect, url_for, escape, Response, abort, send_file, jsonify
from flask.ext.login import login_required, current_user
from maediprojects import app, db, models
from maediprojects.query import activity as qact... | from flask import Flask, render_template, flash, request, Markup, \
session, redirect, url_for, escape, Response, abort, send_file, jsonify
from flask.ext.login import login_required, current_user
from maediprojects import app, db, models
from maediprojects.query import activity as qact... | agpl-3.0 | Python |
e50d42032669d84c344e13863ccb8122b79b8b4a | prepare for release | kalefranz/auxlib,kalefranz/auxlib | auxlib/__about__.py | auxlib/__about__.py | # -*- coding: utf-8 -*-
"""auxiliary library to the python standard library"""
from __future__ import absolute_import, division, print_function
__all__ = ["__title__", "__author__", "__email__", "__license__", "__copyright__",
"__homepage__"]
__title__ = "auxlib"
__author__ = 'Kale Franz'
__email__ = 'kale... | # -*- coding: utf-8 -*-
"""auxiliary library to the python standard library"""
from __future__ import absolute_import, division, print_function
import os
import sys
import warnings
__all__ = ["__title__", "__author__", "__email__", "__license__", "__copyright__",
"__homepage__"]
__title__ = "auxlib"
__auth... | isc | Python |
01d7850ccf5b23c448a898a1a23533e8207e8e49 | Bump version to 1.7.2 | liampauling/betfair,liampauling/betfairlightweight | betfairlightweight/__init__.py | betfairlightweight/__init__.py | import logging
from .apiclient import APIClient
from .exceptions import BetfairError
from .streaming import StreamListener
from . import filters
__title__ = 'betfairlightweight'
__version__ = '1.7.2'
__author__ = 'Liam Pauling'
# Set default logging handler to avoid "No handler found" warnings.
try: # Python 2.7+
... | import logging
from .apiclient import APIClient
from .exceptions import BetfairError
from .streaming import StreamListener
from . import filters
__title__ = 'betfairlightweight'
__version__ = '1.7.1'
__author__ = 'Liam Pauling'
# Set default logging handler to avoid "No handler found" warnings.
try: # Python 2.7+
... | mit | Python |
24f546168b428580ccee05ba28f15e96fb5f64c9 | Create a financial year | Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data | scorecard/tests/test_views.py | scorecard/tests/test_views.py | import json
from infrastructure.models import FinancialYear
from django.test import (
TransactionTestCase,
Client,
override_settings,
)
from . import (
import_data,
)
from .resources import (
GeographyResource,
MunicipalityProfileResource,
MedianGroupResource,
RatingCountGroupResource,... | import json
from django.test import (
TransactionTestCase,
Client,
override_settings,
)
from . import (
import_data,
)
from .resources import (
GeographyResource,
MunicipalityProfileResource,
MedianGroupResource,
RatingCountGroupResource,
)
@override_settings(
SITE_ID=2,
STAT... | mit | Python |
70482d032d1acef1570b16551bf170a0a271a7ec | Put the 'import *' back into test-settings.py | mansilladev/zulip,Juanvulcano/zulip,verma-varsha/zulip,shaunstanislaus/zulip,noroot/zulip,peguin40/zulip,Galexrt/zulip,ashwinirudrappa/zulip,ufosky-server/zulip,AZtheAsian/zulip,Vallher/zulip,seapasulli/zulip,Frouk/zulip,bowlofstew/zulip,eastlhu/zulip,wavelets/zulip,sup95/zulip,eeshangarg/zulip,j831/zulip,zulip/zulip,p... | humbug/test-settings.py | humbug/test-settings.py | from settings import *
DATABASES['default']["NAME"] = "zephyr/tests/zephyrdb.test"
| from settings import DATABASES
DATABASES['default']["NAME"] = "zephyr/tests/zephyrdb.test"
| apache-2.0 | Python |
7c74017bc0d76ecb34e3fab44767290f51d98a09 | Decrease get_updates timeout for client test suite | ryanbackman/zulip,christi3k/zulip,dnmfarrell/zulip,littledogboy/zulip,LAndreas/zulip,timabbott/zulip,hayderimran7/zulip,xuxiao/zulip,deer-hope/zulip,zhaoweigg/zulip,m1ssou/zulip,wdaher/zulip,punchagan/zulip,lfranchi/zulip,kokoar/zulip,voidException/zulip,brainwane/zulip,blaze225/zulip,akuseru/zulip,JPJPJPOPOP/zulip,hay... | humbug/test_settings.py | humbug/test_settings.py | from settings import *
DATABASES["default"] = {"NAME": "zephyr/tests/zephyrdb.test",
"ENGINE": "django.db.backends.sqlite3",
"OPTIONS": { "timeout": 20, },}
TORNADO_SERVER = 'http://localhost:9983'
# Decrease the get_updates timeout to 1 second.
# This allows CasperJS ... | from settings import *
DATABASES["default"] = {"NAME": "zephyr/tests/zephyrdb.test",
"ENGINE": "django.db.backends.sqlite3",
"OPTIONS": { "timeout": 20, },}
TORNADO_SERVER = 'http://localhost:9983'
| apache-2.0 | Python |
4e539a2c35484fedbee2284e894b2e60635de83c | create initial models | charlon/mdot,uw-it-aca/mdot,charlon/mdot,uw-it-aca/mdot,uw-it-aca/mdot,charlon/mdot,uw-it-aca/mdot | mdot/models.py | mdot/models.py | from django.db import models
from django.contrib.auth.models import User
from django.forms import ModelForm
# Create your models here.
class Sponsor(models.Model):
name = models.CharField(max_length = 50)
netid = models.CharField(max_length = 8)
title = models.CharField(max_length = 50)
email = models... | from django.db import models
# Create your models here.
| apache-2.0 | Python |
c3cc948ceede66a70eadc300e558a42c8b06769b | Update change_names_miseq.py | lauringlab/variant_pipeline,lauringlab/variant_pipeline,lauringlab/variant_pipeline,lauringlab/variant_pipeline | scripts/change_names_miseq.py | scripts/change_names_miseq.py | #import sys
import os
import argparse
import shutil
parser = argparse.ArgumentParser(description='This program takes Miseq fastq files and renames them as sample.read_direction.#.fastq and keeps a log of the change')
parser.add_argument('-s',action='store',dest='s',help='The sorce directory containing the original fas... | #import sys
import os
import argparse
import shutil
parser = argparse.ArgumentParser(description='This program takes Miseq fastq files and renames them as sample.read_direction.#.fastq and keeps a log of the change')
parser.add_argument('-s',action='store',dest='s',help='The sorce directory containing the original fas... | apache-2.0 | Python |
6d0bc825a1fd9184bf7b4007bfa82b69e5c7cb35 | fix search to use sites | Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client | binstar_client/commands/search.py | binstar_client/commands/search.py | '''
Search binstar for packages
'''
from binstar_client.utils import get_binstar
from binstar_client.utils.pprint import pprint_packages
import logging
log = logging.getLogger('binstar.search')
def search(args):
binstar = get_binstar(args)
log.info("Run 'binstar show <USER/PACKAGE>' to get more details:")
... | '''
Search binstar for packages
'''
from binstar_client.utils import get_binstar
from binstar_client.utils.pprint import pprint_packages
import logging
log = logging.getLogger('binstar.search')
def search(args):
binstar = get_binstar()
log.info("Run 'binstar show <USER/PACKAGE>' to get more details:")
... | bsd-3-clause | Python |
83e071dd64807d1064fdd60ee0788f385b5f9334 | Remove noise | xaque208/dotfiles,xaque208/dotfiles,xaque208/dotfiles | bin/symlinks.py | bin/symlinks.py | #! /usr/bin/env python
import os
import fnmatch
def link(source, dest):
try:
if not os.path.exists(dest):
print("linking " + source + " to " + dest)
os.symlink(source,dest)
except:
print("fail")
def dotlink(source):
dest = os.environ['HOME'] + "/." + os.path.basena... | #! /usr/bin/env python
import os
import fnmatch
def link(source, dest):
try:
if not os.path.exists(dest):
print("linking " + source + " to " + dest)
os.symlink(source,dest)
except:
print("fail")
def dotlink(source):
dest = os.environ['HOME'] + "/." + os.path.basena... | mit | Python |
6f7d0ce060a29af86bd7cf98de6b6b23bb248fdd | Add missing Bus import in can/__init__.py | cantools/cantools | cantools/database/can/__init__.py | cantools/database/can/__init__.py | from .database import Database
from .message import Message
from .message import EncodeError
from .message import DecodeError
from .signal import Signal
from .node import Node
from .bus import Bus
| from .database import Database
from .message import Message
from .message import EncodeError
from .message import DecodeError
from .signal import Signal
from .node import Node
| mit | Python |
903130b5802f34f619187635fb4b205184abd3d9 | Add an example check | Netuitive/netuitive-client-python | example/example.py | example/example.py | import netuitive
import time
import os
ApiClient = netuitive.Client(url=os.environ.get('API_URL'), api_key=os.environ.get('CUSTOM_API_KEY'))
MyElement = netuitive.Element()
MyElement.add_attribute('Language', 'Python')
MyElement.add_attribute('app_version', '7.0')
MyElement.add_relation('my_child_element')
MyEleme... | import netuitive
import time
import os
ApiClient = netuitive.Client(url=os.environ.get('API_URL'), api_key=os.environ.get('CUSTOM_API_KEY'))
MyElement = netuitive.Element()
MyElement.add_attribute('Language', 'Python')
MyElement.add_attribute('app_version', '7.0')
MyElement.add_relation('my_child_element')
MyEleme... | apache-2.0 | Python |
6909fc497041761eadb5a8b8947eeb21b7fdbcc8 | use GetManager method in example | detrout/telepathy-python,epage/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,max-posedon/telepathy-python,max-posedon/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,epage/telepathy-python,PabloCastellano/telepathy-python,PabloCastellano/telepathy-python,detrout/t... | examples/avatar.py | examples/avatar.py |
"""
Telepathy example which requests the avatar for the user's own handle and
displays it in a Gtk window.
"""
import dbus.glib
import gtk
import sys
from telepathy.constants import CONNECTION_STATUS_CONNECTED
from telepathy.interfaces import (
CONN_MGR_INTERFACE, CONN_INTERFACE, CONN_INTERFACE_AVATARS)
import t... |
"""
Telepathy example which requests the avatar for the user's own handle and
displays it in a Gtk window.
"""
import dbus.glib
import gtk
import sys
from telepathy.constants import CONNECTION_STATUS_CONNECTED
from telepathy.interfaces import (
CONN_MGR_INTERFACE, CONN_INTERFACE, CONN_INTERFACE_AVATARS)
import t... | lgpl-2.1 | Python |
cda7e0d2242e5cc3dafca63a3af01f150fcd37be | Fix seeds for new names | HPI-SWA-Lab/BP2016H1,HPI-SWA-Lab/BP2016H1,HPI-SWA-Lab/BP2016H1,HPI-SWA-Lab/BP2016H1,HPI-SWA-Lab/BP2016H1 | server/seed.py | server/seed.py | from tables import *
fira = Font(fontName='Fira Sans Regular', family_id=1, author_id=1)
fira.tags.append(Tag(text='#pretty', type='opinion'))
fira.tags.append(Tag(text='Latin', type='language'))
thread1 = Thread(title='I don\'t like this word')
thread1.glyphs.append(Glyph(glyphName='A', version_hash='9c7075ca420f30a... | from tables import *
fira = Font(name='Fira Sans Regular', family_id=1, author_id=1)
fira.tags.append(Tag(text='#pretty', type='opinion'))
fira.tags.append(Tag(text='Latin', type='language'))
thread1 = Thread(title='I don\'t like this word')
thread1.glyphs.append(Glyph(name='A', version_hash='9c7075ca420f30aedb27c481... | mit | Python |
67f535f92d79de05aa10e86da3cdd635bc71537b | Use proper stacklevel for deprecation warnings | scrapy/w3lib | w3lib/util.py | w3lib/util.py | from warnings import warn
def str_to_unicode(text, encoding=None, errors='strict'):
warn(
"The w3lib.utils.str_to_unicode function is deprecated and "
"will be removed in a future release.",
DeprecationWarning,
stacklevel=2,
)
if encoding is None:
encoding = 'utf-8'... | from warnings import warn
def str_to_unicode(text, encoding=None, errors='strict'):
warn(
"The w3lib.utils.str_to_unicode function is deprecated and "
"will be removed in a future release.",
DeprecationWarning
)
if encoding is None:
encoding = 'utf-8'
if isinstance(text... | bsd-3-clause | Python |
24f7d137c7a0f58625543858b8f4a09f1dead859 | Update client.py | tamasgal/controlhost | examples/client.py | examples/client.py | from controlhost import Client
with Client('127.0.0.1') as client:
client.subscribe('foo')
try:
while True:
prefix, message = client.get_message()
print prefix.tag
print prefix.length
print message
except KeyboardInterrupt:
client._disconnect(... | from controlhost import Client
with Client('131.188.161.241') as client:
client.subscribe('foo')
try:
while True:
prefix, message = client.get_message()
print prefix.tag
print prefix.length
print message
except KeyboardInterrupt:
client._disco... | mit | Python |
a475173ce00b2d6686c601ffc46a8d2bc3ed0a7f | Switch back to development version | goldmann/dogen,goldmann/dogen,jboss-container-images/concreate,jboss-container-images/concreate,jboss-dockerfiles/dogen,jboss-container-images/concreate,jboss-dockerfiles/dogen,goldmann/dogen,jboss-dockerfiles/dogen | dogen/version.py | dogen/version.py | version = "2.1.0rc1.dev"
| version = "2.0.0"
| mit | Python |
c7439eb0d8a88a3a3584a3e73ed9badc910dcd05 | Move newrelic initialization to the very start of wsgi initialization | DXCanas/content-curation,DXCanas/content-curation,DXCanas/content-curation,DXCanas/content-curation | contentcuration/contentcuration/wsgi.py | contentcuration/contentcuration/wsgi.py | """
WSGI config for contentcuration project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import logging
import os
# Attach newrelic APM
try:
import newrelic.agent
newre... | """
WSGI config for contentcuration project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJAN... | mit | Python |
55d54f67111583dab4209639ef8e3d6430ea7939 | Handle oversteer in turns. | jeradesign/QuickBot_Follow,jeradesign/QuickBot_Follow | src/Command_Interpreter.py | src/Command_Interpreter.py | # Motor driver for QuickBot_Follow.
# John Brewer 3/31/16
# Copyright (C) 2016 Jera Design LLC
# All Rights Reserverd
import Motor_Driver
import sys
from time import sleep
Motor_Driver.init_pins()
print "Ready"
last = ""
count = 0
while True:
line = sys.stdin.readline().rstrip()
if not line:
break... | # Motor driver for QuickBot_Follow.
# John Brewer 3/31/16
# Copyright (C) 2016 Jera Design LLC
# All Rights Reserverd
import Motor_Driver
import sys
Motor_Driver.init_pins()
print "Ready"
while True:
line = sys.stdin.readline().rstrip()
if not line:
break;
if line == "left":
print "turn... | bsd-3-clause | Python |
6486a888cbcec7285df92020f76e3f1c5fbba0e2 | Load exchange rates in test setup. Make it posible to use --keepdb | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/test/test_runner.py | bluebottle/test/test_runner.py | from django.test.runner import DiscoverRunner
from django.db import connection
from django.core import management
from tenant_schemas.utils import get_tenant_model
from bluebottle.test.utils import InitProjectDataMixin
class MultiTenantRunner(DiscoverRunner, InitProjectDataMixin):
def setup_databases(self, *arg... | from django.test.runner import DiscoverRunner
from django.db import connection
from tenant_schemas.utils import get_tenant_model
from bluebottle.test.utils import InitProjectDataMixin
class MultiTenantRunner(DiscoverRunner, InitProjectDataMixin):
def setup_databases(self, *args, **kwargs):
result = supe... | bsd-3-clause | Python |
d9a9cb9004ddc20d92441df50d3a0f73432803bb | Remove import only used for debugging | ska-sa/katdal | scripts/mvf_read_benchmark.py | scripts/mvf_read_benchmark.py | #!/usr/bin/env python
from __future__ import print_function, division, absolute_import
from builtins import range
import argparse
import logging
import time
import katdal
from katdal.lazy_indexer import DaskLazyIndexer
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('filename')
parser.add_... | #!/usr/bin/env python
from __future__ import print_function, division, absolute_import
from builtins import range
import argparse
import logging
import time
import dask
import katdal
from katdal.lazy_indexer import DaskLazyIndexer
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('filename')... | bsd-3-clause | Python |
873c5e8bf85a8be5a08852134967d29353ed3009 | Swap ndcms for generic T3 string. | matz-e/lobster,matz-e/lobster,matz-e/lobster | examples/simple.py | examples/simple.py | from lobster import cmssw
from lobster.core import *
storage = StorageConfiguration(
output=[
"hdfs:///store/user/matze/test_shuffle_take29",
"file:///hadoop/store/user/matze/test_shuffle_take29",
"root://T3_US_NotreDame/store/user/matze/test_shuffle_take29",
"sr... | from lobster import cmssw
from lobster.core import *
storage = StorageConfiguration(
output=[
"hdfs:///store/user/matze/test_shuffle_take29",
"file:///hadoop/store/user/matze/test_shuffle_take29",
"root://ndcms.crc.nd.edu//store/user/matze/test_shuffle_take29",
"... | mit | Python |
6beff62ef9741cfe5ed0443250f5a93d04d74bca | Create UserCandidate model | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/grid/backend/grid/api/users/models.py | packages/grid/backend/grid/api/users/models.py | # stdlib
from typing import Optional
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from pydantic import BaseModel
from pydantic import EmailStr
class BaseUser(BaseModel):
email: Optional[EmailStr]
name: Optional[str]
role: Union[Optional[i... | # stdlib
from typing import Optional
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from pydantic import BaseModel
from pydantic import EmailStr
class BaseUser(BaseModel):
email: Optional[EmailStr]
name: Optional[str]
role: Union[Optional[i... | apache-2.0 | Python |
7db2f2f9124fd82bbcaf8eabea9ff57306796f58 | Fix relative path to .gitignore and other minor changes. | sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc | build/extra_gitignore.py | build/extra_gitignore.py | #!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | #!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | bsd-3-clause | Python |
86429b75bea758627eeef930b604e819089435a7 | fix missing toUpper for location message | biji/yowsup,ongair/yowsup | yowsup/layers/protocol_media/layer.py | yowsup/layers/protocol_media/layer.py | from yowsup.layers import YowLayer, YowLayerEvent, YowProtocolLayer
from .protocolentities import ImageDownloadableMediaMessageProtocolEntity
from .protocolentities import LocationMediaMessageProtocolEntity
from .protocolentities import VCardMediaMessageProtocolEntity
class YowMediaProtocolLayer(YowProtocolLayer):
... | from yowsup.layers import YowLayer, YowLayerEvent, YowProtocolLayer
from .protocolentities import ImageDownloadableMediaMessageProtocolEntity
from .protocolentities import LocationMediaMessageProtocolEntity
from .protocolentities import VCardMediaMessageProtocolEntity
class YowMediaProtocolLayer(YowProtocolLayer):
... | mit | Python |
2f50e7e71b124ae42cab5edb19c030fcc69a4ef5 | Fix failing attribute lookups | maferelo/saleor,HyperManTT/ECommerceSaleor,car3oon/saleor,itbabu/saleor,itbabu/saleor,jreigel/saleor,HyperManTT/ECommerceSaleor,car3oon/saleor,UITools/saleor,mociepka/saleor,UITools/saleor,UITools/saleor,KenMutemi/saleor,jreigel/saleor,KenMutemi/saleor,mociepka/saleor,HyperManTT/ECommerceSaleor,tfroehlich82/saleor,KenM... | saleor/product/models/utils.py | saleor/product/models/utils.py | from django.utils.encoding import smart_text
def get_attributes_display_map(variant, attributes):
display = {}
for attribute in attributes:
value = variant.get_attribute(attribute.pk)
if value:
choices = {smart_text(a.pk): a for a in attribute.values.all()}
attr = choice... | from django.utils.encoding import smart_text
def get_attributes_display_map(variant, attributes):
print "in get_attributes_display_map with " + str(variant) + " and " + str(attributes)
display = {}
for attribute in attributes:
value = variant.get_attribute(attribute.pk)
if value:
... | bsd-3-clause | Python |
6a8fba9bc6bb1108b048947b7ffc10c0904fba14 | Move plugin loading to separate function | cmende/pytelefoob0t | foob0t.py | foob0t.py | # Copyright 2017 Christoph Mende
#
# 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 2017 Christoph Mende
#
# 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 |
6903779f0d34145af1f13fef7f4e07b605aec3d0 | Update __init__.py | CactusDev/CactusBot | cactusbot/commands/__init__.py | cactusbot/commands/__init__.py | """Handle commands."""
from .command import Command
from .magic import COMMANDS
__all__ = ["Command", "COMMANDS"]
| """Handle commands."""
from .command import Command
from .magic import COMMANDS
__all__ = ["Command", "COMMANDS]
| mit | Python |
5e8b82130a0bd0d63629e725fc06380105955274 | Update data migration | baylee-d/osf.io,Johnetordoff/osf.io,mfraezz/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,adlius/osf.io,Johnetordoff/osf.io,mattclark/osf.io,brianjgeiger/osf.io,saradbowman/osf.io,Johnetordoff/osf.io,felliott/osf.io,brianjgeiger/osf.io,CenterForOpenScience/osf.io,cslzchen/osf.io,adlius/osf.io,baylee-d/osf.io,felliot... | osf/migrations/0084_preprint_node_divorce.py | osf/migrations/0084_preprint_node_divorce.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-12 18:25
from __future__ import unicode_literals
from django.db import migrations
from django.db import transaction
def divorce_preprints_from_nodes(apps, schema_editor):
Preprint = apps.get_model('osf', 'PreprintService')
PreprintContributor = a... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-12 18:25
from __future__ import unicode_literals
from django.db import migrations
from django.db import transaction
def divorce_preprints_from_nodes(apps, schema_editor):
Preprint = apps.get_model('osf', 'PreprintService')
PreprintContributor = a... | apache-2.0 | Python |
dd2f7da18fb295d58ac763ee7e91b9b1a5bdf1d0 | Update __about__.py | reaperhulk/bcrypt,reaperhulk/bcrypt,alex/bcrypt,growingdever/bcrypt,pyca/bcrypt,pyca/bcrypt,pyca/bcrypt,growingdever/bcrypt,reaperhulk/bcrypt,alex/bcrypt,reaperhulk/bcrypt,alex/bcrypt,growingdever/bcrypt,pyca/bcrypt | bcrypt/__about__.py | bcrypt/__about__.py | # Author:: Donald Stufft (<donald@stufft.io>)
# Copyright:: Copyright (c) 2013 Donald Stufft
# License:: Apache License, Version 2.0
#
# 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:/... | # Author:: Donald Stufft (<donald@stufft.io>)
# Copyright:: Copyright (c) 2013 Donald Stufft
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... | apache-2.0 | Python |
d7c35749c682cb86356cdf825f3886e22b07942a | Add --refresh command line argument to Django admin command build_genome_blastdb | ginkgobioworks/edge,ginkgobioworks/edge,ginkgobioworks/edge,ginkgobioworks/edge | src/edge/management/commands/build_genome_blastdb.py | src/edge/management/commands/build_genome_blastdb.py | from edge.blastdb import build_all_genome_dbs
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'--refresh',
action='store_true',
help='Rebuild BLAST database files',
)
def ... | from edge.blastdb import build_all_genome_dbs
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
build_all_genome_dbs()
| mit | Python |
f7f576adfccdfbc386c991bb35f2a52e9db19b5e | remove hack | albertz/music-player,kingsj/music-player,albertz/music-player,albertz/music-player,albertz/music-player,kingsj/music-player,albertz/music-player,kingsj/music-player,albertz/music-player,kingsj/music-player,kingsj/music-player | tracker.py | tracker.py |
from utils import *
from pprint import pprint
import sys
from State import state
from player import PlayerEventCallbacks
import lastfm
def track(event, args, kwargs):
print "track:", repr(event), repr(args), repr(kwargs)
if event is PlayerEventCallbacks.onSongChange:
oldSong = kwargs["oldSong"]
newSong = kwar... |
from utils import *
from pprint import pprint
import sys
from State import state
from player import PlayerEventCallbacks
import lastfm
def track(event, args, kwargs):
print "track:", repr(event), repr(args), repr(kwargs)
if event is PlayerEventCallbacks.onSongChange:
oldSong = kwargs["oldSong"]
newSong = kwar... | bsd-2-clause | Python |
587abec7ff5b90c03885e164d9b6b62a1fb41f76 | Fix the headers sent by the GitHub renderer. | ssundarraj/grip,mgoddard-pivotal/grip,mgoddard-pivotal/grip,joeyespo/grip,joeyespo/grip,jbarreras/grip,jbarreras/grip,ssundarraj/grip | grip/github_renderer.py | grip/github_renderer.py | from flask import abort, json
import requests
def render_content(text, gfm=False, context=None,
username=None, password=None):
"""Renders the specified markup using the GitHub API."""
if gfm:
url = 'https://api.github.com/markdown'
data = {'text': text, 'mode': 'gfm'}
... | from flask import abort, json
import requests
def render_content(text, gfm=False, context=None,
username=None, password=None):
"""Renders the specified markup using the GitHub API."""
if gfm:
url = 'https://api.github.com/markdown'
data = {'text': text, 'mode': 'gfm'}
... | mit | Python |
67f64792dc7321cd9521e927b4eb1a58b67cdcdc | Allow passing of direct function reference to url triple | brinkframework/brink | brink/server.py | brink/server.py | from aiohttp import web
from brink.config import config
from brink.db import conn
from brink.handlers import __handler_wrapper, __ws_handler_wrapper
from brink.utils import resolve_func
from brink.cli import print_globe, print_info
import importlib
import aiohttp_autoreload
import logging
def run_server(conf):
fo... | from aiohttp import web
from brink.config import config
from brink.db import conn
from brink.handlers import __handler_wrapper, __ws_handler_wrapper
from brink.utils import resolve_func
from brink.cli import print_globe, print_info
import importlib
import aiohttp_autoreload
import logging
def run_server(conf):
fo... | bsd-3-clause | Python |
6156960333163e15fd2ddd96e831bbdf2e92163d | Correct reference to organization | gg7/sentry,1tush/sentry,gg7/sentry,jokey2k/sentry,TedaLIEz/sentry,beeftornado/sentry,TedaLIEz/sentry,mvaled/sentry,gg7/sentry,zenefits/sentry,nicholasserra/sentry,kevinlondon/sentry,kevinastone/sentry,looker/sentry,mvaled/sentry,ewdurbin/sentry,daevaorn/sentry,JackDanger/sentry,mvaled/sentry,JTCunning/sentry,JTCunning/... | src/sentry/api/bases/organization.py | src/sentry/api/bases/organization.py | from __future__ import absolute_import
from sentry.api.base import Endpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.permissions import ScopedPermission
from sentry.models import AuthIdentity, Organization, OrganizationMember
class OrganizationPermission(ScopedPermission):
scope_map... | from __future__ import absolute_import
from sentry.api.base import Endpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.permissions import ScopedPermission
from sentry.models import AuthIdentity, Organization, OrganizationMember
class OrganizationPermission(ScopedPermission):
scope_map... | bsd-3-clause | Python |
798e51e880374b43c405ce7e4314b3d1a3311c5c | Make exceptions for bad behavior (#220) | wiki-ai/wikilabels,wiki-ai/wikilabels,wiki-ai/wikilabels | wikilabels/database/db.py | wikilabels/database/db.py | import logging
from contextlib import contextmanager
from psycopg2.extras import RealDictCursor
from psycopg2.pool import ThreadedConnectionPool
from .campaigns import Campaigns
from .labels import Labels
from .tasks import Tasks
from .worksets import Worksets
logger = logging.getLogger(__name__)
class DB:
def... | import logging
from contextlib import contextmanager
from psycopg2.extras import RealDictCursor
from psycopg2.pool import ThreadedConnectionPool
from .campaigns import Campaigns
from .labels import Labels
from .tasks import Tasks
from .worksets import Worksets
logger = logging.getLogger(__name__)
class DB:
def... | mit | Python |
3f0932f8fc1277fc5354476470c2931d48f62977 | bump version | SexualHealthInnovations/callisto-core,SexualHealthInnovations/callisto-core,project-callisto/callisto-core,project-callisto/callisto-core | callisto_core/utils/version.py | callisto_core/utils/version.py | __version__ = '0.10.11'
| __version__ = '0.10.10'
| agpl-3.0 | Python |
7220621fcdba6de2e0fabb69e2d51dd382e739ba | Fix Windows freeze error | desbma/sacad,desbma/sacad | freeze.py | freeze.py | #!/usr/bin/env python3
import os
import re
from cx_Freeze import setup, Executable
with open(os.path.join("sacad", "__init__.py"), "rt") as f:
version = re.search("__version__ = \"([^\"]+)\"", f.read()).group(1)
build_exe_options = {"includes": ["lxml._elementpath"],
"packages": ["asyncio", ... | #!/usr/bin/env python3
import os
import re
from cx_Freeze import setup, Executable
with open(os.path.join("sacad", "__init__.py"), "rt") as f:
version = re.search("__version__ = \"([^\"]+)\"", f.read()).group(1)
build_exe_options = {"includes": ["lxml._elementpath"],
"packages": ["asyncio"],... | mpl-2.0 | Python |
ec51bcd1803a2f576f6a325b9b950d86c5d0b2a9 | Cut 0.9.1 | singingwolfboy/invocations,pyinvoke/invocations,mrjmad/invocations | invocations/_version.py | invocations/_version.py | __version_info__ = (0, 9, 1)
__version__ = '.'.join(map(str, __version_info__))
| __version_info__ = (0, 9, 0)
__version__ = '.'.join(map(str, __version_info__))
| bsd-2-clause | Python |
4be292c5c38b4eec08c56a872f6cd4f390bc607a | make compiler's py3k warning a full deprecation warning #6837 | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/compiler/__init__.py | Lib/compiler/__init__.py | """Package for parsing and compiling Python source code
There are several functions defined at the top level that are imported
from modules contained in the package.
parse(buf, mode="exec") -> AST
Converts a string containing Python source code to an abstract
syntax tree (AST). The AST is defined in compiler... | """Package for parsing and compiling Python source code
There are several functions defined at the top level that are imported
from modules contained in the package.
parse(buf, mode="exec") -> AST
Converts a string containing Python source code to an abstract
syntax tree (AST). The AST is defined in compiler... | mit | Python |
7f9c9c25f5786bf96ff3d89cc8fd840e3e6a4a6d | Allow passing of a tuple of three integers to get a datetime. | MinchinWeb/minchin.pelican.jinja_filters | pelican/plugins/jinja_filters/jinja_filters.py | pelican/plugins/jinja_filters/jinja_filters.py | """Various filters for Jinja."""
from datetime import datetime as _datetime
from titlecase import titlecase as _titlecase
__all__ = [
"article_date",
"breaking_spaces",
"datetime",
"titlecase",
]
def datetime(value, format_str="%Y/%m/%d %H:%M"):
"""
Convert a datetime to a different format.... | """Various filters for Jinja."""
from datetime import datetime as _datetime
from titlecase import titlecase as _titlecase
__all__ = [
"article_date",
"breaking_spaces",
"datetime",
"titlecase",
]
def datetime(value, format_str="%Y/%m/%d %H:%M"):
"""
Convert a datetime to a different format.... | mit | Python |
b548092d480871e402e2d50ab96d864c5851cab2 | fix __init__ changes | kkroening/ffmpeg-python | ffmpeg/__init__.py | ffmpeg/__init__.py | from __future__ import unicode_literals
from . import _filters, _ffmpeg, _run
from ._filters import *
from ._ffmpeg import *
from ._run import *
__all__ = _filters.__all__ + _ffmpeg.__all__ + _run.__all__
| from __future__ import unicode_literals
from . import _filters, _ffmpeg, _run
from ._filters import *
from ._ffmpeg import *
from ._run import *
from ._view import *
__all__ = _filters.__all__ + _ffmpeg.__all__ + _run.__all__ + _view.__all__
| apache-2.0 | Python |
71a84ecb772aa5560e35409219c11001ac168c6a | Add logging for contact form email. | cdriehuys/chmvh-website,cdriehuys/chmvh-website,cdriehuys/chmvh-website | chmvh_website/contact/forms.py | chmvh_website/contact/forms.py | import logging
from smtplib import SMTPException
from django import forms
from django.conf import settings
from django.core import mail
from django.template import loader
logger = logging.getLogger('chmvh_website.{0}'.format(__name__))
class ContactForm(forms.Form):
name = forms.CharField()
email = forms.... | from django import forms
from django.conf import settings
from django.core import mail
from django.template import loader
class ContactForm(forms.Form):
name = forms.CharField()
email = forms.EmailField()
message = forms.CharField(widget=forms.Textarea(
attrs={'rows': 5}))
template = loader.g... | mit | Python |
a11c058c520581239a76d1b87920fec7f087eff3 | Use round brackets | rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org | readthedocs/builds/managers.py | readthedocs/builds/managers.py | """Build and Version class model Managers"""
from __future__ import absolute_import
import logging
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from .constants import (BRANCH, TAG, LATEST, LATEST_VERBOSE_NAME, STABLE,
STABLE_VERBOSE_NAME)
from .querysets... | """Build and Version class model Managers"""
from __future__ import absolute_import
import logging
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from .constants import (BRANCH, TAG, LATEST, LATEST_VERBOSE_NAME, STABLE,
STABLE_VERBOSE_NAME)
from .querysets... | mit | Python |
797ab31382a6c92eb4e9496969e36c35a23db20d | Bump version to 10.0.1 | hhursev/recipe-scraper | recipe_scrapers/__version__.py | recipe_scrapers/__version__.py | __version__ = "10.0.1"
| __version__ = "10.0.0"
| mit | Python |
82b1e2db9c9175370d40354c2e6851bb26d58183 | bump plugin version | loomchild/bountyfunding,centaurustech/bountyfunding,loomchild/bountyfunding,centaurustech/bountyfunding,centaurustech/bountyfunding,bountyfunding/bountyfunding,loomchild/bountyfunding,bountyfunding/bountyfunding,bountyfunding/bountyfunding | plugins/bountyfunding_plugin_trac/src/setup.py | plugins/bountyfunding_plugin_trac/src/setup.py | #!/usr/bin/env python
from setuptools import find_packages, setup
setup(
name='BountyFunding', version='0.6',
packages=find_packages(),
entry_points = {
'trac.plugins': [
'bountyfunding = bountyfunding.bountyfunding',
],
},
package_data={'bountyfunding': ['templates/*', 'h... | #!/usr/bin/env python
from setuptools import find_packages, setup
setup(
name='BountyFunding', version='0.5',
packages=find_packages(),
entry_points = {
'trac.plugins': [
'bountyfunding = bountyfunding.bountyfunding',
],
},
package_data={'bountyfunding': ['templates/*', 'h... | agpl-3.0 | Python |
e09798d5adbdea422d31eeed6fded746c0b8e5eb | update reduce options | boada/planckClusters,boada/planckClusters,boada/planckClusters,boada/planckClusters,boada/planckClusters | MOSAICpipe/reduce_ALL.py | MOSAICpipe/reduce_ALL.py | import os
from glob import glob
''' This file links the MOSAIC pipeline into each folder and then does the
complete reduction on things. It still needs to have the individual association
files created before hand, but it does everything else.
I've updated it to also to the newfirm linking and reduction. You specify w... | import os
from glob import glob
import sys
''' This file links the MOSAIC pipeline into each folder and then does the
complete reduction on things. It still needs to have the individual association
files created before hand, but it does everything else.
I've updated it to also to the newfirm linking and reduction. Yo... | mit | Python |
d7cfdbd2bde0cc876db8c1bce020d8a1cf0ea77b | Add search filtering for name and booleans in resource API. | uw-it-aca/mdot-rest,uw-it-aca/mdot-rest | mdot_rest/views.py | mdot_rest/views.py | from django.shortcuts import render
from .models import Resource
from .serializers import ResourceSerializer
from rest_framework import generics, permissions
import django_filters
class ResourceFilter(django_filters.FilterSet):
class Meta:
model = Resource
fields = ('name', 'featured', 'accessible... | from django.shortcuts import render
from .models import Resource
from .serializers import ResourceSerializer
from rest_framework import generics, permissions
class ResourceList(generics.ListCreateAPIView):
queryset = Resource.objects.all()
serializer_class = ResourceSerializer
permission_classes = (permis... | apache-2.0 | Python |
08d2ade71e6fb69512cb6d39cb7ef8712a44172a | update mediumRegex | sanxofon/basicnlp,sanxofon/basicnlp | mediumRegexUTF8.py | mediumRegexUTF8.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# FIX PARA WINDOWS CONSOLE ----------------------
# Usar: chcp 1252
import codecs,locale,sys
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
# -----------------------------------------------
import re
cadena = u"""—¡Joven «emponzoñado» con el whis... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# FIX PARA WINDOWS CONSOLE ----------------------
import codecs,sys
sys.stdout = codecs.getwriter("utf8")(sys.stdout)
# -----------------------------------------------
import re
cadena = u"""—¡Joven «emponzoñado» con el whisky, qué fin… te aguarda exhibir!
El pingüino Wen... | mit | Python |
76dcc6cd050172af50c0721b312ea499f0bb7b71 | modify build option | cubicdaiya/neoagent,cubicdaiya/neoagent | build/config.py | build/config.py | # -*- coding: utf-8 -*-
cflags = [
'-std=c99',
'-Wall',
'-g0',
'-O3',
# '-fno-strict-aliasing',
'-D_GNU_SOURCE',
]
libs = [
'pthread',
'ev',
'json',
]
includes = [
'ext',
]
headers = [
'stdint.h',
'stdbool.h',
'unistd.h',
'sys/stat.h',
'sys/type... | # -*- coding: utf-8 -*-
cflags = [
'-std=c99',
'-Wall',
'-g',
'-O2',
# '-fno-strict-aliasing',
'-D_GNU_SOURCE',
]
libs = [
'pthread',
'ev',
'json',
]
includes = [
'ext',
]
headers = [
'stdint.h',
'stdbool.h',
'unistd.h',
'sys/stat.h',
'sys/types... | bsd-3-clause | Python |
f9d911091f01d91485f21c01850798892ed28dd0 | add right arrow | thomasballinger/scottwasright,thomasballinger/scottwasright | scottsright/manual_readline.py | scottsright/manual_readline.py |
char_sequences = {}
def on(seq):
def add_to_char_sequences(func):
char_sequences[seq] = func
return func
return add_to_char_sequences
@on('[D')
@on('')
def left_arrow(cursor_offset, line):
return max(0, cursor_offset - 1), line
@on('[C')
@on('')
def right_arrow(cursor_offset, line):
... |
char_sequences = {}
def on(seq):
def add_to_char_sequences(func):
char_sequences[seq] = func
return func
return add_to_char_sequences
@on('[D')
@on('')
@on('\x02')
def left_arrow(cursor_offset, line):
return max(0, cursor_offset - 1), line
if __name__ == '__main__':
print repr(char... | mit | Python |
3555b002aae386220bc02d662a9b188426afc08f | Create a specific group for the Facebook plugins - makes it a bit neater in the list of plugins. | chrisglass/cmsplugin_facebook | cmsplugin_facebook/cms_plugins.py | cmsplugin_facebook/cms_plugins.py | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cmsplugin_facebook import models
class BasePlugin(CMSPluginBase):
name = None
def render(self, context, instance, placeholder):
context.update({'instance': instance,
'name': self.name,
... | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cmsplugin_facebook import models
class BasePlugin(CMSPluginBase):
name = None
def render(self, context, instance, placeholder):
context.update({'instance': instance,
'name': self.name,
... | bsd-3-clause | Python |
7f2b3d91550fd6af46ee10e6c68c8633408b12ed | Revert revert to properly fix #125 without cruft. Sigh. | stencila/hub,stencila/hub,stencila/hub,stencila/hub,stencila/hub | director/scripts/create_dev_projects.py | director/scripts/create_dev_projects.py | """
Create projects for the development database
"""
from django.conf import settings
from accounts.models import Account, AccountUserRole
from projects.models import Project
def random_account_member(account):
return AccountUserRole.objects.filter(account=account).order_by('?').first().user
def run(*args):
... | """
Create projects for the development database
"""
from django.conf import settings
from accounts.models import Account
from projects.models import Project
def run(*args):
# Ensure that this is only used in development
assert settings.DEBUG
# Assumes that there are at least 3 accounts
accounts = ... | apache-2.0 | Python |
0282c7eaecb32b736592c84cda1f7520c130c676 | Update basic tests | iconpin/anser | test/basic.py | test/basic.py | import unittest
from anser import Anser, Client
class BasicAnserTest(unittest.TestCase):
def test_creation(self):
server = Anser(__file__)
self.assertEquals(server.name, __file__)
def test_creation_explicit_no_debug(self):
server = Anser(__file__, debug=False)
self.assertFals... | import unittest
from anser import Anser
class BasicTest(unittest.TestCase):
def setUp(self):
pass
def test_creation(self):
server = Anser(__file__)
self.assertEquals(server.name, __file__)
def test_creation_explicit_no_debug(self):
server = Anser(__file__, debug=False)... | mit | Python |
db4d5263c38e95ad8c2e253512c563ea97b8772f | Fix adduser script first line | goneall/PiLightsWebServer,goneall/PiLightsWebServer | src/adduser.py | src/adduser.py | #!/usr/bin/env python
# Licensed under the Apache 2.0 License
'''
Add a user to the database
Usage: adduser username password
The environment variable LIGHTS_WEB_DATABASE must be set to the path of the database
Created on Nov 13, 2014
@author: Gary O'Neall
'''
import sys
import sqlite3
from hashlib import... | #!/usr/bin/env python
# Licensed under the Apache 2.0 License
'''
Add a user to the database
Usage: adduser username password
The environment variable LIGHTS_WEB_DATABASE must be set to the path of the database
Created on Nov 13, 2014
@author: Gary O'Neall
'''
import sys
import sqlite3
from hashlib impor... | apache-2.0 | Python |
a04d97bd9bb62d15201d8cadd1fd3b24980d3507 | Fix installation path generation for configuration file | ivannieto/archer-t2u-ubuntu-installer,ivannieto/archer-t2u-ubuntu-installer,ivannieto/archer-t2u-ubuntu-installer,ivannieto/archer-t2u-ubuntu-installer | t2u-driver-installer.py | t2u-driver-installer.py | import os
PATH = os.getcwd()
HOME = os.getenv('HOME')
INSTALL_FILES = PATH+'/driver-files'
DEV_DIR = HOME+'/test-install'
PROD_DIR = '/etc'
BIN_DIR = '/usr/bin/'
print(('*'*25)+'\n')
print()
def take_input():
i = input("Please, disconnect all devices you're trying to install and press [I]: ")
return i
while... | import os
PATH = os.getcwd()
HOME = os.getenv('HOME')
INSTALL_FILES = PATH+'/driver-files'
DEV_DIR = HOME+'/test-install'
PROD_DIR = '/etc'
BIN_DIR = '/usr/bin/'
print(('*'*25)+'\n')
print()
def take_input():
i = input("Please, disconnect all devices you're trying to install and press [I]: ")
return i
while... | mit | Python |
90b1aebe4b67ff9f221aee3b0c668f658d915537 | Update bottlespin.py | kallerdaller/Cogs-Yorkfield | bottlespin/bottlespin.py | bottlespin/bottlespin.py | import discord
from discord.ext import commands
from random import choice
class Bottlespin:
"""Spins a bottle and lands on a random user."""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, no_pm=True, alias=["bottlespin"])
async def spin(self, ctx, role):
... | import discord
from discord.ext import commands
from random import choice
class Bottlespin:
"""Spins a bottle and lands on a random user."""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, no_pm=True, alias=["bottlespin"])
async def spin(self, ctx, role):
... | mit | Python |
fb6aa002e13a1d1205da28b20d419419067117f6 | Implement basic genome crossover (#44, #36) | a5kin/hecate,a5kin/hecate | xentica/tools/genetics.py | xentica/tools/genetics.py | """A collection of functions allowing genetics manipulations."""
from xentica import core
from xentica.tools import xmath
def genome_crossover(state, num_genes, *genomes, rng_name="rng"):
"""
Crossover given genomes in stochastic way.
:param state:
A container holding model's properties.
:pa... | """A collection of functions allowing genetics manipulations."""
def genome_crossover(*genomes):
"""
Crossover given genomes in stochastic way.
:param genomes: A list of genomes (integers) to crossover
:returns: Single integer, a resulting genome.
"""
raise NotImplementedError
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.