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 |
|---|---|---|---|---|---|
class Solution:
# @param a list of integers
# @return an integer
def removeDuplicates(self, A):
if not A:
return 0
a_len = len(A)
l = 0
s = None
for i in range(0, a_len):
e = A[i]
if s != e:
s = e
... | pikeszfish/Leetcode.py | leetcode.py/RemoveDuplicatesfromSortedArray.py | Python | mit | 403 |
from ptc_socket import Socket
from constants import SHUT_RD, SHUT_WR, SHUT_RDWR, WAIT, NO_WAIT, ABORT
__all__ = [Socket, SHUT_RD, SHUT_WR, SHUT_RDWR, WAIT, NO_WAIT, ABORT] | lukius/ptc | ptc/__init__.py | Python | mit | 172 |
# -*- coding: utf-8 -*-
CAFFE_ROOT = 'distribute/'
CAFFE_MODEL_PATH = 'model/deploy.prototxt'
CAFFE_WEIGHTS_PATH = 'model/fer_alexnet_weights.caffemodel'
GPU_MODE = False
DEFAULT_BOOST = 1.4
STRONG_BOOST = 1.9
NEGATIVE_BOOST = 0.715
EMOTIONS = ["neutral","happy","sad","angry/disgusted","(unused #4)","surprised/afra... | nshaud/content-recommendation | config.py | Python | mit | 486 |
# Copyright (C) 2012 Claudio "nex" Guarnieri (@botherder)
#
# 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.
#
# This pro... | 0x00ach/zer0m0n | signatures/persistence_ads.py | Python | gpl-3.0 | 1,307 |
import os
import feedparser
import wget
from mutagen.mp3 import MP3
from mutagen.easyid3 import EasyID3
url = feedparser.parse('http://heldeepradio.spinninpodcasts.com')
folder = "/mnt/Media/Muziek/Heldeep/"
print(EasyID3.valid_keys.keys())
for post in url.entries:
print (post.title + ": " + post.link)
download... | JoooostB/heldeepgrabber | run.py | Python | mit | 564 |
# Copyright 2016 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... | chemelnucfin/tensorflow | tensorflow/python/ops/math_grad_test.py | Python | apache-2.0 | 24,477 |
# Copyright (c) 2015 Canonical Ltd
#
# 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 ... | tpouyer/nova-lxd | nova_lxd/tests/stubs.py | Python | apache-2.0 | 3,293 |
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 16:45:51 2015
@author: hugo
"""
from beampy.document import document
from bs4 import BeautifulSoup
import re
from beampy.scour import scour
import glob
import os
import sys
from subprocess import check_call, check_output
import tempfile
import time
import hashlib # T... | hchauvet/beampy | beampy/functions.py | Python | gpl-3.0 | 28,913 |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | yunify/qingcloud-cli | qingcloud/cli/iaas_client/actions/router/create_routers.py | Python | apache-2.0 | 2,807 |
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
import logging
import os
import time
import hashlib,urllib
from waveapi import simplejson as json
from pushy import utils
from pushy import pushy
class PushHandler(webapp.RequestHandler):
def __init__(self):
self._pu... | chrismdp/pushy | pushy/receive.py | Python | mit | 701 |
'''
_____ _ __ __ _ _
| __ \| | | \/ | | (_)
| | | | |__ __ _ _ __ ___ __ _ _ __ | \ / |_ _| |_ __ _
| | | | '_ \ / _` | '_ ` _ \ / _` | '__| | |\/| | | | | | |/ _` |
| |__| | | | | (_| | | | | | | (_| | | | | | | |_| | ... | dhamarmulia/dm-snake | main.py | Python | mit | 4,911 |
'''
This script was created to aggregate the downlink, uplink, and signal data from the broadband drive test points.
- It aggregates fields from the points to roads segments based on proximity.
- The script was designed to run as a stand alone arcpy program but it could easily be adapted to a script tool interface.
- I... | agrc/Broadband-DriveTest-Stats | StatsAggregator.py | Python | mit | 7,812 |
import json
import os
import logging
import sys
from pyssdb import pyssdb
CONFIG_FILE = 1
ARGUMENT_LIST = [
[CONFIG_FILE, "-f", "<config_file_name>", True],
]
def PrintUsage():
print("\n", __file__, "\n")
for argItem in ARGUMENT_LIST:
if argItem[3] == True:
print(" ", argItem[1], ... | waynechu/PythonProject | ssdbtest.py | Python | mit | 2,065 |
import json, requests, getpass
from messages import messages_provider
messages = messages_provider.get()
#Need to implement this using OAuth.
class Bootstrap:
APP_NAME = "Git-events"
AUTHORIZATIONS_ENDPOINT = "https://api.github.com/authorizations"
def __init__(self, config):
self.config = conf... | iddl/git-events | bootstrap.py | Python | apache-2.0 | 1,909 |
# This file is part of django-ca (https://github.com/mathiasertl/django-ca).
#
# django-ca 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... | mathiasertl/django-ca | ca/ca/celery.py | Python | gpl-3.0 | 981 |
from matrix_client.client import MatrixClient, Room, User
import pytest
def test_create_client():
MatrixClient("http://example.com")
def test_sync_token():
client = MatrixClient("http://example.com")
assert client.get_sync_token() is None
client.set_sync_token("FAKE_TOKEN")
assert client.get_syn... | dovf/matrix-python-sdk | test/client_test.py | Python | apache-2.0 | 2,970 |
# Copyright (c) 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | ntt-sic/python-cinderclient | cinderclient/v2/volume_types.py | Python | apache-2.0 | 3,363 |
"""
GravityWalker.py is for avatars.
A walker control such as this one provides:
- creation of the collision nodes
- handling the keyboard and mouse input for avatar movement
- moving the avatar
it does not:
- play sounds
- play animations
although it does send messeges that allow a listener to p... | jjkoletar/panda3d | direct/src/controls/GravityWalker.py | Python | bsd-3-clause | 28,692 |
#!/usr/bin/env python
# coding: utf-8
#
# Copyright 2010 Alexandre Fiori
# based on the original Tornado by Facebook
#
# 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.... | fiorix/cyclone | demos/upload/uploaddemo.py | Python | apache-2.0 | 3,092 |
from nba_py import game
def test():
gid = '0041400122'
assert game.BoxscoreSummary(gid)
assert game.Boxscore(gid)
assert game.BoxscoreScoring(gid)
assert game.BoxscoreUsage(gid)
assert game.BoxscoreMisc(gid)
assert game.BoxscoreAdvanced(gid)
assert game.BoxscoreFourFactors(gid)
asse... | mcdallas/nba_py | tests/test_nba_py_game.py | Python | bsd-3-clause | 344 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... | bitcraft/pyglet | pyglet/app/__init__.py | Python | bsd-3-clause | 4,453 |
#!/usr/bin/env python
import paramiko
import time
from getpass import getpass
def prevent_paging(remote_conn):
''' stop pagination '''
remote_conn.send("\n")
remote_conn.send("term len 0\n")
time.sleep(1)
''' clear output buffer '''
output = remote_conn.recv(1000)
return output
def cl... | daveg999/automation_class | class4/class4_ex2.py | Python | apache-2.0 | 1,853 |
# Copyright (c) 2013 OpenStack Foundation
# 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 ... | cernops/neutron | neutron/tests/unit/test_l3_schedulers.py | Python | apache-2.0 | 53,905 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/resource_group_paged.py | Python | mit | 968 |
#!/usr/bin/env python
# coding: utf8
"""Example of a spaCy v2.0 pipeline component that requests all countries via
the REST Countries API, merges country names into one token, assigns entity
labels and sets attributes on country tokens, e.g. the capital and lat/lng
coordinates. Can be extended with more details from th... | aikramer2/spaCy | examples/pipeline/custom_component_countries_api.py | Python | mit | 5,903 |
#!/usr/bin/env python
''' Plot a cdf from a csv file
File: plot_CDF_from_file.py
'''
__author__ = "Hauke Holtkamp"
__credits__ = "Hauke Holtkamp"
__license__ = "unknown"
__version__ = "unknown"
__maintainer__ = "Hauke Holtkamp"
__email__ = "h.holtkamp@gmail.com"
__status__ = "Development"
def plot_cdf_from_file(... | ryklith/pyltesim | plotting/plot_CDF_from_file.py | Python | gpl-2.0 | 1,103 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('redirects', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='redirect',
name='regu... | onespacemedia/cms-redirects | redirects/migrations/0002_auto_20160805_1654.py | Python | mit | 907 |
# -*- coding: UTF-8 -*-
r"""\
Duct is a library for running child processes. Duct makes it easy to build
pipelines and redirect IO like a shell. At the same time, Duct helps you write
correct, portable code: whitespace is never significant, errors from child
processes get reported by default, and a variety of `gotchas,... | oconnor663/duct.py | duct.py | Python | mit | 54,315 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | belokop/indico_bare | indico/modules/events/notes/api.py | Python | gpl-3.0 | 3,341 |
#!/Users/wuga/Documents/website/wuga/env/bin/python2.7
#
# The Python Imaging Library
# $Id$
#
from __future__ import print_function
import sys
if sys.version_info[0] > 2:
import tkinter
else:
import Tkinter as tkinter
from PIL import Image, ImageTk
# ------------------------------------------------------... | wuga214/Django-Wuga | env/bin/player.py | Python | apache-2.0 | 2,120 |
"""
Utility classes and tools for handling data contained in bpch files
"""
from dask import delayed
import dask.array as da
import numpy as np
import os
from collections import OrderedDict
from . uff import FortranFile
from . util import cf
from . util.diaginfo import get_diaginfo, get_tracerinfo
#: Default datat... | darothen/xbpch | xbpch/bpch.py | Python | mit | 13,438 |
from collections import deque
import urllib
import feedparser
import os.path
from .. import *
class NyaaSource(EpisodeSource):
"""
nyaa.se trusted torrent search
cats = 1_37 - English translated only
filter = 2 - Trusted only
"""
base_name = "nyaa.se: {}"
base_url = "http://www.nyaa.se/?page=rss&... | nepthar/autopirate | autopirate/sources/Nyaa.py | Python | unlicense | 2,258 |
from django.test import TestCase
from django.db import models
from uppsell.workflow import Workflow, State, BadTransition, \
pre_transition_signal, post_transition_signal, \
pre_transition, post_transition
class ExampleModel(object):
test_state = 'A'
flag = 'RED'
def __init__(self):
... | upptalk/uppsell | uppsell/tests/test_workflow.py | Python | mit | 5,415 |
## Copyright 2009 Laurent Bovet <laurent.bovet@windmaster.ch>
## Jordi Puigsegur <jordi.puigsegur@gmail.com>
##
## This file is part of wfrog
##
## wfrog 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 Softwar... | wfrog/wfrog | wfcommon/config.py | Python | gpl-3.0 | 7,089 |
# Copyright 2016 Cyril Gaudin (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
class TestJournal(TransactionCase):
def test_open_reconciliation_rules(self):
# Just test that method returned the good view
result = sel... | OCA/bank-statement-reconcile | account_reconcile_rule/tests/test_journal.py | Python | agpl-3.0 | 499 |
#--------------------------------------------------------------------------
# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas
# Copyright: (C) 2001 Centro de Pesquisas Renato Archer
# Homepage: http://www.softwarepublico.gov.br
# Contact: invesalius@cti.gov.br
# License: GNU ... | fabio-otsuka/invesalius3 | invesalius/data/surface.py | Python | gpl-2.0 | 35,564 |
# -----------------------------------------------------------
# demonstrates how to extract the items of a dictionary using items()
#o
# (C) 2015 Frank Hofmann, Berlin, Germany
# Released under GNU Public License (GPL)
# email frank.hofmann@efho.de
# -----------------------------------------------------------
# define... | plasmashadow/training-python | lists-dictionaries-tuples/list-items.py | Python | gpl-2.0 | 616 |
import os
import sys
import shutil
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import init_ops
from tensorflow.contrib.layers.python.layers import regularizers
module_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")
if module_path not in sys.path:
sys.path.append(mod... | kabrapratik28/DeepVideos | model/model_GAN_8.py | Python | apache-2.0 | 38,127 |
class AliasOptions:
def __init__(self, ow_coeff=False, ow_recon=False,
ow_pos=False, ow_intpos=False, ow_hist=False,
ow_dist=False):
self.ow_coeff = ow_coeff
self.ow_recon = ow_recon
self.ow_pos = ow_pos
self.ow_intpos = ow_intpos
self.ow_h... | franklongford/alias | alias/src/alias_options.py | Python | bsd-2-clause | 414 |
#!/usr/bin/python
import os
import re
from setuptools import find_packages, setup
from anchore_engine import version
package_name = "anchore_engine"
with open("requirements.txt") as f:
requirements = f.read().splitlines()
setup(
name="anchore_engine",
author="Anchore Inc.",
author_email="dev@anchor... | anchore/anchore-engine | setup.py | Python | apache-2.0 | 802 |
# -*- coding: utf-8 -*-
import scrapy
class DodfSpider(scrapy.Spider):
name = "dodf"
allowed_domains = ["dodf.df.gov.br"]
start_urls = (
'http://www.dodf.df.gov.br/',
)
def parse(self, response):
pass
| chrmorais/scrapygdf | scrapygdf/spiders/dodf.py | Python | gpl-3.0 | 240 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | taimur97/Feeder | server/appengine/endpoints/api_backend_service.py | Python | gpl-2.0 | 5,564 |
import json
def default_template(title='', js=None, props={}):
from controllers import base
scripts_string = ''
if js is not None:
scripts_string += "<script src='/js/vendor/requirejs/require.js'></script>"
scripts_string += "<script src='/js/require_config.js'></script>"
scripts_st... | zhanrnl/ag | webapp/templates.py | Python | mit | 2,362 |
""""
Library for the Maxim MAX30100 pulse oximetry system on Raspberry Pi
Based on original C library for Arduino by Connor Huffine/Kontakt
https: // github.com / kontakt / MAX30100
September 2017
"""
import smbus
INT_STATUS = 0x00 # Which interrupts are tripped
INT_ENABLE = 0x01 # Which interrupts ar... | feroda/play-nao | LifeIsNAO-bot/hrmon/max30100.py | Python | agpl-3.0 | 6,530 |
from __future__ import unicode_literals
from django.apps import AppConfig
class AccountsConfig(AppConfig):
name = 'Fango.accounts'
| Niemzok/fango | Fango/accounts/apps.py | Python | mit | 138 |
#!/usr/bin/env python2.6
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2012,2013 Contributor
#
# 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... | stdweird/aquilon | tests/broker/test_update_chassis.py | Python | apache-2.0 | 3,613 |
from __future__ import unicode_literals
from prompt_toolkit.utils import take_using_weights
import unittest
import itertools
class SplitLinesTest(unittest.TestCase):
def test_using_weights(self):
def take(generator, count):
return list(itertools.islice(generator, 0, count))
# Check ... | niklasf/python-prompt-toolkit | tests/utils_tests/__init__.py | Python | bsd-3-clause | 1,508 |
#pylint: disable=no-init,invalid-name
from __future__ import (absolute_import, division, print_function)
import time
import datetime
import numbers
import bisect
import numpy
from mantid.api import * # PythonAlgorithm, AlgorithmFactory, WorkspaceProperty
from mantid.kernel import * # StringArrayProperty
from mantid.sim... | wdzhou/mantid | Framework/PythonInterface/plugins/algorithms/LoadLogPropertyTable.py | Python | gpl-3.0 | 7,841 |
##############################################################################
#
# Copyright (c) 2008-2012 SIA "Micronaet s.r.l." (http://www.micronaet.it)
# All Rights Reserved.
# General contacts <riolini@micronaet.it>
#
# WARNING: This program as such is intended to be used by profession... | cherrygirl/micronaet7 | dentist/report/dental_schema.py | Python | agpl-3.0 | 5,074 |
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
hold1 = hold2 = -sys.maxint -1
release1 = release2 = 0
for p in prices:
release2 = max(release2,hold2+p)
hold2 = max(hold2, release1-p)
... | saai/LeetcodePythonSolutions | array/maxProfit3.py | Python | mit | 429 |
from abc import abstractmethod
from django.conf import settings
from django.contrib.admin import ModelAdmin
from django.contrib.admin.helpers import InlineAdminFormSet
from django.contrib.contenttypes.admin import GenericInlineModelAdmin
from django.core.exceptions import ImproperlyConfigured
from django.db.models imp... | django-fluent/django-fluent-contents | fluent_contents/admin/placeholdereditor.py | Python | apache-2.0 | 15,521 |
import sys
import numpy as np
from PyQt4 import QtCore, QtGui
from pyhrf.ndarray import xndarray
from cuboid_browser_ui import Ui_xndarrayBrowser
from axis_slicer import AxisSlicer
from ui_base import DomainValue
#pyuic4 cuboid_browser.ui -o cuboid_browser_ui.py
class LimitedFifo(list):
""" Implement a First-I... | philouc/pyhrf | python/pyhrf/viewer/cuboid_browser.py | Python | gpl-3.0 | 7,136 |
# Copyright (C) 2011-2012 Alexander Shorin
# 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, th... | steptools/StepNCViewer | scripts/tyson.py | Python | apache-2.0 | 25,604 |
data_file = "./csv/data.csv" | rwindegger/nuclai15 | dota2/config.py | Python | gpl-3.0 | 28 |
from setuptools import setup, find_packages
with open('README.md', 'r') as f:
long_description = f.read()
setup(
name = 'github-pr-form',
version = '0.1.1',
author = 'Aaron N Browne',
author_email = 'aaron0browne@gmail.com',
url = 'https://github.com/aaron0browne/github-pr-form',
descripti... | aaron0browne/github-pr-form | setup.py | Python | mit | 1,355 |
from django.test import TestCase
from django.core.urlresolvers import reverse
from wagtail.tests.utils import WagtailTestUtils
class TestStyleGuide(TestCase, WagtailTestUtils):
def setUp(self):
self.login()
def test_styleguide(self):
response = self.client.get(reverse('wagtailstyleguide'))
... | tangentlabs/wagtail | wagtail/contrib/wagtailstyleguide/tests.py | Python | bsd-3-clause | 445 |
"""Running world simulations of Super Mario Bros
"""
__author__ = "Liyan Chen"
__copyright__ = "Copyright (c) 2017 Malmactor"
__license__ = "MIT"
import copy
import itertools as it
from momentum_handler import *
from simulatables import *
def layout_tobb(layout, config=None):
maxx, maxy = layout.shape
id2... | Malmactor/malrio | src/SuperMarioBros/simulation.py | Python | mit | 5,352 |
VERSION = (0, 9, 2)
__author__ = 'Rogério Sampaio de Almeida'
__email__ = 'rsalmei@gmail.com'
__version__ = '.'.join(map(str, VERSION))
__all__ = ('__author__', '__version__', '__email__')
| rsalmei/clearly | clearly/__init__.py | Python | mit | 192 |
# -*- coding: utf-8 -*-
import re
import subprocess
def picamera_status():
"""Returns support and detection status for the Raspberry Pi Camera.
:return: (supported, detected)
:rtype: (bool, bool)
"""
supported, detected = False, False
vcgencmd_regex = r'supported=(0|1) detected=(0|1)'
t... | swoopi/swoopi | swoopi/utils.py | Python | apache-2.0 | 651 |
"""
developeraccount
FILE: __init__.py
Created: 7/5/15 12:42 PM
"""
__author__ = 'Mark Scrimshire:@ekivemark'
from accounts.views.other import *
from accounts.views.user import *
from accounts.views.sms import * | ekivemark/devaccount3 | accounts/views/__init__.py | Python | gpl-2.0 | 214 |
import csv
import datetime
from csvkit.cleanup import RowChecker
from dateutil.parser import parse
import sqlalchemy as sa
from collections import OrderedDict
TRUE_VALUES = ('yes', 'y', 'true', 't')
FALSE_VALUES = ('no', 'n', 'false', 'f')
DEFAULT_DATETIME = datetime.datetime(9999, 12, 31, 0, 0, 0)
NULL_DATE = dateti... | datamade/dedupe-geocoder | typeinferer.py | Python | mit | 4,788 |
"""
This is the default template for our main set of AWS servers.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=wildcard-import, unused-wildcard-import
# Pylint gets confused by path.py instances, which report themselves... | IONISx/edx-platform | cms/envs/aws.py | Python | agpl-3.0 | 16,544 |
'''
.. Created on Mar 20, 2014
.. codeauthor:: Robert Langlois <rl2528@columbia.edu>
'''
_compiler_options=None
def ccompiler_options():
'''
'''
#from numpy.distutils.ccompiler import new_compiler
#from numpy.distutils.fcompiler.pg import PGroupFCompiler
#from numpy.distutils.fcompiler.gnu im... | ezralanglois/arachnid | arachnid/distutils/compiler.py | Python | gpl-2.0 | 5,254 |
import time
import RPi.GPIO as GPIO
import pickle
from PyQt5 import QtCore, QtGui, QtWidgets, uic
import sys
#loads the UI
qtCreatorFile = "../UI/AutomatedBreweryUI/FlowCalibrationDialog.ui"
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
class flowCalibration(QtWidgets.QMainWindow, Ui_MainWindow):
def... | Bobstin/AutomatedBrewery | calibrations/FlowCalibration.py | Python | mit | 4,847 |
import numpy as np
from numpy import sin, cos
from params import *
def get_c1(q, q_d, psi=0):
x,y,a,b,g = q
x_d,y_d,a_d,b_d,_ = q_d
return np.array([
m1 + m2,
0,
- L1*m1*sin(g + a + b),
- L1*m1*sin(g + a + b) \
- L2*m1*sin(g + b) \
- L2*eps*m2*sin(g + b) \
- L3*m1*sin(b) - L3*m2*sin(b)
])
def... | tsybulkin/jumper | x_f.py | Python | bsd-2-clause | 611 |
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 - 2017 Björn Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of python-quilt for details.
import os.path
import stat
from quilt.backup import Backup
from quil... | bjoernricks/python-quilt | quilt/add.py | Python | mit | 3,508 |
# MCM矩阵连乘问题
INF = 0x3f3f3f3f
def mcm(arr):
n = len(arr)
dp = [[0]*n]*n
for i in range(1, n): # cost is zero when multiplying one matrix.
dp[i][i] = 0
for l in range(2, n):
for i in range(1, n-l+1):
j = i+l-1
dp[i][j] = INF
for k in range(i, j):
... | hnu2013wwj/XNCodes | DynamicProgramming/MCM.py | Python | gpl-2.0 | 554 |
# -*- coding: utf-8 -*-
import os
from datetime import datetime, timedelta
from com.ericsson.xn.commons import CommonStatic
from com.ericsson.xn.commons.PyProperties import TrimableProps
from com.ericsson.xn.commons.osutils import get_ne_info_from_cfg, get_pm_counters_map, get_me_types_map
from com.ericsson.xn.x.ne imp... | lowitty/selenium | com/ericsson/xn/x/pm/PmCommons/PmBaseFunc.py | Python | mit | 5,491 |
#!/usr/bin/env python
#
# Copyright 2011 Facebook
#
# 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... | saltstack/salt | salt/ext/tornado/tcpserver.py | Python | apache-2.0 | 12,601 |
#!/usr/bin/python
from __future__ import print_function
import argparse
import boto.ec2
import dateutil
import datetime
import json
from pricing.instance_pricing import InstancePricing
from pricing.spot_pricing import SpotPricing
# region.name, name, instance_type, price, archdomain, env_tag, ip_address, private_ip... | leighklotz/traffic-map | list/list-ec2-hosts-table.py | Python | gpl-2.0 | 3,093 |
#A basic way of caching files associated with URLs
from datetime import datetime
import os
import urllib2
import tempfile
import json
import socket
import utilities
import shutil
class URLCache(object):
TIME_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
def __init__(self, folder):
self._folder = os.path.join(folder... | aplicatii-romanesti/allinclusive-kodi-pi | .kodi/addons/weather.metoffice/src/metoffice/urlcache.py | Python | apache-2.0 | 2,858 |
from typing import List
class Solution:
def largestIsland(self, grid: List[List[int]]) -> int:
islands = set()
searched = set()
width = len(grid)
height = len(grid[0])
area = 0
for x in range(0, width):
for y in range(0, height):
if (x, y... | Tsiannian/tsiannian.github.io | test.py | Python | mit | 2,264 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.postgres.fields import ArrayField, JSONField
from django.utils.functional import cached_property
from wagtail.wagtailcore.models import Page
from geokit_tables.models import GeoKitTable
from layers.model... | Applied-GeoSolutions/geokit | variables/models.py | Python | gpl-2.0 | 5,389 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCU... | jimi-c/ansible | lib/ansible/modules/cloud/ovirt/ovirt_nics.py | Python | gpl-3.0 | 9,114 |
# Generated by Django 2.2.13 on 2021-07-07 11:51
import logging
from django.conf import settings
from django.db import migrations
LIMIT_START_YEAR = 2021
logger = logging.getLogger(settings.DEFAULT_LOGGER)
def set_stage_dimona_to_true_for_internship_type(apps, schema_editor):
LearningUnitYear = apps.get_model('... | uclouvain/OSIS-Louvain | base/migrations/0590_set_stage_dimona_for_stage_type.py | Python | agpl-3.0 | 928 |
# Copyright 2014 NEC Corporation. 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 ... | Mirantis/tempest | tempest/api/compute/admin/test_quotas_negative.py | Python | apache-2.0 | 7,143 |
#!/bin/python
# This file is part of INDXParse.
#
# Copyright 2011-13 Will Ballenthin <william.ballenthin@mandiant.com>
# while at Mandiant <http://www.mandiant.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... | ohio813/python-ntfs | ntfs/secure/SDS.py | Python | apache-2.0 | 14,625 |
# Copyright (C) 2012-2015 Red Hat, Inc.
#
# 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; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITH... | borisroman/vdsm | lib/vdsm/tool/register.py | Python | gpl-2.0 | 17,682 |
"""
Class for reading the configuration file
Uses the ConfigParser lib to return the values present in the config file
"""
__authors__ = "Claudio Marques, David Palma, Luis Cordeiro"
__copyright__ = "Copyright (c) 2014 OneSource Consultoria Informatica, Lda"
__license__ = "Apache 2"
__contact__ = "www.onesource.pt"
_... | OneSourceConsult/ZabbixCeilometer-Proxy | readFile.py | Python | apache-2.0 | 812 |
"""Test icatdump and icatingest.
"""
from subprocess import CalledProcessError
import pytest
import icat
import icat.config
from icat.query import Query
from conftest import DummyDatafile, gettestdata, getConfig, callscript
# Test input
ds_params = str(gettestdata("ingest-ds-params.xml"))
datafiles = str(gettestdata... | icatproject/python-icat | tests/test_06_ingest.py | Python | apache-2.0 | 11,631 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor
#
# 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... | stdweird/aquilon | lib/python2.6/aquilon/worker/commands/show_hostlink_hostlink.py | Python | apache-2.0 | 951 |
import time
import uuid
import six
from tooz import coordination
ALIVE_TIME = 1
coordinator = coordination.get_coordinator('zake://', b'host-1')
coordinator.start()
# Create a group
group = six.binary_type(six.text_type(uuid.uuid4()).encode('ascii'))
request = coordinator.create_group(group)
request.get()
# Join a... | citrix-openstack-build/tooz | examples/leader_election.py | Python | apache-2.0 | 770 |
#!/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'],
... | thaim/ansible | lib/ansible/modules/cloud/amazon/ec2_snapshot_info.py | Python | mit | 8,441 |
#!/usr/bin/env python
#
# kdump.py - Copyright (C) 2010 Red Hat, Inc.
# Written by Joey Boggs <jboggs@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; version 2 of the License.
#
# ... | haiyangd/python-porject | src/ovirtnode/kdump.py | Python | gpl-2.0 | 1,990 |
"""Package to test the get_accessory method."""
from unittest.mock import patch, Mock
import pytest
from homeassistant.core import State
import homeassistant.components.cover as cover
import homeassistant.components.climate as climate
import homeassistant.components.media_player as media_player
from homeassistant.com... | persandstrom/home-assistant | tests/components/homekit/test_get_accessories.py | Python | apache-2.0 | 6,341 |
# -*- coding: utf-8 -*-
"""Installer for the vfu.sitecontent package."""
from setuptools import find_packages
from setuptools import setup
import os
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
long_description = read('README.rst')
setup(
name='vfu.sitecontent',
... | a25kk/vfu | src/vfu.sitecontent/setup.py | Python | mit | 1,772 |
# -*- coding: utf-8 -*-
"""The widget of 'Structure' tab."""
from __future__ import annotations
__author__ = "Yuan Chang"
__copyright__ = "Copyright (C) 2016-2019"
__license__ = "AGPL"
__email__ = "pyslvs@gmail.com"
from typing import TYPE_CHECKING, List, Tuple, Sequence, Dict, Iterable
from qtpy.QtCore import (
... | KmolYuan/Pyslvs-PyQt5 | pyslvs_ui/synthesis/collections/structure_widget.py | Python | agpl-3.0 | 16,405 |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from avatar.models import Avatar
from avatar.templatetags.avatar_tags import avatar
class AvatarAdmin(admin.ModelAdmin):
list_display = ('get_avatar', 'user', 'primary', "date_uploaded")
list_filter = ('primary',)
se... | ofri/django-avatar | avatar/admin.py | Python | bsd-3-clause | 580 |
extensions = []
master_doc = 'index'
project = u'Org\Heigl\Hyphenator'
copyright = u'2011-2012, Andreas Heigl <andreas@heigl.org>'
exclude_patterns = ['_build']
highlight_language = 'php'
html_theme = 'nature'
| fxbenard/typofr | vendor/Org_Heigl/hyphenator/docs/conf.py | Python | mit | 210 |
from django.test import SimpleTestCase, RequestFactory, override_settings
from rest_framework.reverse import reverse
from program_management.api.serializers.prerequisite import ProgramTreePrerequisitesSerializer, \
NodeBaseSerializer
from program_management.ddd.domain.program_tree import ProgramTree
from program_m... | uclouvain/OSIS-Louvain | program_management/tests/api/serializers/test_prerequisite.py | Python | agpl-3.0 | 7,192 |
"""This module provides plugins used in the hairball paper."""
from collections import defaultdict, Counter
from hairball.plugins import HairballPlugin
class Animation(HairballPlugin):
"""Plugin that checks for instances of 'complex animation'.
Animation should include loops, motion, timing, and costume ch... | thsunmy/hairball | hairball/plugins/checks.py | Python | bsd-2-clause | 10,450 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import gym
import numpy as np
import tensorflow as tf
from agents.cem import CEM
from networks.linear import LinearModel
from networks.softmax_linear import SoftmaxLinearModel
# Gym params
EXPERIMENT_DIR = '.... | evancasey/tensorflow-policy-gradient | run_cem.py | Python | mit | 1,337 |
#!/usr/bin/env python
# encoding: utf-8
'''
IMPORTANTE: instalados python3 (>=3.4.0) y python2 (>=2.7)
MainAnaly -- shortdesc
MainAnaly is a description
It defines classes_and_methods
@author: Carlos Gonzalez Sesmero
@copyright: 2017
@license:
@contact: gcarlosonza@gmail.com
@deffield updated: Updated
... | carlos-gs/MiStuRe | misture_core/MainAnaly.py | Python | gpl-3.0 | 5,447 |
# Copyright (c) 2015 OpenStack Foundation.
# 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... | noironetworks/neutron | neutron/cmd/ipset_cleanup.py | Python | apache-2.0 | 3,298 |
import time
from watchdog.events import LoggingEventHandler
from watchdog.observers import Observer
from config import *
from FSEventHandler import FSEventHandler
if __name__ == "__main__":
observer = Observer()
observer.schedule(FSEventHandler(api_base_uri=API_BASE_URI,
api_secret=API_SECRET, path_p... | dash1291/teleport-client | teleport.py | Python | mit | 523 |
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Install/copy the image to the device."""
import cStringIO
import logging
import os
import shutil
import tempfile
import time
import urlparse
from... | chadversary/chromiumos.chromite | cros/commands/cros_flash.py | Python | bsd-3-clause | 38,621 |
# (c) 2019 Red Hat Inc.
#
# 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.
#
# Ansible is dis... | roadmapper/ansible | test/units/modules/network/cloudengine/test_ce_is_is_instance.py | Python | gpl-3.0 | 2,883 |
from main import app
from flask import render_template, request
from config import FREEZER_BASE_URL
@app.route('/')
def index():
page_title = "Timeline: A Year Of 'Systemic Failure' At DCF"
page_url = FREEZER_BASE_URL.rstrip('/') + request.path
social = {
'title': "Timeline: A Year Of 'Systemic F... | vprnet/timeline-dcf-systemic-failure | main/views.py | Python | apache-2.0 | 1,100 |
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
__version__ = "3.0.0"
__bibtex__ = """
@article{emcee,
author = {{Foreman-Mackey}, D. and {Hogg}, D.~W. and {Lang}, D. and {Goodman}, J.},
title = {emcee: The MCMC Hammer},
journal = {PASP},
year = 2013,
volume = 125,
... | farr/emcee | emcee/__init__.py | Python | mit | 731 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011, 2012 Pablo Barenbaum <foones@gmail.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 version 3 of the License, or
# (at your option) a... | gobstones/PyGobstones-Lang | pygobstoneslang/lang/gbs_parser.py | Python | gpl-3.0 | 12,958 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.