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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/Perforce/P4COMSTR.py | Python | mit | 4,112 | 0.002432 |
from ..msg import die
from ..ast import *
def unexpected(item):
die("unexpected construct '%s'" % item.get('type','unknown'), item)
def parse_varuse(varuse, item):
#print "parse varuse %x: item %x: %r" % (id(varuse), id(item), item)
varuse.loc = item['loc']
varuse.name = item['name'].strip()
... | knz/slcore | slc/tools/slc/input/parse.py | Python | gpl-3.0 | 6,199 | 0.042104 |
"""The WaveBlocks Project
IOM plugin providing functions for handling various
overlap matrices of linear combinations of general
wavepackets.
@author: R. Bourquin
@copyright: Copyright (C) 2013 R. Bourquin
@license: Modified BSD License
"""
import numpy as np
def add_overlaplcwp(self, parameters, timeslots=None, m... | WaveBlocks/WaveBlocksND | WaveBlocksND/IOM_plugin_overlaplcwp.py | Python | bsd-3-clause | 10,811 | 0.003515 |
#!/usr/bin/env python
# Copyright (C) 2014 Aldebaran Robotics
#
# 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 applic... | ArthurVal/RIDDLE_naoqi_bridge | naoqi_sensors_py/src/naoqi_sensors/naoqi_microphone.py | Python | bsd-3-clause | 4,844 | 0.007019 |
#!/usr/bin/env python
"""
voice_nav.py allows controlling a mobile base using simple speech commands.
Based on the voice_cmd_vel.py script by Michael Ferguson in the pocketsphinx ROS package.
"""
import roslib; #roslib.load_manifest('pi_speech_tutorial')
import rospy
from geometry_msgs.msg import Twist
from std_... | jdekerautem/TurtleBot-Receptionist | pocketsphinx_files/notsotalkative.py | Python | mit | 6,969 | 0.033434 |
from PerfectMatchingData import *
from Face import *
from Vertex import *
from Graph import *
from VertexList import *
from Output import *
from KekuleanMethods import *
from Checkers import *
from RequiredEdgeMethods import *
from Tkinter import *
from AppInformation import *
from random import randint
import time
i... | Jc11235/Kekulean_Program | GUI_Version/Ubuntu_Version/DriverMethods.py | Python | gpl-2.0 | 39,406 | 0.044054 |
import logging
import gym
import numpy as np
from chaos_theory.algorithm import DDPG
from chaos_theory.run.run_algorithm import run_online_algorithm
logging.basicConfig(level=logging.DEBUG)
logging.getLogger().setLevel(logging.DEBUG)
np.random.seed(1)
if __name__ == "__main__":
env_name = 'HalfCheetah-v1'
e... | justinjfu/chaos_theory | scripts/run_ddpg.py | Python | gpl-3.0 | 526 | 0.001901 |
"""nubrain URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | NuChwezi/nubrain | nubrain/urls.py | Python | mit | 1,184 | 0.000845 |
from unittest.case import TestCase
from dateutil.parser import parse
from responsebot.models import User, Tweet
class UserModelTestCase(TestCase):
def test_create_from_raw_data(self):
created_at = 'Mon Apr 25 08:25:58 +0000 2016'
raw = {
'some_key': 'some value',
'created... | invinst/ResponseBot | tests/unit_tests/models/test_user_model.py | Python | apache-2.0 | 824 | 0 |
def triangle_sum(tri, r, c, h, memo):
if (r, c, h) in memo:
return memo[(r, c, h)]
ans = tri[r][c]
if h > 0:
ans += triangle_sum(tri, r + 1, c, h - 1, memo)
ans += triangle_sum(tri, r + 1, c + 1, h - 1, memo)
if h > 1:
ans -= triangle_sum(tri, r + 2, c + 1, h - 2, memo)... | simonolander/euler | euler-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.py | Python | mit | 1,906 | 0.001574 |
#########
# Copyright (c) 2019 Cloudify Platform Ltd. 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... | cloudify-cosmo/cloudify-manager | rest-service/manager_rest/test/security_utils.py | Python | apache-2.0 | 3,245 | 0 |
#!/usr/bin/env python
# encoding: utf-8
"""
Staircase.py
Created by Tomas HJ Knapen on 2009-11-26.
Copyright (c) 2009 TK. All rights reserved.
"""
import os, sys, datetime
import subprocess, logging
import pickle, datetime, time
import scipy as sp
import numpy as np
# import matplotlib.pylab as pl
from math import ... | VU-Cog-Sci/PRF_experiment | exp_tools/Staircase.py | Python | mit | 6,218 | 0.040849 |
from .exceptions import *
from .raster import BrotherQLRaster
from .brother_ql_create import create_label
| pklaus/brother_ql | brother_ql/__init__.py | Python | gpl-3.0 | 110 | 0.009091 |
from ..writer.crawler import CrawlerWriter
from ..writer.run import RunConfigWriter
from ..writer.sentry import SentryConfigWriter
from ..writer.route import RouteConfigWriter
from ..writer.monitor import MonitorConfigWriter
class WriterFactory:
CRAWLER = 0
RUN_CONFIG = 1
SENTRY_CONFIG = 2
ROUTE... | franziz/arcrawler | lib/factory/writer.py | Python | gpl-3.0 | 940 | 0.03617 |
import pygame
import random
import item
import mob
import tile
class Mapgen(object):
def __init__(self, level):
self.xsiz = 10
self.ysiz = 10
self.biome = "random"
self.procedure = 0
self.zone = []
self.level = level
self.sizefactor = 2
#self.items = ... | Lincoln-Cybernetics/Explore- | mapgen.py | Python | unlicense | 7,161 | 0.012847 |
# encoding=utf-8
# pykarta/geometry/from_text.py
# Copyright 2013--2020, Trinity College
# Last modified: 9 February 2020
import re
from . import Point
# Create a Point() from a text string describing a latitude and longitude
#
# Example from Wikipedia article Whitehouse: 38° 53′ 51.61″ N, 77° 2′ 11.58″ W
# \u2032 --... | david672orford/pykarta | pykarta/geometry/from_text.py | Python | gpl-2.0 | 2,761 | 0.030215 |
# -*- coding: utf-8 -*-
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [('announcements', '0008_auto_20150603_1401')]
operations = [migrations.AddField(model_name='announcement',
name='expiration_date',
... | jacobajit/ion | intranet/apps/announcements/migrations/0009_announcement_expiration_date.py | Python | gpl-2.0 | 432 | 0.002315 |
# Copyright (C) 2014 Linaro Limited
#
# Author: Neil Williams <neil.williams@linaro.org>
#
# This file is part of LAVA Dispatcher.
#
# LAVA Dispatcher 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... | Linaro/lava-dispatcher | lava_dispatcher/job.py | Python | gpl-2.0 | 10,777 | 0.001299 |
# 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... | av8ramit/tensorflow | tensorflow/python/ops/linalg/linear_operator_full_matrix.py | Python | apache-2.0 | 6,505 | 0.001845 |
# Copyright 2017 Starbot Discord Project
#
# 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... | dhinakg/BitSTAR | plugins/srcutils.py | Python | apache-2.0 | 1,479 | 0.008114 |
# ===============================================================================
# Copyright 2018 ross
#
# 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/LICE... | UManPychron/pychron | pychron/pipeline/nodes/audit.py | Python | apache-2.0 | 1,164 | 0 |
import vtk
from vtk.util.misc import vtkGetDataRoot
import render_mpr
reader = vtk.vtkMetaImageReader()
reader.SetFileName("C:\\Users\\fei.wang\\PycharmProjects\\Rendering\\data\\org.mha")
reader.Update()
render_mpr = render_mpr.RendererMPR()
render_mpr.set_volume(reader)
render_mpr.set_output_image_siz... | comedate/VolumeRendering | test_mpr.py | Python | mit | 580 | 0.003448 |
from pprint import pprint
VAR = 42
def foo():
import sys
import ast, tokenize
pass
class C:
from textwrap import dedent
pass
import codecs as C
pass
| asedunov/intellij-community | python/testData/formatter/noBlankLinesAfterLocalImports_after.py | Python | apache-2.0 | 182 | 0.005495 |
import string
__version__ = string.split('$Revision: 1.6 $')[1]
__date__ = string.join(string.split('$Date: 2001/11/17 14:12:34 $')[1:3], ' ')
__author__ = 'Tarn Weisner Burton <twburton@users.sourceforge.net>'
__doc__ = 'http://oss.sgi.com/projects/ogl-sample/registry/SUN/convolution_border_modes.txt'
__api_versi... | fxia22/ASM_xf | PythonD/site_python/OpenGL/GL/SUN/convolution_border_modes.py | Python | gpl-2.0 | 585 | 0.011966 |
from dal import autocomplete
from django.conf.urls import url
from django.views import generic
from .forms import TestForm
from .models import TestModel
urlpatterns = [
url(
'test-autocomplete/$',
autocomplete.Select2QuerySetView.as_view(
model=TestModel,
create_field='na... | luzfcb/django-autocomplete-light | test_project/select2_one_to_one/urls.py | Python | mit | 547 | 0.001828 |
from urllib.request import urlopen
from urllib.parse import urlparse, parse_qs
from socket import error as SocketError
import errno
from bs4 import BeautifulSoup
MAX_PAGES_TO_SEARCH = 3
def parse_news(item):
'''Parse news item
return is a tuple(id, title, url)
'''
url = 'http://www.spa.gov.sa' + item[... | saudisproject/saudi-bots | bots/spa.py | Python | gpl-3.0 | 4,254 | 0.002367 |
nothing = '90052'
while True:
f = open('channel/' + nothing + '.txt', 'r')
line = f.readline()
splits = line.split('Next nothing is ', 1)
if(len(splits) == 2):
nothing = splits[1]
print nothing
else:
break
| cjwfuller/python-challenge | level6.py | Python | mit | 250 | 0 |
"""
In the Core module you can find all basic classes and functions which form the backbone of the toolbox.
"""
import warnings
import numbers
import numpy as np
import numpy.ma as ma
import collections
from copy import copy, deepcopy
from numbers import Number
from scipy import integrate
from scipy.linalg import blo... | cklb/pyinduct | pyinduct/core.py | Python | gpl-3.0 | 100,888 | 0.000545 |
#!/usr/bin/env python
#
# Copyright 2020 Confluent 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... | confluentinc/examples | clients/cloud/python/ccloud_lib.py | Python | apache-2.0 | 5,500 | 0.001273 |
from phapi import ProductHuntApi
import settings
import json
pha = ProductHuntApi(settings.DEVELOPER_TOKEN)
posts = pha.get_posts()
print json.dumps(posts, indent=2) | dangoldin/pyproducthunt | analyze.py | Python | mit | 168 | 0.005952 |
import subprocess
from distutils import spawn
brctlexe = spawn.find_executable("brctl")
ipexe = spawn.find_executable("ip")
class BridgeException(Exception):
pass
class Bridge(object):
def __init__(self, name):
""" Initialize a bridge object. """
self.name = name
def __str__(self):
... | udragon/pybrctl | pybrctl/pybrctl.py | Python | gpl-2.0 | 5,254 | 0.007423 |
'''Test for ratio of Poisson intensities in two independent samples
Author: Josef Perktold
License: BSD-3
'''
import numpy as np
import warnings
from scipy import stats
from statsmodels.stats.base import HolderTuple
from statsmodels.stats.weightstats import _zstat_generic2
def test_poisson_2indep(count1, exposu... | statsmodels/statsmodels | statsmodels/stats/rates.py | Python | bsd-3-clause | 12,513 | 0 |
import os
from flask import Flask, render_template_string, request
from flask_mail import Mail
from flask_sqlalchemy import SQLAlchemy
from flask_user import login_required, SQLAlchemyAdapter, UserManager, UserMixin
from flask_user import roles_required
# Use a Class-based config to avoid needing a 2nd file
# os.gete... | jamescarignan/Flask-User | example_apps/user_auth_app.py | Python | bsd-2-clause | 6,986 | 0.006298 |
class SkipList:
def __init__(self):
self.head = None
| robin1885/algorithms-exercises-using-python | source-code-from-author-book/Listings-for-Second-Edition/listing_8_14.py | Python | mit | 65 | 0 |
# replace all key events in
# js files and htmls
# to our standard key input event
# more details see in DOC dir
# Key 事件进行全局替换, 统一处理。 | lifeinoppo/littlefishlet-scode | SRC/Server/Components/input/python/keyInput.py | Python | gpl-2.0 | 175 | 0.034014 |
from contextlib import contextmanager
import sys
from . import controller
from .utils import (CursorPosition, TextQuery)
if sys.platform.startswith("win"):
from . import ia2
os_controller_class = ia2.Controller
else:
# TODO Support Linux.
pass
controller_instance = None
def get_accessibility_contro... | tylercal/dragonfly | dragonfly/accessibility/__init__.py | Python | lgpl-3.0 | 949 | 0.004215 |
#!/usr/bin/env python
# http://stackoverflow.com/questions/517923/what-is-the-best-way-to-remove-accents-in-a-python-unicode-string
import re
import unicodedata
def strip_accents(text):
"""
Strip accents from input String.
:param text: The input string.
:type text: String.
:returns: The proces... | oh6hay/refworks-bibtex-postprocess | textutil.py | Python | mit | 943 | 0.004242 |
# Copyright (c) 2011 Openstack, LLC.
# 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... | salv-orlando/MyRepo | nova/scheduler/filters/json_filter.py | Python | apache-2.0 | 5,243 | 0.000572 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <nipreps@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... | oesteban/niworkflows | niworkflows/utils/tests/test_misc.py | Python | bsd-3-clause | 2,459 | 0.001627 |
# (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... | wfxiang08/ansible | lib/ansible/plugins/callback/__init__.py | Python | gpl-3.0 | 6,672 | 0.002998 |
# Copyright 2020 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... | tensorflow/tensorflow | tensorflow/core/platform/ram_file_system_test.py | Python | apache-2.0 | 5,699 | 0.006492 |
from boto.exception import S3ResponseError, BotoServerError
from boto.s3.connection import S3Connection
from boto.ec2.autoscale import AutoScaleConnection
from boto.beanstalk import connect_to_region
from boto.s3.key import Key
from datetime import datetime
from time import time, sleep
import zipfile
import os
import ... | cookbrite/ebs-deploy | ebs_deploy/__init__.py | Python | mit | 26,434 | 0.002951 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Eduard Trott
# @Date: 2015-09-15 08:57:35
# @Email: etrott@redhat.com
# @Last modified by: etrott
# @Last Modified time: 2015-12-17 16:53:17
version_info = ('0', '0', '1')
__version__ = '.'.join(version_info[0:3]) # + '-' + version_info[3]
| maybelinot/bellring | bellring/_version.py | Python | gpl-3.0 | 305 | 0 |
from a10sdk.common.A10BaseClass import A10BaseClass
class PortReservation(A10BaseClass):
"""Class Description::
DS-Lite Static Port Reservation.
Class port-reservation supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:par... | amwelch/a10sdk-python | a10sdk/core/cgnv6/cgnv6_ds_lite_port_reservation.py | Python | apache-2.0 | 2,890 | 0.010035 |
#
# 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... | dhuang/incubator-airflow | airflow/providers/tableau/example_dags/example_tableau_refresh_workbook.py | Python | apache-2.0 | 2,507 | 0.002792 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | gochist/horizon | openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py | Python | apache-2.0 | 3,012 | 0.000332 |
import os
import gc
import platform
import sys
import time
import tempfile
import warnings
from optparse import OptionParser
import gpaw.mpi as mpi
from gpaw.hooks import hooks
from gpaw import debug
from gpaw.version import version
def run():
description = ('Run the GPAW test suite. The test suite can be run i... | robwarm/gpaw-symm | gpaw/test/test.py | Python | gpl-3.0 | 5,364 | 0.001119 |
"""
Copyright 2011 Marcus Fedarko
Contact Email: marcus.fedarko@gmail.com
This file is part of CAIP.
CAIP 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) ... | fedarko/CAIP | Code/LevelReader.py | Python | gpl-3.0 | 1,886 | 0.003181 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# qrgen1.py
#
# Copyright 2013 psutton <zleap@zleap.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the Licens... | zleap/python-qrcode | qrreadfromfile.py | Python | gpl-3.0 | 1,039 | 0.008662 |
import xml.etree.ElementTree as ET
import datetime
import sys
import openpyxl
import re
import dateutil
def main():
print 'Number of arguments:', len(sys.argv), 'arguments.' #DEBUG
print 'Argument List:', str(sys.argv) #DEBUG
Payrate = raw_input("Enter your pay rate: ") #DEBUG
sNumber = raw_input("Enter 900#: ... | JamesPavek/payroll | timesheet.py | Python | mit | 2,615 | 0.047419 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'TtTrip.shape'
db.add_column(u'timetable_tttrip', 'shape',... | hasadna/OpenTrain | webserver/opentrain/timetable/migrations/0013_auto__add_field_tttrip_shape.py | Python | bsd-3-clause | 2,893 | 0.005876 |
# 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... | HKUST-SING/tensorflow | tensorflow/python/debug/wrappers/local_cli_wrapper.py | Python | apache-2.0 | 20,594 | 0.004079 |
from __future__ import division
from pySDC.Hooks import hooks
from pySDC.Stats import stats
import matplotlib.pyplot as plt
import numpy as np
class particles_output(hooks):
def __init__(self):
"""
Initialization of particles output
"""
super(particles_output,self).__init__()
... | torbjoernk/pySDC | examples/spiraling_particle/HookClass.py | Python | bsd-2-clause | 1,411 | 0.008505 |
__version__ = "1.0.3" | flashingpumpkin/filerotate | filerotate/__version__.py | Python | mit | 21 | 0.047619 |
# -*- Mode: Python; test-case-name: flumotion.test.test_admin_multi -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Pub... | flyapen/UgFlu | flumotion/test/test_admin_multi.py | Python | gpl-2.0 | 3,725 | 0 |
# -*- coding: UTF-8 -*-
#
# (c) 2010 Mandriva, http://www.mandriva.com/
#
# This file is part of Mandriva Server Setup
#
# MSS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, o... | jfmorcillo/mss | mss/agent/__init__.py | Python | gpl-3.0 | 844 | 0 |
# Copyright (c) 2012 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 telemetry.core import web_contents
DEFAULT_TAB_TIMEOUT = 60
class Tab(web_contents.WebContents):
"""Represents a tab in the browser
The import... | codenote/chromium-test | tools/telemetry/telemetry/core/tab.py | Python | bsd-3-clause | 3,230 | 0.005263 |
# Copyright 2013: Mirantis 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... | afaheem88/rally | tests/unit/deployment/engines/test_devstack.py | Python | apache-2.0 | 4,402 | 0 |
# 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... | Klaminite1337/Paragon | inc/VOCAL/translate.py | Python | mit | 12,795 | 0.005784 |
"""Abstract CarType.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as publis... | LudovicRousseau/pyscard | smartcard/CardType.py | Python | lgpl-2.1 | 3,695 | 0 |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Juniper/ceilometer | ceilometer/network/notifications.py | Python | apache-2.0 | 8,892 | 0 |
scores = [60, 73, 81, 95, 34]
n = 0
total = 0
for x in scores:
n += 1
total += x
avg = total/n
print("for loop print")
print(total)
print(avg)
i = 1
x = 0
while i <= 50:
x += 1
i += 1
print("while loop print")
print(x)
print(i)
| flake123p/ProjectH | Python/_Basics2_/A02_for_while/for_while.py | Python | gpl-3.0 | 238 | 0.016807 |
# A program that has a list of six colors and chooses one by random. The user can then has three chances to quess the right color. After the third attepmt the program outputs "Nope. The color I was thinking of was..."
import random
# this is the function that will execute the program
def program():
# These are the ... | starnes/Python | guessnameclass.py | Python | mit | 1,452 | 0.006887 |
"""
Routines for watching files for changes
"""
from __future__ import print_function
from builtins import zip
import time
import os
def watch(files, timeout=None, poll=2):
"""
Watch a given file or collection of files
until one changes. Uses polling.
Inputs
======
files - Name of one or mo... | erikgrinaker/BOUT-dev | tools/pylib/boututils/watch.py | Python | gpl-3.0 | 2,197 | 0.004096 |
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
class TestQuizResult(unittest.TestCase):
pass
| mhbu50/erpnext | erpnext/education/doctype/quiz_result/test_quiz_result.py | Python | gpl-3.0 | 153 | 0.006536 |
#!/usr/bin/python
from utils import mathfont
import fontforge
nArySumCodePoint = 0x2211 # largeop operator
v = 3 * mathfont.em
f = mathfont.create("limits-lowerlimitbaselinedropmin%d" % v)
mathfont.createSquareGlyph(f, nArySumCodePoint)
f.math.LowerLimitBaselineDropMin = v
f.math.LowerLimitGapMin = 0
f.math.OverbarE... | shinglyu/servo | tests/wpt/web-platform-tests/mathml/tools/limits.py | Python | mpl-2.0 | 2,284 | 0.000438 |
import json
from zipfile import ZipFile
import uuid
import activity
import re
import os
from os.path import isfile, join
from os import listdir, makedirs
from os import path
import datetime
from S3utility.s3_notification_info import S3NotificationInfo
from provider.execution_context import Session
import requests
from... | gnott/elife-bot | activity/activity_VersionDateLookup.py | Python | mit | 3,787 | 0.004489 |
from sympy import Symbol, sin, cos, diff
from pprint import pprint
theta = Symbol('theta')
tdot = Symbol('tdot')
xdot = Symbol('xdot')
u = Symbol('u')
m_p_ = Symbol('m_p_')
m_c_ = Symbol('m_c_')
g_ = Symbol('g_')
l_ = Symbol('l_')
xddot = (u + m_p_ * sin(theta) * (l_ * (tdot * tdot) + g_ * cos(theta))) / (m_c_ + m_p_... | openhumanoids/exotica | exotations/dynamics_solvers/exotica_cartpole_dynamics_solver/scripts/gen_second_order_dynamics.py | Python | bsd-3-clause | 2,089 | 0.004787 |
import xml.etree.ElementTree as ElementTree
import os.path
import sys
#
# is there a xmp sidecar file?
#
def get_xmp_filename(filename):
xmpfilename = False
# some xmp sidecar filenames are based on the original filename without extensions like .jpg or .jpeg
filenamewithoutextension = '.' . join(filena... | opensemanticsearch/open-semantic-etl | src/opensemanticetl/enhance_xmp.py | Python | gpl-3.0 | 4,568 | 0.001751 |
import colorsys
import logging
from pyhap.accessory import Accessory
from pyhap.const import CATEGORY_LIGHTBULB, CATEGORY_FAN
from hackoort.bulb import Bulb
def hls2rgb(h, l, s):
"""Convert h, l, s in 0-1 range to rgb in 0-255
:param h: hue
:param l: luminance
:param s: saturation
:return: red,... | emsi/hackoort | python/oorthap/bulb.py | Python | gpl-3.0 | 4,950 | 0.000606 |
import redis
import copy
import json
def basic_init(self):
self.sep = "["
self.rel_sep = ":"
self.label_sep = "]"
self.namespace = []
class Build_Configuration(object):
def __init__( self, redis_handle):
self.redis_handle = redis_handle
self.delete_all()... | glenn-edgar/local_controller_3 | redis_graph_py3/redis_graph_functions.py | Python | mit | 10,886 | 0.054106 |
from __future__ import print_function
from bose_einstein import bose_einstein
from constant import htr_to_K, htr_to_meV, htr_to_eV
import argparser
import norm_k
import numpy as np
import scf
import system
args = argparser.read_argument('Evaluate step-like feature in electron-phonon coupling')
thres = args.thres / htr... | mmdg-oxford/papers | Schlipf-PRL-2018/model/step.py | Python | gpl-3.0 | 830 | 0.012048 |
# From https://gist.github.com/destan/5540702#file-text2png-py
# coding=utf8
import multiprocessing
import threading
import time
import atexit
import os
import vmprof
def install_vmprof(name="thread"):
cpid = multiprocessing.current_process().name
ctid = threading.current_thread().name
fname = "vmprof-{}-{}-{}-... | fake-name/ReadableWebProxy | Misc/install_vmprof.py | Python | bsd-3-clause | 616 | 0.021104 |
#!/bin/python
from urllib import request
from pymongo import Connection
import argparse
import json
import pymongo
req = request.urlopen('https://blockchain.info/no/api/receive?method=create&address=19J9J4QHDun5YgUTfEU1qb3fSHTbCwcjGj')
encoding = req.headers.get_content_charset()
obj = json.loads(req.read().decode(enco... | roypur/python-bitcoin-accounting | new.py | Python | gpl-3.0 | 797 | 0.015056 |
from marshmallow import Schema, fields, post_load
from marshmallow_enum import EnumField
from enum import IntFlag
from .. import models
from commandment.inventory import models as inventory_models
class ErrorChainItem(Schema):
LocalizedDescription = fields.String()
USEnglishDescription = fields.String()
E... | mosen/commandment | commandment/mdm/response_schema.py | Python | mit | 10,132 | 0.00227 |
# -*- coding: utf-8 -*-
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import common
from openerp.tools import SUPERUSER_ID
class TestPurchaseRequestToRequisition(common.TransactionCase):
def setUp(self):
super(Te... | andrius-preimantas/purchase-workflow | purchase_request_to_requisition/tests/test_purchase_request_to_requisition.py | Python | agpl-3.0 | 3,251 | 0 |
#!/usr/bin python3
# -*- coding:utf-8 -*-
# File Name: fact.py
# Author: Lipsum
# Mail: niuleipeng@gmail.com
# Created Time: 2016-05-11 17:27:38
# def fact(n):
# if n == 1:
# return 1
# return fact(n-1) * n
def fact(n):
return fact_iter(n, 1)
def fact_iter(num, product):
if num == 1:
... | saturnast/python-learning | tempCodeRunnerFile.py | Python | mit | 441 | 0.006803 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob module 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 Licens... | laurentb/weboob | modules/caissedepargne/cenet/browser.py | Python | lgpl-3.0 | 12,250 | 0.002857 |
import networkx as nx
#from networkx.generators.smax import li_smax_graph
def s_metric(G, normalized=True):
"""Return the s-metric of graph.
The s-metric is defined as the sum of the products deg(u)*deg(v)
for every edge (u,v) in G. If norm is provided construct the
s-max graph and compute it's s_met... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/networkx/algorithms/smetric.py | Python | gpl-3.0 | 1,194 | 0.000838 |
import pandas as pd
from rpy2.robjects import pandas2ri
from rpy2.robjects.packages import importr
from rpy2.robjects import Formula
from rpy2 import robjects as ro
from survey_stats.helpr import svyciprop_xlogit, svybyci_xlogit, factor_summary
from survey_stats.helpr import filter_survey_var, rm_nan_survey_var, svyby_... | semanticbits/survey_stats | src/survey_stats/survey.py | Python | bsd-2-clause | 5,498 | 0.002001 |
#!/usr/bin/python
'''
Cronostamper test suit:
Simple trigger simulator. Open a socket and execute
/oneShot when someone get connected and exit.
"oneshot" activate the GPIO 7 just one time.
Nacho Mas Junary-2017
'''
import socket
import commands
import sys
import time
import datetime
from thread import *
HOST = '' ... | nachoplus/cronoStamper | tools/cameraSimulator.py | Python | gpl-2.0 | 1,376 | 0.021076 |
import threading
from mock import patch
from uuid import uuid4
from changes_lxc_wrapper.cli.wrapper import WrapperCommand
def generate_jobstep_data():
# this must generic a *valid* dataset that should result in a full
# run
return {
'status': {'id': 'queued'},
'data': {},
'expect... | dropbox/changes-lxc-wrapper | tests/cli/test_wrapper.py | Python | apache-2.0 | 3,544 | 0.000564 |
import collections
import copy
from typing import Dict, Mapping, Optional, Set
import fontTools.misc.py23
import fontTools.ttLib
import fontTools.ttLib.tables.otTables as otTables
import statmake.classes
def apply_stylespace_to_variable_font(
stylespace: statmake.classes.Stylespace,
varfont: fontTools.ttLib... | googlefonts/statmake | statmake/lib.py | Python | mit | 7,470 | 0.002142 |
from . import strip
class Segment(strip.Strip):
"""Represents an offset, length segment within a strip."""
def __init__(self, strip, length, offset=0):
if offset < 0 or length < 0:
raise ValueError('Segment indices are non-negative.')
if offset + length > len(strip):
... | rec/BiblioPixel | bibliopixel/layout/geometry/segment.py | Python | mit | 1,539 | 0.00065 |
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r'^sql/$', 'sqlparser.views.parse_sql'),
)
| slack-sqlbot/slack-sqlbot | slack_sqlbot/urls.py | Python | mit | 164 | 0 |
import urllib2
import json
import sys
import os
import wunderData
def get_coord(exifdict):
'''
Purpose: The purpose of this script is to extract the Latitude and Longitude from the EXIF data
Inputs: exifdict: structure storing the image's EXIF data.
Outputs: coords: A tuple of the... | Aerolyzer/Aerolyzer | aerolyzer/location.py | Python | apache-2.0 | 3,932 | 0.007121 |
# -*- coding: utf-8 -*-
import contextlib
import logging
import os
import os.path
import yaml
from bravado_core.spec import is_yaml
from six.moves import urllib
from six.moves.urllib import parse as urlparse
from bravado.compat import json
from bravado.requests_client import RequestsClient
log = logging.getLogger(__... | analogue/bravado | bravado/swagger_model.py | Python | bsd-3-clause | 5,223 | 0.000191 |
#! /usr/bin/env python3
import os
import zipfile
import sys
import settings
__author__ = 'tigge'
def main():
zipfilename = os.path.join(settings.get("folder"), settings.get("basename") + ".zip")
zip = zipfile.ZipFile(zipfilename, mode="w", )
for filename in os.listdir(settings.get("folder")):
p... | Tigge/trello-to-web | zip.py | Python | mit | 659 | 0.007587 |
# Copyright 2017 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... | yanchen036/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu_estimator.py | Python | apache-2.0 | 121,921 | 0.006389 |
#!/usr/bin/python
#
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
#
# Copyright (c) 2016 Dell 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 versi... | sivel/ansible-modules-core | network/dellos9/dellos9_command.py | Python | gpl-3.0 | 6,997 | 0.001143 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-07 15:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('thresher', '0001_initial'),
]
operations = [
migrations.AlterField(
... | Goodly/TextThresher | thresher/migrations/0002_auto_20170607_1544.py | Python | apache-2.0 | 473 | 0 |
from bs4 import BeautifulSoup
from urllib.parse import quote
from core import models
def get_setting(setting_name, setting_group_name, default=None):
try:
setting = models.Setting.objects.get(
name=setting_name,
group__name=setting_group_name,
)
return setting.valu... | ubiquitypress/rua | src/core/util.py | Python | gpl-2.0 | 1,313 | 0 |
suite = {
"name" : "mx",
"libraries" : {
# ------------- Libraries -------------
"JACOCOAGENT" : {
"urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/jacoco/jacocoagent-0.7.1-1.jar"],
"sha1" : "2f73a645b02e39290e577ce555f00b02004650b0",
},
"JACOCOREPORT" : {
"urls" : ["https://lafo.... | smarr/mxtool | mx.mx/suite.py | Python | gpl-2.0 | 4,144 | 0.021477 |
import numpy as np
import pylab as pl
from scipy.integrate import odeint
from scipy.interpolate import interp1d
phi = [0.0, 4.0, 8.0, 12.0, 16.0, 20.0, 24.0, 28.0, 32.0, 36.0, 40.0, 44.0, 48.0, 52.0, 56.0, 60.0, 64.0, 68.0, 72.0, 76.0, 80.0, 84.0, 88.0, 92.0, 96.0, 100.0, 104.0, 108.0, 112.0, 116.0, 120.0, 124.0, 128.... | karban/agros2d | data/scripts/dc_motor_dynamic.py | Python | gpl-2.0 | 3,460 | 0.010116 |
# The docs say the processing time is less than 20 milliseconds
#PROCESSING_TIME = 0.015
PROCESSING_TIME = 0.010
INTERVAL_SCALE = 0.95
# Number of degrees for a small angle... if the angle is smaller than this then
# the rover won't try to turn, to help keep the path straight
SMALL_ANGLE = 7.0
# Ensure that the rove... | eklitzke/icfp08 | src/constants.py | Python | isc | 491 | 0.004073 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/food/shared_drink_charde.iff"
result.attribute_template_id... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/food/shared_drink_charde.py | Python | mit | 446 | 0.047085 |
# 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 *
import inspect
class PerlIoSocketSsl(PerlPackage):
"""SSL sockets with IO::Socket interface"""
... | iulian787/spack | var/spack/repos/builtin/packages/perl-io-socket-ssl/package.py | Python | lgpl-2.1 | 1,217 | 0.003287 |
#!/usr/bin/env python
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, InvalidRequestError
from jso... | MrCreosote/kb_read_library_to_file | lib/kb_read_library_to_file/kb_read_library_to_fileServer.py | Python | mit | 23,263 | 0.00129 |
from platform import python_version
from django import get_version
from distutils.version import LooseVersion
DJANGO_VERSION = get_version()
PYTHON_VERSION = python_version()
# These means "less than or equal to DJANGO_FOO_BAR"
DJANGO_2_2 = LooseVersion(DJANGO_VERSION) < LooseVersion('3.0')
DJANGO_3_0 = LooseVersio... | divio/django-cms | cms/utils/compat/__init__.py | Python | bsd-3-clause | 545 | 0.00367 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.fsl.maths import ErodeImage
def test_ErodeImage_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=Tr... | blakedewey/nipype | nipype/interfaces/fsl/tests/test_auto_ErodeImage.py | Python | bsd-3-clause | 1,597 | 0.028178 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.