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 |
|---|---|---|---|---|---|---|
"""Abstraction of an OF table."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2019 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... | trungdtbk/faucet | faucet/valve_table.py | Python | apache-2.0 | 11,432 | 0.001924 |
"""
Copyright (c) 2016-2017 The Nirdizati Project.
This file is part of "Nirdizati".
"Nirdizati" 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 Foundation; either version 3 of the
License, or (at your option) any lat... | nirdizati/nirdizati-runtime | PredictiveMethods/RemainingTime/batch/PredictiveMonitor.py | Python | lgpl-3.0 | 3,958 | 0.002527 |
import re
from functools import reduce
from nltk import word_tokenize
from nltk.corpus import stopwords
stop = set(stopwords.words("english"))
repls = ("(", ""), (")", ""), ("'s", "")
def tokenize(text):
lev1 = re.sub("[!#*%:,.;&-]", "", text) # Remove specific chars
lev2 = re.sub(r'... | Nickil21/Indeed-ML-codesprint-2017 | source/data_preprocessing.py | Python | mit | 776 | 0.006443 |
#!/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 A... | RCheungIT/phoenix | bin/queryserver.py | Python | apache-2.0 | 7,659 | 0.003395 |
#!/usr/bin/python3
from lib.Element import *
from lib.Page import *
from lib.Site import *
import random
import shutil
import pprint
random.seed()
def makeChoice():
print( '\nSelect a lib to check: ' )
print( ' (1) Element.py' )
print( ' (2) Page.py' )
print( ' (3) Site.py' )
print( ' (e) Exit test.py' )... | ayypot/dillys-place | test.py | Python | bsd-2-clause | 3,208 | 0.063279 |
from __future__ import unicode_literals
import re
try:
from collections import OrderedDict
except ImportError:
OrderedDict = None
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib import auth
from django.contrib.auth import get_user_model
from account.conf... | ntucker/django-user-accounts | account/forms.py | Python | mit | 7,903 | 0.002657 |
## This file is part of Invenio.
## Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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... | pamfilos/invenio | modules/websubmit/lib/functions/Create_Modify_Interface.py | Python | gpl-2.0 | 15,906 | 0.006035 |
import os
import socket
import fedmsg.config
from nose.tools.nontrivial import make_decorator
try:
import unittest2 as unittest
except ImportError:
import unittest
def load_config(name='fedmsg-test-config.py'):
here = os.path.sep.join(__file__.split(os.path.sep)[:-1])
test_config = os.path.sep.join(... | vivekanand1101/fedmsg | fedmsg/tests/common.py | Python | lgpl-2.1 | 1,482 | 0 |
from __future__ import division
import bisect
import math
import random
from collections import defaultdict
from itertools import chain
from operator import attrgetter, itemgetter
######################################
# Non-Dominated Sorting (NSGA-II) #
######################################
def selNSGA2(indivi... | DailyActie/Surrogate-Model | 01-codes/deap-master/deap/tools/emo.py | Python | mit | 22,227 | 0.001575 |
import ConfigParser
import json
def get_player_id():
config = ConfigParser.ConfigParser()
config.read('yasp.cfg')
return config.get('yasp', 'player_id')
def get_hero_id():
config = ConfigParser.ConfigParser()
config.read('yasp.cfg')
return config.get('yasp', 'hero_id')
def get_hero_data():
file = open(... | jcdavis/yasp-stats | yasp_util.py | Python | apache-2.0 | 437 | 0.032037 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/py-pyani/package.py | Python | lgpl-2.1 | 2,432 | 0.000411 |
# PMR WebServices
# Copyright (C) 2016 Manhoi Hur, Belyaeva, Irina
# This file is part of PMR WebServices API.
#
# PMR API 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
... | Arabidopsis-Information-Portal/PMR_API | services/experiments_api/experiments_service.py | Python | gpl-2.0 | 4,048 | 0.002717 |
#!/usr/bin/env python
import os
import re
import xively
import subprocess
import time
import datetime
import requests
import sys
temperature = 0
humidity = 0
# extract feed_id and api_key from environment variables
FEED_ID = "YOUR_FEED_ID" #CHANGE IT
API_KEY = "YOUR_KEY" #CHANGE IT
DEBUG = False
# initialize api cl... | williambout/Aira | wind/air.py | Python | mit | 2,815 | 0.019538 |
#!/usr/bin/python
'''
Generate pseudo-random SSNs and save to a text file.
'''
import random
try:
myfile = open(str(raw_input("Output filename: ")), "w")
except ValueError:
print "Invalid input. Please enter a valid filename."
try:
for i in range(int(raw_input("How many random numbers?: "))):
lin... | dagorim/mytools | ssngen.py | Python | bsd-2-clause | 524 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import re
import types
import StringIO
from functools import wraps
import tempfile
import shutil
from pipes import quote
from ansible.runner.return_data import ReturnData
from ansible import utils
from ansible.utils import template
DEFAULT_KEYRING = ""
DEFAULT_GPG_... | llou/gpg_ansible | plugins/action_plugins/gpg_key.py | Python | gpl-3.0 | 45,135 | 0.004786 |
"""Main Tornado app."""
from tornado import gen
from tornado.options import parse_command_line
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application
import logging
from tornado.options import options
from settings import settings
from urls import url_patterns
... | yoziru-desu/locomo-pebble | mock-server/app.py | Python | mit | 1,150 | 0 |
import os
import sys
extensions = []
templates_path = []
source_suffix = '.rst'
master_doc = 'index'
project = u'django-chunked-uploads'
copyright_holder = 'Eldarion'
copyright = u'2012, %s' % copyright_holder
exclude_patterns = ['_build']
pygments_style = 'sphinx'
html_theme = 'default'
htmlhelp_basename = '%sdoc' % ... | eldarion/django-chunked-uploads | docs/conf.py | Python | bsd-3-clause | 645 | 0.00155 |
from django.template.base import Library
from django.core.urlresolvers import reverse
from projects.models import ProjectBuild
register = Library()
@register.simple_tag()
def build_url(build_id):
"""
Fetches the ProjectBuild for a given build_id, if any.
"""
try:
build = ProjectBuild.object... | timrchavez/capomastro | projects/templatetags/projects_tags.py | Python | mit | 543 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'https://ildoc.dev'
RELATIVE_URLS = False
FEE... | ildoc/ildoc.it | publishconf.py | Python | mit | 488 | 0.004098 |
import logging
import numpy as np
import os
import subprocess
import tempfile
from . import scene
from . import rman
ZERO = scene.npvector((0, 0, 0))
_film = rman.Identifier(
'Film', positional=['string'],
named={
'xresolution': 'integer',
'yresolution': 'integer',
'cropwindow': 'fl... | eterevsky/animations | pyrene/pbrt.py | Python | mit | 4,687 | 0.007041 |
import errno
import io
import os
import secrets
import shutil
from contextlib import suppress
from functools import wraps
from fsspec.spec import AbstractFileSystem
from fsspec.utils import infer_storage_options, mirror_from, stringify_path
def wrap_exceptions(func):
@wraps(func)
def wrapper(*args, **kwargs)... | intake/filesystem_spec | fsspec/implementations/arrow.py | Python | bsd-3-clause | 6,762 | 0.000739 |
import unittest
import os
from ui import main
print os.getcwd()
class TestMain(unittest.TestCase):
def setUp(self):
self.m = main.MainWindow()
def test_mainWindow(self):
assert(self.m)
def test_dataframe(self):
import numpy
#Random 25x4 Numpy Matrix
self.m... | sdiehl/rpygtk | rpygtk/runtests.py | Python | gpl-3.0 | 818 | 0.02445 |
#!/usr/bin/env python
# vim: ts=4:sw=4:et
#
# malware zoo
#
import mwzoo
import argparse
import os
import logging
parser = argparse.ArgumentParser(description='MalwareZoo')
parser.add_argument(
'--mwzoo-home', action='store', dest='mwzoo_home', default=None, required=False,
help='Path to the base installation... | unixfreak0037/mwzoo | mwzoo.py | Python | mit | 1,715 | 0.004082 |
from pytest import raises
from mio import runtime
from mio.errors import AttributeError, TypeError
def test_clone(mio):
mio.eval("World = Object clone()")
assert mio.eval("World")
assert mio.eval("World parent") == runtime.find("Object")
def test_type(mio):
assert mio.eval("Object type") == "Objec... | prologic/mio | tests/test_objects.py | Python | mit | 4,906 | 0 |
# reading
# Manages current reading from sources like Instapaper and Goodreads
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Fri Jan 01 09:01:03 2021 -0500
#
# Copyright (C) 2020 Bengfort.com
# For license information, see LICENSE
#
# ID: __init__.py [] benjamin@bengfort.com $
"""
Manages current... | bbengfort/memorandi | reading/__init__.py | Python | apache-2.0 | 539 | 0.003711 |
from django.conf.urls import url, include
from django.conf import settings
from paying_for_college.views import LandingView
from django.contrib import admin
# from django.conf.urls.static import static
urlpatterns = [
# url(r'^admin/', include(admin.site.urls)),
url(r'^$',
LandingView.as_view(), name='... | ascott1/college-costs | paying_for_college/config/urls.py | Python | cc0-1.0 | 801 | 0.001248 |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponse
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPa... | tony-joseph/livre | items/views.py | Python | bsd-3-clause | 22,123 | 0.001718 |
"""
Fitting example: simultaneous fit of two datasets
"""
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
import bornagain as ba
from bornagain import deg, angstrom, nm
def get_sample(params):
"""
Returns a sample with uncorrelated cylinders and pyramids.
"""
radius_a = para... | gpospelov/BornAgain | Examples/fit52_Advanced/multiple_datasets.py | Python | gpl-3.0 | 6,791 | 0 |
import unittest
from rmgpy.molecule.molecule import Molecule
from .parser import *
class ParserTest(unittest.TestCase):
def test_fromAugmentedInChI(self):
aug_inchi = 'InChI=1S/CH4/h1H4'
mol = fromAugmentedInChI(Molecule(), aug_inchi)
self.assertTrue(not mol.InChI == '')
aug_inc... | chatelak/RMG-Py | rmgpy/molecule/parserTest.py | Python | mit | 2,890 | 0.007612 |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from zerver.models import Realm, RealmAlias, get_realm, can_add_alias
from zerver.lib.actions import do_get_realm_aliases
import s... | amyliu345/zulip | zerver/management/commands/realm_alias.py | Python | apache-2.0 | 2,022 | 0.000989 |
#!/bin/python3
import sys
def solve(a0, a1, a2, b0, b1, b2):
score = [0, 0]
alist = [a0, a1, a2]
blist = [b0, b1, b2]
clist = zip(alist, blist)
for pair in clist:
if pair[0] > pair[1]:
score[0] += 1
elif pair[0] < pair[1]:
score[1] += 1
else:
... | Krakn/learning | src/python/hackerrank/algorithms/compare_the_triplets/compare_the_triplets.py | Python | isc | 597 | 0.005025 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ver... | taigaio/taiga-back | taiga/base/utils/diff.py | Python | agpl-3.0 | 1,614 | 0 |
import os
import re
import json
import cocos
class Project(object):
CPP = 'cpp'
LUA = 'lua'
JS = 'js'
CONFIG = '.cocos-project.json'
KEY_PROJ_TYPE = 'project_type'
KEY_HAS_NATIVE = 'has_native'
KEY_CUSTOM_STEP_SCRIPT = "custom_step_script"
CUSTOM_STEP_PRE_BUILD = "pre-build"
... | yylangchen/Sample_CPP_Cocos2dx | tools/cocos2d-console/bin/cocos_project.py | Python | mit | 18,116 | 0.005078 |
from typing import TYPE_CHECKING, List, Optional
import strawberry
from api.languages.types import Language
from api.submissions.types import Submission
from api.users.types import User
from strawberry.types.datetime import DateTime
if TYPE_CHECKING: # pragma: no cover
from api.conferences.types import Conferenc... | patrick91/pycon | backend/api/schedule/types.py | Python | mit | 1,130 | 0 |
#!/usr/bin/env python
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | vsco/grpc | tools/run_tests/run_tests.py | Python | bsd-3-clause | 56,812 | 0.010068 |
# -*- coding: utf-8 -*-
from flask import Blueprint
site_users_blueprint = Blueprint('site_users', __name__)
from . import views, hooks
| pastgift/seed-website-py | app/site_users/__init__.py | Python | mit | 139 | 0.007194 |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 7 19:36:08 2014
@author: Stuart Mumford
This file is designed to be imported and ran only via setup.py, hence it's
dependency on astropy_helpers which will be available in that context.
"""
from __future__ import absolute_import, division, print_function
import os
fro... | Alex-Ian-Hamilton/sunpy | sunpy/tests/setup_command.py | Python | bsd-2-clause | 4,158 | 0.000481 |
"""
@TODO: ProcessLogger().attempts - update/interact based on __enter__/__exit__
@TODO: Review ProcessLoggerABC, and make ProcessLogger inherit from it
@TODO: ProcessingAttempt: make uncaught exception in switch_on_exit() cause parent
to close all other attempts.
@TODO: Write ProcessLoggerABC in task_logger/. Th... | OaklandPeters/task_logger | task_logger/logger.py | Python | mit | 27,065 | 0.010309 |
# 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 datetime import datetime
from django.conf import settings
from django.db import models
from django_extensions.db.f... | sylvestre/rna | rna/models.py | Python | mpl-2.0 | 6,479 | 0.000309 |
# Gambit scripts
#
# Copyright (C) USC Information Sciences Institute
# Author: Nibir Bora <nbora@usc.edu>
# URL: <http://cbg.isi.edu/>
# For license information, see LICENSE
import os
import sys
import numpy
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
import setting... | nbir/gambit-scripts | scripts/LAnhoodAnalysis/src/disp_combined.py | Python | apache-2.0 | 3,378 | 0.043517 |
from ftracer_script import *
## note the capture details file is
## warnings is needed to suppress errors from mousehook tracker
## Function: This is the main script file which houses all the scripts
import sys
import pythoncom, pyHook
import win32con, win32com.client
import win32gui, win32api
import codecs
imp... | mirageglobe/upp-tracker | tracer/ftraceadvance.py | Python | apache-2.0 | 6,390 | 0.006416 |
def foo():
pass \
\
\ | akosyakov/intellij-community | python/testData/formatter/trailingBlankLinesWithBackslashesAtFunctionEndNoNewLine.py | Python | apache-2.0 | 25 | 0.08 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | phrocker/accumulo | test/system/auto/sleep.py | Python | apache-2.0 | 856 | 0 |
from django.http import Http404, HttpResponse
from django.template.context_processors import csrf
from rest_framework.authentication import TokenAuthentication
from rest_framework.parsers import JSONParser
from rest_framework.permissions import DjangoModelPermissions
from rest_framework.views import APIView
from .model... | sussexstudent/falmer | falmer/frontend/views.py | Python | mit | 1,727 | 0.004053 |
from immutable import Immutable
class BinaryTree(Immutable):
"""Immutable Binary Tree.
Left child always smaller than the parent.
Right child always bigger than the parent.
Each element exists only once in a binary tree.
Attributes:
left (BinaryTree): left node.
right (BinaryTree... | d-kiss/candyland | trees/binary_tree.py | Python | gpl-3.0 | 3,771 | 0.00053 |
'''
Different optimizer for minimization
'''
import numpy as np
import theano
import theano.tensor as T
from collections import OrderedDict
def shared32(x, name=None, borrow=False):
return theano.shared(np.asarray(x, dtype='float32'), name=name, borrow=borrow)
def get_momentum_optimizer_max(learning_rate=0.01, ... | zhenxuan00/mmdgm | conv-mmdgm/optimization/optimizer_separated.py | Python | mit | 6,121 | 0.01405 |
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.core import serializers
from django.db.models.loading import get_model
from dashboard import models
import re, os, sys
class Command(BaseCommand):
args = 'system_model [system_id]'
help = 'Ex... | AWegnerGitHub/IRVING | irving/dashboard/management/commands/exportirvingdata.py | Python | gpl-2.0 | 2,221 | 0.029716 |
from __future__ import unicode_literals
from __future__ import print_function
import socket
import time
import six
import math
import threading
from random import choice
import logging
from kazoo.client import KazooClient
from kazoo.client import KazooState
from kazoo.protocol.states import EventType
fro... | bendemott/solr-zkutil | solrzkutil/util.py | Python | mit | 13,103 | 0.0087 |
"""
togePy.pkmn_test
This module tests functionality for togePy
"""
import pokeStructs
import cPickle as pickle
import random
import numpy as np
# Load Data
with open('pokedex', 'rb') as f:
pokedex = pickle.load(f)
with open('abilities', 'rb') as f:
abilities = pickle.load(f)
with open('items... | RK70825/TogePy | pkmn_test.py | Python | gpl-2.0 | 2,964 | 0.008772 |
# -*- coding: utf-8 -*-
TRIPLE_DES_KEY = '1234567812345678'
LIMIT_TITLE_VIEW_LENGTH = 25
RANK_LIST = 5
BLOCK = 11
LIST = 25
VIEW_SERVER_NOTICE = 2
VIEW_NOTICE = 3
TEXTAREA_ROW = 400
MAX_ROW = 700
REPLY_ROW = 50
| codeMarble/codeMarble_Web | codeMarble_Web/resource/otherResource.py | Python | gpl-3.0 | 214 | 0.004673 |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument("--tsv", required=True... | pytorch/fairseq | examples/wav2vec/unsupervised/scripts/filter_tsv.py | Python | mit | 955 | 0 |
from pypylon.cython.factory import Factory
from pypylon.cython.version import PylonVersion
factory = Factory()
pylon_version = PylonVersion() | mabl/PyPylon | pypylon/__init__.py | Python | bsd-3-clause | 142 | 0.007042 |
"""Helper functions
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to templates as 'h'.
"""
from routes import url_for
from webhelpers.html import literal
from webhelpers.html.secure_form import secure_form
from webhelpers.html.tags import *
fro... | leveille/blog.v1 | wurdig/lib/helpers.py | Python | mit | 1,130 | 0.004425 |
#!/usr/bin/env python3
#
# Copyright (c) 2016-2018 Weitian LI <weitian@aaronly.me>
# MIT License
#
# TODO:
# * allow to query by coordinates & radius range
# * filter queried results according to the type/other...
# * if not queried by name, then try query by coordinates
#
"""
Query NED with the provided name or... | liweitianux/atoolbox | astro/query_ned.py | Python | mit | 3,683 | 0.004344 |
# 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 ... | deepmind/pysc2 | pysc2/lib/renderer_human.py | Python | apache-2.0 | 73,287 | 0.008405 |
VERSION_MAJOR = 2
VERSION_MINOR = 1
VERSION_PATCH = 10
version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
version = '%i.%i.%i' % version_info
__version__ = version
__all__ = ['version', 'version_info', '__version__']
| pyblish/pyblish-maya | pyblish_maya/version.py | Python | lgpl-3.0 | 230 | 0 |
#If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
#Find the sum of all the multiples of 3 or 5 below 1000.
result = 0
for i in range(1,1000):
if i % 3 == 0 or i % 5 == 0:
result += + i
print(str(result))
print(result) | FelixCao/ProjectEuler | Problem1.py | Python | mit | 310 | 0.016129 |
# -*- coding: UTF-8 -*-
'''
Module
__init__.py
Copyright
Copyright (C) 2017 Vladimir Roncevic <elektron.ronca@gmail.com>
ats_utilities 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, ei... | vroncevic/py_util | ats_utilities/singleton/base.py | Python | gpl-3.0 | 2,465 | 0 |
#!/usr/bin/env python3
import ctypes
import os
import shutil
import struct
import subprocess
import sys
import time
PYTHON_VERSION = (3, 8, 9)
PYTHON_BITNESS = 32
NSIS_VERSION = '3.06.1'
def main():
if os.name != 'nt':
raise RuntimeError('This script must be run under Windows.')
if ctypes.windll.she... | stweil/letsencrypt | windows-installer/windows_installer/construct.py | Python | apache-2.0 | 5,560 | 0.003417 |
"""Support for Bond fans."""
import math
from typing import Any, Callable, List, Optional
from bond_api import Action, DeviceType, Direction
from homeassistant.components.fan import (
DIRECTION_FORWARD,
DIRECTION_REVERSE,
SPEED_HIGH,
SPEED_LOW,
SPEED_MEDIUM,
SPEED_OFF,
SUPPORT_DIRECTION,
... | titilambert/home-assistant | homeassistant/components/bond/fan.py | Python | apache-2.0 | 4,093 | 0.001222 |
"""
Views related to the video upload feature
"""
from boto import s3
import csv
from uuid import uuid4
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseNotFound
from django.utils.translation import ugettext as _, ugettext_noop... | sameetb-cuelogic/edx-platform-test | cms/djangoapps/contentstore/views/videos.py | Python | agpl-3.0 | 12,545 | 0.001594 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "omxwebremote.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| blm08/omxWebRemote | manage.py | Python | apache-2.0 | 255 | 0 |
#!/usr/bin/python3
import logging
import sys
import pyvips
logging.basicConfig(level=logging.DEBUG)
# pyvips.cache_set_trace(True)
a = pyvips.Image.new_from_file(sys.argv[1])
x = a.erode([[128, 255, 128],
[255, 255, 255],
[128, 255, 128]])
x.write_to_file(sys.argv[2])
| kleisauke/pyvips | examples/try16.py | Python | mit | 302 | 0 |
import _plotly_utils.basevalidators
class RangebreaksValidator(_plotly_utils.basevalidators.CompoundArrayValidator):
def __init__(self, plotly_name="rangebreaks", parent_name="layout.xaxis", **kwargs):
super(RangebreaksValidator, self).__init__(
plotly_name=plotly_name,
parent_name... | plotly/python-api | packages/python/plotly/plotly/validators/layout/xaxis/_rangebreaks.py | Python | mit | 3,243 | 0.000617 |
x = 1
x = x + 1
x = x + x + 2
print("x:",x,"\n")
x = "Hallo Welt"
print("x:",x,"\n")
y = "Gute Nacht"
print("y:",y,"\n")
v = "Und bis morgen"
print("y:"+ y+ " " + v +"\n")
| pez2001/sVimPy | test_scripts/test5.py | Python | gpl-2.0 | 172 | 0.052326 |
#!/usr/bin/env python3
# Copyright 2016 Curtis Sand
#
# 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 la... | fretboardfreak/potty_oh | experiments/signal_generator.py | Python | apache-2.0 | 2,261 | 0 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2010 Dariusz Suchojad <dsuch at gefira.pl>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import re
from uuid import uuid4
# nose
from nose.tools import assert... | dsuch/sec-wall | code/tests/test_constants.py | Python | gpl-3.0 | 672 | 0.002976 |
"""
Django app for:
- Generate favicon in multiple format
- Put in a storage backend
- Include HTML tags for use favicon
"""
VERSION = (0, 6, 0)
__version__ = '.'.join([str(i) for i in VERSION])
__author__ = 'Anthony Monthe (ZuluPro)'
__email__ = 'anthony.monthe@gmail.com'
__url__ = 'https://github.com/ZuluPro/django-s... | ryankaiser/django-super-favicon | favicon/__init__.py | Python | bsd-3-clause | 334 | 0 |
# -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# these are system modules
import numpy
import sys
# these are my local ones
from env import gidgetConfigVars
import tsvIO
# -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
NA_VALUE = -999999
# -#-#-#-#-... | cancerregulome/gidget | commands/feature_matrix_construction/main/addGnabFeatures.py | Python | mit | 38,773 | 0.004384 |
import unittest
import UniDomain.Classes as Classes
#---- unittest Test Classes below here
class TestConfig(unittest.TestCase):
"""Test Config Class"""
def test_Config(self):
"""Check if required config defaults are set"""
self.config = Classes.Config()
self.assertTrue('plugin_authen' ... | spahan/unixdmoain | lib/test/Classes.py | Python | bsd-3-clause | 1,575 | 0.013333 |
from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
from couchpotato.core.helpers.variable import tryInt, cleanHost
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.torrent.base import TorrentMagnetProvider
from couchpotato.environment import Env
... | cloakedcode/CouchPotatoServer | couchpotato/core/providers/torrent/thepiratebay/main.py | Python | gpl-3.0 | 5,523 | 0.010139 |
#!/usr/bin/env python
# encoding=utf-8
# locations.urls
from django.conf.urls import patterns, url
urlpatterns = patterns('',
# ex: /afp/
) | eHealthAfrica/LMIS | LMIS/locations/urls.py | Python | gpl-2.0 | 151 | 0.019868 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class OclIcd(AutotoolsPackage):
"""This package aims at creating an Open Source alternative to v... | iulian787/spack | var/spack/repos/builtin/packages/ocl-icd/package.py | Python | lgpl-2.1 | 2,788 | 0.005022 |
#!/usr/bin/env python
import sys
import pymacaroons
if len(sys.argv) == 1:
sys.stderr.write("usage: %s macaroon [key]\n" % (sys.argv[0],))
sys.exit(1)
macaroon_string = sys.argv[1]
key = sys.argv[2] if len(sys.argv) > 2 else None
macaroon = pymacaroons.Macaroon.deserialize(macaroon_string)
print(macaroon.i... | matrix-org/synapse | scripts-dev/dump_macaroon.py | Python | apache-2.0 | 532 | 0 |
from collections import OrderedDict
import functools
import itertools
import torch
from ..backends.thnn import backend as thnn_backend
from ..parameter import Parameter
import torch.utils.hooks as hooks
def _addindent(s_, numSpaces):
s = s_.split('\n')
# don't do anything for single-line stuff
if len(s) ... | ryfeus/lambda-packs | pytorch/source/torch/nn/modules/module.py | Python | mit | 41,372 | 0.001015 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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... | biswajitsahu/kuma | vendor/packages/translate/storage/placeables/interfaces.py | Python | mpl-2.0 | 1,302 | 0 |
import numpy as np
import westpa
import cPickle as pickle
def dist(pt1, pt2):
return np.sum((pt1-pt2)**2)
def mueller(x, y):
aa = [-1, -1, -6.5, 0.7]
bb = [0, 0, 11, 0.6]
cc = [-10, -10, -6.5, 0.7]
AA = [-200, -100, -170, 15]
XX = [1, 0, -0.5, -1]
YY = [0, 0.5, 1.5, 1]
V1 = 0
for ... | nrego/westpa | lib/examples/stringmethodexamples/examples/Mueller/get_strings.py | Python | gpl-3.0 | 1,298 | 0.009245 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class Employee(models.Model):
_name = "hr.employee"
_inherit = "hr.employee"
child_all_count = fields.Integer(
'Indirect Surbordinates Count',
compute='_... | t3dev/odoo | addons/hr_org_chart/models/hr_employee.py | Python | gpl-3.0 | 1,787 | 0.003917 |
import os
from collections import OrderedDict
import pytest
from waterbutler.providers.s3.metadata import (S3Revision,
S3FileMetadata,
S3FolderMetadata,
S3FolderKeyMetadata,
... | felliott/waterbutler | tests/providers/s3/fixtures.py | Python | apache-2.0 | 5,588 | 0.000537 |
# Copyright 2015 - StackStorm, 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 agr... | openstack/mistral | mistral/tests/unit/config.py | Python | apache-2.0 | 992 | 0 |
"""
Given a string 's' and a dictionary of words 'dict', determine if s can be segmented into a space-separated sequence of one or more dictionary words. Return true is so, and false otherwise.
For example:
s = "practicemakespermanent",
dict = ["makes", "permanent", "practice"].
f(s) // true
"""
s = ... | kekoa428/Interview-Prep | words_in_string.py | Python | gpl-3.0 | 712 | 0.016854 |
"""
Django settings for jay project.
Generated by 'django-admin startproject' using Django 1.8.2.
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 paths in... | OpenJUB/jay | jay/settings.py | Python | mit | 2,511 | 0 |
# -*- coding: utf-8 -*-
import os
import shutil
import sys
import datetime
from invoke import task
from invoke.util import cd
from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer
CONFIG = {
# Local path configuration (can be absolute or relative to tasks.py)
'deploy_path': '..',
# Githu... | webcamoid/webcamoid.github.io | internal/tasks.py | Python | agpl-3.0 | 2,105 | 0.004276 |
"""
Execute impacket's smbexec shell on a partiular host.
This creates a semi-interactive shell without uploading
a binary, but creates lots of shit in the event logs!
All cred to the the awesome Impacket project !
https://code.google.com/p/impacket/
Module built by @harmj0y
"""
from lib import impacket_smbex... | Exploit-install/Veil-Pillage | modules/impacket/smbexec_shell.py | Python | gpl-3.0 | 2,025 | 0.004938 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | platformio/platformio-core | platformio/commands/device/filters/time.py | Python | apache-2.0 | 1,381 | 0 |
#!/usr/bin/env python
"""
Alphasense ADC Driver for Apolline
"""
import argparse
import serial
import time
from influxdb import InfluxDBClient
from influxdb import SeriesHelper
class ADCSensor:
"""
? Alphasense ADC
"""
def __init__(self,database='apolline'):
self.dbname = database
self... | Spirals-Team/apolline-python | apolline/Alphasense_ADC/AlphasenseADC.py | Python | agpl-3.0 | 3,147 | 0.010486 |
#!/usr/bin/env vpython3
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import datetime
import os
import sys
import tempfile
import unittest
if sys.version_info[0] =... | ric2b/Vivaldi-browser | chromium/testing/unexpected_passes_common/expectations_unittest.py | Python | bsd-3-clause | 21,813 | 0.003668 |
# vim: expandtab sw=4 ts=4 sts=4:
#
# Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com>
#
# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# 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 ... | gammu/python-gammu | gammu/worker.py | Python | gpl-2.0 | 10,344 | 0 |
import os
import re
from . import utils
PARTIAL = re.compile('(?P<tag>{{>\s*(?P<name>.+?)\s*}})')
PARTIAL_CUSTOM = re.compile('^(?P<whitespace>\s*)(?P<tag>{{>\s*(?P<name>.+?)\s*}}(?(1)\r?\n?))', re.M)
# def get_template(path, ext='html', partials=None):
# path = os.path.join(TEMPLATES_DIR, '{}.{}'.format(path, ... | mylokin/mustache | mustache/template.py | Python | mit | 1,242 | 0.006441 |
import numpy as np
import sys
caffe_root = '/home/guillem/git/caffe/'
sys.path.insert(1, caffe_root+'python/')
import caffe
import cv2
from py_returnCAMmap import py_returnCAMmap
from py_map2jpg import py_map2jpg
import scipy.io
def im2double(im):
return cv2.normalize(im.astype('float'), None, 0.0, 1.0, cv2.NORM_MINM... | zhangyuygss/WSL | evaluate/py_demo.py | Python | bsd-3-clause | 3,102 | 0.020954 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-18 10:05
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.contrib.taggit
import modelcluster.fields
import wagtail.contrib.routable_page.models
import wag... | hellowebbooks/hellowebbooks-website | blog/migrations/0001_initial.py | Python | mit | 5,381 | 0.002602 |
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
# Copyright (C) 2008 Neogeo Technologies
#
# This file is part of Opencarto project
#
# Opencarto 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 Foundati... | vdeluca/tfi | geonode/contrib/dynamic/postgis.py | Python | gpl-3.0 | 10,137 | 0.000197 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webandgis.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| ingenieroariel/webandgis | manage.py | Python | mit | 252 | 0 |
# Copyright 2019 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... | keras-team/keras | keras/feature_column/dense_features_test.py | Python | apache-2.0 | 43,567 | 0.005624 |
#!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import subprocess
import sys
import webbrowser
SKY_TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
SK... | qiankunshe/sky_engine | sky/tools/skydoc.py | Python | bsd-3-clause | 1,262 | 0.001585 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2019 Rapptz
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 u... | gnmiller/craig-bot | craig-bot/lib/python3.6/site-packages/discord/player.py | Python | mit | 10,909 | 0.001467 |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 22 23:03:45 2017
@author: Shabaka
"""
# import pandas
import pandas as pd
# Import Pyplot as plt from matplotlib
import matplotlib.pyplot as plt
from sqlalchemy import create_engine
# Import func
from sqlalchemy.sql import func
from sqlalchemy import ... | qalhata/Python-Scripts-Repo-on-Data-Science | SQL_Det_Pop_Sum_by_Column.py | Python | gpl-3.0 | 1,516 | 0.00066 |
# Copyright (C) 2017 Sergej Alikov <sergej.alikov@gmail.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# ... | node13h/droll | droll/core/tests/factories.py | Python | agpl-3.0 | 1,048 | 0 |
from django.db.models import signals
def create_perm(*args, **kwargs):
"""
Creates a fake content type and permission
to be able to check for permissions
"""
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django import VERS... | django-leonardo/django-constance | constance/models.py | Python | bsd-3-clause | 1,142 | 0.001751 |
"""
Common base classes for filter rule protocols
"""
from six import StringIO
from virttest import xml_utils
from virttest.libvirt_xml import base, xcepts, accessors
class UntypedDeviceBase(base.LibvirtXMLBase):
"""
Base class implementing common functions for all rule protocol XML w/o a
type attr.
... | balamuruhans/avocado-vt | virttest/libvirt_xml/nwfilter_protocols/base.py | Python | gpl-2.0 | 3,970 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.