text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import os
# We'll render HTML templates and access data sent by POST
# using the request object from flask. Redirect and url_for
# will be used to redirect the user once the upload is done
# and send_from_directory will help us to send/show on the
# browser the file that the user just uploaded
from flask import Flask, ... | davidbradway/fusefit | webui/app/views.py | Python | mit | 2,160 | 0.008333 |
import time
from lib.DomainObjects.EyeosCard import EyeosCard
from lib.Errors.EyeosAPIError import EyeosAPIError
from lib.EyeosApi.EyeosApiCall import EyeosApiCall
from lib.Settings import Settings
from lib.Wrappers.Logger import Logger
class Logout:
def __init__(self, injected_proxy_ip=None, injected_eyeos_api... | Open365/Open365 | lib/EyeosApi/Logout.py | Python | agpl-3.0 | 1,097 | 0.002735 |
# LIPGLOSS - Graphical user interface for constructing glaze recipes
# Copyright (C) 2017 Pieter Mostert
# 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 3 of the License.
# This progra... | PieterMostert/Lipgloss | model/lipgloss/lp_recipe_problem.py | Python | gpl-3.0 | 17,317 | 0.009875 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Isaku Yamahata <yamahata at private email ne jp>
# <yamahata at valinux co jp>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with... | savi-dev/quantum | quantum/plugins/ryu/nova/linux_net.py | Python | apache-2.0 | 2,805 | 0 |
class Operation:
"""
Operation, single operation within execution plan.
"""
def __init__(self, name, args=None):
"""
Create a new operation.
Args:
name: string that represents the name of the operation
args: operation arguments
"""
self.n... | swilly22/redisgraph-py | redisgraph/execution_plan.py | Python | bsd-2-clause | 5,416 | 0.001477 |
#!/usr/bin/env python
#
# Copyright (C) 2009 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 ... | webmedic/booker | src/gdata/blogger/client.py | Python | mit | 6,686 | 0.005085 |
from .spec import BASIC_PROPS_SET, encode_basic_properties
def encode_message(frame, headers, body, frame_size):
"""Encode message headers and body as a sequence of frames."""
for f in frame.encode():
yield f
props, headers = split_headers(headers, BASIC_PROPS_SET)
if headers:
props['h... | seatme/nucleon.amqp | nucleon/amqp/encoding.py | Python | lgpl-3.0 | 1,062 | 0.001883 |
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from django.contrib import admin
from django.contrib.admin.sites import NotRegistered
from models import UserOpenidAssociation
class OpenIDInline(admin.StackedInline):
model = UserOpenidAssociation
class UserAdminWithOpen... | indro/t2c | apps/external_apps/django_openid/admin.py | Python | mit | 658 | 0.009119 |
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2019
import os
import sys
import time
import threading
if 'GEVENT_TEST' not in os.environ and 'CASSANDRA_TEST' not in os.environ and sys.version_info >= (3, 5, 3):
# Background RPC application
#
# Spawn the background RPC app that the tests will ... | instana/python-sensor | tests/apps/grpc_server/__init__.py | Python | mit | 709 | 0.002821 |
from flow.commands.service import ServiceCommand
from flow.configuration.inject.broker import BrokerConfiguration
from flow.configuration.inject.redis_conf import RedisConfiguration
from flow.configuration.inject.service_locator import ServiceLocatorConfiguration
from flow.shell_command.fork.handler import ForkShellCom... | genome/flow-core | flow/shell_command/fork/commands/service.py | Python | agpl-3.0 | 747 | 0.001339 |
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | uni2u/neutron | neutron/plugins/openvswitch/common/config.py | Python | apache-2.0 | 4,210 | 0 |
#! /usr/bin/env python3
# Written by Martin v. Löwis <loewis@informatik.hu-berlin.de>
"""Generate binary message catalog from textual translation description.
This program converts a textual Uniforum-style message catalog (.po file) into
a binary GNU catalog (.mo file). This is essentially the same function as the
G... | LaoZhongGu/kbengine | kbe/src/lib/python/Tools/i18n/msgfmt.py | Python | lgpl-3.0 | 7,051 | 0.002979 |
from __future__ import absolute_import
import zope.interface.interface
from zope.interface.adapter import AdapterLookup as _AdapterLookup
from zope.interface.adapter import AdapterRegistry as _AdapterRegistry
from zope.interface.registry import Components, ComponentLookupError
__all__ = ('Registry',)
NO_CONTRACTS =... | fafhrd91/mdl | mdl/registry.py | Python | apache-2.0 | 3,760 | 0 |
import json
import os
class TestFixtureMixin(object):
def get_json_data(self, filename):
import environ
full_path = (environ.Path(__file__) - 1).root
fixture_path = None
max_levels = 4
current_level = 1
while fixture_path is None:
new_path = '{}{}{}'.fo... | luiscberrocal/django-test-tools | tests/mixins.py | Python | mit | 993 | 0.001007 |
from Foundation import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
class TestNSMetaData (TestCase):
def testConstants(self):
self.assertIsInstance(NSMetadataQueryDidStartGatheringNotification, unicode)
self.assertIsInstance(NSMetadataQueryGatheringP... | albertz/music-player | mac/pyobjc-framework-Cocoa/PyObjCTest/test_nsmetadata.py | Python | bsd-2-clause | 2,524 | 0.003566 |
"""Support for RESTful binary sensors."""
import logging
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA,
BinarySensorDevice,
)
from homeassistant.const import (
CONF_AUTHENTICA... | fbradyirl/home-assistant | homeassistant/components/rest/binary_sensor.py | Python | apache-2.0 | 4,542 | 0.000881 |
import json
import logging
import asyncio
import random
import socket
from hbmqtt.client import MQTTClient, ClientException
from hbmqtt.mqtt.constants import QOS_1
logging.basicConfig(format='%(asctime)s - %(name)14s - '
'%(levelname)5s - %(message)s')
logger = logging.getLogger("mqtt_test_... | pyaiot/pyaiot | utils/mqtt/mqtt-test-node.py | Python | bsd-3-clause | 5,525 | 0 |
#!/usr/bin/env python
#Copyright (C) 2011 by Benedict Paten (benedictpaten@gmail.com)
#
#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 rig... | BD2KGenomics/toil-old | src/toil/batchSystems/combinedBatchSystem.py | Python | mit | 4,039 | 0.013122 |
from botapi.settings import *
DEBUG = True
ALLOWED_HOSTS = ['*']
| naelstrof/PugBot-Discord-Django | botapi/apache/override.py | Python | mit | 66 | 0 |
import tweepy
from pymongo import MongoClient
class RaffleSlave:
"The class responsbile for a single raffle, a new instance for each individual raffle"
Params = None
api = None
alive = True
def __init__(self, hashtag, max, id, owner ):
self.Params = {}
self.Params['max'] = max
... | asmi92/odu-acm | raffleslave.py | Python | mit | 1,668 | 0.020983 |
#
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
#
# pylint: disable=unused-import
import six
from . import Command, Method, Object
from ipalib import api, parameters, output
from ipalib.parameters import DefaultFrom
from ipalib.plugable import Registry
from ipalib.text import _
from ipapython.dn ... | redhatrises/freeipa | ipaclient/remote_plugins/2_164/passwd.py | Python | gpl-3.0 | 2,428 | 0.000824 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import rest.models
from .base import from_django_model
WsAuthGroup = from_django_model(rest.models.WsAuthGroup)
| lavalamp-/ws-backend-community | lib/sqlalchemy/models/auth.py | Python | gpl-3.0 | 178 | 0 |
""" Parser for the negative goals.
Allows to parse sets of the form, e.g., {i-j-k : i!=j & j!=k & i!=k} U
{i,j : i<3 & j<=3}, meaning that i should not know whether j knows the secret
of k, for i, j, k distinct, and that i should not know the secret of j for
either i = 1, 2 and j = 1, 2, 3.
Also allows instantiated neg... | FaustineMaffre/GossipProblem-PDDL-generator | neggoalsparser/parser.py | Python | mit | 3,303 | 0.003633 |
from mock import patch
from django.test import TestCase
from django.core.urlresolvers import reverse
from ..models import Contact
class ContactViewTest(TestCase):
def setUp(self):
self.url = reverse('contact')
self.response = self.client.get(self.url)
def test_contact_view_is_accessible(sel... | prontointern/django-contact-form | django_contact_form_project/contacts/tests/test_views.py | Python | mit | 14,146 | 0.000141 |
import turtle
import random
# Let's create our turtle and call him Simon!
simon = turtle.Turtle()
# We'll set the background to black
turtle.bgcolor("black")
# This is our list of colours
colors = ["red", "green", "blue"]
# We need to ask the user their name
name = turtle.textinput("Name", "What is your name?")
si... | SimonDevon/simple-python-shapes | name-draw1.py | Python | mit | 605 | 0.006612 |
# -*- coding: utf-8; Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
# Miscellaneous validation of user-entered data
#
# Copyright (C) 2005 Junta de Andalucía
# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd.
# Copyright (C) 2015 Manjaro (http://manjaro.org)
#
# Validation library.
# Created by Antonio... | manjaro/thus | thus/misc/validation.py | Python | gpl-3.0 | 5,581 | 0.000896 |
#!/usr/bin/python
# coding: utf-8
#
# Copyright 2014 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
#
# U... | googleads/googleads-adxseller-examples | python/v2.0/generate_report.py | Python | apache-2.0 | 2,740 | 0.006204 |
"""overflow 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-ba... | TIY-Durham/TIY-Overflow | api/overflow/urls.py | Python | gpl-3.0 | 1,416 | 0.000706 |
from thinglang.compiler.opcodes import OpcodeJump
from thinglang.parser.blocks.conditional import Conditional
from thinglang.parser.blocks.loop import Loop
from thinglang.parser.nodes import BaseNode
class BreakStatement(BaseNode):
"""
Jumps to the end of the currently executing loop or conditional
"""
... | ytanay/thinglang | thinglang/parser/statements/break_statement.py | Python | mit | 770 | 0.003896 |
from .DiscreteFactor import State, DiscreteFactor
from .CPD import TabularCPD
from .JointProbabilityDistribution import JointProbabilityDistribution
__all__ = ['TabularCPD',
'DiscreteFactor',
'State'
]
| khalibartan/pgmpy | pgmpy/factors/discrete/__init__.py | Python | mit | 236 | 0 |
from django.apps import AppConfig
class NexusFrontEndConfig(AppConfig):
name = 'nexus_front_end'
| utarsuno/urbtek | nexus_django/nexus_front_end/apps.py | Python | apache-2.0 | 103 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | sysadminmatmoz/ingadhoc | sale_exceptions_ignore_approve/__openerp__.py | Python | agpl-3.0 | 1,775 | 0 |
# Copyright (c) 2015 Presslabs SRL
#
# 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 writ... | PressLabs/silver | silver/tests/unit/test_invoice.py | Python | apache-2.0 | 8,323 | 0.00036 |
#!/usr/bin/env python3
"""
Find characters deep in the expanded string, for fun.
"""
import sys
from collections import Counter
def real_step(s, rules):
out = ""
for i in range(len(s)):
out += s[i]
k = s[i:i+2]
if k in rules:
out += rules[k]
return out
def step(cn... | msullivan/advent-of-code | 2021/14balt.py | Python | mit | 1,674 | 0 |
#!/usr/bin/env python
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
readme = path.join(here, 'README.md')
try:... | damiendr/callipy | setup.py | Python | bsd-2-clause | 1,056 | 0.004735 |
# coding: utf8
# ! /usr/env/python
"""profiler.py component to create profiles with user-defined endpoints."""
from collections import OrderedDict
import numpy as np
from matplotlib import cm, colors, pyplot as plt
from landlab.components.profiler.base_profiler import _BaseProfiler
class Profiler(_BaseProfiler):
... | landlab/landlab | landlab/components/profiler/profiler.py | Python | mit | 13,854 | 0.000217 |
import os
with open("validation_classes.csv", "r") as f:
rows = f.readlines()
rows = rows[1:-1]
rows = [x for x in rows if x != "\n"]
path = "dataset/val/"
for row in rows:
rsplit = row.split(";")
filename = rsplit[0]
c = int(rsplit[1])
new_filename = format(c,'05d') + "_" + filename
if o... | alessiamarcolini/deepstreet | utils/format_validation_filenames_util.py | Python | mit | 408 | 0.002451 |
import math
def linear(x):
return x
def quad(x):
return x*x
def quadout(x):
return 1 -quad(x)
def cubic(x):
return x*x*x
def cubicout(x):
return 1 - cubic(x)
def quint(x):
return x*x*x*x
def quintout(x):
return 1-quint(x)
def sine(x):
return -math.cos(p * (math.pi * .5)) + 1
def sineout(... | devfirefly/PyFlax | Tween.py | Python | mit | 4,128 | 0.03125 |
# coding=utf-8
import zipfile
import re
import os
import hashlib
import json
import logging
from django.shortcuts import render
from django.db.models import Q, Count
from django.core.paginator import Paginator
from rest_framework.views import APIView
from django.conf import settings
from account.models import SUPER... | hxsf/OnlineJudge | problem/views.py | Python | mit | 12,819 | 0.001668 |
'''
Limevideo urlresolver plugin
Copyright (C) 2013 Vinnydude
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 program is ... | xmbcrios/xmbcrios.repository | script.module.urlresolver/lib/urlresolver/plugins/limevideo.py | Python | gpl-2.0 | 3,459 | 0.005204 |
import unittest
from dpark.serialize import dump_closure, load_closure
class TestSerialize(unittest.TestCase):
def testNameError(self):
def foo():
print x
dumped_func = dump_closure(foo)
func = load_closure(dumped_func)
self.assertRaises(NameError, func)
... | quxiaolong1504/dpark | tests/test_serialize.py | Python | bsd-3-clause | 590 | 0.008475 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/xs/ExtensionType.py | Python | gpl-3.0 | 2,037 | 0.003927 |
import os
import re
import json
import importlib
# Django Libraries
from django.http import HttpResponse, HttpResponseServerError
# CloudScape Libraries
from cloudscape.common import config
from cloudscape.common import logger
from cloudscape.common.vars import T_BASE
from cloudscape.engine.api.base import APIBase
fr... | djtaylor/cloudscape-DEPRECATED | python/cloudscape/engine/api/core/request.py | Python | gpl-3.0 | 15,200 | 0.010724 |
# Copyright 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... | darren-wang/ks3 | keystone/server/eventlet.py | Python | apache-2.0 | 5,193 | 0.001541 |
#! python3
'''
mcbd.py - Saves and loads pieces of text from/to the clipboard to/from a
shelf type file.
Usage: python3 mcbd.py save <keyword> - saves clipboard for keyword.
python3 mcbd.py <keyword> - loads to clipboard for keyword.
python3 mcbd.py list - loads all keywords to clipboard.
... | apaksoy/automatetheboringstuff | practice projects/chap 08/multiclipboard with deletion chap 8/mcbd.py | Python | mit | 2,608 | 0.003451 |
# -*- coding: utf-8 -*-
"""This file contains utility functions."""
import logging
import re
# Illegal Unicode characters for XML.
ILLEGAL_XML_RE = re.compile(
ur'[\x00-\x08\x0b-\x1f\x7f-\x84\x86-\x9f'
ur'\ud800-\udfff\ufdd0-\ufddf\ufffe-\uffff]')
def IsText(bytes_in, encoding=None):
"""Examine the bytes... | ostree/plaso | plaso/lib/utils.py | Python | apache-2.0 | 3,494 | 0.013165 |
#
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal su... | harmy/kbengine | kbe/res/scripts/common/Lib/sre_constants.py | Python | lgpl-3.0 | 7,444 | 0.002284 |
#
# 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
# ... | miguelgrinberg/heat | heat/engine/clients/os/manila.py | Python | apache-2.0 | 5,040 | 0 |
class BaiduSearch(object):
def __init__(self):
pass
def __call__(self, client, api, **kw):
"""
client --
client
api --
"""
client.driver.get("http://www.baidu.com")
input = client.e("#kw")
input.cle... | emop/webrobot | hello_baidu/libs/actions.py | Python | gpl-2.0 | 725 | 0.01931 |
import os
from flask import render_template
from markdown import markdown
__all__ = ["DirContents", "Doc"]
class DirContents(object):
def __init__(self, dir, name=''):
self.dir = dir
if name != '':
self.name = name
else:
self.name = dir
def get_contents(self):
... | aivuk/formcreator | formcreator/blocks/__init__.py | Python | bsd-2-clause | 647 | 0.003091 |
""" doc2xml.py
Converts docx files representing a proposed rule into the type of XML we'd
expect from the Federal Register.
Executing: python doc2xml.py file.docx
Writes XML to stdout
Installation:
* Install libxml2 via a package manager
* pip install -e git+https://github.com/savoirfairelinux/python-docx... | tadhg-ohiggins/regulations-parser | doc2xml.py | Python | cc0-1.0 | 5,854 | 0.001025 |
#!/usr/bin/env python3
# -*-coding:UTF-8 -*
import os
import re
import sys
import time
import redis
import datetime
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'packages'))
import Item
import Term
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib/'))
import ConfigLoader
def rreplace(s, old, new, occ... | CIRCL/AIL-framework | update/v2.2/Update.py | Python | agpl-3.0 | 4,172 | 0.006951 |
from abstractKeyboardMapping import AbstractKeyboardMapping
import evdev
class Qwerty(AbstractKeyboardMapping):
def __init__(self):
super(AbstractKeyboardMapping, self).__init__()
def solo(self):
return { "!" : [evdev.ecodes.KEY_LEFTSHIFT, evdev.ecodes.KEY_1],
"@" : [evdev.ecodes.KEY_LEFTSHIFT, evdev... | dictation-toolbox/aenea | server/linux_wayland/qwerty.py | Python | lgpl-3.0 | 1,666 | 0.042017 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import abc
import os
import glob
import logging
import json
import warnings
from monty.io import zopen
from pymatgen.io.vasp.inputs import Incar, Potcar, Poscar
from pymatgen.io.vasp.outputs import Vasprun, O... | blondegeek/pymatgen | pymatgen/apps/borg/hive.py | Python | mit | 15,762 | 0.000444 |
#!/usr/bin/env python
#
# BBB-Network-Ammeter
#
# Copyright (c) 2016, Forest Crossman <cyrozap@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copi... | cyrozap/BBB-Network-Ammeter | server.py | Python | isc | 5,648 | 0.011863 |
# (c) 2019, Evgeni Golov <evgeni@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 version 3 of the License, or
# (at your option) any later version.
#
# This program is distr... | ATIX-AG/foreman-ansible-modules | plugins/doc_fragments/foreman.py | Python | gpl-3.0 | 9,183 | 0.001198 |
from __future__ import print_function
import numpy as np
import os
import sys
import time
import tensorflow as tf
import load_datasets as ld
import datetime as dt
import ilt_two_layers as ilt
from sklearn.metrics import mean_squared_error
import tensorflow.python.client
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.... | abezuglov/ANN | Storm-Surge/code/ilt_multi_gpu_feed.py | Python | gpl-3.0 | 12,586 | 0.014063 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 The Simbiose Ventures Developers
#
# 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... | SlicingDice/slicingdice-python | pyslicer/client.py | Python | mit | 12,918 | 0.000077 |
### Copyright (C) 2009 Vincent Legoll <vincent.legoll@gmail.com>
### 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... | oliver/meld | vc/cdv.py | Python | gpl-2.0 | 1,787 | 0.012311 |
# -*- coding: utf-8 -*-
"""Additional helper functions for the optlang solvers.
All functions integrate well with the context manager, meaning that
all operations defined here are automatically reverted when used in a
`with model:` block.
The functions defined here together with the existing model functions should
a... | zakandrewking/cobrapy | cobra/util/solver.py | Python | lgpl-2.1 | 15,435 | 0 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import cPickle as pickle, time, string
from SPARQLWrapper import SPARQLWrapper, JSON
import rdflib as r, pygraphviz as gv
import pylab as pl
# variaveis principais:
# classes (kk), props,
# vizinhanca_ (de classes)
T=time.time()
U=r.URIRef
def fazQuery(query):
NOW=time.tim... | OpenLinkedSocialData/ocd | OCD.py | Python | unlicense | 24,833 | 0.021655 |
# -*- coding: utf-8 -*-
from flask_babel._compat import text_type
class LazyString(object):
def __init__(self, func, *args, **kwargs):
self._func = func
self._args = args
self._kwargs = kwargs
def __getattr__(self, attr):
string = text_type(self)
if hasattr(string, att... | hachard/Cra-Magnet | flask/lib/python3.5/site-packages/flask_babel/speaklater.py | Python | gpl-3.0 | 1,713 | 0.000584 |
# -*- coding: utf-8 -*-
# This file is part of Fail2Ban.
#
# Fail2Ban is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Fail2Ban is d... | yarikoptic/Fail2Ban-Old-SVNGIT | server/datetemplate.py | Python | gpl-2.0 | 5,047 | 0.033902 |
##########################################################################
#
# Copyright (c) 2014, Image Engine Design 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:
#
# * Redistrib... | lucienfostier/gaffer | python/GafferUITest/MessageWidgetTest.py | Python | bsd-3-clause | 4,866 | 0.044595 |
from __future__ import absolute_import, division, print_function
import toolz
from toolz import first
import datashape
from datashape import Record, dshape, DataShape
from datashape import coretypes as ct
from datashape.predicates import isscalar, iscollection
from .core import common_subexpression
from .expressions ... | vitan/blaze | blaze/expr/reductions.py | Python | bsd-3-clause | 6,478 | 0.001698 |
from django.utils.translation import ugettext_lazy as _
DIAL_CHOICES = (
('none', _('None')),
('din 41091.1', _('Dial with minute and hour markers (DIN 41091, Sect. 1)')),
('din 41091.3', _('Dial with hour markers (DIN 41091, Sect. 3)')),
('din 41091.4', _('Dial with hour numerals (DIN 41091, Part 4)')... | akoebbe/sweetiepi | sweetiepi/clocks/choices.py | Python | mit | 1,719 | 0.000582 |
from uber.common import *
def swallow_exceptions(func):
"""
Don't allow ANY Exceptions to be raised from this.
Use this ONLY where it's absolutely needed, such as dealing with locking functionality.
WARNING: DO NOT USE THIS UNLESS YOU KNOW WHAT YOU'RE DOING :)
"""
@wraps(func)
def swallow_... | md1024/rams | uber/decorators.py | Python | agpl-3.0 | 18,151 | 0.003251 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import numpy as np
import scipy.signal as sp
import random
import nix
import matplotlib.pyplot as plt
COLORS_BLUE_AND_RED = (
'dodgerblue', 'red'
)
COLORS_BLUE_GRADIENT = (
"#034980", "#055DA1", "#1B70E0", "#3786... | stoewer/nix-demo | utils/plotting.py | Python | bsd-3-clause | 12,201 | 0.002951 |
from datetime import date, time, timedelta
from decimal import Decimal
import itertools
from django.utils import timezone
from six.moves import xrange
from .models import Person
def get_fixtures(n=None):
"""
Returns `n` dictionaries of `Person` objects.
If `n` is not specified it defaults to 6.
"... | lead-ratings/django-bulk-update | tests/fixtures.py | Python | mit | 4,775 | 0.000209 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The nealcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP 9 soft forks.
Connect to a single node.
regtest lock-in with 108/144 block signalling
activa... | appop/bitcoin | qa/rpc-tests/bip9-softforks.py | Python | mit | 10,528 | 0.004084 |
from keystone import utils
from keystone.common import wsgi
import keystone.config as config
from keystone.logic.types.tenant import Tenant
from . import get_marker_limit_and_url
class TenantController(wsgi.Controller):
"""Controller for Tenant related operations"""
def __init__(self, options, is_service_ope... | genius1611/Keystone | keystone/controllers/tenant.py | Python | apache-2.0 | 1,975 | 0.002532 |
"""generated file, don't modify or your data will be lost"""
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
pass
| GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/logilab/__init__.py | Python | agpl-3.0 | 155 | 0 |
import argparse
import sys
import math
from collections import namedtuple
from itertools import count
import gym
import numpy as np
import scipy.optimize
from gym import wrappers
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import tor... | tpbarron/pytorch-ppo | main.py | Python | mit | 9,755 | 0.003383 |
import json
import pathlib
import sys
import boto3
dist_folder = pathlib.Path.cwd() / 'dist'
try:
f = next(dist_folder.glob('*.whl'))
except StopIteration:
print("No .whl files found in ./dist!")
sys.exit()
print("Uploading", f.name)
s3 = boto3.client('s3')
s3.upload_file(str(f), 'releases.wagtail.io',... | kaedroho/wagtail | scripts/nightly/upload.py | Python | bsd-3-clause | 615 | 0.001626 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Authors: Jussi Nurminen <jnu@iki.fi>
# License: BSD Style.
import tarfile
import os.path as op
import os
from ...utils import _fetch_file, verbose, _check_option
from ..utils import _get_path, logger, _do_path_update
@verbose
def data_path(dataset='evoked', path=None... | olafhauk/mne-python | mne/datasets/hf_sef/hf_sef.py | Python | bsd-3-clause | 3,751 | 0 |
#!/usr/bin/env python
"""
A simple coin flipping example. The model is written in TensorFlow.
Inspired by Stan's toy example.
Probability model
Prior: Beta
Likelihood: Bernoulli
Inference: Maximum a posteriori
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_f... | ruohoruotsi/Wavelet-Tree-Synth | edward-examples/beta_bernoulli_map.py | Python | gpl-2.0 | 1,013 | 0.002962 |
#!/usr/bin/env python2
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import hashlib
import sys
import os
from random import SystemRandom
import base64
import hmac
if len(s... | cryptoprojects/ultimateonlinecash | share/rpcuser/rpcuser.py | Python | mit | 1,125 | 0.005333 |
import time
from subprocess import *
PATH = "/home/richie_rich/OSProj/redis-OS-project/src/redis-cli"
p1 = Popen([PATH], shell=True, stdin=PIPE)
p1.communicate(input="FLUSHALL")
strength = 1000000
rangeVal = strength + 1
string = "set key"
string1 = ""
count = 0
for i in xrange(1,rangeVal):
count = count + 1
... | richasinha/redis-OS-project | src/setRedis.py | Python | bsd-3-clause | 595 | 0.006723 |
from __future__ import division
import errno
import json
import os
import sys
import time
import traceback
from twisted.internet import defer, reactor
from twisted.python import log
from twisted.web import resource, static
import p2pool
from bitcoin import data as bitcoin_data
from . import data as p2pool_data, p2p
... | andreasfaerber/p2pool-feathercoin | p2pool/web.py | Python | gpl-3.0 | 25,473 | 0.00687 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... | richshaffer/tornado-suds | tornado_suds/bindings/rpc.py | Python | lgpl-3.0 | 3,181 | 0.002829 |
#!/usr/bin/env python3
from lmap import ldap
from getpass import getpass
import threading
pw = getpass()
def bind_fnord(num):
def do_teh_action():
ld = ldap.ldap('ldap://emmi.physik-pool.tu-berlin.de/')
ld.simple_bind('uid=jaseg,ou=people,ou=pcpool,ou=physik,o=tu-berlin,c=de', pw)
print(num, len(ld.search('ou=... | jaseg/python-lmap | testfnord.py | Python | bsd-2-clause | 490 | 0.028571 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class Proj2Pipeline(object):
def process_item(self, item, spider):
return item
| passByReference/webcrawler | proj2/proj2/pipelines.py | Python | apache-2.0 | 285 | 0 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
WTF_CSRF_ENABLED = True
SECRET_KEY = '33stanlake#'
DEBUG = True
APP_TITLE = 'Cloud of Reproducible Records API'
VERSION = '0.1-dev'
MONGODB_SETTINGS = {
'db': 'corr-production',
'host': '0.0.0.0',
'port': 27017
}
# STORMPATH_API_KEY_FILE =... | wd15/corr | corr-api/config.py | Python | mit | 436 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-dialogflow-cx | google/cloud/dialogflowcx_v3beta1/services/pages/transports/base.py | Python | apache-2.0 | 7,215 | 0.001663 |
"""
Functions to fix fonts so they conform to the Google Fonts
specification:
https://github.com/googlefonts/gf-docs/tree/main/Spec
"""
from fontTools.misc.fixedTools import otRound
from fontTools.ttLib import TTFont, newTable, getTableModule
from fontTools.ttLib.tables import ttProgram
from fontTools.ttLib.tables._c_m... | googlefonts/gftools | Lib/gftools/fix.py | Python | apache-2.0 | 28,567 | 0.001505 |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/ns/nsratecontrol.py | Python | apache-2.0 | 5,380 | 0.036059 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | goddardl/gaffer | python/GafferTest/TypedObjectPlugTest.py | Python | bsd-3-clause | 8,984 | 0.059996 |
#!/usr/bin/python
"""
Init script for Earthquake Docker Image (osrg/earthquake)
Supported Env vars:
- EQ_DOCKER_PRIVILEGED
"""
import os
import prctl
import subprocess
import sys
def log(s):
print 'INIT: %s' % s
def is_privileged_mode():
has_env = os.getenv('EQ_DOCKER_PRIVILEGED')
has_cap = prctl.cap_pe... | AkihiroSuda/earthquake | docker/eq-init.py | Python | apache-2.0 | 1,499 | 0.008005 |
import os
import glob
import operator
import errno
import filecmp
import shutil
import numpy
from .smac_output_readers import *
def find_largest_file (glob_pattern):
""" Function to find the largest file matching a glob pattern.
Old SMAC version keep several versions of files as back-ups. This
helper ... | sfalkner/pySMAC | pysmac/utils/state_merge.py | Python | agpl-3.0 | 11,573 | 0.009937 |
#!/usr/bin/python
# -*- encoding: UTF-8 -*-
'''MATRIX Log File Maker
Version: 2
This script will create a csv file that will be a table of settings for all
STM data recorded from the Omicron MATRIX software.
List of classes: -none-
List of functions:
main
'''
# built-in modules
im... | ampron/pyMTRX | pyMTRX/scripts/notebook_sheet.py | Python | gpl-3.0 | 12,420 | 0.008132 |
#!/usr/bin/env python3
import argparse
import functools
import json
import os
import re
import signal
import socket
import ssl
import subprocess
import sys
import threading
import time
import warnings
from collections import defaultdict
from operator import itemgetter
import psutil
from mtools.util import OrderedDict... | rueckstiess/mtools | mtools/mlaunch/mlaunch.py | Python | apache-2.0 | 96,965 | 0.000423 |
import logging
from collections import UserDict
from pajbot.models.db import DBManager, Base
from sqlalchemy import Column, Integer, String
from sqlalchemy.dialects.mysql import TEXT
log = logging.getLogger('pajbot')
class Setting(Base):
__tablename__ = 'tb_settings'
id = Column(Integer, primary_key=True)... | gigglearrows/anniesbot | pajbot/models/setting.py | Python | mit | 2,197 | 0 |
import json
import os
import pexpect
import re
import time
from behave import step
import nmci
@step(u'Autocomplete "{cmd}" in bash and execute')
def autocomplete_command(context, cmd):
bash = context.pexpect_spawn("bash")
bash.send(cmd)
bash.send('\t')
time.sleep(1)
bash.send('\r\n')
time.sl... | NetworkManager/NetworkManager-ci | features/steps/commands.py | Python | gpl-3.0 | 19,422 | 0.003398 |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | sloanyang/aquantic | Tools/Scripts/webkitpy/port/mac_unittest.py | Python | gpl-2.0 | 12,566 | 0.003342 |
#!/usr/bin/python
#
# (c) 2018 Extreme Networks 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 late... | thaim/ansible | lib/ansible/modules/network/exos/exos_facts.py | Python | mit | 5,863 | 0.000682 |
from __future__ import print_function
import sys
import numpy
from arrayaccess import gene_class_ArrayAccess
from test_arrayaccess import LIST_CDT, LIST_NUM
def main(iter_num, list_num, calloc):
clibname = 'arrayaccess.so'
ArrayAccess = gene_class_ArrayAccess(clibname, len(list_num), LIST_CDT)
ArrayAcce... | tkf/railgun | tests/check_memory_leak.py | Python | mit | 1,554 | 0.000644 |
from __init__ import redis_db
from werkzeug.security import generate_password_hash, check_password_hash
from os import urandom
from base64 import b64encode
class User(object):
def __init__(self):
self.username = "" # required
self.password_hash = "" # required
self.phone_number = "" # req... | BrambleLLC/HackAZ-2016 | server/webapp/models.py | Python | mit | 1,957 | 0.006643 |
"""
Copyright (C) 2018 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
... | MediaKraken/MediaKraken_Deployment | source/common/common_network_steam.py | Python | gpl-3.0 | 1,746 | 0.000573 |
from flask import Blueprint
from zou.app.utils.api import configure_api_from_blueprint
from .resources import (
AllProjectsResource,
OpenProjectsResource,
ProductionTeamResource,
ProductionTeamRemoveResource,
ProductionAssetTypeResource,
ProductionAssetTypeRemoveResource,
ProductionTaskType... | cgwire/zou | zou/app/blueprints/projects/__init__.py | Python | agpl-3.0 | 3,136 | 0.000319 |
from ...api import generate_media, prepare_media
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Combines and compresses your media files and saves them in _generated_media.'
requires_model_validation = False
def handle(self, *args, **options):
prepare_medi... | Crop-R/django-mediagenerator | mediagenerator/management/commands/generatemedia.py | Python | bsd-3-clause | 349 | 0.005731 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.