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 |
|---|---|---|---|---|---|
def <warning descr="Python versions 3.7, 3.8, 3.9, 3.10, 3.11 do not allow 'async' and 'await' as names">a<caret>sync</warning>():
pass | jwren/intellij-community | python/testData/quickFixes/PyRenameElementQuickFixTest/renameAsyncFunctionInPy36.py | Python | apache-2.0 | 139 |
import datetime
import webapp2
from google.appengine.api import memcache
class MainPage(webapp2.RequestHandler):
def get(self):
headlines = ['...', '...', '...']
# Set or replace a memcache value.
success = memcache.set('headlines', headlines)
if not success:
s... | jscontreras/learning-gae | pgae-examples-master/2e/python/memcache/memcache/main.py | Python | lgpl-3.0 | 6,648 |
# Copyright (c) 2008-2009 Citrix Systems 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 only.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ... | xenserver/xsconsole | plugins-oem/XSFeatureOEMRestore.py | Python | gpl-2.0 | 4,596 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.modules.events.management.views import WPEventManagement
class WPEventRoles(WPEventManagemen... | pferreir/indico | indico/modules/events/roles/views.py | Python | mit | 434 |
# -*- encoding: utf-8 -*-
from openerp.osv import osv, fields
class crm_lead_to_change_request_wizard(osv.TransientModel):
"""
wizard to convert a Lead into a Change Request and move the Mail Thread
"""
_name = "crm.lead2cr.wizard"
_inherit = 'crm.partner.binding'
_columns = {
"lead_i... | xpansa/pmis | crm_change_request/change_request.py | Python | agpl-3.0 | 2,709 |
from collections import namedtuple
from functools import wraps
Z_FLAG = 1 << 7
N_FLAG = 1 << 6
H_FLAG = 1 << 5
C_FLAG = 1 << 4
def op_code(code, cycles, branch_cycles=0):
"""
Decorator for methods of Z80 that implement instructions. Causes
the method to return the number of clock cycles
consumed. I... | zbyrne/gameboy | pyboy/z80.py | Python | gpl-2.0 | 72,685 |
from bokeh.io import show, output_file
from bokeh.plotting import figure
from bokeh.palettes import Spectral5
from bokeh.sampledata.autompg import autompg_clean as df
from bokeh.transform import factor_cmap
output_file("bar_pandas_groupby_nested.html")
df.cyl = df.cyl.astype(str)
df.yr = df.yr.astype(str)
group = df... | mindriot101/bokeh | sphinx/source/docs/user_guide/examples/categorical_bar_pandas_groupby_nested.py | Python | bsd-3-clause | 976 |
import numpy as np
import torch
import torch.nn as nn
import unittest
from unittest.mock import MagicMock
from ray.experimental.sgd.pytorch.pytorch_runner import PyTorchRunner
class LinearDataset(torch.utils.data.Dataset):
"""y = a * x + b"""
def __init__(self, a, b, size=1000):
x = np.random.random... | stephanie-wang/ray | python/ray/experimental/sgd/tests/test_pytorch_runner.py | Python | apache-2.0 | 4,773 |
import time
import random
prime_in_1000 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,
211, 223, 227, 229, 233, 239, 241, 251, 2... | DaivdZhang/LittleProject | src/cryptology/RSA/core/rsa.py | Python | mit | 3,141 |
from datetime import datetime, timedelta
from random import randint
from zeeguu_core_test.rules.base_rule import BaseRule
from zeeguu_core_test.rules.language_rule import LanguageRule
from zeeguu_core_test.rules.rss_feed_rule import RSSFeedRule
from zeeguu_core_test.rules.url_rule import UrlRule
from zeeguu_core.model... | mircealungu/Zeeguu-Core | zeeguu_core_test/rules/article_rule.py | Python | mit | 1,502 |
"""Diagnostics support for IKEA Tradfri."""
from __future__ import annotations
from typing import cast
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from .const import CONF_GATEWAY_ID, COORDINATOR, COORDINATOR... | rohitranjan1991/home-assistant | homeassistant/components/tradfri/diagnostics.py | Python | mit | 1,136 |
# Orca
#
# Copyright 2005-2009 Sun Microsystems Inc.
# Copyright 2010 Orca Team.
#
# This library 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 (at your option)... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/orca/scripts/toolkits/Gecko/speech_generator.py | Python | gpl-3.0 | 24,398 |
import pandas as pd
from plotnine import ggplot, aes, geom_col, theme
_theme = theme(subplots_adjust={'right': 0.80})
df = pd.DataFrame({
'x': pd.Categorical(['b', 'd', 'c', 'a'], ordered=True),
'y': [1, 2, 3, 4]
})
def test_reorder():
p = (
ggplot(df, aes('reorder(x, y)', 'y', fill='reorder(x,... | has2k1/plotnine | plotnine/tests/test_aes.py | Python | gpl-2.0 | 983 |
class SensorTag:
def __init__(self,mac,control,description = "SensorTag"):
self.mac = mac
self.control = control
self.description = description | HammerDuJour/blepisensor | SensorTag.py | Python | mit | 171 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework import status
from .serializers import TestRunSerializer
from .models import TestRun
from .models import TestRunStatus
from tasks.models import Task
cl... | harnash/sparrow | apps/test_runs/views.py | Python | mit | 441 |
class MeetupApiResponseParser():
def __init__(self, http_response):
self.http_response = http_response
@property
def json(self):
return self.http_response.json()[0]
def extract_attribute(self, context, *args):
current_key = args[0]
not_found_message = "No %s listed" %current_key
value_at_c... | nicole-a-tesla/meetup.pizza | meetup/services/meetup_api_response_parser.py | Python | mit | 1,185 |
# 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/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py | Python | mit | 4,418 |
from config.auth import AuthenticationParameters
from core.oauthclient import DefaultSequencingOAuth2Client
from core.filemetadata import DefaultSequencingFileMetadataApi
| SequencingDOTcom/oAuth2-demo | python-django/oauth2demo/oauth/__init__.py | Python | mit | 172 |
#!/usr/bin/env python
# Copyright (c) 2010 Colin Bick, Robert Damphousse
# 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 us... | brennan-v-/gtfs_SQL_importer | src/import_gtfs_to_sql.py | Python | mit | 5,971 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Abrimos el fichero en modo lectura
fichero = open("lista.txt","r")
contenido = fichero.read()
print contenido
fichero.close()
| psicobyte/ejemplos-python | cap10/p173.py | Python | gpl-3.0 | 173 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-08 06:02
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('admin', '0001_initial'),
]
operations = [
migrations.RenameField(
model... | OnRampOrg/onramp | server/ui/admin/migrations/0002_auto_20161108_0602.py | Python | bsd-3-clause | 825 |
#if 0
# $Id: riffinfo.py 401 2005-03-15 17:50:45Z dischi $
# $Log$
# Revision 1.33 2005/03/15 17:50:45 dischi
# check for corrupt avi
#
# Revision 1.32 2005/03/04 17:41:29 dischi
# handle broken avi files
#
# Revision 1.31 2004/12/13 10:19:07 dischi
# more debug, support LIST > 20000 (new max is 80000)
#
# Revisi... | matachi/subdownloader | modules/mmpython/video/riffinfo.py | Python | gpl-3.0 | 17,865 |
#!/usr/bin/env python3
# Based on gathertags, this goes further by identifying owners and
# sorting files by genre.
import csv, os, sys
from collections import Counter
import numpy as np
import pandas as pd
# import utils
currentdir = os.path.dirname(__file__)
libpath = os.path.join(currentdir, '../lib')
sys.path.ap... | tedunderwood/20cgenres | organizetags.py | Python | mit | 5,190 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function
import sys
import numpy as np
from numpy.testing import *
from numpy.compat import sixu
class TestArrayRepr(object):
def test_nan_inf(self):
x = np.array([np.nan, np.inf])
assert_equal(repr(... | NiclasEriksen/py-towerwars | src/numpy/core/tests/test_arrayprint.py | Python | cc0-1.0 | 6,859 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | rh-s/heat | heat/engine/resources/openstack/neutron/metering.py | Python | apache-2.0 | 6,185 |
import logging
import testUtils as utils
import time
import threading
import pytest
from conftest import IPADDRESS1, \
RESOURCE, \
DUMMYVAL, \
OSCORECLIENTCONTEXT
from coap import coapDefines as d, \
coapException as... | openwsn-berkeley/coap | tests/func/test_timeout_NON.py | Python | bsd-3-clause | 1,466 |
from django.core.exceptions import ValidationError
from django.test import TestCase
from user_contacts.validators import (
validate_number,
validate_string,
validate_address)
class ValidatorTest(TestCase):
def test_string_is_invalid_if_contains_numbers_or_special_chars(self):
with self.assert... | Victory/realpython-tdd | contacts/user_contacts/tests/test_validator.py | Python | mit | 741 |
from flask import Flask, request
from flask_bootstrap import Bootstrap
def create_app(config_filename=None):
app = Flask(__name__, instance_relative_config=True)
# Load default config
app.config.from_object('{{cookiecutter.app_name}}.config.DefaultConfig')
# Load secret config stuff from instance fo... | n8henrie/cookiecutter_gae_flask | {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/__init__.py | Python | mit | 794 |
# Copyright (c) 2017 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
... | sippy/b2bua | sippy/Core/Exceptions.py | Python | bsd-2-clause | 3,472 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | andmos/ansible | lib/ansible/modules/network/cloudengine/ce_ip_interface.py | Python | gpl-3.0 | 24,036 |
#!/usr/bin/env python3
import os
import shutil
import configuration
testPath = os.path.join(configuration.cryengineDirectory, "objects", "_warehouse", "_test")
if os.path.exists(configuration.cryengineDirectory):
if os.path.exists(testPath):
shutil.rmtree(testPath)
input("\nCleared test directory... | schedule-productions/warehouse | cryengine_clear_draft_models.py | Python | apache-2.0 | 501 |
from magma import *
from mantle.lattice.mantle40.LUT import LUTN
__all__ = ['DefineCascade', 'Cascade']
def _Name(n, k, expr):
expr = uint(expr, 1<<k)
return 'Cascade%dx%d_%X' % (n, k, expr)
#
# n is the number of luts
# k is the number of bits per lut
# expr goes into LUT
#
def DefineCascade(n, k, expr, ci... | bjmnbraun/icestick_fastio | thirdparty/magma/mantle/lattice/mantle40/cascade.py | Python | mit | 1,285 |
from __future__ import print_function
from builtins import range
import numpy as np
def InitializeXdmf(filename="beam"):
f = open(filename + ".xmf", 'w')
f.write('<?xml version="1.0" ?>' + '\n'
+ '<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>' + '\n'
+ '<Xdmf Version="2.0" xmlns:xi="http://www.... | erdc/proteus | proteus/mprans/ArchiveBeams.py | Python | mit | 6,254 |
# coding=utf-8
from datetime import datetime
from tzdatastruct import *
from AbPageParser import *
@parser
class Tieba1PageParser(AbPageParser):
'''示例页面解析器'''
@staticmethod
def should_me(url):
if 'tieba.baidu.com' in url:
return True
else:
return False
@stat... | animalize/tz2txt | tz2txt/sites/Tieba1PageParser.py | Python | bsd-3-clause | 4,203 |
# Copyright (C) 2014 Robby Zeitfuchs (@robbyFux)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is d... | lixiangning888/whole_project | modules/signatures_orignal/banker_cridex.py | Python | lgpl-3.0 | 2,206 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-quality | sql_partner_swap_parent/swap.py | Python | agpl-3.0 | 4,398 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-01-29 16:08
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0013_auto_... | linea-it/qlf | backend/framework/qlf/dashboard/migrations/0014_product.py | Python | gpl-3.0 | 995 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | maljac/odoo-addons | partner_social_fields/__openerp__.py | Python | agpl-3.0 | 1,613 |
#!/usr/bin/env python
#
# Copyright 2010 Eric Entzel <[email protected]>
#
from google.appengine.api import mail
from google.appengine.ext.webapp import template
from google.appengine.api import memcache
from datetime import datetime
import os
from_address = '"EventBot" <[email protected]>'
email_interval = 10
#... | eentzel/myeventbot | outgoing_mail.py | Python | mit | 1,865 |
from django import forms
from django.db.models import get_model
from django.conf.urls import url, patterns
from django.core.urlresolvers import reverse
from django.core.exceptions import ImproperlyConfigured
from objectset import resources
from objectset.models import ObjectSet
from objectset.forms import objectset_for... | chop-dbhi/serrano | serrano/resources/sets.py | Python | bsd-2-clause | 4,263 |
from . import widget
from browser import doc,html
class Slider(widget.Widget):
def __init__(self, id=None, label=False):
self._div_shell=html.DIV(Class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all")
widget.Widget.__init__(self, self._div_shell, 'slider', id)
self._h... | Hasimir/brython | www/src/Lib/site-packages/ui/slider.py | Python | bsd-3-clause | 2,282 |
# 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 ... | vulcansteel/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/array_wrapper.py | Python | mit | 836 |
import os
import sys
from distutils.core import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.pat... | jstoxrocky/lifelines | setup.py | Python | mit | 1,548 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'User'
db.create_table(u'account_user', (
(u'i... | odoku/django-skeleton | core/account/migrations/0001_initial.py | Python | mit | 3,767 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import ast
import contextlib
import dis
import inspect
import json
import os
import re
import sys
import tempfile
import time
import unittest
from collections import defaultdict
from random import shuffle
sys.path.append(os.path.dirname(os.path.d... | alexmojaki/executing | tests/test_main.py | Python | mit | 22,605 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | agry/NGECore2 | scripts/mobiles/tatooine/dimu_monastery_nun.py | Python | lgpl-3.0 | 1,336 |
# Copyright (C) 2008 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | Distrotech/bzr | bzrlib/tests/per_repository_chk/test_supported.py | Python | gpl-2.0 | 17,252 |
#
# (C) Copyright 2011 Jacek Konieczny <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful... | pforret/python-for-android | python3-alpha/python-libs/pyxmpp2/streamevents.py | Python | apache-2.0 | 8,647 |
# -*- coding: utf-8 -*-
###############################################################################
# #
# Author: Leonardo Pistone
# Copyright 2014 Camptocamp SA
# ... | VitalPet/bank-statement-reconcile | account_statement_cancel_line/wizard/__init__.py | Python | agpl-3.0 | 1,601 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2014 The ProteinDF development team.
# see also AUTHORS and README if provided.
#
# This file is a part of the ProteinDF software package.
#
# The ProteinDF is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Publ... | ProteinDF/ProteinDF_pytools | scripts/pdf-report.py | Python | gpl-3.0 | 9,274 |
# This file is part of Merlin.
# Merlin is the Copyright (C)2008,2009,2010 of Robin K. Hansen, Elliot Rosemarine, Andreas Jacobsen.
# Individual portions may be copyright by individual contributors, and
# are included in this collective work with permission of the copyright
# owners.
# This program is free software; ... | d7415/merlin | Hooks/scans/parse.py | Python | gpl-2.0 | 1,919 |
import fechbase
class Records(fechbase.RecordsBase):
def __init__(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FEC COMMITTEE ID NUMBER', 'number': '2'},
{'name': 'SEQUENCE NUMBER', 'number': '3'},
... | h4ck3rm1k3/FEC-Field-Documentation | fec/version/v1/F56.py | Python | unlicense | 935 |
# -*- coding: utf-8 -*-
import pytest
import giraffez
from giraffez.constants import *
from giraffez.errors import *
from giraffez.types import *
@pytest.mark.usefixtures('config')
class TestContext(object):
def test_with_context(self, mocker):
connect_mock = mocker.patch('giraffez.cmd.TeradataCmd._conne... | capitalone/giraffez | tests/test_context.py | Python | apache-2.0 | 2,144 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, 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 django.views.generic import View, TemplateView
from shoop.front.basket ... | janusnic/shoop | shoop/front/views/basket.py | Python | agpl-3.0 | 1,113 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# This file is part of Kuaa.
#
# Kuaa is a framework for the automation of machine learning experiments.
#
# It provides a workflow-based standardized environment for easy evaluation of
# ... | rafaelwerneck/kuaa | framework/extract_features.py | Python | gpl-3.0 | 10,077 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SSL_DISABLE = False
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_RECORD_QUERIES = True
MAIL_SERVER = 'smtp.qq.com'
MAIL_PORT = 587
MAIL_USE_TL... | ifwenvlook/blog | config.py | Python | mit | 3,613 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Shows how to use BitmapManager to asynchronously load a Bitmap from a file.
Run this snippet providing a list of filenames of (high resolution) pictures:
$ ./asyncload.py /path/to/mypics/*.jpg anotherpic.png nonexistent.png
Press space to sequentially load the pictur... | pararthshah/libavg-vaapi | src/samples/asyncload.py | Python | lgpl-2.1 | 3,390 |
# -*- coding: utf-8 -*-
#
# 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
#... | owlabs/incubator-airflow | tests/utils/test_helpers.py | Python | apache-2.0 | 9,028 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2013 SSH Communication Security 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 wit... | kimvais/django-ssl-auth | django_ssl_auth/__init__.py | Python | mit | 1,252 |
from pathlib import Path
from foreman import define_parameter, get_relpath, rule
from garage import scripts
from templates import common
(define_parameter
.path_typed('npm_prefix')
.with_doc("""Path to host-only npm packages.""")
.with_derive(lambda ps: ps['//base:drydock'] / get_relpath() / 'modules'))
commo... | clchiou/garage | shipyard/rules/host/node/build.py | Python | mit | 1,039 |
import subprocess as sp
from discord.ext import commands
bot = commands.Bot(command_prefix="!")
process = None # sp.Popen(['python3', 'main.py'])
authorized_users = [125660719323676672, 141211057485119488, 122739797646245899]
def is_authorized(ctx):
def predicate():
return ctx.author.id in authorized_... | henry232323/RPGBot | launch.py | Python | gpl-3.0 | 2,075 |
__author__ = 'Alexandre Menai [email protected]'
'''
The weather module intends to grab pilot weather from the aviation weather services in the USA
'''
#TODO put the following global parameters into a configuration file later on
WEAHTER_HOSTNAME="aviationweather.gov"
METAR_PATH="/adds/dataserver_current/httpparam?dataS... | amenai1979/pylot | bin/weather.py | Python | gpl-2.0 | 1,775 |
import logging
import traceback
import sys
from celery import Celery
from .callbacks import STATUS_LOADING_DATA
from .config import get_engine, _set_connection_string
from .loader import FDPLoader
from .callbacks import do_request, STATUS_INITIALIZING, STATUS_FAIL, STATUS_DONE
app = Celery('fdp_loader')
app.config_f... | openspending/babbage.fiscal-data-package | babbage_fiscal/tasks.py | Python | mit | 2,046 |
#!/usr/bin/env python
import tensorflow as tf
def inputs_placeholder():
a = tf.placeholder("float") # Create a symbolic variable 'a'
b = tf.placeholder("float") # Create a symbolic variable 'b'
return [a, b]
def model(a, b):
y = tf.multiply(a, b) # multiply the symbolic variables
return y
def t... | trhongbinwang/data_science_journey | deep_learning/tensorflow/tutorials/tutorial1/00_multiply.py | Python | apache-2.0 | 810 |
from . import keyboards
| chancegrissom/qmk_firmware | lib/python/qmk/cli/list/__init__.py | Python | gpl-2.0 | 24 |
from django.conf import settings
from django.conf.urls import patterns, include, url
# Setup Django admin to work with Misago auth
from django.contrib import admin
from misago.users.forms.auth import AdminAuthenticationForm
admin.autodiscover()
admin.site.login_form = AdminAuthenticationForm
urlpatterns = patterns(''... | sitsbeyou/Misago | misago/project_template/project_name/urls.py | Python | gpl-2.0 | 1,504 |
import os
import argparse
keywords = {\
"mac":[\
"brew install",\
"brew cask install",\
"port install"\
],\
"linux":[\
"apt-get install",\
"aptitude install",\
"yum install",\
"pacman install",\
"dpkg -i",\
"dnf install",\
"zypper in",\
"make install",\
"tar "\
],\
"lua":[\
"luarocks ins... | AlexMili/WhatInstalled | whatinstalled.py | Python | mit | 1,456 |
from sympy.core.compatibility import xrange, zip_longest
from sympy.utilities.enumerative import (
factoring_visitor,
list_visitor,
MultisetPartitionTraverser,
multiset_partitions_taocp,
PartComponent,
part_key
)
from sympy.utilities.iterables import multiset_partitions, _set_partitions
fro... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/utilities/tests/test_enumerative.py | Python | mit | 6,237 |
# -*- coding: utf-8 -*-
"""package qacode.tests.002_benchmarks"""
| netzulo/qacode | tests/002_benchmarks/__init__.py | Python | gpl-3.0 | 68 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: RSLP Stemmer
#
# Copyright (C) 2001-2011 NLTK Project
# Author: Tiago Tresoldi <[email protected]>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
# This code is based on the algorithm presented in the paper "A Stemming
# Algorithm for the ... | tadgh/ArgoRevisit | third_party/nltk/stem/rslp.py | Python | apache-2.0 | 5,792 |
# -*- coding: utf-8 -*-
import re
_REGEX = re.compile('^(?P<major>[0-9]+)'
'\.(?P<minor>[0-9]+)'
'(\.(?P<patch>[0-9]+))?'
'(\-(?P<prerelease>[0-9A-Za-z]+(\.[0-9A-Za-z]+)*))?'
'(\+(?P<build>[0-9A-Za-z]+(\.[0-9A-Za-z]+)*))?$')
if 'cmp' not... | pensierinmusica/emmet-sublime | emmet/semver.py | Python | mit | 2,471 |
# Copyright (C) 2018-2019 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
from swh.web.common.urlsindex import UrlsIndex
class AdminU... | SoftwareHeritage/swh-web-ui | swh/web/admin/adminurls.py | Python | agpl-3.0 | 1,081 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | dragorosson/heat | heat_integrationtests/functional/test_swiftsignal_update.py | Python | apache-2.0 | 1,714 |
#! /usr/bin/python2
# Copyright 2016 Quentin Schulz <[email protected]>
#
# 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 opt... | free-electrons/lavabo | utils.py | Python | gpl-2.0 | 4,845 |
#!/usr/bin/env python
'''Check a queue and get times and info for messages in q'''
import sys
import os
import logging
import json
import datetime
import boto.sqs as sqs
QUEUE_OAI_HARVEST = os.environ.get('QUEUE_OAI_HARVEST', 'OAI_harvest')
QUEUE_OAI_HARVEST_ERR = os.environ.get('QUEUE_OAI_HARVEST_ERR', 'OAI_harvest_e... | mredar/ucldc_oai_harvest | oai_harvester/read_sqs_queue.py | Python | bsd-3-clause | 1,363 |
#econogee, 1/28/2016
#Stock Data Retrieval Script
#If executed via the command line, will produce 500 data files with stock price information
#between the dates specified in the main method. Can also be imported to use the RetrieveStock method.
import os
import sys
import numpy as np
import urllib2
def RetrieveStoc... | econogee/FinanceScripts | StockReader.py | Python | mit | 1,262 |
class Line(object):
def __init__(self, start, end):
assert end >= start
self.start = start
self.end = end
def overlaps(self, other):
assert isinstance(other, Line)
return other.end >= self.start and self.end >= other.start
def merge(self, other):
... | kaimast/inanutshell | common/geo.py | Python | bsd-2-clause | 2,334 |
# coding=utf-8
"""
Collects data from RabbitMQ through the admin interface
#### Notes
** With added support for breaking down queue metrics by vhost, we have
attempted to keep results generated by existing configurations from
changing. This means that the old behaviour of clobbering queue metrics
whe... | skbkontur/Diamond | src/collectors/rabbitmq/rabbitmq.py | Python | mit | 10,855 |
from django.conf.urls import *
from django.views.generic import TemplateView
from directoalartista.apps.transaction import views as TransactionViews
from directoalartista.apps.myaccount import views as MyAccountView
from directoalartista.apps.genericuser.views import ArtistCustomRegistrationView, \
AgencyCustomR... | mpampols/directoalartista.com | directoalartista/apps/genericuser/accounts_urls.py | Python | mit | 3,779 |
#!/usr/bin/env python
# Copyright (c) 2008 Carnegie Mellon University.
#
# You may modify and redistribute this file under the same terms as
# the CMU Sphinx system. See
# http://cmusphinx.sourceforge.net/html/LICENSE for more information.
import pygtk
pygtk.require('2.0')
import gtk
import gobject
import pygst
pyg... | saez0pub/lmondo | input/python-gstreamer.py | Python | gpl-2.0 | 6,875 |
#!/usr/bin/env python
import sys
import os
import math
import itertools
from collections import namedtuple
from pylatex import Document, LongTabu, NoEscape, NewPage
from pylatex.utils import bold
from enum import Enum, auto
sys.path.insert(0, '/latticeQCD/raid6/ruairi/git/QCD_scripts/sigmond')
import util
# Expects... | andrewhanlon/QCD_scripts | chimera/a0_scattering/coupled_pi-eta_k-kbar_scattering/results_fit.py | Python | gpl-3.0 | 14,334 |
# -*- coding: utf-8 -*-
#
# mpl_utilities.py
# AstroObject
#
# Created by Alexander Rudy on 2012-04-17.
# Copyright 2012 Alexander Rudy. All rights reserved.
# Version 0.6.1
#
u"""
:mod:`util.mpl` – Matplotlib helpers
------------------------------------
This module provides helpers which are dependent on :mo... | alexrudy/AstroObject | AstroObject/util/mpl.py | Python | gpl-3.0 | 2,114 |
############################################################################
# Original work Copyright 2017 Palantir Technologies, Inc. #
# Original work licensed under the MIT License. #
# See ThirdPartyNotices.txt in the project root for license information. #
# All modifi... | openlawlibrary/pygls | pygls/lsp/types/language_features/rename.py | Python | apache-2.0 | 2,341 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/npp/v20190823/models.py | Python | mit | 37,718 |
import threading
from twisted.internet import reactor
from twisted.internet.threads import deferToThreadPool
from twisted.logger import Logger
from hendrix.mechanics.concurrency import get_response_for_thread
from hendrix.mechanics.concurrency.exceptions import ThreadHasNoResponse
class _ThroughToYou(object):
l... | jMyles/hendrix | hendrix/mechanics/concurrency/decorators.py | Python | mit | 4,116 |
# -*- 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/v8/enums/types/offline_user_data_job_type.py | Python | apache-2.0 | 1,291 |
#!/usr/bin/python
#-----------------------------------------------------------------------
# File : testfim.py
# Contents: examples how to use the pure fim functions of the fim module
# Author : Christian Borgelt
# History : 2012.04.17 file created
# 2013.02.11 made compatible with Python 3
#-------------... | lucidfrontier45/pyarules | pyfim/ex/testfim.py | Python | mit | 1,546 |
# -*- coding: utf-8 -*-
from __future__ import (print_function, unicode_literals, absolute_import,
division)
import json
import re
import six
import sys
channel_name_re = re.compile('\A[-a-zA-Z0-9_=@,.;]+\Z')
app_id_re = re.compile('\A[0-9]+\Z')
pusher_url_re = re.compile('\A(http|htt... | hkjallbring/pusher-http-python | pusher/util.py | Python | mit | 1,209 |
import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
httpd.serve_forever()
| sajjadt/opencvjs | test/serve.py | Python | mit | 185 |
import tensorflow.contrib.keras as keras
def pretrained(nc):
# input_tensor = keras.layers.Input(batch_shape=(None, 64, 64, 3))
# vgg = keras.applications.VGG16(input_tensor=input_tensor, input_shape=IMG_SHAPE, weights='imagenet', include_top=False)
vgg = keras.applications.VGG16(weights='imagenet', inclu... | kevinjos/planet-kaggle | code/planetmodels.py | Python | agpl-3.0 | 9,117 |
CONFIG = {
# 首页标题,类型:str
'INDEX_TITLE': 'zzir 的博客',
# 网站地址,类型:str,末尾不添加/
'HOST_URL': 'https://zzir.cn',
# 网站标题,类型:str
'HOST_TEXT': "zzir",
# 网站子标题,类型:str
'SUB_TEXT': '不畏将来, 不念过往. 如此, 安好!',
# 网站尾部信息,类型:str
'FOOTER_TEXT': '遇见你,很幸运~',
# 作者
'AUTHOR': 'zzir',
'EMAIL': 'me... | zzir/white | config.py | Python | mit | 2,108 |
# Copyright 2016 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... | strint/tensorflow | tensorflow/contrib/distributions/python/ops/relaxed_bernoulli.py | Python | apache-2.0 | 8,738 |
import paypalrestsdk.util as util
from paypalrestsdk.resource import List, Find, Delete, Create, Update, Post, Resource
from paypalrestsdk.api import default as default_api
class Invoice(List, Find, Create, Delete, Update, Post):
"""Invoice class wrapping the REST v1/invoices/invoice endpoint
Usage::
... | phimpme/generator | Phimpme/site-packages/paypalrestsdk/invoices.py | Python | gpl-3.0 | 1,077 |
# ########################## Copyrights and License #############################
# #
# Copyright 2016 Yang Fang <[email protected]> #
# ... | xiaofeiyangyang/physpetools | physpetool/tools/created16sdb.py | Python | gpl-3.0 | 3,893 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | ClearCorp/account-financial-tools | account_debt_management/__openerp__.py | Python | agpl-3.0 | 1,877 |
# -*- coding: utf-8 -*-
import importlib
import json
import os
import thread
from collections import OrderedDict
import django
from werkzeug.contrib.fixers import ProxyFix
import framework
import website.models
from framework.addons.utils import render_addon_capabilities
from framework.flask import app, add_handlers... | rdhyee/osf.io | website/app.py | Python | apache-2.0 | 5,397 |
#MenuTitle: Export CSV for Glyphs With Entry and Exit
# -*- coding: utf-8 -*-
__doc__="""
Creates a CSV file containing name of the glyph, the x and y distances, and the rectangle area between entry and exit anchors. Works for selected glyphs only.
"""
import GlyphsApp
thisFont = Glyphs.font # frontmost font
thisFont... | schriftgestalt/Mekka-Scripts | Arabic/Export CSV with Glyphs Containing Exit and Entry.py | Python | apache-2.0 | 1,984 |
from spdy.frames import *
from spdy._zlib_stream import Inflater, Deflater
from bitarray import bitarray
SERVER = 'SERVER'
CLIENT = 'CLIENT'
class SpdyProtocolError(Exception):
pass
def _bitmask(length, split, mask=0):
invert = 1 if mask == 0 else 0
b = str(mask)*split + str(invert)*(length-split)
return int(b, ... | colinmarc/python-spdy | python-spdy/context.py | Python | bsd-2-clause | 6,954 |
# -*- coding: utf-8 -*-
# Copyright 2010-2011, Google 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 code must retain the above copyright
# notice, this... | leighpauls/k2cro4 | third_party/mozc/session/gen_session_stress_test_data.py | Python | bsd-3-clause | 2,490 |
from el_rollastico.log import get_logger
_LOG = get_logger()
from el_rollastico.cluster import Cluster
import click
@click.group()
def cli():
pass
@cli.command()
@click.argument('master_node', nargs=1)
@click.option('--masters/--no-masters', default=False, help='Restart master nodes as well [false]')
@click.o... | vertical-knowledge/El-Rollastico | el_rollastico/__main__.py | Python | gpl-3.0 | 4,911 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.