text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import datetime
import csv
with open('SYSTEMS.csv') as f:
reader = csv.reader(f)
ALLOWED_SYSTEMS = [l[0] for l in reader]
class IntelEntry:
KEYS = ["timer_name", "alliance", "system", "time", "date", "location"]
def __init__(self, timer_name="", alliance="", system="", time="", date="", location=""... | cameronobrien/BroadsideBot | app/intel_entry.py | Python | mit | 1,447 | 0.004838 |
import sys
from rpython.memory.gc.semispace import SemiSpaceGC
from rpython.memory.gc.semispace import GCFLAG_EXTERNAL, GCFLAG_FORWARDED
from rpython.memory.gc.semispace import GC_HASH_TAKEN_ADDR
from rpython.memory.gc import env
from rpython.rtyper.lltypesystem.llmemory import NULL, raw_malloc_usage
from rpython.rtype... | oblique-labs/pyVM | rpython/memory/gc/generation.py | Python | mit | 30,342 | 0.000857 |
"""Support for the Roku remote."""
import requests.exceptions
from homeassistant.components import remote
from homeassistant.const import CONF_HOST
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Roku remote platform."""
if not discovery_info:
retu... | Cinntax/home-assistant | homeassistant/components/roku/remote.py | Python | apache-2.0 | 1,715 | 0.001166 |
# # # WARNING # # #
# This list must also be updated in doc/_templates/autosummary/class.rst if it
# is changed here!
_doc_special_members = ('__contains__', '__getitem__', '__iter__', '__len__',
'__add__', '__sub__', '__mul__', '__div__',
'__neg__', '__hash__')
from ._b... | wmvanvliet/mne-python | mne/utils/__init__.py | Python | bsd-3-clause | 4,697 | 0.002768 |
#!/usr/bin/env python
# coding: utf-8
import re
import bleach
import passlib
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import NoResultFound
# from flask import redirect, url_for, make_response
from flask.ext.restplus import Resource
from flask.ext.mail import Message
from auths import get_aut... | okfn-brasil/viralata | viralata/views.py | Python | agpl-3.0 | 12,901 | 0 |
"""
Author: Junhong Chen
"""
from Bio import SeqIO
import gzip
import sys
import os
pe1 = []
pe2 = []
pname = []
for dirName, subdirList, fileList in os.walk(sys.argv[1]):
for fname in fileList:
tmp = fname.split(".")[0]
tmp = tmp[:len(tmp)-1]
if tmp not in pname:
pname... | macmanes-lab/MCBS913 | code/Junhong Chen/concatReads.py | Python | mit | 925 | 0.016216 |
"""
The different agnocomplete classes to be discovered
"""
from copy import copy
from six import with_metaclass
from abc import abstractmethod, ABCMeta
import logging
from django.db.models import Q
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import force_text as text
from django... | novafloss/django-agnocomplete | agnocomplete/core.py | Python | mit | 20,047 | 0 |
def revertdigits( item ):
return (item%10)*100 + (int(item/10)%10)*10 + int(item/100)
numlist = [314, 315, 642, 246, 129, 999]
numlist.sort( key=revertdigits )
print( numlist ) | paulmcquad/Python | 11 - Lists/sort revertdigits.py | Python | gpl-3.0 | 181 | 0.055249 |
#!/usr/bin/python3
#
# Copyright (c) 2014-2022 The Voxie Authors
#
# 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,... | voxie-viewer/voxie | filters/downsample.py | Python | mit | 3,821 | 0.001309 |
'''
Created on Jun 6, 2014
@author: rtermondt
'''
from django.conf import settings
def global_settings(request):
invitation_system_setting = getattr(settings, 'INVITATION_SYSTEM', None)
if invitation_system_setting == True:
invite_system = True
else:
invite_system = False
ret... | richtermondt/inithub-web | inithub/inithub/context_processors.py | Python | mit | 376 | 0.013298 |
'''Michael Lange <klappnase (at) freakmail (dot) de>
The ToolTip class provides a flexible tooltip widget for Tkinter; it is based on IDLE's ToolTip
module which unfortunately seems to be broken (at least the version I saw).
INITIALIZATION OPTIONS:
anchor : where the text should be positioned inside the widg... | regionbibliotekhalland/digitalasagor | tooltip.py | Python | gpl-3.0 | 8,114 | 0.008134 |
#!/usr/bin/env python
# angelus.py - John Burnett & Will Johnson (c)2015
#
# Angelus does the following:
# -FFT analysis
# -Partial tracking
# -Modal analysis
# -Resynthesis
#
# Angelus will eventually do the following:
# -FFT Analysis -> Notation
# -Modal Analysis -> 3D mesh (and reverse?)
from FFT_Analyzer import ... | johncburnett/Angelus | src/angelus.py | Python | gpl-2.0 | 953 | 0.008395 |
# -*- coding: utf-8 -*-
import common_sale_contract
import test_sale_contract
| tvtsoft/odoo8 | addons/sale_contract/tests/__init__.py | Python | agpl-3.0 | 78 | 0 |
import unittest
from streamlink.stream import StreamIOIterWrapper
class TestPluginStream(unittest.TestCase):
def test_iter(self):
def generator():
yield b"1" * 8192
yield b"2" * 4096
yield b"3" * 2048
fd = StreamIOIterWrapper(generator())
self.assertEq... | beardypig/streamlink | tests/streams/test_stream_wrappers.py | Python | bsd-2-clause | 655 | 0 |
from django.conf import settings
from django.conf.urls.defaults import *
from models import *
from django.views.generic import date_based, list_detail
from django.contrib.auth.decorators import login_required
# Number of random images from the gallery to display.
SAMPLE_SIZE = ":%s" % getattr(settings, 'GALLERY_SAMPLE... | garyp/djwed | photologue/urls.py | Python | mit | 3,400 | 0.008529 |
#!/usr/bin/python -*- coding:utf-8 -*-
__Author__ = "Riyaz Ahmad Bhat"
__Email__ = "riyaz.ah.bhat@gmail.com"
import re
from collections import namedtuple
from sanity_checker import SanityChecker
class DefaultList(list):
"""Equivalent of Default dictionaries for Indexing Errors."""
def __init__(self, defaul... | darshan95/Shift-Reduce-Chunk-Expander | src/ssf_reader.py | Python | mit | 4,608 | 0.052951 |
import nspkg1.foo
| ahb0327/intellij-community | python/testData/completion/importQualifiedNamespacePackage/a.after.py | Python | apache-2.0 | 18 | 0 |
'''
Tree from:
http://www.quesucede.com/page/show/id/python-3-tree-implementation
'''
from urllib.parse import urlparse
import os
(_ROOT, _DEPTH, _BREADTH) = range(3)
class Node:
def __init__(self, identifier):
self.__identifier = identifier
self.__children = []
@property
def identifier... | glaudsonml/kurgan-ai | libs/Tree.py | Python | apache-2.0 | 2,507 | 0.001197 |
#!/usr/bin/python
import sys, commands, struct, operator, subprocess, os
if len(sys.argv) != 3:
print 'usage:',sys.argv[0],'<program> <core>'
sys.exit(1)
prog, core = sys.argv[1:]
# finds out the size of void*/size_t. could be hardcoded for speed...
try:
cell = int(commands.getoutput('gdb '+prog+r''' -ex 'prin... | yosefk/heapprof | heapprof.py | Python | bsd-2-clause | 3,588 | 0.028428 |
import sys
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5 import uic
from . import guiStart
from . import guiCompileSuccess
# sys.path.insert(1, 'C:/Users/GuSan/Desktop/powerOverWhelming/project/src/comp_exec')
from ..comp_exec import validation
from . import guiErrorCode
class GuiSelectCode(QtWidgets.QMainWi... | lunapocket/powerOverWhelming | project/src/gui/guiSelectCode.py | Python | gpl-3.0 | 6,372 | 0.010233 |
# -*- coding: iso-8859-1 -*-
from enigma import eConsoleAppContainer
from Components.Console import Console
from Components.About import about
from Components.PackageInfo import PackageInfoHandler
from Components.Language import language
from Components.Sources.List import List
from Components.Ipkg import IpkgComponent... | atvcaptain/enigma2 | lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py | Python | gpl-2.0 | 9,405 | 0.031154 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import with_statement
import os
import sys
from optparse import OptionParser, BadOptionError
from celery import __version__
from celery.platforms import EX_FAILURE, detached
from celery.utils.log import get_logger
from celery.bin.base im... | couchbaselabs/celery | celery/bin/celeryd_detach.py | Python | bsd-3-clause | 4,792 | 0.000417 |
# Copyright (c) 2013 Red Hat, 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 wri... | openstack/zaqar | zaqar/storage/sqlalchemy/tables.py | Python | apache-2.0 | 2,182 | 0 |
import os
import calendar
import datetime
import logging
from primitives import *
from constants import *
from helpers import OrderedAttrDict, utc
"""
The AS types and their FLV representations.
"""
log = logging.getLogger('flvlib.astypes')
class MalformedFLV(Exception):
pass
# Number
def get_number(f, max_... | mrquim/mrquimrepo | script.video.F4mProxy/lib/flvlib/astypes.py | Python | gpl-2.0 | 8,332 | 0.00228 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2019 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | dgasmith/psi4 | psi4/driver/procrouting/response/scf_response.py | Python | lgpl-3.0 | 28,511 | 0.002876 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This is a doctest example with Numpy arrays.
For more information about doctest, see
https://docs.python.org/3/library/doctest.html (reference)
and
www.fil.univ-lille1.fr/~L1S2API/CoursTP/tp_doctest.html (nice examples in
French).
To run doctest, execute this script... | jeremiedecock/snippets | python/doctest/numpy_example.py | Python | mit | 2,806 | 0.000713 |
import unittest
import time
from datetime import datetime
from app import create_app, db
from app.models import User, AnonymousUser, Role, Permission
class UserModelTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self... | Ginray/my-flask-blog | tests/test_user_model.py | Python | mit | 5,437 | 0.000368 |
import numpy as np
import torch
from PIL import Image
from argparse import ArgumentParser
from torch.optim import SGD, Adam
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torchvision.transforms import Compose, CenterCrop, Normalize
from torchvision.transforms import ToTensor, ToPILIm... | bodokaiser/piwise | main.py | Python | bsd-3-clause | 5,437 | 0.001839 |
# read_hadamard_file.py
# Reads data from a text file to create a 3D
# version of a given Hadamard Matrix.
# Created by Rick Henderson
# Created on June 4, 2015
# Completed June 5, 2015
# Note: A "Hadamard File" is a text file containing rows
# rows of + and - where the + indicates a 1 or a cube
# and th... | rickhenderson/code-samples | python-blender/read_hadamard_file.py | Python | gpl-3.0 | 1,503 | 0.007984 |
from numpy.distutils.core import setup, Extension
#from setuptools import setup, Extension
setup(
name = "Infer", version = "1.0",
description='Python version of MCMC, plus other inference codes under development',
author='Neale Gibson',
author_email='ngibson@eso.org',
packages=['Infer'],
package_dir={'... | nealegibson/Infer | setup.py | Python | gpl-3.0 | 518 | 0.027027 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py... | eicher31/compassion-modules | partner_communication/models/__init__.py | Python | agpl-3.0 | 706 | 0.001416 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ListPlaylistsByID
# Returns a collection of playlists that match the provided IDs.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "Licen... | jordanemedlock/psychtruths | temboo/core/Library/YouTube/Playlists/ListPlaylistsByID.py | Python | apache-2.0 | 6,403 | 0.00531 |
#!/usr/bin/env python
# "manhole" entry point, friendlier ipython startup to remote container
__author__ = 'Dave Foster <dfoster@asascience.com>'
def main():
import sys, os, re, errno, json, socket
from pkg_resources import load_entry_point
r = re.compile('manhole-(\d+).json')
if len(sys.argv) == 2... | scionrep/scioncc | src/scripts/manhole.py | Python | bsd-2-clause | 3,942 | 0.003298 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the output module field formatting helper."""
import unittest
from dfdatetime import semantic_time as dfdatetime_semantic_time
from dfvfs.path import fake_path_spec
from plaso.containers import events
from plaso.lib import definitions
from plaso.output impo... | kiddinn/plaso | tests/output/formatting_helper.py | Python | apache-2.0 | 12,029 | 0.001912 |
# 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... | openstack/horizon | openstack_dashboard/dashboards/admin/hypervisors/compute/urls.py | Python | apache-2.0 | 1,052 | 0 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/oehealth | oehealth_professional/__init__.py | Python | agpl-3.0 | 1,597 | 0.010645 |
# Copyright 2017 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 agre... | craigcitro/pydatalab | google/datalab/contrib/mlworkbench/commands/_ml.py | Python | apache-2.0 | 33,262 | 0.008689 |
from flask_admin import expose
from listenbrainz.webserver.admin import AdminIndexView
class HomeView(AdminIndexView):
@expose('/')
def index(self):
return self.render('admin/home.html')
| Freso/listenbrainz-server | listenbrainz/webserver/admin/views.py | Python | gpl-2.0 | 206 | 0 |
"""
A pythonic interface to the Zabbix API.
"""
from .api import Api, ApiException
from .objects.host import Host
from .objects.hostgroup import HostGroup
from .objects.item import Item
from .objects.trigger import Trigger
from .objects.itservice import ItService
| erik-stephens/zabbix | zabbix/__init__.py | Python | mit | 266 | 0 |
from decimal import Decimal
class Integer:
def __init__(self, val=None):
self.val = int(val)
def __repr__(self):
return self.val
class Text:
def __init__(self, val=None):
self.val = str(val)
def __repr__(self):
return self.val
class Bool:
def __init__(self, val=Non... | shabinesh/Tabject | tabject/types.py | Python | bsd-3-clause | 550 | 0.016364 |
import codecs
import pathlib
import re
import sys
from distutils.command.build_ext import build_ext
from distutils.errors import (CCompilerError, DistutilsExecError,
DistutilsPlatformError)
from setuptools import Extension, setup
if sys.version_info < (3, 5, 3):
raise RuntimeError("... | rutsky/aiohttp | setup.py | Python | apache-2.0 | 4,887 | 0 |
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from edc_registration.models import RegisteredSubject
from .base_maternal_clinical_measurements import BaseMaternalClinicalMeasurements
class MaternalClinicalMeasurementsOne(BaseMaternalClinicalMeasurements):
h... | TshepangRas/tshilo-dikotla | td_maternal/models/maternal_clinical_measurements_one.py | Python | gpl-2.0 | 738 | 0.004065 |
#!/usr/bin/env python3
import os
import sys
thispath = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(os.path.dirname(thispath),"helper"))
from MiscFxns import *
from StandardModules import *
import pulsar_psi4
def ApplyBasis(syst,bsname,bslabel="primary"):
return psr.system.apply_si... | pulsar-chem/Pulsar-Core | test/old/Old2/modules/CP.py | Python | bsd-3-clause | 2,969 | 0.022903 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ver... | sparkslabs/kamaelia | Code/Python/Apps/Europython09/App/BB1.py | Python | apache-2.0 | 1,272 | 0.002358 |
from models.sampler import DynamicBlockGibbsSampler
from models.distribution import DynamicBernoulli
from models.optimizer import DynamicSGD
from utils.utils import prepare_frames
from scipy import io as matio
from data.gwtaylor.path import *
import ipdb
import numpy as np
SIZE_BATCH = 10
EPOCHS = 100
SIZE_HIDDEN = 50... | deprofundis/deprofundis | models/scripts/example_crbm.py | Python | mit | 2,313 | 0.006053 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/deed/event_perk/shared_lambda_shuttle_static_deed.iff"
result.attri... | anhstudios/swganh | data/scripts/templates/object/tangible/deed/event_perk/shared_lambda_shuttle_static_deed.py | Python | mit | 487 | 0.045175 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from unittest import mock
from configman.dotdict import DotDict
from socorro.lib.task_manager import TaskManager, defa... | lonnen/socorro | socorro/unittest/lib/test_task_manager.py | Python | mpl-2.0 | 2,418 | 0.000414 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2015-2016 Gramps Development Team
# Copyright (C) 2016 Nick Hall
#
# 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... | dermoth/gramps | gramps/gen/db/generic.py | Python | gpl-2.0 | 88,300 | 0.000453 |
from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def get_bug_info(self, repository, bug_id):
"""Get the information for the specified bug.
... | reviewboard/reviewboard | reviewboard/hostingsvcs/bugtracker.py | Python | mit | 1,633 | 0 |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2013 Task Coach developers <developers@taskcoach.org>
Task Coach 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, or
... | TaskEvolution/Task-Coach-Evolution | taskcoach/taskcoachlib/widgets/__init__.py | Python | gpl-3.0 | 1,717 | 0.000582 |
#!/usr/bin/env python
"""simple thread pool
@author: dn13(dn13@gmail.com)
@author: Fibrizof(dfang84@gmail.com)
"""
import threading
import Queue
import new
def WorkerPoolError( Exception ):
pass
class Task(threading.Thread):
def __init__(self, queue, result_queue):
threading.Thread.__init__(self)
... | hackshel/py-aluminium | src/__furture__/simplepool.py | Python | bsd-3-clause | 3,289 | 0.023995 |
from ..utils.command import BaseCommand
from ..utils.tabulate import tabulate
from ..utils.info import get_packages, Sources
class Colors:
PURPLE = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
UNDERLINE = '\033[4m'
ENDC = '\033[0m'
class Command(BaseCommand):
name... | piton-package-manager/piton | piton/commands/outdated.py | Python | mit | 1,511 | 0.031105 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import codecs
import importlib
import os
import shutil
from django.apps import apps
from django.core.management import CommandError, call_command
from django.db import DatabaseError, connection, models
from django.db.migrations import questioner
from dja... | abhattad4/Digi-Menu | tests/migrations/test_commands.py | Python | bsd-3-clause | 37,861 | 0.002803 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable
from variable_functions import my_attribute_label
class home_grid_id(Variable):
'''The grid_id of a person's residence.'''
def dep... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/psrc/person/home_grid_id.py | Python | gpl-2.0 | 2,165 | 0.0194 |
# -*- encoding: utf-8 -*-
"""Unit tests for the Docker feature."""
from fauxfactory import gen_choice, gen_string, gen_url
from nailgun import entities
from random import randint, shuffle
from requests.exceptions import HTTPError
from robottelo.api.utils import promote
from robottelo.constants import DOCKER_REGISTRY_HU... | abalakh/robottelo | tests/foreman/api/test_docker.py | Python | gpl-3.0 | 47,259 | 0.000042 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from yali.storage import StorageError
class LibraryError(StorageError):
pass
| akuster/yali | yali/storage/library/__init__.py | Python | gpl-2.0 | 125 | 0.008 |
"""
Interrogate stick for supported capabilities.
"""
import sys
from codinghyde.ant import driver
from codinghyde.ant import node
from config import *
# Initialize
stick = driver.USB1Driver(SERIAL, debug=DEBUG)
antnode = node.Node(stick)
antnode.start()
# Interrogate stick
# Note: This method will return immedia... | mvillalba/codinghyde.ant | demos/ant/02-capabilities.py | Python | mit | 769 | 0 |
import re
import unicodedata
from collections import defaultdict
from typing import Any, Dict, List, Optional, Sequence, Union
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db.models.query import QuerySet
from django.forms.models import model_to_dict
from django.utils.... | punchagan/zulip | zerver/lib/users.py | Python | apache-2.0 | 21,312 | 0.001548 |
# -*- coding: utf-8 -*-
"""Installer script for Pywikibot 2.0 framework."""
#
# (C) Pywikibot team, 2009-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
import itertools
import os
import sys
PYTHON_VERSION = sys.version_info[:3]
PY2 = (PYTHON_VERSIO... | icyflame/batman | setup.py | Python | mit | 7,976 | 0.000251 |
# (c) 2014, Brian Coca, Josh Drake, et al
#
# This file is part of Ansible
#
# Ansible 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, or
# (at your option) any later version.
... | devopservices/ansible | lib/ansible/cache/jsonfile.py | Python | gpl-3.0 | 4,163 | 0.004324 |
#!/usr/bin/env python
"""Upserts Domains from Salesforce Domain__c.
"""
import logging
import os
from django.core.management.base import BaseCommand
import iss.models
import iss.salesforce
logger = logging.getLogger(os.path.basename(__file__))
class Command(BaseCommand):
def add_arguments(self, parser):
... | AASHE/iss | iss/management/commands/upsert_iss_domains.py | Python | mit | 1,085 | 0 |
from sslyze import ServerNetworkLocation
from sslyze.plugins.elliptic_curves_plugin import (
SupportedEllipticCurvesScanResult,
SupportedEllipticCurvesImplementation,
)
from tests.connectivity_utils import check_connectivity_to_server_and_return_info
from tests.markers import can_only_run_on_linux_64
from tests... | nabla-c0d3/sslyze | tests/plugins_tests/test_elliptic_curves_plugin.py | Python | agpl-3.0 | 2,148 | 0.005121 |
# Copyright 2012-2013 Ravello Systems, 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 agree... | ravello/testmill | lib/testmill/command_run.py | Python | apache-2.0 | 4,718 | 0.000848 |
# Copyright (c) 2012, Tycho Andersen. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... | kiniou/qtile | libqtile/state.py | Python | mit | 2,415 | 0 |
__author__ = 'thatcher'
from django.contrib import admin
# from django.contrib.auth.models import User
# from django.contrib.auth.admin import UserAdmin
# from django.contrib.sessions.
from django.contrib.sessions.models import Session
from .models import *
from base.forms import *
def images_thubmnail(self):
ret... | ZmG/trywsk | base/admin.py | Python | apache-2.0 | 1,654 | 0.009069 |
"""
:mod:`imports` is here to resolve import statements and return the
modules/classes/functions/whatever, which they stand for. However there's not
any actual importing done. This module is about finding modules in the
filesystem. This can be quite tricky sometimes, because Python imports are not
always that simple.
... | SamuelDSR/YouCompleteMe-Win7-GVIM | third_party/jedi/jedi/imports.py | Python | gpl-3.0 | 15,994 | 0.000813 |
from __future__ import division
from collections import deque
class MovingAverage(object):
def __init__(self, size):
"""
Initialize your data structure here.
:type size: int
"""
self.queue = deque(maxlen=size)
def next(self, val):
"""
:type val: int
... | keon/algorithms | algorithms/queues/moving_average.py | Python | mit | 749 | 0 |
# -*- coding: utf-8 -*-
"""Racndicmd setup.py."""
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import os
import sys
class Tox(TestCommand):
"""Tox."""
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
def initialize_options(self):
... | mtoshi/rancidcmd | setup.py | Python | mit | 2,154 | 0 |
from .company import Company
from .contact import Contact
from .deal import Deal
from .note import Note
from .requester import Requester
class AgileCRM:
def __init__(self, domain, email, api_key):
requester = Requester(domain, email, api_key)
self.contact = Contact(requester=requester)
se... | rahmonov/agile-crm-python | agilecrm/client.py | Python | mit | 454 | 0 |
#!/usr/bin/env python3
#!/usr/bin/python
# https://en.wikipedia.org/wiki/Matplotlib
import numpy
import matplotlib.pyplot as plt
from numpy.random import rand
a = rand(100)
b = rand(100)
plt.scatter(a, b)
plt.show()
| jtraver/dev | python3/matplotlib/plot1.py | Python | mit | 220 | 0.004545 |
'''
A MLP algorithm example using TensorFlow library.
This example is using generate random distribution
(http://cs231n.github.io/neural-networks-case-study/)
Code references:
https://github.com/shouvikmani/Tensorflow-Deep-Learning-Tutorial/blob/master/tutorial.ipynb
https://github.com/aymericdamien/TensorFlow-Example... | woozzu/tf_tutorials | 03_MLP_spiral2D.py | Python | mit | 3,767 | 0.009557 |
# Copyright 2016 Palo Alto Networks, 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 agre... | PaloAltoNetworks/minemeld-core | tests/traced_mock.py | Python | apache-2.0 | 5,455 | 0.0033 |
from unittest import TestCase
from compile import add_jmp_opcodes, break_to_atoms
from compile.jmp_add import travel, shuffle
from opcode_ import PRT
class TestJMPAdd(TestCase):
def test_added_init_jmp(self):
node_chain = PRT.build_from_string('u', None)
atoms = break_to_atoms(node_chain)
... | TheAnosmic/cheetahs_byte | tests/test_compile/test_jmp_add.py | Python | gpl-2.0 | 3,283 | 0 |
from django.contrib import admin
from .models import Album, Song
# Register your models here.
admin.site.register(Album)
admin.site.register(Song)
| bunnydev26/django_newboston | music/admin.py | Python | gpl-3.0 | 149 | 0 |
#!/usr/bin/env python
from traits.api import HasStrictTraits, Float
from mock import Mock
class MyClass(HasStrictTraits):
number = Float(2.0)
def add_to_number(self, value):
""" Add the value to `number`. """
self.number += value
my_class = MyClass()
# Using my_class.add_to_number = Mock... | marshallmcdonnell/interactive_plotting | Traits/manual/testing_hasstricttraits.py | Python | mit | 547 | 0.005484 |
#
# Copyright (C) 2014 Red Hat, 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 wr... | russellb/gerrymander | gerrymander/model.py | Python | apache-2.0 | 15,825 | 0.000569 |
#!/usr/bin/python
import Adafruit_GPIO as GPIO
import time, os
#print "GETTING GPIO OBJECT"
gpio = GPIO.get_platform_gpio()
#print "SETUP CSID1"
#gpio.setup("CSID1", GPIO.OUT)
#print os.path.exists('/sys/class/gpio/gpio133')
#print "SETUP XIO-P1"
#gpio.setup("XIO-P1", GPIO.IN)
#GPIO.setup("U14_13", GPIO.IN)
#prin... | fantoms/psychic-octo-spork | chipdisable.py | Python | gpl-3.0 | 1,217 | 0.028759 |
################################################################################
#
# Copyright 2015-2020 Félix Brezo and Yaiza Rubio
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Softwa... | i3visio/osrframework | osrframework/wrappers/teamtreehouse.py | Python | agpl-3.0 | 3,948 | 0.00456 |
import datetime
import json
import logging
from django.contrib import messages
from django.contrib.auth import REDIRECT_FIELD_NAME, get_user_model
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import logout
from django.contrib.sites.shortcuts import get_current_site
from djan... | caktus/django-opendebates | opendebates/views.py | Python | apache-2.0 | 19,833 | 0.001311 |
# Copyright (C) 2017 Equinor ASA, Norway.
#
# The file 'site_config.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 Lic... | joakim-hove/ert | res/enkf/queue_config.py | Python | gpl-3.0 | 6,283 | 0.001751 |
from setuptools import setup, find_packages
import os
import allensdk
# http://bugs.python.org/issue8876#msg208792
if hasattr(os, 'link'):
del os.link
def prepend_find_packages(*roots):
''' Recursively traverse nested packages under the root directories
'''
packages = []
for root in roots:
... | wvangeit/AllenSDK | setup.py | Python | gpl-3.0 | 1,828 | 0.012582 |
import shutil
from nose.tools import *
from holland.lib.lvm import LogicalVolume
from holland.lib.lvm.snapshot import *
from tests.constants import *
class TestSnapshot(object):
def setup(self):
self.tmpdir = tempfile.mkdtemp()
def teardown(self):
shutil.rmtree(self.tmpdir)
def test_snap... | m00dawg/holland | plugins/holland.lib.lvm/tests/xfs/test_snapshot.py | Python | bsd-3-clause | 1,824 | 0.004386 |
#!/usr/bin/env python3
import json
import os
import subprocess
def connection_lost(network_id, timeout_seconds):
p = subprocess.Popen(["hamachi", "go-online", network_id])
try:
p.wait(timeout_seconds)
except subprocess.TimeoutExpired:
p.kill()
return True
return False
if __na... | frenzykryger/hamachi-watchdog | hamachi-watchdog.py | Python | bsd-2-clause | 745 | 0 |
#!/usr/bin/env python
## \file merge_solution.py
# \brief Python script for merging of the solution files.
# \author F. Palacios
# \version 6.1.0 "Falcon"
#
# The current SU2 release has been coordinated by the
# SU2 International Developers Society <www.su2devsociety.org>
# with selected contributions from the op... | drewkett/SU2 | SU2_PY/merge_solution.py | Python | lgpl-2.1 | 2,861 | 0.00769 |
# -*- coding: utf-8 -*-
# Copyright 2014-17 Eficent Business and IT Consulting Services S.L.
# <contact@eficent.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import progress_measurements_entry
| sysadminmatmoz/pmis | project_progress_measurement/wizard/__init__.py | Python | agpl-3.0 | 237 | 0 |
"""
Texture Replacement
+++++++++++++++++++
Example of how to replace a texture in game with an external image.
``createTexture()`` and ``removeTexture()`` are to be called from a
module Python Controller.
"""
from bge import logic
from bge import texture
def createTexture(cont):
"""Create a new Dynamic Texture"... | pawkoz/dyplom | blender/doc/python_api/examples/bge.texture.1.py | Python | gpl-2.0 | 1,051 | 0.001903 |
import os
import shutil
import tempfile
import zipfile
class ZipVolume:
def __init__( self, path ):
self.zf = zipfile.ZipFile( path, 'r' )
self.ls = {}
self.__load_ls()
def __load_ls( self ):
ils = self.zf.infolist()
for i in ils:
try:
i... | hakuya/higu | lib/hdbfs/ark.py | Python | bsd-2-clause | 8,385 | 0.025164 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""Python libr... | arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/ext/jsonpickle/__init__.py | Python | mit | 5,049 | 0.00099 |
import random
class intDict(object):
"""A dictionary with integer keys"""
def __init__(self, numBuckets):
"""Create an empty dictionary"""
self.buckets = []
self.numBuckets = numBuckets
for i in range(numBuckets):
self.buckets.append([])
def ad... | parmarmanojkumar/MITx_Python | 6002x/week2/lectureCode_intDict.py | Python | mit | 1,482 | 0.008097 |
#!/usr/bin/env python
from sys import argv
def calcRabbits(n,k):
pairs = [1, 1]
for i in range(2,n):
#try:
f1 = pairs[i-1]
f2 = pairs[i-2] * 3
pairs.append((f1+f2))
# except IndexError:
# pass
return pairs
if __name__ == "__main__":
try:
... | Jorisvansteenbrugge/advbioinf | rosalind/python/fib.py | Python | gpl-3.0 | 489 | 0.022495 |
from cms.models.pluginmodel import CMSPlugin
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import gettext_lazy as _
from django.utils.translation import get_language
from partners.models import Partner
class PartnersPlugin(CMSPluginBase):
name = _... | gitsimon/tq_website | partners/cms_plugins/partners_plugin.py | Python | gpl-2.0 | 859 | 0.001164 |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext
from django.contrib import messages
from django.contrib.adm... | espenak/pinax-oldversion-backup | pinax/apps/signup_codes/views.py | Python | mit | 4,496 | 0.004448 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sleeptomusicweb.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| beddit/sleep-musicalization-web | manage.py | Python | bsd-2-clause | 258 | 0 |
import mimetypes
import unittest
from os import path
from django.conf.urls.static import static
from django.http import FileResponse, HttpResponseNotModified
from django.test import SimpleTestCase, override_settings
from django.utils.http import http_date
from django.views.static import was_modified_since
from .. imp... | mattseymour/django | tests/view_tests/tests/test_static.py | Python | bsd-3-clause | 5,569 | 0.000898 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Triangle Project Code.
# Triangle analyzes the lengths of the sides of a triangle
# (represented by a, b and c) and returns the type of triangle.
#
# It returns:
# 'equilateral' if all sides are equal
# 'isosceles' if exactly 2 sides are equal
# 'scalene' ... | MichaelSEA/python_koans | python3/koans/triangle.py | Python | mit | 1,017 | 0.003933 |
#!/usr/bin/python
#! -*- coding:utf-8 -*-
from sqlalchemy import Column, Integer, String
from database import Base
class Message(Base):
__tablename__ = 'message'
MessageId = Column(Integer, primary_key=True)
DeviceId = Column(String(50))
MessageBody = Column(String(1000))
MessageType = Column(Inte... | HalfLike/qc-web-server | app/models.py | Python | apache-2.0 | 1,467 | 0.00818 |
# Copyright 2018 The TensorFlow Authors. 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 applica... | nburn42/tensorflow | tensorflow/contrib/distribute/python/one_device_strategy.py | Python | apache-2.0 | 4,931 | 0.009126 |
"""
A HTML5 target.
"""
from targets import _
from html import TYPE
import html
NAME = _('HTML5 page')
EXTENSION = 'html'
HEADER = """\
<!DOCTYPE html>
<html>
<head>
<meta charset="%(ENCODING)s">
<title>%(HEADER1)s</title>
<meta name="generator" content="http://txt2tags.org">
<link rel="stylesheet" href="%(STYLE)s"... | farvardin/txt2tags-test | targets/html5.py | Python | gpl-2.0 | 3,582 | 0.019542 |
class Solution(object):
def distributeCandies(self, candies):
"""
:type candies: List[int]
:rtype: int
"""
result = 0
kind = list(set(candies))
if len(kind) > len(candies)/2:
result = len(candies)/2
else:
result = len(kind)
... | sadad111/leetcodebox | Distribute Candies.py | Python | gpl-3.0 | 338 | 0 |
import numpy
from chainer import cuda, Function
def _cu_conv_sum(y, x, n):
# Convolutional sum
# TODO(beam2d): Use scan computation
rdim = x.size / (x.shape[0] * x.shape[1])
cuda.elementwise(
'float* y, const float* x, int rdim, int N, int n_',
'''
int half_n = n_ / 2;
... | nushio3/chainer | chainer/functions/local_response_normalization.py | Python | mit | 4,265 | 0.003751 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.