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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
'''
Copyright (C) 2012-2015 Diego Torres Milano
Created on Feb 2, 2012
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
Un... | akimo12345/AndroidViewClient | src/com/dtmilano/android/viewclient.py | Python | apache-2.0 | 183,943 | 0.007245 |
from django.conf import settings
from django.db.models import Q
from libs.django_utils import render_to_response
from django.views.generic import ListView
from springboard.models import IntranetApplication
from django.contrib.auth.decorators import login_required
from alerts.models import Alert
class SpringBoard(List... | instituteofdesign/django-lms | apps/springboard/views.py | Python | bsd-3-clause | 1,051 | 0.005709 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class GoogleAppSetup(Document):
pass
| saurabh6790/google_integration | google_integration/google_connect/doctype/google_app_setup/google_app_setup.py | Python | mit | 280 | 0.007143 |
from logan.runner import run_app, configure_app
import sys
import base64
import os
KEY_LENGTH = 40
CONFIG_TEMPLATE = """
from fabric_bolt.core.settings.base import *
CONF_ROOT = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(... | brajput24/fabric-bolt | fabric_bolt/utils/runner.py | Python | mit | 1,251 | 0.000799 |
# -*- coding: utf-8 -*-
from __future__ import division
# -*- coding: utf-8 -*-
#
# Sphinx documentation build configuration file, created by
# sphinx-quickstart.py on Sat Mar 8 21:47:50 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, ... | zetaops/SpiffWorkflow | doc/conf.py | Python | lgpl-3.0 | 5,907 | 0.003894 |
# -*- coding: utf-8 -*-
import unittest
class PilhaVaziaErro(Exception):
pass
class Pilha():
def __init__(self):
self.lista = []
def topo(self):
if self.lista:
return self.lista[-1]
raise PilhaVaziaErro()
def vazia(self):
return not bool(self.lista)
... | trgomes/estrutura-de-dados | Exercicios/5-balanceamento.py | Python | mit | 3,019 | 0.002659 |
import os
import sys
from setuptools import setup, find_packages
version = '0.3.3'
def get_package_manifest(filename):
packages = []
with open(filename) as package_file:
for line in package_file.readlines():
line = line.strip()
if not line:
continue
... | njoyce/sockjs-gevent | setup.py | Python | mit | 2,151 | 0.00186 |
################################ FIG J.2 P.683 ################################
import matplotlib.pyplot as plt
def freqplot(fdata, ydata, symbol='', ttl='', xlab='Frequency (Hz)', ylab=''):
""" FREQPLOT - Plot a function of frequency. See myplot for more features."""
#not sure what this means
#if nar... | vberthiaume/digitalFilters | ch2/freqplot.py | Python | gpl-3.0 | 469 | 0.01919 |
# Copyright 2013. Amazon Web Services, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | baida21/py-flask-signup | tests/application-tests.py | Python | apache-2.0 | 1,642 | 0.004263 |
# -*- coding: utf-8 -*-
#
# Misaka documentation build configuration file, created by
# sphinx-quickstart on Sun Jul 12 11:37:42 2015.
#
# 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.
#
# Al... | hepochen/hoedown_misaka | docs/conf.py | Python | mit | 9,639 | 0.005602 |
# Copyright (C) 2016 - Yevgen Muntyan
# Copyright (C) 2016 - Ignacio Casal Quinteiro
# Copyright (C) 2016 - Arnavion
#
# 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... | wingtk/gvsbuild | gvsbuild/projects/graphene.py | Python | gpl-2.0 | 1,663 | 0.001203 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Скрипт извлекает слова из текстового файла и сортирует их по частоте.
# С помощью модуля pymorphy2 можно привести слова к начальной форме (единственное число, именительный падеж).
# Нужен pymorphy2 и русскоязычный словарь для него!
# pip install --user pymorphy2
# Прим... | Shadybloom/synch-profiler | wordfreq-morph.py | Python | mit | 7,594 | 0.006508 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, OneLogin, Inc.
# All rights reserved.
from base64 import b64decode
import json
from lxml import etree
from os.path import dirname, join, exists
import unittest
from xml.dom.minidom import parseString
from onelogin.saml2 import compat
from onelogin.saml2.constants import ... | pitbulk/python3-saml | tests/src/OneLogin/saml2_tests/utils_test.py | Python | bsd-3-clause | 40,950 | 0.004274 |
# -*- 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 or... | googleads/google-ads-python | google/ads/googleads/v10/enums/types/payment_mode.py | Python | apache-2.0 | 1,172 | 0.000853 |
# -*- Mode: Python; test-case-name: -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU L... | flumotion-mirror/flumotion | flumotion/component/misc/httpserver/serverstats.py | Python | lgpl-2.1 | 7,784 | 0 |
# -*- coding: utf-8 -*-
__all__ = ["inet_aton", "record_by_ip", "record_by_request", "get_ip",
"record_by_ip_as_dict", "record_by_request_as_dict"]
import struct
import socket
from geoip.defaults import BACKEND, REDIS_TYPE
from geoip.redis_wrapper import RedisClient
from geoip.models import Range
_RECOR... | gotlium/django-geoip-redis | geoip/geo.py | Python | gpl-3.0 | 1,723 | 0 |
# -*- coding: utf-8 -*-
"""Tests that use cross-checks for generic methods
Should be easy to check consistency across models
Does not cover tsa
Initial cases copied from test_shrink_pickle
Created on Wed Oct 30 14:01:27 2013
Author: Josef Perktold
"""
from statsmodels.compat.python import range
import numpy as np
i... | rgommers/statsmodels | statsmodels/base/tests/test_generic_methods.py | Python | bsd-3-clause | 12,158 | 0.003208 |
#!/usr/bin/env python
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | leighpauls/k2cro4 | third_party/webpagereplay/replay.py | Python | bsd-3-clause | 20,951 | 0.011503 |
from RemoteFlSys import *
class gfeReader:#GetFilesExts Reader
def __init__(self, Reader, Params, AddInfo, OneTime = True):
self.Params = Params
self.Reader = Reader
self.AddInfo = AddInfo
self.Once = OneTime
class fsDirInf:
def __init__(self, SuperDir, Name, DictFlInfs, ... | KyleTen2/ReFiSys | FlSys.py | Python | mit | 13,483 | 0.011941 |
#!/usr/bin/env python
#
# 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 "Li... | snowflakedb/spark-snowflake | legacy/dev/merge_pr.py | Python | apache-2.0 | 18,840 | 0.004299 |
import unittest
import traceback
from time import perf_counter
class CodewarsTestRunner(object):
def __init__(self): pass
def run(self, test):
r = CodewarsTestResult()
s = perf_counter()
print("\n<DESCRIBE::>Tests")
try:
test(r)
finally:
pass
... | Codewars/codewars-runner | frameworks/python/codewars.py | Python | mit | 2,284 | 0.004816 |
# Copyright (c) 2011 Nick Hurley <hurley at todesschaf dot org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,... | todesschaf/pgl | pgl.py | Python | gpl-2.0 | 4,786 | 0.002925 |
#!/usr/bin/env python
"""
fla.gr user model
Given a userID or a username or a email, return the users couchc.database ORM
http://xkcd.com/353/
Josh Ashby
2013
http://joshashby.com
joshuaashby@joshashby.com
"""
from couchdb.mapping import Document, TextField, DateTimeField, \
BooleanField, IntegerField
impor... | JoshAshby/Fla.gr | app/models/couch/user/userModel.py | Python | mit | 3,412 | 0.001758 |
from rsk_mind.datasource import *
from rsk_mind.classifier import *
from transformer import CustomTransformer
PROJECT_NAME = 'test'
DATASOURCE= {
'IN' : {
'class' : CSVDataSource,
'params' : ('in.csv', )
},
'OUT' : {
'class' : CSVDataSource,
'params' : ('out.csv', )
}
... | rsk-mind/rsk-mind-framework | test/setting.py | Python | mit | 927 | 0.010787 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from six.moves import zip
import unittest
import numpy as np
from numpy.testing import (assert_allclose, assert_almost_equal,
assert_array_equal, assert_array_almost_equal)
import p... | jonyroda97/redbot-amigosprovaveis | lib/matplotlib/tests/test_transforms.py | Python | gpl-3.0 | 24,823 | 0.000081 |
"""
This inline scripts makes it possible to use mitmproxy in scenarios where IP spoofing has been used to redirect
connections to mitmproxy. The way this works is that we rely on either the TLS Server Name Indication (SNI) or the
Host header of the HTTP request.
Of course, this is not foolproof - if an HTTPS connectio... | noikiy/mitmproxy | examples/dns_spoofing.py | Python | mit | 1,652 | 0.004843 |
from datetime import datetime
from django.contrib import messages
from django.http import Http404, HttpResponseRedirect, JsonResponse
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext, ugettext_lazy
from django.views import View
from cou... | dimagi/commcare-hq | corehq/apps/linked_domain/views.py | Python | bsd-3-clause | 22,021 | 0.002089 |
# Copyright (c) 2017 Microsoft Corporation.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publis... | village-people/flying-pig | malmopy/visualization/visualizer.py | Python | mit | 4,199 | 0.00381 |
# Copyright 2020, The TensorFlow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | tensorflow/privacy | tensorflow_privacy/privacy/optimizers/dp_optimizer.py | Python | apache-2.0 | 15,920 | 0.005339 |
import wx
from gui.controller.CustomListCtrl import CustomListCtrl
from gui.controller.PlotCtrl import PlotCtrl
class WofSitesView(wx.Frame):
def __init__(self, parent, title, table_columns):
wx.Frame.__init__(self, parent=parent, id=-1, title=title, pos=wx.DefaultPosition, size=(680, 700),
... | Castronova/EMIT | gui/views/WofSitesView.py | Python | gpl-2.0 | 3,111 | 0.002893 |
#-*- coding: utf-8 -*-
from openerp.osv import fields, osv
class finance_contract_rachat(osv.osv_memory):
_name = "finance.contract.rachat"
_columns = {
'date': fields.date('Date de rachat'),
'date_dem': fields.date('Date de la demande'),
'motif': fields.text('Motif'),
'mem... | ATSTI/administra | open_corretora/brokerage/wizard/end_contract.py | Python | gpl-2.0 | 1,064 | 0.005639 |
# flake8: noqa
# -*- coding: utf-8 -*-
###############################################
# Geosite local settings
###############################################
import os
# Outside URL
SITEURL = 'http://$DOMAIN'
OGC_SERVER['default']['LOCATION'] = os.path.join(GEOSERVER_URL, 'geoserver/')
OGC_SERVER['default']['PUBLI... | simonemurzilli/geonode | geonode/contrib/geosites/site_template/local_settings_template.py | Python | gpl-3.0 | 597 | 0 |
from core.serializers import ProjectSerializer
from rest_framework import generics
from core.models import Project
class ProjectList(generics.ListCreateAPIView):
queryset = Project.objects.all()
serializer_class = ProjectSerializer
class ProjectDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Pro... | wathsalav/xos | xos/core/views/projects.py | Python | apache-2.0 | 382 | 0.007853 |
# Copyright 2014-2015 Facundo Batista, Nicolás Demarchi
#
# 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 hope that it will be useful, but
# WIT... | arielrossanigo/fades | fades/helpers.py | Python | gpl-3.0 | 7,161 | 0.001397 |
#!/usr/bin/env python2
'''
EC2 external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
AWS EC2 using the Boto library.
NOTE: This script assumes Ansible is being executed where the environment
variables needed for Boto have already been set... | appuio/ansible-role-openshift-zabbix-monitoring | vendor/openshift-tools/ansible/inventory/aws/ec2.py | Python | apache-2.0 | 55,406 | 0.002978 |
import json
import os
from ctypes import addressof, byref, c_double, c_void_p
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.driver import Driver
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.prototypes import raster as capi
from django.contrib.gis... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/contrib/gis/gdal/raster/source.py | Python | artistic-2.0 | 13,274 | 0.000904 |
# Copyright 2015 Yelp 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, so... | Yelp/yelp_clog | clog/scribe_net.py | Python | apache-2.0 | 8,613 | 0.001974 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017-06-27 michael_yin
#
"""
"""
from django.conf import settings
from django.conf.urls import include, url
from django.core.urlresolvers import reverse
| hellowebbooks/hellowebbooks-website | blog/urls.py | Python | mit | 237 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
import datetime
AUTHOR = u'Jayson Stemmler'
SITENAME = u'Jayson Stemmler'
SITEURL = ''
SITENAME = "Jayson Stemmler's Blog"
SITETITLE = 'Jayson Stemmler'
SITESUBTITLE = 'Research / Data Scientist'
SITEDESCRIPTION = ''
# SI... | jdstemmler/jdstemmler.github.io | pelicanconf.py | Python | mit | 2,048 | 0.001953 |
# -*- coding:Utf-8 -*-
#####################################################################
#This file is part of RGPA.
#Foobar 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, ... | pylayers/pylayers | pylayers/location/geometric/util/boxn.py | Python | mit | 27,884 | 0.029373 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import date
from django.conf import settings
def settings_context(request):
"""
Makes available a template var for some interesting var in settings.py
"""
try:
ITEMS_PER_PAGE = settings.ITEMS_PER_PAGE
except AttributeError:
... | matagus/django-jamendo | apps/jamendo/context_processors.py | Python | bsd-3-clause | 558 | 0.005376 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0004_auto_20160901_2322'),
]
operations = [
migrations.RunSQL("DROP TABLE bookmarks_bookmark;"),
migrations.RunSQL("ALTER TABLE core_bookmark RENAME TO bookmarks_bookmark;"),
... | tom-henderson/bookmarks | bookmarks/bookmarks/migrations/0005_rename_app.py | Python | mit | 431 | 0.006961 |
'''
cloudminingstatus.py
@summary: Show selected API data from cloudhasher and miningpool.
@author: Andreas Krueger
@since: 12 Feb 2017
@contact: https://github.com/drandreaskrueger
@copyright: @author @since @license
@license: Donationware, see README.md. Plus see LICENSE.
@version: v0.1.... | drandreaskrueger/cloudminingstatus | cloudminingstatus.py | Python | agpl-3.0 | 5,999 | 0.015503 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: common.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import random
import time
import threading
import multiprocessing
import numpy as np
from tqdm import tqdm
from six.moves import queue
from tensorpack import *
from tensorpack.utils.concurrency import *
from tensor... | haamoon/tensorpack | examples/DeepQNetwork/common.py | Python | apache-2.0 | 3,829 | 0.000261 |
# coding=utf-8
from kombu import Connection, Exchange, Queue, Consumer
from kombu.async import Hub
web_exchange = Exchange('web_develop', 'direct', durable=True)
standard_queue = Queue('standard', exchange=web_exchange,
routing_key='web.develop')
URI = 'librabbitmq://dongwm:123456@localhost:567... | dongweiming/web_develop | chapter9/section4/kombu_consumer.py | Python | gpl-3.0 | 761 | 0.001314 |
#!/usr/bin/env python
import os, sys
from polib import pofile
from config import CONFIGURATION
from extract import SOURCE_WARN
from execute import execute
TRANSIFEX_HEADER = 'Translations in this file have been downloaded from %s'
TRANSIFEX_URL = 'https://www.transifex.com/projects/p/edx-studio/'
def push():
exe... | praveen-pal/edx-platform | i18n/transifex.py | Python | agpl-3.0 | 2,066 | 0.005808 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organizations', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='organization',
name='logo',
field=models.ImageField(help_text='Pleas... | edx/edx-organizations | organizations/migrations/0002_auto_20170117_1434.py | Python | agpl-3.0 | 490 | 0.002041 |
# Copyright (C) 2003-2009 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... | mirrorcoder/paramiko | tests/test_util.py | Python | lgpl-2.1 | 19,156 | 0.000104 |
# 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/.
from WebIDL import IDLExternalInterface, IDLInterface, WebIDLError
class Configuration:
"""
Represents global ... | nikkisquared/servo | components/script/dom/bindings/codegen/Configuration.py | Python | mpl-2.0 | 15,248 | 0.000787 |
import os
import sys
import skimage.transform
import skimage.exposure
import time
import glob
import numpy as np
import mahotas
import random
import matplotlib
import matplotlib.pyplot as plt
import scipy
import scipy.ndimage
import json
from scipy.ndimage.filters import maximum_filter
base_path = os.path.dirname(__fi... | fegonda/icon_demo | code/model/unet/ff.py | Python | mit | 36,759 | 0.014935 |
"""
sum(2 * 2**i for i in range(i)) == 2 * (2**i - 1) == n
i == log_2(n // 2 + 1)
"""
from math import ceil, log
import time
def count_ways(n, current_power=None, memo=None):
if memo is None:
memo = {}
if current_power is None:
current_power = ceil(log(n // 2 + 1, 2))
key = (n, current_po... | simonolander/euler | euler-169-sum-of-powers-of-2.py | Python | mit | 1,172 | 0 |
import sys
import bpy
from bpy.props import StringProperty
class ExportLog(object):
""" Class which tracks warnings and errors during export """
WARNING = "Warning"
ERROR = "Error"
MESSAGE_SEPERATOR = "\n"
SEVERITY_DIVIDER = "|#|"
EXPORTED_MESSAGE_QUEUE = []
def __init__(self):
... | tobspr/Panda3D-Bam-Exporter | src/ExportLog.py | Python | mit | 2,156 | 0.004174 |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.db.transaction import atomic
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.template import ... | rdonnelly/ultimate-league-app | src/ultimate/user/views.py | Python | bsd-3-clause | 4,712 | 0.004032 |
class RegMagic:
fixed_registers = []
regmagic = RegMagic()
__all__ = ['regmagic']
| svp-dev/slcore | slc/tools/slc/mt/mipsel/regdefs.py | Python | gpl-3.0 | 87 | 0.034483 |
import unittest
from sympy import sqrt, exp, I, pi, IndexedBase, symbols, factorial
from qnet.algebra.core.abstract_algebra import _apply_rules
from qnet.algebra.core.scalar_algebra import (
ScalarValue, KroneckerDelta, Zero, One)
from qnet.algebra.toolbox.core import temporary_rules
from qnet.algebra.core.operat... | mabuchilab/QNET | tests/algebra/test_state_algebra.py | Python | mit | 18,851 | 0.000265 |
from __future__ import print_function
from __future__ import division
ALIGN_LEFT = '<'
ALIGN_CENTER = '_'
ALIGN_RIGHT = '>'
def pprint(data, header=None, dictorder=None, align=None, output_file=None):
if ((dict is type(data[0])) and (dictorder is None)):
dictorder = data[0].keys()
if ((dict is type(da... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Ops/PyScripts/windows/sentinel/table_print.py | Python | unlicense | 3,527 | 0.004536 |
# coding=utf-8
import os
import time
from gzip import GzipFile
from StringIO import StringIO
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.http import HttpResponse
from django.core.management import call_command
from django.views.decorators.csrf impor... | hva/warehouse | warehouse/backup/views.py | Python | mit | 3,061 | 0.003495 |
#!/usr/bin/env python
import os
from slackclient import SlackClient
BOT_NAME = 'chopbot3000'
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
if __name__ == "__main__":
api_call = slack_client.api_call("users.list")
if api_call.get('ok'):
# retrieve all users so we can find our bot
... | baylesj/chopBot3000 | scripts/print_bot_id.py | Python | mit | 604 | 0 |
# Copyright 2016 Google LLC All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | googleapis/python-spanner | google/cloud/spanner_v1/database.py | Python | apache-2.0 | 45,568 | 0.000812 |
# urllib3/contrib/ntlmpool.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
NTLM authenticating pool, contributed by erikcederstran
Issue #10, see: http://co... | kristerhedfors/xnet | xnet/packages/urllib3/contrib/ntlmpool.py | Python | bsd-3-clause | 4,740 | 0 |
"""
This config file runs the simplest dev environment"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614
from .common import *
from logsettings import get_logger_config
DEBUG = True
TEMPLATE_DEBUG = DEBUG
LOGGIN... | IITBinterns13/edx-platform-dev | cms/envs/dev.py | Python | agpl-3.0 | 6,301 | 0.002063 |
"""
Polygon path.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities.geometry.creation import lineation
from fabmetheus_utili... | natetrue/ReplicatorG | skein_engines/skeinforge-31/fabmetheus_utilities/geometry/creation/circle.py | Python | gpl-2.0 | 2,658 | 0.017682 |
import operator
import numpy as np
import sys
'''
Description:
Author: Mikko Auvinen
mikko.auvinen@fmi.fi
Finnish Meteorological Institute
'''
# =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
def readAsciiGridHeader( filename, nHeaderEntries, idx=0 ):
fl = open( filename , 'r')
name = file... | mjsauvinen/P4UL | pyLib/mapTools.py | Python | mit | 23,790 | 0.042917 |
#!/usr/bin/env python
from __future__ import print_function
import sys
import re
from utils import CDNEngine
from utils import request
if sys.version_info >= (3, 0):
import subprocess as commands
import urllib.parse as urlparse
else:
import commands
import urlparse
def detect(hostname):
"""
P... | Nitr4x/whichCDN | plugins/ErrorServerDetection/behaviors.py | Python | mit | 907 | 0.00882 |
# BurnMan - a lower mantle toolkit
# Copyright (C) 2012, 2013, Heister, T., Unterborn, C., Rose, I. and Cottaar, S.
# Released under GPL v2 or later.
"""
example_user_input_material
---------------------------
Shows user how to input a mineral of his/her choice without usint the library and which physical values... | QuLogic/burnman | examples/example_user_input_material.py | Python | gpl-2.0 | 4,958 | 0.013312 |
import sys, os, json
from pathlib import Path
from acmacs_py.mapi_utils import MapiSettings
# ======================================================================
class CladeData:
sSubtypeToCladePrefix = {"h1pdm": "clades-A(H1N1)2009pdm", "h3": "clades-A(H3N2)", "bvic": "clades-B/Vic", "byam": "clades-B/Yam"}
... | acorg/acmacs-whocc | web/chains-202105/py/directories.py | Python | mit | 1,044 | 0.004789 |
from __future__ import division
from itertools import chain
from sklearn.feature_extraction.text import CountVectorizer
import numpy as np
import pandas as pd
from fisher import pvalue
import re
import collections
from nltk.stem.porter import PorterStemmer
import math
from percept.tasks.base import Task
from percept.fi... | VikParuchuri/simpsons-scripts | tasks/train.py | Python | apache-2.0 | 16,847 | 0.008429 |
# Encoding: UTF-8
"""Czech conjugation
"""
from spline.i18n.formatter import Formatter, BaseWord, parse_bool
class Word(BaseWord):
@classmethod
def guess_type(cls, word, **props):
if word.endswith(u'í'):
return SoftAdjective
elif word.endswith(u'ý'):
return HardAdjecti... | veekun/spline | spline/i18n/cs/__init__.py | Python | mit | 2,365 | 0.002668 |
#!/usr/bin/env python
"""
client module for memcached (memory cache daemon)
Overview
========
See U{the MemCached homepage<http://www.danga.com/memcached>} for more about memcached.
Usage summary
=============
This should give you a feel for how this module operates::
import memcache
mc = memcache.Client(... | pouyana/teireader | webui/gluon/contrib/memcache/memcache.py | Python | mit | 49,300 | 0.004138 |
#!/usr/bin/env python
'''
Copyright (C) 2011 Karlisson Bezerra <contact@hacktoon.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 2 of the License, or
(at your option) any later ve... | yaii/yai | share/extensions/ink2canvas/canvas.py | Python | gpl-2.0 | 6,499 | 0.002462 |
from codecs import open
from os import path
from setuptools import setup, Extension
from Cython.Distutils import build_ext
import numpy
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.... | MicheleDamian/ConnectopicMapping | setup.py | Python | apache-2.0 | 1,540 | 0.001299 |
import time
from datetime import datetime, timedelta
from StringIO import StringIO
from django.core.handlers.modpython import ModPythonRequest
from django.core.handlers.wsgi import WSGIRequest, LimitedStream
from django.http import HttpRequest, HttpResponse, parse_cookie, build_request_repr
from django.utils import un... | mitsuhiko/django | tests/regressiontests/requests/tests.py | Python | bsd-3-clause | 15,031 | 0.002329 |
# -*- coding: utf-8 -*-
"""
(c) 2014 - Copyright Red Hat Inc
Authors:
Pierre-Yves Chibon <pingou@pingoured.fr>
"""
from anitya.lib.backends import (
BaseBackend, get_versions_by_regex_for_text, REGEX)
from anitya.lib.exceptions import AnityaPluginException
import six
DEFAULT_REGEX = 'href="([0-9][0-9.]*)/... | pombredanne/anitya | anitya/lib/backends/folder.py | Python | gpl-2.0 | 2,702 | 0.00037 |
#!/usr/bin/env python3
import re
from enum import Enum
diags = []
with open('input.txt', 'r') as f:
diags = f.read().splitlines()
#--- challenge 1
gamma = ""
for i in range(0, len(diags[0])):
zeros = len([x for x in diags if x[i] == "0"])
ones = len([x for x in diags if x[i] == "1"])
gamma += "0" if zeros ... | jekhokie/scriptbox | python--advent-of-code/2021/3/solve.py | Python | mit | 1,039 | 0.014437 |
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy import testing
from sqlalchemy.testing.util import function_named
from sqlalchemy.testing import fixtures
from sqlalchemy.testing.schema import Table, Column
class BaseObject(object):
def __init__(self, *args, **kwargs):
for key, value ... | itkovian/sqlalchemy | test/orm/inheritance/test_magazine.py | Python | mit | 9,316 | 0.008695 |
import os
import sys
import signal
import subprocess
import tempfile
import curses
import visidata
visidata.vd.tstp_signal = None
class SuspendCurses:
'Context manager to leave windowed mode on enter and restore it on exit.'
def __enter__(self):
curses.endwin()
if visidata.vd.tstp_signal:
... | saulpw/visidata | visidata/editor.py | Python | gpl-3.0 | 2,699 | 0.002594 |
import _plotly_utils.basevalidators
class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self,
plotly_name="tickvals",
parent_name="scatterternary.marker.colorbar",
**kwargs
):
super(TickvalsValidator, self).__init__(
plotl... | plotly/python-api | packages/python/plotly/plotly/validators/scatterternary/marker/colorbar/_tickvals.py | Python | mit | 513 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | Ehtaga/account-financial-reporting | account_financial_report_horizontal/report/report_financial.py | Python | agpl-3.0 | 2,192 | 0 |
# coding:utf-8
import MySQLdb as mysql
from flask import Flask, request, render_template
import json
app = Flask(__name__)
con = mysql.connect(user="root", passwd="redhat", db="jiangkun")
con.autocommit(True)
cur = con.cursor()
@app.route('/')
def index():
return render_template("index.html")
@app.route('/list'... | seerjk/reboot06 | 09/homework08/flask_web.py | Python | mit | 768 | 0.002604 |
"""Utility functions for hc-api-python"""
from datetime import datetime
def get_readable_time_string(seconds):
"""Returns human readable string from number of seconds"""
seconds = int(seconds)
minutes = seconds // 60
seconds = seconds % 60
hours = minutes // 60
minutes = minutes % 60
days... | housecanary/hc-api-python | housecanary/utilities.py | Python | mit | 2,345 | 0.002132 |
from .manager import Manager
__version__ = '0.2.4'
| chendx79/Python3HandlerSocket | pyhs/__init__.py | Python | mit | 51 | 0 |
#
# 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... | mtagle/airflow | airflow/providers/google/cloud/operators/mssql_to_gcs.py | Python | apache-2.0 | 3,144 | 0.000318 |
#!/usr/bin/env python
'''
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")... | alexryndin/ambari | ambari-server/src/test/python/stacks/2.2/KAFKA/test_kafka_broker.py | Python | apache-2.0 | 7,652 | 0.023523 |
"""
Gauged
https://github.com/chriso/gauged (MIT Licensed)
Copyright 2014 (c) Chris O'Hara <cohara87@gmail.com>
"""
from urlparse import urlparse, parse_qsl
from urllib import unquote
from .mysql import MySQLDriver
from .sqlite import SQLiteDriver
from .postgresql import PostgreSQLDriver
def parse_dsn(dsn_string):
... | chriso/gauged | gauged/drivers/__init__.py | Python | mit | 1,960 | 0 |
#!/usr/bin/python2.5
import sys
import time
import os
import nuke
def launchSubmit():
print("nukeStub(): launch submitter dialog")
submitCmd = "/drd/software/int/bin/launcher.sh -p %s -d %s --launchBlocking farm -o EPA_CMDLINE python2.5 --arg '$ABSUBMIT/nukesubmit/nuke2AB.py'" % (os.environ['DRD_JOB'], os.environ[... | kurikaesu/arsenalsuite | cpp/apps/absubmit/nukesubmit/nukeStub.py | Python | gpl-2.0 | 877 | 0.019384 |
from extractors.extract_website import ExtractWebsite
from datawakestreams.extractors.extractor_bolt import ExtractorBolt
class WebsiteBolt(ExtractorBolt):
name ='website_extractor'
def __init__(self):
ExtractorBolt.__init__(self)
self.extractor = ExtractWebsite()
| Sotera/Datawake-Legacy | memex-datawake-stream/src/datawakestreams/extractors/website_bolt.py | Python | apache-2.0 | 293 | 0.010239 |
import pycountry
from marshmallow import Schema, fields, ValidationError
def validate_currency_symbol(val):
if val not in [x.letter for x in pycountry.currencies.objects]:
raise ValidationError('Symbol is not valid')
class CategoryTypeField(fields.Field):
def _serialize(self, value, attr, obj):
... | monetario/core | monetario/serializers.py | Python | bsd-3-clause | 5,724 | 0.002271 |
from decimal import Decimal
from electrum.util import (format_satoshis, format_fee_satoshis, parse_URI,
is_hash256_str, chunks)
from . import SequentialTestCase
class TestUtil(SequentialTestCase):
def test_format_satoshis(self):
self.assertEqual("0.00001234", format_satoshis(... | fujicoin/electrum-fjc | electrum/tests/test_util.py | Python | mit | 5,385 | 0.003714 |
# -*- coding: utf-8 -*-
"""
Core client, used for all API requests.
"""
import os
import platform
from collections import namedtuple
from plivo.base import ResponseObject
from plivo.exceptions import (AuthenticationError, InvalidRequestError,
PlivoRestError, PlivoServerError,
... | plivo/plivo-python | plivo/rest/client.py | Python | mit | 13,434 | 0.001265 |
import time
import RPi.GPIO as GPIO
# Constants
PULSE_LEN = 0.03 # length of clock motor pulse
A_PIN = 18 # one motor drive pin
B_PIN = 23 # second motor drive pin
# Configure the GPIO pins
GPIO.setmode(GPIO.BCM)
GPIO.setup(A_PIN, GPIO.OUT)
GPIO.setup(B_PIN, GPIO.OUT)
# Glogal variables
positive_polarity... | simonmonk/pi_magazine | 04_analog_clock/analog_clock_24.py | Python | mit | 1,066 | 0.025328 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Hoverlabel(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "area"
_path_str = "area.hoverlabel"
_valid_props = {
"align",
"alignsrc"... | plotly/python-api | packages/python/plotly/plotly/graph_objs/area/_hoverlabel.py | Python | mit | 17,818 | 0.000954 |
# SecuML
# Copyright (C) 2016-2017 ANSSI
#
# SecuML 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.
#
# SecuML is distributed in the h... | ah-anssi/SecuML | SecuML/core/ActiveLearning/QueryStrategies/AnnotationQueries/AnnotationQueries.py | Python | gpl-2.0 | 3,837 | 0.001303 |
"""Probit regression class and diagnostics."""
__author__ = "Luc Anselin luc.anselin@asu.edu, Pedro V. Amaral pedro.amaral@asu.edu"
import numpy as np
import numpy.linalg as la
import scipy.optimize as op
from scipy.stats import norm, chisqprob
import scipy.sparse as SP
import user_output as USER
import sum... | pastephens/pysal | pysal/spreg/probit.py | Python | bsd-3-clause | 34,383 | 0.002501 |
# 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/v2020_07_01/aio/operations/_ddos_custom_policies_operations.py | Python | mit | 20,544 | 0.004965 |
from .MidiOutFile import MidiOutFile
from .MidiInFile import MidiInFile
"""
This is an example of the smallest possible type 0 midi file, where
all the midi events are in the same track.
"""
class Transposer(MidiOutFile):
"Transposes all notes by 1 octave"
def _transp(self, ch, note):
if c... | JonathanRaiman/Dali | data/score_informed_transcription/midi/example_transpose_octave.py | Python | mit | 1,038 | 0.010597 |
# region Description
"""
nmap_scanner.py: Scan local network with NMAP
Author: Vladimir Ivanov
License: MIT
Copyright 2020, Raw-packet Project
"""
# endregion
# region Import
from raw_packet.Utils.base import Base
import xml.etree.ElementTree as ET
import subprocess as sub
from tempfile import gettempdir
from os.path ... | Vladimir-Ivanov-Git/raw-packet | raw_packet/Scanners/nmap_scanner.py | Python | mit | 5,743 | 0.002438 |
# -*- 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 or... | googleads/google-ads-python | google/ads/googleads/v10/services/services/remarketing_action_service/transports/base.py | Python | apache-2.0 | 6,058 | 0.000495 |
import math
import string
from Conundrum.utils import sanitize
letter_to_value = dict(zip('z' + string.ascii_lowercase, range(0, 27)))
value_to_letter = dict(zip(range(0, 27), 'z' + string.ascii_lowercase))
def encrypt(msg: str, key: str) -> str:
msg = sanitize(msg)
key = sanitize(key)
repeat = int(math... | physicalattraction/kerstpuzzel | src/Conundrum/key_cipher.py | Python | mit | 1,290 | 0.000775 |
#!/usr/bin/env python
# pylint: disable=invalid-name
"""
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
"""
import sys
from problembaseclass import ProblemBaseCl... | jakubczaplicki/projecteuler | problem005.py | Python | mit | 1,000 | 0.008 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008-2010 Zuza Software Foundation
#
# This file is part of Virtaal.
#
# 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 ... | elric/virtaal-debian-snapshots | virtaal/plugins/autocompletor.py | Python | gpl-2.0 | 10,937 | 0.002834 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.