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 |
|---|---|---|---|---|---|
"""Module for manipulating tensor names according to Householder notation"""
RM_2_GREEK = {"a":"alpha", "b":"beta", "c":"gamma", "d":"delta",
"e":"epsilon", "h":"eta", "i":"iota", "k":"kappa", "l":"lambda",
"m":"mu", "n":"nu", "o":"omicron", "p":"pi", "r":"rho",
"s":"sigma", "t":"ta... | IgnitionProject/ignition | ignition/dsl/flame/tensors/tensor_names.py | Python | bsd-3-clause | 5,816 |
plugin_class = "shipmaster.plugins.ssh.ssh.SSHPlugin"
| damoti/shipmaster | shipmaster/plugins/ssh/__init__.py | Python | bsd-3-clause | 54 |
from sqlalchemy import create_engine, MetaData, Table, Column, Integer, String, DateTime
import yaml
conf = yaml.load(open('conf.yml'))
psql_cstr = conf['postgres_connection_str']
psql_schema = conf['postgres_schema']
engine = create_engine(psql_cstr)
conn = engine.connect()
metadata = MetaData(schema=psql_schema)... | bwaite/fetch-to-atom | db.py | Python | mit | 623 |
x = input()
y = input()
print x + y
| cantora/pyc | p0tests/grader_tests/input_2.py | Python | gpl-3.0 | 36 |
#!/usr/bin/env python3
#
# cargo_plugin.py
#
# Copyright © 2016 Christian Hergert <chris@dronelabs.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (... | albfan/gnome-builder | src/plugins/cargo/cargo_plugin.py | Python | gpl-3.0 | 9,062 |
"""Menu File description"""
from PyQt5.QtWidgets import qApp, QFileDialog, QMessageBox
from copy import deepcopy
from app.parser import *
from app.lattice import *
class GUIMenuFile():
def __init__(self, MainWindow):
self.mw = MainWindow
def __del__(self):
pass
def new_lattice(self)... | ocelot-collab/ocelot | ocelot_gui/app/menu_file.py | Python | gpl-3.0 | 2,446 |
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | jimpick/jaikuengine | common/user.py | Python | apache-2.0 | 6,537 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | elopio/snapcraft | tests/integration/repo.py | Python | gpl-3.0 | 1,775 |
# -*- coding: utf-8 -*-
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class CloneConfig(AppConfig):
name = 'clone'
verbose_name = _('ZX Spectrum clones database')
| kgbplus/trdos_site | clone/apps.py | Python | gpl-3.0 | 218 |
from django.conf import settings
from django.core.urlresolvers import resolve, Resolver404
from django.shortcuts import redirect
from djangoproject import urls as frontend_urls
from store.models import Merchant
import sys
class MerchantSubdomainMiddleware(object):
def process_request(self, request):
pat... | fulcircle/djangostore | store/middleware/subdomains.py | Python | gpl-2.0 | 1,012 |
# -*- coding: utf-8 -*-
# std lib
import logging
# 3rd parties
from flask import Flask
from flask_socketio import SocketIO
# local
from sentinel_gui import settings
def setup_logging(app):
logger = logging.getLogger('sentinel_gui')
loglevel = logging.DEBUG if settings.DEBUG else logging.INFO
logger.setL... | cgarciaarano/sentinel_gui | sentinel_gui/web.py | Python | gpl-3.0 | 826 |
#!/usr/bin/env python
#
# Plugins.py
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; w... | pdelsante/thug | thug/DOM/Plugins.py | Python | gpl-2.0 | 1,471 |
#!/usr/bin/python3
#
# Copyright (C) 2018 Rafael Senties Martinelli
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License 3 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be usefu... | rsm-gh/alienware-kbl | usr/lib/python3/AKBL/Addons/GUI/ColorChooserToolbar/ColorToolItem.py | Python | gpl-3.0 | 4,805 |
from .bang import Bang, Uninit
from .gui_main import MFPGUI
| bgribble/mfp | mfp/__init__.py | Python | gpl-2.0 | 61 |
# -*- coding: utf-8 -*-
"""
direct PAS
Python Application Services
----------------------------------------------------------------------------
(C) direct Netware Group - All rights reserved
https://www.direct-netware.de/redirect?pas;media
The following license agreement remains valid unless any additions or
changes ... | dNG-git/pas_media | setup.py | Python | gpl-2.0 | 2,756 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import logging
from functools import reduce
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.core.validators import MinValueValidator, MaxValueValidator
from common.utils import get_signer
f... | eli261/jumpserver | apps/assets/models/user.py | Python | gpl-2.0 | 6,263 |
# Python 2 and 3:
try:
# Python 3 only:
from urllib.parse import urlencode, urlsplit, parse_qs, unquote
except ImportError:
# Python 2 only:
from urlparse import parse_qs, urlsplit
from urllib import urlencode, unquote
| fasihahmad/django-rest-framework-related-views | rest_framework_related/py2_3.py | Python | gpl-3.0 | 239 |
import pexpect
p = pexpect.spawn(["login"])
p.expect("login:")
p.sendline("wrong")
p.expect("Password:")
p.sendline("wrong")
p.expect("Login incorrect")
| masahir0y/buildroot-yamada | support/testing/tests/package/sample_python_pexpect.py | Python | gpl-2.0 | 154 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 t... | PXke/invenio | invenio/legacy/docextract/pdf.py | Python | gpl-2.0 | 16,893 |
"""
Base implementation for services available through a provider
"""
from cloudbridge.cloud.interfaces.resources import Router
from cloudbridge.cloud.interfaces.services import BlockStoreService
from cloudbridge.cloud.interfaces.services import CloudService
from cloudbridge.cloud.interfaces.services import ComputeSer... | ms-azure-cloudbroker/cloudbridge | cloudbridge/cloud/base/services.py | Python | mit | 6,452 |
from .data import contract_template, company_name_column
from .fetch import get_sponsor, get_sponsors_ws_data
from .contract import create_sponsor_agreement
| EuroPython/ep-tools | eptools/sponsors/__init__.py | Python | mit | 158 |
# Copyright 2016-2018 ARM Limited
#
# 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 w... | lisatn/workload-automation | wa/framework/configuration/plugin_cache.py | Python | apache-2.0 | 13,957 |
# This file is part of Gajim.
#
# Gajim is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; version 3 only.
#
# Gajim is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | gajim/gajim | gajim/common/modules/http_auth.py | Python | gpl-3.0 | 2,575 |
# -*- coding: utf-8 -*-
"""
Django settings for To-Do-List project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
import environ
import os
ROOT_DIR = environ.P... | arnaudblois/to_do_list | config/settings/common.py | Python | mit | 10,018 |
#!/usr/bin/env python
# 2015 Copyright (C) White
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
#... | thomashuang/white | white/controller/admin/extend.py | Python | gpl-2.0 | 1,282 |
# -*- coding: utf-8 -*-
# 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 o... | martbhell/wasthereannhlgamelastnight | src/lib/google/api/control_pb2.py | Python | mit | 3,161 |
#
# joeecc - A small Elliptic Curve Cryptography Demonstration.
# Copyright (C) 2011-2016 Johannes Bauer
#
# This file is part of joeecc.
#
# joeecc 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; this program... | johndoe31415/joeecc | ecc/Tools.py | Python | gpl-3.0 | 3,622 |
#!/usr/bin/python
#
# Copyright (C) 2007 SIOS Technology, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Rondineli/django-sso | django_sso/python-saml2-read-only/src/saml2/ds_test_data.py | Python | gpl-2.0 | 11,058 |
#! /usr/bin/env python
import json
import sys
sys.path.append('..')
from CodewebsIndexClient import CodewebsIndexClient
def loadTextFile(fname):
with open(fname) as fid:
return fid.read()
def wrap(ast,code,map,codeblockid):
astjson = json.loads(ast)
wrappedJSON = {'ast': astjson,
... | tanonev/codewebs | src/analogyFinder/src/daemons/example/exampleclient.py | Python | mit | 1,439 |
#coding=UTF-8
'''
Created on 2011-7-5
@author: Administrator
'''
import cookielib
import urllib2
from pyquery.pyquery import PyQuery
import re
from config import housetype, checkPath, makePath,citynameDict_sf
import datetime
import time
import threading
from BeautifulSoup import BeautifulSoup
from jjrlog import LinkLo... | ptphp/PyLib | src/webpy1/src/jjrspider/soufun.py | Python | apache-2.0 | 39,564 |
import glob
import logging
import os
import pandas as pd
import minst.utils as utils
logger = logging.getLogger(__name__)
NAME = 'philharmonia'
ONSET_DIR = os.path.join(os.path.dirname(__file__),
os.pardir, os.pardir,
"data", "onsets", NAME)
def parse(filename):
... | ejhumphrey/minst-dataset | minst/sources/philharmonia.py | Python | isc | 3,404 |
# https://pythonhosted.org/setuptools/setuptools.html#namespace-packages
__import__('pkg_resources').declare_namespace(__name__)
import mimetypes
# http://docs.python-requests.org/en/latest/user/advanced/#post-multiple-multipart-encoded-files
def encode_multipart_formdata(args):
data = {}
files = []... | straup/py-flamework-api | flamework/api/request/__init__.py | Python | bsd-3-clause | 1,157 |
# print 'hello world!'
print 'hello world!'
| hsadler/programming-language-examples | python/hello_world.py | Python | mit | 46 |
# -*- coding: utf-8 -*-
"""
All code for scraping images and videos from posted
links go in this file.
"""
import BeautifulSoup
import requests
from urlparse import urlparse, urlunparse, urljoin
img_extensions = ['jpg', 'jpeg', 'gif', 'png', 'bmp']
def make_abs(url, img_src):
domain = urlparse(url).netloc
sch... | codelucas/flask_reddit | flask_reddit/media.py | Python | mit | 1,763 |
# Copyright (c) 2011 The Chromium OS Authors.
#
# See file CREDITS for list of people who contributed to this
# project.
#
# 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
# t... | MarvellEmbeddedProcessors/u-boot-armada38x | tools/patman/series.py | Python | gpl-2.0 | 8,520 |
import os
import datetime
from utils.util import run_command
__author__ = 'maa'
class MsBuilder:
def __init__(self, msbuild):
if msbuild == None:
self.msbuild = r"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
else:
self.msbuild = msbuild
def build_with... | amatkivskiy/baidu | baidu/utils/msbuilder.py | Python | apache-2.0 | 1,654 |
# Copyright 2017-20 ForgeFlow S.L. (www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import tagged
from odoo.addons.test_mail.data.test_mail_data import MAIL_TEMPLATE
from odoo.addons.test_mail.tests.test_mail_gateway import TestMailgateway
@tagged("mail_gate... | OCA/server-tools | fetchmail_incoming_log/tests/test_fetchmail_incoming_log.py | Python | agpl-3.0 | 1,226 |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... | JarbasAI/JarbasAI | mycroft/configuration/__init__.py | Python | gpl-3.0 | 12,270 |
from .spike_detection import highest_spike
class ContentExtractor:
def __init__(self, config):
self.config = config
def extract(self, article):
text_lines = article.rawtext.split('\n')
line_values = [len(line) for line in text_lines]
l,r,_ = highest_spike(line_values,self.conf... | villasv/pyWebNectar | webnectar/extractors/ContentExtractor.py | Python | gpl-3.0 | 493 |
#!/usr/bin/env python
"""
gets basic info about AVI file using OpenCV
input: filename or cv2.Capture
"""
from pathlib import Path
from struct import pack
from typing import Dict, Any
import cv2
def getaviprop(fn: Path) -> Dict[str, Any]:
if isinstance(fn, (str, Path)): # assuming filename
fn = Path(fn).... | scienceopen/CVutils | morecvutils/getaviprop.py | Python | mit | 1,520 |
#!/usr/bin/env python3
'''
KLL Data Dropper (Doesn't emit anything)
'''
# Copyright (C) 2016-2018 by Jacob Alexander
#
# This file 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 Licen... | kiibohd/kll | kll/emitters/none/none.py | Python | gpl-3.0 | 1,805 |
from django.conf.urls import include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
# Examples:
# url(r'^$', 'site.views.home', name='home'),
# url(r'^site/', include('site.foo.urls')),
#(r'^cache/', include('django_memcac... | kyokley/MediaViewer | mysite/urls.py | Python | mit | 658 |
#!/usr/bin/env python
#************************************************************************
# Compilation: javac ThreeSum.java
# Execution: java ThreeSum input.txt
# Dependencies: In.java StdOut.java Stopwatch.java
# Data files: http://algs4.cs.princeton.edu/14analysis/1Kints.txt
# htt... | dvklopfenstein/PrincetonAlgorithms | py/AlgsSedgewickWayne/ThreeSum.py | Python | gpl-2.0 | 18,990 |
# make the other metrics work
# generate the txt files, then work on the pdf otuput
__version__ = "0.1.0"
import numpy as np
import pandas as pd
# import matplotlib
# matplotlib.use('pdf')
import matplotlib.pyplot as plt
import sys
import os
import networkx as nx
import PHRG
import probabilistic_cfg as pcfg
import net_... | nddsg/TreeDecomps | xplodnTree/tdec/exact_phrg.py | Python | mit | 10,046 |
#!/usr/bin/env python
#
# ___INFO__MARK_BEGIN__
#######################################################################################
# Copyright 2016-2021 Univa Corporation (acquired and owned by Altair Engineering Inc.)
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file e... | gridengine/config-api | test/utils.py | Python | apache-2.0 | 4,927 |
#
# Copyright (C) 2005-2010 TUBITAK/UEKAE
#
# 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.
#
# Please read the COPYING ... | akuster/yali | yali/gui/ScrCollection.py | Python | gpl-2.0 | 3,898 |
"""This module contains the unit tests for
the formatting of block quotes.
"""
import unittest
import PyMarkdownGen.PyMarkdownGen as md
class BlockquoteTests(unittest.TestCase):
"""The test case (fixture) for testing block quotes."""
def test_block_quote(self):
"""Tests block quotes that contain... | LukasWoodtli/PyMarkdownGen | PyMarkdownGen/test/block_quote_test.py | Python | epl-1.0 | 1,125 |
#!/usr/bin/env python
import sys
from uda_common import read_feature_groups
from sklearn.datasets import load_svmlight_file
import numpy as np
from os.path import dirname, join
def main(args):
if len(args) < 1:
sys.stderr.write("One required argument: <reduced training data> [freq=50]\n")
sys.exit(... | tmills/uda | scripts/create_freq_pivots.py | Python | apache-2.0 | 1,863 |
# -*- coding:utf8 -*-
"""
rtrlib.rtr_socket
-----------------
"""
from __future__ import absolute_import, unicode_literals
from enum import Enum
from _rtrlib import lib
class RTRSocketList(object):
"""
List of RTRSockets. Can be accessed like any other list.
Read Only.
"""
def __init__(self, ... | rtrlib/python-binding | rtrlib/rtr_socket.py | Python | mit | 3,583 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import contextlib
import pytz
import datetime
import ipaddress
import itertools
import logging
import hmac
from collections import defaultdict
from hashlib import sha256
from itertools import chain, repeat
from lxml imp... | t3dev/odoo | odoo/addons/base/models/res_users.py | Python | gpl-3.0 | 59,781 |
import os
import shutil
import tempfile
from contextlib import contextmanager
from importlib import import_module
from django.apps import apps
from django.db import connections
from django.db.migrations.recorder import MigrationRecorder
from django.test import TransactionTestCase
from django.test.utils import extend_s... | auready/django | tests/migrations/test_base.py | Python | bsd-3-clause | 4,977 |
from io import open
from itertools import islice
import numpy as np
import os
import random
import time
import yaml
def strip_quotations_newline(text):
''' This function is needed when reading tweets from Labeled_Tweets.json
'''
text = text.rstrip()
if text[0] == '"':
text = text[1:]
if te... | anmolshkl/oppia-ml | load_data.py | Python | apache-2.0 | 3,107 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-07-01 03:33
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0007_auto_20170630_1248'),
]
operations = [
migrations.RemoveField(
... | michealcarrerweb/LHVent_app | account/migrations/0008_auto_20170701_0333.py | Python | mit | 500 |
# -*- coding: utf-8 -*-
# Licensed to the StackStorm, Inc ('StackStorm') 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 "Licen... | alfasin/st2 | st2actions/setup.py | Python | apache-2.0 | 1,752 |
from __future__ import absolute_import, print_function, division
from netlib.http import decoded
from .connections import ClientConnection, ServerConnection
from .flow import Flow, Error
from .http import (
HTTPFlow, HTTPRequest, HTTPResponse, Headers,
make_error_response, make_connect_request, make_con... | x2Ident/x2Ident_test | mitmproxy/mitmproxy/models/__init__.py | Python | gpl-3.0 | 753 |
# immediately below is stupid hackery for setuptools to work with Cython
import distutils.extension
import distutils.command.build_ext
from distutils.extension import Extension as _Extension
from setuptools import setup
distutils.extension.Extension = _Extension
distutils.command.build_ext.Extension = _Extension
Exten... | danielhauagge/pyvision | setup.py | Python | mit | 3,264 |
# Image windowing class
import numpy as np
import sidpy
from scipy import fftpack
from scipy.signal import hanning, blackman
from skimage.transform import rescale
class ImageWindowing:
"""
This class will generate windows from sidpy dataset objects. At present only 2D windowing is allowed.
"""
def __... | pycroscopy/pycroscopy | pycroscopy/image/image_window.py | Python | mit | 17,132 |
from collections import defaultdict
import bisect
from utils import memo
class Solution(object):
def findRotateSteps(self, ring, key):
"""
:type ring: str
:type key: str
:rtype: int
"""
m, n = len(ring), len(key)
mid = (m >> 1) + 1
dct = defaultdict... | wufangjie/leetcode | 514. Freedom Trail.py | Python | gpl-3.0 | 2,585 |
# 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... | xodus7/tensorflow | tensorflow/tools/quantization/quantize_graph_test.py | Python | apache-2.0 | 42,452 |
#!/usr/bin/env python
'''
Disclaimer - This is a solution to the below problem given the content we have
discussed in class. It is not necessarily the best solution to the problem.
In other words, I only use things we have covered up to this point in the class
(with some minor exceptions).
Python for Network Enginee... | Collisio-Adolebitque/pfne-2017 | pynet/learnpy_ecourse/class3/ex1_binary_converter.py | Python | gpl-3.0 | 2,354 |
# -*- 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 taNeaItem(scrapy.Item):
titleArticle = scrapy.Field()
linkArticle = scrapy.Field()
textArticle = scrapy.Field()
| bamartos/homesearch | source/items.py | Python | gpl-2.0 | 298 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2015 Université Catholique de Louvain.
#
# This file is part of INGInious.
#
# INGInious 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 3 o... | layus/INGInious | frontend/submission_manager.py | Python | agpl-3.0 | 8,388 |
def computepay(hours,rate):
if hours <= 40.0:
return rate * hours
else:
regular = 40.0 * rate
ot = (hours-40.0)*(rate*1.5)
#return (rate * hours) + ((hours-40.0)*(rate*1.5))
return regular + ot
print(computepay(float(input("Enter Hours: ")),float(input("Enter Rate: "))))
| rlmitchell/coursera | py4e/1_python_for_everybody/ex-4-6.py | Python | gpl-3.0 | 299 |
# -*- 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... | ttfseiko/openerp-trunk | openerp/addons/document_ftp/ftpserver/__init__.py | Python | agpl-3.0 | 2,649 |
"""
Implements interface to openssl X509 and X509Store structures,
I.e allows to load, analyze and verify certificates.
X509Store objects are also used to verify other signed documets,
such as CMS, OCSP and timestamps.
"""
from ctypes import c_void_p, c_long, c_ulong, c_int, POINTER, c_char_p, Structure, cast
from ... | vbwagner/ctypescrypto | ctypescrypto/x509.py | Python | mit | 28,184 |
"""
hellofriend.py
Author: Jasmine Lou
Credit: the internet and classmates
Assignment:
Write and submit an interactive Python program that asks for the user's name and age,
then prints how much older Python is than the user (based on a simple comparison of
birth year). Python's first public release occurred in 1991... | jasminelou/Hello-friend | hellofriend.py | Python | mit | 871 |
from hashlib import sha256 as hash_new
SIZE = 1024 * 1024
def compute_hash(data, size):
"""
compute hash of storage item's data file, return hexdigest
"""
hasher = hash_new()
offset = 0
while offset < size:
buf = data.read(SIZE, offset)
offset += len(buf)
hasher.update... | bepasty/bepasty-server | src/bepasty/utils/hashing.py | Python | bsd-2-clause | 356 |
import itertools
from datetime import timedelta
from django.core.urlresolvers import reverse
from django.http.response import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.views.generic ... | logston/qsic3 | qsic/events/views.py | Python | bsd-3-clause | 4,823 |
# $Id: mod_sipp.py 5067 2015-04-13 12:28:02Z nanang $
## Automatic test module for SIPp.
##
## This module will need a test driver for each SIPp scenario:
## - For simple scenario, i.e: make/receive call (including auth), this
## test module can auto-generate a default test driver, i.e: make call
## or apply auto ... | lxki/pjsip | tests/pjsua/mod_sipp.py | Python | gpl-2.0 | 8,609 |
#!/usr/bin/env python3
"""
The default output from glimmerHMM (when using the -g option) produces something LIKE
GFF but has only mRNA and CDS features. This script transforms this into the canonical
genes described in the specification.
Example input:
Supercontig_3.1 GlimmerHMM mRNA 15493 15926 . ... | jonathancrabtree/biocode | gff/convert_glimmerHMM_gff_to_gff3.py | Python | gpl-3.0 | 4,769 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob 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 3 of the License, or
# (at your op... | yannrouillard/weboob | weboob/applications/qcookboob/recipe.py | Python | agpl-3.0 | 4,427 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | sydneycarton/NeatMechanicalToy | app/bookbeeper/bookservices/migrations/0001_initial.py | Python | apache-2.0 | 3,684 |
"""
VerseBot for Reddit
By Matthieu Grieger
Continued By Team VerseBot
response.py
Copyright (c) 2015 Matthieu Grieger (MIT License)
"""
MAXIMUM_MESSAGE_LENGTH = 4000
class Response:
""" Class that holds the properties and methods of a comment
response. """
def __init__(self, message, parser, link=None)... | Matthew-Arnold/slack-versebot | versebot/response.py | Python | mit | 5,650 |
# Copyright (c) 2007 Red Hat, Inc.
# Copyright (c) 2009, 2010, 2011 Intel, 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; version 2 of the License
#
# This program is distributed in the ... | ronan22/mic | mic/kickstart/__init__.py | Python | gpl-2.0 | 31,009 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, cstr, fmt_money
import unittest
class TestFmtMoney(unittest.TestCase):
def test_standard(self):
frappe.db.set_... | neilLasrado/frappe | frappe/tests/test_fmt_money.py | Python | mit | 4,407 |
# encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from __... | klahnakoski/intermittents | pyLibrary/queries/es14/aggs.py | Python | mpl-2.0 | 17,393 |
#!/usr/bin/env python
import os, sys, argparse
from operator import itemgetter
sys.path.append(
os.path.abspath(
os.path.join(os.path.dirname(os.path.abspath(__file__)),
os.pardir, os.pardir, os.pardir)))
from themis.metaprograms.utils import StatQuery
import themis.metaprograms.util... | mconley99/themis_tritonsort | src/scripts/themis/metaprograms/list_time_series/list_time_series.py | Python | bsd-3-clause | 3,286 |
import csv
import h5py
from collections import defaultdict
import numpy as np
import os
def extract_detections(path_data, path_csv, path_output):
CUBE_SZ = 54
# parse the detections csv
with open(path_csv, "r") as f:
reader = csv.reader(f)
list_detections = list(reader)
list_detectio... | syagev/kaggle_dsb | kaggle/util.py | Python | apache-2.0 | 3,228 |
"""
Common task fixtures.
"""
#
# Fimfarchive, preserves stories from Fimfiction.
# Copyright (C) 2020 Joakim Soderlund
#
# 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 t... | JockeTF/fimfarchive | tests/tasks/conftest.py | Python | gpl-3.0 | 2,907 |
# Copyright 2013 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | samsu/neutron | plugins/cisco/extensions/n1kv.py | Python | apache-2.0 | 3,484 |
# Copyright 2017 Mark Dickinson
#
# 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,... | mdickinson/pcgrandom | pcgrandom/test/test_distributions.py | Python | apache-2.0 | 4,229 |
import gtk
import BaseObject
class PropertyBox(gtk.HBox):
def __init__(self, prop):
gtk.HBox.__init__(self, False, 5)
self.property = prop
label = gtk.Label(prop.nickName)
self.pack_start(label, False, False)
if prop.type == BaseObject.PROPTYPE_COLOR:
b = gtk.ColorButton()
b.set_color(prop.value)
b... | fredmorcos/attic | projects/opengrafik/opengrafik_20090719_python_gtk/PropertiesPane.py | Python | isc | 2,534 |
f = lambda n: 1 if n < 2 else f(n-1) + f(n-2)
g = lambda m: map(f, range(0,m))
print sum(g(7))
| Dawny33/Code | Hackerrank/Codeathon Unleashed/test.py | Python | gpl-3.0 | 96 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import importlib
import inspect
import json
import logging
import os
import sys
import types
from azure.common.credentials import BasicTokenAuthentication
from azure.core.credentials import AccessToken
from azure.identity import (AzureCliC... | alfredgamulo/cloud-custodian | tools/c7n_azure/c7n_azure/session.py | Python | apache-2.0 | 14,857 |
import numpy as np
'''my rk4'''
def rk4(f,y0,a0,I0,dt,T):
mysolu=[]
mysola=[]
mysolI=[]
mytime=[]
t=0
un=y0
an=a0
In=I0
mytime.append(t)
mysolu.append(un)
mysola.append(an)
mysolI.append(In)
while t<=T:
k1_e,k1_a,k1_I=f(un,an,In,t)
k2_e,k2_a,k2_I=f(un+(dt/2)*k1_e,an+(dt/2)*k1_a,In+(dt/2)*k1_I,t+dt/2... | ulisespereira/PereiraBrunel2016 | figure1/myintegrator.py | Python | gpl-2.0 | 754 |
#!/usr/local/bin/python3
import cgi
print("Content-type: text/html")
print('''
<!DOCTYPE html>
<html>
<head>
<title>Linux</title>
</head>
<body>
<h1>Linux</h1>
<p>Linux</p>
<p>This is the article for Linux</p>
</body>
</html>
''')
| Secretmapper/updevcamp-session-2-dist | form/cgi-bin/lectures/simple/linux.py | Python | mit | 268 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# ThinkOpen Solutions Brasil
# Copyright (C) Thinkopen Solutions <http://www.tkobr.com>.
#
# This... | elego/tkobr-addons | unported/tko_l10n_br_hr/l10n_br_hr.py | Python | agpl-3.0 | 17,315 |
# Copyright (c) 2001-2006 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module provides wxPython event loop support for Twisted.
In order to use this support, simply do the following::
| from twisted.internet import wxreactor
| wxreactor.install()
Then, when your root wxApp has been cre... | sorenh/cc | vendor/Twisted-10.0.0/twisted/internet/wxreactor.py | Python | apache-2.0 | 5,270 |
# Copyright (C) 2016 Rafael Moura
import io
import sys
from parser import *
def main():
try:
file = open(sys.argv[1], "r");
except Exception as err:
sys.stderr.write("open file failed: " + str(err) + "\n");
lines = file.readlines();
file.close();
parse(lines);
try:
ofile = open("output.bin", "wb... | dhustkoder/EMT | OP_CPU_MEMORY/assembler/py_asm1/main.py | Python | gpl-3.0 | 495 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib as mpl
import seaborn as sb
import sys
import time
from scipy import stats
def id( x ):
return x
def cleanCSV( csv_in, csv_out ):
Data = pd.read_csv( csv_in )
dontWant = [
'OTHER PROPE... | CKPalk/SeattleCrime_DM | DataMining/Stats/data_reduction.py | Python | mit | 1,356 |
#!/usr/bin/env python
# encoding: utf-8
import os
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
from tbone import __version__
def read(f):
return open(os.path.join(os.path.dirname(__file__), ... | 475Cumulus/TBone | setup.py | Python | mit | 1,316 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'CustomUser.language'
db.delete_column('app_customuser', 'language')
# Changing f... | eduherraiz/foowill | app/migrations/0006_auto__del_field_customuser_language__chg_field_tweet_user.py | Python | mit | 7,011 |
import json
import os
from datetime import datetime
from tempfile import NamedTemporaryFile
from time import strftime, strptime
from django.views.decorators.http import require_POST
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.http import HttpResponseForbidden,\
... | SEL-Columbia/formhub | odk_viewer/views.py | Python | bsd-2-clause | 27,537 |
# -*- coding: utf-8 -*-
# * 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, or (at your option)
# * any later version.
# *
# * This Program is distributed in the hope th... | AmbiBox/kodi.script.ambibox | resources/lib/media.py | Python | gpl-2.0 | 2,410 |
# coding: utf-8
from mongomock import MongoClient as MockMongoClient
from .base import *
# For tests, don't use KoBoCAT's DB
DATABASES = {
'default': dj_database_url.config(default='sqlite:///%s/db.sqlite3' % BASE_DIR),
}
DATABASE_ROUTERS = ['kpi.db_routers.TestingDatabaseRouter']
TESTING = True
# Decrease pro... | kobotoolbox/kpi | kobo/settings/testing.py | Python | agpl-3.0 | 664 |
#
# 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/.
#
# Copyright (c) 2015 Digi International Inc., All Rights Reserved.
#
import os
import dj_database_url
import binasci... | brucetsao/xbeewificloudkit | xbeewifiapp/settings.py | Python | mpl-2.0 | 12,120 |
# force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append("../../../../../../../")
import GeneralUtil.python.PlotUtilities as pPlotUtil
impo... | prheenan/Research | Perkins/Projects/Conferences/2016_7_CPLC/Day2_FRET_Dynamics/HistogramPlotting/MainHistogramAnalysis.py | Python | gpl-3.0 | 3,830 |
import logging
from itertools import count
from hashlib import sha1
from sqlalchemy.sql import and_, expression
from sqlalchemy.schema import Column, Index
from sqlalchemy import alias
from dataset.persistence.util import guess_type, normalize_column_name
from dataset.persistence.util import ResultIter
from dataset.ut... | askebos/dataset | dataset/persistence/table.py | Python | mit | 15,871 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
impor... | areitz/pants | src/python/pants/backend/codegen/tasks/simple_codegen_task.py | Python | apache-2.0 | 19,854 |
class Car(object):
def __init__(self, name='General', model='GM', vehicle_type=None):
self.speed = 0
self.name = name
self.model = model
self.vehicle_type = vehicle_type
if self.name in ['Porshe', 'Koenigsegg']:
self.num_of_doors = 2
else:
self.num_of_doors = 4
if self.vehic... | anthonyndunguwanja/Anthony-Ndungu-bootcamp-17 | Day 2/Car_Class_Lab.py | Python | mit | 825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.