text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | lib/spack/spack/cmd/clone.py | Python | lgpl-2.1 | 3,972 | 0 |
import squeezeboxserver
import time
squeezebox = squeezeboxserver.SqueezeboxServer("192.168.1.65:9000")
players = squeezebox.players()
for p in players:
print ("MAC: %s" % p['playerid'])
time.sleep(10)
squeezebox.power("00:04:20:06:8c:55", "on")
squeezebox.playlist("00:04:20:06:8c:55", "play")
time... | JoakimLindbom/agocontrol | devices/squeezeboxserver/slimtest.py | Python | gpl-3.0 | 443 | 0.002257 |
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
#
# 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
# with... | houzhenggang/hiwifi-openwrt-HC5661-HC5761 | staging_dir/host/lib64/scons-2.1.0/SCons/Tool/MSCommon/__init__.py | Python | gpl-2.0 | 2,107 | 0.000949 |
import re
def fun(s):
# return True if s is a valid email, else return False
f = "^[a-zA-Z][\w-]*@[a-zA-Z0-9]+\.[a-zA-Z]{1,3}$"
if not re.match(f, s):
return False
username, after = re.split(r'[@]', s)
websitename, extension = re.split(r'[.]', after)
if(len(extension) > 3):
ret... | kakaba2009/MachineLearning | python/src/algorithm/coding/regex/email.py | Python | apache-2.0 | 614 | 0.004886 |
from models import Event
from django.views.generic import DetailView, ListView
class EventListView(ListView):
template_name = 'agenda/event_list.html'
queryset = Event.objects.upcoming()
paginate_by = 20
class EventArchiveview(EventListView):
queryset = Event.objects.past()
class EventDetailV... | feinheit/feincms-elephantagenda | elephantagenda/views.py | Python | mit | 403 | 0 |
# 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... | keras-team/keras | keras/layers/merging/maximum.py | Python | apache-2.0 | 2,842 | 0.001759 |
#!/usr/bin/env python
"""
demonstrate adding a FigureCanvasGTK3Agg widget to a Gtk.ScrolledWindow
using GTK3 accessed via pygobject
"""
from gi.repository import Gtk
from matplotlib.figure import Figure
from numpy import arange, sin, pi
from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanv... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/mpl_examples/user_interfaces/embedding_in_gtk3.py | Python | mit | 834 | 0.014388 |
import os
import sys
from Bio import Entrez
import wx
from xml.dom import minidom
import re
class etPlugin():
def GetName(self):
'''
Method to return name of tool
'''
return "ESummary"
def GetBMP(self, dirH):
'''
Method to return identifying image
''... | fxb22/BioGUI | plugins/Tools/ETOOLSPlugins/ESummary.py | Python | gpl-2.0 | 3,669 | 0.016898 |
#!/usr/bin/env
import subprocess, os, random, copy
output_filename = "twelvetone_ex.ly"
output_file = open(output_filename, "w")
notes = ['c','cis','d','dis','e','f','fis','g','gis','a','ais','b']
temp_tt_array = []
def twelvetone_gen():
notes_svd = copy.copy(notes)
a = 11
while len(temp_tt_array) < 12... | giannotr/misc-python | twelvetone.py | Python | gpl-2.0 | 1,207 | 0.014085 |
#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
import sys
import unittest
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.codec.der.encoder import encode as der_encoder
f... | etingof/pyasn1-modules | tests/test_rfc4043.py | Python | bsd-2-clause | 4,870 | 0.000411 |
"""
Filenames of the tests
"""
import os
from os.path import join as pjoin
from .. import LiF_g4
# This is a 2x2x2 q-point grid. The weights can be obtained from abinit.
nqpt = 3
wtq = [0.125, 0.5, 0.375]
# Indices of the q-points in the 4x4x4 grid.
iqpt_subset = [0, 2, 6]
dirname = os.path.dirname(__file__)
fna... | jmbeuken/abinit | scripts/post_processing/ElectronPhononCoupling/ElectronPhononCoupling/data/LiF_g2_2/__init__.py | Python | gpl-3.0 | 668 | 0 |
"""
"""
from Tkinter import *
from areavi import AreaVi
from ttk import Notebook
class PanedHorizontalWindow(PanedWindow):
"""
"""
def __init__(self, *args, **kwargs):
"""
"""
PanedWindow.__init__(self, orient=HORIZONTAL, *args, **kwargs)
def create_area(self):
""... | kk9599/vy | vyapp/notevi.py | Python | mit | 2,502 | 0.003597 |
#----------------------------------------------------------------------
# Copyright (c) 2011-2015 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | plantigrade/geni-tools | src/gcf/omnilib/frameworks/framework_base.py | Python | mit | 14,946 | 0.004416 |
"""
WSGI config for elixirapp project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os, sys
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | bio-tools/biotoolsregistry | backend/elixirapp/wsgi.py | Python | gpl-3.0 | 487 | 0.004107 |
# -*- coding: utf-8 -*-
"""
database.use_tornado_database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using tornado.database with MySQL
http://flask.pocoo.org/snippets/11/
"""
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from tornado.database import Connectio... | fengsp/flask-snippets | database/use_tornado_database.py | Python | bsd-3-clause | 1,247 | 0.004812 |
from biokbase.workspace.client import Workspace
from biokbase.narrative_method_store.client import NarrativeMethodStore
from biokbase.userandjobstate.client import UserAndJobState
from biokbase.catalog.Client import Catalog
from biokbase.service.Client import Client as ServiceClient
from biokbase.execution_engine2.exec... | pranjan77/narrative | src/biokbase/narrative/clients.py | Python | mit | 1,813 | 0.002758 |
# _*_ coding: utf-8 _*_
import os
try:
from cStringIO import StringIO # python 2
except ImportError:
from io import StringIO # python 3
from collections import OrderedDict
import unittest
from tornado.escape import to_unicode
from tortik.util import make_qs, update_url, real_ip
from tortik.util.xml_etree im... | glibin/tortik | tortik_tests/util_test.py | Python | mit | 7,001 | 0.00432 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | vlegoff/tsunami | src/primaires/pnj/commandes/chemin/voir.py | Python | bsd-3-clause | 3,490 | 0.000287 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | synsun/robotframework | src/robot/utils/normalizing.py | Python | apache-2.0 | 3,790 | 0.000264 |
import os
from sqlalchemy import create_engine, MetaData
from sqlalchemy.orm import scoped_session, sessionmaker
metadata = MetaData()
def get_sa_db_uri(driver='', username='', password='', host='', port='', database=''):
"""get SQLAlchemy DB URI: driver://username:password@host:port/database"""
assert driv... | schettino72/serveronduty | websod/database.py | Python | mit | 1,071 | 0.002801 |
# 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... | hehongliang/tensorflow | tensorflow/python/training/optimizer_test.py | Python | apache-2.0 | 12,617 | 0.00959 |
# Copyright (C) 2017 Nippon Telegraph and Telephone 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 appli... | shinpeimuraoka/ryu | ryu/lib/netdevice.py | Python | apache-2.0 | 4,034 | 0.002231 |
"""
keyring_demo.py
This demo shows how to create a new keyring and enable it in keyring lib.
Created by Kang Zhang on 2009-07-12
"""
import os
KEYRINGRC = "keyringrc.cfg"
def load_keyring_by_config():
"""This function shows how to enable a keyring using config file
"""
# create the config file
co... | robinson96/GRAPE | keyring/demo/keyring_demo.py | Python | bsd-3-clause | 2,347 | 0.005113 |
#!/usr/bin/env python
from algorithms.sorting.selection_sort import *
from __prototype__ import *
if __name__ == '__main__':
test_all(selection_sort) | pymber/algorithms | tests/run-test-sort-selection.py | Python | mit | 154 | 0.006494 |
# Data fitting wrappers with optimized parameters.
#
# Copyright (C) 2010-2011 Huang Xin
#
# See LICENSE.TXT that came with this file.
from __future__ import division
import math
import numpy as np
import scipy.ndimage as nd
from sinusoidfitter import onedsinusoidfit,onedsinusoid
from gaussfitter import gaussfit,oned... | chrox/RealTimeElectrophy | Experimenter/DataProcessing/Fitting/Fitters.py | Python | bsd-2-clause | 7,874 | 0.04318 |
# coding=utf-8
# Copyright 2020 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 requ... | frreiss/tensorflow-fred | tensorflow/python/distribute/collective_util.py | Python | apache-2.0 | 8,799 | 0.002842 |
from __future__ import print_function
import numpy as np
from stompy.grid import exact_delaunay, unstructured_grid
Triangulation=exact_delaunay.Triangulation
from stompy.spatial import robust_predicates
def test_gen_intersected_elements():
dt = Triangulation()
pnts = [ [0,0],
[5,0],
... | rustychris/stompy | test/test_exact_delaunay2.py | Python | mit | 2,185 | 0.040732 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.http import JsonRespons... | shawnadelic/shuup | shuup/simple_supplier/admin_module/views.py | Python | agpl-3.0 | 6,626 | 0.002717 |
import os
import psutil
import sys
__all__ = [
'BeerProgress'
]
_default_display = {
'cpu': True,
'mem': True,
'progressbar': True,
'percent': True,
'tasks_ratio': True,
'skipped_tasks': True,
'fd_count': True,
'context_switches': True
}
class BeerProgress(object):
def __in... | fcvarela/beerprogress | beerprogress/__init__.py | Python | bsd-3-clause | 3,534 | 0.001698 |
import random
import sys
sys.setrecursionlimit(7000)
def selection_sort(array, counter):
for i in range(0,len(array)):
min_val = array[i:len(array)+1][0]
for j in array[i:len(array)+1]:
counter += 1
if j < min_val:
min_val = j
k = array[i:len(array)+... | SulavKhadka/Sorting-Algorithms | sort_algos.py | Python | mit | 4,236 | 0.004013 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Contains common test fixtures used to run unit tests.
"""
import sys
# This is needed so Python can find test_tools on the path.
sys.path.append('../../..')
from test_tools.fixtures.common import *
| awsdocs/aws-doc-sdk-examples | python/example_code/apigateway/aws_service/test/conftest.py | Python | apache-2.0 | 311 | 0.003215 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import glob
import os
import subprocess
import sys
from idl_option import GetOption, Option... | chromium/chromium | ppapi/generators/idl_diff.py | Python | bsd-3-clause | 9,131 | 0.02048 |
# Problem B
# Small dataset
# O = G = V = 0. (Each unicorn has only one hair color in its mane.)
def solve(N, R, Y, B):
res = ""
imp = "IMPOSSIBLE "
if sum((R,Y,B)) == 0:
return ""
if max(R,Y,B) > N//2 :
return imp
if (R==Y) and (Y==B):
return "RYB"*R
elif (R==Y) and... | subhrm/google-code-jam-solutions | solutions/2017/1B/B/B_small.py | Python | mit | 1,604 | 0.01808 |
# -*- coding: utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
| sociateru/django-iprestrict | iprestrict/migrations/__init__.py | Python | bsd-3-clause | 117 | 0.008547 |
class InvalidUsage(Exception):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
self.status_code = status_code
self.payload = payload
def to_dict(self):
... | xstreck1/TREMPPI | python/tremppi/server_errors.py | Python | gpl-3.0 | 1,278 | 0.000782 |
"""Tests for the frequency module in analysis"""
import pytest
from lantern.analysis import frequency
def test_frequency_analyze():
"""Testing frequency analyze works for ngram = 1"""
assert frequency.frequency_analyze("abb") == {'a': 1, 'b': 2}
def test_frequency_analyze_bigram():
"""Testing frequenc... | CameronLonsdale/lantern | tests/analysis/test_frequency.py | Python | mit | 2,466 | 0.001622 |
# -*- coding: utf-8 -*-
"""
Author
------
Bo Zhang
Email
-----
bozhang@nao.cas.cn
Created on
----------
- Sat Sep 03 12:00:00 2016
Modifications
-------------
- Sat Sep 03 12:00:00 2016
Aims
----
- normalization
Notes
-----
This is migrated from **SLAM** package
"""
from __future__ import division
import numpy... | hypergravity/hrs | twodspec/normalization.py | Python | bsd-3-clause | 8,493 | 0.000118 |
#!/usr/bin/env python
import json
import optparse
import os
import subprocess
import sys
import tempfile
CHUNK_SIZE = 2**20
DEFAULT_DATA_TABLE_NAME = "bowtie_indexes"
def get_id_name( params, dbkey, fasta_description=None):
# TODO: ensure sequence_id is unique and does not already appear in location file
se... | nturaga/tools-iuc | data_managers/data_manager_bowtie_index_builder/data_manager/bowtie_index_builder.py | Python | mit | 4,124 | 0.023763 |
# -*- coding: utf-8 -*-
from psycopg2 import IntegrityError
from openerp.addons.mail.tests.common import TestMail
class TestMailFollowers(TestMail):
def setUp(self):
super(TestMailFollowers, self).setUp()
Subtype = self.env['mail.message.subtype']
self.mt_mg_def = Subtype.create({'name':... | minhphung171093/GreenERP_V9 | openerp/addons/mail/tests/test_mail_followers.py | Python | gpl-3.0 | 7,126 | 0.004491 |
# Copyright 2019 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/clusterfuzz | src/clusterfuzz/_internal/bot/minimizer/html_minimizer.py | Python | apache-2.0 | 7,964 | 0.005399 |
#!/usr/bin/env python
__author__ = 'waroquiers'
import unittest
from pymatgen.util.testing import PymatgenTest
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import ExplicitPermutationsAlgorithm
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import... | setten/pymatgen | pymatgen/analysis/chemenv/coordination_environments/tests/test_coordination_geometries.py | Python | mit | 14,930 | 0.004488 |
from AsynMongo import Collection
| XianwuLin/AsynMongo | __init__.py | Python | mit | 33 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_osm_find_first
----------------------------------
Tests for `osm-find-first` module.
"""
import unittest
import tempfile
import re
import httpretty
import osm_find_first
def v(string):
return string.format(version=osm_find_first.__version__)
class Test... | rory/osm-find-first | tests/test_osm_find_first.py | Python | gpl-3.0 | 3,556 | 0.002812 |
# Python - 3.6.0
Test.assert_equals(cube_checker(-12,2), False)
Test.assert_equals(cube_checker(8, 3), False)
Test.assert_equals(cube_checker(8, 2), True)
Test.assert_equals(cube_checker(-8,-2), False)
Test.assert_equals(cube_checker(0, 0), False)
Test.assert_equals(cube_checker(27, 3), True)
Test.assert_equals(cub... | RevansChen/online-judge | Codewars/8kyu/find-out-whether-the-shape-is-a-cube/Python/test.py | Python | mit | 579 | 0.01209 |
# Copyright (c) 2011 OpenStack Foundation
# 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 ... | Francis-Liu/animated-broccoli | nova/scheduler/host_manager.py | Python | apache-2.0 | 32,388 | 0.000494 |
# -*- coding: utf-8 -*-
"""
Cookie handling module. (Ripped from coursera-dl)
TODO: Convert to Hy and make generic.
"""
import logging
import os
import ssl
import tempfile
import getpass
import requests
from requests.adapters import HTTPAdapter
try: # Workaround for broken Debian/Ubuntu packages? (See issue #331)
... | skeledrew/web-dl | cookies.py | Python | agpl-3.0 | 10,859 | 0.000829 |
from .settings import info
class get_settings:
def __init__(self):
self.settings = info()
self.repo = self.settings['repo']
self.repo_path = self.repo['repo_path']
self.repo_url = self.repo['repo_url']
self.key = self.repo['ssh_key']
self.slack = self.settings['slack... | persepolisdm/translation-API | pdm_api/settings/__init__.py | Python | gpl-3.0 | 688 | 0.001453 |
"""
* Copyright (c) 2012-2017, Nic McDonald and Adriana Flores
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, t... | adrifloresm/sssweep | setup.py | Python | bsd-3-clause | 2,611 | 0.003064 |
major = 0
minor = 37
patch = 0
| vovanbo/aiohttp_json_api | punch_version.py | Python | mit | 31 | 0 |
import json
from requests import Request, Session
class Requester:
@staticmethod
def verifyconnection(url="http://google.com"):
return Requester.request(url, method='GET', decode=False)
@staticmethod
def request(url, method=None, data=None, decode=True):
if not url.startswith('http://... | Bioto/Huuey-python | huuey/requester.py | Python | mit | 809 | 0.001236 |
#
# Copyright (C) 2000 Stephen Davies
# Copyright (C) 2000 Stefan Seefeld
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
from Synopsis.Processor import Parameter
from Synopsis import FileTree
from Synopsis.Formatters.HTML.View import View
f... | stefanseefeld/synopsis | Synopsis/Formatters/HTML/Views/FileListing.py | Python | lgpl-2.1 | 2,722 | 0.019471 |
mustBeAdmin = ['You must be the webadmin to access this page.','danger']
mustBeStudentCoord = ['You must be a student coordinator to access this page.','danger']
from sockdefs import *
print("forming routes...")
monkey.patch_all()
# MAIN EVENTS PAGE #
@app.route('/', methods=['GET', 'POST'])
def index():
if requ... | theapricot/oppapp2 | app.py | Python | mit | 13,357 | 0.013626 |
#!/usr/bin/python
###############################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
# All Rights Reserved
######################################################################... | MarcosCommunity/odoo | comunity_modules/costing_method_settings/__openerp__.py | Python | agpl-3.0 | 1,761 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-error-reporting | google/cloud/errorreporting_v1beta1/services/error_group_service/client.py | Python | apache-2.0 | 25,457 | 0.001453 |
#!/usr/bin/env python
#
# -----------------------------------------------------------------------------
# Copyright (C) 2015 Daniel Standage <daniel.standage@gmail.com>
#
# This file is part of tag (http://github.com/standage/tag) and is licensed
# under the BSD 3-clause license: see LICENSE.
# ------------------------... | standage/tag | tag/__init__.py | Python | bsd-3-clause | 1,438 | 0 |
SECRET_KEY = 'secret'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
... | jobec/django-auth-adfs | tests/settings.py | Python | bsd-2-clause | 2,308 | 0 |
# -*- coding:utf-8 -*-
from django.db import models
# Create your models here.
class UserType(models.Model):
display = models.CharField(max_length=50)
def __unicode__(self):
return self.display
class Admin(models.Model):
username = models.CharField(max_length=50)
password = models.Cha... | zhangyage/Python-oldboy | day14/BBS/web/models.py | Python | apache-2.0 | 1,693 | 0.022011 |
import serial,time,socket
import hart_protocol
import sys
port = 3
if len(sys.argv) < 4:
print "Error, usage " + sys.argv[0] + " port long_address new_longtag"
print "Usage hex string (5 hex digits) as address and LATIN-1 string as new long tag"
quit()
address = sys.argv[2].decode('hex')
if len(addr... | Darkkey/hartinsecurity | hart_change_longtag.py | Python | bsd-2-clause | 1,068 | 0.015918 |
# Linktastic Module
# - A python2/3 compatible module that can create hardlinks/symlinks on windows-based systems
#
# Linktastic is distributed under the MIT License. The follow are the terms and conditions of using Linktastic.
#
# The MIT License (MIT)
# Copyright (c) 2012 Solipsis Development
#
# Permission is here... | tortib/nzbToMedia | nzbtomedia/linktastic/linktastic.py | Python | gpl-3.0 | 4,260 | 0.00493 |
from ailment.expression import UnaryOp
from .base import PeepholeOptimizationExprBase
class RemoveRedundantNots(PeepholeOptimizationExprBase):
__slots__ = ()
name = "Remove redundant Nots"
expr_classes = (UnaryOp, ) # all expressions are allowed
def optimize(self, expr: UnaryOp):
# Not(No... | angr/angr | angr/analyses/decompiler/peephole_optimizations/remove_redundant_nots.py | Python | bsd-2-clause | 531 | 0 |
#!/usr/bin/env python
r"""
crate_anon/nlp_webserver/views.py
===============================================================================
Copyright (C) 2015-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CRATE.
CRATE is free software: you can redistribute it and/or modify
it under... | RudolfCardinal/crate | crate_anon/nlp_webserver/views.py | Python | gpl-3.0 | 30,270 | 0 |
import urllib.parse
from wptserve.utils import isomorphic_encode
def main(request, response):
"""Handler that causes multiple redirections. Redirect chain is as follows:
1. Initial URL containing multi-redirect.py
2. Redirect to cross-origin URL
3. Redirect to same-origin URL
4. Fin... | scheib/chromium | third_party/blink/web_tests/external/wpt/resource-timing/resources/multi_redirect.py | Python | bsd-3-clause | 2,682 | 0.003356 |
from flask_login import LoginManager
from server.users.models import User
login_manager = LoginManager()
@login_manager.user_loader
def load_user(user_id):
return User.get(user_id=user_id)
| Ideabin/Ideabin | server/login.py | Python | gpl-3.0 | 197 | 0 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, copy, json
from frappe import _, msgprint
from frappe.utils import cint
import frappe.share
rights = ("read", "write", "create", "delete", "submit", "cancel", "ame... | indictranstech/reciphergroup-frappe | frappe/permissions.py | Python | mit | 13,272 | 0.026597 |
from playerGst import *
| JeffHoogland/qAndora | playerGst/__init__.py | Python | bsd-3-clause | 24 | 0 |
import wx
from PIL import Image
from vistas.core.threading import Thread
from vistas.ui.controls.static_image import StaticImage
from vistas.ui.utils import make_window_transparent
LegendRenderEvent, EVT_LEGEND_RENDERED = wx.lib.newevent.NewEvent()
class LegendWindow(wx.Frame):
""" A window for showing a render... | VISTAS-IVES/pyvistas | source/vistas/ui/windows/legend.py | Python | bsd-3-clause | 8,666 | 0.001154 |
import random
def prio():
action_lst = []
lim = 1000
for _ in range(lim):
k = random.randint(1, 201)
action_lst.append(k)
return action_lst
| VRaviTheja/SDN-policy | flowgenerator/random_priority.py | Python | apache-2.0 | 180 | 0.005556 |
__author__ = 'Tom'
import pickle
import urllib2
import os
import pymel.core as pm
import project_data as prj
reload(prj)
class updater():
def __init__(self):
self.master_url = 'https://raw.githubusercontent.com/tb-animator/tbtools/master/'
self.realPath = os.path.realpath(__file__)
self.ba... | tb-animator/tbtools | updater.py | Python | mit | 5,495 | 0.008735 |
import pymongo
import getpass
import os
import base64
import ConfigParser
import sys
from database import *
from pymongo.errors import DuplicateKeyError
db, logger = None, None
def setup_config(args):
'''Saves MongoDB settings to a configuration file'''
config = ConfigParser.SafeConfigParser()
config.a... | oicr-ibc/cssscl | cssscl/configure.py | Python | gpl-3.0 | 1,425 | 0.006316 |
# Copyright 2011-2018 Nick Boultbee
#
# 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.
import os
from urllib.parse impor... | Mellthas/quodlibet | quodlibet/ext/songsmenu/website_search.py | Python | gpl-2.0 | 6,154 | 0.000163 |
# coding=utf-8
# Copyright 2017 Christopher Bartz <bartz@dkrz.de>
#
# 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 app... | cbartz/git-lfs-swift-server | git_lfs_swift_server/__init__.py | Python | apache-2.0 | 637 | 0 |
import django_filters
from django.contrib.auth import get_user_model
from .models import Sprint, Task
User = get_user_model()
class NullFilter(django_filters.BooleanFilter):
"""Filter on a field set as null or not."""
def filter(self, qs, value):
if value is not None:
return qs.filte... | guiandmag/scrum-django | board/forms.py | Python | apache-2.0 | 1,021 | 0 |
from lxml import etree
import sys
REQUEST_BODY_PART_1 = '<![CDATA[actualEvent='
REQUEST_BODY_PART_2 = '&queryEmail='
REQUEST_BODY_PART_3 = ']]>'
CONTENT_TYPE = 'Content-type: application/x-www-form-urlencoded'
def usage():
print "python create_test_case [URL]"\
" [EVENT_NAME] [AMOUNT_CASES] [TEST_CASE_FI... | Ezetowers/AppEngine_EventsManagement | load_tests/QueryGuest_Case/query_guests.py | Python | mit | 1,268 | 0.002366 |
from django.apps import AppConfig
class ReqsConfig(AppConfig):
name = 'reqs'
| inspectorbean/spat | reqs/apps.py | Python | gpl-3.0 | 83 | 0 |
import sys
import os
import importlib
import glob
# Imoprt and instantiate each Cmd object.
_this_dir = os.path.dirname(__file__)
_this_mod = os.path.basename(_this_dir)
def build_cmds(sub_parser):
cmd_objs = {}
imlist = glob.glob(os.path.join(_this_dir, "*.py"))
imlist.remove(os.path.join(_this_dir, "... | jeffbuttars/pcm | pcmpy/cmds/__init__.py | Python | mit | 876 | 0.001142 |
# -*- coding: utf-8 -*-
"""
werkzeug.serving
~~~~~~~~~~~~~~~~
There are many ways to serve a WSGI application. While you're developing
it you usually don't want a full blown webserver like Apache but a simple
standalone one. From Python 2.5 onwards there is the `wsgiref`_ server in
the standa... | nateprewitt/werkzeug | werkzeug/serving.py | Python | bsd-3-clause | 25,464 | 0.000589 |
#!/usr/bin/env python
#
# Software License Agreement (BSD License)
#
# Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source co... | tu-darmstadt-ros-pkg/hector_diagnostics | hector_computer_monitor/scripts/cpu_monitor.py | Python | bsd-3-clause | 31,998 | 0.013938 |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | SickGear/SickGear | lib/simplejson/__init__.py | Python | gpl-3.0 | 24,480 | 0.001348 |
# -*- coding: utf-8 -*-
#
# This file is part of the jabber.at homepage (https://github.com/jabber-at/hp).
#
# This project 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... | jabber-at/hp | hp/core/tests/base.py | Python | gpl-3.0 | 8,383 | 0.002863 |
# Copyright 2013 IBM Corp.
#
# 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 t... | devoid/nova | nova/tests/integrated/v3/test_lock_server.py | Python | apache-2.0 | 1,568 | 0 |
# -*- coding: utf-8 -*-
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to e... | noxora/flask-base | flask/lib/python3.4/site-packages/Crypto/__init__.py | Python | mit | 1,836 | 0.001089 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import _, api, fields, models
class Job(models.Model):
_inherit = "hr.job"
_name = "hr.job"
_inherits = {'mail.alias': 'alias_id'}
@api.model
def _default_address_id(self):
return self.env.user.compan... | vileopratama/vitech | src/addons/hr_recruitment/models/hr_job.py | Python | mit | 5,037 | 0.003574 |
"""
Wire-level packet handling
"""
from mysqlproxy.types import FixedLengthInteger, \
FixedLengthString, LengthEncodedInteger, \
RestOfPacketString
from mysqlproxy import capabilities
from StringIO import StringIO
__all__ = [
'PacketMeta', 'IncomingPacketChain', 'OutgoingPacketChain',
'Packet',... | spigwitmer/mysqlproxy | mysqlproxy/packet.py | Python | bsd-3-clause | 7,817 | 0.001407 |
import time
import requests
from .exceptions import HttpError
from .json import json_loads
def check_rep(rep):
if (rep.status_code // 100) != 2:
raise HttpError(rep.text, rep.status_code)
def rep_to_json(rep):
check_rep(rep)
# we use our json loads for date parsing
return json_loads(rep.tex... | openergy/openergy | ovbpclient/rest_client.py | Python | mit | 4,045 | 0.002472 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Chris Schmidt <chris.schmidt () contrastsecurity.com>
#
# Built using https://github.com/hamnis/useful-scripts/blob/master/python/download-maven-artifact
# as a reference and starting point.
#
# GNU General Public License v3.0+ (see COPYING or https://www... | marratj/ansible | lib/ansible/modules/packaging/language/maven_artifact.py | Python | gpl-3.0 | 18,975 | 0.005586 |
from sqlalchemy import Column, Integer, String, Text, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from database.main import Base
class CreatureTemplateSchema(Base):
"""
This table holds the information about each creature in the game
entry - the unique ID of this creature
creature_nam... | Enether/python_wow | models/creatures/creature_template.py | Python | mit | 3,514 | 0.002846 |
import sys, datetime
import elasticsearch
INDEX = 'cli'
DOC_TYPE = 'cli'
def create_elasticsearch_index(es):
"""es should be an elasticsearch.Elasticsearch instance"""
es.indices.create(index = INDEX, ignore = 400) # ignore already existing index
es.indices.put_mapping(index = INDEX, doc_type = DOC_TYPE, ... | commontk/ctk-cli-indexer | ctk_cli_indexer/indexer.py | Python | apache-2.0 | 2,583 | 0.02168 |
from cobra.model.aaa import User, UserDomain
from createLocalUser import input_key_args as input_local_user
from createMo import *
def input_key_args(msg='\nPlease Specify User Domain:'):
print msg
return input_raw_input("User Domain Name", required=True)
def add_user_domain(parent_mo, user_domain):
""... | FibercorpLabs/FibercorpDevops | cisco/aci/addUserDomain.py | Python | gpl-3.0 | 1,791 | 0.003908 |
#! /usr/bin/python
import base64
import sys
f = open(sys.argv[1], "r")
items = []
for line in f.readlines():
if len(line.strip()) == 0:
continue
if line[0] == "{":
items.append(base64.b64encode(line.strip()))
else:
items.append(line.strip())
print ".".join(items)
| mozilla-services/FindMyDevice | test/buildAssert.py | Python | mpl-2.0 | 303 | 0 |
#!/usr/bin/env python
#
# test_doctests.py - test runner for COT doctests
#
# July 2016, Glenn F. Matthews
# Copyright (c) 2016-2017 the COT project developers.
# See the COPYRIGHT.txt file at the top-level directory of this distribution
# and at https://github.com/glennmatthews/cot/blob/master/COPYRIGHT.txt.
#
# This ... | glennmatthews/cot | COT/tests/test_doctests.py | Python | mit | 1,224 | 0 |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | enthought/traitsgui | enthought/pyface/timer/do_later.py | Python | bsd-3-clause | 2,116 | 0.014178 |
#
# ident/geoio.py
#
# Copyright (C) 2011 Damien Churchill <damoxc@gmail.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, or (at your option)
# any later version.
#
# Thi... | damoxc/vsmtpd | plugins/ident/geoip.py | Python | gpl-3.0 | 1,203 | 0.000831 |
# Copyright 2014-2020 Arx Libertatis Team (see the AUTHORS file)
#
# This file is part of Arx Libertatis.
#
# Arx Libertatis 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
... | Thoronador/ArxLibertatis | plugins/blender/arx_addon/dataFts.py | Python | gpl-3.0 | 10,486 | 0.005531 |
"""Web dashboard."""
import os
import sys
import json
import aiohttp
from discord.ext import commands
import util.dynaimport as di
from .cog import Cog
japronto = di.load('japronto')
sanic = di.load('sanic')
response = di.load('sanic.response')
root_dir = os.path.dirname(os.path.abspath(sys.modules['__main__'].core_fi... | Armored-Dragon/goldmine | default_cogs/web.py | Python | mit | 1,742 | 0.003444 |
#!/usr/bin/env python
#
####
# Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu>
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software
# and its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in ... | JulienMcJay/eclock | windows/Python27/Lib/Cookie.py | Python | gpl-2.0 | 25,844 | 0.010447 |
"""
drslib exceptions
"""
class TranslationError(Exception):
pass
| ESGF/esgf-drslib | drslib/exceptions.py | Python | bsd-3-clause | 73 | 0.027397 |
# Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Node objects."""
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
str = None
__metaclass__ = type
__all__ = [
"NODE_TRA... | cloudbase/maas | src/maasserver/models/node.py | Python | agpl-3.0 | 32,077 | 0.000717 |
import asyncio
from collections import defaultdict
from datetime import datetime, timedelta
from itertools import zip_longest
import os
from typing import Any, Dict, List
try:
from dateutil import parser as dp
dateutil_available = True
except:
dateutil_available = False
import discord
from discord.ext imp... | dealien/Red-Magician | cogs/survey.py | Python | gpl-3.0 | 27,575 | 0.000544 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
import applications.discount.models
class Migration(migrations.Migration):
dependencies = [
('discount', '0005_auto_20160507_2145'),
]
operations = [
migrations.Alter... | AlexStarov/Shop | applications/discount/migrations/0006_auto_20160517_2147.py | Python | apache-2.0 | 1,256 | 0.002389 |
#!/usr/bin/env python3
#
# Script for polling N64/GC SI bus devices
#
# This script uses the serial bridge and pool in loops
# for the buttons status.
#
# It currently supports N64 controllers, N64 mouses & GameCube controllers.
#
# --Jacques Gagnon <darthcloud@gmail.com>
#
from bus import Bus
from collections import ... | darthcloud/cube64-dx | notes/poll.py | Python | gpl-2.0 | 6,079 | 0.023195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.