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 LegacyRouter: def db_for_read(self, model, **hints): if model._meta.app_label == 'legacy_cep': return 'legacy_cep' return None def db_for_write(self, model, **hints): if model._meta.app_label == 'legacy_cep': return 'legacy_cep' return None de...
cmjatai/cmj
cmj/legacy_cep/router.py
Python
gpl-3.0
653
#!/usr/bin/env python2 # Copyright 2013-present Barefoot Networks, 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 b...
hanw/behavioral-model
tools/runtime_CLI.py
Python
apache-2.0
86,770
import sys import os import json import hashlib import logging import base64 import urllib import copy import re import bleach import pytz from datetime import datetime from boto.s3.cors import CORSConfiguration from boto.s3.key import Key import jsonschema from furl import furl from dateutil.parser import parse as du_...
mostlygeek/splice
splice/ingest.py
Python
mpl-2.0
17,210
#-*- coding: utf-8 -*- from django.http import HttpResponse from filer.server.backends.base import ServerBase class ApacheXSendfileServer(ServerBase): def serve(self, request, file, **kwargs): response = HttpResponse() response['X-Sendfile'] = file.path # This is needed for lighttpd, hopefully t...
philippbosch/django-filer
filer/server/backends/xsendfile.py
Python
mit
594
import logging LOG_FILENAME = 'logging_example.out' logging.basicConfig( filename=LOG_FILENAME, level=logging.DEBUG, ) logging.debug('This message should go to the log file') with open(LOG_FILENAME, 'rt') as f: body = f.read() print('FILE:') print(body)
jasonwee/asus-rt-n14uhp-mrtg
src/lesson_application_building_blocks/logging_file_example.py
Python
apache-2.0
272
import os from collections import Iterable, OrderedDict from coala_utils.decorators import ( enforce_signature, generate_repr, ) from coala_utils.string_processing.StringConverter import StringConverter from coalib.parsing.Globbing import glob_escape def path(obj, *args, **kwargs): return obj.__path__(*a...
Asnelchristian/coala
coalib/settings/Setting.py
Python
agpl-3.0
9,443
#!/usr/bin/env python import numpy as np import pandas as pd from pyconsensus import Oracle import rpy2.robjects as robj import rpy2.robjects.pandas2ri from rpy2.robjects.packages import importr pd.set_option("display.max_rows", 25) pd.set_option("display.width", 1000) np.set_printoptions(linewidth=500) # > M # ...
AugurProject/pyconsensus
pyconsensus/plotj.py
Python
gpl-3.0
3,619
#!/usr/bin/env python # -*- coding: utf-8 -*- # # A Solution to "Large non-mersenne prime" – Project Euler Problem No. 97 # by Florian Buetow # # Sourcecode: https://github.com/fbcom/project-euler # Problem statement: https://projecteuler.net/problem=97 print "Solution:", (28433 * 2**7830457 + 1) % 10**10
fbcom/project-euler
097_large_non_mersenne_prime.py
Python
mit
311
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack LLC. # Copyright 2011 Justin Santa Barbara # 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...
NoBodyCam/TftpPxeBootBareMetal
nova/api/openstack/extensions.py
Python
apache-2.0
12,937
############################################################################### # ilastik: interactive learning and segmentation toolkit # # Copyright (C) 2011-2014, the ilastik developers # <team@ilastik.org> # # This program is free software; you can redistribute it and/or # mod...
nielsbuwen/ilastik
ilastik/applets/autocontextClassification/opBatchIoSelective.py
Python
gpl-3.0
11,464
from __future__ import generator_stop import datetime import io import csv import json from sqlalchemy import Column, Integer, String, DateTime, Float, Text, Boolean, func, inspect from sqlalchemy.orm import validates, deferred from sqlalchemy.ext.declarative import declarative_base from psiturk.db import db_session fr...
NYUCCL/psiTurk
psiturk/models.py
Python
mit
11,147
#!/usr/bin/env python import argparse import glob import os import re import sys RE_INPUT = ('\s+Search initialized with\s+(?P<num>\d+)\s+structures from the ' 'input structure file') RE_TOTAL = ('\s+Total number of structures processed =\s+(?P<num>\d+)') def count_steps(direc): filenames = glob.glob(...
Q2MM/q2mm
tools/count_steps.py
Python
mit
3,226
import bpy from bpy.props import * import os import shutil import arm.props_ui as props_ui import arm.assets as assets import arm.log as log import arm.utils import arm.make import arm.props_renderpath as props_renderpath import arm.proxy import arm.nodes_logic # Armory version arm_version = '2019.6' arm_commit = '$Id...
luboslenco/cyclesgame
blender/arm/props.py
Python
lgpl-3.0
27,293
""" This package contains the wrappers to submit and execute jobs. ``RemoteWrapper`` is the main Wrapper. ``LocalWrapper`` inherits from it but runs in the same machine that submitts the jobs. """
ornl-ndav/django-remote-submission
django_remote_submission/wrapper/__init__.py
Python
isc
200
from airflow import DAG from airflow.operators import PythonOperator from airflow.hooks import RedisHook from datetime import datetime, timedelta from airflow.models import Variable from airflow.hooks import RedisHook from shutil import copyfile import logging import traceback from airflow.hooks import MemcacheHook d...
vipul-tm/DAG
dags-ttpl/createPreviousState.py
Python
bsd-3-clause
14,429
#!/usr/bin/env python """ Common module for dealing with fields for the IGN Aggregate Report """ import collections import csv import os from ngi_reports.common import ign_sample_report # The ign_aggregate_report.CommonReport class extends the ign_sample_report.CommonReport class class CommonReport(ign_sample_report...
senthil10/ngi_reports
ngi_reports/common/ign_aggregate_report.py
Python
mit
2,072
""" Svg_writer is a class and collection of utilities to read from and write to an svg file. Svg_writer uses the layer_template.svg file in the templates folder in the same folder as svg_writer, to output an svg file. """ from __future__ import absolute_import #Init has to be imported first because it has code to wo...
dob71/x2swn
skeinforge/fabmetheus_utilities/svg_writer.py
Python
gpl-3.0
12,163
from __future__ import print_function class BlinkM(object): commands = { # 'func': ['comand', input_args, return_values] "setRGB": ['n', 3, 0], "fadeToRGB": ['c', 3, 0], "fadeToHSV": ['h', 3, 0], "fadeToRandomRGB": ['C', 3, 0], "fadeToRandomH...
sochotnicky/python-blinkm
blinkm.py
Python
gpl-3.0
2,081
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('freebasics', '0006_change_site_url_field_type'), ] operations = [ migrations.AddField( model_name='freebasicscon...
praekeltfoundation/mc2-freebasics
freebasics/migrations/0007_freebasicscontroller_postgres_db_url.py
Python
bsd-2-clause
442
deprecated_params = dict(k='inflection_point', f='smoothing', noise_level='noise') def class_extensions(): def transform(self, frame, blending=None, inflection_point=None, smoothing=None, noise=None, as_training=False, **kwargs): """ Apply transformation to `te_columns` based on the encoding maps...
michalkurka/h2o-3
h2o-bindings/bin/custom/python/gen_targetencoder.py
Python
apache-2.0
8,061
#coding:utf-8 import numpy as np from chainer import Variable, FunctionSet import chainer.functions as F class LSTM(FunctionSet): def __init__(self,f_n_units, n_units): super(LSTM, self).__init__( l1_x = F.Linear(f_n_units, 4*n_units), l1_h = F.Linear(n_units, 4*n_units), ...
wbap/Hackathon2015
Nishida/WBAI_open_code/lstm/lstm.py
Python
apache-2.0
1,640
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import unittest import copy from vispy.util.event import Event, EventEmitter, EmitterGroup from vispy.util import use_log_level from vispy.testing import run_tests_if_main, as...
ghisvail/vispy
vispy/util/tests/test_emitter_group.py
Python
bsd-3-clause
7,817
# Authors : Alexandre Gramfort, alexandre.gramfort@inria.fr (2011) # Denis A. Engemann <denis.engemann@gmail.com> # License : BSD 3-clause from functools import partial import numpy as np from ..parallel import parallel_func from ..io.pick import _picks_to_idx from ..utils import logger, verbose, _time_mask...
kambysese/mne-python
mne/time_frequency/psd.py
Python
bsd-3-clause
12,506
# -*- coding: latin-1 -*- """ This module contains the parser/generators (or coders/encoders if you prefer) for the classes/datatypes that are used in Icalendar: ########################################################################### # This module defines these property value data types and property parameters ...
ryba-xek/iCalendar
src/icalendar/prop.py
Python
lgpl-2.1
42,896
import base64 import logging import re import warnings import spnego import spnego.channel_bindings import spnego.exceptions from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from cryptography.exceptions import UnsupportedAlgorithm...
requests/requests-kerberos
requests_kerberos/kerberos_.py
Python
isc
18,197
""" Test output formatting for Series/DataFrame, including to_string & reprs """ from datetime import datetime from io import StringIO import itertools from operator import methodcaller import os from pathlib import Path import re from shutil import get_terminal_size import sys import textwrap import dateutil import ...
jreback/pandas
pandas/tests/io/formats/test_format.py
Python
bsd-3-clause
118,315
from vsg.rules import token_case_with_prefix_suffix from vsg import token lTokens = [] lTokens.append(token.process_statement.end_process_label) class rule_019(token_case_with_prefix_suffix): ''' This rule checks the **end process** label has proper case. |configuring_uppercase_and_lowercase_rules_lin...
jeremiah-c-leary/vhdl-style-guide
vsg/rules/process/rule_019.py
Python
gpl-3.0
618
from builtins import classmethod import numpy as np from datetime import datetime as dt """ Inspired by https://repl.it/repls/OrganicVainDoom#main.py """ class NeuralNet(object): train_cnt = 0 epoch = 0 eta = 0.5 # TODO make constructor-only param h_layers = [3] X = None Y = None X...
hiryou/MLPractice
neural_net/by_numpy.py
Python
mit
3,555
# Copyright (C) 2015-2016 OLogN Technologies AG # # This source file 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 WITHOUT ...
smartanthill/smartanthill2_0-embedded
firmware/platformio_extra_script.py
Python
gpl-2.0
877
# -*- coding: utf-8 -*- import logging from apscheduler.schedulers.background import BackgroundScheduler from fooltrader.datamanager.datamanager import crawl_stock_quote logger = logging.getLogger(__name__) sched = BackgroundScheduler() # 每天下午5:00抓取数据 @sched.scheduled_job('cron', hour=17, minute=10) def schedule...
foolcage/fooltrader
fooltrader/main.py
Python
mit
700
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import numpy as np from ..ext.six.moves import xrange def _fix_colors(colors): colors = np.asarray(colors) if colors.ndim not in (2, 3): raise ValueError('c...
kkuunnddaannkk/vispy
vispy/geometry/meshdata.py
Python
bsd-3-clause
22,746
from sqlalchemy import Column, String, Integer from app import Base class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) username = Column(String(100), unique=True, nullable=False) email = Column(String(100), unique=True, nullable=False) password = Column(String(100), nullable=False) ...
AtillaMaia/Login-System
app/models/tables.py
Python
mit
536
"""calculate the electron impact excitation cross sections """ import sys from pfac import fac use_openmp = False if len(sys.argv) == 2 and sys.argv[1] == 'openmp': use_openmp = True if use_openmp: # enable openmp with 2 cores fac.InitializeMPI(2) fac.SetAtom('Fe') # 1s shell is closed fac.Closed('1s') ...
fnevgeny/fac
demo/excitation/fe17_excitation.py
Python
gpl-3.0
723
# __init__.py - collection of United States numbers # coding: utf-8 # # Copyright (C) 2012 Arthur de Jong # # This library 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 2.1 of the Lic...
tonyseek/python-stdnum
stdnum/us/__init__.py
Python
lgpl-2.1
880
#!/usr/bin/python import re import sys import xml.sax # A simple script which turns a gml file into a set of python dictionaries with # the same set of information, restricted to a bounding box. The goal is to # speed up subsequent processing of the same data as well as to distribute # the complexity of parsing an ...
wlach/neocoder
utils/gml2py-statscan.py
Python
mit
3,995
# -*- coding: utf-8 -*- from __future__ import absolute_import from django.contrib.auth.models import User, AnonymousUser from sentry.permissions import can_create_projects, can_set_public_projects from sentry.testutils import TestCase class CanCreateProjectTest(TestCase): def test_superuser_is_true(self): ...
simmetria/sentry
tests/sentry/permissions/tests.py
Python
bsd-3-clause
1,667
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-04-24 14:39 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Bot', '0003_day_week_day_id'), ] operations = [ migrations.AddField( ...
leoniknik/PartyBot
Bot/migrations/0004_telegramuser_free_mode.py
Python
mit
478
# This file is part of Mylar. # # Mylar 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. # # Mylar is distributed in the hope that...
evilhero/mylar
mylar/updater.py
Python
gpl-3.0
92,033
""" ========================================== One-class SVM with non-linear kernel (RBF) ========================================== An example using a one-class SVM for novelty detection. :ref:`One-class SVM <svm_outlier_detection>` is an unsupervised algorithm that learns a decision function for novelty detection: ...
e-koch/Phys-595
project_code/Example Scripts/plot_oneclass.py
Python
mit
2,557
#!/usr/bin/python # Copyright: (c) 2018, Pluribus Networks # 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': ['...
thaim/ansible
lib/ansible/modules/network/netvisor/pn_vtep.py
Python
mit
5,290
#! python3 """Download XKCD Downloads every single XKCD comic. """ def main(): import requests, os, bs4 url = "http://xkcd.com" # starting url os.makedirs("xkcd", exist_ok=True) # store comics in ./xkcd while not url.endswith('#'): # Download the page. print("Downloadin...
JoseALermaIII/python-tutorials
pythontutorials/books/AutomateTheBoringStuff/Ch11/P4_downloadXkcd.py
Python
mit
1,308
#!/usr/bin/env python # -*- coding: utf-8 -*- # # tiingo documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # auto...
hydrosquall/tiingo-python
docs/conf.py
Python
mit
8,714
from bs4 import BeautifulSoup from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode from couchpotato.core.helpers.variable import tryInt, cleanHost from couchpotato.core.logger import CPLog from couchpotato.core.providers.torrent.base import TorrentMagnetProvider from couchpotato.environment import Env ...
cloakedcode/CouchPotatoServer
couchpotato/core/providers/torrent/thepiratebay/main.py
Python
gpl-3.0
5,523
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2015, Jefferson Girão <jefferson@girao.net> # (c) 2015, René Moser <mail@renemoser.net> # # 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...
chepazzo/ansible-modules-extras
cloud/cloudstack/cs_volume.py
Python
gpl-3.0
15,295
from django.conf.urls import patterns, include, url from . import views # Uncomment the next two lines to enable the admin: urlpatterns = patterns('', # user is out url(r'^$', views.default, name="teacher_classroom_view_list"), url(r'^search/$', views.search, name="teacher_classroom_view_search"), ...
houssemFat/MeeM-Dev
teacher/apps/courses/classroom/urls.py
Python
mit
490
ans = 0; num1 = 1; num2 = 2; while (num2 < 4000000): if (num2%2 == 0): ans = ans + num2; num3 = num1 + num2; num1 = num2; num2 = num3; print(ans)
GT-IDEaS/SkillsWorkshop2017
Week01/Problem02/utantipongpipat_02.py
Python
bsd-3-clause
169
#!/usr/bin/env python """This script does x. Example: Attributes: Todo: """ import os import sys import glob import numpy as np import pandas as pd import radical.analytics as ra def initialize_entity(ename=None): entities = {'session': {'sid' : [], # Session ID 'sess...
radical-experiments/AIMES-Experience
OSG/analysis/bin/wranglermp.py
Python
mit
17,207
#!/usr/bin/env python # -*- coding: utf-8 -*- # $Id: tdUsb1.py 56295 2015-06-09 14:29:55Z vboxsync $ """ VirtualBox Validation Kit - USB testcase and benchmark. """ __copyright__ = \ """ Copyright (C) 2014-2015 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www...
carmark/vbox
src/VBox/ValidationKit/tests/usb/tdUsb1.py
Python
gpl-2.0
15,566
#!/usr/bin/python # # Copyright 2016 Deany Dean # # 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 ...
deanydean/py-piglow-sys
src/piglowui.py
Python
apache-2.0
5,904
#!/usr/bin/env python # 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...
appium/python-client
appium/webdriver/extensions/android/performance.py
Python
apache-2.0
2,742
import os, sys import shutil import tempfile import subprocess from nose.tools import * from holland.lib.lvm.raw import * from tests.constants import * def test_pvs(): pvs(LOOP_DEV) def test_vgs(): vg, = vgs(TEST_VG) assert_equals(vg['vg_name'], TEST_VG) assert_equals(int(vg['pv_count']), 1) def test...
m00dawg/holland
plugins/holland.lib.lvm/tests/ext3/test_raw.py
Python
bsd-3-clause
1,495
''' Created on Oct 11, 2018 @author: lqp ''' from util import TrackUtil from util.TrackUtil import current_milli_time from pymongo.mongo_client import MongoClient import re import datetime keepDays = 45 def lowerMonth(): millis = current_milli_time() millis -= TrackUtil.oneDayMillis() * keepDays dat...
lqp276/repo_lqp
repopy/src/db/trimRdCollection.py
Python
gpl-2.0
5,924
#!/usr/bin/env python """ Get summary informations of all productions """ import DIRAC from DIRAC.Core.Utilities.PrettyPrint import printTable from DIRAC.Core.Base.Script import Script @Script() def main(): Script.parseCommandLine() from DIRAC.ProductionSystem.Client.ProductionClient import ProductionClient ...
DIRACGrid/DIRAC
src/DIRAC/ProductionSystem/scripts/dirac_prod_get_all.py
Python
gpl-3.0
1,259
from collections import Iterable import numpy as np import tensorflow as tf from . import config from . import utilities from .model import Model, ModelError from .utilities import Description, Region class DistributionError(Exception): pass def _parse_bounds(num_dimensions, lower, upper, bounds): def _pa...
tensorprob/tensorprob
tensorprob/distribution.py
Python
mit
4,354
import os from ..lib.sqlitedict.sqlitedict import SqliteDict db = os.path.join(os.getcwd(),'guifiAnalyzerOut','traffic','8346','data.sqld') linksTable = SqliteDict( filename=db, tablename='links', # create new db file if not exists and rewrite if exists flag='c', autocommit=False) devicesTable = S...
emmdim/guifiAnalyzer
traffic/tests/test.py
Python
gpl-3.0
628
import json import os def entry (outdir:str, name:str, prologue:str, segments:[str]): dfn = os.path.join (outdir, 'entry.json') try: with open (dfn, 'rt') as f: data = json.load (f) except: data = {} try: jp = json.loads (prologue) except: print ('Error decoding:') print (p...
al-niessner/HikingJournal
hj/util/format/json.py
Python
gpl-3.0
991
# The following file contains code from the Klein and Saratoga projects, and are # licensed under the MIT license. # Copyright (c) 2011-2015, Klein Contributors, (c) 2014-2015 HawkOwl # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files ...
erhuabushuo/crossbar
crossbar/adapter/rest/test/request_mock.py
Python
agpl-3.0
4,360
#!/usr/bin/env python from scapy.all import * import binascii import hmac from hashlib import sha1 from time import time from threading import Thread from Queue import Queue import MySQLdb import sys # TO DO: could be fine to parse a JSON file to fetch the value of those parameters rtls_psk = "SECRET" rtls_sta_rep_s...
SK-011/RTLS_server
rtls_server.py
Python
gpl-2.0
5,328
import pythongis as pg dat = pg.VectorData(r"C:\Users\karbah\Dropbox\PRIO\Misc\priocountries\priocountries.shp") # sizes mapp = pg.renderer.Map() mapp.add_layer(dat, fillcolor="yellow", nolegend=True) mapp.add_layer(dat.convert.to_points(), fillsize=dict(breaks="natural", ...
karimbahgat/PythonGis
tests/oldtests/testlegend.py
Python
mit
2,747
import numpy as np def arrange_input_as(xmin, xmax, npoints, func='linear'): """ Arranges data on a given interval according to a given function. :param xmin: lower boundary of the interval :param xmax: upper boundary of the interval :param npoints: number of points the interval should be divided ...
Dominik1123/my_tools
my_tools/data.py
Python
mit
1,341
# Copyright 2019 The gRPC Authors. # # 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 wri...
muxi/grpc
src/python/grpcio_tests/tests_aio/unit/call_test.py
Python
apache-2.0
16,065
# -*- coding: utf-8 -*- import warnings import pytest def func(): warnings.warn(UserWarning("foo")) @pytest.mark.parametrize("i", range(5)) def test_foo(i): func() def test_bar(): func()
cloudera/hue
desktop/core/ext-py/pytest-4.6.11/testing/example_scripts/warnings/test_group_warnings_by_message.py
Python
apache-2.0
206
""" Tests for django test runner """ from __future__ import absolute_import, unicode_literals import sys from optparse import make_option from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command from django import db from django.test import runner, TestCase, TransactionT...
atruberg/django-custom
tests/test_runner/tests.py
Python
bsd-3-clause
14,695
#! /usr/bin/env python import h5py from atom.api import Atom, Typed, Str, Bool, List import enaml from enaml.qt.qt_application import QtApplication import argparse, sys from instruments.InstrumentManager import InstrumentLibrary import Sweeps import MeasFilters import QGL.ChannelLibrary import QGL.Channels import js...
rmcgurrin/PyQLab
ExpSettingsGUI.py
Python
apache-2.0
8,141
#Python 2.7 #Generate factorizations via primes to find divisors from itertools import chain, combinations def powerset(s): #retrieved from itertools documentation return chain.from_iterable(combinations(s, r) for r in range(len(s)+1)) def primes(limit): numbers = [True] * limit for i in range(2, limit): ...
dooleykh/ProjectEuler
23.py
Python
mit
1,423
from .challenge_2 import hex_xor def repeating_key_xor(plaintext, key): counter = 0 ciphertext = '' for c in plaintext: e = hex_xor(bytes.tohex(c), bytes.tohex(key[counter%len(key)])) ciphertext += e counter += 1 return ciphertext
gjtempleton/matasano_cryptopals
set1/challenge_5.py
Python
mit
273
"""useful context managers""" from contextlib import suppress with suppress(ModuleNotFoundError): from lag import * import os import contextlib def clog(*args, condition=True, log_func=print, **kwargs): if condition: return log_func(*args, **kwargs) @contextlib.contextmanager def cd(newdir, verbos...
thorwhalen/ut
util/context_managers.py
Python
mit
908
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import os from twitter.common.collections import OrderedSet from pants.backend.jvm.targ...
twitter/pants
src/python/pants/backend/jvm/tasks/bundle_create.py
Python
apache-2.0
7,733
#!/usr/bin/python # # Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com> # # 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', ...
aperigault/ansible
lib/ansible/modules/cloud/azure/azure_rm_containerinstance_facts.py
Python
gpl-3.0
10,881
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 Nebula, 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 # # ...
1ukash/horizon
horizon/dashboards/project/images_and_snapshots/volume_snapshots/panel.py
Python
apache-2.0
860
from plugin import plugin import random @plugin("give me advice") def advice(jarvis, s): answers = [ "No", "Yes", "You Can Do It!", "I Cant Help You", "Sorry To hear That, But You Must Forget :(", "Keep It Up!", "Nice", "Dont Do It Ever Again", ...
sukeesh/Jarvis
jarviscli/plugins/advice_giver.py
Python
mit
1,950
#!/usr/bin/python from __future__ import unicode_literals, division, absolute_import import inspect import os import sys import yaml import logging import warnings from contextlib import contextmanager from functools import wraps import mock from nose.plugins.attrib import attr from vcr import VCR import flexget.log...
tvcsantos/Flexget
tests/__init__.py
Python
mit
10,416
_printable = dict((chr(i), ".") for i in range(256)) _printable.update((chr(i), chr(i)) for i in range(32, 128)) def hexdump(data, linesize = 16): prettylines = [] if len(data) < 65536: fmt = "%%04X %%-%ds %%s" else: fmt = "%%08X %%-%ds %%s" fmt = fmt % (3 * linesize - ...
larsks/pydonet
lib/pydonet/construct/lib/hex.py
Python
gpl-2.0
1,231
# The MIT License # # Copyright (c) 2008 William T. Katz # # 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,...
unixboy/stashboard
stashboard/handlers/api.py
Python
mit
20,209
#!/usr/bin/env python import os import sys import astropy.units as u import numpy as np from astropy.io import ascii import naima from naima.models import ExponentialCutoffPowerLaw, InverseCompton # Model definition def ElectronIC(pars, data): # Match parameters to ECPL properties, and give them the appropria...
zblz/naima
docs/_static/RXJ1713_IC.py
Python
bsd-3-clause
5,507
import os import sys import cStringIO import gluon.contrib.shell import gluon.dal import gluon.html import gluon.validators import code import thread from gluon.debug import communicate, web_debugger, qdb_debugger import pydoc if DEMO_MODE or MULTI_USER_MODE: session.flash = T('disabled in demo mode...
ccpgames/eve-metrics
web2py/applications/admin/controllers/debug.py
Python
mit
8,078
from google.appengine.ext import ndb import json """ class ContainerState: OPEN = 1 CLOSED = 2 UNKNOWN = 3 TRANSITION = 4 """ class UserChannel(ndb.Model): user_id = ndb.StringProperty(required=True) token = ndb.StringProperty(required=True) active = ndb.BooleanProper...
babelphish/fridge-cop
user_channel.py
Python
agpl-3.0
690
############################################################################### # # The MIT License (MIT) # # Copyright (c) Tavendo GmbH # # 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 with...
FabriceLapeyrere/audiostories-python
server.py
Python
gpl-3.0
1,938
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Aug 6 15:47:09 2017 @author: noore """ import logging from numpy import matrix, load, zeros, sqrt import os from equilibrator_api import settings PREPROCESS_FNAME = os.path.join(settings.DATA_DIR, 'cc_preprocess.npz') class ComponentContribution(obj...
eladnoor/equilibrator-api
equilibrator_api/component_contribution.py
Python
mit
7,793
# coding=utf-8 from django.contrib import admin from forum.models import ForumUser, Plane, Node, Topic, Reply, Favorite, Notification, Transaction, Vote class ForumUserAdmin(admin.ModelAdmin): list_display = ('username', 'email', 'is_active', 'is_staff', 'date_joined') search_fields = ('username', 'email', '...
zhu327/forum
forum/admin.py
Python
mit
1,293
from edc_sync.site_sync_models import site_sync_models site_sync_models.register_for_app('ambition_subject')
botswana-harvard/ambition-subject
ambition_subject/sync_models.py
Python
gpl-3.0
110
from django.contrib import admin from tsj.models import * admin.site.register(Company) admin.site.register(Resident) admin.site.register(House) admin.site.register(ServiceCompany) admin.site.register(MeterType) admin.site.register(MeterReadingHistory) admin.site.register(Employer) admin.site.register(Notification)
dan4ik95dv/housemanagement
tsj/admin.py
Python
mit
317
# -*- coding: utf-8 -*- # # Copyright (c) 2015-2017 Kevin Deldycke <kevin@deldycke.com> # and contributors. # All Rights Reserved. # # 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 F...
kdeldycke/chessboard
chessboard/board.py
Python
gpl-2.0
7,166
# -*- coding: utf-8 -*- """ To customise optimisers including new optimisation methods, learning rate decay schedule, or customise other optional parameters of the optimiser: create a `newclass.py` that has a class `NewOptimisor` and implement `get_instance()`. and set config parameter in config file or from command ...
NifTK/NiftyNet
niftynet/engine/application_optimiser.py
Python
apache-2.0
3,009
# shipBonusMissileLauncherHeavyROFATC1 # # Used by: # Ship: Vangel type = "passive" def handler(fit, ship, context): fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Missile Launcher Heavy", "speed", ship.getModifiedItemAttr("shipBonusATC1"))
bsmr-eve/Pyfa
eos/effects/shipbonusmissilelauncherheavyrofatc1.py
Python
gpl-3.0
300
# -*- coding: utf-8 -*- # # 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 #...
r39132/airflow
airflow/contrib/operators/datastore_export_operator.py
Python
apache-2.0
4,882
# Outspline - A highly modular and extensible outliner. # Copyright (C) 2011-2014 Dario Giovannetti <dev@dariogiovannetti.net> # # This file is part of Outspline. # # Outspline 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 Softw...
xguse/outspline
src/outspline/extensions/organism/queries.py
Python
gpl-3.0
1,677
import logging from django.core.management.base import NoArgsCommand, CommandError from django.conf import settings import friendfeed.friendfeed from friendfeed.models import FriendFeedEntry class Command(NoArgsCommand): help = "Fetch items from FriendFeed, updating our local cache." def handle_noargs(self, *...
mikl/django-friendfeed-zwei
friendfeed/management/commands/friendfeed_fetch.py
Python
mit
2,373
# Django settings for tests project. import os import sys # add path jserrorlogging source dir sys.path.insert(0, os.getcwd()) sys.path.insert(0, os.path.join(os.getcwd(), os.pardir)) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { '...
moqada/django-js-error-logging
tests/tests/settings.py
Python
bsd-3-clause
5,681
#!/usr/bin/env python ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver # Generated: Mon Nov 9 07:56:11 2009 ################################################## from gnuradio import eng_notation from gnuradio import gr from gnuradio import noaa from gnuradio im...
GREO/GNU-Radio
gr-noaa/apps/usrp_rx_hrpt.py
Python
gpl-3.0
16,918
# # Collective Knowledge (checking and installing software) # # See CK LICENSE.txt for licensing details # See CK COPYRIGHT.txt for copyright details # # Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net # cfg={} # Will be updated by CK (meta description of this module) work={} # Will be update...
ctuning/ck
ck/repo/module/soft/module.py
Python
bsd-3-clause
97,841
#!/usr/bin/env python2 # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' from collections import OrderedDict class Inherit: pass inherit = Inher...
hazrpg/calibre
src/calibre/ebooks/docx/block_styles.py
Python
gpl-3.0
16,749
#!/usr/bin/env python """simple thread pool @author: dn13(dn13@gmail.com) @author: Fibrizof(dfang84@gmail.com) """ import threading import Queue import new def WorkerPoolError( Exception ): pass class Task(threading.Thread): def __init__(self, queue, result_queue): threading.Thread.__init__(self) ...
hackshel/py-aluminium
src/__furture__/simplepool.py
Python
bsd-3-clause
3,289
# 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 # d...
spzala/tosca-parser
parser/utils/gettextutils.py
Python
apache-2.0
816
class ConsoleCommand(object): """A decorator that makes a function to be treated as a console command.""" class NotACommand(Exception): pass class ArgsMismatch(Exception): pass def __init__(self, *args): self.args_desc = args def __call__(self, f):...
sh-ft/mudwyrm_engine
mudwyrm_engine/console_command.py
Python
mit
1,681
# -*- coding: utf-8 -*- """ pyglass library ~~~~~~~~~~~~~~~~~~~~~ pyglass extracts QuickLook preview images from files. Basic usage: >>> import pyglass >>> previews = pyglass.preview('design_v1.sketch') >>> previews ['/var/folders/fq/xtn_qh1x6c3drpp3ycytx1fr0000gn/T/pyglassY92Xqs', '/var/folders/fq/x...
Pixelapse/pyglass
pyglass/__init__.py
Python
mit
595
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('page', '0011_auto_20150211_0919'), ] operations = [ migrations.AddField( model_name='richtextentry', ...
glogiotatidis/masterfirefoxos
masterfirefoxos/base/migrate/page/0012_auto_20150211_1114.py
Python
mpl-2.0
1,067
def zwgll(p): """ computes the p+1 Gauss-Lobatto-Legendre nodes z on [-1,1] i.e. the zeros of the first derivative of the Legendre polynomial of degree p plus -1 and 1 and the p+1 weights w """ import numpy as np n = p + 1 z = np.zeros(n, dtype=np.float64) w = np.zeros(n, dtype=np.float64) z[0] ...
maxhutch/sem
sem.py
Python
gpl-3.0
4,045
import requests from scup.bind import bind_method from Queue import Queue class ScupAPI(object): def __init__(self, public_key, private_key, url='http://api.scup.com/1.1', timeout=None, logRequests=False): """ Initialize ScupAPI with user's public and private keys. :param public_key: Use...
gdmachado/scup-python
scup/scup_api.py
Python
mit
5,267
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'scan_dialog_base.ui' # # Created: Sat Jan 7 15:11:01 2017 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 exce...
IZSVenezie/VetEpiGIS-Stat
plugin/scan_dialog.py
Python
gpl-3.0
6,708