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
import requests import urllib from bot_plugins import AbstractPlugin import bleach class StackOverflow(AbstractPlugin.AbstractPlugin): SEARCH_API_URL = 'https://api.stackexchange.com/2.2/search/advanced?pagesize=1&order=desc&sort=relevance&body={}&wiki=False&site=stackoverflow' ANSWER_API_URL = 'https://api....
MShel/PyChatBot
bot_plugins/StackOverflow.py
Python
gpl-3.0
2,263
# BlenderBIM Add-on - OpenBIM Blender Add-on # Copyright (C) 2021 Dion Moult <dion@thinkmoult.com> # # This file is part of BlenderBIM Add-on. # # BlenderBIM Add-on 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 Foundati...
IfcOpenShell/IfcOpenShell
src/blenderbim/blenderbim/tool/library.py
Python
lgpl-3.0
3,118
from math import floor def score_syntax_errors(program_lines): points = {')': 3, ']': 57, '}': 1197, '>': 25137} s = 0 scores_auto = [] for line in program_lines: corrupted, stack = corrupted_character(line) if corrupted: s += points[corrupted] else: s...
matslindh/codingchallenges
adventofcode2021/day10.py
Python
mit
2,156
from django.template import RequestContext from django.shortcuts import render_to_response from django.contrib.auth.decorators import permission_required from django.contrib.auth.decorators import login_required from django.shortcuts import HttpResponseRedirect from models import HRApplication from models import HRApp...
RZN-FFEvo/corpauth
hrapplications/views.py
Python
gpl-2.0
7,724
from django.core.cache import cache from rest_framework import response, schemas from rest_framework.authentication import BasicAuthentication from rest_framework.decorators import api_view, renderer_classes, permission_classes from rest_framework.permissions import AllowAny from rest_framework.response import Response...
EnviroMonitor/EnviroMonitorWeb
api/views.py
Python
gpl-3.0
3,649
# coding:utf-8 """ Validation module that that supports alternate spelling suggestions for domains, MX record lookup and query, as well as custom local-part grammar for large ESPs. This module should probably not be used directly, use addresslib.address unles you are building ontop of the library. Public Functions i...
EncircleInc/addresslib
addresslib/validate.py
Python
apache-2.0
5,490
from lcc.stars_processing.utilities.base_descriptor import BaseDescriptor from lcc.stars_processing.utilities.compare import ComparativeBase from lcc.stars_processing.utilities.symbolic_representation import SymbolicRepresentation class HistShapeDescr(SymbolicRepresentation, ComparativeBase, BaseDescriptor): """ ...
mavrix93/LightCurvesClassifier
lcc/stars_processing/descriptors/hist_shape_descr.py
Python
mit
2,958
""" Copyright (c) 2015 Andreea Georgescu Created on Wed Mar 4 00:47:37 2015 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 License, or (at your option) any later version. ...
SamWitte/Codds_DarkMatter
src/experiment_HaloIndep_Band.py
Python
gpl-2.0
102,335
############################################################################# ## ## Copyright (C) 2015 The Qt Company Ltd. ## Contact: http://www.qt.io/licensing ## ## This file is part of Qt Creator. ## ## Commercial License Usage ## Licensees holding valid commercial Qt licenses may use this file in ## accordance wit...
frostasm/qt-creator
tests/system/suite_WELP/tst_WELP04/test.py
Python
gpl-3.0
4,695
from django.contrib.auth.models import User from rest_framework.authtoken.models import Token from django.db.models.signals import post_save from django.dispatch import receiver @receiver(post_save, sender=User) def create_auth_token(sender, instance=None, created=False, **kwargs): """ Creates a token wheneve...
mava-ar/sgk
src/dj_auth/signals.py
Python
apache-2.0
408
import milk.measures.measures import milk.measures.curves import numpy as np import numpy from milk.measures import accuracy, waccuracy, bayesian_significance def test_100(): C=numpy.zeros((2,2)) C[0,0]=100 C[1,1]=50 assert accuracy(C) == 1. assert waccuracy(C) == 1. def test_0(): C = numpy.ar...
pombredanne/milk
milk/tests/test_measures.py
Python
mit
1,527
#!/usr/bin/env python # -*- coding: UTF-8 -*- # # Copyright (c) 2020 ASMlover. 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...
ASMlover/study
python/tadpole/chunk.py
Python
bsd-2-clause
2,952
import _modeller class AtomType(object): """An atom type, as defined in the topology and other library files""" def __init__(self, mdl, num): self.mdl = mdl self._num = num def __str__(self): return "<%s>" % repr(self) def __repr__(self): return "Atom type %s" % self.n...
bjornwallner/proq2-server
apps/modeller9v8/modlib/modeller/atom_type.py
Python
gpl-3.0
1,457
#!/usr/bin/env python # -*- coding: utf-8 -*- # programa2.py - Exemplo de Endentação def main (): x = 1 while True: print(x) if x > 5: break else: print('menor') x += 1 x = 0 print('fim.') def nao_implementado(): pass if __name__ == '_...
juliogc/learn
py/learn/python/programa2.py
Python
mit
359
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Tests for monthly workflows""" import datetime import freezegun from ggrc import app # noqa #pylint: disable=unused-import from ggrc import db from ggrc_workflows import models from integration.ggrc_w...
andrei-karalionak/ggrc-core
test/integration/ggrc_workflows/workflow_cycle_calculator/test_one_time_workflow.py
Python
apache-2.0
12,180
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This class is very simple and is stateless """ import requests import random import jieba import re import numpy as np from query_util import QueryUtils import cn_util class SimpleSingKernel: null_anwer = ['额...我只会唱周杰伦的星睛,轨迹,七里香'] # null_answer = ['null'] ...
aquadrop/solr_py
client/sc_sing_kernel.py
Python
gpl-3.0
2,321
# encoding: utf-8 ############################################################################## # # patch for download preview # Copyright (C) 2014 zkjiao@gmail.com # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License a...
mmbtba/patch_download_preview
__openerp__.py
Python
agpl-3.0
1,501
#!/usr/bin/env python #################################### # # --- TEXTPATGEN TEMPLATE --- # # Users can change the output by editing # this file directly. # #################################### import sys sys.stdout.write('####################################\n') sys.stdout.write('#\n') sys.stdout.write('# -- TEXTP...
kevinleake01/textpatgen
12-workspace-py/tpl-py-0001.py
Python
gpl-2.0
774
from django.conf.urls import include, url urlpatterns = [ url(r'^$', 'moviepicker.views.home', name='home'), url(r'^(?P<username>)/$', 'moviepicker.views.watcher_details', name='watcher_details'), url(r'^get-results/$', 'moviepicker.views.get_results', name='get_results'), url(r'^(?P<username>)/votes/...
all-out/all-out-website
moviepicker/urls.py
Python
apache-2.0
466
import os import sys sys.path.append('./') from crayimage.simulation import order_tracks import numpy as np def test_ordering(): for i in range(10): p1 = np.random.uniform(0.0, 1.0) p2 = np.random.uniform(0.0, 1.0) dxs = np.random.binomial(2, p=p1, size=100) - 1 dys = np.random.binomial(2, p=p2, si...
yandexdataschool/crayimage
tests/simulation/test_ordering.py
Python
mit
656
"""RSS feed for pso2.jp Scrape RSS feed from pso2.jp/players/ and convert it into markdown links to Google translated links of the RSS URLs. Attributes: cache: String of the last parsed RSS data """ import aiohttp import asyncio import datetime as dt import html import re import urllib.parse import SLA_bot.confi...
EsqWiggles/SLA-bot
SLA_bot/module/pso2rss.py
Python
mit
2,896
def PE_004(): max = 0 curr = 0 for num1 in range (100, 1000, 1): for num2 in range(100, 1000, 1): curr = num1 * num2 if (str(curr) == str(curr)[::-1] and curr > max): max = curr return max print (PE_004())
NickDarling/ProjectEuler
PE_004.py
Python
mit
275
#!/usr/bin/env python # # Copyright 2015 Free Software Foundation, Inc. # # GNU Radio 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, or (at your option) # any later version. # # GNU Radio is...
iohannez/gnuradio
gr-fec/python/fec/polar/channel_construction_awgn.py
Python
gpl-3.0
8,712
import sys from copy import copy from itertools import chain from numpy import * from copy import deepcopy from scipy.signal import medfilt as MF from scipy.stats import scoreatpercentile as sap from numpy.random import normal from .core import * from .lpf import * from .extcore import * from .lpf import CLPF from .l...
hpparvi/Parviainen-2017-WASP-80b
src/lpfmr.py
Python
mit
3,078
import getopt import sys class opts: def __init__(self, name, options, *usage_thunks): self.name = name self.options = options self.usage_thunks = usage_thunks self.options['help'] = \ {'shortOpt': '?', 'longOpt': 'help', 'type': 'help', 'desc': "Print ...
DarthMaulware/EquationGroupLeaks
Leak #4 - Don't Forget Your Base/EQGRP-Auction-File/Linux/bin/earlyshovel/opts.py
Python
unlicense
3,073
# -*- coding: utf-8 -*- #The MIT License (MIT) # #Copyright (c) 2015,2018 Sami Salkosuo # #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 r...
samisalkosuo/clipasswordmgr
clipwdmgr/commands/AddAccountCommand.py
Python
mit
3,179
# 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 a...
sajuptpm/neutron-ipam
neutron/db/migration/alembic_migrations/env.py
Python
apache-2.0
3,032
#!/usr/bin/env python # This file is part of Fusion-icon. # Fusion-icon 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. # # Fusion-ic...
smolleyes/fusion-icon
FusionIcon/util.py
Python
gpl-2.0
11,154
# Copyright 2016 IBM Corp # 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 appl...
vganapath/rally
rally/plugins/openstack/scenarios/nova/hosts.py
Python
apache-2.0
1,339
from .demon_hunter import *
jleclanche/fireplace
fireplace/cards/initiate/__init__.py
Python
agpl-3.0
28
# Apache Thrift Network Transport in Python from thrift.transport import TSocket from thrift.transport import TTransport def read_trans(t): while (True): try: data = t.read(4096) if len(data) > 0: print(data) else: break ...
RandyAbernethy/ThriftBook
part2/transports/net/sock_trans.py
Python
apache-2.0
621
import sys import math # Assume if x is too small that it is at least 1e-323 def safelog(x): if x < 1e-323: return -743.74692474082133 # math.log(1e-323) return math.log(x) def usage(): print sys.argv[0], " <disease-profiles> <gene-profiles>" print "Compare disease profiles to gene-profile...
wac/meshop
profile_gd_predict/cmp-profile.py
Python
isc
9,725
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models class StockPickingType(models.Model): _inherit = 'stock.picking.type' code = fields.Selection(selection_add=[('mrp_operation', 'Manufacturing Operation')]) count_mo_todo = f...
richard-willowit/odoo
addons/mrp/models/stock_picking.py
Python
gpl-3.0
1,559
class AccountMailer: pass
toolmakers/ahoy
application/web/app/mailers/account_mailer.py
Python
bsd-2-clause
31
#!/usr/bin/python import sys import math from klampt import * from klampt import WidgetSet,PointPoser,RobotPoser from klampt.glprogram import * class GLWidgetProgram(GLRealtimeProgram): """A base class for using widgets. Right-clicks are passed onto widgets. Subclasses should call self.widgetMaster.add(...
bbgw/Klampt
Python/demos/widgets.py
Python
bsd-3-clause
3,863
from ghosh import GhoshModel from ghosh import LOG_FILE, MODEL_FILE
cosanlab/emote
v2/ghosh/__init__.py
Python
mit
68
#! /usr/bin/env python import numpy as np import subprocess as sp import os import sys try: import h5py except: print("h5py package not avilable -- using ascii conversion") from .rawdata import RawData from .pplexceptions import DataNotAvailable class Channelflow_RawData(RawData): def __init__(self,f...
edwardsmith999/pyDataView
postproclib/channelflowrawdata.py
Python
gpl-3.0
11,325
"""Controller for the reports module Author: Logan Gore This file is responsible for loading all site pages under /reports. """ from datetime import datetime from datetime import timedelta from flask import Blueprint from flask import flash from flask import jsonify from flask import redirect from flask import rende...
gorel/dli-reports
dli_app/mod_reports/controllers.py
Python
mit
21,847
""" hostdev device support class(es) http://libvirt.org/formatdomain.html#elementsHostDev """ from virttest.libvirt_xml.devices import base class Hostdev(base.TypedDeviceBase): #TODO: Write this class __metaclass__ = base.StubDeviceMeta _device_tag = 'hostdev' _def_type_name = 'pci'
sathnaga/virt-test
virttest/libvirt_xml/devices/hostdev.py
Python
gpl-2.0
303
import openpyxl from openpyxl.utils import get_column_letter wb = openpyxl.load_workbook('flip.xlsx') sheet = wb.active max_row = sheet.max_row max_column = sheet.max_column sheetData = [[0 for col in range(max_column)] for row in range(max_row)] for i in range(1, max_row + 1): for j in range(1, max_column + 1):...
sallyyoo/ced2
py/practice/12/flip.py
Python
mit
811
#ΪÔö¼ÓÑ¡Ôñ·¢ËÍ·½Ê½¹¦ÄܶøÐ޸ĽçÃæ£¬Í¬Ê±ÃÀ»¯----·ÂQQ½çÃæ #µã»÷Õ¹¿ª»òÊÕÆð·¢ËÍ·½Ê½Ñ¡Ôñ²Ëµ¥ #ʹÓÃjQuery¿â£¬¸ÄÉÆÁ˼æÈÝÐÔÎÊÌâ #ʵÏÖ×Ô¶¨ÒåEnter»òCtrl+Enter·¢Ë͹¦ÄÜ #µÚÒ»´Î´ò¿ªÊ±»ñÈ¡×îºó100Ìõ¼Ç¼£¨Ô­±¾ÊÇ×îǰµÄ100Ìõ£¬ÊÇΪÁ˲âÊÔÆäËü¹¦ÄܶøÌáǰ¼ÓµÄ£©£¬²¢°´Ê±¼äÅÅÐò #Îı¾¿òΪ¿Õʱ×èÖ¹·¢ËÍ #µ÷Õû³õʼ»¯µÄ100Ìõ¼Ç¼µÄ·¢Ë͸ñʽºÍʱ¼ä£...
chenss/ChatRoom
14 美化聊天界面 适应更多尺寸的屏幕 增加测试用的个人主页 由于上传问题版本号改为2/todo.py
Python
gpl-2.0
1,179
# -*- coding: utf-8 -*- # MLC (Machine Learning Control): A genetic algorithm library to solve chaotic problems # Copyright (C) 2015-2017, Thomas Duriez (thomas.duriez@gmail.com) # Copyright (C) 2015, Adrian Durán (adrianmdu@gmail.com) # Copyright (C) 2015-2017, Ezequiel Torres Feyuk (ezequiel.torresfeyuk@gmail.com) # ...
MachineLearningControl/OpenMLC-Python
MLC/Common/PreevaluationManager.py
Python
gpl-3.0
3,071
# # 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 us...
lukecwik/incubator-beam
sdks/python/apache_beam/utils/profiler.py
Python
apache-2.0
5,998
#!/usr/bin/python import sys import stat import os import re import shutil import subprocess import urlparse import urllib import urllib2 import json import socket import random import argparse import signal import time import atexit import traceback from abc import ABCMeta, abstractmethod from kazoo.client import Kazo...
appsoma/gandalf
pegboard.py
Python
gpl-2.0
37,204
"""Get WHOIS information for a given host.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from datetime import datetime, timezone from typing import cast from whois import Domain from homeassistant.components.sensor import ( SensorDeviceClass, Sen...
rohitranjan1991/home-assistant
homeassistant/components/whois/sensor.py
Python
mit
6,901
# Copyright (C) 2010 Oregon State University et al. # # 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 License, or (at your option) any later version. # # This program i...
dmS0Zq/ganeti_webmgr
ganeti_webmgr/authentication/tests/views.py
Python
gpl-2.0
10,969
"""Tests for google analytics snippets""" from dxr.testing import DxrInstanceTestCase from nose.tools import ok_ class GoogleAnalyticsMarkupTests(DxrInstanceTestCase): def test_google_analytics_snippet_exists(self): """Make sure google analytics snippet does show up""" response = self.client().g...
jbradberry/dxr
tests/test_google_analytics/test_google_analytics.py
Python
mit
442
import unittest import pymongo from .. import signals from .. import models # SIGNAL TESTS models.mongodb_database = pymongo.MongoClient().test_database class BaseModel(models.Model): _collection = 'testmodel' def __init__(self): super(BaseModel, self).__init__() self.a = 1 self.b ...
mind1master/miongo
miongo/tests/test_signals.py
Python
mit
4,300
#!/usr/bin/python -tt """ Description will eventually go here. """ ## # Copyright (C) 2003 by Duke University # # 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 License,...
mr/epylog-modules
modules/logins_mod.py
Python
gpl-2.0
29,840
#!/usr/bin/env python ''' API Authentication ''' from flask import g, jsonify, request, redirect, url_for from flask.ext.httpauth import HTTPBasicAuth from ooiservices.app import db from ooiservices.app.models import User from ooiservices.app.main import api from ooiservices.app.main.errors import unauthorized from oa...
oceanzus/ooi-ui-services
ooiservices/app/main/authentication.py
Python
apache-2.0
3,078
from vsg import violation from vsg.rule_group import structure from vsg.vhdlFile import utils class remove_tokens(structure.Rule): ''' Removes a token and duplicate whitespace. Parameters ---------- name : string The group the rule belongs to. identifier : string unique iden...
jeremiah-c-leary/vhdl-style-guide
vsg/rules/remove_tokens.py
Python
gpl-3.0
1,121
from Naked.toolshed.shell import execute import sqlite3 import json from wutu.util import * from wutu.compiler.common import create_stream from wutu import Wutu os.chdir(os.path.join(os.path.dirname(os.path.realpath(__file__)), "tests")) class AppMock(object): @staticmethod def route(rule, endpoint, **options...
zaibacu/wutu
wutu/test_util.py
Python
mit
4,303
#! /usr/bin/env python import re import sys f = open(sys.argv[1],'U') lines = f.readlines() x = ''.join(lines) ingredients = re.findall(r"\[([^[]+)\]", x) for s in [k for k in lines if k.startswith('Serves:')]: print s.strip() for x in ingredients: print ' -',x #todo from each ingredient take $\d+[^\w] as a 'me...
benpage26/octospice
shop_list.py
Python
mit
536
""" Tests for permissions defined in courseware.rules """ import ddt import six from django.test import TestCase from opaque_keys.edx.locator import CourseLocator from course_modes.tests.factories import CourseModeFactory from student.models import CourseEnrollment from student.tests.factories import UserFactory @...
cpennington/edx-platform
lms/djangoapps/courseware/tests/test_rules.py
Python
agpl-3.0
1,680
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ai ts=4 sts=4 et sw=4 nu from __future__ import (unicode_literals, absolute_import, division, print_function) import os import tempfile import zipfile from pprint import pprint as pp from multiprocessing.dummy import Pool import requests fro...
kiwix/gutenberg
gutenbergtozim/download.py
Python
gpl-3.0
8,092
""" Plot gas, tar, char from primary and secondary reactions as determined by the Blasi 1993 kinetic scheme for biomass pyrolysis. Reference: Blasi, 1993. Combustion Science and Technology, 90, pp 315–340. """ import numpy as np import matplotlib.pyplot as py # Parameters # ------------------------------------------...
pyrolysis/kinetic-schemes
blasi_1993.py
Python
mit
5,133
__all__ = [ 'check_numpy', ] __displayname__ = 'Version Verifier' try: from ._helpers import PVGeoError except ImportError: PVGeoError = RuntimeError def check_numpy(alert='print'): """A method to check the active environment's version of NumPy for compatibility with PVGeo. Args: al...
banesullivan/ParaViewGeophysics
PVGeo/version.py
Python
bsd-3-clause
1,027
import os import shutil import unittest from flask import json class NewsView(unittest.TestCase): def setUp(self): import web reload(web) self.app = web.app.test_client() def tearDown(self): try: shutil.rmtree('urlshortner') except: pass def...
loogica/urlsh
test_views.py
Python
mit
2,651
from __future__ import unicode_literals from django.db import transaction from django.db import models from django.contrib.auth.models import User # Create your models here. class UserProfile(models.Model): user = models.OneToOneField(User, unique=True, verbose_name=('user')) phone = models.CharField(max_leng...
passren/Roxd
member/models.py
Python
gpl-2.0
727
""" This is a power regulator module. |br| *Examples*: Please go to the *examples/signals* directory for examples on how to use the regulator. |br| *Settings*: Parameters of the regulator are described below. Take a look on '__parametersDefine' function for more info on the parameters. Par...
JacekPierzchlewski/RxCS
rxcs/sig/powerRegulator.py
Python
bsd-2-clause
5,047
''' (*)~--------------------------------------------------------------------------- Pupil - eye tracking platform Copyright (C) 2012-2017 Pupil Labs Distributed under the terms of the GNU Lesser General Public License (LGPL v3.0). See COPYING and COPYING.LESSER for license details. -----------------------------------...
teamCarel/EyeTracker
src/shared_modules/csv_utils.py
Python
lgpl-3.0
2,645
#pythran export approximated_callgraph(int) #runas approximated_callgraph(100) #bench approximated_callgraph(250) def call(i, j): return i+j def approximated_callgraph(size): out= list() for i in xrange(size): out.append(map(lambda j:call(i, j), xrange(size))) return out
hainm/pythran
pythran/tests/cases/approximated_callgraph.py
Python
bsd-3-clause
297
#!/usr/bin/env python3 -W ignore::DeprecationWarning __author__ = "Ryan Delaney" __email__ = "ryan.delaney@gmail.com" __copyright__ = """© Copyright 2016-2018 Ryan Delaney. All rights reserved. This work is distributed WITHOUT ANY WARRANTY whatsoever; without even the implied warranty of MERCHANTABILITY or FITNESS F...
rpdelaney/python-chess-annotator
annotator/__main__.py
Python
gpl-3.0
26,504
"""Hierarchical MVC example The difference between this and minimal.py is that the `items` data structure is hierarchical/nested as opposed to one-dimensional. Layout: _________________________________ | _____________________________ |<----- controller | | | | | | | | | | |...
madoodia/codeLab
pyside/test_marcus_hierarchical.py
Python
mit
17,447
# dagCcy.py class DAG(object): # functionality '''''Base DAG''' __shared_state = {} # would be nice to use a collections.OrderedDict() def __init__(self): self.__dict__ = self.__shared_state def setValue(self,n,v): if v == n.value: return # build the DAG n...
mhallett/MeDaReDa
demos/demo1/src/dagCcy.py
Python
mit
2,827
from . import payment_acquirer
mozaik-association/mozaik
mozaik_membership_payment_stripe/models/__init__.py
Python
agpl-3.0
31
''' Problem Statement: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? Extended Problem Statement: What is the Nth prime number? ''' def is_prime(n): for i in range(2, n//2 + 1): if n % i == 0: return False return True n ...
CodeVITap/ProjectEuler
python/007.py
Python
gpl-3.0
423
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Original Module by SIESA (<http://www.siesacr.com>) # Refactored by CLEARCORP S.A. (<http://clearcorp.co.cr>) # # This program is free software: you can redis...
3dfxsoftware/cbss-addons
account_invoice_pricelist/__init__.py
Python
gpl-2.0
1,082
# Generated by Django 3.0.6 on 2021-01-09 23:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ms1analysis', '0008_auto_20170509_2103'), ] operations = [ migrations.AlterField( model_name='analysis', name='statu...
sdrogers/ms2ldaviz
ms2ldaviz/ms1analysis/migrations/0009_auto_20210109_2301.py
Python
mit
698
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import eventlet import gevent class WampyTimeOut(gevent.Timeout, eventlet.Timeout): pass
noisyboiler/wampy
wampy/backends/errors.py
Python
mpl-2.0
295
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
sileht/pifpaf
pifpaf/drivers/memcached.py
Python
apache-2.0
1,385
from datetime import datetime import time from django.contrib.auth import get_user_model from django.contrib.auth.models import Group, Permission from django.utils.text import slugify from html5lib.filters._base import Filter as html5lib_Filter from nose.tools import nottest from waffle.models import Flag from kuma....
utkbansal/kuma
kuma/wiki/tests/__init__.py
Python
mpl-2.0
6,137
# -*- coding: utf-8 -*- from logging import getLogger from django.conf import settings from django.contrib import messages from django.contrib.sites.models import Site from django.core.cache import cache from django.core.exceptions import ValidationError from django.core.urlresolvers import NoReverseMatch from django...
jeffreylu9/django-cms
menus/menu_pool.py
Python
bsd-3-clause
12,402
from authlib.jose import jwt # It is already a JsonWebToken object from authlib.jose import JsonWebToken # Encoding # good - key and algorithm supplied jwt.encode({"alg": "HS256"}, token, "key") JsonWebToken().encode({"alg": "HS256"}, token, "key") # bad - empty key jwt.encode({"alg": "HS256"}, token, "") JsonWebTo...
github/codeql
python/ql/test/experimental/query-tests/Security/CWE-347/authlib.py
Python
mit
507
def gauss(n): return (n*(n+1))/2 def piramide_truncada(inicio, fin): return gauss(fin) - gauss(inicio) def piramide(fichas): nivel = 1 total = gauss(nivel) while fichas > total: nivel += 1 total = gauss(nivel) if fichas < total: inicio = 2 fin = nivel ...
israelem/aceptaelreto
codes/2017-12-18-fichas_domino.py
Python
mit
788
# Copyright 2013 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Test node constraint forms.""" from __future__ import ( absolute_import, print_function, unicode_literals, ) str = None __metaclass__ = type __all__ = [] fro...
cloudbase/maas
src/maasserver/tests/test_node_constraint_filter_forms.py
Python
agpl-3.0
11,888
# Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
google/sling
python/myelin/builder.py
Python
apache-2.0
16,412
"""Mongodb implementations of resource sessions.""" # pylint: disable=no-init # Numerous classes don't require __init__. # pylint: disable=too-many-public-methods,too-few-public-methods # Number of methods are defined in specification # pylint: disable=protected-access # Access to protected methods allowed...
birdland/dlkit-doc
dlkit/mongo/resource/sessions.py
Python
mit
139,556
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy class BlogItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() id = scrapy.Field() title = scrapy.Fie...
GavinZhuLei/spider_study
newblogs/newblogs/items.py
Python
apache-2.0
463
# # 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...
spektom/incubator-airflow
airflow/utils/cli.py
Python
apache-2.0
8,836
# Author: illuz <iilluzen[at]gmail.com> # File: AC_binary_search_logn.py # Create Date: 2015-02-02 22:15:22 # Descripton: class Solution: def findKthSortedArrays(self, A, B, k): if len(A) < len(B): tmp = A A = B B = tmp if len(B) == 0: ...
bssrdf/leetcode-7
solutions/004.Median_of_Two_Sorted_Arrays/AC_binary_search_logn.py
Python
gpl-2.0
1,115
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 Fortinet, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lic...
roadmapper/ansible
lib/ansible/modules/network/fortios/fortios_router_policy.py
Python
gpl-3.0
17,342
""" Sponge Knowledge Base Fibonacci numbers Note that this example is intended ONLY to show how to send a chain of events (each carrying a Fibonacci number as an attribute). If you need to generate the Fibonacci numbers you should use a simpler method. """ maxIndex = 100 def onInit(): sponge.setVariable("f(maxInd...
softelnet/sponge
sponge-integration-tests/examples/core/fibonacci.py
Python
apache-2.0
1,254
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file from waflib.Tools import ar,d from waflib.Configure import conf @conf def find_ldc2(conf): conf.find_program(['ldc2'],var='D') out=conf.cmd_and_log(conf.env.D+['-version']) if out.find("based on D...
Gnurou/glmark2
waflib/Tools/ldc2.py
Python
gpl-3.0
937
"""The tests for the device tracker component.""" # pylint: disable=protected-access import asyncio import json import logging import unittest from unittest.mock import call, patch from datetime import datetime, timedelta import os from homeassistant.components import zone from homeassistant.core import callback, Stat...
MungoRae/home-assistant
tests/components/device_tracker/test_init.py
Python
apache-2.0
29,746
# # GtkMain.py -- pygtk threading help routines. # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # """ GUI threading help routines. Usage: import GtkMain # See c...
Rbeaty88/ginga
ginga/gtkw/GtkMain.py
Python
bsd-3-clause
5,866
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-03-15 15:32 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0114_project_enabled_plugin_list_can_be_blank'), ...
Linaro/squad
squad/core/migrations/0115_fix_slug_validation.py
Python
agpl-3.0
1,395
from others import sms_request print(sms_request('15683000435', '123456'))
mrcodehang/cqut-chat-server
test/test_http.py
Python
mpl-2.0
75
#!/usr/bin/env python # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2011-2019 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a co...
quattor/aquilon
tests/broker/test_add_router_address.py
Python
apache-2.0
9,284
# coding=utf-8 # Copyright 2022 The Google Research 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 applicab...
google-research/google-research
video_structure/train.py
Python
apache-2.0
4,778
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. # # This copy of Ice is licensed to you under the terms described in the # ICE_LICENSE file included in this distribution. # # *************************************...
joshmoore/zeroc-ice
cs/test/Ice/interceptor/run.py
Python
gpl-2.0
997
""" Data migration creation command """ from __future__ import print_function import sys import os import re from optparse import make_option try: set except NameError: from sets import Set as set from django.core.management.base import BaseCommand from django.core.management.color import no_style from djan...
havard024/prego
venv/lib/python2.7/site-packages/south/management/commands/datamigration.py
Python
mit
5,038
import os import sys sys.path.append('../..') import numpy from anna import util from anna.datasets import supervised_dataset from models import CNNModel print('Start') pid = os.getpid() print('PID: {}'.format(pid)) f = open('pid', 'wb') f.write(str(pid)+'\n') f.close() model = CNNModel('experiment', './', learni...
ifp-uiuc/an-analysis-of-unsupervised-pre-training-iclr-2015
cifar10/1_to_1/cnn_ad/train.py
Python
bsd-3-clause
1,959
from matrix.constants import DECOMPOSITION_TYPES from matrix.constants import UNIVERSAL_PERMUTATION_METHODS as PERMUTATION_METHODS """ Supported permutation methods for decompose dense matrices. """
jor-/matrix-decomposition
matrix/dense/constants.py
Python
agpl-3.0
199
''' Most Pensool decorators for debug, transform, invalidate. See also picking. Generically: functions that modify other functions i.e. metaprogramming. Like macros. Specifically, modify function calls with pre- and post- operations. ''' ''' Copyright 2010, 2011 Lloyd Konneker This file is part of Pensool. Penso...
bootchk/pensool
source/decorators.py
Python
gpl-3.0
3,699
""" * This file is part of chiplotle. * * http://music.columbia.edu/cmc/chiplotle """ from chiplotle.plotters.drawingplotter import _DrawingPlotter class DPX3300(_DrawingPlotter): def __init__(self, ser, **kwargs): self.allowedHPGLCommands = tuple(['\x1b.', 'AA','AR','BL','CA','CC', 'CI','CP','C...
drepetto/chiplotle
chiplotle/plotters/dpx3300.py
Python
gpl-3.0
752
# 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 distributed in the hope that it will be useful, # bu...
santazhang/BitTorrent-4.0.0-GPL
BitTorrent/parseargs.py
Python
gpl-3.0
5,039
#=============================================================================== # Copyright (c) 2015, Max Zwiessele # 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...
sods/paramz
paramz/core/pickleable.py
Python
bsd-3-clause
5,751
# -*- 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 NfbcPipeline(object): def process_item(self, item, spider): return item
mattdennewitz/mlb-nfbc-adp-importer
nfbc/nfbc/pipelines.py
Python
mit
284
""" Input Data Usage Analysis - Unit Tests ====================================== :Authors: Caterina Urban and Simon Wehrli and Lowis Engel """ import glob import os import unittest import sys from lyra.abstract_domains.usage.usage_domain import SimpleUsageState from lyra.engine.backward import BackwardInterpreter...
caterinaurban/Lyra
src/lyra/unittests/usage_tests.py
Python
mpl-2.0
1,771