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 |
|---|---|---|---|---|---|
# Watchdog - Building supervision with Raspberry Pi
# (C)2017 - Norbert Huffschmid - GNU GPL V3
import os
from subprocess import Popen, PIPE
def index(req):
req.write('Watchdog - (C)2017 - Norbert Huffschmid\n\n')
req.write('Building supervision with Raspberry Pi\n\n')
process = Popen(['/usr/bin/... | long-exposure/watchdog | plugin/about/www/about.py | Python | gpl-3.0 | 669 |
class Day:
date = None
index = None
room_objects = []
def __init__(self, date=None, index=None):
self.date = date
self.index = index
self.room_objects = []
def add_room(self, room):
self.room_objects.append(room)
| niranjan94/python-pentabarf-xml | pentabarf/Day.py | Python | mit | 269 |
import re
from datetime import datetime
from BeautifulSoup import BeautifulSoup
from django.db import models
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.contrib.syndication.views impor... | viswimmer1/PythonGenerator | data/python_files/34091278/models.py | Python | gpl-2.0 | 5,618 |
from sympy.combinatorics import Permutation
from sympy.combinatorics.perm_groups import PermutationGroup
from sympy.combinatorics.homomorphisms import homomorphism, group_isomorphism, is_isomorphic
from sympy.combinatorics.free_groups import free_group
from sympy.combinatorics.fp_groups import FpGroup
from sympy.combin... | kaushik94/sympy | sympy/combinatorics/tests/test_homomorphisms.py | Python | bsd-3-clause | 3,623 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.pant... | gmalmquist/pants | tests/python/pants_test/engine/legacy/test_pants_engine_integration.py | Python | apache-2.0 | 1,031 |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016,2019
"""
Schemas for streams.
********
Overview
********
A stream represents an unbounded flow of tuples with a declared schema so that each tuple on the stream complies with the schema. A stream's schema may be one of:
* :py:class:... | IBMStreams/streamsx.topology | com.ibm.streamsx.topology/opt/python/packages/streamsx/topology/schema.py | Python | apache-2.0 | 37,502 |
import os
import subprocess
import sys
from collections import defaultdict
from typing import Any, ClassVar, Dict, Type
from urllib.parse import urljoin
from .wptmanifest.parser import atoms
atom_reset = atoms["Reset"]
enabled_tests = {"testharness", "reftest", "wdspec", "crashtest", "print-reftest"}
class Result(o... | chromium/chromium | third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/wpttest.py | Python | bsd-3-clause | 24,539 |
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('auth', '0006_require_contenttypes_0002'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
... | edx-solutions/organizations-edx-platform-extensions | edx_solutions_organizations/migrations/0001_initial.py | Python | agpl-3.0 | 2,681 |
"""
KDTree for PySAL: Python Spatial Analysis Library.
Adds support for Arc Distance to scipy.spatial.KDTree.
"""
import math
import scipy.spatial
import numpy
from scipy import inf
from . import sphere
from .sphere import RADIUS_EARTH_KM
__author__ = "Charles R Schmidt <schmidtc@gmail.com>"
__all__ = ["DISTANCE_MET... | lixun910/pysal | pysal/lib/cg/kdtree.py | Python | bsd-3-clause | 11,910 |
# Term Frequency Graph based on .jsonl data from TheRealDonaldTrump
import sys
import string
import json
from collections import Counter
from nltk.tokenize import TweetTokenizer
from nltk.corpus import stopwords
import matplotlib.pyplot as plt
def process(text, tokenizer=TweetTokenizer(), stopwords=[]):
"""Process... | filkuzmanovski/tweet-science | twitter_term_frequency_graph.py | Python | gpl-3.0 | 1,326 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# A Solution to "Amicable numbers" – Project Euler Problem No. 21
# by Florian Buetow
#
# Sourcecode: https://github.com/fbcom/project-euler
# Problem statement: https://projecteuler.net/problem=21
#
def get_proper_divisors(n):
ret = [1]
for d in range(2, n/2+1)... | fbcom/project-euler | 021_amicable_numbers.py | Python | mit | 800 |
#!/usr/bin/python
# Copyright 2004 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Test that on compilers sensitive to library order on linker's command line, we
# generate the correct order.
import BoostBu... | mxrrow/zaicoin | src/deps/boost/tools/build/v2/test/library_order.py | Python | mit | 2,157 |
#!/usr/bin/python
#
# Copyright 2013 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 b... | lociii/googleads-python-lib | examples/adspygoogle/dfp/v201306/get_custom_targeting_keys_by_statement.py | Python | apache-2.0 | 2,094 |
"""
===============================================================
The discount factor tuner for dlm
===============================================================
The modelTuner class provides the tuning functionality for the dlm class.
It makes use of the gradient descent to optimize the discount factor for
each... | wwrechard/pydlm | pydlm/tuner/dlmTuner.py | Python | bsd-3-clause | 4,269 |
import numpy as np
import theano as th
from kaggle_utils import multiclass_log_loss
from examples.utils import make_progressbar
def validate(dataset_x, dataset_y, model, epoch, batch_size):
progress = make_progressbar('Testing epoch #{}'.format(epoch), len(dataset_x))
progress.start()
logloss = 0.
fo... | Pandoro/DeepFried2 | examples/Kaggle-Otto/test.py | Python | mit | 986 |
import time
import threading
import subprocess
import pygame.locals
vlc_path = 'C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe'
class Scene(threading.Thread):
def __init__(self, screen, games, games_manager):
threading.Thread.__init__(self)
self.screen = screen
self.games = games
... | flowersteam/SESM | SESM/scene.py | Python | gpl-3.0 | 953 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | devopservices/ansible | lib/ansible/runner/__init__.py | Python | gpl-3.0 | 69,424 |
# 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 t... | briancurtin/rackspace-sdk-plugin | rackspace/monitoring/v1/notification_type.py | Python | apache-2.0 | 991 |
import sys
from ftplib import FTP
ftp = FTP()
class FTPClient():
"""docstring for FTPClient"""
def __init__(self):
"""
"""
pass
message_array = []
def log_message(self, message, clear=True):
"""
Logs the message to the message_array, from where it is retrieved t... | yekeqiang/mypython | myftp/mypackage/ftp_module.py | Python | gpl-2.0 | 4,731 |
# -*- coding: utf-8 -*-
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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
#
# U... | schristakidis/p2ner | p2ner/components/pipeelement/flowcontrolelement/flowcontrolelement/flowcontrol.py | Python | apache-2.0 | 3,252 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('management', '0005_remove_userprofile_photos'),
]
operations = [
migrations.AddField(
model_name='userprofile',
... | trivago-ggarrido/PsyAna | management/migrations/0006_auto_20150118_0911.py | Python | gpl-2.0 | 675 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import *
import os
import re
import ast
from ub import config
import ub
session = None
cc_exceptions = ['datetime', 'int', 'comments', 'float', 'composite', 'series']
cc_c... | JackED42/calibre-web | cps/db.py | Python | gpl-3.0 | 11,883 |
import xmlrpclib
server = xmlrpclib.ServerProxy("http://effbot.org/rpc/echo.cgi")
print "'testing'"
print repr(server.echo("testing"))
print "['testing', 'testing', 1, 2.0, [3]]"
print repr(server.echo("testing", "testing", 1, 2.0, [3]))
| Yinxiaoli/iros2015_folding | src/folding_control/src/xmlrpclib-1.0.1/echotest.py | Python | mit | 248 |
import os
import sys
import codecs
from fnmatch import fnmatchcase
from distutils.util import convert_path
from setuptools import setup, find_packages
def read(fname):
return codecs.open(os.path.join(os.path.dirname(__file__), fname)).read()
# Provided as an attribute, so you can append to these instead
# of rep... | d0ugal-archive/html5video | setup.py | Python | mit | 5,057 |
# Copyright (c) 2009, Tim Cuthbertson # 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 of condit... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/rednose.py | Python | agpl-3.0 | 11,413 |
# 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 | platformio/commands/team.py | Python | apache-2.0 | 6,668 |
"""
Support tool for disabling user accounts.
"""
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.db.models import Q
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
from django.views.generic import View
from rest_framewor... | philanthropy-u/edx-platform | lms/djangoapps/support/views/manage_user.py | Python | agpl-3.0 | 2,973 |
"""Check that there is enough disk space in predefined paths."""
import tempfile
import os.path
from openshift_checks import OpenShiftCheck, OpenShiftCheckException
class DiskAvailability(OpenShiftCheck):
"""Check that recommended disk space is available before a first-time install."""
name = "disk_availab... | zhiwliu/openshift-ansible | roles/openshift_health_checker/openshift_checks/disk_availability.py | Python | apache-2.0 | 6,703 |
"""
Copyright 2016 Deepgram
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
distri... | deepgram/kur | kur/supplier/speechrec.py | Python | apache-2.0 | 30,208 |
# -*- coding: utf-8 -*-
# srpregister.py
# Copyright (C) 2013 LEAP
#
# 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 3 of the License, or
# (at your option) any later version.
#
#... | andrejb/bitmask_client | src/leap/bitmask/crypto/srpregister.py | Python | gpl-3.0 | 7,329 |
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, user, password):
wd = self.app.wd
self.app.open_home_page()
self.app.type_text("user", user)
self.app.type_text("pass", password)
wd.find_element_by_css_selector("input[value='Login']").... | obutkalyuk/Python_15 | fixture/session.py | Python | apache-2.0 | 1,157 |
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt, pi, fabs
from integrate import *
from fitting import *
def f(x):
return 1 / (1 + x ** 2)
targets = [10**(-val) for val in range(2, 13)]
comp_bound = 7
rom_nums = [1 / target ** (1 / 6) for target in targets[0: comp_bound]]
rom_nums = [i... | Jokiva/Computational-Physics | lecture 10/romberg_err.py | Python | gpl-3.0 | 1,390 |
"""
Copyright (c) 2011, Michael Joseph Walsh.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the ... | nemonik/Intellect | intellect/examples/bahBahBlackSheep/__init__.py | Python | bsd-3-clause | 1,628 |
from __future__ import absolute_import
from __future__ import unicode_literals
from datetime import datetime, time
from collections import namedtuple
from django import forms
from django.utils.dateparse import parse_datetime
from django.utils.encoding import force_str
from django.utils.translation import ugettext_la... | steventimberman/masterDebater | venv/lib/python2.7/site-packages/django_filters/fields.py | Python | mit | 5,624 |
def transform_scalars(dataset):
from tomviz import utils
import numpy as np
# Get the current volume as a numpy array.
array = utils.get_array(dataset)
#create 3D hanning window
for axis, axis_size in enumerate(array.shape):
# set up shape for numpy broadcasting
filter_shape =... | Hovden/tomviz | tomviz/python/HannWindow3D.py | Python | bsd-3-clause | 678 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | jjscarafia/odoo | addons/mail/mail_message.py | Python | agpl-3.0 | 47,270 |
# -*- coding: utf-8
# pylint: disable=line-too-long
"""Implements the collections class (the file name has an extra 'c' to avoid
masking the standard collections library).
If the user have analyzed their metagenome using a metagenome binning software
and identified draft genomes in their data (or by any other means b... | meren/anvio | anvio/ccollections.py | Python | gpl-3.0 | 18,061 |
# -*- coding: UTF-8 -*-
"""
Some global constants and a settings object, that stores the template and
it's context along with the filenames for the diff…
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from pathlib import Path
from pkg_resources import resource_string
from appdi... | brutus/wdiffhtml | wdiffhtml/settings.py | Python | gpl-3.0 | 2,302 |
#!/usr/bin/env python3
import argparse
from mygrations.mygrate import mygrate
# argument parsing
parser = argparse.ArgumentParser()
parser.add_argument(
'command',
nargs='?',
default='version',
choices=['version', 'apply', 'check', 'import', 'plan', 'plan_export'],
help='Action to execute (default... | cmancone/mygrations | mygrate.py | Python | mit | 795 |
from enum import Enum
class ExpressionType(Enum):
CUSTOM = ""
AND = "and"
OR = "or"
NOT = "not"
WHEN = "when"
FORALL = "forall"
class Expression:
expression_type = ExpressionType("")
predicate = ""
objects = []
subexpressions = []
def __init__(self, expression_type, pred... | CinnamonHAB/cinnamonHAB | pddl_parser/pddl_problem.py | Python | gpl-3.0 | 8,213 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | srajag/nova | nova/tests/integrated/v3/test_extension_info.py | Python | apache-2.0 | 2,868 |
#!/usr/bin/python
## Printing troubleshooter
## Copyright (C) 2008 Red Hat, Inc.
## Copyright (C) 2008 Tim Waugh <twaugh@redhat.com>
## 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 ... | hamonikr-root/system-config-printer-gnome | troubleshoot/CheckLocalServerPublishing.py | Python | gpl-2.0 | 3,179 |
import os
import h5py
import numpy as np
from pyspawn.traj import traj
class hessian(traj):
def build_hessian_hdf5_semianalytical(self, dr):
ndims = self.get_numdims()
self.set_timestep(1.0)
self.compute_elec_struct(False)
filename = "hessian.hdf5"
if not os.path.isfil... | blevine37/pySpawn17 | pyspawn/hessian.py | Python | mit | 2,477 |
import logging
import splunk.Intersplunk as si
import os
import subprocess
from splunk.appserver.mrsparkle.lib.util import make_splunkhome_path
USER = 'ubuntu'
SSH_KEY = make_splunkhome_path(['etc', 'apps', 'bsides-austin-2015-app','default','bsides_demo.pem'])
#makes a local path to store logs to be ingested in inou... | divious1/bsides-austin-2015 | bsides-austin-2015-app/bin/sysdigstart.py | Python | apache-2.0 | 3,007 |
# Copyright (c) 2018 PaddlePaddle 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 app... | PaddlePaddle/Paddle | python/paddle/fluid/tests/book/test_recommender_system.py | Python | apache-2.0 | 12,089 |
import csv
import numpy as np
from apiclient.discovery import build
import json
# Load Dataset
with open("./Youtube History Data.csv") as f:
reader = csv.reader(f)
raw_data = [list(x) for x in reader]
data = np.array(raw_data[1:])
# Youtube Data Collection
with open('youtube_config.json') as f:
DEVELOPER_... | bcongdon/Data-Science-Projects | youtube-history/tag_scraper.py | Python | gpl-3.0 | 1,084 |
# -*- coding: utf-8 -*-
#
# lld documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented ... | llvm-mirror/lld | docs/conf.py | Python | apache-2.0 | 8,299 |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | StackStorm/st2-auth-backend-flat-file | tests/unit/test_flat_file_backend.py | Python | apache-2.0 | 3,052 |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | roadmapper/ansible | lib/ansible/modules/cloud/amazon/ecs_task.py | Python | gpl-3.0 | 17,388 |
from sympy import (
adjoint, conjugate, DiracDelta, Heaviside, nan, pi, sign, sqrt,
symbols, transpose, Symbol, Piecewise, I, S, Eq, oo,
SingularityFunction, signsimp
)
from sympy.utilities.pytest import raises
from sympy.core.function import ArgumentIndexError
from sympy.utilities.exceptions import SymP... | wxgeo/geophar | wxgeometrie/sympy/functions/special/tests/test_delta_functions.py | Python | gpl-2.0 | 6,190 |
import sys
from com.l2scoria.gameserver.datatables import SkillTable
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
qn = "125_IntheNameofEvilPart1"
# NPCs
MUSHIKA = 32114
... | zenn1989/scoria-interlude | L2Jscoria-Game/data/scripts/quests/125_IntheNameofEvilPart1/__init__.py | Python | gpl-3.0 | 6,260 |
# Webhooks for external integrations.
from __future__ import absolute_import
from zerver.models import get_client
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
import ujson
@api_key_onl... | ryansnowboarder/zulip | zerver/views/webhooks/travis.py | Python | apache-2.0 | 1,326 |
"""
Adds support for Nest thermostats.
"""
import logging
from homeassistant.components.thermostat import ThermostatDevice
from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS)
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up... | Jaidan/jaidan-hab-home-assistant | homeassistant/components/thermostat/nest.py | Python | mit | 2,770 |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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.
CVXPY is distributed i... | riadnassiffe/Simulator | src/tools/ecos/cvxpy/cvxpy/utilities/key_utils.py | Python | mit | 3,912 |
import csv
import matplotlib.pyplot as plt
from numpy import *
import scipy.interpolate
import math
from pylab import *
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
import matplotlib.patches as patches
from matplotlib.path import Path
import os
# ---------------------------------------------------... | crichardson17/starburst_atlas | Low_resolution_sims/Dusty_LowRes/Padova_inst/padova_inst_8/fullgrid/peaks_reader.py | Python | gpl-2.0 | 5,306 |
# 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 logging
import torch
from torch import nn
from fairseq import utils
from fairseq.data.data_utils import lengths_to_padding_mask
from ... | pytorch/fairseq | fairseq/models/text_to_speech/fastspeech2.py | Python | mit | 15,718 |
# string to integer
def myint(string):
if string[0] == '-':
neg = True
string = string[1:]
else:
neg = False
num = 0
for s in string:
num *= 10
num += int(s)
if neg:
num = -1*num
return num
print myint('123')
print myint('-123')
p... | amitsaha/learning | python/strings/str2int.py | Python | unlicense | 345 |
#! /usr/bin/env python
"""
Bit error rate tester (BERT) simulator, written in Python.
Original Author: David Banas <capn.freako@gmail.com>
Original Date: 17 June 2014
Testing by: Mark Marlett <mark.marlett@gmail.com>
This Python script provides a GUI interface to a BERT simulator, which
can be used to explore the ... | MarkMarlett/PyBERT | pybert/pybert.py | Python | bsd-2-clause | 45,021 |
# -*- coding: utf-8 -*-
#
# weatherservice documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 30 18:33:43 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | RealTimeWeb/weather | python/docs/conf.py | Python | mit | 8,090 |
## -*- encoding: utf-8 -*-
import os
import sys
from setuptools import setup
from codecs import open # To open the README file with proper encoding
from setuptools.command.test import test as TestCommand # for tests
# Get information from separate files (README, VERSION)
def readfile(filename):
with open(filename... | mforets/carlin | setup.py | Python | gpl-3.0 | 1,724 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 15 19:54:08 2010
@author: sat kumar tomer (http://civil.iisc.ernet.in/~satkumar/)
Functions:
utm2deg: Calculate utm co-ordinates from Lat, Lon
deg2utm : Calculate Lat, Lon from UTM
kabini:
berambadi:
great_circle_distance:
... | tectronics/ambhas | ambhas/gis.py | Python | lgpl-2.1 | 12,300 |
#!/usr/bin/env python
#
# Copyright 2014 Dell 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 a... | zsoltdudas/lis-tempest | tempest/cmd/cleanup.py | Python | apache-2.0 | 11,901 |
import spacepy.time as spt
x = spt.Ticktock([2452331.0142361112, 2452332.0142361112], 'JD')
print(x.ISO)
| fsbr/se3-path-planner | cuspStudy/scratch/tickexample.py | Python | mit | 106 |
import select
import socket
try:
from eventlet.patcher import is_monkey_patched as is_eventlet
except ImportError:
is_eventlet = lambda module: False # noqa
POLL_READ = 0x001
POLL_ERR = 0x008 | 0x010 | 0x2000
class _epoll(object):
def __init__(self):
self._epoll = select.epoll()
def regis... | pantheon-systems/kombu | kombu/utils/eventio.py | Python | bsd-3-clause | 2,757 |
# -*- coding: utf-8 -*-
import csv
from django.core.management.base import BaseCommand
from intranet.apps.eighth.models import EighthActivity
from intranet.apps.groups.models import Group
from intranet.apps.users.models import User
class Command(BaseCommand):
help = "Transfer attendance data"
def handle(s... | jacobajit/ion | intranet/apps/eighth/management/commands/import_permissions.py | Python | gpl-2.0 | 1,682 |
# -*- coding=utf -*-
import unittest
from sqlalchemy import create_engine, MetaData, Table, Integer, String, Column
from cubes import *
from cubes.errors import *
from ..common import CubesTestCaseBase
from json import dumps
def printable(obj):
return dumps(obj, indent=4)
class AggregatesTestCase(CubesTestCaseBa... | ubreddy/cubes | tests/sql/test_aggregates.py | Python | mit | 2,324 |
'''
urlresolver Kodi plugin
Copyright (C) 2018
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 3 of the License, or
(at your option) any later version.
Thi... | koditr/xbmc-tr-team-turkish-addons | script.module.urlresolver/lib/urlresolver/plugins/fembed.py | Python | gpl-2.0 | 2,251 |
#!/usr/bin/env python3
#
# Copyright (C) 2007-2013 by frePPLe bv
#
# This library 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 versio... | frePPLe/frePPLe | frepplectl.py | Python | agpl-3.0 | 1,613 |
#!/usr/bin/env python
from distutils.core import setup, Extension
import numpy
from Cython.Build import cythonize
setup(
name='PievaCore',
version='1.0.0',
description='Low level pixel to led mapping provider',
author='Albertas Mickenas',
author_email='mic@wemakethings.net',
packages=['core']... | stavka/pieva2 | setup.py | Python | gpl-2.0 | 669 |
# Eve W-Space
# Copyright (C) 2013 Andrew Austin and other contributors
#
# 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 3 of the License, or
# (at your option... | reactormonk/eve-wspace | evewspace/Recruitment/views.py | Python | gpl-3.0 | 855 |
#!/usr/bin/env python
""" Provide support for assignment formats.
The convention is that when stored in files, column index starts
with 1, even though python convention starts with 0.
"""
# Version 1
from listR import isFloat
def assignmentExprStream2Dict(data, assignmentSymbol="=", commentSymbol="#"):
... | palmerjh/iEBE | PlayGround/job-2/binUtilities/assignmentFormat.py | Python | gpl-3.0 | 2,468 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | zhaochao/fuel-web | nailgun/nailgun/objects/base.py | Python | apache-2.0 | 17,245 |
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import test_addon_hash
from . import test_module
from . import test_module_deprecated
from . import test_module_upgrade_deprecated
| ovnicraft/server-tools | module_auto_update/tests/__init__.py | Python | agpl-3.0 | 257 |
# Copyright (c) 2015 The Phtevencoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Dummy Socks5 server for testing.
'''
from __future__ import print_function, division, unicode_literals
import socket, threadin... | ravenbyron/phtevencoin | qa/rpc-tests/test_framework/socks5.py | Python | mit | 5,705 |
# -*- test-case-name: twisted.words.test.test_jabbercomponent -*-
#
# Copyright (c) 2001-2005 Twisted Matrix Laboratories.
# See LICENSE for details.
from zope.interface import implements
from twisted.words.xish import domish, xpath, utility
from twisted.words.protocols.jabber import jstrports, xmlstream
def compon... | kenorb/BitTorrent | twisted/words/protocols/jabber/component.py | Python | gpl-3.0 | 5,773 |
import time
import sys
import thread
import server_pool
import db_transfer
import shell
import daemon
#def test():
# thread.start_new_thread(DbTransfer.thread_db, ())
# Api.web_server()
def main():
shell.check_python()
config = shell.get_config(False)
daemon.daemon_exec(config)
daemon.set_user(co... | ilikecola/Shadowsocks-combine-manyuser | shadowsocks/server.py | Python | apache-2.0 | 495 |
import re
import codecs
from toolz.itertoolz import groupby
from itertools import count
def __flatten(ls):
"""
Aux function to flatten lists and remove None from result (k, v) sequences
:param ls: original list
:return: flattened list
"""
for e in ls:
if type(e) is list:
fo... | ramonpin/mredu | mredu/simul.py | Python | apache-2.0 | 3,677 |
# Copyright 2015 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... | strint/tensorflow | tensorflow/tools/docs/parser.py | Python | apache-2.0 | 43,815 |
#
# 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... | apache/incubator-airflow | airflow/contrib/operators/redis_publish_operator.py | Python | apache-2.0 | 1,150 |
"""Support for IQVIA sensors."""
from __future__ import annotations
from statistics import mean
from typing import NamedTuple
import numpy as np
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigE... | lukas-hetzenecker/home-assistant | homeassistant/components/iqvia/sensor.py | Python | apache-2.0 | 8,845 |
with open('sphere.obj') as f:
lines = f.readlines()
vertecies = filter(lambda line: line.startswith('v '), lines)
faces = filter(lambda line: line.startswith('f '), lines)
normals = [ 'vn' + line[1:] for line in vertecies ]
newFaces = [
(
'f ' +
' '.join([
'{0}//{0}'.format(ind... | DomNomNom/anisotropic | assets/makeNormalSphere.py | Python | gpl-3.0 | 540 |
from modularodm import Q
from rest_framework import generics
from rest_framework import exceptions
from rest_framework.response import Response
from rest_framework.exceptions import NotFound
from rest_framework.status import HTTP_204_NO_CONTENT
from rest_framework import permissions as drf_permissions
from website.mod... | samchrisinger/osf.io | api/preprints/views.py | Python | apache-2.0 | 15,291 |
import mock
import pytest
import tests
import verzamelend
class RegisterCallbacksTestCase(tests.BaseTestCase):
@mock.patch('verzamelend.collectd')
def test(self, mock_collectd):
"""
Test verzamelend.register_callbacks().
"""
plugin = verzamelend.Plugin('test')
verza... | collectdbit/verzamelend | tests/module_test.py | Python | apache-2.0 | 1,082 |
#!/usr/bin/env python
# Note: this file is part of some nnet3 config-creation tools that are now deprecated.
from __future__ import print_function
import os
import argparse
import sys
import warnings
import copy
from operator import itemgetter
def GetSumDescriptor(inputs):
sum_descriptors = inputs
while len(s... | michellemorales/OpenMM | kaldi/egs/wsj/s5/steps/nnet3/components.py | Python | gpl-2.0 | 29,765 |
# Authors: Rob Crittenden <rcritten@redhat.com>
#
# Copyright (C) 2010 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ver... | hatchetation/freeipa | ipapython/certmonger.py | Python | gpl-3.0 | 14,272 |
# proxy module
from traitsui.wx.image_panel import *
| enthought/etsproxy | enthought/traits/ui/wx/image_panel.py | Python | bsd-3-clause | 53 |
import math
def convert_infinity_to_string(number):
if math.isinf(number):
if number < 0:
return "-Infinity"
if number > 0:
return "Infinity"
return number
| CitrineInformatics/python-citrination-client | citrination_client/util/maths.py | Python | apache-2.0 | 205 |
from scattering import scatterer
import numpy as np
from numpy.testing import assert_array_almost_equal, run_module_suite
def test_ones():
scat = scatterer(.1, 0.0, 'water', diameters=np.array([0.04, 0.05]))
scat.set_scattering_model('rayleigh')
assert_array_almost_equal(scat.sigma_b,
... | dopplershift/Scattering | test/test_scatterer.py | Python | bsd-2-clause | 434 |
"""Functions that ease the use of Django."""
# pylint: disable=protected-access
from __future__ import absolute_import
from django.utils.safestring import mark_safe
def get_fields(model_object, ignore_fields=()):
"""Extract the fields of the model.
Args:
model_object (django.models.Model): model ins... | gregoil/rotest | src/rotest/common/django_utils/common.py | Python | mit | 2,036 |
#!/usr/bin/python
# Import the required modules
import cv2, os
import numpy as np
from PIL import Image
# For face detection we will use the Haar Cascade provided by OpenCV.
cascadePath = "haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier(cascadePath)
def get_images_and_labels(path):
# App... | The-J-Person/Barfacecor | face_recognizer.py | Python | mit | 2,704 |
#
#
# Copyright (C) 2006, 2007, 2011, 2012, 2013, 2014 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
... | ganeti/ganeti | lib/luxi.py | Python | bsd-2-clause | 9,450 |
"""
Interfaces to the QEMU monitor.
:copyright: 2008-2010 Red Hat Inc.
"""
import socket
import time
import threading
import logging
import select
import re
import os
import utils_misc
import passfd_setup
from autotest.client.shared import utils
try:
import json
except ImportError:
logging.warning("Could not ... | rbian/virt-test | virttest/qemu_monitor.py | Python | gpl-2.0 | 67,086 |
# coding: utf-8
from __future__ import unicode_literals
import base64
from .common import InfoExtractor
from ..compat import compat_urllib_request
from ..utils import qualities
class DumpertIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?dumpert\.nl/mediabase/(?P<id>[0-9]+/[0-9a-zA-Z]+)'
_TEST = {
... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/dumpert.py | Python | unlicense | 1,957 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Ver 16 - 28 July 2019 -
from urllib.request import *
import json
import time
import mysql.connector
from mysql.connector import errorcode
import string
import sys
import datetime
from db import *
import threading
#from threading import Thread
import multiprocessing as mp
fr... | theflorianmaas/dh | Python/dhproc dev/getDirectUpdate.py | Python | mit | 10,081 |
# -*- coding:utf-8 -*-
#
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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
#
# Unl... | pombredanne/bandit | tests/unit/core/test_issue.py | Python | apache-2.0 | 4,613 |
#
# gPrime - A web-based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2007-2009 Brian G. Matherly
# Copyright (C) 2009-2010 Benny Malengier <benny.malengier@gramps-project.org>
# Copyright (C) 2010 Peter Landgren
# Copyright (C) 2010 Tim Lyons
# Copyright (C) 2011 ... | sam-m888/gprime | gprime/plugins/docgen/htmldoc.py | Python | gpl-2.0 | 22,518 |
# -*- coding: utf-8 -*-
#
# dbsync documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 14 17:15:11 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | reinaldoc/dbsync | docs/conf.py | Python | gpl-2.0 | 6,413 |
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='tgbotplug',
version='0.1.14',
p... | pmpfl/tgbotplug | setup.py | Python | mit | 1,080 |
#!/usr/bin/env python3
import json
import random
def main():
dictionary_file_path = 'dictionary.json'
with open(dictionary_file_path, "r") as dictionary_file:
dictionary = json.load(dictionary_file)
while True:
# Select a random word-meaning pair
word_meaning = random.choice(list(... | Anmol-Singh-Jaggi/Dictionary | quiz.py | Python | gpl-3.0 | 501 |
# coding: utf-8
#
# Copyright 2018 The Oppia 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 requi... | kevinlee12/oppia | core/domain/state_domain_test.py | Python | apache-2.0 | 203,993 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.