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 |
|---|---|---|---|---|---|---|---|---|
11cd074f67668135d606f68dddb66c465ec01756 | Add db index on field tag name | jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps,opps/opps,YACOWS/opps,YACOWS/opps,opps/opps,opps/opps,jeanmask/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,williamroot/opps,williamroot/opps | opps/core/tags/models.py | opps/core/tags/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from opps.core.models import Date, Slugged
class Tag(Date, Slugged):
name = models.CharField(_(u'Name'), max_length=255, unique=True,
... | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from opps.core.models import Date, Slugged
class Tag(Date, Slugged):
name = models.CharField(_(u'Name'), max_length=255, unique=True)
def save(self,... | mit | Python |
706aa6ed7170709828258bca1b9a1dfe6e8fa77e | improve helper functions | gousaiyang/SoftwareList,gousaiyang/SoftwareList | SLHelper.py | SLHelper.py | # -*- coding: utf-8 -*-
import re
import tkinter
from tkinter import messagebox
def file_content(filename):
with open(filename, 'rb') as fin:
content = fin.read()
return content.decode('utf-8')
def write_file(filename, content):
with open(filename, 'wb') as fout:
fout.write(c... | # -*- coding: utf-8 -*-
import re
import tkinter
from tkinter import messagebox
def file_content(filename):
with open(filename, 'r') as fin:
content = fin.read()
return content
def write_file(filename, content):
with open(filename, 'wb') as fout:
fout.write(content.encode('ut... | mit | Python |
9d65b613384b1d4781efd65588639ad68261e8d7 | Remove unused import. | Lukasa/cryptography,kimvais/cryptography,skeuomorf/cryptography,sholsapp/cryptography,dstufft/cryptography,sholsapp/cryptography,skeuomorf/cryptography,sholsapp/cryptography,glyph/cryptography,skeuomorf/cryptography,bwhmather/cryptography,Ayrx/cryptography,Hasimir/cryptography,Hasimir/cryptography,Ayrx/cryptography,kim... | cryptography/hazmat/primitives/hmac.py | cryptography/hazmat/primitives/hmac.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | bsd-3-clause | Python |
38a2d86aed4ea1e94691993c5f49722f9a69ac8d | Remove Python < 3.6 version check | ARM-software/lisa,credp/lisa,credp/lisa,credp/lisa,credp/lisa,ARM-software/lisa,ARM-software/lisa,ARM-software/lisa | lisa/__init__.py | lisa/__init__.py | #! /usr/bin/env python3
import warnings
import os
import sys
from lisa.version import __version__
# Raise an exception when a deprecated API is used from within a lisa.*
# submodule. This ensures that we don't use any deprecated APIs internally, so
# they are only kept for external backward compatibility purposes.
... | #! /usr/bin/env python3
import warnings
import os
import sys
from lisa.version import __version__
# Raise an exception when a deprecated API is used from within a lisa.*
# submodule. This ensures that we don't use any deprecated APIs internally, so
# they are only kept for external backward compatibility purposes.
... | apache-2.0 | Python |
13298bd49d9c72b8db6650fb0f8b316998b302f0 | Add permissions on TodoList model. | endthestart/safarido,endthestart/safarido,endthestart/safarido | safarido/todos/models.py | safarido/todos/models.py | from django.conf import settings
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
class TimestampedModel(models.Model):
created_on = models.DateTimeField(_('created on'), auto_now_add=True)
modified_on = models.DateTimeFiel... | from django.conf import settings
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
class TimestampedModel(models.Model):
created_on = models.DateTimeField(_('created on'), auto_now_add=True)
modified_on = models.DateTimeFiel... | mit | Python |
b16a1987075bd72cb7d31cf3dc7e529ce8d0e102 | fix loop | TejasM/wisely,TejasM/wisely,TejasM/wisely | wisely_project/get_courses_file.py | wisely_project/get_courses_file.py | import sys
import os
import traceback
from django import db
sys.path.append('/root/wisely/wisely_project/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'wisely_project.settings.production'
from django.db.models import F, Q
from django.utils import timezone
from users.tasks import get_coursera_courses, get_edx_courses, ge... | import sys
import os
import traceback
from django import db
sys.path.append('/root/wisely/wisely_project/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'wisely_project.settings.production'
from django.db.models import F
from django.utils import timezone
from users.tasks import get_coursera_courses, get_edx_courses, get_u... | mit | Python |
a2c484afc3951a77a6684f9c7323672c6db691aa | Fix name of celery queue | rileymcdowell/genomic-neuralnet,rileymcdowell/genomic-neuralnet,rileymcdowell/genomic-neuralnet | genomic_neuralnet/common/celery_slave.py | genomic_neuralnet/common/celery_slave.py | from __future__ import print_function
import os
import sys
import time
import numpy as np
import redis
import pickle
from itertools import chain
from genomic_neuralnet.common.base_compare import try_predictor
from genomic_neuralnet.util.ec2_util import get_master_dns
from celery import Celery
import celery.app.cont... | from __future__ import print_function
import os
import sys
import time
import numpy as np
import redis
import pickle
from itertools import chain
from genomic_neuralnet.common.base_compare import try_predictor
from genomic_neuralnet.util.ec2_util import get_master_dns
from celery import Celery
import celery.app.cont... | mit | Python |
e8003dbb1e6a7efe60b02c65207c7202236b1adb | Update InputDialogCtrl.py | Relrin/Helenae,Relrin/Helenae,Relrin/Helenae | helenae/gui/widgets/InputDialogCtrl.py | helenae/gui/widgets/InputDialogCtrl.py | # -*- coding: utf-8 -*-
import wx
class InputDialog(wx.Dialog):
def __init__(self, parent, id, title, ico_folder, validator):
wx.Dialog.__init__(self, parent, id, title, style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)
self.label = wx.StaticText(self, label="Имя элемента:", pos=(15, 20))
... | # -*- coding: utf-8 -*-
import wx
from validators.FileValidator import FileValidator
class InputDialog(wx.Dialog):
def __init__(self, parent, id, title, ico_folder, validator):
wx.Dialog.__init__(self, parent, id, title, style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)
self.label = wx.StaticText(... | mit | Python |
a705892cd7e32a540c5fee61a2bf4c4d67abf477 | add get_all_required_node_names method | zdw/xos,cboling/xos,open-cloud/xos,zdw/xos,zdw/xos,opencord/xos,open-cloud/xos,cboling/xos,cboling/xos,zdw/xos,open-cloud/xos,cboling/xos,opencord/xos,opencord/xos,cboling/xos | xos/tosca/resources/xosresource.py | xos/tosca/resources/xosresource.py | class XOSResource(object):
xos_base_class = "XOSResource"
xos_model = None
provides = None
def __init__(self, user, nodetemplate):
self.dirty = False
self.user = user
self.nodetemplate = nodetemplate
def get_all_required_node_names(self):
results = []
for re... | class XOSResource(object):
xos_base_class = "XOSResource"
xos_model = None
provides = None
def __init__(self, user, nodetemplate):
self.dirty = False
self.user = user
self.nodetemplate = nodetemplate
def get_requirements(self, relationship_name, throw_exception=False):
... | apache-2.0 | Python |
cb3bb4d350d5b05c9f3f123dc71dc4cec9f70703 | Convert to use Context. | pfalcon/picotui | example_widgets.py | example_widgets.py | from picotui.context import Context
from picotui.screen import Screen
from picotui.widgets import *
from picotui.defs import *
with Context():
Screen.attr_color(C_WHITE, C_BLUE)
Screen.cls()
Screen.attr_reset()
d = Dialog(5, 5, 50, 12)
# Can add a raw string to dialog, will be converted to WLabe... | from picotui.screen import Screen
from picotui.widgets import *
from picotui.defs import *
if __name__ == "__main__":
s = Screen()
try:
s.init_tty()
s.enable_mouse()
s.attr_color(C_WHITE, C_BLUE)
s.cls()
s.attr_reset()
d = Dialog(5, 5, 50, 12)
# Can ad... | mit | Python |
bc6772cb8990039479f6fe2b238304765aafab41 | make 70_web.py better | moskytw/mosql,uranusjr/mosql | examples/70_web.py | examples/70_web.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Run this script, then try the following urls:
#
# 1. http://127.0.0.1:5000/?person_id=mosky
# 2. http://127.0.0.1:5000/?name=Mosky Liu
# 3. http://127.0.0.1:5000/?name like=%Mosky%
#
import psycopg2
from flask import Flask, request, jsonify
from mosql.query import selec... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Run this script, then try the following urls:
#
# 1. http://127.0.0.1:5000/?person_id=mosky
# 2. http://127.0.0.1:5000/?name=Mosky Liu
# 3. http://127.0.0.1:5000/?name like=%Mosky%
#
import psycopg2
from flask import Flask, request, jsonify
from mosql.query import selec... | mit | Python |
cb5aeedc651773d1c298b167b07aa535dfd7beca | Fix typos/spelling in serializer docstrings (#2420) | Parsl/parsl,Parsl/parsl,Parsl/parsl,Parsl/parsl | parsl/serialize/concretes.py | parsl/serialize/concretes.py | import dill
import pickle
import logging
logger = logging.getLogger(__name__)
from parsl.serialize.base import SerializerBase
class PickleSerializer(SerializerBase):
""" Pickle serialization covers most python objects, with some notable exceptions:
* functions defined in a interpreter/notebook
* classes... | import dill
import pickle
import logging
logger = logging.getLogger(__name__)
from parsl.serialize.base import SerializerBase
class PickleSerializer(SerializerBase):
""" Pickle serialization covers most python objects, with some notable exceptions:
* functions defined in a interpretor/notebook
* classes... | apache-2.0 | Python |
7fd76d87cfda8f02912985cb3cf650ee8ff2e11e | Remove py2 Ska.DBI assert in report test | sot/mica,sot/mica | mica/report/tests/test_write_report.py | mica/report/tests/test_write_report.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import tempfile
import os
import shutil
import pytest
from .. import report
try:
import Ska.DBI
with Ska.DBI.DBI(server='sqlsao', dbi='sybase', user='aca_ops', database='axafocat') as db:
HAS_SYBASE_ACCESS = True
except:
HAS_SYBASE_AC... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import tempfile
import os
import shutil
import pytest
from .. import report
try:
import Ska.DBI
with Ska.DBI.DBI(server='sqlsao', dbi='sybase', user='aca_ops', database='axafocat') as db:
assert db.conn._is_connected == 1
HAS_SYBA... | bsd-3-clause | Python |
319d457e1e6511f6c240f5f4f5479181647f7cf6 | Fix bug with test | jkitchin/scopus,scopus-api/scopus | scopus/tests/test_AffiliationSearch.py | scopus/tests/test_AffiliationSearch.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `AffiliationSearch` module."""
from collections import namedtuple
from nose.tools import assert_equal, assert_true
import scopus
s = scopus.AffiliationSearch('af-id(60021784)', refresh=True)
def test_affiliations():
received = s.affiliations
asser... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `AffiliationSearch` module."""
from collections import namedtuple
from nose.tools import assert_equal, assert_true
import scopus
s = scopus.AffiliationSearch('af-id(60021784)', refresh=True)
def test_affiliations():
received = s.affiliations
asser... | mit | Python |
ed0821bd41a10dd00727f09cf9ba82123bd2cf93 | Fix output of permissions import script | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | scripts/import_permissions_and_roles.py | scripts/import_permissions_and_roles.py | #!/usr/bin/env python
"""Import permissions, roles, and their relations from a TOML file.
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
import click
from byceps.services.authorization import impex_service
from byceps.util.system import get_config_filename_from... | #!/usr/bin/env python
"""Import permissions, roles, and their relations from a TOML file.
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
import click
from byceps.services.authorization import impex_service
from byceps.util.system import get_config_filename_from... | bsd-3-clause | Python |
cf94a8a51d4e8eb3fd96ca3587af0f4c38e2deec | Fix kdtree example | larsmans/python-pcl,amitibo/python-pcl,amitibo/python-pcl,amitibo/python-pcl,larsmans/python-pcl,larsmans/python-pcl | examples/kdtree.py | examples/kdtree.py | from __future__ import print_function
import numpy as np
import pcl
points_1 = np.array([[0, 0, 0],
[1, 0, 0],
[0, 1, 0],
[1, 1, 0]], dtype=np.float32)
points_2 = np.array([[0, 0, 0.2],
[1, 0, 0],
[0, 1, 0],
... | from __future__ import print_function
import numpy as np
import pcl
pc_1 = pcl.PointCloud()
pc_1.from_array(points_1)
pc_2 = pcl.PointCloud()
pc_2.from_array(points_2)
kd = pcl.KdTreeFLANN(pc_1)
points_1 = np.array([[0, 0, 0],
[1, 0, 0],
[0, 1, 0],
[1, 1... | bsd-3-clause | Python |
881290c3d29ad28fb0fddfdd895fe493d7909262 | make the wsgi.py work with all providers | mrdakoki/ballin-avenger,natea/django-deployer,natea/django-deployer,mrdakoki/ballin-avenger | django_deployer/paas_templates/wsgi.py | django_deployer/paas_templates/wsgi.py | import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'{{ project_name }}')))
os.environ['DJANGO_SETTINGS_MODULE'] = '{{ django_settings }}_{{ provider }}'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler() | import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'{{ project_name }}')))
os.environ['DJANGO_SETTINGS_MODULE'] = '{{ django_settings }}_stackato'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler() | mit | Python |
7b84c2bd59f455050a249da795d1a73021b12581 | Add an import | thombashi/pathvalidate | pathvalidate/__init__.py | pathvalidate/__init__.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from ._error import NullNameError
from ._error import InvalidCharError
from ._error import InvalidCharWindowsError
from ._error import InvalidLengthError
from ._common import _validate_null_strin... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from ._error import NullNameError
from ._error import InvalidCharError
from ._error import InvalidLengthError
from ._common import _validate_null_string
from ._app import validate_excel_sheet_nam... | mit | Python |
343ed4b5ce1685c00eb611982319e48047c46361 | remove dead code | fifoforlifo/pyqplan | samples/test_a/test_a.py | samples/test_a/test_a.py | class project:
title = "Main Project"
estimate = 3
class task_a:
estimate = 8
class task_b:
title = "Task B"
estimate = 4
def deps(): return [project.task_a, other.task_d]
class task_c:
estimate = 6
def deps(): return [project.task_a]
class other:
... | class project:
title = "Main Project"
estimate = 3
class task_a:
estimate = 8
class task_b:
title = "Task B"
estimate = 4
def deps(): return [project.task_a, other.task_d]
class task_c:
estimate = 6
def deps(): return [project.task_a]
class other:
... | apache-2.0 | Python |
ba0f68221ed0aa3d0fcf99efcb3180ddd9d89e0b | add imports to magenta/music/__init__.py for notebook functions (#246) | magenta/note-seq,magenta/note-seq,magenta/note-seq | __init__.py | __init__.py | # Copyright 2016 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 ag... | # Copyright 2016 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 ag... | apache-2.0 | Python |
1fd2623c1e718a1b6685c82f40d4bcb11dd8541d | Add a get_collection method. | materialsproject/pymatgen-db,migueldiascosta/pymatgen-db,migueldiascosta/pymatgen-db,migueldiascosta/pymatgen-db,materialsproject/pymatgen-db,migueldiascosta/pymatgen-db,migueldiascosta/pymatgen-db | matgendb/util.py | matgendb/util.py | """
Utility functions used across scripts
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "1.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Dec 1, 2012"
import bson
import datetime
import json
import os
from pymongo import Connection... | """
Utility functions used across scripts
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "1.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Dec 1, 2012"
import bson
import datetime
import json
import os
DEFAULT_PORT = 27017
DEFAULT... | mit | Python |
47077fd978866acefb127d3ca3b72182a468a020 | Support prelim.csv files in sort_sam.py script. | cfe-lab/MiCall,cfe-lab/MiCall,cfe-lab/MiCall | micall/utils/sort_sam.py | micall/utils/sort_sam.py | #! /usr/bin/env python3
import csv
import json
import os
from argparse import ArgumentParser, FileType, ArgumentDefaultsHelpFormatter
import subprocess
from pathlib import Path
import typing
def parse_args():
# noinspection PyTypeChecker
parser = ArgumentParser(description='Sort SAM file before viewing.',
... | #! /usr/bin/env python3
import os
from argparse import ArgumentParser, FileType
import subprocess
def parse_args():
parser = ArgumentParser(description='Sort SAM file before viewing.')
parser.add_argument('sam', help='SAM file to sort')
return parser.parse_args()
def main():
args = parse_args()
... | agpl-3.0 | Python |
1b3b3edac1b01a59519690c86647c70a67c4d90b | Add support for relative paths in mac os gen_snapshot. (#35324) | rmacnak-google/engine,flutter/engine,flutter/engine,rmacnak-google/engine,chinmaygarde/flutter_engine,rmacnak-google/engine,flutter/engine,rmacnak-google/engine,flutter/engine,chinmaygarde/flutter_engine,chinmaygarde/flutter_engine,flutter/engine,rmacnak-google/engine,chinmaygarde/flutter_engine,chinmaygarde/flutter_en... | sky/tools/create_macos_gen_snapshots.py | sky/tools/create_macos_gen_snapshots.py | #!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import subprocess
import sys
import os
buildroot_dir = os.path.abspath(
os.path.join(os.path.realpath(__file__),... | #!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import subprocess
import sys
import os
def main():
parser = argparse.ArgumentParser(
description='Copies ar... | bsd-3-clause | Python |
16b92aac9a7f82a3c15bd2e50d02e4af482a7cf0 | Fix crestHandler auth callback. | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | mint/web/cresthandler.py | mint/web/cresthandler.py | from conary.repository.netrepos import proxy
import restlib.http.modpython
from restlib import response
import crest.root
import crest.webhooks
from mint.rest.db import database as restDatabase
from mint.db import database
from mint.rest.middleware import auth
def handleCrest(uri, cfg, db, repos, req):
handler... | from conary.repository.netrepos import proxy
import restlib.http.modpython
from restlib import response
import crest.root
import crest.webhooks
from mint.rest.db import database as restDatabase
from mint.db import database
from mint.rest.middleware import auth
def handleCrest(uri, cfg, db, repos, req):
handler... | apache-2.0 | Python |
f20c911285cc83f2cfe2b4650ba85f4b82eae43c | Improve description about the api | KeyWeeUsr/plyer,kivy/plyer,kivy/plyer,kived/plyer,KeyWeeUsr/plyer,kived/plyer,kivy/plyer,KeyWeeUsr/plyer | plyer/facades/temperature.py | plyer/facades/temperature.py | class Temperature(object):
'''Temperature facade.
Temperature sensor is used to measure the ambient room temperature in
degrees Celsius (°C)
With method `enable` you can turn on temperature sensor and 'disable'
method stops the sensor.
Use property `temperature` to get ambient air temperature in... | class Temperature(object):
'''Temperature facade.
Temperature sensor is used to measure the ambient room temperature in degrees Celsius
With method `enable` you can turn on temperature sensor and 'disable'
method stops the sensor.
Use property `temperature` to get ambient air temperature in degree C... | mit | Python |
bec24879cafaa4e17dd7cd56bcdaa3b04cb378b9 | remove test_dpdk_vf.py from run_tests | stackforge/fuel-plugin-contrail,stackforge/fuel-plugin-contrail,stackforge/fuel-plugin-contrail,stackforge/fuel-plugin-contrail | plugin_test/run_tests.py | plugin_test/run_tests.py | """Copyright 2015 Mirantis, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | """Copyright 2015 Mirantis, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | apache-2.0 | Python |
f956159efe43f14618c1b2baed8abaddbab42488 | Fix export_models.py to work with new structure | crossroads-education/eta,crossroads-education/eta | scripts/export_models.py | scripts/export_models.py | import json
import os
import utils
def process_file(filename):
handle = open(filename, "r")
lines = handle.read().replace("\r", "").split("\n")
handle.close()
real_lines = []
for line in lines:
line = line.replace(" default ", " ")
raw_line = line.strip()
if raw_line.startsw... | import os
import utils
def process_file(filename):
handle = open(filename, "r")
lines = handle.read().replace("\r", "").split("\n")
handle.close()
real_lines = []
for line in lines:
line = line.replace(" default ", " ")
raw_line = line.strip()
if raw_line.startswith("@") or ... | mit | Python |
7f876881267da77efeb8c3f5bb585502e33e76fc | add imagefile funcs to namespace | dalejung/ts-charting | ts_charting/__init__.py | ts_charting/__init__.py | from ts_charting.figure import Figure, Grapher
from ts_charting.charting import *
import ts_charting.ohlc
import ts_charting.boxplot
import ts_charting.span
from ts_charting.styler import styler, marker_styler, level_styler
from ts_charting.ipython import figsize, IN_NOTEBOOK
from ts_charting.plot_3d import plot_wire... | from ts_charting.figure import Figure, Grapher
from ts_charting.charting import *
import ts_charting.ohlc
import ts_charting.boxplot
import ts_charting.span
from ts_charting.styler import styler, marker_styler, level_styler
from ts_charting.ipython import figsize, IN_NOTEBOOK
from ts_charting.plot_3d import plot_wire... | mit | Python |
cb47cd2fbd37b9fce12abbf1c0ccff38d863f838 | Add some refactorings | timtroendle/pytus2000 | scripts/generate_code.py | scripts/generate_code.py | from collections import namedtuple
from itertools import dropwhile, groupby
VARIABLE_SECTION_START = 'Pos. = '
VARIABLE_NAME_FIELD = 'Variable = '
VARIABLE_LABEL_FIELD = 'Variable label = '
VALUE_FIELD = 'Value = '
VALUE_LABEL_FIELD = 'Label = '
Variable = namedtuple('Variable', ['id', 'name', 'label', 'values'])
c... | from collections import namedtuple
from itertools import dropwhile, groupby
VARIABLE_SECTION_START = 'Pos. = '
VARIABLE_NAME_FIELD = 'Variable = '
VARIABLE_LABEL_FIELD = 'Variable label = '
VALUE_FIELD = 'Value = '
VALUE_LABEL_FIELD = 'Label = '
Variable = namedtuple('Variable', ['id', 'name', 'label', 'values'])
c... | mit | Python |
90d42e80690a80a7099142b6b024c8d3b0f78075 | Fix DelayedCall cancellation in remind plugin on reload | JohnMaguire/Cardinal | plugins/remind/plugin.py | plugins/remind/plugin.py | from twisted.internet import error, reactor
from cardinal.decorators import command, help
class RemindPlugin:
def __init__(self):
self.call_ids = []
@command('remind')
@help("Sends a reminder after a set time.")
@help("Syntax: .remind <minutes> <message>")
def remind(self, cardinal, user... | from twisted.internet import error, reactor
from cardinal.decorators import command, help
class RemindPlugin:
def __init__(self):
self.call_ids = []
@command('remind')
@help("Sends a reminder after a set time.")
@help("Syntax: .remind <minutes> <message>")
def remind(self, cardinal, user... | mit | Python |
d6c81135077867283738bcf9cceb0ce8198808d6 | Enable SSL verify for prod | amm0nite/unicornclient,amm0nite/unicornclient | unicornclient/config.py | unicornclient/config.py | import os
import logging
ENV = os.getenv('PYTHONENV', 'prod')
LOG_LEVEL = logging.DEBUG
LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
HOST = 'localhost'
PORT = 8080
SSL_VERIFY = False
DEFAULT_ROUTINES = ['auth', 'ping', 'status', 'system']
if ENV == 'prod':
LOG_LEVEL = logging.INFO
HOST = 'unic... | import os
import logging
ENV = os.getenv('PYTHONENV', 'prod')
LOG_LEVEL = logging.DEBUG
LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
HOST = 'localhost'
PORT = 8080
SSL_VERIFY = False
DEFAULT_ROUTINES = ['auth', 'ping', 'status', 'system']
if ENV == 'prod':
LOG_LEVEL = logging.INFO
HOST = 'unic... | mit | Python |
5741d373ce42e7fbf7f888e4c220b033d21567fb | move default iembot listen ports | akrherz/iembot,akrherz/iembot | iembot.tac | iembot.tac | # Twisted Bits
from twisted.application import service, internet
from twisted.web import server
from twisted.enterprise import adbapi
# Base Python
import json
# Local Import
import iemchatbot
dbconfig = json.load(open('settings.json'))
application = service.Application("Public IEMBOT")
serviceCollection = service... | # Twisted Bits
from twisted.application import service, internet
from twisted.web import server
from twisted.enterprise import adbapi
# Base Python
import json
# Local Import
import iemchatbot
dbconfig = json.load(open('settings.json'))
application = service.Application("Public IEMBOT")
serviceCollection = service... | mit | Python |
4312dcee00eabe97040a7a1da58f25d714a9dfee | Remove debug statement and prevent nsfw for images | jakebasile/procbot,jakebasile/procbot,jakebasile/procbot,jakebasile/procbot,jakebasile/procbot | scripts/python/reddit.py | scripts/python/reddit.py | #!/usr/bin/env python3
# Copyright 2012-2013 Jake Basile and Kyle Varga
#
# 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 requir... | #!/usr/bin/env python3
# Copyright 2012-2013 Jake Basile and Kyle Varga
#
# 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 requir... | bsd-2-clause | Python |
f6cf19966651e8c1e21fa3bde777c5bad6285c9f | add print | jluccisano/raspberry-scripts,jluccisano/raspberry-scripts | scripts/relay_control.py | scripts/relay_control.py | #!/usr/bin/python
import RPi.GPIO as GPIO
import argparse
GPIO.setmode(GPIO.BOARD)
# GPIO/BOARD | Relay IN | Rotors | Zone
# 22/15 | R2 IN2 | 1 | B
# 18/12 | R1 IN2 | 2 | A
# 24/18 | R1 IN3 | 3 | D
# 17/11 | R1 IN4 | 4 | C
# 27/13 | R2 IN1 | 5 | E
relayIO =... | #!/usr/bin/python
import RPi.GPIO as GPIO
import argparse
GPIO.setmode(GPIO.BOARD)
# GPIO/BOARD | Relay IN | Rotors | Zone
# 22/15 | R2 IN2 | 1 | B
# 18/12 | R1 IN2 | 2 | A
# 24/18 | R1 IN3 | 3 | D
# 17/11 | R1 IN4 | 4 | C
# 27/13 | R2 IN1 | 5 | E
relayIO =... | mit | Python |
2f6d64325e1d4aa23d892db33402f455bd75458d | Reduce QR code box size. | Steveice10/FBI,Steveice10/FBI,Steveice10/FBI | servefiles/servefiles.py | servefiles/servefiles.py | import atexit
import os
import sys
import tempfile
import threading
import urllib
import netifaces
import qrcode
from PIL import ImageTk
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import TCPServer
from Tkinter import Tk, Frame, Label, BitmapImage
from urlparse import urljoin
fr... | import atexit
import os
import sys
import tempfile
import threading
import urllib
import netifaces
import qrcode
from PIL import ImageTk
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import TCPServer
from Tkinter import Tk, Frame, Label, BitmapImage
from urlparse import urljoin
fr... | mit | Python |
8bc482db2e9cf98d3e3571f49a85ee7a287efaf7 | Use DjangoJSONEncoder when serving jsonp requests | codeforboston/cornerwise,cityofsomerville/citydash,cityofsomerville/citydash,cityofsomerville/citydash,cityofsomerville/cornerwise,cityofsomerville/cornerwise,cityofsomerville/cornerwise,codeforboston/cornerwise,codeforboston/cornerwise,cityofsomerville/citydash,cityofsomerville/cornerwise,codeforboston/cornerwise | server/shared/request.py | server/shared/request.py | from django.core.serializers.json import DjangoJSONEncoder
from django.http import JsonResponse, HttpResponse
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
import logging, json, re
logger = logging.getLogger("logger")
class ErrorResponse(Exception):
def __ini... | from django.http import JsonResponse, HttpResponse
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
import logging
import json
import re
logger = logging.getLogger("logger")
class ErrorResponse(Exception):
def __init__(self, message, data=None, status=401, err=N... | mit | Python |
e1d119d743076b29cf19c584c337579903ab3875 | fix templates path | criscv94/bdd_repo,criscv94/bdd_repo,criscv94/bdd_repo | flaskr/__init__.py | flaskr/__init__.py | #!/usr/bin/python3
# -*- coding: latin-1 -*-
import os
import sys
# import psycopg2
import json
from bson import json_util
from pymongo import MongoClient
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
def create_app():
app = Flask(__name__)
return app
a... | #!/usr/bin/python3
# -*- coding: latin-1 -*-
import os
import sys
# import psycopg2
import json
from bson import json_util
from pymongo import MongoClient
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
def create_app():
app = Flask(__name__)
return app
a... | mit | Python |
22571c096051fefc28b467ca29d93a4f0ea6cb9c | fix column pruning | dwa/mongoose_fdw,asya999/mongoose_fdw,laurenhecht/mongoose_fdw | mongoose_fdw/__init__.py | mongoose_fdw/__init__.py | ###
### Author: David Wallin
### Time-stamp: <2015-03-02 08:56:11 dwa>
from multicorn import ForeignDataWrapper
from multicorn.utils import log_to_postgres as log2pg
from pymongo import MongoClient
class Mongoose_fdw (ForeignDataWrapper):
def __init__(self, options, columns):
super(Mongoose_fdw, self).... | ###
### Author: David Wallin
### Time-stamp: <2015-03-02 08:56:11 dwa>
from multicorn import ForeignDataWrapper
from multicorn.utils import log_to_postgres as log2pg
from pymongo import MongoClient
class Mongoose_fdw (ForeignDataWrapper):
def __init__(self, options, columns):
super(Mongoose_fdw, self).... | mit | Python |
441cfadb97879d9ac76407145ba77185bbb292f8 | fix regex n test | Fantomas42/mots-vides,Fantomas42/mots-vides | mots_vides/stop_words.py | mots_vides/stop_words.py | """
StopWord Python container, managing collection of stop words.
"""
import re
class StopWord(object):
"""
Object managing collection of stop words for a given language.
"""
def __init__(self, language, collection=[]):
"""
Initializes with a given language and an optional collection.... | """
StopWord Python container, managing collection of stop words.
"""
import re
class StopWord(object):
"""
Object managing collection of stop words for a given language.
"""
def __init__(self, language, collection=[]):
"""
Initializes with a given language and an optional collection.... | bsd-3-clause | Python |
9c7d335780e219893f0976cda6a5388b51fa0a64 | Update to v19.2.6 | Dark5ide/mycroft-core,Dark5ide/mycroft-core | mycroft/version/__init__.py | mycroft/version/__init__.py | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | apache-2.0 | Python |
0d77cb02dfec448c1de8def96c9b73856b602759 | Update models.py | Bouke/django-user-sessions,Bouke/django-user-sessions,jmp0xf/django-user-sessions,ivorbosloper/django-user-sessions,jmp0xf/django-user-sessions,ivorbosloper/django-user-sessions | user_sessions/models.py | user_sessions/models.py | import django
from django.conf import settings
from django.contrib.sessions.models import SessionManager
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Session(models.Model):
"""
Session objects containing user session information.
Django provides full support ... | import django
from django.conf import settings
from django.contrib.sessions.models import SessionManager
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Session(models.Model):
"""
Session objects containing user session information.
Django provides full support ... | mit | Python |
b5814202bdcc5a15503d6c52c59aa2eb8736b7ec | Add whitelist to redpill plugin | alama/PSO2Proxy,cyberkitsune/PSO2Proxy,alama/PSO2Proxy,flyergo/PSO2Proxy,flyergo/PSO2Proxy,cyberkitsune/PSO2Proxy,alama/PSO2Proxy,cyberkitsune/PSO2Proxy | proxy/plugins/redpill.py | proxy/plugins/redpill.py | # redpill.py PSO2Proxy plugin
# For use with redpill.py flask webapp and website for packet logging and management
import sqlite, plugins
dbLocation = '/var/pso2-www/redpill/redpill.db'
enabled = False
if enabled:
@plugins.onStartHook
def redpillInit():
print("[Redpill] Redpill initilizing with database %s." % db... | # redpill.py PSO2Proxy plugin
# For use with redpill.py flask webapp and website for packet logging and management
import sqlite
dbLocation = '/var/pso2-www/redpill/redpill.db'
#TODO | agpl-3.0 | Python |
28f74edc5b2902ccb9026388db789807a5c2e1f1 | Append layout and seat if in csv if exist in ticket. | wadobo/congressus,wadobo/congressus,wadobo/congressus,wadobo/congressus | congressus/invs/utils.py | congressus/invs/utils.py | from django.conf import settings
from django.http import HttpResponse
from .models import Invitation
from tickets.utils import concat_pdf
from tickets.utils import generate_pdf
def gen_csv_from_generator(ig, numbered=True, string=True):
csv = []
name = ig.type.name
for i, inv in enumerate(ig.invitations.... | from django.conf import settings
from django.http import HttpResponse
from .models import Invitation
from tickets.utils import concat_pdf
from tickets.utils import generate_pdf
def gen_csv_from_generator(ig, numbered=True, string=True):
csv = []
name = ig.type.name
for i, inv in enumerate(ig.invitations.... | agpl-3.0 | Python |
d7284d82367a3f9b7a3db4de88d3c06e92542b23 | fix bug in domain blacklist | MuckRock/muckrock,MuckRock/muckrock,MuckRock/muckrock,MuckRock/muckrock | muckrock/task/signals.py | muckrock/task/signals.py | """Signals for the task application"""
from django.db.models.signals import post_save
from email.utils import parseaddr
import logging
from muckrock.task.models import OrphanTask, BlacklistDomain
logger = logging.getLogger(__name__)
def domain_blacklist(sender, instance, **kwargs):
"""Blacklist certain domains ... | """Signals for the task application"""
from django.db.models.signals import post_save
from email.utils import parseaddr
import logging
from muckrock.task.models import OrphanTask, BlacklistDomain
logger = logging.getLogger(__name__)
def domain_blacklist(sender, instance, **kwargs):
"""Blacklist certain domains ... | agpl-3.0 | Python |
009f1ec1580653dfc600c505622b95d153be231d | fix the id column | gkralik/lightspeed | util/create_database.py | util/create_database.py | #!/usr/bin/env python
import os
import sys
import sqlite3
base_dir = os.path.dirname(os.path.realpath(os.path.join(__file__, '..')))
db_path = os.path.join(base_dir, 'db/lightspeed.db')
if len(sys.argv) == 2:
db_path = os.path.realpath(sys.argv[1])
try:
conn = sqlite3.connect(db_path)
c = conn.cursor();
... | #!/usr/bin/env python
import os
import sys
import sqlite3
base_dir = os.path.dirname(os.path.realpath(os.path.join(__file__, '..')))
db_path = os.path.join(base_dir, 'db/lightspeed.db')
if len(sys.argv) == 2:
db_path = os.path.realpath(sys.argv[1])
try:
conn = sqlite3.connect(db_path)
c = conn.cursor();
... | mit | Python |
30c2463ea91a6ae5c43e3c31d8efae093e9708c3 | fix attempt | viaict/viaduct,viaict/viaduct,viaict/viaduct,viaict/viaduct,viaict/viaduct | viaduct/models/group.py | viaduct/models/group.py | #!/usr/bin/python
from viaduct import db
from viaduct.models.permission import GroupPermission
user_group = db.Table('user_group',
db.Column('user_id', db.Integer, db.ForeignKey('user.id')),
db.Column('group_id', db.Integer, db.ForeignKey('group.id'))
)
class Group(db.Model):
__tablename__ = 'group'
id = db.Col... | #!/usr/bin/python
from viaduct import db
from viaduct.models.permission import GroupPermission
user_group = db.Table('user_group',
db.Column('user_id', db.Integer, db.ForeignKey('user.id')),
db.Column('group_id', db.Integer, db.ForeignKey('group.id'))
)
class Group(db.Model):
__tablename__ = 'group'
id = db.Col... | mit | Python |
980ea4be2fd6d05aa9ec64bfaa50d89161185ccd | rework httplib2.Http to be able to not verify certs if configuration tells the app not to verify them | ayan-usgs/PubsWarehouse_UI,mbucknell/PubsWarehouse_UI,jkreft-usgs/PubsWarehouse_UI,jkreft-usgs/PubsWarehouse_UI,USGS-CIDA/PubsWarehouse_UI,jkreft-usgs/PubsWarehouse_UI,ayan-usgs/PubsWarehouse_UI,mbucknell/PubsWarehouse_UI,USGS-CIDA/PubsWarehouse_UI,USGS-CIDA/PubsWarehouse_UI,ayan-usgs/PubsWarehouse_UI,mbucknell/PubsWar... | pubs_ui/metrics/views.py | pubs_ui/metrics/views.py |
from flask import Blueprint, render_template
from flask_login import login_required
from httplib2 import Http
from oauth2client.service_account import ServiceAccountCredentials
from .. import app
metrics = Blueprint('metrics', __name__,
template_folder='templates',
static_fold... |
from flask import Blueprint, render_template
from flask_login import login_required
from httplib2 import Http
from oauth2client.service_account import ServiceAccountCredentials
from .. import app
metrics = Blueprint('metrics', __name__,
template_folder='templates',
static_fold... | unlicense | Python |
290f864f1bb44300cec9bb9e28679c3d7ba70c7e | Test 1 done | mtb-za/fatiando,cmeessen/fatiando,drandykass/fatiando,cmeessen/fatiando,santis19/fatiando,victortxa/fatiando,drandykass/fatiando,fatiando/fatiando,mtb-za/fatiando,santis19/fatiando,victortxa/fatiando,rafaelmds/fatiando,fatiando/fatiando,rafaelmds/fatiando | cookbook/seismic_conv.py | cookbook/seismic_conv.py | """
Synthetic convolutional seismogram for a simple two layer velocity model
"""
import numpy as np
from fatiando.seismic import conv
from fatiando.vis import mpl
#model parameters
n_samples, n_traces = [600, 20]
rock_grid = 1500.*np.ones((n_samples, n_traces))
rock_grid[300:, :] = 2500.
#synthetic calculation
[vel_l, ... | """
Synthetic convolutional seismogram for a simple two layer velocity model
"""
import numpy as np
from fatiando.seismic import conv
from fatiando.vis import mpl
#model parameters
n_samples, n_traces = [600, 20]
rock_grid = 1500.*np.ones((n_samples, n_traces))
rock_grid[300:,:] = 2500.
#synthetic calculation
[vel_l, r... | bsd-3-clause | Python |
b4623bcdcd0a35091030057edc52870045a17223 | fix for Anaconda compatibility | wright-group/WrightTools,wright-group/WrightTools | __init__.py | __init__.py | '''
Import all subdirectories and modules.
'''
import os as _os
__all__ = []
for _path in _os.listdir(_os.path.dirname(__file__)):
_full_path = _os.path.join(_os.path.dirname(__file__), _path)
if _os.path.isdir(_full_path) and _path not in ['.git', 'examples', 'widgets']:
__import__(_path, locals(), g... | '''
Import all subdirectories and modules.
'''
import os as _os
__all__ = []
for _path in _os.listdir(_os.path.dirname(__file__)):
_full_path = _os.path.join(_os.path.dirname(__file__), _path)
if _os.path.isdir(_full_path) and _path not in ['.git', 'examples']:
__import__(_path, locals(), globals())
... | mit | Python |
2ce8efa3bf227c9a769121a4d313963f0cfbde51 | print sys args | loreguerra/bbt-chart | add_data.py | add_data.py | import psycopg2
import sys
from connect import connect_to_db
# add argparse for options via command line
# add new temperature and date
conn = connect_to_db()
cur = conn.cursor()
print sys.argv
| import psycopg2
import sys
from connect import connect_to_db
# add argparse for options via command line
# add new temperature and date
def add_temp(date, temp):
print date, temp
# conn = connect_to_db()
| mit | Python |
85da4c8cb3d613882eb46fb398e361286d4b4286 | fix add_page | j00bar/django-widgy,j00bar/django-widgy,j00bar/django-widgy | add_page.py | add_page.py | from widgy.models import *
page = ContentPage.objects.create(
title='widgy page'
)
page.root_widget = TwoColumnLayout.add_root().node
page.save()
for i in range(3):
page.root_widget.data.left_bucket.data.add_child(TextContent,
content='yay %s' % i
)
for i in range(2):
... | from widgy.models import *
page = ContentPage.objects.create(
title='widgy page'
)
page.root_widget = TwoColumnLayout.add_root().node
page.save()
for i in range(3):
page.root_widget.data.left_bucket.add_child(TextContent,
content='yay %s' % i
)
for i in range(2):
page... | apache-2.0 | Python |
8034a3f237fad994444cbc7edfffb658ef00f908 | Test commit | Signbank/BSL-signbank,Signbank/BSL-signbank,Signbank/Auslan-signbank,Signbank/Auslan-signbank,Signbank/BSL-signbank,Signbank/Auslan-signbank,Signbank/BSL-signbank,Signbank/Auslan-signbank | __init__.py | __init__.py | # test
| bsd-3-clause | Python | |
9cd440760ea789cf712491080e61205d03a027c8 | Support verbose and bleeding config from file | EPITECH-2022/TwentyTwo | __main__.py | __main__.py | import json, os.path
import discord
from discord.ext import commands
from Fun import Fun
def main():
# variables
config_file = 'config.json'
# load config
with open(config_file) as f:
config = json.load(f)
# split config
description, token = config['description'], config['token']
... | import json, os.path
import discord
from discord.ext import commands
from Fun import Fun
def main():
# variables
config_file = 'config.json'
# load config
with open(config_file) as f:
config = json.load(f)
# split config
description, token = config['description'], config['token']
... | mit | Python |
6bb6f73b6dd5a497a670ec3dc4d85483253737d2 | update dev version after 0.9.6 tag [skip ci] | desihub/desimodel,desihub/desimodel | py/desimodel/_version.py | py/desimodel/_version.py | __version__ = '0.9.6.dev431'
| __version__ = '0.9.6'
| bsd-3-clause | Python |
615613a3213e7b4023135b2fc85ac725d5f12656 | Add jvm_path argument to connect method | laughingman7743/PyAthenaJDBC,laughingman7743/PyAthenaJDBC | pyathenajdbc/__init__.py | pyathenajdbc/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
__version__ = '1.0.2'
__athena_driver_version__ = '1.0.0'
# Globals https://www.python.org/dev/peps/pep-0249/#globals
apilevel = '2.0'
threadsafety = 3
paramstyle = 'pyformat'
ATHENA_JAR = 'Athe... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
__version__ = '1.0.2'
__athena_driver_version__ = '1.0.0'
# Globals https://www.python.org/dev/peps/pep-0249/#globals
apilevel = '2.0'
threadsafety = 3
paramstyle = 'pyformat'
ATHENA_JAR = 'Athe... | mit | Python |
462312c3acf2d6daf7d8cd27f251b8cb92647f5e | Fix a typo in the variable name | jean/pybossa,geotagx/geotagx-pybossa-archive,OpenNewsLabs/pybossa,stefanhahmann/pybossa,proyectos-analizo-info/pybossa-analizo-info,stefanhahmann/pybossa,proyectos-analizo-info/pybossa-analizo-info,Scifabric/pybossa,geotagx/geotagx-pybossa-archive,geotagx/geotagx-pybossa-archive,OpenNewsLabs/pybossa,harihpr/tweetclicke... | pybossa/auth/category.py | pybossa/auth/category.py | from flaskext.login import current_user
def create(category=None):
if current_user.is_authenticated():
if current_user.admin is True:
return True
else:
return False
else:
return False
def read(category=None):
return True
def update(category):
return ... | from flaskext.login import current_user
def create(app=None):
if current_user.is_authenticated():
if current_user.admin is True:
return True
else:
return False
else:
return False
def read(app=None):
return True
def update(app):
return create(app)
d... | agpl-3.0 | Python |
ce384e6eb3f762f611bfd70874766248169a7d15 | indent fix | thesabbir/nginpro | nginpro/utils.py | nginpro/utils.py | """
Utilities
"""
from string import Template
"""
Generate configuration blocks
"""
def make_block(name, content, pattern=""):
return Template(
"""
${name} ${pattern} {
${content}
}
""").safe_substitute(name=name, content=content, pattern=pattern)
"""
Takes a python ... | """
Utilities
"""
from string import Template
"""
Generate configuration blocks
"""
def make_block(name, content, pattern=""):
return Template("""
${name} ${pattern} {
${content}
}
""").safe_substitute(name=name, content=content, pattern=pattern)
"""
Takes a python dictionary an... | mit | Python |
96ad539fdf0302dd0e2996f746ce1fd055c8e590 | fix log size to 5mb | 2gis/vmmaster,sh0ked/vmmaster,2gis/vmmaster,sh0ked/vmmaster,2gis/vmmaster | vmmaster/core/logger.py | vmmaster/core/logger.py | import logging
import logging.handlers
import graypy
import os
import sys
from .config import config
class StreamToLogger(object):
"""
Fake file-like stream object that redirects writes to a logger instance.
"""
def __init__(self, logger, log_level=logging.INFO):
self.logger = logger
... | import logging
import logging.handlers
import graypy
import os
import sys
from .config import config
class StreamToLogger(object):
"""
Fake file-like stream object that redirects writes to a logger instance.
"""
def __init__(self, logger, log_level=logging.INFO):
self.logger = logger
... | mit | Python |
23ab8664d1ed16ea0339f9b94938e1c95b574132 | Remove silly try/except blocks in button.py | AndyDeany/pygame-template | pygametemplate/button.py | pygametemplate/button.py | import time
from pygametemplate import log
class Button(object):
"""Class representing keyboard keys."""
def __init__(self, game, number):
self.game = game
self.number = number
self.event = None # The last event that caused the button press
self.pressed = 0 # If the but... | import time
from pygametemplate import log
class Button(object):
"""Class representing keyboard keys."""
def __init__(self, game, number):
self.game = game
try:
self.number = number
self.event = None # The last event that caused the button press
self.pre... | mit | Python |
1ee2e880872c4744f4159df7fc64bb64b3f35632 | Add docstring to Button.time_held() method | AndyDeany/pygame-template | pygametemplate/button.py | pygametemplate/button.py | import time
class Button(object):
"""Class representing keyboard keys."""
def __init__(self, game, number):
self.game = game
self.number = number
self.event = None # The last event that caused the button press
self.pressed = 0 # If the button was just pressed
sel... | import time
class Button(object):
"""Class representing keyboard keys."""
def __init__(self, game, number):
self.game = game
self.number = number
self.event = None # The last event that caused the button press
self.pressed = 0 # If the button was just pressed
sel... | mit | Python |
d7249e710be3da451b4ca752780e5a86501f6198 | update version number to 1.8.3 | frib-high-level-controls/FLAME,frib-high-level-controls/FLAME,frib-high-level-controls/FLAME,frib-high-level-controls/FLAME,frib-high-level-controls/FLAME,frib-high-level-controls/FLAME | python/flame/__init__.py | python/flame/__init__.py |
from collections import OrderedDict
from ._internal import (Machine as MachineBase,
GLPSPrinter, _GLPSParse,
_pyapi_version, _capi_version,
FLAME_ERROR, FLAME_WARN,
FLAME_INFO, FLAME_DEBUG,
setLogLe... |
from collections import OrderedDict
from ._internal import (Machine as MachineBase,
GLPSPrinter, _GLPSParse,
_pyapi_version, _capi_version,
FLAME_ERROR, FLAME_WARN,
FLAME_INFO, FLAME_DEBUG,
setLogLe... | mit | Python |
6708830ab2bde841bbc3da2befbbe5ab9f3d21aa | Put test stuff inside `if __name__ == '__main__'` | msabramo/ansi_str | ansi_str.py | ansi_str.py | import re
_ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])')
def strip_ansi(value):
return _ansi_re.sub('', value)
def len_exclude_ansi(value):
return len(strip_ansi(value))
class ansi_str(str):
"""A str subclass, specialized for strings containing ANSI escapes.
When you call the ``len`` metho... | import re
_ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])')
def strip_ansi(value):
return _ansi_re.sub('', value)
def len_exclude_ansi(value):
return len(strip_ansi(value))
class ansi_str(str):
"""A str subclass, specialized for strings containing ANSI escapes.
When you call the ``len`` metho... | mit | Python |
b9e12e6bb1d4d4cdb337cbf3d3cd7a41f57b4d24 | Use a more standard RPM query format | pombredanne/jsonstats,RHInception/jsonstats,pombredanne/jsonstats,RHInception/jsonstats | JsonStats/FetchStats/Plugins/RPM.py | JsonStats/FetchStats/Plugins/RPM.py | import datetime
from JsonStats.FetchStats import Fetcher
class RPM(Fetcher):
def __init__(self):
"""
Returns an rpm manifest (all rpms installed on the system.
**Note**: This takes more than a few seconds!!
"""
self.context = 'rpm'
self._load_data()
def _load_... | import datetime
from JsonStats.FetchStats import Fetcher
class RPM(Fetcher):
def __init__(self):
"""
Returns an rpm manifest (all rpms installed on the system.
**Note**: This takes more than a few seconds!!
"""
self.context = 'rpm'
self._load_data()
def _load_... | mit | Python |
9ec8aa9fbb9b8c6656e5fe8920787f2c03a93683 | create Cell class and method add_neighbor that returns a list of neighbor positions | BradleyMoore/Game_of_Life | app/life.py | app/life.py | class Cell(object):
def __init__(self, pos):
self.neighbors = 0
self.neighbor_list = []
self.pos = pos
self.posx = pos[0]
self.posy = pos[1]
def add_neighbors(self):
self.neighbor_list = []
for x in xrange(self.posx-1, self.posx+1):
for y in... | mit | Python | |
777eaf01586b330b976c2691bf73b9a2053ff978 | Store real non-stemmed texts | matnel/hs-comments-visu,matnel/hs-comments-visu | app/main.py | app/main.py | from flask import *
import collect_hs
import collections
import nltk
import numpy
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decomposition import LatentDirichletAllocation
app = Flask(__name__)
## common constructs
stem = nltk.stem.snowball.SnowballStemmer('finnish')
@app.route("/"... | from flask import *
import collect_hs
import collections
import nltk
import numpy
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decomposition import LatentDirichletAllocation
app = Flask(__name__)
## common constructs
stem = nltk.stem.snowball.SnowballStemmer('finnish')
@app.route("/"... | mit | Python |
1056c3f489b162d77b6c117fad2b45bfa06beee1 | Revert "Added a post view" | yourbuddyconner/cs399-social,yourbuddyconner/cs399-social | app/urls.py | app/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
#from . import views
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'app.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', 'app.views.splash', name='sp... | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
#from . import views
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'app.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', 'app.views.splash', name='... | unlicense | Python |
1165c923145be18d40fda1fc4303cac3e1613078 | Update cached_function wrapper to set qualname instead of name | albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com | app/util.py | app/util.py | # Various utility functions
import os
SHOULD_CACHE = os.environ.get('ENV', 'development') == 'production'
def cached_function(func):
data = {}
def wrapper(*args):
if not SHOULD_CACHE:
return func(*args)
cache_key = ' '.join([str(x) for x in args])
if cache_key not in dat... | # Various utility functions
import os
SHOULD_CACHE = os.environ.get('ENV', 'development') == 'production'
def cached_function(func):
data = {}
def wrapper(*args):
if not SHOULD_CACHE:
return func(*args)
cache_key = ' '.join([str(x) for x in args])
if cache_key not in dat... | mit | Python |
d39eb13f555daa429838b76de2f4088a46f36237 | tweak `do` | tek/amino | amino/do.py | amino/do.py | from types import GeneratorType
from typing import TypeVar, Callable, Any, Generator, cast, Type
import functools
from amino.tc.base import F
from amino.tc.monad import Monad
A = TypeVar('A')
B = TypeVar('B')
G = TypeVar('G', bound=F)
Do = Generator
def untyped_do(f: Callable[..., Generator[G, B, None]]) -> Callabl... | from types import GeneratorType
from typing import TypeVar, Callable, Any, Generator, cast, Optional, Type
import functools
from amino.tc.base import F
from amino.tc.monad import Monad
A = TypeVar('A')
B = TypeVar('B')
G = TypeVar('G', bound=F)
Do = Generator
def untyped_do(f: Callable[..., Generator[G, B, None]]) ... | mit | Python |
98a82f084c6693dbd7cd44774f52e1bbdd835d05 | Fix urls.py | rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug | rdmo/projects/urls/v1.py | rdmo/projects/urls/v1.py | from django.urls import include, path
from rest_framework_extensions.routers import ExtendedDefaultRouter
from ..viewsets import (CatalogViewSet, MembershipViewSet,
ProjectMembershipViewSet, ProjectQuestionSetViewSet,
ProjectSnapshotViewSet, ProjectValueViewSet,
... | from django.urls import include, path
from rest_framework_extensions.routers import ExtendedDefaultRouter
from ..viewsets import (ProjectQuestionSetViewSet, ProjectSnapshotViewSet, ProjectMembershipViewSet,
ProjectValueViewSet, ProjectViewSet, MembershipViewSet, SnapshotViewSet,
... | apache-2.0 | Python |
8b7ef1066abefae83876607fd1a9153662463185 | add try for obnl version loading in init | IntegrCiTy/obnl | obnl/__init__.py | obnl/__init__.py | import pkg_resources # part of setuptools
try:
__version__ = pkg_resources.require("obnl")[0].version
except:
pass
| import pkg_resources # part of setuptools
__version__ = pkg_resources.require("obnl")[0].version | apache-2.0 | Python |
32d49946279cab868b493aae432b431fa9d5e2bc | Add wrap at wrap_width unless it's 0. | randy3k/AutoWrap | autowrap.py | autowrap.py | import sublime, sublime_plugin, re, sys
if sys.version >= '3':
long = int
class AutoWrapListener(sublime_plugin.EventListener):
saved_sel = 0
def on_modified(self, view):
if view.is_scratch() or view.settings().get('is_widget'): return
if not view.settings().get('auto_wrap', False): retur... | import sublime, sublime_plugin, re, sys
if sys.version >= '3':
long = int
class AutoWrapListener(sublime_plugin.EventListener):
saved_sel = 0
def on_modified(self, view):
if view.is_scratch() or view.settings().get('is_widget'): return
if not view.settings().get('auto_wrap', False): retur... | mit | Python |
0f85b39fcca84b60815c54201f5f52eb9a2840c7 | Split the normalize function into two. | eliteraspberries/avena | avena/np.py | avena/np.py | #!/usr/bin/env python2
from numpy import around, empty as _empty, mean, std
from numpy import int8, int16, int32, int64
from numpy import uint8, uint16, uint32, uint64
from numpy import float32, float64
from sys import float_info as _float_info
_eps = 10.0 * _float_info.epsilon
# Map of NumPy array type strings to ... | #!/usr/bin/env python2
from numpy import around, empty as _empty, mean, std
from numpy import int8, int16, int32, int64
from numpy import uint8, uint16, uint32, uint64
from numpy import float32, float64
from sys import float_info as _float_info
_eps = 10.0 * _float_info.epsilon
# Map of NumPy array type strings to ... | isc | Python |
bdcafd0c5af46e88ae06e6bbb853d415a30f8d26 | test algo affine | neuropoly/spinalcordtoolbox,neuropoly/spinalcordtoolbox,neuropoly/spinalcordtoolbox,neuropoly/spinalcordtoolbox,neuropoly/spinalcordtoolbox,neuropoly/spinalcordtoolbox,neuropoly/spinalcordtoolbox | testing/test_sct_register_multimodal.py | testing/test_sct_register_multimodal.py | #!/usr/bin/env python
#########################################################################################
#
# Test function for sct_register_multimodal script
#
# replace the shell test script in sct 1.0
#
# ---------------------------------------------------------------------------------------
# Copyright (c) ... | #!/usr/bin/env python
#########################################################################################
#
# Test function for sct_register_multimodal script
#
# replace the shell test script in sct 1.0
#
# ---------------------------------------------------------------------------------------
# Copyright (c) ... | mit | Python |
1e704b4ac648d06a05d8c97e3ca38b64ea931c0a | Fix version number | lordappsec/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,juga0/ooni-probe,Karthikeyan-... | ooni/__init__.py | ooni/__init__.py | # -*- encoding: utf-8 -*-
__author__ = "Arturo Filastò"
__version__ = "1.0.0-rc5"
__all__ = ['config', 'inputunit', 'kit',
'lib', 'nettest', 'oonicli', 'reporter',
'templates', 'utils']
| # -*- encoding: utf-8 -*-
__author__ = "Arturo Filastò"
__version__ = "1.0.0-rc3"
__all__ = ['config', 'inputunit', 'kit',
'lib', 'nettest', 'oonicli', 'reporter',
'templates', 'utils']
| bsd-2-clause | Python |
0c244f0b295785378c85dfdf7a70c238d0a4f20b | Add a warning to prevent people from running nipy from the source directory. | alexis-roche/nipy,alexis-roche/nireg,alexis-roche/nipy,nipy/nipy-labs,alexis-roche/niseg,alexis-roche/nireg,alexis-roche/register,arokem/nipy,arokem/nipy,nipy/nireg,alexis-roche/niseg,bthirion/nipy,alexis-roche/register,arokem/nipy,alexis-roche/register,arokem/nipy,nipy/nireg,nipy/nipy-labs,bthirion/nipy,alexis-roche/n... | neuroimaging/__init__.py | neuroimaging/__init__.py | # -*- coding: utf-8 -*-
"""
Neuroimaging tools for Python (NIPY).
The aim of NIPY is to produce a platform-independent Python environment for
the analysis of brain imaging data using an open development model.
While
the project is still in its initial stages, packages for file I/O, script
support as well as single su... | # -*- coding: utf-8 -*-
"""
Neuroimaging tools for Python (NIPY).
The aim of NIPY is to produce a platform-independent Python environment for
the analysis of brain imaging data using an open development model.
While
the project is still in its initial stages, packages for file I/O, script
support as well as single su... | bsd-3-clause | Python |
0b6ced2e048d4538db68abe356b8a4719a830fa0 | Check the needed env vars are provided to the backfill script | AppliedTrust/traildash,AppliedTrust/traildash,AppliedTrust/traildash,AppliedTrust/traildash | backfill.py | backfill.py | #!/usr/bin/env python
import json
from os import environ
import boto3
if not all([environ.get('AWS_S3_BUCKET'), environ.get('AWS_SQS_URL')]):
print('You have to specify the AWS_S3_BUCKET and AWS_SQS_URL environment variables.')
print('Check the "Backfilling data" section of the README file for more info.')
... | #!/usr/bin/env python
import json
from os import environ
import boto3
bucket = boto3.resource('s3').Bucket(environ.get('AWS_S3_BUCKET'))
queue = boto3.resource('sqs').Queue(environ.get('AWS_SQS_URL'))
items_queued = 0
for item in bucket.objects.all():
if not item.key.endswith('.json.gz'):
continue
... | bsd-2-clause | Python |
d16cdad0fd12dcab26d670e83a746fede085d085 | fix the test .tac to use new createService arguments | jeroenh/OpenNSA,jab1982/opennsa,NORDUnet/opennsa,jeroenh/OpenNSA,NORDUnet/opennsa,jeroenh/OpenNSA,NORDUnet/opennsa,jab1982/opennsa | opennsa-test.tac | opennsa-test.tac | #!/usr/bin/env python # syntax highlightning
import os, sys
from twisted.python import log
from twisted.python.log import ILogObserver
from twisted.application import internet, service
from opennsa import setup, registry, logging
from opennsa.backends import dud
from opennsa.topology import gole
DEBUG = False
PROF... | #!/usr/bin/env python # syntax highlightning
import os, sys
from twisted.python import log
from twisted.python.log import ILogObserver
from twisted.application import internet, service
from opennsa import setup, registry, logging
from opennsa.backends import dud
from opennsa.topology import gole
DEBUG = False
PROF... | bsd-3-clause | Python |
f662fafd2f69d64306ab89a1360a3cadda072b59 | clean up pylint ignores to be more specific | lucidfrontier45/ScalaFunctional,EntilZha/PyFunctional,EntilZha/ScalaFunctional,ChuyuHsu/ScalaFunctional,EntilZha/ScalaFunctional,lucidfrontier45/ScalaFunctional,ChuyuHsu/ScalaFunctional,EntilZha/PyFunctional | functional/util.py | functional/util.py | # pylint: disable=no-name-in-module,unused-import
import collections
import six
import builtins
if six.PY2:
from itertools import ifilterfalse as filterfalse
def dict_item_iter(dictionary):
return dictionary.viewitems()
else:
from itertools import filterfalse
def dict_item_iter(dictionary):
... | # pylint: disable=no-name-in-module,unused-import,too-many-instance-attributes,too-many-arguments, too-few-public-methods
import collections
import six
import builtins
if six.PY2:
from itertools import ifilterfalse as filterfalse
def dict_item_iter(dictionary):
return dictionary.viewitems()
else:
... | mit | Python |
4e74723aac53956fb0316ae0d438da623de133d5 | Add and update tests for video renderer | felliott/modular-file-renderer,CenterForOpenScience/modular-file-renderer,felliott/modular-file-renderer,CenterForOpenScience/modular-file-renderer,CenterForOpenScience/modular-file-renderer,CenterForOpenScience/modular-file-renderer,felliott/modular-file-renderer,felliott/modular-file-renderer | tests/extensions/video/test_renderer.py | tests/extensions/video/test_renderer.py | import pytest
from mfr.core.provider import ProviderMetadata
from mfr.extensions.video import VideoRenderer
@pytest.fixture
def metadata():
return ProviderMetadata('test', '.mp4', 'text/plain', '1234',
'http://wb.osf.io/file/test.mp4?token=1234')
@pytest.fixture
def file_path():
... | import pytest
from mfr.core.provider import ProviderMetadata
from mfr.extensions.video import VideoRenderer
@pytest.fixture
def metadata():
return ProviderMetadata('test', '.mp4', 'text/plain', '1234', 'http://wb.osf.io/file/test.mp4?token=1234')
@pytest.fixture
def file_path():
return '/tmp/test.mp4'
@... | apache-2.0 | Python |
e1c359fab8c351c77556e34731cd677b4c0cc99b | Update mono to 4.0.1 | BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild | packages/mono.py | packages/mono.py | class MonoPackage (Package):
def __init__ (self):
Package.__init__ (self, 'mono', '4.0.1',
sources = [
'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2'
],
configure_flags = [
'--with-jit=yes',
'--with-ikvm=no',
'--with-mcs-docs=no',
'--with-moonlight=no',
... | class MonoPackage (Package):
def __init__ (self):
Package.__init__ (self, 'mono', '4.0.0',
sources = [
'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2'
],
configure_flags = [
'--with-jit=yes',
'--with-ikvm=no',
'--with-mcs-docs=no',
'--with-moonlight=no',
... | mit | Python |
7e627a16c85a9ffa88833176201351908a5458c2 | Fix (#795) | stripe/stripe-python | stripe/api_resources/terminal/reader.py | stripe/api_resources/terminal/reader.py | # File generated from our OpenAPI spec
from __future__ import absolute_import, division, print_function
from stripe import util
from stripe.api_resources.abstract import APIResourceTestHelpers
from stripe.api_resources.abstract import CreateableAPIResource
from stripe.api_resources.abstract import DeletableAPIResource... | # File generated from our OpenAPI spec
from __future__ import absolute_import, division, print_function
from stripe import util
from stripe.api_resources.abstract import APIResourceTestHelpers
from stripe.api_resources.abstract import CreateableAPIResource
from stripe.api_resources.abstract import DeletableAPIResource... | mit | Python |
38de1280ff97d468dcb0214e6c1037ee12d9676b | Add another action | entering/suoreach,entering/suoreach,entering/suoreach | dashboard/controllers.py | dashboard/controllers.py | import cherrypy
class Dashboard:
@cherrypy.expose
def index(self):
return "Dashboard!"
@cherrypy.expose
def edit(self, number):
return "Dashboard edit " + number
| import cherrypy
class Dashboard:
@cherrypy.expose
def index(self):
return "Dashboard!"
| mit | Python |
cd3f94c7574825812d4e0fea6fda20f9e4432495 | Test GetApplication | GNOME/at-spi2-core,GNOME/at-spi2-core,GNOME/at-spi2-core | tests/registryd/test_root_accessible.py | tests/registryd/test_root_accessible.py | # Pytest will pick up this module automatically when running just "pytest".
#
# Each test_*() function gets passed test fixtures, which are defined
# in conftest.py. So, a function "def test_foo(bar)" will get a bar()
# fixture created for it.
import pytest
import dbus
from utils import get_property, check_unknown_p... | # Pytest will pick up this module automatically when running just "pytest".
#
# Each test_*() function gets passed test fixtures, which are defined
# in conftest.py. So, a function "def test_foo(bar)" will get a bar()
# fixture created for it.
import pytest
import dbus
from utils import get_property, check_unknown_p... | lgpl-2.1 | Python |
2ee9e4200c90eae9739a44cb56270d0e873907e9 | Add more example | pk-python/basics | pandas/pandas.py | pandas/pandas.py | import pandas as pd
# Reading csv without header
inp = pd.read_csv('data.txt', header=None)
# Reading csv and set name of columns
inp = pd.read_csv('data.txt', names=['column1', 'column2'])
# Reading csv and set index
inp = pd.read_csv('data.txt', index_col=['column1'])
inp = pd.read_csv('data.txt', index_col=0)
# ... | import pandas as pd
# Reading csv without header
inp = pd.read_csv('data.txt', header=None)
# Retrieving particular columns by indexes, since column headers are not there
X_df = inp[inp.columns[0:2]]
# Converting dataframe to numpy ndarray
X_nd = X_df.values | mit | Python |
54fab13f466d17acfa4f9b3d67d777de8d34f67f | Remove interdependence from get_path_category() | pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | src/core/templatetags/pycontw_tools.py | src/core/templatetags/pycontw_tools.py | import re
from django.template import Library
register = Library()
@register.filter
def message_bootstrap_class_str(message):
return ' '.join('alert-' + tag for tag in message.tags.split(' '))
@register.filter
def get_path_category(url):
pattern = r'/(?P<lang>zh\-hant|en\-us)/(?P<category>[0-9a-z-]*)/'
... | import re
from django.template import Library
register = Library()
@register.filter
def message_bootstrap_class_str(message):
return ' '.join('alert-' + tag for tag in message.tags.split(' '))
@register.filter
def get_path_category(url):
lang = '\/(zh\-hant|en\-us)'
category_pattern_mapping = {
... | mit | Python |
320a96337c55d770ed032520ecb75155e2d124e5 | Update version | maxmind/GeoIP2-python,maxmind/GeoIP2-python,simudream/GeoIP2-python | geoip2/__init__.py | geoip2/__init__.py | #pylint:disable=C0111
__title__ = 'geoip2'
__version__ = '0.1.1'
__author__ = 'Gregory Oschwald'
__license__ = 'LGPLv2+'
__copyright__ = 'Copyright 2013 Maxmind, Inc.'
| #pylint:disable=C0111
__title__ = 'geoip2'
__version__ = '0.1.0'
__author__ = 'Gregory Oschwald'
__license__ = 'LGPLv2+'
__copyright__ = 'Copyright 2013 Maxmind, Inc.'
| apache-2.0 | Python |
01dd6198cba28623e3d2a72bc9b1f720a70112f0 | Bump version to 0.2.1 | geomet/geomet,larsbutler/geomet,larsbutler/geomet,geomet/geomet | geomet/__init__.py | geomet/__init__.py | # Copyright 2013 Lars Butler & individual contributors
#
# 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 applicab... | # Copyright 2013 Lars Butler & individual contributors
#
# 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 applicab... | apache-2.0 | Python |
ab8d6fc2163e7170e8d184f1321119bbcd469709 | Update ipc_lista1.9.py | any1m1c/ipc20161 | lista1/ipc_lista1.9.py | lista1/ipc_lista1.9.py | #ipc_lista1.9
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que peça a temperatura em graus Fahrenheit, transforme e mostre a temperatura em graus Celsius.
| #ipc_lista1.9
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que peça a temperatura em graus Fahrenheit, transforme e mostre a temperatura em graus Celsius.
| apache-2.0 | Python |
c9ba6d141e356b48caf1820a309e554f21e016c4 | Transpose guards against None result | saurabhjn76/sympy,postvakje/sympy,kaichogami/sympy,Titan-C/sympy,bukzor/sympy,MridulS/sympy,toolforger/sympy,atsao72/sympy,iamutkarshtiwari/sympy,maniteja123/sympy,shikil/sympy,lindsayad/sympy,grevutiu-gabriel/sympy,Sumith1896/sympy,bukzor/sympy,yukoba/sympy,asm666/sympy,yashsharan/sympy,toolforger/sympy,jamesblunt/sym... | sympy/matrices/expressions/transpose.py | sympy/matrices/expressions/transpose.py | from sympy import Basic, Q
from sympy.functions import adjoint, conjugate
from sympy.matrices.expressions.matexpr import MatrixExpr
from sympy.matrices import MatrixBase
class Transpose(MatrixExpr):
"""
The transpose of a matrix expression.
This is a symbolic object that simply stores its argument withou... | from sympy import Basic, Q
from sympy.functions import adjoint, conjugate
from sympy.matrices.expressions.matexpr import MatrixExpr
from sympy.matrices import MatrixBase
class Transpose(MatrixExpr):
"""
The transpose of a matrix expression.
This is a symbolic object that simply stores its argument withou... | bsd-3-clause | Python |
df4a47a1111908e7120cd9ef296322a41c8cc5aa | Update windows-1251 file scanner | FarGroup/FarManager,FarGroup/FarManager,johnd0e/FarManager,FarGroup/FarManager,FarGroup/FarManager,johnd0e/FarManager,johnd0e/FarManager,johnd0e/FarManager,johnd0e/FarManager,FarGroup/FarManager,FarGroup/FarManager,johnd0e/FarManager,FarGroup/FarManager,johnd0e/FarManager,FarGroup/FarManager,johnd0e/FarManager | enc/tools/contrib/techtonik/rucheck.py | enc/tools/contrib/techtonik/rucheck.py | #!/usr/bin/env python2
# -*- coding:windows-1251 -*-
"""Find files with letters in russian windows-1251 encoding.
windows-1251 is a single byte encoding with a range 0xC0-0xFF
and 0xA8,0xB8 for symbols and respectfully. Unfortunately,
russian symbols in windows-1251 clash with russian symbols in
utf-8, where they t... | #!/usr/bin/env python2
# -*- coding:windows-1251 -*-
"""Find files with letters in russian windows-1251 encoding.
If English encyclopedia files contain Russian letters they are considered
untranslated unless <!-- NLC --> marker is present at the same line in
HTML code.
"""
# pythonized by techtonik // gmail.com
im... | bsd-3-clause | Python |
4e53b01f2024e320e4c31ded5d6ad7187aa6868b | Make Wordclient a class | anirudhagar13/SS_Graph,anirudhagar13/SS_Graph,anirudhagar13/SS_Graph,anirudhagar13/SS_Graph | Wordclient.py | Wordclient.py | from __future__ import print_function
from Commons import *
from Spider import *
from Edge import *
class Wordclient:
def __init__(self, word):
'''
Constructor to crawl web for a word
'''
self.word = word
sp = Spider(word)
self.web = sp.crawl() # Crawled web
def printweb(word, web):
'''
To Print en... | from __future__ import print_function
from Commons import *
from Spider import *
from Edge import *
def Printpaths(word, web):
'''
To print paths to a specific word in web
'''
if word in web:
paths = web[word]
print ('TO : ',word)
for i, path in enumerate(paths):
print ('PATH', i+1,' :',end='')
score =... | apache-2.0 | Python |
92699fa0ac8c97a5a54da2a4155b08145c524d5d | revert the previous change: regression found | tinyerp/openerpweb_seven,tinyerp/openerpweb_seven | web_seven/openerpweb.py | web_seven/openerpweb.py | # -*- coding: utf-8 -*-
def patch_web7():
import babel
import os.path
import openerp.addons.web
try:
from openerp.addons.web import http as openerpweb
except ImportError:
# OpenERP Web 6.1
return
# Adapt the OpenERP Web 7.0 method for OpenERP 6.1 server
@openerpwe... | # -*- coding: utf-8 -*-
def patch_web7():
import babel
import os.path
import sys
import openerp.addons.web
try:
from openerp.addons.web import http as openerpweb
except ImportError:
# OpenERP Web 6.1
return
# Self-reference for 6.1 modules which import 'web.common... | bsd-3-clause | Python |
f03b47e987ed2259b10e21123ed8bca711b8bf15 | Add -D_REENTRANT to cflags as per Gemfire docs | gemfire/node-gemfire,gemfire/node-gemfire,mross-pivotal/node-gemfire,mross-pivotal/node-gemfire,gemfire/node-gemfire,mross-pivotal/node-gemfire,gemfire/node-gemfire,gemfire/node-gemfire,mross-pivotal/node-gemfire,gemfire/node-gemfire,mross-pivotal/node-gemfire,mross-pivotal/node-gemfire | binding.gyp | binding.gyp | # vim: set ft=javascript
{
# NOTE: 'module_name' and 'module_path' come from the 'binary' property in package.json
# node-pre-gyp handles passing them down to node-gyp when you build from source
"targets": [
{
"target_name": "<(module_name)",
"include_dirs": [ "include" ],
"sources": [ "src/binding.cpp"... | # vim: set ft=javascript
{
# NOTE: 'module_name' and 'module_path' come from the 'binary' property in package.json
# node-pre-gyp handles passing them down to node-gyp when you build from source
"targets": [
{
"target_name": "<(module_name)",
"include_dirs": [ "include" ],
"sources": [ "src/binding.cpp"... | bsd-2-clause | Python |
726e70910e72f68085ecc7cdcc2d474c2ba99c6a | add source dir to include_dirs | embeddedfactor/node-mifare,embeddedfactor/node-mifare,embeddedfactor/node-mifare,embeddedfactor/node-mifare | binding.gyp | binding.gyp | {
"variables": {
"source_dir": "src",
},
"targets": [
{
"target_name": "node_mifare",
"dependencies": ["node_modules/libfreefare-pcsc/binding.gyp:freefare_pcsc"],
"conditions": [
['OS=="linux"', {
"defines": [
"USE_LIBNFC",
],
... | {
"targets": [
{
"target_name": "node_mifare",
"dependencies": ["node_modules/libfreefare-pcsc/binding.gyp:freefare_pcsc"],
"conditions": [
['OS=="linux"', {
"defines": [
"USE_LIBNFC",
],
}]
],
"sources": [
"src/mif... | mit | Python |
0b7eca03c652b5afefb7eabd48011310b122acbc | Fix #47 contect handling | zsiciarz/django-envelope,zsiciarz/django-envelope | envelope/templatetags/envelope_tags.py | envelope/templatetags/envelope_tags.py | # -*- coding: utf-8 -*-
"""
Template tags related to the contact form.
"""
from __future__ import unicode_literals
from django import template
register = template.Library()
try:
import honeypot
# Register antispam_fields as an inclusion tag
t = template.Template('{% load honeypot %}{% render_honeypot_f... | # -*- coding: utf-8 -*-
"""
Template tags related to the contact form.
"""
from __future__ import unicode_literals
from django import template
register = template.Library()
try:
import honeypot
# Register antispam_fields as an inclusion tag
t = template.Template('{% load honeypot %}{% render_honeypot_f... | mit | Python |
444baf986cf90a952f5d2406b5aba60113494349 | Add FloatingIP object implementation | openstack/oslo.versionedobjects,citrix-openstack-build/oslo.versionedobjects | nova/objects/__init__.py | nova/objects/__init__.py | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | apache-2.0 | Python |
4f7590ea19036ceb358c323d796be0046f33327e | move config.json to correct location | SqueezeStudioAnimation/omtk,SqueezeStudioAnimation/omtk | omtk/core/preferences.py | omtk/core/preferences.py | """
Provide a Preference class to store the user preferences of the local installation.
"""
import os
import inspect
import json
import logging
log = logging.getLogger('omtk')
CONFIG_FILENAME = 'config.json'
def get_path_preferences():
"""
:return: The search path of the configuration file.
"""
curren... | """
Provide a Preference class to store the user preferences of the local installation.
"""
import os
import inspect
import json
import logging
log = logging.getLogger('omtk')
CONFIG_FILENAME = 'config.json'
def get_path_preferences():
"""
:return: The search path of the configuration file.
"""
curren... | mit | Python |
cae6e403efdef67af23a3b8a6c80082fa9efe4bd | Fix test | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/files/views.py | bluebottle/files/views.py | import mimetypes
import magic
from django.conf import settings
from django.http import HttpResponse
from rest_framework.exceptions import ValidationError
from rest_framework.parsers import FileUploadParser
from rest_framework.permissions import IsAuthenticated
from rest_framework_json_api.views import AutoPrefetchMixi... | import mimetypes
import magic
from django.conf import settings
from django.core.exceptions import ValidationError
from django.http import HttpResponse
from rest_framework.parsers import FileUploadParser
from rest_framework.permissions import IsAuthenticated
from rest_framework_json_api.views import AutoPrefetchMixin
f... | bsd-3-clause | Python |
ab4351afae1f1a16206cce6801d114b047babf76 | Update main to use tag and reuse_mesage | alvarogzp/telegram-games,alvarogzp/telegram-games,alvarogzp/telegram-games,alvarogzp/telegram-games | bot/main.py | bot/main.py | #!/usr/bin/env python3
import logging
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, InlineQueryHandler
from game.api.server import start_api_server
from game.chooser import inline_query_game_chooser_handler
from game.launch import callback_query_game_launcher_handler
from tools import confi... | #!/usr/bin/env python3
import logging
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, InlineQueryHandler
from game.api.server import start_api_server
from game.chooser import inline_query_game_chooser_handler
from game.launch import callback_query_game_launcher_handler
from tools import confi... | apache-2.0 | Python |
23a1922afac917b06dbd6772fefc3b8a7c53c5ff | fix linespacing in footnotes (part of #3) | alerque/greek-reader,jtauber/greek-reader | backends.py | backends.py | class LaTeX:
def preamble(self, typeface):
return """
\\documentclass[a4paper,12pt]{{article}}
\\usepackage{{setspace}}
\\usepackage{{fontspec}}
\\usepackage{{dblfnote}}
\\usepackage{{pfnote}}
\\setromanfont{{{typeface}}}
\\linespread{{1.5}}
\\onehalfspacing
\\begin{{document}}
""".format(typeface=type... | class LaTeX:
def preamble(self, typeface):
return """
\\documentclass[a4paper,12pt]{{article}}
\\usepackage{{fontspec}}
\\usepackage{{dblfnote}}
\\usepackage{{pfnote}}
\\setromanfont{{{typeface}}}
\\linespread{{1.5}}
\\spaceskip 0.5em
\\begin{{document}}
""".format(typeface=typeface)
def chapter_v... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.