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 |
|---|---|---|---|---|---|---|---|---|
8d1fa06fa83e99ede2dc49b4b02749b0714cef78 | Fix profile_detail url | SoPR/horas,SoPR/horas,SoPR/horas,SoPR/horas | apps/profiles/urls.py | apps/profiles/urls.py | from django.conf.urls import patterns, url
from .views import ProfileDetailView, ProfileUpdateView
urlpatterns = patterns(
'', # Empty string as prefix
url('^$', ProfileDetailView.as_view(), name='profile_detail'),
url('^/update/$', ProfileUpdateView.as_view(), name='profile_update'),
# url('^.(?P<f... | from django.conf.urls import patterns, url
from .views import ProfileDetailView, ProfileUpdateView
urlpatterns = patterns(
'', # Empty string as prefix
url('^/$', ProfileDetailView.as_view(), name='profile_detail'),
url('^/update/$', ProfileUpdateView.as_view(), name='profile_update'),
# url('^.(?P<... | mit | Python |
06b57e2db7cce08ff0b6f2a5e0ad6d2723f1d017 | fix CI failure by using 3rd packages | qzane/you-get,xyuanmu/you-get,zmwangx/you-get,cnbeining/you-get,xyuanmu/you-get,qzane/you-get,cnbeining/you-get,zmwangx/you-get | src/you_get/extractors/douyutv.py | src/you_get/extractors/douyutv.py | #!/usr/bin/env python
__all__ = ['douyutv_download']
from ..common import *
import json
import hashlib
import time
import random
import string
import urllib.parse, urllib.request
def douyutv_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
room_id = url[url.rfind('/')+1:]
json_req... | #!/usr/bin/env python
__all__ = ['douyutv_download']
from ..common import *
import json
import hashlib
import time
import random
import string
import requests
def douyutv_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
room_id = url[url.rfind('/')+1:]
json_request_url = "http://m... | mit | Python |
f682d8de52bc8904b5cc7361e6457ce1ce23855a | fix .spectrum import | hamogu/astrospec,glentner/astrospec | astrospec/__init__.py | astrospec/__init__.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is an Astropy affiliated package.
"""
# Elevate objects to the package level
from .spectrum import Spectrum1D
__all__ = ['Spectrum1D']
# Affiliated packages may add whatever they like to this file, but
# should keep this content at the top... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is an Astropy affiliated package.
"""
# Elevate objects to the package level
from spectrum import Spectrum1D
__all__ = ['Spectrum1D']
# Affiliated packages may add whatever they like to this file, but
# should keep this content at the top.... | bsd-3-clause | Python |
eea71e722f6067eb8b77e74d14a71d137de4ee6f | Update auth.py | pathakvaidehi2391/WorkSpace,pathakvaidehi2391/WorkSpace | azurecloudify/auth.py | azurecloudify/auth.py |
import requests
import json
import urllib2
import time
from lockfile import LockFile
from cloudify import ctx
import constants
def get_token_from_client_credentials():
client_id = ctx.node.properties['client_id']
aad_password = ctx.node.properties['aad_password']
tenant_id = ctx.node.properties['tenant_... |
import requests
import json
import urllib2
import time
from lockfile import LockFile
from cloudify import ctx
import constants
def get_token_from_client_credentials():
client_id = ctx.node.properties['client_id']
aad_password = ctx.node.properties['aad_password']
tenant_id = ctx.node.properties['tenant_... | apache-2.0 | Python |
21da7d358cbeeb88f8beb6aed393734b60b79d43 | Fix some typos | EmadMokhtar/halaqat,EmadMokhtar/halaqat,EmadMokhtar/halaqat | back_office/models.py | back_office/models.py | from django.db import models
from django.utils.translation import ugettext as _
from Django.contrib.auth.models import User
FEMALE = 'F'
MALE = 'M'
class Teacher(models.Model):
"""
Halaqat teachers information
"""
GENDER_CHOICES = (
(MALE, _('Male')),
(FEMALE, _('Female')),
)
... | from django.db import models
from django.utils.translation import ugettext as _
from Django.contrib.auth.models import User
FEMALE = 'F'
MALE = 'M'
class Teacher(models.Model):
"""
halaqat teachers informations
"""
GENDET_CHOICES = (
(MALE, _('Male')),
(FEMALE, _('Female')),
)
... | mit | Python |
d16cbf8994023dba5146ddb38e0db29202bb4614 | Rename the related name for User one-to-one relationship | EmadMokhtar/halaqat,EmadMokhtar/halaqat,EmadMokhtar/halaqat | back_office/models.py | back_office/models.py | from django.db import models
from django.utils.translation import ugettext as _
from Django.contrib.auth.models import User
FEMALE = 'F'
MALE = 'M'
class Teacher(models.Model):
"""
Halaqat teachers information
"""
GENDER_CHOICES = (
(MALE, _('Male')),
(FEMALE, _('Female')),
)
... | from django.db import models
from django.utils.translation import ugettext as _
from Django.contrib.auth.models import User
FEMALE = 'F'
MALE = 'M'
class Teacher(models.Model):
"""
Halaqat teachers information
"""
GENDER_CHOICES = (
(MALE, _('Male')),
(FEMALE, _('Female')),
)
... | mit | Python |
a0e2a373631037d0162c2a0e4f06404c54fc478d | split of cleaner function, add submission | ddboline/kaggle_imdb_sentiment_model,ddboline/kaggle_imdb_sentiment_model | bag_of_words_model.py | bag_of_words_model.py | #!/usr/bin/python
import os
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.ensemble import RandomForestClassifier
from KaggleWord2VecUtility import KaggleWord2VecUtility
import pandas as pd
import numpy as np
def clean_review_function(review):
list_of_words = KaggleWord2VecUtility.review... | #!/usr/bin/python
import os
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.ensemble import RandomForestClassifier
from KaggleWord2VecUtility import KaggleWord2VecUtility
import pandas as pd
import numpy as np
from memory_profiler import profile
@profile
def bag_of_words_model():
labeledt... | mit | Python |
5bd73a81a9befed7aa1256544e02741c8fe609c7 | Update version to 1.1.0 | arteria-project/arteria-bcl2fastq,johanherman/arteria-bcl2fastq,johandahlberg/arteria-bcl2fastq | bcl2fastq/__init__.py | bcl2fastq/__init__.py | __version__ = "1.1.0"
| __version__ = "1.0.0"
| mit | Python |
c86c5aa2e8572a2877c3040438842adeb3112a9f | Add get_time_range | BuzzFeedNews/bikeshares | bikeshares/program.py | bikeshares/program.py | import pandas as pd
class TripSubset(pd.DataFrame):
def by_station(self):
started = self.groupby("start_station").size()
ended = self.groupby("end_station").size()
counts = pd.DataFrame({
"trips_started": started,
"trips_ended": ended,
"trips_total": star... | import pandas as pd
class TripSubset(pd.DataFrame):
def by_station(self):
started = self.groupby("start_station").size()
ended = self.groupby("end_station").size()
counts = pd.DataFrame({
"trips_started": started,
"trips_ended": ended,
"trips_total": star... | mit | Python |
478de126daa521ba5d57abbbd829a2c0e225910c | change tabs to spaces | mjnbike/tapiriik,cgourlay/tapiriik,gavioto/tapiriik,abhijit86k/tapiriik,abs0/tapiriik,cmgrote/tapiriik,campbellr/tapiriik,mduggan/tapiriik,brunoflores/tapiriik,dlenski/tapiriik,campbellr/tapiriik,campbellr/tapiriik,abs0/tapiriik,brunoflores/tapiriik,cgourlay/tapiriik,gavioto/tapiriik,dlenski/tapiriik,niosus/tapiriik,md... | tapiriik/services/sessioncache.py | tapiriik/services/sessioncache.py | from datetime import datetime
from tapiriik.database import redis
import pickle
class SessionCache:
def __init__(self, scope, lifetime, freshen_on_get=False):
self._lifetime = lifetime
self._autorefresh = freshen_on_get
self._scope = scope
self._cacheKey = "sessioncache:%s:%s" % (se... | from datetime import datetime
from tapiriik.database import redis
import pickle
class SessionCache:
def __init__(self, scope, lifetime, freshen_on_get=False):
self._lifetime = lifetime
self._autorefresh = freshen_on_get
self._scope = scope
self._cacheKey = "sessioncache:%s:%s" % (self._scope, "%s")
def Get(... | apache-2.0 | Python |
fc926c87df2a1c22d76a3d7c37b4b446d682a4c2 | Add newline. | ohsu-qin/qipipe | test/unit/pipelines/test_stage.py | test/unit/pipelines/test_stage.py | from nose.tools import *
import os, re, glob, shutil
import logging
logger = logging.getLogger(__name__)
# The test parent directory.
ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
# The test fixture.
FIXTURE = os.path.join(ROOT, 'fixtures', 'pipelines', 'stage')
# The test results paren... | from nose.tools import *
import os, re, glob, shutil
import logging
logger = logging.getLogger(__name__)
# The test parent directory.
ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
# The test fixture.
FIXTURE = os.path.join(ROOT, 'fixtures', 'pipelines', 'stage')
# The test results paren... | bsd-2-clause | Python |
b483e98f6e9120271c8f753506edf970e13f7495 | Fix test import for py26 compat | boto/botocore,pplu/botocore | tests/integration/test_kinesis.py | tests/integration/test_kinesis.py | # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights ... | # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights ... | apache-2.0 | Python |
ec99a09fb316886097bd1cb37fca60334c340be3 | set defaults for each field | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | cla_backend/apps/legalaid/management/commands/obfuscate.py | cla_backend/apps/legalaid/management/commands/obfuscate.py | # -*- coding: utf-8 -*-
from django.core.management.base import NoArgsCommand
from django.core import settings
from legalaid.models import PersonalDetails, ThirdPartyDetails, \
EligibilityCheck, Case, CaseNoteHistory, EODDetails, Complaint
OBFUSCATED_FIELDS = {
PersonalDetails: {
'full_name': 'Fullna... | # -*- coding: utf-8 -*-
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
"""
Obfuscate all sensitive data in db
Personal details:
full_name
postcode
street
mobile_phone
home_phone
email
date_of_birth
ni_nu... | mit | Python |
3256207b07ae0d39cd335c3cdb0d09943255ca5c | remove useless caching | OCA/connector-interfaces,OCA/connector-interfaces | connector_importer/models/sources/source_consumer_mixin.py | connector_importer/models/sources/source_consumer_mixin.py | # Author: Simone Orsi
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class ImportSourceConsumerMixin(models.AbstractModel):
"""Source consumer mixin.
Inheriting models can setup, configure and use import sources.
... | # Author: Simone Orsi
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models, tools
class ImportSourceConsumerMixin(models.AbstractModel):
"""Source consumer mixin.
Inheriting models can setup, configure and use import sources... | agpl-3.0 | Python |
1dcf447e73b5b979670109f87dc53ef07c189a8e | allow for pythonpoint.exe | kanarelo/reportlab,kanarelo/reportlab,kanarelo/reportlab,Distrotech/reportlab,kanarelo/reportlab,Distrotech/reportlab,Distrotech/reportlab,kanarelo/reportlab,Distrotech/reportlab,Distrotech/reportlab | reportlab/test/test_tools_pythonpoint.py | reportlab/test/test_tools_pythonpoint.py | """Tests for the (soon to be) reportlab.tools.pythonpoint package.
"""
import os, sys
from reportlab.test import unittest
from reportlab.test.utils import SecureTestCase
class PythonPointTestCase(SecureTestCase):
"Some very crude tests on PythonPoint."
def test1(self):
"Test if pythonpoint.pdf can be created fro... | """Tests for the (soon to be) reportlab.tools.pythonpoint package.
"""
import os, sys
from reportlab.test import unittest
from reportlab.test.utils import SecureTestCase
class PythonPointTestCase(SecureTestCase):
"Some very crude tests on PythonPoint."
def test1(self):
"Test if pythonpoint.pdf... | bsd-3-clause | Python |
d1201f3ec03849dd976283aeb2c91947df1c4713 | update version | Fahreeve/aiovk,Fahreeve/aiovk,Fahreeve/aiovk | aiovk/__init__.py | aiovk/__init__.py | __version__ = '2.2.0'
from aiovk.sessions import ImplicitSession, TokenSession, AuthorizationCodeSession
from aiovk.api import API
from aiovk.longpoll import LongPoll
| __version__ = '2.1.1'
from aiovk.sessions import ImplicitSession, TokenSession, AuthorizationCodeSession
from aiovk.api import API
from aiovk.longpoll import LongPoll
| mit | Python |
183744497a1a698b6f66052e9270ba3d98f3241f | bump version to 4.0.0 | guardian/alerta,skob/alerta,mrkeng/alerta,skob/alerta,mrkeng/alerta,guardian/alerta,skob/alerta,mrkeng/alerta,mrkeng/alerta,skob/alerta,guardian/alerta,guardian/alerta | alerta/version.py | alerta/version.py | __version__ = '4.0.0'
| __version__ = '3.3.7'
| apache-2.0 | Python |
595b4a728b187b8c01428789f4fa528ae5cd3e3c | Refactor codes | bowen0701/algorithms_data_structures | alg_palindrome.py | alg_palindrome.py | """Palindrome: a string that read the same forward and backward.
For example: radar, madam.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def palindrome_iter(a_str):
"""Check palindrom by left & right match.
Time complexity: O(n).
Space... | """Palindrome: a string that read the same forward and backward.
For example: radar, madam.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def palindrome(a_str):
"""Check palindrom by front & rear match."""
ls = list(a_str)
is_match = Tr... | bsd-2-clause | Python |
566abd65f60e00312ee51db3b3314c29e0160c2f | Move module time to main() | bowen0701/algorithms_data_structures | alg_palindrome.py | alg_palindrome.py | """Palindrome: a string that read the same forward and backward.
For example: radar, madam.
"""
from __future__ import print_function
def match_palindrome(a_str):
"""Check palindrom by front & rear match by Deque."""
from ds_deque import Deque
str_deque = Deque()
for s in a_str:
str_deque.... | """Palindrome: a string that read the same forward and backward.
For example: radar, madam.
"""
from __future__ import print_function
import time
def match_palindrome(a_str):
"""Check palindrom by front & rear match by Deque."""
from ds_deque import Deque
str_deque = Deque()
for s in a_str:
... | bsd-2-clause | Python |
2f3b2b96633107495948d90167d552967963fab2 | make DHT example simple again | nanpy/nanpy | nanpy/examples/dht.py | nanpy/examples/dht.py | #!/usr/bin/env python
# a simple example to read from a DHT sensor
from nanpy import DHT
# http://learn.adafruit.com/dht/connecting-to-a-dhtxx-sensor
# DHT sensor connected to digital pin 10
dht = DHT(10, DHT.DHT22)
print("Temperature is %.2f degrees Celcius" % dht.readTemperature(False))
print("Temperature is %.2f... | #!/usr/bin/env python
# a simple example to read from a DHT sensor
from nanpy import DHT
# http://learn.adafruit.com/dht/connecting-to-a-dhtxx-sensor
# DHT sensor connected to digital pin 10
dhts = [
DHT(6, DHT.DHT11),
DHT(7, DHT.DHT11),
DHT(8, DHT.DHT11)
]
for i, dht in enumerate(dhts):
print("DHT ... | mit | Python |
62f38c4959f4cd0ca4708f7f2d82f2f4e48faf27 | fix typo in travis report | wwu-numerik/scripts,wwu-numerik/scripts,wwu-numerik/scripts | python/travis_report.py | python/travis_report.py | #!/usr/bin/env python3
import os
import format_check as fc
def clang_format_status(dirname):
import requests
token = os.environ['STATUS_TOKEN']
auth = ('ftalbrecht', token)
pr = os.environ['TRAVIS_PULL_REQUEST']
slug = os.environ['TRAVIS_REPO_SLUG']
if pr == 'false':
statuses_url = '... | #!/usr/bin/env python3
import os
import format_check as fc
def clang_format_status(dirname):
import requests
token = os.environ['STATUS_TOKEN']
auth = ('ftalbrecht', token)
pr = os.environ['TRAVIS_PULL_REQUEST']
slug = os.environ['TRAVIS_REPO_SLUG']
if pr == 'false':
statuses_url = '... | bsd-2-clause | Python |
34fe4bb5cd5c4c35a659698e8d258c78da01887a | Add get_users method to get a list of users | rcarrillocruz/pynexus | pynexus/api_client.py | pynexus/api_client.py | import requests
class ApiClient:
def __init__(self, host, username, password):
self.uri = host + '/nexus/service/local/'
self.username = username
self.password = password
def get_all_repositories(self):
r = requests.get(self.uri + 'all_repositories', headers={'Accept': 'applica... | import requests
class ApiClient:
def __init__(self, host, username, password):
self.uri = host + '/nexus/service/local/'
self.username = username
self.password = password
def get_all_repositories(self):
r = requests.get(self.uri + 'all_repositories', headers={'Accept': 'applica... | apache-2.0 | Python |
a03edcca6bb4a2eb1452609e1fab2a29f8b76a11 | Support for multiple accounts | vramirez/Ashgabat-Black,vramirez/Ashgabat-Black | python3/get_statuses.py | python3/get_statuses.py | #A python3 file
import os,configparser,math,sys,time,tweepy,json
config = configparser.RawConfigParser()
config.read('twauth.properties')
consumer_key=config.get('OAuth','key')
consumer_secret=config.get('OAuth','key_secret')
access_key=config.get('OAuth','token')
access_secret=config.get('OAuth','token_secret')
... | #A python3 file
import os,configparser,math,sys,time,tweepy,json
config = configparser.RawConfigParser()
config.read('twauth.properties')
consumer_key=config.get('OAuth','key')
consumer_secret=config.get('OAuth','key_secret')
access_key=config.get('OAuth','token')
access_secret=config.get('OAuth','token_secret')
... | mit | Python |
525fb8baacecde39c8738af4f2e7d37d00a5fe4b | Test ids on some form labels | Yelp/pushmanager,Yelp/pushmanager,asottile/pushmanager,bis12/pushmanager,YelpArchive/pushmanager,YelpArchive/pushmanager,Yelp/pushmanager,asottile/pushmanager,asottile/pushmanager,YelpArchive/pushmanager,imbstack/pushmanager,Yelp/pushmanager,YelpArchive/pushmanager,imbstack/pushmanager,bis12/pushmanager,imbstack/pushma... | tests/test_template_newrequest.py | tests/test_template_newrequest.py | import testing as T
class NewRequestTemplateTest(T.TemplateTestCase):
authenticated = True
newrequest_page = 'modules/newrequest.html'
form_elements = ['title', 'tags', 'review', 'repo', 'branch', 'description', 'comments', 'watchers', 'takeover']
def test_request_form_labels(self):
tree = s... | import testing as T
class NewRequestTemplateTest(T.TemplateTestCase):
authenticated = True
newrequest_page = 'modules/newrequest.html'
form_elements = ['title', 'tags', 'review', 'repo', 'branch', 'description', 'comments', 'watchers', 'takeover']
def test_request_form_labels(self):
tree = s... | apache-2.0 | Python |
51313728da79070ffaae0023fea8d7de976cab71 | Remove debug print | brocaar/pyvertica,spilgames/pyvertica | pyvertica/connection.py | pyvertica/connection.py | import pyodbc
def get_connection(dsn, reconnect=True, **kwargs):
"""
Get :py:mod:`!pyodbc` connection for the given ``dsn``.
Usage example::
from pyvertica.connection import get_connection
connection = get_connection('TestDSN')
cursor = connection.cursor()
The connection w... | import pyodbc
def get_connection(dsn, reconnect=True, **kwargs):
"""
Get :py:mod:`!pyodbc` connection for the given ``dsn``.
Usage example::
from pyvertica.connection import get_connection
connection = get_connection('TestDSN')
cursor = connection.cursor()
The connection w... | bsd-3-clause | Python |
a9dfbd751fbfbe427586886989cf7dc0616f5678 | install lru_cache | dataplumber/nexus,dataplumber/nexus,dataplumber/nexus,dataplumber/nexus,dataplumber/nexus,dataplumber/nexus,dataplumber/nexus | analysis/setup.py | analysis/setup.py | """
Copyright (c) 2016 Jet Propulsion Laboratory,
California Institute of Technology. All rights reserved
"""
import setuptools
__version__ = '1.5'
setuptools.setup(
name="nexusanalysis",
version=__version__,
url="https://github.jpl.nasa.gov/thuang/nexus",
author="Team Nexus",
description="NEXU... | """
Copyright (c) 2016 Jet Propulsion Laboratory,
California Institute of Technology. All rights reserved
"""
import setuptools
__version__ = '1.5'
setuptools.setup(
name="nexusanalysis",
version=__version__,
url="https://github.jpl.nasa.gov/thuang/nexus",
author="Team Nexus",
description="NEXU... | apache-2.0 | Python |
6eeecb5e36e5551ba3a3c35a9c7f52393d2f9d14 | Add simple helper properties to Problem. | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | src/puzzle/problems/problem.py | src/puzzle/problems/problem.py | from src.data import meta
class Problem(object):
def __init__(self, name, lines):
self.name = name
self.lines = lines
self._solutions = None
self._constraints = []
@property
def kind(self):
return str(type(self)).strip("'<>").split('.').pop()
@property
def solution(self):
return se... | from src.data import meta
class Problem(object):
def __init__(self, name, lines):
self.name = name
self.lines = lines
self._solutions = None
self._constraints = []
def constrain(self, fn):
self._constraints.append(fn)
# Invalidate solutions.
self._solutions = None
def solutions(sel... | mit | Python |
a2e4531d3f2708fc70f46754975708ec8b03f766 | Update config.py | AndreiDrang/python-rucaptcha | src/python_rucaptcha/config.py | src/python_rucaptcha/config.py | from typing import Generator
from tenacity import AsyncRetrying, wait_fixed, stop_after_attempt
from requests.adapters import Retry
RETRIES = Retry(total=5, backoff_factor=0.5)
ASYNC_RETRIES = AsyncRetrying(wait=wait_fixed(5), stop=stop_after_attempt(5), reraise=True)
# Application key
APP_KEY = "1899"
# Connection... | from tenacity import AsyncRetrying, wait_fixed, stop_after_attempt
from requests.adapters import Retry
RETRIES = Retry(total=5, backoff_factor=0.5)
ASYNC_RETRIES = AsyncRetrying(wait=wait_fixed(5), stop=stop_after_attempt(5), reraise=True)
# Application key
APP_KEY = "1899"
# Connection retry generator
def connect_g... | mit | Python |
06fa8ec9cd43f331ff0ff49a9fe24bf3316f980b | update test for census models | suriyan/ethnicolr,suriyan/ethnicolr,suriyan/ethnicolr | ethnicolr/tests/test_020_pred_census_ln.py | ethnicolr/tests/test_020_pred_census_ln.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tests for pred_census_ln.py
"""
import os
import shutil
import unittest
import pandas as pd
from ethnicolr.pred_census_ln import pred_census_ln
from . import capture
class TestCensusLn(unittest.TestCase):
def setUp(self):
names = [{'last': 'smith', 'tr... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tests for pred_census_ln.py
"""
import os
import shutil
import unittest
import pandas as pd
from ethnicolr.pred_census_ln import pred_census_ln
from . import capture
class TestCensusLn(unittest.TestCase):
def setUp(self):
names = [{'last': 'smith', 'tr... | mit | Python |
45c462156509806173c7bd497c52f4eb2844ffc8 | Update forms.py | gauravkulkarni96/MicroBlog,gauravkulkarni96/MicroBlog,gauravkulkarni96/MicroBlog | app/forms.py | app/forms.py | from flask_wtf import Form
from wtforms import StringField, DateTimeField,PasswordField, IntegerField
from wtforms.validators import DataRequired
class login(Form):
username=StringField("username",validators=[DataRequired()])
password = PasswordField('password', validators=[DataRequired()])
class post_data(Fo... | from flask_wtf import Form
from wtforms import StringField, DateTimeField,PasswordField, IntegerField
from wtforms validators import DataRequired
class login(Form):
username=StringField("username",validators=[DataRequired()])
password = PasswordField('password', validators=[DataRequired()])
class post_data(Fo... | mit | Python |
a6b9ae61adea5a8bdf36eb824f81283f37df2057 | Update station.py | elailai94/EasyTicket | Source-Code/Station/station.py | Source-Code/Station/station.py | #==============================================================================
# EasyTicket
#
# @description: Module for providing methods to work with Station objects
# @author: Elisha Lai
# @version: 1.3 20/04/2015
#==============================================================================
# Station module (sta... | #==============================================================================
# EasyTicket
#
# @description: Module for providing methods to work with Station objects
# @author: Elisha Lai
# @version: 1.3 20/04/2015
#==============================================================================
# Station module (sta... | mit | Python |
37a6f088af294eb09615c85b9ead0a48f9ce3e30 | Fix optionset import by avoiding provider_key being null | DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug | rdmo/options/imports.py | rdmo/options/imports.py | import logging
from rdmo.conditions.models import Condition
from rdmo.core.imports import (fetch_parents, get_foreign_field,
get_m2m_instances, set_common_fields,
set_lang_field, validate_instance)
from .models import Option, OptionSet
logger = logging.ge... | import logging
from rdmo.conditions.models import Condition
from rdmo.core.imports import (fetch_parents, get_foreign_field,
get_m2m_instances, set_common_fields,
set_lang_field, validate_instance)
from .models import Option, OptionSet
logger = logging.ge... | apache-2.0 | Python |
244b6f24d1940e1b69460847fd5b9e600a700b7b | fix merge | pli1988/portfolioFactory | example.py | example.py | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 8 22:53:50 2014
Author: Peter Li
"""
import portfolioFactory.universe.universe as universe
import portfolioFactory.utils.utils as utils
import portfolioFactory.metrics.riskMetrics as riskMetrics
import portfolioFactory.metrics.retMetrics as retMetrics
import por... | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 8 22:53:50 2014
Author: Peter Li
"""
import portfolioFactory.universe.universe as universe
import portfolioFactory.utils.utils as utils
import portfolioFactory.metrics.riskMetrics as riskMetrics
import portfolioFactory.metrics.retMetrics as retMetrics
import por... | mit | Python |
1f99b16a169c884a54cdfc4c48fd982832d6315d | Update example request | rpersoon/ecmwf-python-client | example.py | example.py | #!/usr/bin/env python
#
# (C) Copyright 2012-2013 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of it... | #!/usr/bin/env python
#
# (C) Copyright 2012-2013 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of it... | apache-2.0 | Python |
2d5bfcbb85508fa4250a45a0097bd1ed182d61f8 | Update safeprint.py | gappleto97/Senior-Project | common/safeprint.py | common/safeprint.py | import multiprocessing, sys, datetime
from common import settings
print_lock = multiprocessing.RLock()
def safeprint(content, verbosity=0):
"""Prints in a thread-lock, taking a single object as an argument"""
string = "[" + str(multiprocessing.current_process().pid) + "] " + datetime.datetime.now().strftime('%... | import multiprocessing, sys, datetime
from common import settings
print_lock = multiprocessing.RLock()
def safeprint(content, verbosity=0):
"""Prints in a thread-lock, taking a single object as an argument"""
string = "[" + str(multiprocessing.current_process().pid) + "] " + datetime.datetime.now().strftime('%... | mit | Python |
e81cc2fa69e96562fa5179a93a6e43cefbfb70ca | Remove useless configs. | soasme/flask-perm,soasme/flask-perm,soasme/flask-perm | example.py | example.py | # -*- coding: utf-8 -*-
from collections import namedtuple
from flask import Flask, g, render_template, abort
from flask_sqlalchemy import SQLAlchemy
from flask_perm import Perm
from flask_script import Manager
app = Flask(__name__)
manager = Manager(app)
db = SQLAlchemy()
perm = Perm()
app.config['DEBUG'] = True
app.... | # -*- coding: utf-8 -*-
from collections import namedtuple
from flask import Flask, g, render_template, abort
from flask_sqlalchemy import SQLAlchemy
from flask_perm import Perm
from flask_script import Manager
app = Flask(__name__)
manager = Manager(app)
db = SQLAlchemy()
perm = Perm()
app.config['DEBUG'] = True
app.... | mit | Python |
aa7f4f2b53c8afb940e9b6ec2a38cb4f8dc69cb8 | bump flask from 1.1.2 to 2.0.0 in /app | macbre/wbc.macbre.net,macbre/wbc.macbre.net,macbre/wbc.macbre.net,macbre/wbc.macbre.net | app/setup.py | app/setup.py | from setuptools import setup, find_packages
# @see https://github.com/pypa/sampleproject/blob/master/setup.py
setup(
name='wbc',
version='0.0.0',
author='Maciej Brencz',
author_email='maciej.brencz@gmail.com',
description='Flask app providing WBC archives API',
url='https://github.com/macbre/wb... | from setuptools import setup, find_packages
# @see https://github.com/pypa/sampleproject/blob/master/setup.py
setup(
name='wbc',
version='0.0.0',
author='Maciej Brencz',
author_email='maciej.brencz@gmail.com',
description='Flask app providing WBC archives API',
url='https://github.com/macbre/wb... | mit | Python |
7ebce409cdf7097d5f03a76467bf1af38fbbb913 | Bump version in opal._version | khchine5/opal,khchine5/opal,khchine5/opal | opal/_version.py | opal/_version.py | __version__ = '0.5.4'
| __version__ = '0.5.3'
| agpl-3.0 | Python |
25efc0348695f1344d51293dc6350407820d84fc | Call Vector2.convert directly in UNARY_OPS | ppb/ppb-vector,ppb/ppb-vector | tests/utils.py | tests/utils.py | from ppb_vector import Vector2
import hypothesis.strategies as st
def vectors(max_magnitude=1e300):
return st.builds(Vector2,
st.floats(min_value=-max_magnitude, max_value=max_magnitude),
st.floats(min_value=-max_magnitude, max_value=max_magnitude)
)
@st.composite
de... | from ppb_vector import Vector2
import hypothesis.strategies as st
def vectors(max_magnitude=1e300):
return st.builds(Vector2,
st.floats(min_value=-max_magnitude, max_value=max_magnitude),
st.floats(min_value=-max_magnitude, max_value=max_magnitude)
)
@st.composite
de... | artistic-2.0 | Python |
23cb767077d782cfb788be563330d513fb0c1f32 | fix 手机models类型变更 | cindywang0728/adminset,cindywang0728/adminset,cindywang0728/adminset | appconf/models.py | appconf/models.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from cmdb.models import Host
class AppOwner(models.Model):
name = models.CharField(u"负责人姓名", max_length=50, unique=True, null=False, blank=False)
phone = models.CharField(u"负责人手机", max_length=3... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from cmdb.models import Host
class AppOwner(models.Model):
name = models.CharField(u"负责人姓名", max_length=30, unique=True, null=False, blank=False)
phone = models.IntegerField(u"负责人手机")
qq = ... | apache-2.0 | Python |
29600a6a73fff0c66e9c9ca7505d29c69ee086f2 | Support for fibonacci tree | libsmelt/Simulator,libsmelt/Simulator,libsmelt/Simulator | graphs/fibonacci.py | graphs/fibonacci.py | # Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013 ETH Zurich.
# Import graphviz
import sys
sys.path.append('..')
sys.path.append('/usr/lib/graphviz/python/')
sys.path.append('/usr/lib64/graphviz/python/')
import gv
import logging
# Import pygraph
from pygraph.classes.graph import graph
from pygraph.classes.dig... | # Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013 ETH Zurich.
# Import graphviz
import sys
sys.path.append('..')
sys.path.append('/usr/lib/graphviz/python/')
sys.path.append('/usr/lib64/graphviz/python/')
import gv
import logging
# Import pygraph
from pygraph.classes.graph import graph
from pygraph.classes.dig... | mit | Python |
b12fe0da6b014dad6bc0d3b6a97e1dd321cb34f8 | 更新版本号:0.1.3 | ddcatgg/dglib | dglib/__init__.py | dglib/__init__.py |
__author__ = 'DDGG'
__version__ = '0.1.3'
__license__ = 'MIT'
|
__author__ = 'DDGG'
__version__ = '0.1.2'
__license__ = 'MIT'
| mit | Python |
e6355cb015b821d94867d6ff59dab4e81ec02207 | update fabfile | ojengwa/ibu,ojengwa/migrate | fabfile.py | fabfile.py | """Summary."""
import re
import ast
from fabric.api import local, task
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('ibu/__init__.py', 'rb') as f:
VERSION = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
@task
def install(version=""):
"""Install pro... | """Summary."""
import re
import ast
from fabric.api import local, task
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('ibu/__init__.py', 'rb') as f:
VERSION = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
@task
def install(version=""):
"""Install pro... | mit | Python |
9b6bdeb0aaa971eedeb13170cd38880a40c97b74 | Change random pick of AI | gl051/tic-tac-toe | tic-tac-toe.py | tic-tac-toe.py | #!/usr/bin/python
"""
Exercise: Implement a Tic-Tac-Toe game
"""
import grid
import random
class TicTacToe(object):
def __init__(self):
self.grid = grid.Grid()
self.game_over = False
self.players = {0: 'User', 1:'AI'}
def user_pick(self):
self.grid.show()
pos_str =... | #!/usr/bin/python
"""
Exercise: Implement a Tic-Tac-Toe game
"""
import grid
import random
class TicTacToe(object):
def __init__(self):
self.grid = grid.Grid()
self.game_over = False
self.players = {0: 'User', 1:'AI'}
def user_pick(self):
self.grid.show()
pos_str =... | mit | Python |
ba079451eb3acfada8b39b574d8dad98317961f6 | Fix src syntax error | tuxxy/SMIRCH | api.py | api.py | import requests
class Teli:
TOKEN = None
SRC_DID = None
API = None
def __init__(self, TOKEN, SRC_DID):
self.TOKEN = TOKEN
self.SRC_DID = SRC_DID
self.API = "https://sms.teleapi.net/{}/send"
def send_sms(self, dest, message, src=self.SRC_DID):
args = {
'... | import requests
class Teli:
TOKEN = None
SRC_DID = None
API = None
def __init__(self, TOKEN, SRC_DID):
self.TOKEN = TOKEN
self.SRC_DID = SRC_DID
self.API = "https://sms.teleapi.net/{}/send"
def send_sms(self, src=self.SRC_DID, dest, message):
args = {
'... | agpl-3.0 | Python |
34443382aed376938ecda345dd08c72327954b4d | Update fabfile | messense/everbean,messense/everbean | fabfile.py | fabfile.py | # coding=utf-8
from __future__ import unicode_literals
import os
from fabric.api import *
base_path = os.path.dirname(__file__)
project_root = "~/projects/everbean"
pip_path = os.path.join(project_root, "bin/pip")
python_path = os.path.join(project_root, "bin/python")
env.user = "messense"
env.hosts = ["messense.me"... | # coding=utf-8
from __future__ import unicode_literals
import os
from fabric.api import *
base_path = os.path.dirname(__file__)
project_root = "~/project/everbean"
pip_path = os.path.join(project_root, "bin/pip")
python_path = os.path.join(project_root, "bin/python")
env.user = "messense"
env.hosts = ["messense.me"]... | mit | Python |
5af1fc8fd10512c8efcedf972feb2fee49e6c26c | Make scan results limited to one per moon per person. | StephenSwat/eve_lunar_mining_organiser,StephenSwat/eve_lunar_mining_organiser | elmo/moon_tracker/models.py | elmo/moon_tracker/models.py | from django.db import models
from django.conf import settings
from django.forms import Select
from eve_sde.models import Moon
# Create your models here.
class ScanResult(models.Model):
owner = models.ForeignKey(
settings.AUTH_USER_MODEL,
related_name='scans',
db_index=True
)
moon ... | from django.db import models
from django.conf import settings
from django.forms import Select
from eve_sde.models import Moon
# Create your models here.
class ScanResult(models.Model):
owner = models.ForeignKey(
settings.AUTH_USER_MODEL,
related_name='scans',
db_index=True
)
moon ... | mit | Python |
8114d2bb83c84c1923009ba19ac35f6af59df5ca | Fix wsgi file. Really should install nginx. | mjtamlyn/archery-scoring,mjtamlyn/archery-scoring,mjtamlyn/archery-scoring,mjtamlyn/archery-scoring,mjtamlyn/archery-scoring | archery.wsgi | archery.wsgi | import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'scoring.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
| import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'src.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
| bsd-3-clause | Python |
cf3c31eca325610de4dd72bac097d41b36d9708f | Migre set var settings to app conf | opps/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,opps/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,opps/opps | opps/core/__init__.py | opps/core/__init__.py | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from appconf import AppConf
trans_app_label = _('Core')
class OppsCoreConf(AppConf):
DEFAULT_URLS = ('127.0.0.1', 'localhost',)
SHORT = 'googl'
SHORT_URL = 'googl.short.GooglUrlShort'
c... | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
trans_app_label = _('Core')
settings.INSTALLED_APPS += (
'opps.channels',
'opps.sources',
'opps.articles',
'opps.images',
'django.contrib.redirects',
'django_thumbor',
'haystac... | mit | Python |
02d8baaef1aefcecb6d0a60bce743bd39f5f6b80 | add missing json import | cooncesean/mixpanel-query-py | mixpanel_query/utils.py | mixpanel_query/utils.py | import json
import six
from six.moves.urllib.parse import urlencode
def _totext(val):
"""
Py2 and Py3 compatible function that coerces
any non-Unicode string types into the official "text type" (unicode in Py2, str in Py3).
For objects that are not binary (str/bytes) or text (unicode/str),
return v... | import six
from six.moves.urllib.parse import urlencode
def _totext(val):
"""
Py2 and Py3 compatible function that coerces
any non-Unicode string types into the official "text type" (unicode in Py2, str in Py3).
For objects that are not binary (str/bytes) or text (unicode/str),
return value is unch... | mit | Python |
cff6b59502c9d4cb95cb661204e3137fe5e17687 | update Django admin fields | deis/workflow,deis/workflow,deis/workflow | controller/api/admin.py | controller/api/admin.py | # -*- coding: utf-8 -*-
"""
Django admin app configuration for Deis API models.
"""
from __future__ import unicode_literals
from django.contrib import admin
from guardian.admin import GuardedModelAdmin
from .models import App
from .models import Build
from .models import Cluster
from .models import Config
from .mod... | # -*- coding: utf-8 -*-
"""
Django admin app configuration for Deis API models.
"""
from __future__ import unicode_literals
from django.contrib import admin
from guardian.admin import GuardedModelAdmin
from .models import App
from .models import Build
from .models import Cluster
from .models import Config
from .mod... | mit | Python |
e0e14acc45198f16a90718ee292c056ebd05cff8 | Use utils.seeding in spaces.space (#1473) | Farama-Foundation/Gymnasium,Farama-Foundation/Gymnasium | gym/spaces/space.py | gym/spaces/space.py | from gym.utils import seeding
class Space(object):
"""Defines the observation and action spaces, so you can write generic
code that applies to any Env. For example, you can choose a random
action.
"""
def __init__(self, shape=None, dtype=None):
import numpy as np # takes about 300-400ms t... | class Space(object):
"""Defines the observation and action spaces, so you can write generic
code that applies to any Env. For example, you can choose a random
action.
"""
def __init__(self, shape=None, dtype=None):
import numpy as np # takes about 300-400ms to import, so we load lazily
... | mit | Python |
9736c02f23ce4fa7941a5a3c98ed9ca8836c4d32 | rename to match scale | rweir/buttle | buttle/tests/test_parser.py | buttle/tests/test_parser.py | import unittest
from buttle.parser import tokenise
class TokeniserTests(unittest.TestCase):
def test_full_tokenise(self):
line = """["Jane" "Doe" nil "Fake Pty Ltd" (["Mobile" "+61 4123 456 789"] ["Home" "61 2 9876 5432"]) nil ("someone@example.com") ((creation-date . "2001-01-01") (timestamp . "2002-02-0... | import unittest
from buttle.parser import tokenise
class TokeniserTests(unittest.TestCase):
def test_tokenise(self):
line = """["Jane" "Doe" nil "Fake Pty Ltd" (["Mobile" "+61 4123 456 789"] ["Home" "61 2 9876 5432"]) nil ("someone@example.com") ((creation-date . "2001-01-01") (timestamp . "2002-02-02")) ... | bsd-3-clause | Python |
bc3cf7bb0ac8e271f8786b9ec982fe1297d0ac93 | Add debugging statements to example_app context. This is to help indicate to users that PALE's example_app is operating. | Loudr/pale | tests/example_app/flask_app.py | tests/example_app/flask_app.py | import logging
import flask
from pale.adapters import flask as pale_flask_adapter
from pale.config import authenticator, context_creator
from tests.example_app import api
@authenticator
def authenticate_pale_context(context):
"""Don't actually authenticate anything in this test."""
logging.debug("pale.exampl... | import flask
from pale.adapters import flask as pale_flask_adapter
from pale.config import authenticator, context_creator
from tests.example_app import api
@authenticator
def authenticate_pale_context(context):
"""Don't actually authenticate anything in this test."""
return context
@context_creator
def cre... | mit | Python |
ab7efebaeb99f53e5122237d03c42e3dd04cfa05 | Update TiedModelRealtimeSignalProcessor to handle m2m relationships | OpenVolunteeringPlatform/django-ovp-search | ovp_search/signals.py | ovp_search/signals.py | from django.db import models
from haystack import signals
from ovp_projects.models import Project
from ovp_organizations.models import Organization
from ovp_core.models import GoogleAddress
class TiedModelRealtimeSignalProcessor(signals.BaseSignalProcessor):
"""
TiedModelRealTimeSignalProcessor handles updates... | from django.db import models
from haystack import signals
from ovp_projects.models import Project
from ovp_organizations.models import Organization
from ovp_core.models import GoogleAddress
class TiedModelRealtimeSignalProcessor(signals.BaseSignalProcessor):
"""
TiedModelRealTimeSignalProcessor handles updates... | agpl-3.0 | Python |
7d5d4fa735fa5a2d07fbeaa36e50a59b7be29927 | Add game suspend/resume basics. | rave-engine/rave | rave/game.py | rave/game.py | """
rave game module.
This contains the code that ties everything together to run a single game.
"""
import threading
import rave.log
import rave.filesystem
import rave.execution
import rave.events
# The engine game!
engine = None
def current():
""" Get currently running game. This is a convenience wrapper for r... | """
rave game module.
This contains the code that ties everything together to run a single game.
"""
import rave.filesystem
import rave.execution
import rave.events
# The engine game!
engine = None
def current():
""" Get currently running game. This is a convenience wrapper for rave.execution.current(). """
... | bsd-2-clause | Python |
b857ebb34a3ab528c83d06f9b0285e12ea689628 | add print time | xiongtiancheng/jpush-docs,dengyhgit/jpush-docs,Aoyunyun/jpush-docs,xiongtiancheng/jpush-docs,dengyhgit/jpush-docs,war22moon/jpush-docs,xiongtiancheng/jpush-docs,Nocturnana/jpush-docs,raoxudong/jpush-docs,raoxudong/jpush-docs,xiongtiancheng/jpush-docs,war22moon/jpush-docs,Aoyunyun/jpush-docs,raoxudong/jpush-docs,Nocturn... | autobuild.py | autobuild.py | import commands
import os
import time
def git_pull():
print (os.chdir("/opt/push/jpush-docs/jpush-docs/"))
print (commands.getstatusoutput("git pull origin renew"))
print ("git pull origin renew")
def set_venv():
print (os.chdir("/opt/push/jpush-docs/"))
print (commands.getstatusoutput(". venv/bin... | import commands
import os
import time
def git_pull():
print (os.chdir("/opt/push/jpush-docs/jpush-docs/"))
print (commands.getstatusoutput("sudo git pull origin renew"))
print ("git pull origin renew")
def set_venv():
print (os.chdir("/opt/push/jpush-docs/"))
print (commands.getstatusoutput(". ven... | mit | Python |
7608878ff2de78cae1f5b2f55478c135f09d6d15 | Remove unused imports | toslunar/chainerrl,toslunar/chainerrl | fc_tail_policy.py | fc_tail_policy.py | import chainer
from chainer import links as L
import policy
class FCTailPolicy(chainer.ChainList, policy.SoftmaxPolicy):
def __init__(self, head, head_output_size, n_actions=18):
layers = [
head.copy(),
L.Linear(head_output_size, n_actions),
]
super(FCTailPolicy, ... | import numpy as np
import chainer
from chainer import functions as F
from chainer import links as L
import policy
import dqn_net
class FCTailPolicy(chainer.ChainList, policy.SoftmaxPolicy):
def __init__(self, head, head_output_size, n_actions=18):
layers = [
head.copy(),
L.Linea... | mit | Python |
8ee50deac62f76277c4cf5677cd5475eb93da4f3 | Drop constraint (#17275) | apache/incubator-superset,airbnb/caravel,apache/incubator-superset,zhouyao1994/incubator-superset,apache/incubator-superset,airbnb/caravel,apache/incubator-superset,zhouyao1994/incubator-superset,airbnb/caravel,zhouyao1994/incubator-superset,zhouyao1994/incubator-superset,apache/incubator-superset,zhouyao1994/incubator... | superset/migrations/versions/b92d69a6643c_rename_csv_to_file.py | superset/migrations/versions/b92d69a6643c_rename_csv_to_file.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 | Python |
160bd9151b96bd22a5dfab1cb9e1ed5ef97f1804 | Bump version | getavalon/core,mindbender-studio/core,mindbender-studio/core,getavalon/core | avalon/version.py | avalon/version.py | """Version includes the Git revision number
This module separates between deployed and development versions of allzpark.
A development version draws its minor version directly from Git, the total
number of commits on the current branch equals the revision number. Once
deployed, this number is embedded into the Python ... | """Version includes the Git revision number
This module separates between deployed and development versions of allzpark.
A development version draws its minor version directly from Git, the total
number of commits on the current branch equals the revision number. Once
deployed, this number is embedded into the Python ... | mit | Python |
f704ff7d31b1e6007fd2c97e56fa0b9097843cf4 | Make 'fab clean' also do a 'git gc --prune'. | bspink/fabric,felix-d/fabric,rane-hs/fabric-py3,kmonsoor/fabric,bitmonk/fabric,mathiasertl/fabric,cmattoon/fabric,itoed/fabric,rbramwell/fabric,cgvarela/fabric,xLegoz/fabric,opavader/fabric,amaniak/fabric,getsentry/fabric,pashinin/fabric,elijah513/fabric,qinrong/fabric,tekapo/fabric,bitprophet/fabric,sdelements/fabric,... | fabfile.py | fabfile.py |
# fabfile.py - A fabfile for Fabric itself.
# Copyright (C) 2008 Christian Vest Hansen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) ... |
# fabfile.py - A fabfile for Fabric itself.
# Copyright (C) 2008 Christian Vest Hansen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) ... | bsd-2-clause | Python |
76eb16f32adbf18207c7c24bae4108b00e43c4c5 | Add STM32F746 disco board as a test platform (#7863) | dmlc/tvm,Laurawly/tvm-1,Laurawly/tvm-1,Laurawly/tvm-1,dmlc/tvm,Laurawly/tvm-1,Laurawly/tvm-1,dmlc/tvm,dmlc/tvm,dmlc/tvm,Laurawly/tvm-1,Laurawly/tvm-1,Laurawly/tvm-1,Laurawly/tvm-1,dmlc/tvm,dmlc/tvm,Laurawly/tvm-1,dmlc/tvm,dmlc/tvm | tests/micro/zephyr/conftest.py | tests/micro/zephyr/conftest.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 | Python |
341182ee63a7205e4e28cba2b5ae21db310d6012 | Fix pep8 issues | jrsmith3/refmanage | refmanage/fs_utils.py | refmanage/fs_utils.py | # -*- coding: utf-8 -*-
import os
import glob
import pathlib2 as pathlib
from pybtex.database.input import bibtex
def handle_files_args(*paths_args):
"""
Handle file(s) arguments from command line
This method takes the string(s) which were passed to the cli which indicate the files on which to operate. I... | # -*- coding: utf-8 -*-
import os
import glob
import pathlib2 as pathlib
from pybtex.database.input import bibtex
def handle_files_args(*paths_args):
"""
Handle file(s) arguments from command line
This method takes the string(s) which were passed to the cli which indicate the files on which to operate. I... | mit | Python |
a1fb610693910df19cfde00876821287acb2b8c3 | Improve requirements/compile.py (#330) | adamchainz/patchy | requirements/compile.py | requirements/compile.py | #!/usr/bin/env python
import os
import subprocess
import sys
from pathlib import Path
if __name__ == "__main__":
os.chdir(Path(__file__).parent)
os.environ["CUSTOM_COMPILE_COMMAND"] = "requirements/compile.py"
os.environ.pop("PIP_REQUIRE_VIRTUALENV")
common_args = [
"-m",
"piptools",
... | #!/usr/bin/env python
import os
import subprocess
import sys
from pathlib import Path
if __name__ == "__main__":
os.chdir(Path(__file__).parent)
os.environ["CUSTOM_COMPILE_COMMAND"] = "requirements/compile.py"
os.environ.pop("PIP_REQUIRE_VIRTUALENV")
common_args = ["-m", "piptools", "compile", "--gener... | mit | Python |
7b2a6a57d3bb84a8e8fb7723921a9d61547cf25b | Update widgets.py | gsiegman/django-paintstore,jamescw/django-paintstore,jamescw/django-paintstore,RDXT/django-paintstore,gsiegman/django-paintstore,RDXT/django-paintstore | paintstore/widgets.py | paintstore/widgets.py | from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
class ColorPickerWidget(forms.TextInput):
class Media:
css = {
"all": ("%s/%s" % (settings.STATIC_URL, "paintstore/css/colorpicker.css"),)
}
js = (
... | from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
class ColorPickerWidget(forms.TextInput):
class Media:
css = {
"all": ("%s/%s" % (settings.STATIC_URL, "paintstore/css/colorpicker.css"),)
}
js = (
... | mit | Python |
1190473e0d36a169a384c9952291d29c385f9a72 | Update test case | uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers | dthm4kaiako/conftest.py | dthm4kaiako/conftest.py | """Module for configuring pytest."""
import pytest
from django.conf import settings
from django.test import RequestFactory
from users.models import User
from tests.users.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(tmpdir):
"""Pytest setup for media storage."""
settings.MEDIA... | """Module for configuring pytest."""
import pytest
from django.conf import settings
from django.test import RequestFactory
from users.models import User
from tests.users.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings=settings, tmpdir=''):
"""Pytest setup for media storage.... | mit | Python |
a4c0c5e03f06d559cbf7a3b28fe39804df2674d6 | update tests for convore object system | kennethreitz-archive/python-convore | test_convore.py | test_convore.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import convore
class ConvoreTestSuite(unittest.TestCase):
"""Requests test cases."""
def setUp(self):
pass
def tearDown(self):
pass
def test_convore_login(self):
_convore = convore.Convore('requeststest', 'r... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import convore
class ConvoreTestSuite(unittest.TestCase):
"""Requests test cases."""
def setUp(self):
pass
def tearDown(self):
pass
def test_convore_login(self):
convore.login('requeststest', 'requeststest')... | isc | Python |
37129ca9f20bf21acf97900eca30ee245c03dbde | Update tutorial 1 to demo storing/loading oauth token via pickle. | awangga/tweepy,kskk02/tweepy,tuxos/tweepy,bconnelly/tweepy,xrg/tweepy,LikeABird/tweepy,takeshineshiro/tweepy,srimanthd/tweepy,markunsworth/tweepy,svven/tweepy,abhishekgahlot/tweepy,arunxarun/tweepy,edsu/tweepy,vishnugonela/tweepy,tweepy/tweepy,aganzha/tweepy,sa8/tweepy,nickmalleson/tweepy,tsablic/tweepy,IsaacHaze/tweep... | tutorial/t1.py | tutorial/t1.py | from getpass import getpass
import cPickle as pickle
import tweepy
""" Tutorial 1 -- Authentication
Tweepy supports both basic auth and OAuth authentication. It is
recommended you use OAuth so you can be more secure and also
set a custom "from xxx" for you application.
Authentication is handled by AuthHandler inst... | from getpass import getpass
import tweepy
""" Tutorial 1 -- Authentication
Tweepy supports both basic auth and OAuth authentication. It is
recommended you use OAuth so you can be more secure and also
set a custom "from xxx" for you application.
Authentication is handled by AuthHandler instances. You must either
cr... | mit | Python |
f8b5dfcb953f2904f85e95d87379be733c61cb10 | Add an iterative version of twineTables that calculates only the minimum set of fields required for a given record before returning that record. Allows for lower latency in processing large incoming record-sets. | mmattice/TwistedSNMP | twinetables.py | twinetables.py | """Convert indexed tabular sets into convenient format
By default, getTable( [roots] ) returns a dictionary structure
like this:
rootOID: { fullOID:value }
however, tables in SNMP Agents are often indexed by equal
extensions to the root OID, so that fullOIDs x.3 and y.3 will
refer to the same described phenomena. t... | """Convert indexed tabular sets into convenient format
By default, getTable( [roots] ) returns a dictionary structure
like this:
rootOID: { fullOID:value }
however, tables in SNMP Agents are often indexed by equal
extensions to the root OID, so that fullOIDs x.3 and y.3 will
refer to the same described phenomena. t... | bsd-3-clause | Python |
eec46801f07ecdebe19df5447d4c967dcf66da37 | Update square.py | Kaceykaso/design_by_roomba,Kaceykaso/design_by_roomba | python/square.py | python/square.py | #! /usr/bin/env python
# Square script
# Executed when asked to draw a square by the user
# Draws a 12 inch square
import serial
import create
from time import strftime
# Create robot
robot = create.Create("/dev/ttyUSB0")
robot.toFullMode()
# Record current position, at start of drawing
pose = robot.getPose()
now = ... | #! /usr/bin/env python
# Square script
# Executed when asked to draw a square by the user
# Draws a 12 inch square
import serial
import create
from time import strftime
# Create robot
robot = create.Create("/dev/ttyUSB0")
robot.toFullMode()
# Record current position, at start of drawing
pose = robot.getPose()
now = ... | mit | Python |
72ec5447bb7389ff9d23a0c8d5aa5eaaa0d90052 | update sys for vm deploy | codeforamerica/courtbot-reporter,codeforamerica/courtbot-reporter,codeforamerica/courtbot-reporter,kuanb/atl_zoink,kuanb/atl_zoink,codeforamerica/courtbot-reporter | pyv/searchall.py | pyv/searchall.py | from datetime import timedelta, date
import urllib2
import csv
csv.field_size_limit(1000000000)
import sqlite3 as lite
import sys
con = None
# housekeeping to get the db set up and clean
con = lite.connect("all.db")
try:
cur = con.cursor()
cur.execute("DROP TABLE IF EXISTS allatl")
cur.execute("CREATE TABLE alla... | from datetime import timedelta, date
import urllib2
import csv
csv.field_size_limit(1000000000)
import sqlite3 as lite
import sys
con = None
# housekeeping to get the db set up and clean
con = lite.connect("all.db")
with con:
cur = con.cursor()
cur.execute("DROP TABLE IF EXISTS allatl")
cur.execute("CREATE TABLE... | mit | Python |
2ca726622203be7c4d6c8f8cd6ae7c4bef0de1a2 | bump version to 3.3.4.1 | vialectrum/vialectrum,pooler/electrum-ltc,vialectrum/vialectrum,pooler/electrum-ltc,vialectrum/vialectrum,pooler/electrum-ltc,pooler/electrum-ltc | electrum_ltc/version.py | electrum_ltc/version.py | ELECTRUM_VERSION = '3.3.4.1' # version of the client package
APK_VERSION = '3.3.4.1' # read by buildozer.spec
PROTOCOL_VERSION = '1.4' # protocol version requested
# The hash of the mnemonic seed must begin with this
SEED_PREFIX = '01' # Standard wallet
SEED_PREFIX_SW = '100' # Segwit wal... | ELECTRUM_VERSION = '3.3.4' # version of the client package
APK_VERSION = '3.3.4.0' # read by buildozer.spec
PROTOCOL_VERSION = '1.4' # protocol version requested
# The hash of the mnemonic seed must begin with this
SEED_PREFIX = '01' # Standard wallet
SEED_PREFIX_SW = '100' # Segwit wal... | mit | Python |
8c1254e8a541ee33e4fdd86bfbd6377bf6cf1ff9 | fix bug | rosix-ru/django-reportapi,rosix-ru/django-reportapi,rosix-ru/django-reportapi,rosix-ru/django-reportapi | reportapi/managers.py | reportapi/managers.py | # -*- coding: utf-8 -*-
#
# reportapi/managers.py
#
# Copyright 2014 Grigoriy Kramarenko <root@rosix.ru>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the Licens... | # -*- coding: utf-8 -*-
#
# reportapi/managers.py
#
# Copyright 2014 Grigoriy Kramarenko <root@rosix.ru>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the Licens... | agpl-3.0 | Python |
d0d567a269cba96193532ae5f64fa6434993b71f | Fix randn function call | rmsare/scarplet,stgl/scarplet | tests/test_WindowedTemplate.py | tests/test_WindowedTemplate.py |
import unittest
import math
import numpy as np
from osgeo import gdal, osr, ogr
DEFAULT_EPSG = 32610 # UTM 10N
class WindowedTemplateTestCase(unittest.TestCase):
class ScarpTestCase(unittest.TestCase):
class MorletTestCase(unittest.TestCase):
def generate_synthetic_scarp(a, b, kt, nx, ny, de=1, sig2=0, t... |
import unittest
import math
import numpy as np
from osgeo import gdal, osr, ogr
DEFAULT_EPSG = 32610 # UTM 10N
class WindowedTemplateTestCase(unittest.TestCase):
class ScarpTestCase(unittest.TestCase):
class MorletTestCase(unittest.TestCase):
def generate_synthetic_scarp(a, b, kt, nx, ny, de=1, sig2=0, t... | mit | Python |
eee55aec2638050e8f9a1c9953515b172d06ea51 | Add exports in __init__ | saaros/kafka-python,xiaosl/kafka-python,rdiomar/kafka-python,alexzhang2015/kafka-python,duanhongyi/kakfa,ohmu/kafka-python,vshlapakov/kafka-python,vshlapakov/kafka-python,grue/kafka-python,reAsOn2010/kafka-python,Yelp/kafka-python,docker-hub/kafka-python,coldeasy/kafka-python,docker-hub/kafka-python,nmandavia/kafka-pyt... | kafka/__init__.py | kafka/__init__.py | __title__ = 'kafka'
__version__ = '0.2-alpha'
__author__ = 'David Arthur'
__license__ = 'Apache License 2.0'
__copyright__ = 'Copyright 2012, David Arthur under Apache License, v2.0'
from kafka.client import KafkaClient
from kafka.conn import KafkaConnection
from kafka.protocol import (
create_message, create_gzip... | __title__ = 'kafka'
__version__ = '0.2-alpha'
__author__ = 'David Arthur'
__license__ = 'Apache License 2.0'
__copyright__ = 'Copyright 2012, David Arthur under Apache License, v2.0'
from kafka.client import KafkaClient
from kafka.conn import KafkaConnection
from kafka.protocol import (
create_message, create_gzip... | apache-2.0 | Python |
9adebd145825355d39502ead808c20a67ab68969 | fix complete run configs | phsmit/iwclul2016-scripts,phsmit/iwclul2016-scripts,phsmit/iwclul2016-scripts | 03_lmtraining/configs/complete/gen_configs.py | 03_lmtraining/configs/complete/gen_configs.py | #!/usr/bin/env python3
for lang in ("sme", "est", "fin"):
for gender in ("M", "F"):
for tool in ("s", "v"):
for order in range(5,9):
for type in ("m", "w"):
with open("{}{}_cow_{}_{}g_{}.sh".format(lang,gender,tool,order,type), 'w') as f:
... | #!/usr/bin/env python3
for lang in ("sme", "est", "fin"):
for gender in ("M", "F"):
for tool in ("s", "v"):
for order in range(5,9):
for type in ("m", "w"):
with open("{}{}_cow_{}_{}g_{}.sh".format(lang,gender,tool,order,type), 'w') as f:
... | bsd-3-clause | Python |
0d89712bda6e85901e839dec3e639c16aea42d48 | Fix tests failing with Python 3 | tuffnatty/drf-proxy-pagination | tests/test_proxy_pagination.py | tests/test_proxy_pagination.py | import json
from django.test import TestCase
from django.utils import six
from rest_framework import status
from tests.models import TestModel
class ProxyPaginationTests(TestCase):
"""
Tests for drf-proxy-pagination
"""
def setUp(self):
for n in range(200):
TestModel.objects.cre... | import json
from django.test import TestCase
from rest_framework import status
from tests.models import TestModel
class ProxyPaginationTests(TestCase):
"""
Tests for drf-proxy-pagination
"""
def setUp(self):
for n in range(200):
TestModel.objects.create(n=n)
def test_withou... | mit | Python |
8df7a212dfe557b814617a1861b5b928bba3cdd9 | Change logging to always log on DEBUG to file | stevepiercy/cookiecutter,audreyr/cookiecutter,pjbull/cookiecutter,pjbull/cookiecutter,dajose/cookiecutter,audreyr/cookiecutter,luzfcb/cookiecutter,terryjbates/cookiecutter,michaeljoseph/cookiecutter,michaeljoseph/cookiecutter,dajose/cookiecutter,hackebrot/cookiecutter,luzfcb/cookiecutter,stevepiercy/cookiecutter,hackeb... | cookiecutter/log.py | cookiecutter/log.py | # -*- coding: utf-8 -*-
import logging
LOG_LEVELS = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL,
}
LOG_FORMATS = {
'DEBUG': u'%(levelname)s [%(template)s] %(name)s: %(message)s',
'INFO': u'%(levelname)s: ... | # -*- coding: utf-8 -*-
import logging
LOG_LEVELS = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL,
}
LOG_FORMATS = {
'DEBUG': u'%(levelname)s [%(template)s] %(name)s: %(message)s',
'INFO': u'%(levelname)s: ... | bsd-3-clause | Python |
787f55e513338c61615fe251f0fc6a9368c85bd8 | Fix Netgear update entity (#75496) | nkgilley/home-assistant,w1ll1am23/home-assistant,mezz64/home-assistant,w1ll1am23/home-assistant,mezz64/home-assistant,nkgilley/home-assistant | homeassistant/components/netgear/update.py | homeassistant/components/netgear/update.py | """Update entities for Netgear devices."""
from __future__ import annotations
import logging
from typing import Any
from homeassistant.components.update import (
UpdateDeviceClass,
UpdateEntity,
UpdateEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import Home... | """Update entities for Netgear devices."""
from __future__ import annotations
import logging
from typing import Any
from homeassistant.components.update import (
UpdateDeviceClass,
UpdateEntity,
UpdateEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import Home... | apache-2.0 | Python |
536718625d27a2d03a1c03db69404fa149d48982 | Add horizon overrides enabled file. | Martin819/salt-formula-horizon,openstack/salt-formula-horizon,openstack/salt-formula-horizon,Martin819/salt-formula-horizon,Martin819/salt-formula-horizon,openstack/salt-formula-horizon | horizon/files/enabled/horizon_overrides.py | horizon/files/enabled/horizon_overrides.py |
ADD_INSTALLED_APPS = [
'horizon_overrides',
]
| apache-2.0 | Python | |
14d445a3bb6c29730dc0608c8d11616a8e617ea9 | destroy the pool | thefab/tornadis,thefab/tornadis | examples/context_manager.py | examples/context_manager.py | import tornado
import tornadis
@tornado.gen.coroutine
def ping_redis(pool, num):
with (yield pool.connected_client()) as client:
# client is a connected tornadis.Client instance
# it will be automatically released to the pool thanks to the
# "with" keyword
reply = yield client.call... | import tornado
import tornadis
@tornado.gen.coroutine
def ping_redis(pool, num):
with (yield pool.connected_client()) as client:
# client is a connected tornadis.Client instance
# it will be automatically released to the pool thanks to the
# "with" keyword
reply = yield client.call... | mit | Python |
2216316b0f30558d6770c50e637d13431ca14e76 | test that checks if last redirect corresponds to the rendered node (page displayed) | viper-framework/har2tree,viper-framework/har2tree,viper-framework/har2tree | tests/simple_test.py | tests/simple_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from har2tree import CrawledTree, Har2Tree, HarFile
from pathlib import Path
import datetime
import os
import uuid
class SimpleTest(unittest.TestCase):
http_redirect_ct: CrawledTree
@classmethod
def setUpClass(cls) -> None:
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from har2tree import CrawledTree, Har2Tree
from pathlib import Path
import datetime
import os
import uuid
class SimpleTest(unittest.TestCase):
http_redirect_ct: CrawledTree
@classmethod
def setUpClass(cls) -> None:
t... | bsd-3-clause | Python |
e5fa5d45d476f6ab85d715d905e9c8af625c0cdc | Split decorators test into smaller units | JohnMaguire/Cardinal,BiohZn/Cardinal | cardinal/test_decorators.py | cardinal/test_decorators.py | import pytest
import decorators
def test_command():
# ensure commands is a list with foo added
@decorators.command('foo')
def foo():
pass
assert foo.commands == ['foo']
# test that you can pass a list
@decorators.command(['foo', 'bar'])
def foo():
pass
assert foo.com... | import pytest
import decorators
def test_command():
# ensure commands is a list with foo added
@decorators.command('foo')
def foo():
pass
assert foo.commands == ['foo']
# test that you can pass a list
@decorators.command(['foo', 'bar'])
def foo():
pass
assert foo.com... | mit | Python |
380c2feaf4934e36f2f812e767a8b8420cc7a55d | fix wording in test_config | axelhodler/notesdude,axelhodler/notesdude | tests/test_config.py | tests/test_config.py | import os.path
import ConfigParser
CONFIG_FILE = 'user.cfg'
class TestConfigFile():
def test_if_config_exists(self):
assert os.path.isfile(CONFIG_FILE), "config file does not exist"
def test_if_config_section_exists(self):
config = ConfigParser.RawConfigParser()
try:
confi... | import os.path
import ConfigParser
CONFIG_FILE = 'user.cfg'
class TestConfigFile():
def test_if_config_exists(self):
assert os.path.isfile(CONFIG_FILE), "config file does not exist"
def test_if_config_header_exists(self):
config = ConfigParser.RawConfigParser()
try:
config... | mit | Python |
1da97c39f5903f5566ddc89558652a5486f27912 | Fix flaky ls test. (#427) | Toblerity/Fiona,rbuffat/Fiona,Toblerity/Fiona,rbuffat/Fiona | tests/test_fio_ls.py | tests/test_fio_ls.py | """Unittests for `$ fio ls`"""
import json
import sys
import os
from click.testing import CliRunner
import pytest
import fiona
from fiona.fio.main import main_group
DATA_DIR = os.path.join("tests", "data")
def test_fio_ls_single_layer():
result = CliRunner().invoke(main_group, [
'ls',
DATA_DIR]... | """Unittests for `$ fio ls`"""
import json
import sys
import os
from click.testing import CliRunner
import pytest
import fiona
from fiona.fio.main import main_group
DATA_DIR = os.path.join("tests", "data")
def test_fio_ls_single_layer():
result = CliRunner().invoke(main_group, [
'ls',
DATA_DIR]... | bsd-3-clause | Python |
375ab8d0cf76d3f989996f76173e1bca90a53fd6 | add config settings to app | samtx/whatsmyrankine,samtx/whatsmyrankine,samtx/whatsmyrankine,samtx/whatsmyrankine,samtx/whatsmyrankine | app.py | app.py | from flask import Flask
from flask.ext.runner import Runner
app = Flask(__name__)
app.config.from_object(os.environ['APP_SETTINGS'])
runner = Runner(app)
@app.route('/')
def hello():
return "Hello World!"
@app.route('/<name>')
def hello_name(name):
return "Hello {}!".format(name)
if __name__=='__main__':
... | from flask import Flask
from flask.ext.runner import Runner
app = Flask(__name__)
runner = Runner(app)
@app.route('/')
def hello():
return "Hello World!"
@app.route('/<name>')
def hello_name(name):
return "Hello {}!".format(name)
if __name__=='__main__':
runner.run()
| mit | Python |
b4243c25d40e2f19a8c11509b528df5e23480582 | Add useful function to path_munging.py | dangall/Kaggle-MobileODT-Cancer-Screening | modules/path_munging.py | modules/path_munging.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 27 11:26:31 2017
@author: daniele
"""
import os
def all_image_paths(folderpath):
"""
Returns a list of filenames containing 'jpg'. The returned list has
sublists with filenames, where each sublist is a different folder.
"""
im... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 27 11:26:31 2017
@author: daniele
"""
import os
def all_image_paths(folderpath):
"""
Returns a list of filenames containing 'jpg'. The returned list has
sublists with filenames, where each sublist is a different folder.
"""
im... | mit | Python |
f555f7e48d63fb37a1d1ecaab0fed6ba3ea7c7c3 | Fix syntax error | mitsuhiko/celery,ask/celery,frac/celery,frac/celery,mitsuhiko/celery,WoLpH/celery,ask/celery,cbrepo/celery,WoLpH/celery,cbrepo/celery | celery/contrib/coroutine.py | celery/contrib/coroutine.py | import time
from collections import deque
from celery.task.base import Task
class CoroutineTask(Task):
abstract = True
_current_gen = None
def body(self):
while True:
args, kwargs = (yield)
yield self.run(*args, **kwargs)
def run(self, *args, **kwargs):
try:
... | import time
from collections import deque
from celery.task.base import Task
class CoroutineTask(Task):
abstract = True
_current_gen = None
def body(self):
while True:
args, kwargs = (yield)
yield self.run(*args, *kwargs)
def run(self, *args, **kwargs):
try:
... | bsd-3-clause | Python |
8eb78be724ad53c5e423015bef41ed0f105aed11 | Fix order of imports | gotling/mopidy-auto,gotling/mopidy-auto,gotling/mopidy-auto | mopidy_auto/__init__.py | mopidy_auto/__init__.py | from __future__ import unicode_literals
import logging
import os
from mopidy import config, ext
import tornado.web
from .web import IndexHandler, MoveHandler, VolumeHandler
__version__ = '0.3.0'
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = 'Mopidy-Auto'
ext_name = 'a... | from __future__ import unicode_literals
import logging
import os
from mopidy import config, ext
import tornado.web
from .web import IndexHandler, VolumeHandler, MoveHandler
__version__ = '0.3.0'
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = 'Mopidy-Auto'
ext_name = 'a... | mit | Python |
ad75e4571fcf4183398b77647c97d6866668e060 | Add more logging. | elielsardanons/dstar_sniffer,elielsardanons/dstar_sniffer | dstar_sniffer/aprs_lib/aprsis.py | dstar_sniffer/aprs_lib/aprsis.py | import aprslib
import logging
import nmea
from passcode import passcode_generator
from ..util_lib import config
def to_aprs_callsign(dstar_callsign):
module = dstar_callsign[-1:]
return dstar_callsign[:-1].strip() + "-" + module
def aprsis_dstar_callback(dstar_stream):
# only send beacon from Kenwood D74
if 'D74... | import aprslib
import logging
import nmea
from passcode import passcode_generator
from ..util_lib import config
def to_aprs_callsign(dstar_callsign):
module = dstar_callsign[-1:]
return dstar_callsign[:-1].strip() + "-" + module
def aprsis_dstar_callback(dstar_stream):
# only send beacon from Kenwood D74
if 'D74... | mit | Python |
86f957d8eb6b40aa48c4045f9a5356253413fc59 | fix bezier widget type name | missionpinball/mpf-mc,missionpinball/mpf-mc,missionpinball/mpf-mc | mpfmc/widgets/bezier.py | mpfmc/widgets/bezier.py | from kivy.graphics import Line as KivyLine
from kivy.graphics.context_instructions import Color
from kivy.uix.widget import Widget
from mpfmc.uix.widget import MpfWidget
class Bezier(MpfWidget, Widget):
widget_type_name = 'Bezier'
def __init__(self, mc, config, key=None, **kwargs):
super().__init__(... | from kivy.graphics import Line as KivyLine
from kivy.graphics.context_instructions import Color
from kivy.uix.widget import Widget
from mpfmc.uix.widget import MpfWidget
class Bezier(MpfWidget, Widget):
widget_type_name = 'Line'
def __init__(self, mc, config, key=None, **kwargs):
super().__init__(mc... | mit | Python |
b0ec7b03b52f90ace8e6fb9c0b96609bf9687ce1 | make test parameters more descriptive | weirdgiraffe/plugin.video.giraffe.seasonvar | tests/test_screen.py | tests/test_screen.py | # coding: utf-8
#
# Copyright © 2017 weirdgiraffe <giraffe@cyberzoo.xyz>
#
# Distributed under terms of the MIT license.
#
import pytest
import re
from datetime import datetime, timedelta
from screen import render_screen
from kodi import Plugin
from mock_kodi.xbmcplugin import directory
assert pytest
def strip_colo... | # coding: utf-8
#
# Copyright © 2017 weirdgiraffe <giraffe@cyberzoo.xyz>
#
# Distributed under terms of the MIT license.
#
import pytest
import re
from datetime import datetime, timedelta
from screen import render_screen
from kodi import Plugin
from mock_kodi.xbmcplugin import directory
assert pytest
def strip_colo... | mit | Python |
1edc627cdf9faf797465b07e4e7912d5efc703ee | Add test for language ID upgrade function | caleb531/youversion-suggest,caleb531/youversion-suggest | tests/test_shared.py | tests/test_shared.py | # tests.test_shared
from __future__ import unicode_literals
import tests
import yvs.shared as yvs
import nose.tools as nose
from gzip import GzipFile
from StringIO import StringIO
from mock import Mock, NonCallableMock, patch
from tests.decorators import use_user_prefs
with open('tests/html/psa.23.html') as html_fil... | # tests.test_shared
from __future__ import unicode_literals
import tests
import yvs.shared as yvs
import nose.tools as nose
from gzip import GzipFile
from StringIO import StringIO
from mock import Mock, NonCallableMock, patch
with open('tests/html/psa.23.html') as html_file:
html_content = html_file.read()
pa... | mit | Python |
650a3c305540b98901d353fbcd2e9633da694a7e | use kemap | baverman/fmd | fmd/app.py | fmd/app.py | import gtk
from uxie.actions import KeyMap
from uxie.floating import Manager as FeedbackManager
from uxie.plugins import Manager as PluginManager
import filelist
import clipboard
import fsutils
keymap = KeyMap()
keymap.map_generic('root-menu', 'F1')
keymap.map_generic('copy', '<ctrl>c')
keymap.map_generic('copy', '<... | import gtk
from uxie.actions import Activator, map_generic
from uxie.floating import Manager as FeedbackManager
from uxie.plugins import Manager as PluginManager
import filelist
import clipboard
import fsutils
map_generic('root-menu', 'F1')
map_generic('copy', '<ctrl>c')
map_generic('copy', '<ctrl>Insert')
map_gener... | mit | Python |
c33b1f711d4ad1289b15296302d8ff896aa77036 | Fix import error | Juanlu001/poliastro,Juanlu001/poliastro,Juanlu001/poliastro,poliastro/poliastro | src/poliastro/tests/test_czml.py | src/poliastro/tests/test_czml.py | import pytest
from numpy.testing import assert_allclose
from poliastro.czml.extract_czml import CZMLExtractor
from poliastro.examples import iss, molniya
def test_czml_add_orbit():
start_epoch = iss.epoch
end_epoch = iss.epoch + molniya.period
Extractor = CZMLExtractor(start_epoch, end_epoch, 10)
E... | import pytest
from numpy.testing import assert_allclose
from poliastro.czml.extract_czml import CZMLExtractor
from poliastro.examples import molniya, iss
def test_czml_add_orbit():
start_epoch = iss.epoch
end_epoch = iss.epoch + molniya.period
Extractor = CZMLExtractor(start_epoch, end_epoch, 10)
... | mit | Python |
4016bf5565c743785c9d943774ffd7ee76cda4a5 | Remove some unused codes. | drakeet/DrakeetLoveBot | app.py | app.py | # coding: utf-8
from datetime import datetime
from flask import Flask
from flask import render_template, request
import logging
import telegram
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
bot_name = '@DrakeetLoveBo... | # coding: utf-8
from datetime import datetime
from flask import Flask
from flask import render_template, request
import logging
import telegram
# from views.todos import todos_view
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(m... | mit | Python |
86857c8171cbac06fa32f210a401d6989e77f8fd | set code to only ready X and Y cols | georgetown-analytics/dc-crimebusters,georgetown-analytics/dc-crimebusters | crimebusters/cluster.py | crimebusters/cluster.py | """
Creates a colorized kmeans cluster of crime in Washington, DC.
Attempted to add pop-ups but there are too many co-located
points. Data for kmeans is all numeric except for the input
crime labels. All data was normalized and coordinates are
in WGS 84. Data will not load into ArcGIS online - the site
usually crashes... | """
Creates a colorized kmeans cluster of crime in Washington, DC.
Attempted to add pop-ups but there are too many co-located
points. Data for kmeans is all numeric except for the input
crime labels. All data was normalized and coordinates are
in WGS 84. Data will not load into ArcGIS online - the site
usually crashes... | mit | Python |
8f2e1ef30a62c19fc91eed48adc38ecfcdbc37d6 | Attach as_jsonapi to models for easy serialization | pinax/pinax-api | pinax/api/registry.py | pinax/api/registry.py | from __future__ import unicode_literals
registry = {}
bound_registry = {}
def register(cls):
registry[cls.api_type] = cls
def as_jsonapi(self):
return cls(self).serialize()
cls.model.as_jsonapi = as_jsonapi
return cls
def bind(parent=None, resource=None):
def wrapper(endpointset):
... | from __future__ import unicode_literals
registry = {}
bound_registry = {}
def register(cls):
registry[cls.api_type] = cls
return cls
def bind(parent=None, resource=None):
def wrapper(endpointset):
if parent is not None:
endpointset.parent = parent
endpointset.url.parent... | mit | Python |
eb66b79bed7a340d0424b0790466589a6c45b0ba | Add safe_deep_mkdir and restore upstream safe_mkdir. | foursquare/fsqio,foursquare/fsqio,foursquare/fsqio,foursquare/fsqio,foursquare/fsqio | src/python/fsqio/util/dirutil.py | src/python/fsqio/util/dirutil.py | # coding=utf-8
# Copyright 2015 Foursquare Labs Inc. All Rights Reserved.
from __future__ import (
absolute_import,
division,
generators,
nested_scopes,
print_function,
unicode_literals,
with_statement,
)
import errno
import os
import shutil
def safe_rmtree(directory):
"""Delete a directory if it's ... | # coding=utf-8
# Copyright 2015 Foursquare Labs Inc. All Rights Reserved.
from __future__ import (
absolute_import,
division,
generators,
nested_scopes,
print_function,
unicode_literals,
with_statement,
)
import errno
import os
import shutil
def safe_rmtree(directory):
"""Delete a directory if it's ... | apache-2.0 | Python |
73fa2788a1e8d6faef1eda78520b1908ebde66b5 | Make examples resizable by default | cprogrammer1994/ModernGL,cprogrammer1994/ModernGL,cprogrammer1994/ModernGL | examples/ported/_example.py | examples/ported/_example.py | import os
import moderngl_window as mglw
class Example(mglw.WindowConfig):
gl_version = (3, 3)
title = "ModernGL Example"
window_size = (1280, 720)
aspect_ratio = 16 / 9
resizable = True
resource_dir = os.path.normpath(os.path.join(__file__, '../../data'))
def __init__(self, **kwargs):
... | import os
import moderngl_window as mglw
class Example(mglw.WindowConfig):
gl_version = (3, 3)
title = "ModernGL Example"
window_size = (1280, 720)
aspect_ratio = 16 / 9
resizable = False
resource_dir = os.path.normpath(os.path.join(__file__, '../../data'))
def __init__(self, **kwargs):... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.