commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
52fa3230a29e10b49b7e6decb68cf5dbbf7a208f | Handle Unknown locale errors properly | zou/app/__init__.py | zou/app/__init__.py | import os
import flask_fs
import traceback
from flask import Flask, jsonify
from flasgger import Swagger
from flask_restful import current_app
from flask_jwt_extended import JWTManager
from flask_principal import Principal, identity_changed, Identity
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Mi... | import os
import flask_fs
import traceback
from flask import Flask, jsonify
from flasgger import Swagger
from flask_restful import current_app
from flask_jwt_extended import JWTManager
from flask_principal import Principal, identity_changed, Identity
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Mi... | Python | 0 |
7f9c9c25f5786bf96ff3d89cc8fd840e3e6a4a6d | Allow passing of a tuple of three integers to get a datetime. | 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.... | Python | 0.000005 |
b548092d480871e402e2d50ab96d864c5851cab2 | fix __init__ changes | 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__
| Python | 0.000057 |
22a10d3e0e5a0f5c11fa3ebaaa05c6e6e00f95a2 | Add some metadata | cgi-bin/wepp/sm2shape.py | cgi-bin/wepp/sm2shape.py | #!/mesonet/python/bin/python
# Output by township
from pyIEM import iemdb, wellknowntext
import shapelib, dbflib, os, cgi, mx.DateTime, sys, zipfile, shutil
i = iemdb.iemdb()
mydb = i['wepp']
os.chdir('/tmp/')
# Figure out what date we want
form = cgi.FormContent()
year = int(form["year"][0])
month = int(form["mont... | #!/mesonet/python/bin/python
# Output by township
from pyIEM import iemdb, wellknowntext
import shapelib, dbflib, os, cgi, mx.DateTime, sys, zipfile, shutil
i = iemdb.iemdb()
mydb = i['wepp']
os.chdir('/tmp/')
# Figure out what date we want
form = cgi.FormContent()
year = int(form["year"][0])
month = int(form["mont... | Python | 0.000355 |
f1630095ffe6c0d54e16c2466a2c1885453ec1af | Remove execute permission from exception.py | ironic_lib/exception.py | ironic_lib/exception.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | Python | 0.000042 |
71a84ecb772aa5560e35409219c11001ac168c6a | Add logging for contact form email. | 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... | Python | 0 |
a11c058c520581239a76d1b87920fec7f087eff3 | Use round brackets | 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... | Python | 0.000357 |
797ab31382a6c92eb4e9496969e36c35a23db20d | Bump version to 10.0.1 | recipe_scrapers/__version__.py | recipe_scrapers/__version__.py | __version__ = "10.0.1"
| __version__ = "10.0.0"
| Python | 0 |
82b1e2db9c9175370d40354c2e6851bb26d58183 | bump plugin version | 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... | Python | 0 |
8b542d9602d459a6f38dd17c48d3f9a7680fac78 | Fixed the lower-case probleme | malware_crawl/scan/manual_html.py | malware_crawl/scan/manual_html.py | from __future__ import print_function, unicode_literals
import requests
import lxml.html
import six
from progress.bar import Bar
_malware_keywords = {'Queen Elizabeth II',}
_lower_mk = {}
for k,v in _malware_keywords.items():
_lower_mk[k.lower()] = v;
_malware_keywords = _lower_mk
def check_content(url):
tr... | from __future__ import print_function, unicode_literals
import requests
import lxml.html
import six
from progress.bar import Bar
_malware_keywords = {'Queen Elizabeth II',}
def check_content(url):
try:
response = requests.get(url, timeout=10.0)
response.raise_for_status()
except requests.exc... | Python | 0.99868 |
e09798d5adbdea422d31eeed6fded746c0b8e5eb | update reduce options | 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... | Python | 0.000001 |
d7cfdbd2bde0cc876db8c1bce020d8a1cf0ea77b | Add search filtering for name and booleans in resource API. | 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... | Python | 0 |
48ba12cb0018930d0674b4124ecf581cfd8bb39f | Test cleanup For #9-semweb-model | src/test/python/dot/rural/sepake/test_csv_to_rdf.py | src/test/python/dot/rural/sepake/test_csv_to_rdf.py | '''
Created on 3 Oct 2014
@author: s05nc4
'''
import unittest
import StringIO
from dot.rural.sepake.csv_to_rdf import CSV, CsvGraph, PROV
from rdflib import RDF, RDFS
from rdflib.query import ResultRow
import csv
from rdflib.term import Literal
EXAMPLE = '''"A","B","C"
1,2,3
4,5,6
'''
ALL_CELLS_QUERY = '''
SELECT ?h... | '''
Created on 3 Oct 2014
@author: s05nc4
'''
import unittest
import StringIO
from dot.rural.sepake.csv_to_rdf import CSV, CsvGraph, PROV
from rdflib import RDF, RDFS
from rdflib.query import ResultRow
EXAMPLE = '''"A","B","C"
1,2,3
4,5,6
'''
ALL_CELLS_QUERY = '''
SELECT ?h ?v
WHERE {{
?cell <{rdf.type}> <{csv.... | Python | 0 |
ac70763faa0798b2e78a9f2b898570e3b08df5cb | Fix method call | cla_backend/apps/cla_eventlog/management/commands/find_and_delete_old_cases.py | cla_backend/apps/cla_eventlog/management/commands/find_and_delete_old_cases.py | import sys
from django.core.management.base import BaseCommand
from dateutil.relativedelta import relativedelta
from legalaid.models import Case
from cla_eventlog.models import Log
from cla_butler.tasks import DeleteOldData
class FindAndDeleteCasesUsingCreationTime(DeleteOldData):
def get_eligible_cases(self):
... | import sys
from django.core.management.base import BaseCommand
from dateutil.relativedelta import relativedelta
from legalaid.models import Case
from cla_eventlog.models import Log
from cla_butler.tasks import DeleteOldData
class FindAndDeleteCasesUsingCreationTime(DeleteOldData):
def get_eligible_cases(self):
... | Python | 0.000008 |
08d2ade71e6fb69512cb6d39cb7ef8712a44172a | update mediumRegex | 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... | Python | 0 |
76dcc6cd050172af50c0721b312ea499f0bb7b71 | modify build option | 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... | Python | 0.000001 |
f9d911091f01d91485f21c01850798892ed28dd0 | add right arrow | 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... | Python | 0.001032 |
42fcc098fe2b89f50b28b5d158ae6eead46dd382 | Add command to help description of timez | hamper/plugins/timez.py | hamper/plugins/timez.py | import requests
import json
from hamper.interfaces import ChatCommandPlugin, Command
class Timez(ChatCommandPlugin):
name = 'timez'
priority = 2
def setup(self, loader):
try:
self.api_key = loader.config['timez']['api-key']
except (KeyError, TypeError):
self.api_k... | import requests
import json
from hamper.interfaces import ChatCommandPlugin, Command
class Timez(ChatCommandPlugin):
name = 'timez'
priority = 2
def setup(self, loader):
try:
self.api_key = loader.config['timez']['api-key']
except (KeyError, TypeError):
self.api_k... | Python | 0.000001 |
3555b002aae386220bc02d662a9b188426afc08f | Create a specific group for the Facebook plugins - makes it a bit neater in the list of plugins. | 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,
... | Python | 0 |
7f2b3d91550fd6af46ee10e6c68c8633408b12ed | Revert revert to properly fix #125 without cruft. Sigh. | 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 = ... | Python | 0 |
0282c7eaecb32b736592c84cda1f7520c130c676 | Update basic tests | 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)... | Python | 0 |
db4d5263c38e95ad8c2e253512c563ea97b8772f | Fix adduser script first line | 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... | Python | 0.000002 |
a04d97bd9bb62d15201d8cadd1fd3b24980d3507 | Fix installation path generation for configuration file | 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... | Python | 0 |
90b1aebe4b67ff9f221aee3b0c668f658d915537 | Update bottlespin.py | 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):
... | Python | 0 |
fb6aa002e13a1d1205da28b20d419419067117f6 | Implement basic genome crossover (#44, #36) | 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
| Python | 0.000011 |
c0d79ba0420f6e0176e98266a02c60b1f53f4a93 | apply same simplification to setfield | obj_update.py | obj_update.py | from __future__ import unicode_literals
import logging
import sys
# for python 2/3 compatibility
text_type = unicode if sys.version_info[0] < 3 else str
logger = logging.getLogger('obj_update')
def setfield(obj, fieldname, value):
"""Fancy setattr with debugging."""
old = getattr(obj, fieldname)
old_r... | from __future__ import unicode_literals
import logging
import sys
# for python 2/3 compatibility
text_type = unicode if sys.version_info[0] < 3 else str
logger = logging.getLogger('obj_update')
def setfield(obj, fieldname, value):
"""Fancy setattr with debugging."""
old = getattr(obj, fieldname)
if ol... | Python | 0.000002 |
60874bb237bfe8fc2c95499cf7fd37a868ff315c | Cache the image for four days(original is seven) | zhihudaily/views/utils.py | zhihudaily/views/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from StringIO import StringIO
from flask import send_file, g, Blueprint
from zhihudaily.configs import Config
from zhihudaily.crawler import Crawler
utils = Blueprint('utils', __name__)
@utils.before_app_reque... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from StringIO import StringIO
from flask import send_file, g, Blueprint
from zhihudaily.configs import Config
from zhihudaily.crawler import Crawler
utils = Blueprint('utils', __name__)
@utils.before_app_reque... | Python | 0.999999 |
35eadd561a47204c32627e26c5e6e64849e38f2e | improve enrico_config | enrico/config.py | enrico/config.py | """Central place for config file handling"""
import sys
from os.path import join
from configobj import ConfigObj, flatten_errors
from extern.configobj.validate import Validator
from environ import CONFIG_DIR
def get_config(infile, configspec=join(CONFIG_DIR, 'default.conf')):
"""Parse config file, and in addition... | """Central place for config file handling"""
import sys
from os.path import join
from configobj import ConfigObj, flatten_errors
from extern.configobj.validate import Validator
from environ import CONFIG_DIR
def get_config(infile, configspec=join(CONFIG_DIR, 'default.conf')):
"""Parse config file, and in addition... | Python | 0.000002 |
b0970703d4df2a3072f267855fa348428d01fc93 | allow configuration of repl. factor | pcassandra/dj18/tests/dj18test_app/settings.py | pcassandra/dj18/tests/dj18test_app/settings.py | """
Django settings for dj18tests project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os
... | """
Django settings for dj18tests project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os
... | Python | 0.000023 |
c3587c23f6a5f34cf7bdc0a88b4057381f7752ac | add cascade delete table | flaskutils/test.py | flaskutils/test.py | from flaskutils import app
from .models import FlaskModel
from pgsqlutils.base import syncdb, Session
class ModelTestCase(object):
def setup(self):
"""
Use this test case when no interaction in a view is required
"""
syncdb()
def teardown(self):
Session.rollback()
... | from flaskutils import app
from .models import FlaskModel
from pgsqlutils.base import syncdb, Session
class ModelTestCase(object):
def setup(self):
"""
Use this test case when no interaction in a view is required
"""
syncdb()
def teardown(self):
Session.rollback()
... | Python | 0.000001 |
750195a169edf643f66e072e0cbde154a787b62c | Fix a bunch of unicode problems in logging. | floo/common/msg.py | floo/common/msg.py | import os
import time
try:
from . import shared as G
assert G
unicode = str
python2 = False
except ImportError:
python2 = True
import shared as G
LOG_LEVELS = {
'DEBUG': 1,
'MSG': 2,
'WARN': 3,
'ERROR': 4,
}
LOG_LEVEL = LOG_LEVELS['MSG']
LOG_FILE = os.path.join(G.BASE_DIR, 'm... | import os
import time
try:
from . import shared as G
assert G
unicode = str
python2 = False
except ImportError:
python2 = True
import shared as G
LOG_LEVELS = {
'DEBUG': 1,
'MSG': 2,
'WARN': 3,
'ERROR': 4,
}
LOG_LEVEL = LOG_LEVELS['MSG']
LOG_FILE = os.path.join(G.BASE_DIR, 'm... | Python | 0.999987 |
e8f941aca9a111eb81c41e0be3a0c6591386083c | change way to get if celery should be used | flowjs/settings.py | flowjs/settings.py | from django.conf import settings
# Media path where the files are saved
FLOWJS_PATH = getattr(settings, "FLOWJS_PATH", 'flowjs/')
# Remove the upload files when the model is deleted
FLOWJS_REMOVE_FILES_ON_DELETE = getattr(settings, "FLOWJS_REMOVE_FILES_ON_DELETE", True)
# Remove temporary chunks after file have been... | from django.conf import settings
# Media path where the files are saved
FLOWJS_PATH = getattr(settings, "FLOWJS_PATH", 'flowjs/')
# Remove the upload files when the model is deleted
FLOWJS_REMOVE_FILES_ON_DELETE = getattr(settings, "FLOWJS_REMOVE_FILES_ON_DELETE", True)
# Remove temporary chunks after file have been... | Python | 0.000001 |
c2798702a1f2b1dc40c10b481b9989f9a86c71b2 | Fix indentation error in some helpers | helpers/fix_fathatan.py | helpers/fix_fathatan.py | # -*- coding: utf-8 -*-
import os
import re
import argparse
def fix_fathatan(file_path):
with open(file_path, 'r') as file:
lines = file.readlines()
new_lines = []
for line in lines:
new_lines.append(re.sub(r'اً', 'ًا', line))
file_path = file_path.split(os.sep)
file_path[-1] = 'fixed_' + file_pat... | # -*- coding: utf-8 -*-
import os
import re
import argparse
def fix_fathatan(file_path):
with open(file_path, 'r') as file:
lines = file.readlines()
new_lines = []
for line in lines:
new_lines.append(re.sub(r'اً', 'ًا', line))
file_path = file_path.split(os.sep)
file_path[-1] = 'fixed_' + file_pat... | Python | 0.000017 |
080bccbf8b61edf9f3c9da4163497cc82e287db0 | Update roll.py | roll.py | roll.py | import random, re
#Update schema
__url__ = 'https://raw.githubusercontent.com/KittyHawkIrc/modules/production/' + __name__ + '.py'
__version__ = 1.0
# global variable for maximum length
max_len = 378
# declare trigger
def declare():
return {'roll': 'privmsg'}
# response to trigger
def callback(sel... | import random, re
#Update schema
__url__ = 'https://raw.githubusercontent.com/KittyHawkIrc/modules/production/' + __name__ + '.py'
__version__ = 1.0
# global variable for maximum length
max_len = 378
# declare trigger
def declare():
return {'roll': 'privmsg'}
# response to trigger
def callback(sel... | Python | 0.000001 |
5398f356cab1e98673c253849a1de2bb76fc537a | move lapse archival to staging | scripts/util/autolapses2box.py | scripts/util/autolapses2box.py | """Send autolapse tar files to staging for archival.
Run from RUN_MIDNIGHT.sh for the previous date"""
import datetime
import subprocess
import os
import stat
import glob
from pyiem.util import logger
LOG = logger()
def main():
"""Run for the previous date, please"""
valid = datetime.date.today() - datetim... | """Send autolapse tar files to box for archival.
Run from RUN_MIDNIGHT.sh for the previous date"""
import datetime
import os
import stat
import glob
from pyiem.box_utils import sendfiles2box
def main():
"""Run for the previous date, please"""
valid = datetime.date.today() - datetime.timedelta(days=1)
no... | Python | 0 |
f77d3728f5bcf34c396d5855054c679efa908f16 | Update field names for school query (#731) | salesforce/management/commands/update_schools.py | salesforce/management/commands/update_schools.py | from django.core.management.base import BaseCommand
from salesforce.models import School
from salesforce.salesforce import Salesforce
class Command(BaseCommand):
help = "update schools from salesforce.com"
def handle(self, *args, **options):
with Salesforce() as sf:
query = "SELECT Name, ... | from django.core.management.base import BaseCommand
from salesforce.models import School
from salesforce.salesforce import Salesforce
class Command(BaseCommand):
help = "update schools from salesforce.com"
def handle(self, *args, **options):
with Salesforce() as sf:
query = "SELECT Name, ... | Python | 0 |
97a490db75f0a4976199365c3f654ba8cdb9a781 | Test zip, and print format | 01_Built-in_Types/tuple.py | 01_Built-in_Types/tuple.py | #!/usr/bin/env python
import sys
import pickle
# Test zip, and format in print
names = ["xxx", "yyy", "zzz"]
ages = [18, 19, 20]
persons = zip(names, ages)
for name, age in persons:
print "{0}'s age is {1}".format(name, age)
# Check argument
if len(sys.argv) != 2:
print("%s filename" % sys.argv[0])
rai... | #!/usr/bin/env python
import sys
import pickle
# Check argument
if len(sys.argv) != 2:
print("%s filename" % sys.argv[0])
raise SystemExit(1)
# Write tuples
file = open(sys.argv[1], "wb");
line = []
while True:
print("Enter name, age, score (ex: zzz, 16, 90) or quit");
line = sys.stdin.readline()
... | Python | 0 |
ba6ef8c9f0881e7236063d5372f64656df1b4bf0 | rename package from 'motion_control' to 'kinesis' | msl/equipment/resources/thorlabs/__init__.py | msl/equipment/resources/thorlabs/__init__.py | """
Wrappers around APIs from Thorlabs.
"""
from .kinesis.motion_control import MotionControl
from .kinesis.callbacks import MotionControlCallback
| """
Wrappers around APIs from Thorlabs.
"""
from .motion_control.motion_control import MotionControl
from .motion_control.callbacks import MotionControlCallback
| Python | 0.000181 |
ce56148d04725d3c9c5fd12fb42c44d05d41f774 | append more option flags in goober's output | goober.py | goober.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.plugins.base import Plugin
from nose.case import Test
import logging
import unittest
import os
log = logging.getLogger(__name__)
class Goober(Plugin):
"""
After a multiprocess test run, print out a one-line command that will rerun all the failed / erro... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.plugins.base import Plugin
from nose.case import Test
import logging
import unittest
import os
log = logging.getLogger(__name__)
class Goober(Plugin):
"""
After a multiprocess test run, print out a one-line command that will rerun all the failed / erro... | Python | 0.000002 |
89fbd8ba88edfcbc4877f06434098f628cbc3f9d | Fix client | src/client.py | src/client.py | #!/usr/bin/env python3
import time
from scapy.all import IP, ls
from tuntap import TunThread
import dns
import query
from packet import Packet
addr = '192.168.33.10'
hostname = 'vpn.bgpat.net'
class VPNClient(TunThread):
daemon = True
name = 'tun_client'
addr = '192.168.200.2'
gateway = '192.168.200... | #!/usr/bin/env python3
import time
from scapy.all import ls
from tuntap import TunThread
import dns
import query
from packet import Packet
addr = '192.168.33.10'
hostname = 'vpn.bgpat.net'
class VPNClient(TunThread):
daemon = True
name = 'tun_client'
addr = '192.168.200.2'
gateway = '192.168.200.1'
... | Python | 0.000001 |
a68f9e0e7f9d99e0052c6c01395dbb131c052797 | remove k4 | esproxy/views.py | esproxy/views.py | import os
from django.http import HttpResponse, HttpResponseRedirect
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.shortcuts import render_to_response
from settings import ELASTICSEARCH_PROXY, ELASTIC... | from django.http import HttpResponse, HttpResponseRedirect
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.shortcuts import render_to_response
from settings import ELASTICSEARCH_PROXY, ELASTICSEARCH_REA... | Python | 0.999691 |
8cd2332871bd246352f23f286ae459c2cf399a35 | allow classifier parameter to be configurable | sklearn/sklearn-template/template/trainer/model.py | sklearn/sklearn-template/template/trainer/model.py | # Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python | 0.000001 |
ad8ff0e8d280a8a0b3876382b63a1be4ad0784e5 | increment version | version.py | version.py | # -*- coding: utf-8 -*-
import platform
name = "Fourth Evaz"
version = (0, 1, 10)
source = "https://github.com/shacknetisp/fourthevaz"
def gitstr():
try:
return "%s" % (open('.git/refs/heads/master').read().strip()[0:10])
except FileNotFoundError:
return ""
except IndexError:
retur... | # -*- coding: utf-8 -*-
import platform
name = "Fourth Evaz"
version = (0, 1, 9)
source = "https://github.com/shacknetisp/fourthevaz"
def gitstr():
try:
return "%s" % (open('.git/refs/heads/master').read().strip()[0:10])
except FileNotFoundError:
return ""
except IndexError:
return... | Python | 0.000004 |
185f174b6c1d50ad51987765f42e078a6081e5d3 | Remove semi-colon | 06-pipeline/tf-06.py | 06-pipeline/tf-06.py | #!/usr/bin/env python
import sys, re, operator, string
#
# The functions
#
def read_file(path_to_file):
"""
Takes a path to a file and returns the entire
contents of the file as a string
"""
with open(path_to_file) as f:
data = f.read()
return data
def filter_chars_and_normalize(str_da... | #!/usr/bin/env python
import sys, re, operator, string
#
# The functions
#
def read_file(path_to_file):
"""
Takes a path to a file and returns the entire
contents of the file as a string
"""
with open(path_to_file) as f:
data = f.read()
return data
def filter_chars_and_normalize(str_da... | Python | 0.999991 |
e5963987e678926ad8cdde93e2551d0516a7686b | Increase timeout for bench_pictures on Android | slave/skia_slave_scripts/android_bench_pictures.py | slave/skia_slave_scripts/android_bench_pictures.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia bench_pictures executable. """
from android_render_pictures import AndroidRenderPictures
from android_run_bench i... | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia bench_pictures executable. """
from android_render_pictures import AndroidRenderPictures
from android_run_bench i... | Python | 0.000011 |
d4e890a16fcb155c6df78d378b3ba9429590c74b | fix test | src/unittest/python/aws/kms_tests.py | src/unittest/python/aws/kms_tests.py | import base64
import unittest2
from boto.kms.exceptions import InvalidCiphertextException
from cfn_sphere.aws.kms import KMS
from mock import patch
from cfn_sphere.exceptions import InvalidEncryptedValueException
class KMSTests(unittest2.TestCase):
@patch('cfn_sphere.aws.kms.kms.connect_to_region')
def test_... | import unittest2
from boto.kms.exceptions import InvalidCiphertextException
from cfn_sphere.aws.kms import KMS
from mock import patch
from cfn_sphere.exceptions import InvalidEncryptedValueException
class KMSTests(unittest2.TestCase):
@patch('cfn_sphere.aws.kms.kms.connect_to_region')
def test_decrypt_value(s... | Python | 0.000002 |
ade0542bf38a4e70e1f22b6aa00f624900f772d8 | Implement data coordinator for CPNWH scraper; clean up URL code | scripts/observations/scrape/CPNWH_Downloader.py | scripts/observations/scrape/CPNWH_Downloader.py | """Use this to directly download CPNWH data.
To prevent timeout errors with their server, the data is downloaded from each
herbaria separately.
"""
import argparse
import string
import requests
import PyFloraBook.input_output.data_coordinator as dc
# Parse arguments
PARSER = argparse.ArgumentParser(
descripti... | """Use this to directly download CPNWH data.
To prevent timeout errors with their server, the data is downloaded from each
herbaria separately.
"""
import argparse
import string
import requests
# Parse arguments
PARSER = argparse.ArgumentParser(
description='Download CPNWH data into multiple files')
PARSER.add... | Python | 0 |
1e7fba11a40c5f477e8a1482638a9bcaaf981348 | Make hoomd.data.typeparam.TypeParameter picklable | hoomd/data/typeparam.py | hoomd/data/typeparam.py | from hoomd.data.parameterdicts import AttachedTypeParameterDict
class TypeParameter:
__slots__ = ('name', 'type_kind', 'param_dict')
def __init__(self, name, type_kind, param_dict):
self.name = name
self.type_kind = type_kind
self.param_dict = param_dict
def __getattr__(self, att... | from hoomd.data.parameterdicts import AttachedTypeParameterDict
from copy import deepcopy
class TypeParameter:
def __init__(self, name, type_kind, param_dict):
self.name = name
self.type_kind = type_kind
self.param_dict = param_dict
def __getattr__(self, attr):
try:
... | Python | 0 |
5af140148f1395e27b392f4236a552be2e81fc10 | remove gen_frame() | vizgame.py | vizgame.py | import tables as tb
import matplotlib.pyplot as plt
from scipy import misc
import matplotlib.cm as cm
from matplotlib.widgets import Slider
class Experience(tb.IsDescription):
action = tb.IntCol(pos=1)
reward = tb.IntCol(pos=2)
def record(action, reward, frame, newfile=False):
if not newfile:
wi... | import tables as tb
import matplotlib.pyplot as plt
from scipy import misc
import matplotlib.cm as cm
from matplotlib.widgets import Slider
class Experience(tb.IsDescription):
action = tb.IntCol(pos=1)
reward = tb.IntCol(pos=2)
def record(action, reward, frame, newfile=False):
if not newfile:
wi... | Python | 0.000001 |
8425a06fb270e18b7aa7b137cb99b43ce39a4b53 | Fix bitrotted function call | haas.wsgi | haas.wsgi | #!/usr/bin/env python
import haas.api
from haas import config, model, server
config.load('/etc/haas.cfg')
config.configure_logging()
config.load_extensions()
server.init()
from haas.rest import wsgi_handler as application
| #!/usr/bin/env python
import haas.api
from haas import config, model, server
config.load('/etc/haas.cfg')
config.configure_logging()
config.load_extensions()
server.api_server_init()
from haas.rest import wsgi_handler as application
| Python | 0 |
4c0788003c2e579d42200c6ce1da3cedd4dff152 | Implement reading from and writing to mfrc522 registers | mfrc522/mfrc522.py | mfrc522/mfrc522.py | from enum import Enum
class MFRC522:
MAX_LEN = 16
class Commands(Enum):
PCD_IDLE = 0x00
PCD_AUTHENT = 0x0E
PCD_RECEIVE = 0x08
PCD_TRANSMIT = 0x04
PCD_TRANSCEIVE = 0x0C
PCD_RESETPHASE = 0x0F
PCD_CALCCRC ... | class MFRC522:
MAX_LEN = 16
class Commands(Enum):
PCD_IDLE = 0x00
PCD_AUTHENT = 0x0E
PCD_RECEIVE = 0x08
PCD_TRANSMIT = 0x04
PCD_TRANSCEIVE = 0x0C
PCD_RESETPHASE = 0x0F
PCD_CALCCRC = 0x03
class Regi... | Python | 0 |
b219823af7188f968d7c52c5273148c510bd7454 | Simplify the ckernel pass a bit more | blaze/compute/air/frontend/ckernel_impls.py | blaze/compute/air/frontend/ckernel_impls.py | """
Convert 'kernel' Op to 'ckernel'.
"""
from __future__ import absolute_import, division, print_function
from pykit.ir import transform, Op
def run(func, env):
strategies = env['strategies']
transform(CKernelImplementations(strategies), func)
class CKernelImplementations(object):
"""
For kernels... | """
Lift ckernels to their appropriate rank so they always consume the full array
arguments.
"""
from __future__ import absolute_import, division, print_function
import datashape
from pykit.ir import transform, Op
#------------------------------------------------------------------------
# Run
#----------------------... | Python | 0.000001 |
60dd476337ead3262daaa17ee4a973937cac380d | Add help for sites argument to manage.py scan | securethenews/sites/management/commands/scan.py | securethenews/sites/management/commands/scan.py | import json
import subprocess
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from sites.models import Site, Scan
def pshtt(domain):
pshtt_cmd = ['pshtt', '--json', domain]
p = subprocess.Popen(
pshtt_cmd,
stdout=subprocess.PIPE,
s... | import json
import subprocess
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from sites.models import Site, Scan
def pshtt(domain):
pshtt_cmd = ['pshtt', '--json', domain]
p = subprocess.Popen(
pshtt_cmd,
stdout=subprocess.PIPE,
s... | Python | 0 |
36d219164b5e7332d72a980368badec9f86e5c5e | Update test_corpus.py | sacremoses/test/test_corpus.py | sacremoses/test/test_corpus.py | # -*- coding: utf-8 -*-
"""
Tests for corpus.py
"""
import sys
import doctest
import unittest
from sacremoses.corpus import Perluniprops, NonbreakingPrefixes
class CorpusTest(unittest.TestCase):
def test_perluniprops_chars_sanity_check(self):
perluniprops = Perluniprops()
for category in perlun... | # -*- coding: utf-8 -*-
"""
Tests for corpus.py
"""
import sys
import doctest
import unittest
from sacremoses.corpus import Perluniprops, NonbreakingPrefixes
class CorpusTest(unittest.TestCase):
def test_perluniprops_chars_sanity_check(self):
perluniprops = Perluniprops()
for category in perlun... | Python | 0.000001 |
53c6e1f1d0939b4c585301427920e0cf1dd9e341 | Remove tabs. | panel/main.py | panel/main.py | import ibus
import gtk
import dbus
import dbus.mainloop.glib
import panel
class PanelApplication:
def __init__ (self):
self._dbusconn = dbus.connection.Connection (ibus.IBUS_ADDR)
self._dbusconn.add_signal_receiver (self._disconnected_cb,
"Disconnected",
dbus_interface = dbus.LOCAL_IFACE)
self._p... | import ibus
import gtk
import dbus
import dbus.mainloop.glib
import panel
class PanelApplication:
def __init__ (self):
self._dbusconn = dbus.connection.Connection (ibus.IBUS_ADDR)
self._dbusconn.add_signal_receiver (self._disconnected_cb,
"Disconnected",
dbus_interface = dbus.LOCAL_IFACE)
self._p... | Python | 0 |
6bdc16e24e51d16b0fa214d30394317079bc90a9 | Throw more user-friendly execption inside get_backend_instance method. | st2auth/st2auth/backends/__init__.py | st2auth/st2auth/backends/__init__.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Python | 0 |
212a9a901625605000210ec8c436c8f6e9be7c39 | correct the log filename and handler | xutils/log.py | xutils/log.py | # -*- coding: utf-8 -*-
import os
import os.path
import logging
from logging.handlers import RotatingFileHandler
def init(logger=None, level="INFO", file=None, handler_cls=None, process=False,
max_count=30, propagate=True, file_config=None, dict_config=None):
root = logging.getLogger()
if not logge... | # -*- coding: utf-8 -*-
import os
import os.path
import logging
from logging.handlers import RotatingFileHandler
def init(logger=None, level="INFO", file=None, handler_cls=None, process=False,
max_count=30, propagate=True, file_config=None, dict_config=None):
root = logging.getLogger()
if not logge... | Python | 0.000004 |
b83b774f6651232afd828bf1ec2c489084832b52 | Fix test | bluebottle/funding_pledge/tests/test_api.py | bluebottle/funding_pledge/tests/test_api.py | import json
from django.core import mail
from django.urls import reverse
from rest_framework import status
from bluebottle.funding.tests.factories import FundingFactory, DonationFactory
from bluebottle.initiatives.tests.factories import InitiativeFactory
from bluebottle.test.factory_models.accounts import BlueBottle... | import json
from django.core import mail
from django.urls import reverse
from rest_framework import status
from bluebottle.funding.tests.factories import FundingFactory, DonationFactory
from bluebottle.initiatives.tests.factories import InitiativeFactory
from bluebottle.test.factory_models.accounts import BlueBottle... | Python | 0.000004 |
0e60c23ce6e40304437218151e895dcaf856f832 | Update project version | billing/__init__.py | billing/__init__.py | __version__ = '1.7'
__copyright__ = 'Copyright (c) 2020, Skioo SA'
__licence__ = 'MIT'
__URL__ = 'https://github.com/skioo/django-customer-billing'
| __version__ = '1.6'
__copyright__ = 'Copyright (c) 2020, Skioo SA'
__licence__ = 'MIT'
__URL__ = 'https://github.com/skioo/django-customer-billing'
| Python | 0 |
6f6aeb99677fd510a13ca1abd4962b64763ca5ec | Update repo_metadata.py | gitmostwanted/tasks/repo_metadata.py | gitmostwanted/tasks/repo_metadata.py | from gitmostwanted.app import app, db, celery
from gitmostwanted.models.repo import Repo, RepoMean
from gitmostwanted.lib.github import api
from sqlalchemy.sql import func, expression
from datetime import datetime, timedelta
@celery.task()
def metadata_maturity(num_months):
repos = Repo.query\
.filter(Rep... | from gitmostwanted.app import app, db, celery
from gitmostwanted.models.repo import Repo, RepoMean
from gitmostwanted.lib.github import api
from sqlalchemy.sql import func, expression
from datetime import datetime, timedelta
@celery.task()
def metadata_maturity(num_months):
repos = Repo.query\
.filter(Rep... | Python | 0.000002 |
22fef4c07a28a96267e1d3f0390bc366790252a0 | Use alias for nodejs_tool. | nodejs/def.bzl | nodejs/def.bzl | _js_filetype = FileType([".js"])
SCRIPT_TEMPLATE = """\
#!/bin/bash
"{node_bin}" "{script_path}"
"""
def nodejs_binary_impl(ctx):
ctx.file_action(
ctx.outputs.executable,
SCRIPT_TEMPLATE.format(node_bin=ctx.file._nodejs_tool.short_path,
script_path=ctx.file.main_scri... | _js_filetype = FileType([".js"])
SCRIPT_TEMPLATE = """\
#!/bin/bash
"{node_bin}" "{script_path}"
"""
def nodejs_binary_impl(ctx):
ctx.file_action(
ctx.outputs.executable,
SCRIPT_TEMPLATE.format(node_bin=ctx.file._nodejs_tool.short_path,
script_path=ctx.file.main_scri... | Python | 0 |
e8540104547878e9f8360ba07ca0cbf1ee63e6ca | update Nottingham import script | polling_stations/apps/data_collection/management/commands/import_nottingham.py | polling_stations/apps/data_collection/management/commands/import_nottingham.py | from data_collection.github_importer import BaseGitHubImporter
class Command(BaseGitHubImporter):
srid = 4326
districts_srid = 4326
council_id = "E06000018"
elections = []
scraper_name = "wdiv-scrapers/DC-PollingStations-Nottingham"
geom_type = "geojson"
def district_record_to_dict(self,... | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E06000018"
addresses_name = "parl.2017-06-08/Version 1/Democracy_Club__08June2017 8.tsv"
stations_name = "parl.2017-06-08/Version 1/Democracy_Club__08June2017... | Python | 0 |
6647025f3cb44818d0ff403160df35aa827516c7 | refactor env var load | src/config.py | src/config.py | import os
import sys
import socket
import platform
import util
import json
import re
APP = os.path.basename(sys.argv[0])
USER = os.environ.get('SUDO_USER', 'USER')
HOME = os.path.expanduser(f"~{USER}")
HOME_ROOT = os.path.expanduser("~root")
BASE_PATH = os.path.dirname(os.path.dirname(__file__))
HOSTNAME = socket.get... | import os
import sys
import socket
import platform
import util
import json
import re
APP = os.path.basename(sys.argv[0])
USER = os.environ.get('SUDO_USER')
if not USER:
USER = os.environ.get('USER')
HOME = os.path.expanduser(f"~{USER}")
HOME_ROOT = os.path.expanduser("~root")
BASE_PATH = os.path.dirname(os.path.... | Python | 0.000062 |
24110636fd6eaae8962478c9f3e56c9da469be81 | bump version to 0.9.0 | zs/version.py | zs/version.py | # This file is part of ZS
# Copyright (C) 2013-2014 Nathaniel Smith <njs@pobox.com>
# See file LICENSE.txt for license information.
# This file must be kept very simple, because it is consumed from several
# places -- it is imported by zs/__init__.py, execfile'd by setup.py, etc.
# We use a simple scheme:
# 1.0.0 -... | # This file is part of ZS
# Copyright (C) 2013-2014 Nathaniel Smith <njs@pobox.com>
# See file LICENSE.txt for license information.
# This file must be kept very simple, because it is consumed from several
# places -- it is imported by zs/__init__.py, execfile'd by setup.py, etc.
# We use a simple scheme:
# 1.0.0 -... | Python | 0.000001 |
970978b5355259fe943d5efed1b8b4ce945fdfa7 | Debug control flow and exit on errors | weather.py | weather.py | #! /usr/bin/python2
from os.path import expanduser,isfile
import sys
from urllib import urlopen
location_path="~/.location"
def location_from_homedir():
if isfile(expanduser(location_path)):
with open(expanduser(location_path)) as f:
return "&".join(f.read().split("\n"))
else:
pri... | #! /usr/bin/python2
from os.path import expanduser,isfile
from sys import argv
from urllib import urlopen
location_path="~/.location"
def location_from_homedir():
if isfile(expanduser(location_path)):
with open(expanduser(location_path)) as f:
return "&".join(f.read().split("\n"))
else:
... | Python | 0 |
6e024501b76beaccc2daa46f045f4e3444aa146b | update python client library example | examples/send.py | examples/send.py | #!/usr/bin/env python
from alerta.api import ApiClient
from alerta.alert import Alert
api = ApiClient(endpoint='http://localhost:8080', key='tUA6oBX6E5hUUQZ+dyze6vZbOMmiZWA7ke88Nvio')
alert = Alert(
resource='web-server-01',
event='HttpError',
group='Web',
environment='Production',
service='thegu... | #!/usr/bin/env python
from alerta.client import Alert, ApiClient
client = ApiClient()
alert = Alert(resource='res1', event='event1')
print alert
print client.send(alert)
| Python | 0 |
cb69b004e46d8d08e6c2419c7e4a83383a14755b | remove reference-based infinite loop | shadho/backend/json/domain.py | shadho/backend/json/domain.py | from shadho.backend.base.domain import BaseDomain
from shadho.backend.json.value import Value
from shadho.backend.utils import InvalidObjectError
import uuid
class Domain(BaseDomain):
def __init__(self, id=None, domain=None, path=None, strategy=None,
scaling=None, model=None, values=None, exhaus... | from shadho.backend.base.domain import BaseDomain
from shadho.backend.json.value import Value
import uuid
class Domain(BaseDomain):
def __init__(self, id=None, domain=None, path=None, strategy=None,
scaling=None, model=None, values=None, exhaustive=False,
exhaustive_idx=None):
... | Python | 0.000056 |
00d006d280960228f249480e7af990cf7df39b59 | remove useless function | jsonapi_utils/alchemy.py | jsonapi_utils/alchemy.py | # -*- coding: utf-8 -*-
from sqlalchemy.sql.expression import desc, asc, text
from jsonapi_utils.constants import DEFAULT_PAGE_SIZE
def paginate_query(query, pagination_kwargs):
"""Paginate query result according to jsonapi rfc
:param sqlalchemy.orm.query.Query query: sqlalchemy queryset
:param dict pa... | # -*- coding: utf-8 -*-
from sqlalchemy.sql.expression import desc, asc, text
from jsonapi_utils.constants import DEFAULT_PAGE_SIZE
def paginate_query(query, pagination_kwargs):
"""Paginate query result according to jsonapi rfc
:param sqlalchemy.orm.query.Query query: sqlalchemy queryset
:param dict pa... | Python | 0.001107 |
1f31ed22627cb1cf5b4323a18435bd9fb7fc7462 | add trailing slash | web/url.py | web/url.py | from flask import Flask, render_template, jsonify, redirect, url_for
from web.clasher import Clasher
import os
xml_file = 'https://s3.amazonaws.com/navishack/PC-00-COMP-BBC.xml.gz'
clash_data = None
app = Flask(__name__)
app.debug = 'DEBUG' in os.environ
@app.route('/')
def index():
return redirect('/clash/')
... | from flask import Flask, render_template, jsonify, redirect, url_for
from web.clasher import Clasher
import os
xml_file = 'https://s3.amazonaws.com/navishack/PC-00-COMP-BBC.xml.gz'
clash_data = None
app = Flask(__name__)
app.debug = 'DEBUG' in os.environ
@app.route('/')
def index():
return redirect('/clash/')
... | Python | 0.000008 |
61a582e968bec7344255d68d143551e1e6c7b278 | Use wraps to preserve name, fixes #55 | huey/djhuey/__init__.py | huey/djhuey/__init__.py | """
This module contains a lot of cruft to handle instantiating a "Huey" object
using Django settings. Unlike more flexible python apps, the huey django
integration consists of a single global Huey instance configured via the
settings module.
"""
from functools import wraps
import sys
from django.conf import settings... | """
This module contains a lot of cruft to handle instantiating a "Huey" object
using Django settings. Unlike more flexible python apps, the huey django
integration consists of a single global Huey instance configured via the
settings module.
"""
import sys
from django.conf import settings
from django.db import close... | Python | 0 |
3dd84fc4dc6cff921329286485e287c13ebebdec | Update version.py | mirdata/version.py | mirdata/version.py | #!/usr/bin/env python
"""Version info"""
short_version = "0.3"
version = "0.3.4b1"
| #!/usr/bin/env python
"""Version info"""
short_version = "0.3"
version = "0.3.4b0"
| Python | 0.000001 |
32b287b9d22b22262d291fb7e352a3502fe2e68f | Fix Docker test to wait fixed time (#5858) | test/assembly/docker.py | test/assembly/docker.py | #!/usr/bin/env python
import os
import socket
import subprocess as sp
import sys
import time
print('Building the image...')
sp.check_call(['bazel', 'run', '//:assemble-docker'])
print('Starting the image...')
sp.check_call(['docker', 'run', '-v', '{}:/grakn-core-all-linux/logs/'.format(os.getcwd()), '--name', 'grakn... | #!/usr/bin/env python
import os
import socket
import subprocess as sp
import sys
import time
def wait_for_port(port, host='localhost', timeout=30.0):
start_time = time.time()
while True:
try:
socket.create_connection((host, port), timeout=timeout)
return
except OSError... | Python | 0.000715 |
d8a27a94d90e5611b24c26c331a0016bbbb87af0 | update debug set default to false | web/web.py | web/web.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# web
#
import os
import flask
import models
app = flask.Flask(__name__)
app.secret_key = 'some_secret'
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # max 16M
#app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
def register_routers():
from routers import home
a... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# web
#
import os
import flask
import models
app = flask.Flask(__name__)
app.secret_key = 'some_secret'
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # max 16M
#app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
def register_routers():
from routers import home
a... | Python | 0.000046 |
aea0d98fd7fb5eaa0fd547b5442af6984f8d78e0 | fix bugs | exp/exp/tests.py | exp/exp/tests.py | from django.test import TestCase, RequestFactory
import json
from . import views_model, views_auth
class SearchTestCase(TestCase):
def setUp(self):
self.factory = RequestFactory()
def test_general_search(self):
post_data = {
'search_query': 'tp3ks',
'query_specifier':... | from django.test import TestCase, RequestFactory
import json
from . import views_model, views_auth
class SearchTestCase(TestCase):
def setUp(self):
self.factory = RequestFactory()
def test_general_search(self):
post_data = {
'search_query': 'tp3ks',
'query_specifier':... | Python | 0.000001 |
b738dc7b888aa356e1b7a3dfeee9ff2ca4b14b9e | Add style option to mark_entities | metal/contrib/entity_classification/utils.py | metal/contrib/entity_classification/utils.py | def mark_entities(tokens, positions, markers=[], style="insert"):
"""Adds special markers around tokens at specific positions (e.g., entities)
Args:
tokens: A list of tokens (the sentence)
positions:
1) A list of inclusive ranges (tuples) corresponding to the
token range... | def mark_entities(tokens, positions, markers=[]):
"""Adds special markers around tokens at specific positions (e.g., entities)
Args:
tokens: A list of tokens (the sentence)
positions:
1) A list of inclusive ranges (tuples) corresponding to the
token ranges of the entitie... | Python | 0.000001 |
ebfac180c04d24ea8ff93583eac52e6c0bc8d553 | Add contract test for 'v2' email notification | tests/app/public_contracts/test_GET_notification.py | tests/app/public_contracts/test_GET_notification.py | from . import return_json_from_response, validate_v0, validate
from app.models import ApiKey, KEY_TYPE_NORMAL
from app.dao.api_key_dao import save_model_api_key
from app.v2.notifications.notification_schemas import get_notification_response
from tests import create_authorization_header
def _get_notification(client, n... | from . import return_json_from_response, validate_v0, validate
from app.models import ApiKey, KEY_TYPE_NORMAL
from app.dao.api_key_dao import save_model_api_key
from app.v2.notifications.notification_schemas import get_notification_response
from tests import create_authorization_header
def _get_notification(client, n... | Python | 0 |
fc6ad89460dca9e1e5b1a4effe14c868cafc0e54 | add looping around math | test.py | test.py | __author__ = 'mike.lyons'
print "Hello World!"
while True:
x = raw_input("Enter any number: ")
y = raw_input("Enter another number: ")
try:
x = float(x)
y = float(y)
except ValueError:
x = 0.0
y = 0.0
print x+y
print x/2
print y**2
user_exit = raw_inp... | __author__ = 'mike.lyons'
print "Hello World!"
x = raw_input("Enter any number: ")
y = raw_input("Enter another number: ")
try:
x = float(x)
y = float(y)
except ValueError:
x = 0.0
y = 0.0
print x+y
print x/2
print y**2
| Python | 0.000027 |
e33bbf8cfb7a6aa1a32ff99185f97582cfa60a78 | support scans without scan parameter | silab_online_monitor/producer_sim/pybar_fei4.py | silab_online_monitor/producer_sim/pybar_fei4.py | ''' This is a producer faking data coming from pyBAR by taking real data and sending these in chunks'''
import time
import numpy as np
import tables as tb
import zmq
import logging
from online_monitor.utils.producer_sim import ProducerSim
class pyBarFEI4Sim(ProducerSim):
def setup_producer_device(self):
... | ''' This is a producer faking data coming from pyBAR by taking real data and sending these in chunks'''
import time
import numpy as np
import tables as tb
import zmq
import logging
from online_monitor.utils.producer_sim import ProducerSim
class pyBarFEI4Sim(ProducerSim):
def setup_producer_device(self):
... | Python | 0 |
91a3a94466736ef6996befa73549e309fb9251f8 | Remove unused import | explorer/urls.py | explorer/urls.py | from django.conf.urls import url
from explorer.views import (
QueryView,
CreateQueryView,
PlayQueryView,
DeleteQueryView,
ListQueryView,
ListQueryLogView,
download_query,
view_csv_query,
email_csv_query,
download_csv_from_sql,
schema,
format_sql,
)
urlpatterns = [
ur... | from django.conf.urls import patterns, url
from explorer.views import (
QueryView,
CreateQueryView,
PlayQueryView,
DeleteQueryView,
ListQueryView,
ListQueryLogView,
download_query,
view_csv_query,
email_csv_query,
download_csv_from_sql,
schema,
format_sql,
)
urlpatterns ... | Python | 0.000001 |
eb758ca756dc5716252b0364aadd5ef5a40ef773 | Streamline test_ExpectationsStore_with_DatabaseStoreBackend | tests/data_context/store/test_expectations_store.py | tests/data_context/store/test_expectations_store.py | import pytest
from great_expectations.core import ExpectationSuite
from great_expectations.data_context.store import (
DatabaseStoreBackend,
ExpectationsStore,
)
from great_expectations.data_context.types.resource_identifiers import (
ExpectationSuiteIdentifier,
)
from great_expectations.exceptions import ... | import pytest
from great_expectations.core import ExpectationSuite
from great_expectations.data_context.store import (
DatabaseStoreBackend,
ExpectationsStore,
)
from great_expectations.data_context.types.resource_identifiers import (
ExpectationSuiteIdentifier,
)
from great_expectations.exceptions import ... | Python | 0 |
3b4dd9a59de9a37a4167f64fec2f3896479f56c9 | Simplify option formatting. | qipipe/registration/ants/similarity_metrics.py | qipipe/registration/ants/similarity_metrics.py | class SimilarityMetric(object):
_FMT = "{name}[{fixed}, {moving}, {opts}]"
def __init__(self, name, *opts):
self.name = name
self.opts = opts
def format(self, fixed, moving, weight=1):
"""
Formats the ANTS similiarity metric argument.
:param reference: the fixed re... | class SimilarityMetric(object):
_FMT = "{name}[{fixed}, {moving}, {opts}]"
def __init__(self, name, *opts):
self.name = name
self.opts = opts
def format(self, fixed, moving, weight=1):
"""
Formats the ANTS similiarity metric argument.
:param reference: the fixed re... | Python | 0.000001 |
01ea3c8481aeba52dc17d8324ddbec8b6a633f35 | Add a method that inserts comma to given number. | numberutils.py | numberutils.py | ##-*- coding: utf-8 -*-
#!/usr/bin/python
"""
Utilities related to Number.
"""
__author__ = 'SeomGi, Han'
__credits__ = ['SeomGi, Han']
__copyright__ = 'Copyright 2015, Python Utils Project'
__license__ = 'MIT'
__version__ = '1.0.0'
__maintainer__ = 'SeomGi, Han'
__email__ = 'iandmyhand@gmail.com'
__status__ = 'Produ... | ##-*- coding: utf-8 -*-
#!/usr/bin/python
"""
Number to Hangul string util.
"""
__author__ = 'SeomGi, Han'
__credits__ = ['SeomGi, Han']
__copyright__ = 'Copyright 2015, Python Utils Project'
__license__ = 'MIT'
__version__ = '0.0.1'
__maintainer__ = 'SeomGi, Han'
__email__ = 'iandmyhand@gmail.com'
__status__ = 'Prod... | Python | 0.000075 |
bc6bacf6bd5fccf2e09dd3c07f6104e1f845351b | Revert "Added solution to assignment 4" | bootcamp/lesson4.py | bootcamp/lesson4.py | import datetime
import math
import requests
from core import test_helper
# Question 1
# ----------
# Using the datetime module return a datetime object with the year of 2015, the month of June, and the day of 1
def playing_with_dt():
# Write code here
pass
# Question 2
# ----------
# Using the math module... | import datetime
import math
import requests
from core import test_helper
# Question 1
# ----------
# Using the datetime module return a datetime object with the year of 2015, the month of June, and the day of 1
def playing_with_dt():
return datetime.datetime(year=2015, month=06, day=01)
# Question 2
# -------... | Python | 0 |
46eeffee39ea9ae7edacc1fe63b0686f6f2a68ad | Simplify logger initization logic | wolfbot.py | wolfbot.py | #!/usr/bin/env python3.2
# Copyright (c) 2011 Jimmy Cao
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | #!/usr/bin/env python3.2
# Copyright (c) 2011 Jimmy Cao
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | Python | 0.001181 |
d81ac294add6d2f14f283556ca1b0b2addd5f1ee | Update main.py | fx_collect/main.py | fx_collect/main.py | from database import DatabaseHandler
from broker import FXCMBrokerHandler
import subprocess
import time
import sys
import re
class MainAggregator(object):
def __init__(self):
"""
The MainAggregator class is just here to setup the initial
databases and then start each subprocess.
... | class MainAggregator(object):
def __init__(self):
"""
The MainAggregator class is just here to setup the initial
databases and then start each subprocess.
I'm going to change the name because its shit.
Later updates will have database health monitoring or
... | Python | 0.000001 |
864d551ca7aaf661ecfe54cca8c69e0f9daf1c46 | fix license | ezcf/__init__.py | ezcf/__init__.py | __author__ = "laike9m (laike9m@gmail.com)"
__title__ = 'ezcf'
__version__ = '0.0.1'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015 laike9m'
import sys
from .api import ConfigFinder
sys.meta_path.append(ConfigFinder()) | __author__ = "laike9m (laike9m@gmail.com)"
__title__ = 'ezcf'
__version__ = '0.0.1'
# __build__ = None
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2015 laike9m'
import sys
from .api import ConfigFinder
sys.meta_path.append(ConfigFinder()) | Python | 0.000001 |
ae8e98a4e609bee0e73175bdc50859dd0bed62cb | Fix lint errors. | recipe-server/normandy/base/api/serializers.py | recipe-server/normandy/base/api/serializers.py | from django.contrib.auth.models import User
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
id = serializers.IntegerField()
first_name = serializers.CharField()
last_name = serializers.CharField()
email = serializers.CharField()
class Meta:
model... | from django.contrib.auth.models import User
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
id = serializers.IntegerField()
first_name = serializers.CharField()
last_name = serializers.CharField()
email = serializers.CharField()
class Meta:
model... | Python | 0.000006 |
53db7465c8bb5f7ea0a9647b69555df36ade4191 | Use a trigger and lambda instead of schedule for the delay stage. | moa/stage/delay.py | moa/stage/delay.py |
__all__ = ('Delay', )
import random
import time
from kivy.clock import Clock
from kivy.properties import (OptionProperty, BoundedNumericProperty,
ReferenceListProperty)
from moa.stage import MoaStage
class Delay(MoaStage):
_delay_step_trigger = None
def __init__(self, **kwargs):
super(Delay, ... |
__all__ = ('Delay', )
import random
import time
from kivy.clock import Clock
from kivy.properties import (OptionProperty, BoundedNumericProperty,
ReferenceListProperty)
from moa.stage import MoaStage
class Delay(MoaStage):
def pause(self, *largs, **kwargs):
if super(Delay, self).pause(*largs, **kw... | Python | 0 |
bdacc7646c087d8fd87feb20c6af1d23d5cb1feb | clean up track/models | common/djangoapps/track/models.py | common/djangoapps/track/models.py | from django.db import models
class TrackingLog(models.Model):
"""Defines the fields that are stored in the tracking log database"""
dtcreated = models.DateTimeField('creation date', auto_now_add=True)
username = models.CharField(max_length=32, blank=True)
ip = models.CharField(max_length=32, blank=Tru... | from django.db import models
from django.db import models
class TrackingLog(models.Model):
dtcreated = models.DateTimeField('creation date', auto_now_add=True)
username = models.CharField(max_length=32, blank=True)
ip = models.CharField(max_length=32, blank=True)
event_source = models.CharField(max_l... | Python | 0.000001 |
de99cf5de9fa96c0a5e0853b04070cd4637c43af | Fix bug in csv report generation and add some code refactoring | edx_data_research/reporting/edx_base.py | edx_data_research/reporting/edx_base.py | import csv
import os
from pymongo import MongoClient
class EdX(object):
def __init__(self, args):
self.uri = args.uri
client = MongoClient(self.uri)
self.db = client[args.db_name]
self._collections = None
self.output_directory = args.output_directory
self.row_limi... | import csv
import os
from pymongo import MongoClient
class EdX(object):
def __init__(self, args):
self.uri = args.uri
client = MongoClient(self.uri)
self.db = client[args.db_name]
self._collections = None
self.output_directory = args.output_directory
self.row_limi... | Python | 0 |
ed6b086f785c4856ef73484ffc2082a0fba200b8 | Update accessible classes | ezhc/__init__.py | ezhc/__init__.py |
from ._config import load_js_libs
from ._highcharts import Highcharts
from ._highstock import Highstock
from ._global_options import GlobalOptions
from ._theme import Theme
from . import sample
from . import build
from ._clock import Clock
__all__ = ['Highcharts',
'Highstock',
'GlobalOptions... |
from ._config import load_js_libs
from ._highcharts import Highcharts
from ._highstock import Highstock
from . import sample
from . import build
from ._clock import Clock
__all__ = ['Highcharts',
'Highstock',
'sample',
'build',
'Clock',
]
load_js_libs()
| Python | 0 |
dec3d29f8482cb71f5ea3337622460a38b4f9124 | Set the default to production | galaxy/__init__.py | galaxy/__init__.py | # (c) 2012-2016, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... | # (c) 2012-2016, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... | Python | 0.000014 |
20d41f31e40a8d20902fcfea4543fa9c2c4d8cae | add dummy import function, so modulefinder can find our tables. | Lib/fontTools/ttLib/tables/__init__.py | Lib/fontTools/ttLib/tables/__init__.py | def _moduleFinderHint():
import B_A_S_E_
import C_F_F_
import D_S_I_G_
import DefaultTable
import G_D_E_F_
import G_P_O_S_
import G_S_U_B_
import J_S_T_F_
import L_T_S_H_
import O_S_2f_2
import T_S_I_B_
import T_S_I_D_
import T_S_I_J_
import T_S_I_P_
import T_S_I_S_
import T_S_I_V_
import T_S_I__0
imp... | """Empty __init__.py file to signal Python this directory is a package.
(It can't be completely empty since WinZip seems to skip empty files.)
"""
| Python | 0.000002 |
c24979627a8a2282a297704b735b1445b56dbce6 | Bump version. [skip ci] | mocket/__init__.py | mocket/__init__.py | try:
# Py2
from mocket import mocketize, Mocket, MocketEntry, Mocketizer
except ImportError:
# Py3
from mocket.mocket import mocketize, Mocket, MocketEntry, Mocketizer
__all__ = (mocketize, Mocket, MocketEntry, Mocketizer)
__version__ = '2.7.2'
| try:
# Py2
from mocket import mocketize, Mocket, MocketEntry, Mocketizer
except ImportError:
# Py3
from mocket.mocket import mocketize, Mocket, MocketEntry, Mocketizer
__all__ = (mocketize, Mocket, MocketEntry, Mocketizer)
__version__ = '2.7.1'
| Python | 0 |
974f46f4bfe6a8307a5e4a878c14028e89d0c6d6 | update pep8 | newfies/dialer_campaign/admin.py | newfies/dialer_campaign/admin.py | #
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2Billing S.L.
#
# The Initia... | #
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2Billing S.L.
#
# The Initia... | Python | 0 |
3e96eaeb9bb722d24fe4e589c49e52d32e8af1aa | Bump version. | mocket/__init__.py | mocket/__init__.py | try:
# Py2
from mocket import mocketize, Mocket, MocketEntry, Mocketizer
except ImportError:
# Py3
from mocket.mocket import mocketize, Mocket, MocketEntry, Mocketizer
__all__ = (mocketize, Mocket, MocketEntry, Mocketizer)
__version__ = '3.7.1'
| try:
# Py2
from mocket import mocketize, Mocket, MocketEntry, Mocketizer
except ImportError:
# Py3
from mocket.mocket import mocketize, Mocket, MocketEntry, Mocketizer
__all__ = (mocketize, Mocket, MocketEntry, Mocketizer)
__version__ = '3.7.0'
| Python | 0 |
4f6ceb1147d0c326f55621de4b60c440d22d336a | add basis parsing to volume parser | envision/envision/parser/vasp/volume.py | envision/envision/parser/vasp/volume.py | #
# ENVISIoN
#
# Copyright (c) 2017 Fredrik Segerhammar
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,... | #
# ENVISIoN
#
# Copyright (c) 2017 Fredrik Segerhammar
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,... | Python | 0.000001 |
d043afa075cfdb347172047ac17082911c637ef9 | set default values for required config variables | packages/grid/backend/app/app/core/config.py | packages/grid/backend/app/app/core/config.py | # stdlib
import secrets
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Union
# third party
from pydantic import AnyHttpUrl
from pydantic import BaseSettings
from pydantic import EmailStr
from pydantic import HttpUrl
from pydantic import PostgresDsn... | # stdlib
import secrets
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Union
# third party
from pydantic import AnyHttpUrl
from pydantic import BaseSettings
from pydantic import EmailStr
from pydantic import HttpUrl
from pydantic import PostgresDsn... | Python | 0.000003 |
812c40bfaf2ef4f59643c53e8b8ac76f20777423 | Modify a debian example to archlinux | fabtools/arch.py | fabtools/arch.py | """
Archlinux packages
==================
This module provides tools to manage Archlinux packages
and repositories.
"""
from __future__ import with_statement
from fabric.api import hide, run, settings
from fabtools.utils import run_as_root
MANAGER = 'LC_ALL=C pacman'
def update_index(quiet=True):
"""
Up... | """
Archlinux packages
==================
This module provides tools to manage Archlinux packages
and repositories.
"""
from __future__ import with_statement
from fabric.api import hide, run, settings
from fabtools.utils import run_as_root
MANAGER = 'LC_ALL=C pacman'
def update_index(quiet=True):
"""
Up... | Python | 0.999775 |
c9aff74371f176daa011514a05875f59c86a33c6 | Refactor CLI argument parsing. | checker/main.py | checker/main.py | #!/usr/bin/env python
import os
import sys
import subprocess
import argparse
class Checker:
def __init__(self, path):
if not os.path.isdir(path):
sys.exit(1);
self.path = os.path.realpath(path)
self.jobs = self.getExecutableFiles(self.path)
def getExecutableFiles(self,pat... | #!/usr/bin/env python
import os
import sys
import subprocess
import getopt
class Checker:
def __init__(self, path):
if not os.path.isdir(path):
sys.exit(1);
self.path = os.path.realpath(path)
self.jobs = self.getExecutableFiles(self.path)
def getExecutableFiles(self,path)... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.