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 |
|---|---|---|---|---|---|
# Generated by Django 3.1.13 on 2021-10-22 12:55
from django.db import migrations
import uuid
def gen_uuid(apps, schema_editor):
MyModel1 = apps.get_model('outdoor', 'course')
MyModel2 = apps.get_model('outdoor', 'site')
for row in MyModel1.objects.all():
row.uuid = uuid.uuid4()
row.save(... | GeotrekCE/Geotrek-admin | geotrek/outdoor/migrations/0034_auto_20211022_1255.py | Python | bsd-2-clause | 639 |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column
from sqlalchemy.types import String, Integer, Boolean, Text, Date
from webapp.libs.mediahelper import MediaHelper
Base = declarative_base()
class Schedule(Base):
__tablename__ = "schedule"
schedule_id = Column(I... | crocodilered/insideout | webapp/libs/models/schedule.py | Python | mit | 712 |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~... | bmi-forum/bmi-pyre | pythia-0.8/packages/pyre/tests/applications/hello.py | Python | gpl-2.0 | 2,202 |
class MultiCodec(object):
"""
A codec which simply composes together a chain of other codecs
"""
def __init__(self, *codecs):
self.codecs = codecs
def encode(self, data):
for codec in self.codecs:
data = codec.encode(data)
return data
def decode(self, dat... | gamechanger/topical | topical/codecs/multi.py | Python | mit | 426 |
from DIRAC import gConfig, gLogger
from DIRAC.DataManagementSystem.DB.DataIntegrityDB import DataIntegrityDB
def test():
""" Some test cases
"""
host = '127.0.0.1'
user = 'Dirac'
pwd = 'Dirac'
db = 'DataIntegrityDB'
gConfig.setOptionValue( '/Systems/DataManagement/Test/Databases/DataIntegrityDB/Host', ... | Andrew-McNab-UK/DIRAC | tests/Integration/DataManagementSystem/Test_DataIntegrityDB.py | Python | gpl-3.0 | 3,658 |
import Pyro4
import socket
import sys
import yasnac.remote.erc as erc
sys.excepthook = Pyro4.util.excepthook
def main() :
# Need to get local ip address in order to bind the pyro daemon..
# socket.gethostbyname(socket.gethostname()) gives 127.0.0.1.
# So do the gross thing
s = socket.socket(socket.AF... | b3sigma/robjoy | serve_erc.py | Python | gpl-3.0 | 767 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Vauxoo
# Author: Osval Reyes, Yanina Aular
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | ddico/rma | rma/__init__.py | Python | agpl-3.0 | 939 |
class Solution(object):
def count_bits(self, n):
c = (n - ((n >> 1) & 0o33333333333) - ((n >> 2) & 0o11111111111))
return ((c + (c >> 3)) & 0o30707070707) % 63
def countBits(self, num):
"""
:type num: int
:rtype: List[int]
"""
return map(self.count_bits, x... | ckclark/leetcode | py/counting-bits.py | Python | apache-2.0 | 336 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .. import users
from ..models import GitHubCore
class IssueEvent(GitHubCore):
"""The :class:`IssueEvent <IssueEvent>` object. This specifically deals
with events described in the
`Issues\>Events <http://developer.github.com/v3/issues/ev... | balloob/github3.py | github3/issues/event.py | Python | bsd-3-clause | 2,480 |
from mock import patch
import mock
from builtins import bytes
from lxml import etree
from pytest import raises
from collections import namedtuple
from kiwi.xml_description import XMLDescription
from kiwi.exceptions import (
KiwiSchemaImportError,
KiwiValidationError,
KiwiDescriptionInvalid,
KiwiDataSt... | b1-systems/kiwi | test/unit/xml_description_test.py | Python | gpl-3.0 | 12,634 |
"""
Django settings for rms project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Bui... | iu5team/rms | rms/settings.py | Python | mit | 3,227 |
from setuptools import setup, find_packages
setup(name='BIOMD0000000223',
version=20140916,
description='BIOMD0000000223 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000223',
maintainer='Stanley Gu',
maintainer_url='[email protected]',
packages=find_packages(... | biomodels/BIOMD0000000223 | setup.py | Python | cc0-1.0 | 377 |
from __future__ import unicode_literals
from django.apps import AppConfig
class RootConfig(AppConfig):
name = 'root'
| PyConPune/pune.pycon.org | root/apps.py | Python | mit | 124 |
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
#
# __main__.py
# @Author : Gustavo F ([email protected])
# @Link : https://github.com/sharkguto
# @Date : 17/02/2019 10:13:23
import time
from ims24.services.extractor import Extractor
from ims24 import logger
from ims24.services.haus import ExtractorHaus
de... | fclesio/learning-space | Python/ims24/ims24/__main__.py | Python | gpl-2.0 | 857 |
import mock
from datetime import datetime
from django.contrib.auth.models import User
from django.test import TestCase
from mediaviewer.models.file import File
from mediaviewer.models.filenamescrapeformat import FilenameScrapeFormat
from mediaviewer.models.path import Path
from mediaviewer.models.usersettings import... | kyokley/MediaViewer | mediaviewer/tests/models/test_file.py | Python | mit | 13,668 |
#!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database2 repository')
api.version_co... | lawrluor/matchstats | db_create.py | Python | bsd-3-clause | 518 |
import copy
import sys
def configMake(L, N, prevList, totList):
if L==1:
endList = [copy.deepcopy(prevList), N]
totList.append(unfold(endList))
return [N]
if N==0:
return configMake(L-1, 0, [copy.deepcopy(prevList), 0], totList)
if L==N:
return configMake(L-1, N-1, [c... | joshuahellier/PhDStuff | codes/thesisCodes/correlationFunctions/exactDist.py | Python | mit | 2,644 |
"""
Windows Process Control
winprocess.run launches a child process and returns the exit code.
Optionally, it can:
redirect stdin, stdout & stderr to files
run the command as another user
limit the process's running time
control the process window (location, size, window state, desktop)
Works on Windows NT, 20... | alexei-matveev/ccp1gui | jobmanager/winprocess.py | Python | gpl-2.0 | 7,039 |
import curses
import logging
import common
from pycurses_widgets import Screen, StatusBar, CommandBar, TitleBar, TextPanel, TabPanel, ItemList
from .commandhandler import CommandHandler
class Window(Screen):
def __init__(self, win):
super(Window, self).__init__(win)
self.title = TitleBar(self)
... | franckv/pygmail | src/ui/ncurses/window.py | Python | gpl-3.0 | 2,371 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis_louvain | base/tests/templatetags/test_offer_year_calendar_display.py | Python | agpl-3.0 | 4,161 |
'''
@date Mar 28, 2010
@author: Matthew A. Todd
This file is part of Test Parser
by Matthew A. Todd
Test Parser 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... | matcatc/Test_Parser | src/TestParser/View/Tkinter/TkResultView.py | Python | gpl-3.0 | 13,664 |
# coding: utf-8
import types
from girlfriend.workflow.gfworkflow import (
Workflow,
Context
)
from girlfriend.util.lang import ObjDictModel
from girlfriend.util.config import Config
from girlfriend.plugin import plugin_mgr
class WorkflowBuilder(object):
def __init__(self):
self._clazz = Workflow
... | chihongze/girlfriend | girlfriend/workflow/builder/__init__.py | Python | mit | 2,180 |
"""
Matplotlib Animation Example
author: Jake Vanderplas
email: [email protected]
website: http://jakevdp.github.com
license: BSD
Please feel free to use and modify this, but keep the above information. Thanks!
"""
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
i... | asurafire/PSO | animation_test.py | Python | mit | 3,252 |
# -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
import os
import imp
import sys
import salt
import logging
import tempfile
# Import salt libs
from salt.exceptions import LoaderError
from salt.template import check_render_pipe_str
from salt.utils.decorators import Depends
log = loggin... | victorywang80/Maintenance | saltstack/src/salt/loader.py | Python | apache-2.0 | 34,104 |
from django.shortcuts import render, get_object_or_404, redirect, \
HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.http import HttpResponseForbidden, JsonResponse
from django.core.exceptions import SuspiciousOperation, ValidationError, \
Im... | kieranmathieson/feds | projects/views.py | Python | apache-2.0 | 12,870 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSansKhmer-Regular'
native_name = ''
def glyphs(self):
glyphs = []
glyphs.append(0x008C) #uni17E6
glyphs.append(0x008D) #uni17E7
glyphs.append(0x008A) #uni17E4
glyphs.append(0x0085) #uni17DB
... | davelab6/pyfontaine | fontaine/charsets/noto_glyphs/notosanskhmer_regular.py | Python | gpl-3.0 | 11,163 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | karllessard/tensorflow | tensorflow/python/framework/ops.py | Python | apache-2.0 | 254,309 |
from __future__ import print_function, unicode_literals
from . logEnvironmentModule import *
from . errorObjs import *
from heapq import nlargest
import random
from collections import deque
class BFS_improved(LogAgent):
"""BFS_improved LogAgent by Robert Parcus, 2014
State space blind search using BFS. It is... | MircoT/AI-Project-PlannerEnvironment | agents_dir/BFS_improved.py | Python | mit | 3,874 |
"""Functions to plot epochs data
"""
# Authors: Alexandre Gramfort <[email protected]>
# Denis Engemann <[email protected]>
# Martin Luessi <[email protected]>
# Eric Larson <[email protected]>
# Jaakko Leppakangas <[email protected]... | jmontoyam/mne-python | mne/viz/epochs.py | Python | bsd-3-clause | 65,600 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from struct import *
import numpy, sys
# http://stackoverflow.com/questions/25019287/how-to-convert-grayscale-values-in-matrix-to-an-image-in-python
# end if
imagesFile = 'data/brt-train-images.data';
w, h = 70, 74
chessmenTypesCount = 7
xMatrix = [[0 for x in range(70... | archcra/brt | train/loadTrainData.py | Python | gpl-3.0 | 1,508 |
# Copyright (C) 2010-2011 Mathijs de Bruin <[email protected]>
#
# This file is part of django-shopkit.
#
# django-shopkit is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2, or (at... | dokterbob/django-shopkit | shopkit/shipping/basemodels.py | Python | agpl-3.0 | 6,392 |
##@package isinterface
# Instance simulator interface.
#@author Sebastien MATHIEU
import time, datetime, re, sys, threading, queue, subprocess,traceback,os
import asyncio,websockets
import xml.etree.ElementTree as ElementTree
from .job import Job
from .log import log
# Static parameters
## Maximum number... | sebMathieu/dsima | server/isinterface.py | Python | bsd-3-clause | 11,595 |
# Copyright 2020 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 agreed to in writing, ... | google/fuzzbench | common/test_gcloud.py | Python | apache-2.0 | 7,576 |
class ApiVersionMismatchException(RuntimeError):
"""
Represents an error because a webhooks event has an API version that this version of the SDK does not support.
"""
def __init__(self, event_api_version, sdk_api_version):
super(ApiVersionMismatchException, self).__init__(
"event A... | Ingenico-ePayments/connect-sdk-python2 | ingenico/connect/sdk/webhooks/api_version_mismatch_exception.py | Python | mit | 879 |
# -*- coding:utf-8 -*-
"""
(c) All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, VPSI, 2017
"""
import json
import ast
import locale
from collections import defaultdict, OrderedDict
from datetime import datetime, timedelta
from fpdf import FPDF
from django.shortcuts import render
from d... | epfl-sdf/bill2myprint | src/bill2myprint/views.py | Python | mit | 24,715 |
__author__ = 'dimd'
from NetCatKS.Components import IXMLResourceAPI, IXMLResource
from zope.interface import implementer
from zope.component import adapts
@implementer(IXMLResourceAPI)
class Convert(object):
adapts(IXMLResource)
def __init__(self, factory):
self.factory = factory
def process_... | dimddev/NetCatKS | examples/components/adapters/time/xml/__init__.py | Python | bsd-2-clause | 401 |
import machine, time, micropython
from machine import Timer
TIMEOUT_MS = 5000 #soft-reset will happen around 5 sec
class TimeoutException(Exception):
pass
def timeout_callback(t):
micropython.schedule_exc(TimeoutException())
def trial_function():
cnt = 0
while True:
print("%d..." % cnt)
... | open-eio/upython-poly | timeout.py | Python | mit | 642 |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Boolean
from sqlalchemy.sql.schema import ForeignKey
from sqlalchemy.orm import relationship
from .serializable import Serializable
Base = declarative_base()
class Developer(Serializable, Base):
__tablename__... | GOFCROW/project_manager_server | server/data_layer/models.py | Python | isc | 1,590 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
# Copyright 2011 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (... | citrix-openstack/horizon | horizon/horizon/dashboards/nova/access_and_security/views.py | Python | apache-2.0 | 2,643 |
from torch.autograd import Function
import torch
from torch.nn.modules.utils import _pair
from pyinn.utils import Dtype, Stream, load_kernel
CUDA_NUM_THREADS = 1024
def GET_BLOCKS(N):
return (N + CUDA_NUM_THREADS - 1) // CUDA_NUM_THREADS
_im2col_kernel = '''
#define CUDA_KERNEL_LOOP(i, n) ... | szagoruyko/pyinn | pyinn/im2col.py | Python | mit | 9,567 |
#!/usr/bin/env python
# Copyright (c) 2012 NTT DOCOMO, 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... | zestrada/nova-cs498cc | nova/cmd/baremetal_deploy_helper.py | Python | apache-2.0 | 10,439 |
"""Support for Lupusec Security System binary sensors."""
import logging
from datetime import timedelta
from homeassistant.components.lupusec import (LupusecDevice,
DOMAIN as LUPUSEC_DOMAIN)
from homeassistant.components.binary_sensor import (BinarySensorDevice,
... | HydrelioxGitHub/home-assistant | homeassistant/components/lupusec/binary_sensor.py | Python | apache-2.0 | 1,410 |
class Solution(object):
def maxProfit1(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
if prices is None or len(prices) == 0:
return 0
l = len(prices)
dp = [[None]*l for i in xrange(l)]
for offset in xrange(l):
for ... | shuquan/leetcode | easy/best-time-to-buy-and-sell-stock/best_time_to_buy_and_sell_stock.py | Python | apache-2.0 | 1,146 |
from datetime import datetime
from skylines.model import Club
def lva(**kwargs):
return Club(
name=u"LV Aachen",
website=u"http://www.lv-aachen.de",
time_created=datetime(2015, 12, 24, 12, 34, 56),
).apply_kwargs(kwargs)
def sfn(**kwargs):
return Club(
name=u"Sportflug N... | skylines-project/skylines | tests/data/clubs.py | Python | agpl-3.0 | 405 |
"""An NNTP client class based on RFC 977: Network News Transfer Protocol.
Example:
>>> from nntplib import NNTP
>>> s = NNTP('news')
>>> resp, count, first, last, name = s.group('comp.lang.python')
>>> print 'Group', name, 'has', count, 'articles, range', first, 'to', last
Group comp.lang.python has 51 articles, rang... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.1/Lib/nntplib.py | Python | mit | 18,078 |
from measurements import parametric_sweep as ps
try:
pna.set_average(True)
pna.set_bandwidth(100)
pna.set_averages(3)
pna.set_nop(1)
pna.set_power(-35)
pna.get_all()
pna.set_centerfreq(5.2682e9)
pna.set_span(1e6)
lo.set_power(-5)
lo.set_status(1)
#lo.set_frequenc... | vdrhtc/Measurement-automation | lib/script_qubit_2tone.py | Python | gpl-3.0 | 725 |
import pytest
from distutils.version import LooseVersion
import pandas as pd
from pandas.core.computation.engines import _engines
import pandas.core.computation.expr as expr
from pandas.core.computation.check import _MIN_NUMEXPR_VERSION
def test_compat():
# test we have compat with our version of nu
from p... | NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/tests/computation/test_compat.py | Python | apache-2.0 | 1,320 |
#################################################################################
##____ ___ _ _ ____ ___ _____ ____ ___
#| _ \_ _| \ | | __ ) / _ \_ _| |___ \ / _ \
#| |_) | || \| | _ \| | | || | __) || | | |
#| __/| || |\ | |_) | |_| ... | Curbfeeler/PinbotFromES | trough.py | Python | mit | 19,435 |
#/usr/bin/python
def devidefile(trainFile,subFilePath,codeNum):
trainf=open(trainFile,'r');
lines=trainf.readlines();
totalLine=len(lines);
perfileLine=totalLine/int(codeNum);
for i in range(0,int(codeNum)+1):
subtrainf=open('%s/train%d.tmp'%(subFilePath,i),'wt');
if perfileLine*(i+1... | drawfish/VAD_HTK | pyscrp/devidetrainfile.py | Python | gpl-2.0 | 628 |
import json
import re
from aloisius import Stack, StackException
import mock
from moto import mock_cloudformation
import pytest
dummy_template = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Stack 3",
"Resources": {
"VPC": {
"Properties": {
"CidrBlock": "... | diasjorge/aloisius | tests/test_stack.py | Python | bsd-2-clause | 2,199 |
"""Preprocessing tools useful for building models."""
# Copyright 2015-present Scikit Flow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | panmari/tensorflow | tensorflow/contrib/skflow/python/skflow/preprocessing/__init__.py | Python | apache-2.0 | 894 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2019-04-26
git sha ... | lcoandrade/DsgTools | core/DSGToolsProcessingAlgs/Algs/LayerManagementAlgs/assignFilterToLayersAlgorithm.py | Python | gpl-2.0 | 7,059 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_flaskpypi
----------------------------------
Tests for `flaskpypi` module.
"""
import pytest
from flaskpypi import flaskpypi
# Code from https://wiki.python.org/moin/PyPISimple
from xml.etree import ElementTree
from urllib.request import urlopen
def get_distri... | waynew/flaskpypi | tests/test_flaskpypi.py | Python | bsd-3-clause | 752 |
# -*- coding: utf-8 -*-
"""Pickle format processing function."""
__author__ = "Yuan Chang"
__copyright__ = "Copyright (C) 2016-2021"
__license__ = "AGPL"
__email__ = "[email protected]"
from pickle import load, dump, UnpicklingError, HIGHEST_PROTOCOL
from qtpy.QtWidgets import QMessageBox
from .format_editor import F... | 40323230/Pyslvs-PyQt5 | pyslvs_ui/io/project_pickle.py | Python | agpl-3.0 | 1,320 |
import time
from unittest import TestCase
from numpy.random import rand
from numpy.testing import assert_allclose
from span.utils.decorate import cached_property, thunkify
from span.testing import slow
class ThunkifyException(Exception):
pass
class TestCachedProperty(TestCase):
def test_cached_property(se... | cpcloud/span | span/utils/tests/test_decorate.py | Python | gpl-3.0 | 1,777 |
# Copyright 2021 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 agreed to in writing, ... | google-research/DBAP-algorithm | third_party/rlkit_library/rlkit/samplers/data_collector/step_collector.py | Python | apache-2.0 | 12,271 |
"""
POST-PROCESSORS
=============================================================================
Markdown also allows post-processors, which are similar to preprocessors in
that they need to implement a "run" method. However, they are run after core
processing.
"""
import markdown
class Processor:
... | bbondy/brianbondy.gae | libs/markdown/postprocessors.py | Python | mit | 2,548 |
# 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 u... | apache/incubator-superset | superset/models/sql_types/base.py | Python | apache-2.0 | 2,642 |
#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
#Copyright (c) 1986 Nick Wong.
#Copyright (c) 2016-2026 TP-NEW Corp.
# License: TP-NEW (www.tp-new.com)
__author__ = "Nick Wong"
'''
fork() 子进程 进程间通信
'''
from multiprocessing import Process,Queue
import os,time,random
#写数据进程执行代码
def write(q):
print('进程写: %s' %... | nick-huang-cc/GraffitiSpaceTT | UnderstandStudyPython/Queue_SH.py | Python | agpl-3.0 | 1,096 |
from bottypes.command import Command
from bottypes.command_descriptor import CommandDesc
from bottypes.invalid_command import InvalidCommand
from handlers import handler_factory
from handlers.base_handler import BaseHandler
from util.githandler import GitHandler
from util.loghandler import log
import subprocess
import... | OpenToAllCTF/OTA-Challenge-Bot | handlers/bot_handler.py | Python | mit | 3,767 |
from game import Game
from player import Player
| asceth/devsyn | games/asteroids/__init__.py | Python | mit | 48 |
# usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 29 10:10:35 2017
@author: Vijayasai S
"""
"""
mercator_proj is a function which converts latitude and longitude
to x and y coordinate system.
lat and long should be mentioned in degrees
"""
import numpy as np
def mercator_proj(lat, long):
radi... | Vijaysai005/KProject | vijay/DBSCAN/temp/mercator_projection.py | Python | gpl-3.0 | 957 |
# Copyright 2017 IoT-Lab Team
# Contributor(s) : see AUTHORS file
#
# 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 of conditions a... | pyaiot/pyaiot | pyaiot/gateway/coap/gateway.py | Python | bsd-3-clause | 9,193 |
# Copyright 2016 Intel Corporation
#
# 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... | TuKo/brainiak | examples/factoranalysis/htfa_cv_example.py | Python | apache-2.0 | 11,484 |
# -*- coding: utf-8 -*-
#
# WsgiService documentation build configuration file, created by
# sphinx-quickstart on Fri May 1 16:34:26 2009.
#
# 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
# autogenerated file.
#
#... | beekpr/wsgiservice | docs/conf.py | Python | bsd-2-clause | 6,526 |
import numpy as np
from .utils import trig_sum
def lombscargle_fast(t, y, dy, f0, df, Nf,
center_data=True, fit_mean=True,
normalization='standard',
use_fft=True, trig_sum_kwds=None):
"""Fast Lomb-Scargle Periodogram
This implements the Press & ... | bsipocz/astropy | astropy/timeseries/periodograms/lombscargle/implementations/fast_impl.py | Python | bsd-3-clause | 4,924 |
"""The ``celery upgrade`` command, used to upgrade from previous versions."""
from __future__ import absolute_import, print_function, unicode_literals
import codecs
from celery.app import defaults
from celery.bin.base import Command
from celery.utils.functional import pass1
class upgrade(Command):
"""Perform upgr... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/celery/bin/upgrade.py | Python | mit | 3,651 |
import os
from posixpath import basename
from urllib.parse import urlparse
from .common.spiders import BaseDocumentationSpider
from typing import Any, List, Set
def get_images_dir(images_path: str) -> str:
# Get index html file as start url and convert it to file uri
dir_path = os.path.dirname(os.path.real... | jackrzhang/zulip | tools/documentation_crawler/documentation_crawler/spiders/check_help_documentation.py | Python | apache-2.0 | 3,112 |
"""Helper script for generating compact docstring coverage report.
The ``docstr-coverage`` package has a quite verbose output. This script
mimicks the one-line-per-file output of ``coverage.py``.
It also sets some defaults and does more elaborate filtering/exclusion than
currently possible with the basic ``docstr-cov... | nens/threedi-qgis-plugin | scripts/docstring-report.py | Python | gpl-3.0 | 1,684 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2010, 2011, 2013 CERN.
##
## Invenio 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 yo... | jmartinm/invenio | modules/docextract/lib/refextract_api_unit_tests.py | Python | gpl-2.0 | 1,319 |
import tkinter as tk
from tkinter import simpledialog, messagebox
import tkinter.filedialog as filedialog
import tkinter.ttk as ttk
import os as os
import json
from PIL import Image, ImageTk
import shutil
import re
PEOPLE_FILENAME = "settings.json"
def load_settings():
global people
global directory_variable... | ande3577/image_tagger | image_tagger.py | Python | gpl-3.0 | 11,353 |
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2019 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
import re
import operator
import os
import pytest
from xdist.dsession imp... | peterjanes/dosage | tests/modules/conftest.py | Python | mit | 1,983 |
from xform import *
from dataflow import *
def apply(cfg):
# Various algos below don't work with no explicit entry in CFG
cfg_preheader(cfg)
# Also don't work with >1 entries
remove_unreachable_entries(cfg)
# Various algos below require single-exit CFG
cfg_single_exit(cfg)
foreach_inst(cf... | pfalcon/ScratchABlock | script_propagate_dce.py | Python | gpl-3.0 | 765 |
# -*- coding: utf-8 -*-
# Telegram
from telegram.ext import run_async, CallbackContext
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
#Modules
from module.shared import config_map, check_log
# System libraries
from urllib.parse import quote
import requests
import sqlite3
import logging
impor... | UNICT-DMI/Telegram-DMI-Bot | module/gitlab.py | Python | gpl-3.0 | 12,856 |
"""
Hilbert projective metric (Basic conding !)
=========================
- boundary of Ω
- order of the points p,x, q, y
- || || Real norm
||py|| ||xq||
d(x,y) = ln( ---------------- )
||px|| ||yq||
"""
from sympy import symbols
from sympy import log
from sympy.geometry import... | kiaderouiche/hilbmetrics | hilbert/mtchilbert.py | Python | apache-2.0 | 659 |
from xml.etree import cElementTree as ElementTree
SENSEVAL3_TEST_DATA_FILE = "english-all-words.xml"
SENSEVAL3_TEST_ANSWERS_FILE = "EnglishAW.test.key"
def senseval_data():
# TODO: Add part of speech of each word using WordNet
all_sentences = []
senseval_test = ElementTree.parse(SENSEVAL3_TEST_DATA_FILE... | tgrant59/pydante | sensevalapi.py | Python | mit | 3,821 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | AnnalisaS/migration_geonode | geonode/layers/models.py | Python | gpl-3.0 | 29,589 |
#-*- coding: utf-8 -*-
from django.conf import settings
from django.core import exceptions
from django.utils.importlib import import_module
def load_class(class_path, setting_name=None):
"""
Loads a class given a class_path.
The setting_name parameter is only there for pretty error output, and
theref... | hzlf/openbroadcast | website/shop/shop/util/loader.py | Python | gpl-3.0 | 2,073 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_07_01/operations/_route_filters_operations.py | Python | mit | 30,281 |
"""
Wrappers to LAPACK library
==========================
NOTE: this module is deprecated -- use scipy.linalg.lapack instead!
flapack -- wrappers for Fortran [*] LAPACK routines
clapack -- wrappers for ATLAS LAPACK routines
calc_lwork -- calculate optimal lwork parameters
get_lapack_funcs -- query fo... | beiko-lab/gengis | bin/Lib/site-packages/scipy/lib/lapack/__init__.py | Python | gpl-3.0 | 8,118 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-10-19 04:07
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
import functools
import instance.models.utils
class Migration(migrations.Migration):
dependencies = [
('instance',... | open-craft/opencraft | instance/migrations/0110_auto_20181019_0407.py | Python | agpl-3.0 | 2,277 |
#answer: dx = (/ (1) (2))
var:
[0,1] x;
cost:
x/2
| keram88/gelpia_tests | reverse_diff_tests/x_over_2.py | Python | mit | 52 |
from ..node_tree import UMOGReferenceHolder
import bpy
class UMOGSetSceneFrameRange(bpy.types.Operator):
"""Set playback/rendering frame range to simulation range"""
bl_idname = 'umog.frame_range'
bl_label = 'Set Scene Frame Range'
bl_options = {'REGISTER', 'UNDO'}
position = bpy.props.StringPrope... | hsab/UMOG | umog_addon/operators/frame_operators.py | Python | gpl-3.0 | 1,211 |
#!/usr/bin/env python
'''
PySQM reading program
____________________________
Copyright (c) Mireia Nievas <mnievas[at]ucm[dot]es>
This file is part of PySQM.
PySQM 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 Foundatio... | migueln/PySQM | pysqm/read.py | Python | gpl-3.0 | 26,816 |
"""Pressure util functions."""
from __future__ import annotations
from numbers import Number
from homeassistant.const import (
PRESSURE,
PRESSURE_BAR,
PRESSURE_CBAR,
PRESSURE_HPA,
PRESSURE_INHG,
PRESSURE_KPA,
PRESSURE_MBAR,
PRESSURE_PA,
PRESSURE_PSI,
UNIT_NOT_RECOGNIZED_TEMPLAT... | jawilson/home-assistant | homeassistant/util/pressure.py | Python | apache-2.0 | 1,358 |
#!/usr/bin/env python
#
# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# 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 ... | RedhawkSDR/integration-gnuhawk | qa/tests/qa_sig_source.py | Python | gpl-3.0 | 6,406 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | kailIII/emaresa | trunk.pe.bk/l10n_pe_hr_payroll/__init__.py | Python | agpl-3.0 | 1,051 |
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
from videoclases.models.course import Course
class Student(models.Model):
user = models.OneToOneField(User)
courses = models.ManyToManyField(Course, related_name='students')
changed_password = model... | Videoclases/videoclases | videoclases/models/student.py | Python | gpl-3.0 | 756 |
import os.path
import multiprocessing
import utils
import functools
import sys
def check_existing_default_config(species, script_path):
species = species.lower().split(' ')
trueCoverage_config_folder = os.path.join(os.path.dirname(script_path), 'modules', 'trueCoverage_rematch', '')
config = None
reference = None... | dorbarker/INNUca | modules/trueCoverage_rematch.py | Python | gpl-3.0 | 33,927 |
"""
Windows Meta File
"""
from construct import *
wmf_record = Struct("records",
ULInt32("size"), # size in words, including the size, function and params
Enum(ULInt16("function"),
AbortDoc = 0x0052,
Aldus_Header = 0x0001,
AnimatePalette = 0x0436,
Arc = 0x0817,
BitBlt =... | PythEch/pymobiledevice | libs/python/construct/formats/graphics/wmf.py | Python | lgpl-3.0 | 3,535 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from window import MainWindow
win = MainWindow()
| CrackedP0t/ponyplayer | ponyplayer.py | Python | gpl-3.0 | 94 |
"""
Partial backport of Python 3.5's weakref module:
finalize (new in Python 3.4)
Backport modifications are marked with marked with "XXX backport".
"""
from __future__ import absolute_import
import itertools
import sys
from weakref import ref
__all__ = ['finalize']
class finalize(object):
"""Class for fi... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/backports/weakref.py | Python | bsd-2-clause | 5,250 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
from sc2reader.utils import Length
from sc2reader.events.base import Event
from sc2reader.log_utils import loggable
from itertools import chain
@loggable
class GameEvent(Event):
"""
This is the base cl... | ggtracker/sc2reader | sc2reader/events/game.py | Python | mit | 25,673 |
'''
umount.py - this file is part of S3QL (http://s3ql.googlecode.com)
Copyright (C) 2008-2009 Nikolaus Rath <[email protected]>
This program can be distributed under the terms of the GNU GPLv3.
'''
from __future__ import division, print_function, absolute_import
from .common import CTRL_NAME, setup_logging
from .pa... | thefirstwind/s3qloss | src/s3ql/umount.py | Python | gpl-3.0 | 6,539 |
# Copyright 2021 National Research Foundation (SARAO)
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This ... | ska-sa/spead2 | tests/test_recv_chunk_stream.py | Python | lgpl-3.0 | 24,263 |
''' Created by Trevor Batty
Date: May 14th 2017
Creates the origin section of the GUI.
'''
import tkinter as tk
from tkinter import ttk
import tkMessageBox
import subprocess as sp
import tools
class Origin(ttk.Frame):
def __init__(self,root,mainFrame):
# Create Origin frame
ttk.F... | tbattz/configureOpenGLMap | src/origin.py | Python | gpl-3.0 | 6,145 |
from __future__ import absolute_import
from django.conf import settings
from django.http import Http404, HttpResponseRedirect
from django.views.generic import View
from sentry import options
class OutView(View):
def get(self, request):
if not settings.SENTRY_ONPREMISE:
raise Http404
... | JackDanger/sentry | src/sentry/web/frontend/out.py | Python | bsd-3-clause | 558 |
"""
We acquire the python information by running an interrogation script via subprocess trigger. This operation is not
cheap, especially not on Windows. To not have to pay this hefty cost every time we apply multiple levels of
caching.
"""
from __future__ import absolute_import, unicode_literals
import logging
import... | TeamSPoon/logicmoo_workspace | packs_web/butterfly/lib/python3.7/site-packages/virtualenv/discovery/cached_py_info.py | Python | mit | 5,043 |
def counting_sort(input):
output = [0] * len(input)
max = input[0]
min = input[0]
for i in range(1, len(input)):
if input[i] > max:
max = input[i]
elif input[i] < min:
min = input[i]
k = max - min + 1
count_list = [0] * k
for i in range(0, len(inpu... | algobook/Algo_Ds_Notes | Counting_Sort/Counting_Sort.py | Python | gpl-3.0 | 850 |
# 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 u... | zhouyao1994/incubator-superset | superset/examples/bart_lines.py | Python | apache-2.0 | 2,148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.