code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
The BioThings Explorer project.
.. moduleauthor:: Jiwen Xin <kevinxin@scripps.edu>
"""
| biothings/biothings_explorer | __init__.py | Python | apache-2.0 | 118 |
# -*- coding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015-Today Julius Network Solutions SARL <contact@julius.fr>
#
# This program is free software: you can redistribute it and/or modify
# it unde... | ncliam/serverpos | openerp/custom_modules/website_sms_authentication_base_phone/models/__init__.py | Python | agpl-3.0 | 1,081 |
from .bgplvmpanama import BGPLVM_PANAMA
from .var_dtc_fixed_cov import VarDTCFixedCov | mzwiessele/applygpy | applygpy/bgplvmpanama/__init__.py | Python | bsd-3-clause | 85 |
# Python - 3.6.0
plural = lambda n: n != 1
| RevansChen/online-judge | Codewars/8kyu/plural/Python/solution1.py | Python | mit | 44 |
#!python
"""Bootstrap ensetuptools installation
If you want to use ensetuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of ensetu... | cournape/ensetuptools | ez_ensetuptools.py | Python | bsd-3-clause | 7,483 |
# -*- coding: utf-8 -*-
from google.appengine.ext import ndb
from src.plugins.user import UserModel as _UserModel
class UserModel(_UserModel):
authorized_query_id = ndb.StringProperty(repeated=True)
# authorized_table_name = ndb.StringProperty(repeated=True)
report_id = ndb.StringProperty(repeated=True)
... | rororo12/bq-square | src/user.py | Python | mit | 369 |
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class MembershipRequest(models.Model):
_inherit = "membership.request"
petition_registration_id = fields.Many2one(
comodel_name="petition.registration",
string=... | mozaik-association/mozaik | mozaik_petition_membership_request_involvement/models/membership_request.py | Python | agpl-3.0 | 1,353 |
import gensim
import os
from gensim import corpora
from gensim import utils
class DtmCorpus(corpora.textcorpus.TextCorpus):
def get_texts(self):
return self.input
def __len__(self):
return len(self.input)
if __name__ == '__main__':
corpus, time_seq = utils.unpickle('gensi... | bartvm/gensim | gensim/test/test_dtm.py | Python | gpl-3.0 | 681 |
import sys
import h5py
import matplotlib.pyplot as plt
import numpy
def usage(exit_val=1):
print 'plot_hdf5.py <hdf5_file> <start_channel> [<end_channel>]'
sys.exit(exit_val)
if len(sys.argv) != 3 and len(sys.argv) != 4:
usage()
try:
f = sys.argv[1]
ch_s = int(sys.argv[2])
if len(sys.argv) =... | leaflabs/leafysd | util/plot_hdf5.py | Python | gpl-2.0 | 1,376 |
# Copyright 2013, Big Switch Networks
#
# 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... | Juniper/contrail-horizon | openstack_dashboard/dashboards/project/l3routers/extensions/routerrules/forms.py | Python | apache-2.0 | 4,105 |
"""
Tests for django admin commands in the verify_student module
Lots of imports from verify_student's model tests, since they cover similar ground
"""
from django.conf import settings
from django.core.management import call_command
from mock import patch
from testfixtures import LogCapture
from common.test.utils im... | stvstnfrd/edx-platform | lms/djangoapps/verify_student/management/commands/tests/test_verify_student.py | Python | agpl-3.0 | 4,175 |
from gettext import gettext as _
from pulp.common.error_codes import Error
DEB0001 = Error('DEB0001',
_('Create local repository at: %(path)s failed. Reason: %(reason)s'),
['path', 'reason'])
| pombredanne/pulp_deb | common/pulp_deb/common/errors.py | Python | gpl-2.0 | 228 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1/services/specialist_pool_service/client.py | Python | apache-2.0 | 37,232 |
'''
Created on Jun 25, 2014
@author: Jeremy May
'''
import pickle
from PyQt4 import QtGui
class SettingsDialog(QtGui.QDialog):
def __init__(self, parent=None):
'''
Constructor
'''
super(SettingsDialog, self).__init__(parent)
self.parent = parent
... | Kenishi/DroidNavi | pyqt-ui/src/pytelelog_pyqt/components/settings.py | Python | gpl-2.0 | 5,225 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-18 16:05
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0008_alter_user_us... | jefke-glider/gliding | ato/report_ia/migrations/0029_nieuws.py | Python | mit | 1,082 |
#!/usr/local/bin/python
import os
# import ycm_core
# return the filename in the path without extension
def findFileName(path, ext):
name = ''
for projFile in os.listdir(path):
# cocoapods will generate _Pods.xcodeproj as well
if projFile.endswith(ext) and not projFile.startswith('_Pods'):
name= proj... | haifengkao/ReactiveCache | .ycm_extra_conf.py | Python | mit | 13,022 |
import unittest
import fakeredis
from sixpack.models import Alternative, Experiment
class TestAlternativeModel(unittest.TestCase):
unit = True
def setUp(self):
self.redis = fakeredis.FakeStrictRedis()
self.client_id = 381
def test_key(self):
exp = Experiment('show-something', [... | nickveenhof/sixpack | sixpack/test/alternative_model_test.py | Python | bsd-2-clause | 3,143 |
# coding: utf-8
# Copyright 2014 Globo.com Player authors. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
import sys
PYTHON_MAJOR_VERSION = sys.version_info
import os
import posixpath
try:
import urlparse as url_parser
import urlli... | cristina0botez/m3u8 | m3u8/__init__.py | Python | mit | 2,171 |
# Natural Language Toolkit: IPI PAN Corpus Reader
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Konrad Goluchowski <kodie@mimuw.edu.pl>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
import functools
from nltk import compat
from nltk.corpus.reader.util import StreamBackedCorpusVie... | adazey/Muzez | libs/nltk/corpus/reader/ipipan.py | Python | gpl-3.0 | 13,048 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Copyright 2012 Unknown <diogo@arch>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your opt... | ODiogoSilva/TriFusion | trifusion/process/data.py | Python | gpl-3.0 | 52,874 |
from os.path import exists
from cornice.service import Service
from pkg_resources import get_distribution
from ..config import path, get_logger
log = get_logger(__name__)
app_info = Service(
name='appinfo',
path=path(''),
renderer='json',
accept='application/json')
@app_info.get()
def get_app_in... | grunskis/senic-hub | senic_hub/backend/views/appinfo.py | Python | mit | 1,062 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import httpretty
import json
import sure
from pyeqs import QuerySet, Filter
from pyeqs.dsl import Term, Sort, ScriptScore
from tests.helpers import homogeneous
@httpretty.activate
def test_create_queryset_with_host_string():
"""
Create a querys... | Yipit/pyeqs | tests/unit/test_connection.py | Python | mit | 4,100 |
"""Package contains implementations of processes."""
| qbahn/grortir | grortir/main/model/processes/__init__.py | Python | mit | 53 |
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('webhooks/', include('webhooks.urls')),
path('admin/', admin.site.urls),
]
| saulario/pruebas | pipedrive/pipedrive/urls.py | Python | gpl-3.0 | 176 |
# 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 th... | legnaleurc/tornado | tornado/test/asyncio_test.py | Python | apache-2.0 | 4,795 |
import unittest
from datetime import date
import pandas as pd
import numpy as np
from dateutil import relativedelta
from excel_helper import ExcelParameterLoader, ParameterRepository, growth_coefficients
class ExcelParameterLoaderTestCase(unittest.TestCase):
def test_parameter_getvalue_random(self):
re... | dschien/PyExcelModelingHelper | tests/test_excel_loader.py | Python | mit | 17,168 |
#! /usr/bin/env python
'''
vcfreq.py: Convert frequency to V/oct signal
Copyright (c) 2020 Bill Gribble <grib@billgribble.com>
'''
from ..processor import Processor
from ..mfp_app import MFPApp
from ..bang import Uninit
class VCFreq(Processor):
doc_tooltip_obj = "Convert frequency (Hz) to V/oct signal"
doc_... | bgribble/mfp | mfp/builtins/vcfreq.py | Python | gpl-2.0 | 1,367 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 12, transform = "Logit", sigma = 0.0, exog_count = 100, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_MovingAverage/cycle_12/ar_12/test_artificial_128_Logit_MovingAverage_12_12_100.py | Python | bsd-3-clause | 267 |
from clockwork import clockwork
from pprint import pprint
api = clockwork.API('4d377b576ea0eff6f4a0be8248e57c5e12b27798')
def send_sms(number, msg):
message = clockwork.SMS(
to = number,
message = msg)
response = api.send(message)
if response.success:
print (response.id)
else:
... | parisandmilo/Ko-lect-FoC2015 | python-backend/api_modules/sms.py | Python | mit | 418 |
import datetime
import logging
from django.conf import settings
from django.core.exceptions import NON_FIELD_ERRORS
from google.appengine.api.datastore import Key, Delete, MAX_ALLOWABLE_QUERIES
from google.appengine.datastore.datastore_rpc import TransactionOptions
from google.appengine.ext import db
from .unique_uti... | kirberich/djangae | djangae/db/constraints.py | Python | bsd-3-clause | 11,037 |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# ElevProf0.py
# Created on: 2015-11-09 15:56:06.00000
# (generated by ArcGIS/ModelBuilder)
# Usage: ElevProf0 <SectionLine> <Distance> <Route_Identifier_Field__2_> <Expression> <NED10m1>
# Description:
# Generates... | inkenbrandt/ArcPy | CrossSectionTool/ElevProf0.py | Python | gpl-2.0 | 6,568 |
__author__ = "Marie E. Rognes (meg@simula.no)"
__copyright__ = "Copyright (C) 2012 Marie Rognes"
__license__ = "Distribute at will"
"""
Schematic drawing (starts with 1 springs, starts with 0 dashpots)
| A10 --- A00 |
----- | | --------
| A11 |
Standard linear solid (SLS) viscoelasti... | pf4d/dolfin-adjoint | tests_dolfin/viscoelasticity/timings/unannotated.py | Python | lgpl-3.0 | 7,692 |
import pytest
from unittest.mock import patch
from unittest.mock import Mock, call
import socket
import chatbot.chatbot
import chatbot.responder
class TestChatbot:
def construct(self, sock, Responder):
self.tested = chatbot.chatbot.Chatbot( sock )
Responder.assert_called_once_with()
@patch('ch... | haarcuba/testix | chatbot/test/test_chatbot_with_unittest_mock.py | Python | mit | 1,274 |
import unittest2
import json
from consts.award_type import AwardType
from datafeeds.usfirst_event_awards_parser_02 import UsfirstEventAwardsParser_02
def convert_to_comparable(data):
"""
Converts jsons to dicts so that elements can be more easily compared
"""
if type(data) == list:
return [co... | nwalters512/the-blue-alliance | tests/test_usfirst_event_awards_parser_02.py | Python | mit | 2,367 |
class Vertex(object):
"""A Vertex is a node in a graph."""
def __init__(self, label=''):
self.label = label
def __repr__(self):
"""Returns a string representation of this object that can
be evaluated as a Python expression."""
return 'Vertex(%s)' % repr(self.label)
__s... | hacpai/show-me-the-code | Data Structure/0004/Graph.py | Python | gpl-2.0 | 3,466 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import socket
from lineup import Step, Queue
from lineup.framework import Node
from redis import StrictRedis
class DummyStep(Step):
def consume(self, instructions):
self.produce({'cool': instructions})
def te... | pombredanne/lineup | tests/functional/test_queue.py | Python | mit | 1,663 |
# -*- coding: utf-8 -*-
#
# pynest_example_template.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the... | sdiazpier/nest-simulator | doc/userdoc/contribute/templates/pynest_example_template.py | Python | gpl-2.0 | 5,837 |
from gpio_swig import *
fpga_filename = 'std_2rxint_2tx_dig.rbf'
| trnewman/VT-USRP-daughterboard-drivers_python | gr-gpio/src/python/gpio.py | Python | gpl-3.0 | 66 |
#------------------------------------------------------------------------------
# Copyright (c) 2013, Enthought, Inc.
# All rights reserved.
#------------------------------------------------------------------------------
# Enthought library imports.
from pyface.tasks.api import Task, TaskLayout, PaneItem
# Local impo... | pankajp/pyface | examples/tasks/enaml/enaml_task.py | Python | bsd-3-clause | 1,211 |
import re
from typing import Dict, Optional
from discord.ext import commands
from discordbot.command import MtgContext, roughly_matches
from magic import fetcher
from shared import fetch_tools
@commands.command(aliases=['res', 'pdm'])
async def resources(ctx: MtgContext, *, args: Optional[str]) -> None:
"""Usef... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | discordbot/commands/resources.py | Python | gpl-3.0 | 2,935 |
# -*- coding: utf-8 -*-
"""Module to plot netCDF files (interactively)
This module is attempted to handle netCDF files with the use of
python package netCDF4 and to plot them with the use of python
package matplotlib.
Requirements (at least this package is tested with)
- matplotlib version, 1.3.1
- mpl_toolkits.... | Chilipp/nc2map | __init__.py | Python | gpl-2.0 | 11,535 |
"""
008.py 修正
008.py 的方法中, int+int 可能会越界。
"""
INT_MAX = 2 ** 31 - 1
INT_MIN = - 2 ** 31
REMAINDER = INT_MAX % 10
class Solution:
def myAtoi(self, s):
if not s:
return 0
# remove leading whitespace
i = 0
for i_, c in enumerate(s):
if c != ' ':
... | cosven/pat_play | leetcode/008_again.py | Python | gpl-3.0 | 1,027 |
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | apache/incubator-airflow | tests/providers/google/cloud/operators/test_gcs_system_helper.py | Python | apache-2.0 | 2,215 |
import os
DATASOURCE_DIR = 'datasources'
CACHE_DIR = 'cache.db'
PRICES_DATA = os.sep.join((DATASOURCE_DIR, 'us-prices-adjusted-1992-2014.zip'))
UNADJUSTED_PRICES_DATA = os.sep.join((DATASOURCE_DIR, 'us-prices-unadjusted-1992-2014.zip'))
SOURCE_US_EQUITIES = os.sep.join((DATASOURCE_DIR, 'us-equities.csv'))
SOURCE_US_... | chris-ch/us-equities | backtest/constants.py | Python | mit | 687 |
# Work in progress | Konubinix/pyfilesystem | fs/expose/serve/__init__.py | Python | bsd-3-clause | 18 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`test_config`
==================
Created by hbldh <henrik.blidh@nedomkull.com>
Created on 2016-02-04
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import ... | hbldh/flask-pybankid | tests/test_config.py | Python | mit | 1,775 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CustomerProfile'
db.create_table(u'main_customerprofile',... | asmaps/as_poweradmin | as_poweradmin/main/migrations/0001_initial.py | Python | mit | 4,679 |
"""
module for generating C, C++, Fortran77, Fortran90 and Octave/Matlab routines
that evaluate sympy expressions. This module is work in progress. Only the
milestones with a '+' character in the list below have been completed.
--- How is sympy.utilities.codegen different from sympy.printing.ccode? ---
We considere... | toolforger/sympy | sympy/utilities/codegen.py | Python | bsd-3-clause | 55,923 |
# (c) Copyright 2014 Brocade Communications Systems Inc.
# All Rights Reserved.
#
# Copyright 2014 OpenStack Foundation
#
# 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
#
# ... | Akrog/cinder | cinder/zonemanager/drivers/brocade/brcd_fc_san_lookup_service.py | Python | apache-2.0 | 10,817 |
# coding: utf-8
'''
------------------------------------------------------------------------------
Copyright 2015 - 2017 Esri
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/... | Esri/solutions-geoprocessing-toolbox | utils/test/Configuration.py | Python | apache-2.0 | 8,923 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, merge, publish... | rwl/PyCIM | CIM14/IEC61968/Common/Status.py | Python | mit | 2,668 |
# import numpy as np
# import scipy as sp
# import matplotlib as mpl
# import copy
class evaluator:
def __init__(self, num):
self.num = num
self.anstag = [-1 for _ in xrange(num)]
self.restag = [-1 for _ in xrange(num)]
self.precision = 0
self.recall = 0
def load_answer_clusters(self, c):
cnum = len(c... | usc-isi-i2/lsh-linking | swoosh/evaluator.py | Python | apache-2.0 | 1,418 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "web.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | openstates/openstates.org | manage.py | Python | mit | 809 |
import requests
import re
from bs4 import BeautifulSoup
from distance import levenshtein
from mtgreatest.rdb import Cursor, serialize
NUM_NORM_NAMES = 4
NORM_NAMES = ['norm_name_{}'.format(num) for num in range(NUM_NORM_NAMES)]
def fix_name_and_country(name, country):
if name is None:
return (name, country)
... | oelarnes/mtgreatest | mtgreatest-py/mtgreatest/scrape/players.py | Python | mit | 4,550 |
"""
Django settings for oauth_client project.
Generated by 'django-admin startproject' using Django 1.8.5.
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/
"""
# Build... | brollins90/dsOauth | oauth_client/oauth_client/settings.py | Python | mit | 3,891 |
from bopy.mcmctools.emceetools import emcee_general_run
__all__ = ['emceetools']
| hypergravity/bopy | bopy/mcmctools/__init__.py | Python | bsd-3-clause | 82 |
#####################################################################
# s12f18.py
#
# (c) Copyright 2021, Benjamin Parzella. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Fou... | bparzella/secsgem | secsgem/secs/functions/s12f18.py | Python | lgpl-2.1 | 2,601 |
#!/usr/bin/python
from scipy.stats import cauchy
import random
import math
import csv
import numpy as np
import netCDF4 as nc
import argparse
import lvDiagram
'''
parser = argparse.ArgumentParser()
parser.add_argument("numberRegions", type=int,
help="Number of HII Regions to Populate in Model")
a... | WillArmentrout/galSims | simulate/Simulate_Function.py | Python | gpl-2.0 | 17,243 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import dddp
import dddp.models
from dddp.migrations import TruncateOperation
class Migration(migrations.Migration):
dependencies = [
('sessions', '0001_initial'),
... | commoncode/django-ddp | dddp/migrations/0002_auto_20150408_0321.py | Python | mit | 2,926 |
#!/usr/bin/env python
# encoding: utf-8
# vim:ft=python.django:
from django.contrib import admin
from .models import Telefono, Operadora, Salto, Virtual
@admin.register(Telefono)
class TelefonoAdmin(admin.ModelAdmin):
list_display = ('numero', 'descripcion', 'es_primario', 'primario', 'operadora')
search_fi... | aaloy/curs_estiu_2015_uib | centralita/src/inventario/admin.py | Python | gpl-2.0 | 784 |
from __future__ import absolute_import
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU Gener... | karrtikr/ete | ete3/tools/phylobuild_lib/getch.py | Python | gpl-3.0 | 3,540 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-08 02:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('constellation', '0005_event_youtubevideoid'),
]
operations = [
migrations.Al... | teamazim/django_unchained | constellation/migrations/0006_auto_20160308_0228.py | Python | gpl-3.0 | 525 |
import os
from celery import Celery
from celery.schedules import crontab
from celery.task import periodic_task
from django.apps import AppConfig
from django.conf import settings
from django.core.management import call_command
if not settings.configured:
# set the default Django settings module for the 'celery' pr... | Ameriks/velo.lv | velo/taskapp/celery.py | Python | gpl-3.0 | 1,323 |
"""
Meta is a script to access the plugins which handle meta information.
"""
from __future__ import absolute_import
from fabmetheus_utilities import archive
from fabmetheus_utilities import settings
from skeinforge_application.skeinforge_utilities import skeinforge_profile
__author__ = 'Enrique Perez (perez_enriq... | tinkerinestudio/Tinkerine-Suite | TinkerineSuite/Cura/cura_sf/skeinforge_application/skeinforge_utilities/skeinforge_meta.py | Python | agpl-3.0 | 1,230 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,... | keen99/SickRage | sickbeard/clients/__init__.py | Python | gpl-3.0 | 3,669 |
import django_filters
from django_filters.widgets import BooleanWidget
from .models import Group
from guardian.shortcuts import get_objects_for_user
class GroupFilter(django_filters.FilterSet):
name = django_filters.CharFilter(lookup_expr='icontains')
can_manage = django_filters.MethodFilter(widget=BooleanWid... | wangzitian0/BOJ-V4 | ojuser/filters.py | Python | mit | 893 |
#!/usr/bin/env python
"""
Your task is to complete the 'porsche_query' function and in particular the query
to find all autos where the manufacturer field matches "Porsche".
Please modify only 'porsche_query' function, as only that will be taken into account.
Your code will be run against a MongoDB instance that we ha... | krzyste/ud032 | Lesson_4_Working_with_MongoDB/10-Finding_Porsche/find_porsche.py | Python | agpl-3.0 | 1,240 |
import logging, couchdb, oauth2, json, sys
from decorator import decorator
from pylons import config, request as r, response as res, session
from pylons.controllers.util import abort
from functools import wraps
log = logging.getLogger(__name__)
appConfig = config['app_conf']
class Error(RuntimeError):
"""Generic... | jimklo/LearningRegistry | LR/lr/lib/oauth.py | Python | apache-2.0 | 6,907 |
#!/usr/bin/env python3
"""Logging module for bulk uploads."""
import fcntl
import json
import os
def write_to_log(log_file_path, msg, newline=True):
"""Lock and write to a given file, creates the file if it doesn't exist."""
# create log file descriptor if it doesn't exist, if it does continue as normal
... | RCOS-Grading-Server/HWserver | sbin/submitty_daemon_jobs/submitty_jobs/write_to_log.py | Python | bsd-3-clause | 1,770 |
import numpy as np
def compute_ratio(value1, value2, args):
value1 = value1 + args['pseudocount']
value2 = value2 + args['pseudocount']
ratio = float(value1) / value2
if args['valueType'] == 'log2':
ratio = np.log2(ratio)
elif args['valueType'] == 'reciprocal_ratio':
# the recipr... | JinfengChen/deepTools | deeptools/getRatio.py | Python | gpl-3.0 | 2,169 |
import chardet
import codecs
import collections
import contextlib
import datetime
import errno
import functools
import itertools
import operator
import os
import random
import re
import shutil
import time
import unicodedata
import urllib
import urlparse
import django.core.mail
from django import http
from django.conf ... | mdaif/olympia | apps/amo/utils.py | Python | bsd-3-clause | 33,689 |
#!/usr/bin/env python
#from xcelip import iprecs
from netmiko.linux import LinuxSSH
from netmiko import ConnectHandler
import os
import errno
import datetime
import time
from IPy import IP
from colorama import init,Fore, Back, Style
import sys
import getpass
timestamp = time.strftime(".%H%M%S")
__author__ = "John Ng"... | phasedscum/python-as-a-waffle | Scratch Dir/Cucm_Connectorizer.py | Python | mit | 2,522 |
# https://projecteuler.net/problem=20
#
# n! means n × (n − 1) × ... × 3 × 2 × 1
#
# For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
# and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
#
# Find the sum of the digits in the number 100!
def preCalcFactSum(limit):
ary = [1]
f = 1
... | rahulsrma26/code-gems | ProjectEuler/Problems/problem001_025/Solution020.py | Python | mit | 528 |
from panda3d.core import *
import string
import types
try:
language = getConfigExpress().GetString('language', 'english')
checkLanguage = getConfigExpress().GetBool('check-language', 0)
except:
language = simbase.config.GetString('language', 'english')
checkLanguage = simbase.config.GetBool('check-langu... | Spiderlover/Toontown | toontown/toonbase/TTLocalizer.py | Python | mit | 1,791 |
__source__ = 'https://github.com/kamyu104/LeetCode/blob/master/Python/word-squares.py'
# https://leetcode.com/problems/word-squares/#/description
# Time: O(n^2 * n!)
# Space: O(n^2)
#
# Description: 425. Word Squares
#
# Given a set of words (without duplicates), find all word squares you can build from them.
#
# A se... | JulyKikuAkita/PythonPrac | cs15211/WordSquares.py | Python | apache-2.0 | 12,230 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_issue.py | Python | mit | 2,121 |
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-only
"""
This utilty generate json output to post comment in gerrit.
INPUT: output of checkpatch.pl.
OUTPUT: json format output that can be used to post comment in gerrit
"""
import os
import sys
import json
data = {}
data['comments'] = []
list_temp = {}
def... | pcengines/coreboot | util/lint/checkpatch_json.py | Python | gpl-2.0 | 1,686 |
from __future__ import absolute_import
import cPickle as pickle
import os
import subprocess
import sys
from .utils import get_command_prefix, get_func_name, get_func
from . import logs
def call_in_fork(func, args=None, kwargs=None):
args = args or ()
kwargs = kwargs or ()
pid = os.fork()
if pi... | westernx/sgevents | sgevents/subprocess.py | Python | bsd-3-clause | 1,550 |
import re
import json
import yaml
import os
import logging
import utils
from validators import Validator
from frameworkUtils import FrameworkUtils
logger = logging.getLogger(os.getenv('LOGGER_NAME', __name__))
permissions_files = os.getenv('PERMISSIONS_FILES')
class AuthorizeResult:
def __init__(self, result... | seomoz/roger-mesos | aaad/authorizers.py | Python | apache-2.0 | 9,461 |
# -----------------------------------------------------------
# demonstrates how to create and use an 2d array using NumPy
#o
# (C) 2016 Frank Hofmann, Berlin, Germany
# Released under GNU Public License (GPL)
# email frank.hofmann@efho.de
# -----------------------------------------------------------
# requirements:
#... | hofmannedv/training-python | data-structures/array2d-numpy.py | Python | gpl-2.0 | 2,471 |
# -*- coding:utf-8 -*-
from django import forms
from django.utils.translation import ugettext_lazy as _
class SendTestMail(forms.Form):
"""Отправка тестового письма для проверки настроек
почтового сервера.
"""
text = forms.CharField(label=_('Text message'))
email = forms.EmailField(label=... | sfcl/severcart | service/forms/send_test_mail.py | Python | gpl-2.0 | 437 |
class Record (object) :
def __init__ (self, ** _fields) :
for _identifier, _value in _fields.iteritems () :
setattr (self, _identifier, _value)
return
| cipriancraciun/extremely-simple-cluster-platform | components/py-tools/sources/escp/tools/records.py | Python | gpl-3.0 | 169 |
"""
07-midifile-with-mido.py - Reading a MIDI file with mido and sending the events to pyo.
This example shows how simple it is to play a MIDI file with mido and send the events
to an audio synth build with pyo.
"""
from pyo import *
# Try to import MidiFile from the mido module. You can install mido with pip:
# p... | belangeo/pyo | pyo/examples/16-midi/07-midifile-with-mido.py | Python | lgpl-3.0 | 1,142 |
import numpy
import math
import itertools
def quad_arr_from_sample(sample):
res = []
for n in xrange(len(sample)):
for m in xrange(n, len(sample)):
res.append(sample[n]*sample[m])
return [1] + res
def cube_arr_from_sample(sample):
res = []
for n in xrange(len(sample)):
for m in xrange(n, len(sample)):
... | maxikov/attfocus | polynomial_regression/featurebuilder.py | Python | gpl-3.0 | 4,222 |
"""Module for testing session pools."""
import threading
class TestConnection(TestCase):
def __ConnectAndDrop(self):
"""Connect to the database, perform a query and drop the connection."""
connection = self.pool.acquire()
cursor = connection.cursor()
cursor.execute(u"select count(... | jayceyxc/hue | desktop/core/ext-py/cx_Oracle-5.2.1/test/uSessionPool.py | Python | apache-2.0 | 4,475 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
'''
Copyright 2014-2015 Teppo Perä
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
Un... | Debith/py2traits | src/pytraits/combiner.py | Python | apache-2.0 | 1,354 |
import sys
import os
import shutil
from bento.installed_package_description \
import \
InstalledSection
from bento.errors \
import \
CommandExecutionFailure
from bento.utils.utils \
import \
cpu_count, extract_exception
import bento.errors
import yaku.task_manager
import yaku.conte... | cournape/Bento | bento/commands/build_yaku.py | Python | bsd-3-clause | 1,536 |
"""Overrides the built-in help formatter.
All help messages will be embed and pretty.
Most of the code stolen from
discord.ext.commands.formatter.py and
converted into embeds instead of codeblocks.
Docstr on cog class becomes category.
Docstr on command definition becomes command
summary and usage.
Use [p] in comman... | ZetDude/KALEVBOT | cogs/utils/help.py | Python | mit | 10,945 |
from apio.commands.drivers import cli as cmd_drivers
def test_drivers(clirunner, validate_cliresult, configenv):
with clirunner.isolated_filesystem():
configenv()
result = clirunner.invoke(cmd_drivers)
validate_cliresult(result)
| Jesus89/apio | test/env_commands/test_drivers.py | Python | gpl-2.0 | 259 |
# Copyright 2015 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 a... | DailyActie/Surrogate-Model | 01-codes/tensorflow-master/tensorflow/examples/how_tos/reading_data/fully_connected_reader.py | Python | mit | 7,305 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Open Data Portal.
# Copyright (C) 2017 CERN.
#
# CERN Open Data Portal is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, o... | cernanalysispreservation/analysis-preservation.cern.ch | cap/modules/search/query.py | Python | gpl-2.0 | 3,691 |
from selenium.webdriver.support.ui import Select
from keywordgroup import KeywordGroup
class _SelectElementKeywords(KeywordGroup):
# Public
def get_list_items(self, locator):
"""Returns the values in the select list identified by `locator`.
Select list keywords work on both lists and combo b... | jennifer0703/robotframework-selenium2library | src/Selenium2Library/keywords/_selectelement.py | Python | apache-2.0 | 15,937 |
"""
This module contains celery task functions for handling the sending of bulk email
to a course.
"""
import math
import re
import time
from smtplib import SMTPServerDisconnected, SMTPDataError, SMTPConnectError
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.core.mail... | pdehaye/theming-edx-platform | lms/djangoapps/bulk_email/tasks.py | Python | agpl-3.0 | 10,209 |
"""
A component which allows you to send data to an Influx database.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/influxdb/
"""
import logging
import re
import voluptuous as vol
from homeassistant.const import (
EVENT_STATE_CHANGED, STATE_UNAVA... | MungoRae/home-assistant | homeassistant/components/influxdb.py | Python | apache-2.0 | 7,812 |
#!/usr/bin/env python
# coding=utf8
"""
Fix permissions again
@contact: Debian FTP Master <ftpmaster@debian.org>
@copyright: 2011 Mark Hymers <mhy@debian.org>
@license: GNU General Public License version 2 or later
"""
# This program is free software; you can redistribute it and/or modify
# it under the terms of the... | abhi11/dak | dak/dakdb/update58.py | Python | gpl-2.0 | 3,526 |
#NVDAObjects/IAccessible/sysTreeView32.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2007-2010 Michael Curran <mick@kulgan.net>, James Teh <jamie@jantrid.net>
from ctypes import *
from ctypes.wintypes... | daisymax/nvda | source/NVDAObjects/IAccessible/sysTreeView32.py | Python | gpl-2.0 | 10,467 |
#!/usr/bin/env python
import os
import sys
import django
from django.core.management import call_command
from django.conf import settings
from django.test.utils import get_runner
def runtests():
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
django.setup()
call_command("makemigrations")
Test... | aaronc-bixly/notifications | runtests.py | Python | mit | 512 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fieldsight', '0052_auto_20180109_1839'),
]
operations = [
migrations.RemoveField(
model_name='userinvite',
... | awemulya/fieldsight-kobocat | onadata/apps/fieldsight/migrations/0053_auto_20180329_1453.py | Python | bsd-2-clause | 920 |
import json
from core.rule_core import *
from core import yapi
class YunoModule:
name = "greylist"
cfg_ver = None
config = {
"expiry": 24,
"score": 1,
"list_path": "Käyttäjä:VakauttajaBot/greylist.json"
}
list_ver = None
api = yapi.MWAPI
greylist = None
... | 4shadoww/stabilizerbot | core/rules/greylist.py | Python | mit | 941 |
import operator
import pytest
from bonobo.util.objects import ValueHolder, Wrapper, get_attribute_or_create, get_name
from bonobo.util.testing import optional_contextmanager
class foo:
pass
class bar:
__name__ = "baz"
def test_get_name():
assert get_name(42) == "int"
assert get_name("eat at joe.... | hartym/bonobo | tests/util/test_objects.py | Python | apache-2.0 | 4,935 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.